Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 100 additions & 9 deletions AUTONOMY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Where the dev workflow stops for a human today:
| 1 | **Plan approval** — present the plan, wait for explicit approval before any edit | `start_dev` (Plan Mode) |
| 2 | **Ship PR sign-off** — review of `## API Changes` / `## Scripts Changed` before commit/push/PR | `ship_library` / `ship_workspace` |
| 3 | **Heart YELLOW acknowledgement** — warnings surfaced, proceed only on explicit go-ahead | ship gate (`skills/WORKFLOW.md` "Heart readiness gate") |
| 4 | **Merge / issue close** — offered after shipping, never automatic | post-ship |
| 4 | **Merge / issue close** — by the declared `Consequence:` tier: `notify` / `glance` merged in-turn by the shipping session on green CI; `judge` or undeclared offered after shipping, never automatic ("Merge authority follows Consequence", 2026-10-02) | post-ship / `/prm` |
| 5 | **Version ask** — the minor-version choice | `pre_build` |
| 6 | **Post-merge cleanup confirmation** — worktree removal, branch deletion, registry moves | `ship_*` cleanup |

Expand All @@ -32,7 +32,7 @@ Where the dev workflow stops for a human today:
| Ship PR sign-off | proceed through the autonomous-ship gate; end at PR-open | park (`awaiting-input`), question to the issue, continue elsewhere — except under an explicit `--auto` launch, where it resolves to decide-and-flag (below; 2026-09-07) | present + wait |
| Heart YELLOW | park, unless the reason set was human-acknowledged at launch (see the autonomous-ship gate) | same as `safe` | present + wait |
| Heart RED | stop, report | stop, report | stop, report — a live human may separately invoke the development override or corrective-PR exception below; neither is an autonomy level |
| Merge / close | human, always | human, always | human, always |
| Merge / close | by declared `Consequence:` (2026-10-02 section) | by declared `Consequence:` | by declared `Consequence:` |
| Version ask | n/a — release stays `human-required` (sole exception: the scheduled-nightly standing grant, dated below) | n/a | ask |
| Cleanup | proceed + log | proceed + log | confirm |

Expand Down Expand Up @@ -240,8 +240,9 @@ An interactive `supervised` run parks at ship sign-off exactly as above —
the human is one message away, so the round-trip is free. Under an explicit
`--auto` launch the ship checkpoint instead resolves to **decide-and-flag**
(next section, extended to it 2026-09-07): the run ships to an open PR and the
decision is flagged there. Merge stays a human act either way, and no run ever
bypasses the gate — checkpoint-and-continue frees the human's session, not the
decision is flagged there. A `decision-taken` PR is never auto-merged — its
merge stays a human act whatever its tier ("Merge authority follows
Consequence"), and no run ever bypasses the gate — checkpoint-and-continue frees the human's session, not the
checkpoint.

### Decide-and-flag (`--auto` launches) — 2026-08-30, extended 2026-09-07
Expand Down Expand Up @@ -443,6 +444,88 @@ own `batches/AGENTS.md` drops both: the Heart gates releases, not runs), and
**their absence there is never read as an unacknowledged RED** — the fields are
not missing, they do not exist on that schema.

## Merge authority follows Consequence — 2026-10-02

**Who merges is decided by the task's declared `Consequence:` tier**
(`PyAutoMind/REFERENCE.md` "The review-cost model"), not by its autonomy level.
Approved by the human 2026-10-02; this section is that dated doctrine edit.

| Declared `Consequence:` | Who merges | What the human reads |
|---|---|---|
| `notify` | the **shipping session**: it waits for CI inside its turn, merges on green, then runs the `/prm` close-out itself | the close-out ledger |
| `glance` | the shipping session, exactly as `notify` — **only if the `Witness:` check passed** | a **post-merge summary**; each auto-merge appends one Shadow-window row (below) |
| `judge` | the human, by `/prm` — unchanged | the PR |
| *no header* | the human, by `/prm` — unchanged | the PR |

**Declared means written in the prompt.** A tier the sizing faculty would infer
for a header-less prompt never carries merge authority — a missing header is
`judge` for this purpose, whatever `bin/pyauto-brain sizing` says.

