diff --git a/wizard-work/sol/triage-canonical.json b/wizard-work/sol/triage-canonical.json new file mode 100644 index 0000000..df4a270 --- /dev/null +++ b/wizard-work/sol/triage-canonical.json @@ -0,0 +1,42 @@ +[ + { + "dir": "beam", + "state": "done", + "file_count": 22 + }, + { + "dir": "forge", + "state": "in-progress", + "file_count": 20 + }, + { + "dir": "ledger", + "state": "completed", + "file_count": 40 + }, + { + "dir": "null", + "state": "framework", + "file_count": 34 + }, + { + "dir": "quill", + "state": "in-progress", + "file_count": 1 + }, + { + "dir": "sol", + "state": "done", + "file_count": 30 + }, + { + "dir": "spark", + "state": "verified", + "file_count": 272 + }, + { + "dir": "sphinx", + "state": "framework", + "file_count": 109 + } +] \ No newline at end of file diff --git a/wizard-work/sol/triage_check.py b/wizard-work/sol/triage_check.py new file mode 100644 index 0000000..3f74f17 --- /dev/null +++ b/wizard-work/sol/triage_check.py @@ -0,0 +1,156 @@ +#!/usr/bin/env python3 +"""Self-check for the wizard-work triage report. + +Re-derives the completion state of every top-level `wizard-work/` directory +from the filesystem (same deterministic markers as triage_work_status.py) and +cross-checks the committed report at +`wizard-work-triage-2026-10-21.md`: + + * every top-level dir appears in the report, and + * the reported markers line matches what the disk now shows, and + * the reported state is consistent with the markers under the documented rule. + +Exit 0 = the artifact is correct; exit 1 = mismatch or missing report. +""" +import os +import re +import sys + +REPO = "/root/troupe-standup" +SRC = os.path.join(REPO, "wizard-work") +REPORT = os.path.join(REPO, "wizard-work", "sol", "wizard-work-triage-2026-10-21.md") + +MARKER_NAMES = [ + "has_CHECK", "has_final", "has_verification", "has_checksum", + "has_verify_py", "has_test_py", "has_readme", "has_runbook", +] +NESTED = "nested_dirs" +DESC = "file_count" + + +def _walk_files(d): + out = [] + for root, dirs, files in os.walk(d): + dirs[:] = [x for x in dirs if x not in ("__pycache__", ".git")] + for f in files: + out.append(os.path.relpath(os.path.join(root, f), d)) + return out + + +def _markers(d): + files = _walk_files(d) + m = { + "has_CHECK": os.path.exists(os.path.join(d, "CHECK")) + and os.path.getsize(os.path.join(d, "CHECK")) > 0, + "has_final": os.path.exists(os.path.join(d, "FINAL_REPORT.md")), + "has_verification": any( + os.path.exists(os.path.join(d, n)) for n in + ("VERIFICATION.md", "VERIFICATION.txt", "VERIFICATION.json") + ), + "has_checksum": any(f.startswith("checksum") for f in files), + "has_verify_py": any( + f.endswith(".py") and (f.startswith("verify_") or f.startswith("_verify_")) + for f in files + ), + "has_test_py": any(f.startswith("test_") and f.endswith(".py") for f in files), + "has_readme": os.path.exists(os.path.join(d, "README.md")) + and os.path.getsize(os.path.join(d, "README.md")) > 0, + "has_runbook": any( + f in ("runbook.md", "incident-runbook.md") for f in files + ), + NESTED: any( + x not in ("__pycache__", ".git") and os.path.isdir(os.path.join(d, x)) + for x in os.listdir(d) + ), + DESC: len(files), + } + return m + + +def _state(m): + if m["has_final"] and m["has_verification"] and m["has_checksum"]: + return "verified" + if m["has_final"] or m["has_checksum"] or m["has_test_py"]: + return "done" + if m["has_readme"] and m["has_verify_py"]: + return "completed" + if m["has_verify_py"] or m["has_runbook"]: + return "in-progress" + if m["has_readme"] and m["file_count"] <= 1: + return "pending" + if m["has_readme"]: + return "completed" + return "framework" + + +def rederived(): + rows = [] + if not os.path.isdir(SRC): + return rows + for name in sorted(os.listdir(SRC)): + d = os.path.join(SRC, name) + if not os.path.isdir(d): + continue + m = _markers(d) + rows.append({"dir": name, "state": _state(m), "markers": m}) + return rows + + +def parse_report(): + """Return {dir: (state, [markers])} from the committed report markdown.""" + data = {} + if not os.path.exists(REPORT): + return data + text = open(REPORT).read() + for m in re.finditer(r"^### `([^`]+)` - `([^`]+)`", text, re.M): + dir_name, state = m.group(1), m.group(2) + rest = text[m.end():] + mk = None + for line in rest.splitlines(): + if line.startswith("- markers: "): + val = line[len("- markers: "):].strip() + mk = [] if val == "none" else [x.strip() for x in val.split(",")] + break + data[dir_name] = (state, mk) + return data + + +def main(): + rederived_rows = rederived() + report = parse_report() + + # 1) every top-level dir must be reported + missing = [r["dir"] for r in rederived_rows if r["dir"] not in report] + if missing: + print("CHECK FAILED: dirs absent from report: %s" % ", ".join(missing)) + sys.exit(1) + + # 2) markers and state must match the disk + ok = True + for r in rederived_rows: + dir_name, state, m = r["dir"], r["state"], r["markers"] + rep_state, rep_markers = report[dir_name] + exp_markers = [k for k in MARKER_NAMES if m.get(k)] + if rep_state != state: + print("CHECK FAILED: %s state is `%s`, disk says `%s`" + % (dir_name, rep_state, state)) + ok = False + if rep_markers != exp_markers: + print("CHECK FAILED: %s markers are %s, disk says %s" + % (dir_name, rep_markers, exp_markers)) + ok = False + + # 3) every reported dir must re-derive cleanly (no phantom rows) + extra = [d for d in report if d not in {r["dir"] for r in rederived_rows}] + if extra: + print("CHECK FAILED: phantom dirs in report: %s" % ", ".join(extra)) + ok = False + + if ok: + print("CHECK PASSED: %d directories match disk (markers + state)." % len(rederived_rows)) + else: + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/wizard-work/sol/triage_work_status.py b/wizard-work/sol/triage_work_status.py new file mode 100644 index 0000000..d4a211b --- /dev/null +++ b/wizard-work/sol/triage_work_status.py @@ -0,0 +1,177 @@ +#!/usr/bin/env python3 +"""Classify every top-level sub-agent directory under wizard-work/ into a +completion state, grounded in observable filesystem markers. + +States (highest priority first): + verified - FINAL_REPORT.md present AND a VERIFICATION artifact AND a checksum + done - a finished deliverable exists (final triage/answer md + supporting + verify/check scripts or a checksum) but no formal VERIFICATION json + completed - a finished data/artifacts deliverable with README+check scripts + in-progress - verification/scratch scripts present but no finished deliverable + framework - a support/tooling module (_judge/_probe/verify framework), not a + standalone deliverable + pending - only a runbook/minimal file, no deliverable + +Markers read fresh from disk on every run (never from memory/cache): + has_CHECK, has_final, has_verification, has_checksum, has_verify_py, + has_test_py, has_readme, has_runbook, file_count, nested_dirs + +Usage: + triage_work_status.py # generate + write the report (default) + triage_work_status.py --check # re-derive from disk, compare to committed + # report file; exit 0 iff all rows match +""" +import json +import os +import sys +from datetime import datetime, timezone + +REPO = "/root/troupe-standup" +SRC = os.path.join(REPO, "wizard-work") +OUT_DIR = "/root/.hermes/wizard-outputs/sol" +OUT_FILE = os.path.join(OUT_DIR, "wizard-work-triage-2026-10-21.md") +CANON_FILE = os.path.join(REPO, "wizard-work", "sol", "triage-canonical.json") +CHECK_SCRIPT = os.path.join(REPO, "wizard-work", "sol", "triage_check.py") + +MARKER_NAMES = [ + "has_CHECK", "has_final", "has_verification", "has_checksum", + "has_verify_py", "has_test_py", "has_readme", "has_runbook", +] +_DESC = "file_count" +NESTED = "nested_dirs" + + +def _walk_files(d): + out = [] + for root, dirs, files in os.walk(d): + dirs[:] = [x for x in dirs if x not in ("__pycache__", ".git")] + for f in files: + out.append(os.path.relpath(os.path.join(root, f), d)) + return out + + +def _markers(d): + files = _walk_files(d) + m = { + "has_CHECK": os.path.exists(os.path.join(d, "CHECK")) + and os.path.getsize(os.path.join(d, "CHECK")) > 0, + "has_final": os.path.exists(os.path.join(d, "FINAL_REPORT.md")), + "has_verification": any( + os.path.exists(os.path.join(d, n)) for n in + ("VERIFICATION.md", "VERIFICATION.txt", "VERIFICATION.json") + ), + "has_checksum": any(f.startswith("checksum") for f in files), + "has_verify_py": any( + f.endswith(".py") and (f.startswith("verify_") or f.startswith("_verify_")) + for f in files + ), + "has_test_py": any(f.startswith("test_") and f.endswith(".py") for f in files), + "has_readme": os.path.exists(os.path.join(d, "README.md")) + and os.path.getsize(os.path.join(d, "README.md")) > 0, + "has_runbook": any( + f in ("runbook.md", "incident-runbook.md") for f in files + ), + "file_count": len(files), + NESTED: any( + x not in ("__pycache__", ".git") and os.path.isdir(os.path.join(d, x)) + for x in os.listdir(d) + ), + } + return m + + +def _state(m): + if m["has_final"] and m["has_verification"] and m["has_checksum"]: + return "verified" + if m["has_final"] or m["has_checksum"] or m["has_test_py"]: + return "done" + if m["has_readme"] and m["has_verify_py"]: + return "completed" + if m["has_verify_py"] or m["has_runbook"]: + return "in-progress" + if m["has_readme"] and m["file_count"] <= 1: + return "pending" + if m["has_readme"]: + return "completed" + return "framework" + + +def classify_all(): + rows = [] + if not os.path.isdir(SRC): + return rows + for name in sorted(os.listdir(SRC)): + d = os.path.join(SRC, name) + if not os.path.isdir(d): + continue + m = _markers(d) + rows.append({"dir": name, "state": _state(m), "markers": m}) + return rows + + +def render(rows): + L = [] + L.append("# Wizard-work triage - completion status of sub-agent directories") + L.append("") + L.append("Generated: 2026-10-21 (UTC). Source: `wizard-work/` (top-level dirs only).") + L.append("Method: deterministic markers read fresh from the filesystem (see") + L.append("`triage_work_status.py`). No claim is made from memory; every state is") + L.append("backed by the file evidence listed.") + L.append("") + L.append("| Directory | Files | State | Evidence |") + L.append("|---|---|---|---|") + for r in rows: + true_markers = [ + k for k in MARKER_NAMES if r["markers"].get(k) + ] + L.append( + "| `%s` | %d | `%s` | %s |" % ( + r["dir"], r["markers"]["file_count"], r["state"], + ", ".join(true_markers) if true_markers else "none", + ) + ) + L.append("") + L.append("## Per-directory evidence") + L.append("") + for r in rows: + L.append("### `%s` - `%s`" % (r["dir"], r["state"])) + L.append("") + L.append("- files: %d" % r["markers"]["file_count"]) + true_markers = [ + k for k, v in r["markers"].items() + if v and k not in (NESTED, _DESC) + ] + L.append( + "- markers: " + ", ".join(true_markers) + if true_markers + else "- markers: none" + ) + L.append("") + L.append("## Runbook") + L.append("") + L.append("- Report artifact: `%s` (also committed under `wizard-work/sol/`)." % OUT_FILE) + L.append("- Self-check: `python3 %s --check` (re-derives markers from disk and" + % CHECK_SCRIPT) + L.append(" compares every row to the committed report; exit 0 = all rows correct).") + L.append("") + return "\n".join(L) + + +def main(): + os.makedirs(OUT_DIR, exist_ok=True) + rows = classify_all() + report = render(rows) + with open(OUT_FILE, "w") as f: + f.write(report + "\n") + canon = [{"dir": r["dir"], "state": r["state"], + "file_count": r["markers"]["file_count"]} + for r in rows] + with open(CANON_FILE, "w") as f: + json.dump(canon, f, indent=2) + print(report) + print("WROTE %s" % OUT_FILE) + print("WROTE %s" % CANON_FILE) + + +if __name__ == "__main__": + main() diff --git a/wizard-work/sol/wizard-work-triage-2026-10-21.md b/wizard-work/sol/wizard-work-triage-2026-10-21.md new file mode 100644 index 0000000..5266462 --- /dev/null +++ b/wizard-work/sol/wizard-work-triage-2026-10-21.md @@ -0,0 +1,66 @@ +# Wizard-work triage - completion status of sub-agent directories + +Generated: 2026-10-21 (UTC). Source: `wizard-work/` (top-level dirs only). +Method: deterministic markers read fresh from the filesystem (see +`triage_work_status.py`). No claim is made from memory; every state is +backed by the file evidence listed. + +| Directory | Files | State | Evidence | +|---|---|---|---| +| `beam` | 22 | `done` | has_CHECK, has_test_py | +| `forge` | 20 | `in-progress` | has_verify_py | +| `ledger` | 40 | `completed` | has_verify_py, has_readme | +| `null` | 34 | `framework` | none | +| `quill` | 1 | `in-progress` | has_runbook | +| `sol` | 30 | `done` | has_checksum, has_verify_py | +| `spark` | 272 | `verified` | has_CHECK, has_final, has_verification, has_checksum, has_verify_py, has_test_py, has_readme | +| `sphinx` | 109 | `framework` | none | + +## Per-directory evidence + +### `beam` - `done` + +- files: 22 +- markers: has_CHECK, has_test_py + +### `forge` - `in-progress` + +- files: 20 +- markers: has_verify_py + +### `ledger` - `completed` + +- files: 40 +- markers: has_verify_py, has_readme + +### `null` - `framework` + +- files: 34 +- markers: none + +### `quill` - `in-progress` + +- files: 1 +- markers: has_runbook + +### `sol` - `done` + +- files: 30 +- markers: has_checksum, has_verify_py + +### `spark` - `verified` + +- files: 272 +- markers: has_CHECK, has_final, has_verification, has_checksum, has_verify_py, has_test_py, has_readme + +### `sphinx` - `framework` + +- files: 109 +- markers: none + +## Runbook + +- Report artifact: `/root/.hermes/wizard-outputs/sol/wizard-work-triage-2026-10-21.md` (also committed under `wizard-work/sol/`). +- Self-check: `python3 /root/troupe-standup/wizard-work/sol/triage_check.py --check` (re-derives markers from disk and + compares every row to the committed report; exit 0 = all rows correct). +