diff --git a/AGENTS.md b/AGENTS.md index 703acec6..23b86adc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -171,7 +171,8 @@ via `/route`, and it routes to the right agent; normal usage never says work-type fixed (no dedicated conductor — added only on demonstrated need, never for symmetry); `/prm` composes the end-of-task close-out (CI green → merge → issue closed → Mind `active/` → -`complete/` → worktree and branches removed); `/brain +`complete/` → dashboard reconciled and regenerated → worktree and branches +removed); `/brain ` is the raw passthrough. Every command routes **through** the Brain; none replaces it. diff --git a/skills/COMMANDS.md b/skills/COMMANDS.md index 4bcae7a9..37aad23a 100644 --- a/skills/COMMANDS.md +++ b/skills/COMMANDS.md @@ -89,9 +89,14 @@ call, so the Brain is not bypassed): checks until **every** workflow run and **every** matrix leg for the head sha is green, merges in library-first order, then closes the task out end to end: Shipped comment, issue closed, `lifecycle.py record` moving the prompt - `active/` → `complete/` (claim released, Mind pushed), `worktree_remove`, merged - branches deleted, and a ledger of what it did. Typing `/prm` authorizes all of - it, so it does not stop to ask again. Owns no gate of its own — it refuses on + `active/` → `complete/` (claim released, Mind pushed), the Mind's + `dashboard.md` reconciled and regenerated in that same commit, + `worktree_remove`, merged branches deleted, and a ledger of what it did. + Typing `/prm` authorizes all of it, so it does not stop to ask again. The + dashboard leg is the one thing here nothing else covers: `dashboard_refresh.yml` + self-heals a stale *render*, never a prompt the merge finished and nobody + retired, so a close-out that skips it is how shipped and half-shipped tasks + pile up on the page as pickable backlog. Owns no gate of its own — it refuses on red/pending/conflicting checks, an unmerged upstream library PR, an unmerged sibling branch (the shipped-in-waves trap), or a `worktree_remove` refusal, and asks exactly once before deleting a worktree holding irreplaceable data diff --git a/skills/prm/SKILL.md b/skills/prm/SKILL.md index eb8d859d..b3d5a69a 100644 --- a/skills/prm/SKILL.md +++ b/skills/prm/SKILL.md @@ -1,6 +1,6 @@ --- name: prm -description: The last thing you type for a task — "PR, CI green, then merge", then the full close-out. Watches a feature PR's checks until every workflow run and every matrix leg is green, merges (library-first gate honoured), closes the issue, moves the PyAutoMind prompt active/ → complete/, removes the task worktree and deletes the merged branches. Use when the user says merge this PR once CI is green, close this task out, or types /prm. Runs anywhere gh is authenticated: CLI, mobile Claude Code chat, Codex. +description: The last thing you type for a task — "PR, CI green, then merge", then the full close-out. Watches a feature PR's checks until every workflow run and every matrix leg is green, merges (library-first gate honoured), closes the issue, moves the PyAutoMind prompt active/ → complete/, reconciles and regenerates the Mind dashboard, removes the task worktree and deletes the merged branches. Use when the user says merge this PR once CI is green, close this task out, or types /prm. Runs anywhere gh is authenticated: CLI, mobile Claude Code chat, Codex. --- # /prm — PR, CI green, then merge, then close the task out @@ -10,8 +10,9 @@ Follow [`prm.md`](prm.md) exactly; gh + close-out mechanics in Composition door — it owns no agent and re-derives nothing: the merge gates come from `/ship_library` / `/ship_workspace`, the CI verdict from GitHub Actions, the -lifecycle from PyAutoMind. Typing `/prm` authorizes the **whole** close-out — -merge, issue close, `active/` → `complete/`, worktree and branch removal — so it -runs to the end without asking again. It still refuses on red, pending, +lifecycle from PyAutoMind, the dashboard render from `/intake`. Typing `/prm` +authorizes the **whole** close-out — merge, issue close, `active/` → +`complete/`, the dashboard reconciled and regenerated, worktree and branch +removal — so it runs to the end without asking again. It still refuses on red, pending, conflicting, an unmerged upstream library PR, or an unmerged sibling branch, and asks once before deleting a worktree that holds irreplaceable data products. diff --git a/skills/prm/prm.md b/skills/prm/prm.md index 7bcf9e08..38128971 100644 --- a/skills/prm/prm.md +++ b/skills/prm/prm.md @@ -3,8 +3,9 @@ The end-of-task shortcut for "PR CI green then merge" — and the **full task close-out**: the last thing you type for a task. It watches the feature PR's checks, merges the moment they are genuinely green, then closes the task out -completely — issue closed, PyAutoMind moved `active/` → `complete/`, worktree -removed, branches deleted — and hands back a ledger of what it did. +completely — issue closed, PyAutoMind moved `active/` → `complete/`, the Mind's +`dashboard.md` reconciled and regenerated, worktree removed, branches deleted — +and hands back a ledger of what it did. Shared routing context: `PyAutoBrain/skills/COMMANDS.md`. gh mechanics + snippets: [`reference.md`](reference.md). @@ -15,8 +16,11 @@ Every rule here already has an owner. The merge gates belong to [`../ship_library/ship_library.md`](../ship_library/ship_library.md) and [`../ship_workspace/ship_workspace.md`](../ship_workspace/ship_workspace.md) (library-first gate, issue completion, Mind state); the verdict belongs to GitHub -Actions. `/prm` only sequences them. It never re-runs the readiness gate, never -edits code to make a check pass, and never opens a PR — that is `/ship_*`. +Actions; the lifecycle moves belong to `PyAutoMind/scripts/lifecycle.py` and the +dashboard render to [`../intake/intake.md`](../intake/intake.md). `/prm` only +sequences them. It never re-runs the readiness gate, never edits code to make a +check pass, never opens a PR — that is `/ship_*` — and never hand-writes a +generated page. ## Usage @@ -122,27 +126,87 @@ step 6. Order is forced by the tooling, so do not reorder: `lifecycle.py record --date … --from-file … --prompt --apply`. The `--prompt` argument is a **bare filename**; a path silently no-ops. Verify all three effects (record has `## Original prompt`, the - `active/` prompt is gone, the `## ` entry left `active.md`), run - `lifecycle.py check`, then commit and push Mind — on `main`, and note that - `prompt_sync_push` stages `-A`, so check for unrelated work first. -4. **Worktree** — `worktree_remove ` (source `bin/worktree.sh`, `PYAUTO_MAIN` + `active/` prompt is gone, the `## ` entry left `active.md`). + + **Record the scope you merged, not the scope you filed.** Where the merged + PRs cover only part of what the prompt asked for — one phase of a campaign, + three of five findings — neither recording the whole prompt complete nor + leaving the whole prompt in `active/` is true. Record what shipped, and + re-file the remainder as a fresh `draft///` prompt whose + header points back at the record. A prompt recorded whole on a partial merge + is exactly what puts a half-done task on the dashboard as pickable backlog. +4. **Mind: leave the page true** — the close-out is not finished when the claim + is released; it is finished when `dashboard.md` stops offering this work. + `dashboard_refresh.yml` self-heals a stale *render*, never a stale *prompt*, + so this leg belongs to `/prm` and to nothing else — skipping it is how + shipped and half-shipped tasks accumulate on the page. + + Legs 1 and 2 are judgement and may find nothing. **Leg 3 is a command, and it + runs on every close-out that touched Mind at all** — including the ordinary + one where the sweep is clean and no sibling is retired. Moving a prompt + `active/` → `complete/` changes the page by itself; a close-out that recorded + the task and did not re-render has left the page wrong. There is no "nothing + changed" exit from leg 3, only a `--check` that says the render is current. + + 1. **Sweep what this task is named in.** Grep the slug and the prompt + filename across `draft/`, `active/`, `epics.md` and the registry files. + Repoint or remove every hit the merge falsified: a `blocked-by:` this PR + unblocked, an epic phase now done, a `superseded-by:` chain that now ends + in a record. + 2. **Reconcile the neighbourhood.** Run `pyauto-brain intake reconcile + draft//` over the folder the shipped prompt came from, + plus any folder the merged diff lands in — folder-scoped it is a handful + of prompts, not the 130-odd of the whole backlog. Then: **proof retires, + resemblance reports.** A sibling the merge provably covers — its issue + closed by this PR, its scope inside the record you just wrote, a merged PR + named in its own body — gets its own record and `git rm` under the same + `/prm` authorization. One that merely *looks* alike gets a ledger line + naming it and the `/intake reconcile` door; never retire on resemblance, + and never turn this sweep into a second question (step 6 owns the only one). + 3. **Regenerate — always.** Two commands, in this order, no condition on + either: + + ```bash + pyauto-brain intake --apply dashboard # writes dashboard.md + dashboard.html + pyauto-brain intake dashboard --check # must print "…are current" + ``` + + Never hand-edit `dashboard.md` / `dashboard.html`. Commit the render + **with** the record, in one commit: the workflow's heal commit is made + with `GITHUB_TOKEN`, which triggers no other workflow and has to + re-dispatch `pages_dashboard.yml` by hand, so a self-healed page reaches + Pages later than a correctly-committed one — and heals nothing you retired + in 1 and 2. + + Then `lifecycle.py check` and push Mind — on `main`, and note that + `prompt_sync_push` stages `-A`, so check for unrelated work first. The push + is not the end of the leg: `git show --stat HEAD` must name `dashboard.md` + and `dashboard.html` alongside the record, or leg 3 did not happen. +5. **Worktree** — `worktree_remove ` (source `bin/worktree.sh`, `PYAUTO_MAIN` set), never `rm -rf`. It refuses on a dirty repo and on a claim still registered in `active.md` — which is exactly why step 3 comes first. -5. **Branches** — delete the remote `feature/` per proven-merged repo, plus +6. **Branches** — delete the remote `feature/` per proven-merged repo, plus any local branch left in the canonical checkout. Never delete a branch whose merge you did not prove in sub-step 1. **Where the environment cannot delete remote refs** (proxied web session, above), this sub-step does not exist: attempt nothing, and report nothing about it. `/repo_cleanup` finds those branches on origin by itself, so silence here loses nothing. -6. **Report the ledger** — PRs merged, issue closed, record path, `active.md` - released, worktree removed, branches deleted, and anything skipped. Branches - are simply absent from the ledger where sub-step 5 did not apply. +7. **Report the ledger** — PRs merged, issue closed, record path, `active.md` + released, **dashboard regenerated** (plus any sibling prompt retired, and any + suspect left standing with its `/intake reconcile` prefix), worktree removed, + branches deleted, and anything skipped. Branches are simply absent from the + ledger where sub-step 6 did not apply. The dashboard line is not optional + prose: if you cannot write it, leg 4.3 did not run — go back and run it. **Remote (mobile/codex):** sub-steps 1 and 2 run over `gh`/`git ls-remote` as usual. Mind (3) works if PyAutoMind is checked out; otherwise say the record is -pending. The worktree (4) is local-only — name it as outstanding rather than -implying it ran. Branches (5) delete normally from mobile and Codex; a proxied -web session drops the sub-step silently. +pending. The dashboard leg (4) needs **both** checkouts — the state is Mind's, +the renderer is Brain's; with only Mind, do its sweep and reconcile legs and say +the render +is left to `dashboard_refresh.yml`; with neither, say the whole leg is pending +rather than implying the page is true. The worktree (5) is local-only — name it +as outstanding rather than implying it ran. Branches (6) delete normally from +mobile and Codex; a proxied web session drops the sub-step silently. ### 6. The only guards that stop you @@ -166,4 +230,8 @@ Stop and report instead of pressing on when: - Under a `--auto` workflow run, merge stays human: `/prm` is a human-typed door and is never invoked by the autonomous queue. - A task with no issue, no Mind prompt, or no worktree (a direct wiring change, - say) simply skips those sub-steps and says so — it is not an error. + say) simply skips those sub-steps and says so — it is not an error. That + licence does **not** extend to the dashboard regen: it is skippable only where + the close-out wrote nothing to Mind at all. Re-rendering an already-current + tree is a no-op that leaves `git status` clean, so when in doubt, run it — + the cheap mistake is the redundant render, not the stale page. diff --git a/skills/prm/reference.md b/skills/prm/reference.md index bb1c2792..5b09251f 100644 --- a/skills/prm/reference.md +++ b/skills/prm/reference.md @@ -152,15 +152,126 @@ grep -n "^## " active.md # want no match python3 scripts/lifecycle.py check # want clean exit ``` +Do **not** commit yet — the dashboard leg below belongs in the same commit. + +`lifecycle.py check` will not catch the partial-ship case: it compares +`active.md` slugs against `complete/` records and knows nothing about how much +of a prompt's scope the merge actually covered. That judgement is yours. Where +the merge covered part of it, write the record for the shipped part and re-file +the rest before committing: + +```bash +# the remainder, as a fresh backlog prompt pointing back at the record +cat > draft///.md <<'EOF' +# + +- Status: split out of `` at close-out — phases 1-2 shipped in + `complete///.md` (); this is what remains. +... +EOF +``` + +### 4. Mind: leave the page true + +`dashboard.md` / `dashboard.html` are generated from `draft/`, `active/` and the +registry files. `dashboard_refresh.yml` re-renders them on any push touching +those paths, so the *render* self-heals — but a prompt the merge finished and +nobody retired renders faithfully, as pickable backlog. That is the drift this +step exists for, and `intake reconcile` measures it: the whole-backlog run on +2026-08-25 ranked **24 suspects of 138 scanned** while the page itself was +current. + +**Sweep what this task is named in** — the merge falsifies more than its own +prompt: + +```bash +cd $PYAUTO_MAIN/PyAutoMind +grep -rn "\|" draft/ active/ epics.md \ + active.md planned.md parked.md condemned.md +``` + +Repoint or remove each hit: a `blocked-by:` this PR unblocked, an epic phase now +done, a `superseded-by:` chain that now ends in a record. + +**Reconcile the neighbourhood** — folder-scoped, not whole-backlog. Both are +fast (~5s bare, <1s scoped); the cost is *adjudication*, not runtime. The bare +run hands you 24 suspects spanning work this task never touched, none of which +`/prm` has proof for — a backlog chore, and incompatible with running to the end +without asking. A folder is the handful this merge could plausibly have +finished: + +```bash +BRAIN=$PYAUTO_MAIN/PyAutoBrain/agents/conductors/intake/_intake.py +python3 "$BRAIN" --mind . reconcile draft// +``` + +It is **read-only by design**: `--apply` is ignored with *"intake reconcile is +read-only — retiring prompts stays human"*, and the emit closes with the same +rule. Under `/prm` that human authorization is the typed `/prm` — but it extends +only as far as *proof*: + +| Evidence | Action | +|---|---| +| The sibling's issue was closed by this PR (`Closes #N`), or its scope sits inside the record you just wrote, or its own body names a now-merged PR | Write its record (`lifecycle.py record …`), `git rm` the prompt, repoint references | +| `shared-identifiers` / `rare-topic-overlap` / `stale-status` only | Leave it filed; name it in the ledger with the prefix to re-run | + +`record` serves a `draft/` prompt too, with one catch: `--prompt` resolves under +`active/` only, so the fold does not happen — append the draft's full text under +a `## Original prompt` heading in the `--from-file` body yourself, then `git rm` +the draft. Everything else (`complete/index.md`, the `active.md` prune) is +folded into `record` already. + +**Why this is a skill step and not a `record` step.** Two chores that used to sit +here were folded into `lifecycle.py record` precisely because a separate step was +easy to forget — `complete/index.md` and the `active.md` prune, both after their +own drift-alarm email storms. The dashboard cannot follow them: the state is +Mind's but the renderer is Brain's (`agents/conductors/intake/_intake.py`), and a +Mind script importing a Brain module inverts the organ boundary — which is why +`dashboard_refresh.yml` checks out both repos to do it. So the render stays a +step someone has to take, and `/prm` is the door that takes it. + +**Regenerate, and commit the render with the record.** Unconditional — the +sweep and the reconcile above may both come back empty, this does not: +`lifecycle.py record` alone changes what the page shows. + +```bash +python3 "$BRAIN" --mind . --apply dashboard # writes dashboard.md + dashboard.html +python3 "$BRAIN" --mind . dashboard --check # "…are current"; exit 1 = drift +python3 scripts/lifecycle.py check +``` + +Or through the router, identically — `pyauto-brain intake --apply dashboard` and +`pyauto-brain intake dashboard --check`; use whichever the environment resolves. + +Running it on an already-current tree is a **no-op**: the renderer rewrites both +files byte-identically and `git status` stays clean, so there is never a reason +to guess whether it is needed. `--apply` prints +`Wrote: dashboard.md + dashboard.html ( prompts, hygiene flag(s))`. + +`--check` exits **1** for drift and anything higher for a renderer failure +(Brain/Mind version skew) — a non-1 code is not a stale page, so read the +message rather than re-rendering. + Then commit + push. `prompt_sync_push` runs `git add -A`, so check for unrelated work first and use explicit pathspecs if any exists: ```bash git status --short # unrelated work? source scripts/prompt_sync.sh && prompt_sync_push "complete: " +git show --stat HEAD # names dashboard.md + dashboard.html? ``` -### 4. Worktree +That last line is the leg's own check: a close-out commit that does not carry +`dashboard.md` and `dashboard.html` beside the record did not regenerate, and +the ledger's dashboard line would be a claim you cannot back. + +One commit carrying the record, the retirements and the regenerated pages is the +goal. The workflow's fallback is strictly worse: its heal commit is made with +`GITHUB_TOKEN`, which triggers no other workflow, so it must dispatch +`pages_dashboard.yml` itself for the Pages site to catch up — and it can only +heal the render, never the retirements from the sweep above. + +### 5. Worktree Removal deletes the whole task root — **including gitignored `output/`, `cache/`, and downloaded data** that only live there (a reduced dataset + a @@ -187,7 +298,7 @@ needs it. A `PyAutoLabs-wt//` dir whose worktrees are already gone survive of symlinks + `activate.sh` and `git worktree list` will not name it — a directory listing is the only way to find it. -### 5. Branches +### 6. Branches Local branches go with the worktree; the remote ones do not. **First establish whether this environment may delete remote refs at all** — one probe, once per @@ -237,11 +348,22 @@ to work, treat it as the proxied case from that point on: **stop after the first refusal** and drop the sub-step — do not repeat the push per repo, and do not narrate the failure. -### 6. The ledger +### 7. The ledger Report, per line: PR(s) merged (URL + `MERGED`), issue closed (number + state), -record path under `complete///`, `active.md` claim released, worktree -removed, branches deleted, and **anything skipped** with the reason. A close-out -that quietly skipped a step reads exactly like one that finished — with one -deliberate exception: a sub-step the environment makes impossible (step 5 behind -the proxy) is omitted outright rather than reported as skipped. +record path under `complete///`, `active.md` claim released, the +dashboard regenerated (and any sibling prompt retired, and any suspect left +standing with the prefix to re-run), worktree removed, branches deleted, and +**anything skipped** with the reason. A close-out that quietly skipped a step +reads exactly like one that finished — with one deliberate exception: a sub-step +the environment makes impossible (step 6 behind the proxy) is omitted outright +rather than reported as skipped. + +The dashboard lines carry the drift, so give them numbers rather than a verb: + +``` +dashboard: regenerated (dashboard.md + dashboard.html, same commit as the record) + retired: draft/bug/priors/15_transformed_message_logpdf_jacobian.md — PyAutoFit#1498 merged, scope inside this record + standing: draft/bug/priors/14_replace_transform_stack_with_bijectors.md — resemblance only + → /intake reconcile draft/bug/priors +```