**The evidence** (cited for the grant, as "Graduation and demotion" requires):

- ~200 recent merged PRs across 8 repos carried **0 reviews**, and most merged
**under an hour** after opening with 1–2 commits — the human merge on this
organism's own low-consequence work is a click, not a review.
- `PyAutoMind/autonomy_log.md`, first table: **120 `merged-unchanged` / 12
`amended` / 2 `rejected` / 2 `reverted`**.
- The tier-`notify` Shadow window stood at **13/40, all clean**. The human
grants `notify` early by this edit rather than waiting out the window, and
**re-scopes the window to `glance`**.

**The authorization is given at plan time, never assumed later.**

- **Plan approval at `start_dev` is the merge authorization.** The plan must
state the declared tier and the **merge mode** (`auto-merge on green` or
`human /prm`); approving that plan authorizes that merge. A plan that does not
state them authorizes no merge.
- Under **`--auto`** or a **batch**, the launch / slot approval is the
authorization, bounded exactly as the launch is ("What a batch launch is").
- **Multi-phase epics chain**: a phase that auto-merged hands to the next phase
without re-asking, and the chain **stops** at a `judge`-tier phase, any
failure, Heart RED, or scope the approved plan did not name.

**The in-turn wait.** After PR-open, the shipping session waits for CI **inside
its own turn**: one background `gh pr checks <n> --watch` capped at **~60 min**
(the Bash call's own timeout). That is a process of this session, not a timer:
no `send_later`, `ScheduleWakeup`, cron, routine or `subscribe_pr_activity`
(`PyAutoMind/policy/end_at_deliverable.md` stands as written). When it returns,
CI is judged exactly as `/prm` step 2 judges it — every run, every leg — and on
green the merge and close-out run per `skills/prm/` in full. Cap reached, or a
surface with no authenticated `gh` (mobile, web): judge once, merge only if
already green, otherwise report and end; the human runs `/prm`.

**Never auto-merged, at any tier:**

- a PR carrying the **`decision-taken`** label (decide-and-flag);
- a ship under the **Heart RED development override** or the **corrective-PR
exception** — both keep their own separate human merge command;
- **red, pending or conflicting** CI, or a non-`CLEAN` merge state;
- a **SKIPPED** test leg — skipped is not green.

The `/prm` guards apply verbatim: the **library-first** gate, the
**sibling-branch** proof (every claimed branch merged before close-out) and the
**data-worktree** question. **`gh pr merge` is a bare, unchained Bash call**
(no `&&`, no `;`, no pipe) so the permission layer sees exactly one merge; if
it is denied, stop and report — never retry it another way. On MCP the merge
is the single `merge_pull_request` call, with the same rule.

**The `glance` Shadow window.** Each auto-merged `glance` PR appends one row to
`PyAutoMind/autonomy_log.md` "Shadow window" at close-out, recorded
`merged-unchanged` at merge (`lifecycle.py close … --tier glance`). The human
reads the post-merge summary and **amends the row** if they find something
substantive (`merged-after-substantive-change`), or marks it `reverted`.
`glance` is **confirmed at 20 clean rows**. **Any revert demotes that tier back
to a human `/prm`** immediately, by dated doctrine edit citing the row — and a
reverted `notify` merge demotes `notify` the same way.

**Later step, not now:** GitHub's native `--auto` merge (`gh pr merge --auto`,
`enable_pr_auto_merge`) would let the wait outlive the turn without a timer.
It is not adopted here; it needs its own doctrine edit.

*Revert condition:* any reverted auto-merge demotes its tier (above); an
auto-merge found to have bypassed one of the never-auto-merge rules retires this
section and returns every merge to `/prm`.

## Human override for Heart RED (development only)

Heart RED still parks every autonomous run and blocks every release. After the
Expand Down Expand Up @@ -597,14 +680,19 @@ tier), never by weakening leg 4.

## Hard invariants (every level, no exceptions)

