Repository navigation
maintenance: shed the Cortex review-slot and gate apparatus #9
Description
Overview
Phase 1 of the cortex-checkin epic (ledger PyAutoMind/draft/maintenance/pyautocortex/cortex_checkin_epic.md). The Cortex's core — projects.yaml, phase files, append-only rulings, check/move/rule/new, collect's scorer, dashboard --apply — is right-sized. What is over the top is everything that models the human as a reviewer working a scheduled shift through a packet page: 0 conductor-opened slots, 0 rulings from a packet, 0 partial reviews, review-minutes-actual never filled, 2 gated refs and 0 gate flips, rule --also never used, Lane: local-dev on 32/32 phases, and a restricted-YAML parser whose own parity test proves it redundant.
This phase is deletion only, plus the one decoupling the phase-2 door needs: collect must run with no batch record. Every historical record stays readable — batches/2026-*.md and batches/reviews/*.md are cited verbatim by 13 rulings and are kept as read-only history.
Two PRs: PyAutoCortex (schema, scripts, workflows, tests, docs) and PyAutoBrain (cortex conductor, the batch conductor's cortex kind, status box, skills). Dev batching is untouched.
Plan
- Retire gate grading in PyAutoCortex: delete
gates_grade.yml(the daily cron), thegates --grade/--writepath inscripts/cortex.py, theGates-cleared:/Gate-override:header keys and the threecheckinvariants over them. Keep the plainGates:header, thegatedstate,GATE_REF_RE/gate_urland the read-onlygateslisting — a gated phase now moves toreadyby a human typingmove ready. - Delete
rule --also(never used) and theLane:header (one mechanical sweep over 32 phase files + schema,check, thenewtemplate and the "laptop lane" prose). - Replace the restricted-YAML parser (
parse_projects+ its six parity tests) withyaml.safe_load, keeping the field validation; declarepyyamlincortex_check.ymland the README install line. - Delete the batch record + packet schema:
batches/packets/, the batch-record schema inREFERENCE.md, the slot/shift/review-minutes/partial-review vocabulary inbatches/AGENTS.md, andbatch_problems/_review_section_problemsincortex.py. Keep the records and reviews themselves as history with a two-linebatches/AGENTS.mdsaying exactly that; the rulingBatch:field becomes optional-historical. - Decouple
collectfrom the batch record:collect --pull --applywith no record now scopes to every phase insubmitted|running;--phase RELnarrows;--slotgoes away.apply_opsstill movesrunning → pulled → awaiting-ruling; the record-rewrite leg is deleted. - Delete the cortex kind from the batch conductor in PyAutoBrain (
plan_cortex,cortex_plan_record, carried members,CORTEX_CHIPS, partial reviews, the cortex lane gate, the cortex--pushintegration legs) and the Cortex status box from_status.pyand its render call in_cortex.py. - Delete the
planverb and thegates --grade --applywrapper from the cortex conductor. Keepcensus,dashboard, the decoupledcollect, and every payload builder — phases 2 and 3 build on them. - Update the skills and docs to match, delete the tests of deleted things, keep every test of a kept thing green, and regenerate the Cortex dashboard (it loses the status box).
Detailed implementation plan
Work Classification
Library (both repos are agent/tooling source, shipped via /ship_library).
Affected Repositories
- PyAutoCortex (primary)
- PyAutoBrain
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoCortex | main | clean |
| ./PyAutoBrain | main | clean |
No worktree claim on either repo in active.md (claims held by gaussian-precompute-p2, euclid-cpu-two-stage-route, image-source-mappings-p3 — no overlap).
Suggested branch: feature/cortex-checkin-p1-shed-review-slot
Worktree root: ~/Code/PyAutoLabs-wt/cortex-checkin-p1-shed-review-slot/
Implementation Steps — PyAutoCortex
- Gate grading. Delete
.github/workflows/gates_grade.yml. Inscripts/cortex.pydeleteGATE_JQ,_http_gate,fetch_gate_states,grade_gateand the--grade/--writehalf ofgates_report(~L929-1092), plus the--grade/--write/--applyflags on thegatessubparser. KeepGATE_REF_RE,DEFAULT_GATE_OWNER,gate_refs,gate_urland the read-only listing. DropGates-cleared/Gate-overridefromPHASE_KEYSand the three gate invariants inphase_problems; dropGATES_SETTLED_STATES/GRADED_STATESif they become unused. UpdateAGENTS.md(workflow table + "the one scheduled job that mutates the ledger"),REFERENCE.md(~L148-157) and append a dated entry todocs/schema_decisions.md: gate grading retired 2026-09-03; sequencing is proseReady when:per decision 54. rule --also. Remove the flag from therulesubparser, the fan-out inrule_phase/cmd_rule, its tests and its docs.Lane:. RemoveLANE, the key fromPHASE_KEYS, thecheckinvariant, thenewtemplate line, the line from all 32phases/**/*.mdfiles and the skeleton fixtures, and the "laptop lane" prose fromAGENTS.md.- PyYAML. Replace
parse_projects(~L290-400),_strip_comment,_scalarand_finish_rowwith ayaml.safe_loadload inload_projects, keeping the field validation (PROJECT_FIELDS,PROJECT_OPTIONAL_FIELDS,PROJECT_STATUSES,PARTITIONS, path shape) as problems. Delete the six parity tests; keep the field-validation tests. Addpyyamlto thecortex_check.ymlpip line and the README install line. - Batch record + packet schema.
git rm -r batches/packets/; deletebatch_problems,_review_section_problems,_record_members,_record_values,MEMBER_RE,REVIEW_SECTION_RE,REVIEW_KEY_RE,REVIEW_PART_RE,SLOT_RE(~L772-893) and theircheckwiring plus tests.batch_records/batch_reviewsstay only if a kept caller needs them. Rewritebatches/AGENTS.mdto two lines ("read-only history; never modified, only added"), delete the batch-record schema section fromREFERENCE.md, make rulingBatch:optional-historical in the schema, and dropbatches/packets/**frompages_dashboard.yml. State thebatches/decision inscripts/ledger_merge.py(history: never modified, only added) and fixtests/test_ledger_merge.py. collectdecoupling is Brain-side (step 9) — the Cortex docs must stop documenting--slot.
Implementation Steps — PyAutoBrain
agents/conductors/batch/_batch.py: deleteplan_cortex(~L3050),cortex_plan_record(~L3154),carried_members(~L3208) and thecarried:/carried-from:keys,CORTEX_CHIPS(~L2724) and the cortex packet rendering,REVIEW_PART_RE/_next_review_path(~L2737-2768, shipped as PyAutoCortex#7 / PyAutoBrain#342 — revert cleanly),--kind cortexonplan/collectand_main_plan_cortex, the cortex lane gate (detect_lane~L962 stays only if dev uses it), and the cortex--pushlegs in_integration.py(~L328/430).agents/conductors/batch/_status.py(~L196): delete the Cortex status box render and the strip_cortex.pyprints above "awaiting", plus the render call inagents/conductors/cortex/_cortex.py.agents/conductors/cortex/_cortex.py: delete theplanverb (plan,emit_plan~L972-1050) and thegates --grade --applywrapper (~L1856). Reworkcmd_collect(~L1727-1745) so it no longer requires a record or--phase: default scope = every phase insubmitted|running;--phase RELnarrows;--slotis gone.run_pull(~L1701),apply_ops(~L1658) and_apply_checked(~L1802) keep therunning → pulled → awaiting-rulingmoves; the record-rewrite leg goes. Keepcensus,dashboard,collect,_ruling_payload,launch_payload,_live_payload,_epic_payload,_project_payload.- Docs/skills:
skills/batch/batch.mdscience section (~L152-176) → one paragraph pointing at/cortex(installed in phase 2);skills/cortex/cortex.mdverb menu losesplanandgates --grade;agents/conductors/cortex/AGENTS.mdandagents/conductors/batch/AGENTS.md(~L545-600 rolling-board / carry prose) updated; theskills/COMMANDS.md/cortexrow stays. - Tests: delete the tests of deleted things, keep the rest green. Mind the
_batchsubstring trap in_cortex.pyand the tenant firewall (no real org/repo names in new fixtures).
Verification
- PyAutoCortex
pytest -qandpython3 scripts/cortex.py check. - PyAutoBrain
pytest -q(one known worktree-only failure:test_cortex_conductor::test_a_fixture_tree_finds_the_schema_its_checkout_ships). - Regenerate the Cortex dashboard from inside the Cortex checkout against this branch's Brain worktree:
python3 ../PyAutoBrain/agents/conductors/cortex/_cortex.py dashboard --cortex . --apply, then confirmdashboard --checkis current. - The prompt's
Witness:grep (excluding the prompt and record files themselves).
Key Files
PyAutoCortex/scripts/cortex.py— 1640 lines; the gates stack,parse_projects,batch_problems,rule --also.PyAutoCortex/.github/workflows/{gates_grade,cortex_check,pages_dashboard}.ymlPyAutoCortex/{AGENTS.md,REFERENCE.md,README.md,docs/schema_decisions.md,batches/AGENTS.md}PyAutoBrain/agents/conductors/batch/{_batch.py,_status.py,_integration.py,AGENTS.md}PyAutoBrain/agents/conductors/cortex/{_cortex.py,AGENTS.md}PyAutoBrain/skills/{batch/batch.md,cortex/cortex.md}
Out of scope (epic ledger)
Collapsing the 10-state phase machine; Migrated-from: headers and docs/schema_decisions.md history; rewriting the seven per-project hpc/sync CLIs. projects.yaml and rulings/ are code / append-only and are not modified.
Original Prompt
Click to expand starting prompt
# Cortex: shed the review-slot and gate apparatus the check-in loop never uses
Type: maintenance
Target: pyautocortex
Repos:
- PyAutoCortex
- PyAutoBrain
Themes:
- mind-workflow
Difficulty: medium
Autonomy: safe
Priority: high
Status: draft
Consequence: judge
Witness: in PyAutoCortex `grep -rn "gates_grade\|Gates-cleared\|Gate-override\|--also\|^Lane:\|review-minutes\|packets/" --include=*.md --include=*.py --include=*.yml . ` returns only `complete`-style history under `batches/reviews/` and `rulings/`; `.github/workflows/gates_grade.yml` and `batches/packets/` are gone; `scripts/cortex.py` imports `yaml` and has no `parse_projects` hand parser; in PyAutoBrain `grep -rn "plan_cortex\|cortex_plan_record\|carried_members\|CORTEX_CHIPS\|REVIEW_PART_RE\|_next_review_path" agents/ board/ skills/` returns nothing; `pyauto-brain cortex collect --pull --apply` runs with NO batch record and no `--phase` and scores every submitted/running phase; `pyauto-brain cortex dashboard --check` is current with no status box; Cortex `pytest -q`, Brain `pytest -q` and `cortex.py check` pass; the dashboard renders every existing section except the status box
Review-minutes: 20
Unattended: ready
Epic: cortex-checkin
Phase: 1
Filed: 2026-09-03
Phase 1 of `cortex-checkin` (ledger `draft/maintenance/pyautocortex/cortex_checkin_epic.md`).
Two PRs: PyAutoCortex (schema, scripts, workflows, tests, docs) and PyAutoBrain
(conductor, batch cortex kind, status box, skills). Deletion only, plus the one
decoupling the door needs (item 6). Keep every historical record readable.
## Delete — PyAutoCortex
1. **Gate grading**: `.github/workflows/gates_grade.yml`; in `scripts/cortex.py`
the `gates --grade/--write` path (`_http_gate`, `fetch_gate_states`,
`grade_gate`, `gates_report` ~L929-1092) and its tests; the
`Gates-cleared:` / `Gate-override:` keys and the three `check` invariants
that reference them (REFERENCE.md ~L148-157). KEEP the plain `Gates:`
header, the `gated` state, `GATE_REF_RE`/`gate_url` and the read-only
`gates` listing (no `--grade`): a gated phase is moved to `ready` by a
human typing `move ready`. Update AGENTS.md/REFERENCE.md/schema_decisions
(append a dated decision: "gate grading retired 2026-09-03; sequencing is
prose `Ready when:` per decision 54").
2. **`rule --also`** fan-out (never used) — remove flag, code, tests, docs.
3. **`Lane:`** header — remove from the schema, `check`, `new` template, the
32 phase files (one mechanical sweep), and the "laptop lane" prose in
AGENTS.md. Brain's `_batch.py` lane filter for cortex kind goes with item 7.
4. **Restricted-YAML parser** (`parse_projects` ~L290-400 + the six parity
tests): replace with `yaml.safe_load` and keep the FIELD validation
(required keys, `status` values, path shape). Add `pyyaml` to whatever
declares Cortex's deps (`cortex_check.yml` pip line, README install line).
5. **Batch record + packet schema**: delete `batches/packets/` (TEMPLATE.md,
AGENTS.md, the three HTML files), the batch-record schema section in
REFERENCE.md and `batches/AGENTS.md`'s slot/shift/review-at/review-minutes
vocabulary and partial-review (`-r<N>`) rules, and `batch_problems` +
`_review_section_problems` in `cortex.py` (~L772-893) with their tests.
KEEP `batches/2026-*.md` and `batches/reviews/*.md` as read-only history
(the human's verbatim words are cited by 13 rulings) — add a two-line
`batches/AGENTS.md` saying exactly that, and make the ruling `Batch:`
field optional-historical in the schema. Ledger-merge classification for
`batches/` becomes "history: never modified, only added" or drop the path
from the classifier — state which.
6. **Decouple `collect` from the record** (Brain side, but list it here so the
Cortex side does not still document `--slot`): the door needs
`collect --pull --apply` with no record: default scope = every phase in
`submitted|running`, `--phase REL` narrows, `--slot` goes away.
`apply_ops` keeps moving `running → pulled → awaiting-ruling`; the record
rewrite leg is deleted.
## Delete — PyAutoBrain
7. In `agents/conductors/batch/_batch.py`: `plan_cortex`, `cortex_plan_record`,
`carried_members` / `carried:` / `carried-from:`, `CORTEX_CHIPS` and the
cortex packet rendering, `REVIEW_PART_RE` / `_next_review_path` (partial
reviews, shipped as PyAutoCortex#7 / PyAutoBrain#342 — revert cleanly),
`--kind cortex` on `plan`/`collect` entirely, the cortex lane gate
(`detect_lane` stays for dev if dev uses it; delete if cortex-only), and
`--push` integration for the cortex kind (`_integration.py`). Dev batching
is untouched.
8. `agents/conductors/batch/_status.py`: the Cortex status box and the strip
`_cortex.py` renders above "awaiting" (dashboard shows "No batch in
flight" today). Delete the render call in `_cortex.py` too.
9. `agents/conductors/cortex/_cortex.py`: the `plan` verb (`plan`, `emit_plan`
~L972-1050), the `gates --grade --apply` wrapper (~L1856), `--slot` on
`collect` (item 6). Keep `census`, `dashboard`, `collect` (decoupled),
the payload builders (`_ruling_payload`, `launch_payload`, `_live_payload`,
`_epic_payload`, `_project_payload`) — phase 2 and 3 build on them.
10. Skills/docs: `skills/batch/batch.md` science section (~L152-176) → one
paragraph pointing at `/cortex` (phase 2); `skills/cortex/cortex.md` verb
menu loses `plan` and `gates --grade`; `agents/conductors/cortex/AGENTS.md`
and `batch/AGENTS.md` (~L545-600 rolling-board / carry prose) updated;
`skills/COMMANDS.md` row for `/cortex` stays (phase 2 installs it).
11. Tests: delete the tests of the deleted things; keep every test of a kept
thing green. Mind the `_batch` substring trap in `_cortex.py` noted in
memory, and the tenant firewall (no real org/repo names in new fixtures).
Then: Cortex `pytest -q` + `python3 scripts/cortex.py check`; Brain `pytest -q`
(one known worktree-only failure: `test_cortex_conductor::test_a_fixture_tree_finds_the_schema_its_checkout_ships`);
regenerate the Cortex dashboard from inside the Cortex checkout
(`python3 ../PyAutoBrain/agents/conductors/cortex/_cortex.py dashboard --cortex . --apply`)
and confirm `--check` is current; open both PRs.
Activity
Jammy2211 commentedon Sep 3, 2026
Shipped to PRs — merge stays human
Both halves of phase 1 are open on branch
feature/cortex-checkin-p1-shed-review-slot:cortexkind, the status box, theplanverb and the gate-grading wrapper;collectdecoupled from the batch record.rule --also,Lane:, the hand-rolled YAML parser.Merge order: PyAutoBrain#348 first.
dashboard_refresh.ymlin this repo renders through PyAutoBrain main, so #10'srefreshcheck stays red until #348 lands; the other direction is safe because the new conductor works against either script. #10'scheckjob (cortex.py check+ pytest) is green on its own tree.Verification
pytest -qpytest -qcortex.py checkcortex dashboard --checkLines deleted:
scripts/cortex.py1640 → 1334;_batch.py3727 → 2862;_cortex.py1967 → 1734;_status.py−80.What
collectnow accepts--slotis gone with the record it named. Default scope: every phase insubmitted | running.--phase RELnarrows.--applystill needs a refresh stamp and still movesrunning → pulled → awaiting-ruling, rehearsed on a copy; it writes nothing else.Left undone (prompt item 2)
rulings/AGENTS.mdstill documentsrule --alsoin one sentence.rulings/is append-only and was out of bounds for this phase; it is a one-line fix for whoever next edits that file.Heart
RED at ship time and not acknowledged:
"release validation FAILED (stage integrate)","PyAutoArray: open PR 11d old". Both are release-chain facts about other repos; neither organ here is in the release chain. PRs were opened, nothing was merged.🤖 Generated with Claude Code
https://claude.ai/code/session_013HsZA1ufn3msgPiDFxEXa6
Jammy2211 commentedon Sep 4, 2026
Shipped
Phase 1 of the
cortex-checkinepic — the review-slot and gate apparatus is retired.fc1cb32f6e226ddd2da24448769f1f77ebed64216cd6220e8e86711919c8261d3230564f22b09036Both merged to
mainon 2026-09-04, Brain before Cortex (the Cortexrefreshworkflow renders through PyAutoBrain
main, so its check only goes green oncethe matching Brain PR has landed — it did, on the re-run).
PyAutoCortex#10 needed a merge of
origin/maininto its branch first:mainhad moved under it (the dashboard self-heal commit
1a39784and the gate-gradecommit
1815c69), conflicting on the two generated pages. Resolved byregenerating
dashboard.md+dashboard.htmlwith the phase-1 renderer ratherthan hand-resolving them, keeping
main's gate flip (State: ready) onphases/euclid/dr1_prelim_10_lens_science_run.mdand dropping theGates-cleared:key this phase retires (schema decision 58). Merge commit2ddb47b.Heart was RED at merge time with two reasons — "release validation FAILED
(stage integrate)" and "PyAutoArray: open PR 12d old" — both release-chain facts
about other repos. Neither PyAutoBrain nor PyAutoCortex is in the release chain,
so the merge went ahead under an explicit human acknowledgement.
Closed by
/prm.