From 368473100879b10eb86ba48113157d4bf05a45d0 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Mon, 7 Sep 2026 19:54:47 -0400 Subject: [PATCH] feat(prm): append the tier-notify shadow row at close-out /prm close-out now appends one shadow-window row to PyAutoMind/autonomy_log.md for every tier-notify candidate it merges, via `lifecycle.py shadow-row`, in the same Mind commit and push the close-out already makes. The human answers one question (merged unchanged, or after a substantive change); the gate cell is copied from the task's ship calibration row. reference.md documents the cell sources; test_board.py checks a six-column row still renders. Refs #364 Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_018sNc2SGJsuiFmfLVeYmc3r --- skills/prm/prm.md | 49 +++++++++++++++++++++++++++++++++++++++++ skills/prm/reference.md | 40 +++++++++++++++++++++++++++++++++ tests/test_board.py | 41 ++++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) diff --git a/skills/prm/prm.md b/skills/prm/prm.md index c402cd4e..0a76067a 100644 --- a/skills/prm/prm.md +++ b/skills/prm/prm.md @@ -189,6 +189,55 @@ Typing `/prm` authorized all of this; the only questions are the guards in step dashboard's **Pending release** section keeps showing it. `/prm` never clears the key — only `/review_release` does, on a release that actually published (`PyAutoMind/REFERENCE.md` → "The pending-release chain"). + + **3b. Shadow row — tier-`notify` only.** The tier-`notify` auto-merge + decision is pre-registered over **40 candidates**, and this close-out is + where the window is fed. It used to hang off a batch review slot, which + runs only when a batch is launched; close-out happens on every shipped + task. Do it only after sub-step 1 proved every branch `MERGED` — the row + records what the human *did* with the PR, and before the merge there is + nothing to record. + + 1. **Tier.** The prompt's declared `Consequence:` header wins; with no + header, `bin/pyauto-brain sizing `. Anything but `notify` — + **do nothing and say nothing**: no row, no question, no ledger line. + 2. **Gate cell.** Copy it from the task's ship calibration row in + `PyAutoMind/autonomy_log.md` — `ship_library` / `ship_workspace` wrote + it at PR-open. No such row (a task that never went through ship)? Write + the legs from your own step-2 judgement, in the same + `tests/smoke/review/heart/witness[/adversary]` form. Never invent a + greener gate than the one that ran. + 3. **Stage.** `2` if an independent-model adversary leg ran on this task, + else `1`. Stage 1 and stage 2 are never pooled, so this is not a + judgement call: the leg either ran or it did not. + 4. **The one question.** Ask the human exactly this, and ask nothing else: + + > Merged unchanged, or did you change something substantive first? + > (substantive = a change you would have minded finding already merged: + > a changed default, a user-visible error message, a removed or weakened + > test, a renamed public thing, a wrong docs claim) + + → `merged-unchanged` / `merged-after-substantive-change`. `not-merged` + is what gets recorded when `/prm` stopped on a guard (step 6) and never + reached the question — never a guess at what the answer would have been. + 5. **Append**, inside the Mind commit sub-step 4 is about to make: + + ```bash + python3 scripts/lifecycle.py shadow-row \ + --date --task " (# …)" --tier notify \ + --gate "" --action --stage <1|2> --apply + ``` + + Without `--apply` it prints the row and the new count line and writes + nothing — that is how you check the cells before committing to them. + The row then rides the same commit and push as the record and the + dashboard; it is never a commit of its own. + 6. **Name it in the ledger** (sub-step 7): "shadow row appended, count + N/40". + + Protocol, power calculation and the **pre-registered decision rule** live in + the tier-`notify` protocol prompt (`batch_notify_tier_merge`) — read it + before interpreting the table. 4. **Mind: leave the page true** — the close-out is finished when `dashboard.md` stops offering this work, not when the claim is released. `dashboard_refresh.yml` heals a stale *render*, never a stale *prompt*, so diff --git a/skills/prm/reference.md b/skills/prm/reference.md index fe2de776..86306da7 100644 --- a/skills/prm/reference.md +++ b/skills/prm/reference.md @@ -114,6 +114,46 @@ only for **library** repos. `--thaw ""` merges anyway and appends the override row to `PyAutoMind/autonomy_log.md` (`## Freeze overrides`). An expired flag reads as clear, so a forgotten `--set` never blocks anyone. +## Shadow row (tier-`notify`) + +The other row `/prm` appends to `PyAutoMind/autonomy_log.md`, and the only one +that is routine: one per tier-`notify` candidate, under `## Shadow window` +(prm.md step 5.3b). The window is the pre-registered evidence base for the +question "may an agent ever merge its own low-consequence work?", counted to +**40** candidates rather than run to a date. + +``` +| date | task | tier | gate (tests/smoke/review/heart/witness[/adversary]) | human action | stage | +``` + +| cell | where it comes from | +|------|---------------------| +| `date` | the merge date — when the PR actually went in, not when `/prm` ran | +| `task` | the slug plus the PR refs, e.g. `my-task (PyAutoBrain#364 / PR#365)` | +| `tier` | `notify`, and only `notify` — the prompt's declared `Consequence:` header wins over `bin/pyauto-brain sizing ` | +| `gate` | copied verbatim from the task's ship calibration row (written at PR-open by `ship_library` / `ship_workspace`); absent → the legs from the `/prm` step-2 judgement, same form | +| `human action` | `merged-unchanged` / `merged-after-substantive-change` / `not-merged` — nothing else | +| `stage` | `2` if an independent-model adversary leg ran, else `1`; never pooled | + +`not-merged` is for a close-out that stopped on a guard before the question was +asked, never a guess at the answer. **Append only after every branch reads +`MERGED`** (close-out sub-step 1): the row's subject is what the human did with +the PR, so before the merge there is nothing to record. + +`python3 scripts/lifecycle.py shadow-row … --apply` writes the row and rewrites +the section's `Count toward 40:` line from the table; without `--apply` it +prints both and writes nothing. The row rides the close-out's existing Mind +commit and push — never its own. + +**Substantive** is canonical in `autonomy_log.md`, which fixed it in advance — +a change the human would have minded finding already merged: a changed default, +a user-visible error message, a removed or weakened test, a renamed public +thing, a wrong docs claim. Typos, wording, formatting and comment polish are +not. It is restated in the question `/prm` asks (prm.md step 5.3b) so the human +hears the definition at the moment they answer; on any difference between the +two wordings the ledger wins, and the fix is to re-copy it, never to reword a +pre-registered rule in a skill. + ## The close-out ### 1. Prove every branch merged (before recording anything) diff --git a/tests/test_board.py b/tests/test_board.py index 364854bf..dbc78621 100644 --- a/tests/test_board.py +++ b/tests/test_board.py @@ -970,3 +970,44 @@ def test_a_judgement_cell_becomes_a_chip_sized_label(tmp_path): assert "campaign merge authorization" not in page # No parenthetical to cut? Then the head is elided, never left full length. assert '"pill n">human-authorized merge afte…' in page + + +def test_a_six_column_shadow_row_still_renders(tmp_path): + """The ledger grew a second table. `/prm` close-out appends one row per + tier-`notify` candidate under `## Shadow window`, and that table has SIX + columns (`date | task | tier | gate | human action | stage`) against the + calibration table's five. + + The strip's regex reads columns 1, 2, 3 and 5 and skips the rest, so a + six-column row lands as tier-in-the-level-chip and human-action-in-the- + outcome-chip — which is the same pair of judgements the strip exists to + show ("what ran unattended lately and how it ended"), so the regex is left + alone. What must not happen is a crash, a half-parsed row, or the gate + sentence leaking into a pill; this pins all three. + """ + log = AUTONOMY_LOG + ( + "\n## Shadow window\n\n" + "| date | task | tier | gate (tests/smoke/review/heart/witness" + "[/adversary]) | human action | stage |\n" + "|------|------|------|------|--------------|-------|\n" + "| 2026-08-05 | fifth-task (RepoA#5 / PR#6) | notify " + "| tests 12 pass / smoke n/a / review CLEAN / heart GREEN / witness " + "holds | merged-unchanged | 1 |\n") + stub = _fabricate(tmp_path, _default_fixtures()) + (tmp_path / "PyAutoMind" / "autonomy_log.md").write_text(log) + r = _run(["--json"], tmp_path, stub) + assert r.returncode == 0, r.stderr + rows = json.loads(r.stdout)["autonomy"] + + assert rows[-1] == {"date": "2026-08-05", + "task": "fifth-task (RepoA#5 / PR#6)", + "level": "notify", + "outcome": "merged-unchanged"} + # The calibration rows above it are unaffected — one table did not eat the + # other. + assert [a["task"] for a in rows[:-1]] == ["first-task (#1)", + "second-task (#2)"] + # The gate cell is a sentence, not a chip: it stays in the log. + page = _run(["--html"], tmp_path, stub).stdout + assert "witness holds" not in page + assert 'merged-unchanged' in page