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
60 changes: 51 additions & 9 deletions AUTONOMY.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Where the dev workflow stops for a human today:
| Plan approval | write plan to the issue, proceed | write plan to the issue, proceed | present + wait |
| 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 human may separately invoke the corrective-PR exception (below), which is not an autonomy level |
| 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 |
| 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 @@ -443,15 +443,52 @@ 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.

## Human override for Heart RED (development only)

Heart RED still parks every autonomous run and blocks every release. After the
agent has parked and reported — or at the equivalent gate in supervised or
human-required development — a **live human** may authorize a non-corrective
development branch to pass the RED gate. This is a development-shipping
override, not an acknowledgement that Heart is healthy, not an autonomy level,
and not evidence that the branch repairs Heart.

- **Evidence before the ask** — the agent surfaces every exact RED reason
string from Heart's current verdict and shows that the branch has passed all
applicable tests, smoke, and review. A failed branch test, smoke leg, or
review cannot be overridden.
- **Authorization** — the live human names the specific task or issue and
authorizes that branch contemporaneously. It is recorded verbatim, or
faithfully quoted, on the issue. A standing, stored, batch, ambient, or
earlier-session grant does not count.
- **Permitted development actions** — commit, push, and opening the task's
pending-release PR.
- **Merge remains separate and checked** — merge requires a separate explicit
human merge command and every required GitHub check green. One live message
may explicitly authorize both development shipping and merge, but if the
turn ends before the checks are green, the merge grant expires: do not arm
auto-merge or a waiter; the human must invoke `/prm` again.
- **Forbidden** — release, release rehearsal, bypassing a failed test, smoke,
review, required GitHub check or branch protection, force merge, and any
claim that the branch fixes Heart. Heart remains RED for release purposes.
- **Recorded in four sinks** — the authorization, exact current RED reasons,
and passed branch gates are recorded on the **GitHub issue**; in the **PR
body**; in the task's **`PyAutoMind/active.md`** entry as a
`- heart-red-override:` block; and in the **first** table of
**`PyAutoMind/autonomy_log.md`** with outcome `red-override`.

This override is never inferred or exercised by `--auto`: RED parks the run
first, and only the live human act above can resume development shipping.

## Corrective-PR exception for Heart RED (human-authorized)