- **Merge and issue-close are human acts.** An explicit future flag may extend
autonomy to merge; it does not exist and must not be assumed.
- **Merge and issue-close are human acts, except as "Merge authority follows
Consequence" (2026-10-02) grants them** — a declared `notify` or witnessed
`glance` task, authorized at plan or launch approval, merged in-turn on green
CI. Nothing else extends autonomy to merge; GitHub native auto-merge is not
adopted and must not be assumed.
- **Releases are human acts, with one dated exception.** The scheduled-nightly
standing grant (2026-07-09, above) is the only path that ships a release
without a per-release human; it is activity-gated, Heart-GREEN-gated and
kill-switchable. Every other release is `human-required`.
- **Autonomous runs end at PR-open**, with the PR body carrying the plan, the
review verdict, test/smoke counts, and a validation checklist.
review verdict, test/smoke counts, and a validation checklist — or, for a
declared `notify` / witnessed `glance` task, at the in-turn merge and
close-out that section grants.
- **Never modify code to make tests or smoke tests pass.**
- **Heart YELLOW/RED is never acknowledged autonomously.** A launch-time
human acknowledgement of a named reason set is a human acknowledgement — it
Expand Down Expand Up @@ -649,10 +737,13 @@ tier), never by weakening leg 4.
## Consumers

- `start_dev` — `--auto` usage, effective-level computation, plan-to-issue
for `safe`, launch-acknowledgement recording (its "--auto mode" section).
for `safe`, launch-acknowledgement recording (its "--auto mode" section);
the plan's tier + merge-mode line.
- `prm` — the CI judgment, merge guards and close-out every merge runs,
human-typed or tiered.
- `ship_library` / `ship_workspace` — the four-leg gate at step 4 (five under a
batch launch), stop at
PR-open, validation checklist, calibration append; the RED-handling step
PR-open (or the tiered in-turn merge), validation checklist, calibration append; the RED-handling step
points here for both the development-only human override and the narrower
corrective-PR exception.

Expand Down
3 changes: 3 additions & 0 deletions skills/prm/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ runs to the end without asking again — but still refuses on red, pending,
conflicting, an unmerged upstream library PR or sibling branch, and asks once
before deleting a worktree holding irreplaceable data products.

The shipping session also runs it in-turn for a declared `notify` / witnessed
`glance` task its approved plan authorized (`prm.md` "Tiered merge").

Read only the applicable step/environment from linked references, not all files.
Reuse unchanged instructions already loaded; follow [CONTEXT.md](../CONTEXT.md)
for bounded output and repository paths.
68 changes: 39 additions & 29 deletions skills/prm/closeout.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ All Mind paths below are relative to the resolved Mind checkout.

## 5. Close the task out

Typing `/prm` authorized all of this; the only questions are the guards in step
6. Order is forced by the tooling, so do not reorder:
Typing `/prm` authorized all of this — and so did the approved plan or launch
of a tiered merge (prm.md "Tiered merge"), which runs this same close-out
in-turn after its bounded wait; the shipping session never leaves a waiter,
timer or subscription behind to do it later. The only questions are the guards
in step 6. Order is forced by the tooling, so do not reorder:

1. **Prove every branch merged, per repo** — a `complete/` record is a write-up,
not a merge receipt, and a task may have shipped in waves. Ask git, per repo
Expand All @@ -22,11 +25,11 @@ Typing `/prm` authorized all of this; the only questions are the guards in step
3. **Mind: `active/` → `complete/`** — draft the completion body, then one
verb does the whole Mind-side close-out — the record, the prompt's
removal, the `active.md` row (and any `parked.md`/`planned.md` pointer),
the shadow row when the tier is `notify`, and `complete/index.md`:
the shadow row when the tier is `glance`, and `complete/index.md`:

```bash
python3 scripts/lifecycle.py close <slug> --date <merge date> \
--from-file <body.md> --pr <Repo#N …> [--tier notify --gate "<cell>" \
--from-file <body.md> --pr <Repo#N …> [--tier glance --gate "<cell>" \
--action <action> --stage <1|2>] # dry run: prints every step
python3 scripts/lifecycle.py close … --apply # then does them
```
Expand All @@ -52,16 +55,15 @@ Typing `/prm` authorized all of this; the only questions are the guards in step
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.
**3b. Shadow row — tier-`glance` only.** Since 2026-10-02 the window
counts tier-`glance` merges toward **20 clean rows** (`notify` was granted
then at 13/40, all clean — `../../AUTONOMY.md` "Merge authority follows
Consequence — 2026-10-02"). Do it only after sub-step 1 proved every branch
`MERGED` — the row records what happened to 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 <prompt>`. Anything but `notify` —
1. **Tier.** The prompt's **declared** `Consequence:` header — never a
tier `bin/pyauto-brain sizing` would infer. Anything but `glance` —
**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
Expand All @@ -72,28 +74,36 @@ Typing `/prm` authorized all of this; the only questions are the guards in step
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** — the `--tier notify --gate "<cell>" --action <action>
4. **The action.**
- **Tiered merge** (prm.md "Tiered merge" — the shipping session merged
it): record `merged-unchanged` at merge and **ask nothing**. The
human reads the post-merge summary and amends the row to
`merged-after-substantive-change` if they find something
substantive, or `reverted` if it was backed out — a `reverted` row
demotes `glance` back to a human `/prm`.
- **Human-typed `/prm`**: ask exactly this, and 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 merge — never a guess at what would have happened.
5. **Append** — the `--tier glance --gate "<cell>" --action <action>
--stage <1|2>` flags on the `close` verb above do it (`shadow-row` is
the verb underneath). The dry run prints the row and the new count line
before anything is written; the row rides the same commit and push as
the record and the dashboard, never a commit of its own.
6. **Name it in the ledger** (sub-step 7): "shadow row appended, count
N/40".
N/20" — and, for a tiered merge, end the ledger with the post-merge
summary the human reads in place of the PR: what merged, the witness
result, and the one-command revert.

Protocol, power calculation and the **pre-registered decision rule** live in
the tier-`notify` protocol prompt, folded under `## Original prompt` in
`PyAutoMind/complete/2026/09/prm-shadow-row-notify-tier.md` — read it
before interpreting the table.
The window's header in `PyAutoMind/autonomy_log.md` carries the rule; the
earlier tier-`notify` protocol is folded under `## Original prompt` in
`PyAutoMind/complete/2026/09/prm-shadow-row-notify-tier.md`.
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
Expand Down
2 changes: 1 addition & 1 deletion skills/prm/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mapping page only if something here is missing. Names take the
| 1 resolve | `list_pull_requests` (state `open`), or `pull_request_read` `get` for a known number. Mind's `active.md` via `get_file_contents` |
| 2 judge CI | `pull_request_read` `get_check_runs` — every check on the head commit, in one call. Then `pull_request_read` `get` for `mergeable` / `merge_state_status` |
| 2 by workflow | `actions_list` `list_workflow_runs` **has no `head_sha` filter** (`workflow_runs_filter` is actor/branch/event/status only): filter by `branch`, then match `head_sha` yourself, or you will judge a stale run. Legs: `actions_list` `list_workflow_jobs`, `resource_id` = run id |
| 3 stop | **No call.** On this surface step 3 is judge-once-then-stop: no `subscribe_pr_activity`, no `send_later`. Report where each PR stands and end the turn; the human re-runs `/prm` when CI is green |
| 3 stop | **No call.** On this surface step 3 is judge-once-then-stop: no `subscribe_pr_activity`, no `send_later`. Report where each PR stands and end the turn; the human re-runs `/prm` when CI is green. A tiered auto-merge (prm.md "Tiered merge") has no wait here either: merge only if already green |
| 3 red | `get_job_logs` with `run_id`, `failed_only: true`, `return_content: true` — **before** anything else, the blob is purged |
| 4 merge | `merge_pull_request` (`merge_method: "merge"`), then `pull_request_read` `get` to confirm `MERGED`; `unsubscribe_pr_activity` only to clear a stale subscription an older run left |
| 5.2 issue | `add_issue_comment`, then `issue_write` `update` with `state: "closed"` and `state_reason: "completed"` — an unset reason is what leaves an issue reading "closed as not planned" |
Expand Down
Loading
Loading