Heart RED forbids commit, push and PR-open at every autonomy level (the levels
table). But Heart cannot clear a RED until the fixing source reaches `main`,
fresh wheels are built, and release-integration validation passes — so a source
fix that directly repairs the exact defect named by the RED reason cannot be
shipped, and recovery is impossible without violating policy. This section is
the **one** authorized way through that deadlock, and it is a **human act**, not
an autonomy level: it never fires under `--auto` (the hard invariant "Heart
the **narrow causal-fix path**, alongside the development-only human override
above, through that deadlock. It is a **human act**, not an autonomy level: it
never fires under `--auto` (the hard invariant "Heart
YELLOW/RED is never acknowledged autonomously" stands verbatim — an unattended
`--auto` run on RED still stops and reports). A human invokes it, live, per
incident.
Expand Down Expand Up @@ -521,11 +558,11 @@ at PR-open (or on parking):
```

Outcome ∈ `merged-unchanged` / `amended` / `rejected` / `rejected-at-review` /
`parked` / `corrective` (`corrective` records a use of the human-authorized
corrective-PR exception above — not an `--auto` run, but logged so the
exception's use is auditable alongside the autonomy rows). This is the evidence
base for raising or lowering caps — autonomy grows by demonstrated calibration,
not by optimism.
`parked` / `corrective` / `red-override`. `corrective` records the causal-fix
exception; `red-override` records the development-only human override. Neither
is an `--auto` run, but both are logged in this first table so their use is
auditable alongside the autonomy rows. This is the evidence base for raising or
lowering caps — autonomy grows by demonstrated calibration, not by optimism.

**`rejected-at-review` — added 2026-08-30.** Stamped by the **human**, in their
review slot, when they would not have merged what the run produced. It exists
Expand Down Expand Up @@ -572,6 +609,10 @@ tier), never by weakening leg 4.
- **Heart YELLOW/RED is never acknowledged autonomously.** A launch-time
human acknowledgement of a named reason set is a human acknowledgement — it
binds to that exact set, for that launch, and never extends to new reasons.
- **The development-only human override for Heart RED is a live human act**
after an autonomous run parks, never an autonomous acknowledgement. It can
open a development PR and, only with a separate current human merge command
plus green required checks, merge it; Heart remains RED for release.
- **The corrective-PR exception for Heart RED is a contemporaneous human act**
(the section above), never reachable under `--auto`. It permits only commit,
push and opening one pending-release PR that repairs the named RED reason —
Expand Down Expand Up @@ -612,6 +653,7 @@ tier), never by weakening leg 4.
- `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
points here for the human-authorized corrective-PR exception.
points here for both the development-only human override and the narrower
corrective-PR exception.

Skills must link here rather than copying the tables.
15 changes: 9 additions & 6 deletions agents/conductors/intake/_intake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ def bundle_prompt(b: dict) -> str:
`/prm` closes each member out unchanged.
"""
members = [m["path"] for m in b["members"]]
L = [f"You are the architect (Fable) for the PyAutoMind bundle "
L = [f"You are the judgment tier for the PyAutoMind bundle "
f"'{b.get('title') or b['slug']}' — {len(members)} INDEPENDENT tasks "
"run in one orchestrated session.",
"",
Expand All @@ -1281,11 +1281,14 @@ def bundle_prompt(b: dict) -> str:
"branch at a time, so inside it members are worked one at a time, "
"each on its own `feature/<member-task>` branch cut from "
"`origin/main`; members in different repos may run in parallel.",
"4. Delegate the implementation of each member to an Opus subagent "
"via the Agent tool (`Agent(model=\"opus\", …)`), one subagent per "
"member, with the member's issue plan, the worktree path and the "
"branch to use. You plan, judge and talk to the user; the subagents "
"edit, test and report back.",
"4. For each member, resolve the execution tier from "
"`PyAutoBrain/skills/WORKFLOW.md`, then delegate implementation "
"through the current harness's native subagent mechanism, one "
"execution delegate per member, with the member's issue plan, the "
"worktree path and the branch to use. If that mechanism is "
"unavailable, follow WORKFLOW's direct-execution fallback. The "
"current session plans, judges and talks to the user; the execution "
"delegate edits, tests and reports back.",
"5. Ship each member on its own: `/ship_library` or "
"`/ship_workspace`, ONE PR per task, so `/prm` closes each member out "
"unchanged. Never one PR for the bundle.",
Expand Down
17 changes: 10 additions & 7 deletions skills/WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,16 @@ pyauto-heart readiness --json # authoritative GREEN / YELLOW / RED verdict
- **YELLOW** → surface the warnings; proceed only with explicit user
acknowledgement (a human checkpoint at **every** autonomy level —
[`../AUTONOMY.md`](../AUTONOMY.md)).
- **RED** → stop; report what failed. Do not ship — **unless** a human
authorizes the narrow corrective-PR exception naming the exact RED reason
([`../AUTONOMY.md`](../AUTONOMY.md) "Corrective-PR exception for Heart RED"):
commit/push/PR-open of one reason-scoped fix only, never merge or release.
When that exception is in play, surface the exact RED reason string(s)
verbatim from `pyauto-heart readiness` so the human authorizes the quote the
agent provided rather than hunting for the wording.
- **RED** → stop and report what failed; an autonomous run parks before any
exception can be considered. After the exact current RED reasons and passed
applicable tests/smoke/review are surfaced, including the reason strings
verbatim from `pyauto-heart readiness`, a live human may authorize the
development-only override ([`../AUTONOMY.md`](../AUTONOMY.md)
"Human override for Heart RED (development only)"), or may authorize the
narrower causal-fix path ("Corrective-PR exception for Heart RED"). Follow
the selected canonical section's scope and record sinks exactly. Neither
path permits release or a CI bypass; merge requires its own current human
command and green required GitHub checks.

Tests/smoke runs that feed the verdict are Heart's domain — invoke them through
the vitals faculty rather than re-deriving pass/fail criteria in the skill.
Expand Down
9 changes: 9 additions & 0 deletions skills/prm/prm.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ every run for the sha and every job in it, and treat anything not `completed` as

Green on every leg → merge, in this order:

**PRs shipped under the Heart RED development override.** The shipping grant
alone is not merge authority. Require a separate explicit human merge command
and every required GitHub check green; never force, override protection, or
treat Heart RED as cleared. A live message may authorize both shipping and
merge, but that merge grant lasts only for the current turn. If the turn ends
before checks are green, it expires: arm no waiter or auto-merge, stop, and
require the human to invoke `/prm` again. This permission never reaches a
release or release rehearsal.

1. **The Heart freeze window — library PRs only.** A release validation is a
window in which the library `main`s must not move: a merge landing inside it
invalidates the evidence and restales the rehearsal (~75 minutes, measured
Expand Down
15 changes: 8 additions & 7 deletions skills/ship_library/ship_library.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ pyauto-heart readiness --json # authoritative GREEN / YELLOW / RED
The library test suites are part of Heart's verdict — they run as the gate, not
as an ad-hoc step the skill re-judges. **GREEN** → proceed to step 4.
**YELLOW** → surface warnings, proceed only on explicit user acknowledgement.
**RED** → stop and report; do not ship — **unless** a human authorizes the
narrow corrective-PR exception naming the exact RED reason (`AUTONOMY.md`
"Corrective-PR exception for Heart RED"), which permits commit/push/PR-open of
one reason-scoped fix only, never merge or release. When that exception is in
play, **surface the exact RED reason string(s) verbatim from `pyauto-heart
readiness`** and the specific corrective request, so the human authorizes the
quote the agent provided rather than hunting for the wording. If `pyauto-brain`/`pyauto-heart` are
**RED** → stop and report; an autonomous run parks. After surfacing the exact
current RED reasons verbatim from `pyauto-heart readiness` and passed applicable
tests/smoke/review, a live human may authorize the canonical `AUTONOMY.md`
"Human override for Heart RED (development only)" or the narrower
"Corrective-PR exception for Heart RED" for a causal fix. Follow the selected
canonical section's scope and four record sinks exactly. Neither path permits
release or bypassing CI; merge requires its own current human command and green
required GitHub checks. If `pyauto-brain`/`pyauto-heart` are
unavailable, run the per-repo `pytest <test_dir>/ -x` inside the worktree as the
gate and treat any failure as RED (WORKFLOW.md). Under `--auto`, this step is
the four-leg **autonomous-ship gate** — tests (+ downstream dependents on
Expand Down
17 changes: 9 additions & 8 deletions skills/ship_workspace/ship_workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ pyauto-heart readiness --json # GREEN / YELLOW / RED
```

Workspace **smoke tests** are part of Heart's verdict. **GREEN** → execute.
**YELLOW** → proceed only on explicit acknowledgement. **RED** → stop —
**unless** a human authorizes the narrow corrective-PR exception naming the
exact RED reason (`AUTONOMY.md` "Corrective-PR exception for Heart RED"), which
permits commit/push/PR-open of one reason-scoped fix only, never merge or
release. When that exception is in play, **surface the exact RED reason
string(s) verbatim from `pyauto-heart readiness`** and the specific corrective
request, so the human authorizes the quote the agent provided rather than
hunting for the wording. If the
**YELLOW** → proceed only on explicit acknowledgement. **RED** → stop; an
autonomous run parks. After surfacing the exact current RED reasons and passed
applicable tests/smoke/review, including the reason strings verbatim from
`pyauto-heart readiness`, a live human may authorize the canonical
`AUTONOMY.md` "Human override for Heart RED (development only)" or the narrower
"Corrective-PR exception for Heart RED" for a causal fix. Follow the selected
canonical section's scope and four record sinks exactly. Neither path permits
release or bypassing CI; merge requires its own current human command and green
required GitHub checks. If the
organism CLIs are unavailable, run `/smoke_test` (with `activate.sh` sourced) as
the gate and treat any failure as RED. Under `--auto`, this step is the
four-leg **autonomous-ship gate** (`AUTONOMY.md` "The autonomous-ship gate");
Expand Down
79 changes: 72 additions & 7 deletions tests/test_corrective_red_exception.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Doc-contract tests for the human-authorized corrective-PR exception to
Heart RED (PyAutoBrain#112).
"""Doc-contract tests for the human-authorized development paths through
Heart RED (PyAutoBrain#112 and the development-only override).

The exception is doctrine, not code, so its guardrails are pinned against the
canonical text of AUTONOMY.md — a weakening edit (dropping a forbidden action,
a record sink, or the human-only clause) fails loudly here rather than silently
widening the one authorized path through a RED gate. The seam tests also pin
widening either authorized path through a RED gate. The seam tests also pin
the "link, don't duplicate policy" contract: the ship skills point at
AUTONOMY.md and do not carry a second copy of the permitted/forbidden lists.
"""
Expand All @@ -16,8 +16,10 @@
SHIP_LIBRARY = (BRAIN_HOME / "skills" / "ship_library" / "ship_library.md").read_text()
SHIP_WORKSPACE = (BRAIN_HOME / "skills" / "ship_workspace" / "ship_workspace.md").read_text()
WORKFLOW = (BRAIN_HOME / "skills" / "WORKFLOW.md").read_text()
PRM = (BRAIN_HOME / "skills" / "prm" / "prm.md").read_text()

SECTION_HEADER = "## Corrective-PR exception for Heart RED (human-authorized)"
OVERRIDE_HEADER = "## Human override for Heart RED (development only)"


def _norm(text):
Expand All @@ -26,10 +28,10 @@ def _norm(text):
return " ".join(text.replace("*", "").replace("`", "").lower().split())


def _section():
"""The corrective-PR exception section body (header to the next ``## ``)."""
start = AUTONOMY.index(SECTION_HEADER)
rest = AUTONOMY[start + len(SECTION_HEADER):]
def _section(header=SECTION_HEADER):
"""One policy section body, from its header to the next ``## ``."""
start = AUTONOMY.index(header)
rest = AUTONOMY[start + len(header):]
end = rest.find("\n## ")
return _norm(rest if end == -1 else rest[:end])

Expand All @@ -38,6 +40,69 @@ def test_section_exists():
assert SECTION_HEADER in AUTONOMY


def test_development_override_requires_live_human_and_passing_branch_gates():
sec = _section(OVERRIDE_HEADER)
assert "non-corrective development branch" in sec
assert "live human" in sec
assert "every exact red reason string from heart's current verdict" in sec
assert "passed all applicable tests, smoke, and review" in sec
for stale_grant in ("standing", "stored", "batch", "ambient",
"earlier-session"):
assert stale_grant in sec
assert "specific task or issue" in sec
assert "verbatim, or faithfully quoted, on the issue" in sec


def test_development_override_scope_records_and_release_boundary():
sec = _section(OVERRIDE_HEADER)
for permitted in ("commit", "push", "opening the task's pending-release pr"):
assert permitted in sec
for sink in ("github issue", "pr body", "pyautomind/active.md",
"- heart-red-override:", "pyautomind/autonomy_log.md",
"outcome red-override"):
assert _norm(sink) in sec, sink
assert "first table" in sec
for forbidden in ("release rehearsal", "force merge",
"claim that the branch fixes heart",
"bypassing a failed test",
"required github check or branch protection"):
assert forbidden in sec
assert "heart remains red for release purposes" in sec


def test_development_override_merge_grant_expires_and_never_bypasses_ci():
sec = _section(OVERRIDE_HEADER)
assert "separate explicit human merge command" in sec
assert "every required github check green" in sec
assert "if the turn ends before the checks are green, the merge grant expires" in sec
assert "human must invoke /prm again" in sec
prm = _norm(PRM)
assert "merge grant lasts only for the current turn" in prm
assert "every required github check green" in prm
assert "invoke /prm again" in prm


def test_development_override_is_never_autonomous_and_has_log_schema():
sec = _section(OVERRIDE_HEADER)
assert "never inferred or exercised by --auto" in sec
assert "red parks the run first" in sec
assert "red-override" in AUTONOMY


def test_both_ship_skills_link_the_development_override():
marker = "Human override for Heart RED (development only)"
assert marker in SHIP_LIBRARY
assert marker in SHIP_WORKSPACE
assert marker in WORKFLOW


def test_corrective_path_coexists_with_the_development_override():
sec = _section()
assert "narrow causal-fix path" in sec
assert "alongside the development-only human override" in sec
assert "one authorized way" not in sec


def test_permitted_set_is_commit_push_pr_open_only():
sec = _section()
for verb in ("commit", "push", "opening one"):
Expand Down
Loading
Loading