Skip to content

feat(batch): the cortex member kind — separate records, rolling board, carry-forward (Cortex phase 5) - #335

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/cortex-birth-phases-1-3-u9pq77
Sep 2, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
claude/cortex-birth-phases-1-3-u9pq77

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Closes #334. PyAutoMind prompt: active/cortex_batch_member_kind.md — cortex-birth phase 5. Gates: Cortex phase 2 (shipped) and the collect verb (#332, shipped). Companion doctrine PR in PyAutoCortex (batches/AGENTS.md, packets/AGENTS.md); merge this one first.

Summary

The batch conductor gains its second member kind. --kind dev|cortex|both, defaulting from the lane: local-dev offers both, a cloud session dev only and reports the Cortex ready count. The phase-2 cortex conductor is folded in, not rebuilt: _cortex.py is imported lazily by file location and is unchanged (it stays Mind-free for the Cortex's own dashboard_refresh.yml).

  • plan --kind cortex — _cortex.census + _cortex.plan: ready + witness + budget + lane, no autonomy cap, no library-repo clash in either direction (a science run claims no library worktree). Launch lines printed, never executed. --apply --review-at <ISO> [--slot] [--shift] [--stamp] opens PyAutoCortex/batches/<slot>.md in the Cortex schema — refused without --review-at (the shift is dispatch → review-at, and it is the human's), refused on an existing slot, rehearsed with the Cortex's own check on a copy.
  • collect --kind cortex — the rolling board. score_cortex/cortex_blocks registered as KINDS["cortex"] over score_phase/member_block; the Cortex health words (HEALTHY · SUSPECT · FAILED · RUNNING), the four ruling verbs, ### follow-ups, (none) default; a RUNNING member renders a live strip and no review control, excluded from the progress count. Phase moves and refreshed: lines go through the Cortex's _apply_checked; the record gets collect keys only (member state column never touched); the packet is spliced in place through the shared renderer, parametrised per organ. After the moves the board is re-scored so a member the apply just delivered gets its review controls in the same packet. May run any number of times per slot; ruled members and every other section stay byte-identical. --pull laptop-only; --fetch/--evidence dev-only; --review-at re-declares the horizon at a refresh.
  • Carry-forward, Cortex-side. At close, - carried: <slug> — still <state> at review per still-live member; the next plan --kind cortex --apply includes them at their current state with - carried-from: — the human never re-specifies them. Absorbs queue.md Relocate the Health Agent into PyAutoBrain (canonical home) #2's science side.
  • Doctrine. AUTONOMY.md leg 4 ("Which record — 2026-09-02": a member reads its own organ's record; "no record → solo --auto" unchanged for dev, inapplicable to cortex). Batch AGENTS.md ("Two kinds, two records", --kind under Running, exit 5). skills/batch/batch.md (the Cortex recipe, two records / two review-at:s).

Two decisions

  1. No heart-ack: / expected-effects: on a Cortex record. The Cortex's own batches/AGENTS.md drops them (the Heart gates releases, not runs; no autonomy leg to license) and a science member is never --auto, so nothing reads them — the prompt's heart-ack: n/a (cortex) wording is overridden by the organ's schema, and their absence is never read as an unacknowledged RED (AUTONOMY.md says so).
  2. A RUNNING member has no review control at all and its submitted section defaults to (none); carry-forward, not an unclickable leave-to-finish, moves it to the next board.

Changes

  • agents/conductors/batch/_batch.py (+926/−57), packet.js (three token-driven edits: follow-ups heading, default decision, reviewable-aware progress).
  • tests/test_batch_kinds.py (21 tests), tests/_cortex_board.py (the cortex board fixture builder, lifted out of test_cortex_conductor.py unchanged in behaviour).
  • AUTONOMY.md, agents/conductors/batch/AGENTS.md, skills/batch/batch.md.

API Changes

New flags on the batch conductor: --kind, --cortex DIR, --cortex-budget N, --review-at ISO, --shift LABEL, --pull; --slot/--apply/--stamp accepted on plan only with an explicit --kind cortex; exit code 5 = no usable Cortex tree. Dev plan/collect behaviour unchanged. _cortex.py unchanged.

Verification

  • python3 -m pytest -q -n auto tests → 797 passed (776 before). Tenant firewall OK.
  • Cloud session, real trees, read-only: plan --kind cortex reports the ready count and plans nothing; --lane local-dev proposes only ready phases (none today); dev plan proposes no phases/ path; both trees untouched.
  • Scratch copy of the real Cortex: plan --kind cortex --apply --review-at … --slot 2026-09-02-test → record written, cortex check: OK; collect --kind cortex --apply on the four awaiting-ruling phases → a 60 KB standalone packet; second apply: record byte-identical, packet differs by the stamp only, tree still checks.
  • Closed record 2026-08-31-pm: report-only writes nothing; --apply leaves record and archived packet byte-identical, names the three already-ruled members.
  • Gate: tests ✓ · smoke n/a (organ repo) · review — independent Sonnet adversary, see the PR comment · Heart YELLOW 65 (manifest drift 1 mismatch; CI status unavailable in the web container) acknowledged under the human's standing authorisation and recorded on the Mind active.md entry.

🤖 Generated with Claude Code

https://claude.ai/code/session_011GD9gpi75AT2SgymYQyGiT


Generated by Claude Code

…, carry-forward

Cortex-birth phase 5. The batch conductor gains `--kind dev|cortex|both`
(default from the lane: local-dev offers both, a cloud session dev only and
reports the Cortex ready count). `plan --kind cortex` folds in the phase-2
cortex conductor's census + plan (ready + witness + budget + lane; no autonomy
cap, no library-repo clash in either direction) and `--apply --review-at`
opens `PyAutoCortex/batches/<slot>.md` in the Cortex schema — refused without
the human's review-at, rehearsed with the Cortex's own check. `collect --kind
cortex` scores members through `score_phase`/`member_block` into the shared
kind-neutral packet: Cortex health words (HEALTHY · SUSPECT · FAILED ·
RUNNING), the four ruling verbs, `###` follow-ups, RUNNING members with no
review control; phase moves and `refreshed:` lines through the Cortex apply,
collect keys only on the record, the packet spliced in place. Carry-forward:
`carried:` lines at close, `carried-from:` on the next record. `_cortex.py`
is imported lazily and unchanged (Mind-free by design).

Doctrine: AUTONOMY leg 4 (a member reads its own organ's record), batch
AGENTS.md ("Two kinds, two records"), skills/batch/batch.md (the Cortex
recipe). 21 tests; the cortex board fixture builder shared as
tests/_cortex_board.py.

Closes #334.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011GD9gpi75AT2SgymYQyGiT

Copy link
Copy Markdown
Contributor Author

Autonomous-ship gate — leg 5, independent adversary (AUTONOMY.md, review faculty step 2b). Reader: Sonnet (a different model from the Opus implementer and the Fable architect). Surface: pyauto-brain review --repo PyAutoBrain --witness … --adversary on 6f3ece4.

Witness — falsified and holds, by running it: plan --kind cortex in this cloud session → CortexPlan, nothing planned, the ready count reported (the real Cortex has 0 ready phases today, confirmed with --lane local-dev too); dev plan proposes only draft/… prompts, no phases/ path; on a scratch board with a ready phase, plan --kind cortex --apply --review-at … --slot 2026-09-02-adv wrote a record that passes the Cortex check; collect --kind cortex --apply twice changed only the packet's refreshed stamp, record byte-identical, both real trees untouched before and after every run.

Dispositions (one per lifted claim):

  • "_cortex.py is imported lazily and unchanged" → basis-cited: the diff has zero hunks in _cortex.py; its import block is stdlib plus _pyauto_root/_theme, no Mind reference
  • "no autonomy cap, no library clash in either direction" → basis-cited: plan_cortex calls cx.plan, which references neither; a phase with no Autonomy: header was admitted (test + own rebuild)
  • "a Mind record never lists a Cortex member and vice versa" → basis-cited: test_neither_record_ever_lists_the_others_members + own run (member lines all phases/…)
  • "RUNNING members hold no review control and are excluded from the progress count" → basis-cited: own run — class="member running", no data-decision/data-ruled, "reviewable": false, Ruled 0 of 0
  • "the record's state column stays a phase state" → basis-cited: own runs (only ready/running/awaiting-ruling/pulled observed; check_problems == [] throughout)
  • "### follow-ups and (none) default for the Cortex; ##/UNREVIEWED unchanged for dev" → basis-cited: the rendered packet.js constants + the untouched task-1 test still asserting ## Follow-ups accepted
  • "an awaiting-ruling member is not re-stamped on every refresh" → basis-cited: a fourth collect on an awaiting-ruling board produced a byte-identical record
  • "carried members appear on the next record without being named" → basis-cited: own run — carried: written once at close (idempotent), the next plan --kind cortex --apply included the member with carried-from:
  • "the close leg fills, never overwrites" → basis-cited: own run — close fields appended once; two further collects, zero diff
  • "dev behaviour unchanged" → basis-cited: test_batch_collect.py/test_batch_plan.py untouched and green (116/116); the test_cortex_conductor.py diff is a pure fixture extraction

Adversarial inputs: collect --kind both → usage error rc 2; plan --kind cortex --apply on an existing slot → refused, nothing overwritten; a member path with a space → unparsable line reported, no crash; a phase in State: pulled whose run line still says running → moved to awaiting-ruling without a cross-check — the phase-2 apply_ops behaviour (state is authoritative), untouched by this branch and out of its scope; noted as a pre-existing Cortex-side consistency gap.

Verdict: CLEAN. No must-fix findings. Tests 797 passed; tenant firewall OK. Heart at ship: YELLOW 65 (manifest drift 1 mismatch; CI status unavailable in the web container — measurement blindness), acknowledged under the human's standing authorisation for the cortex-birth epic and recorded on the Mind active.md entry.


Generated by Claude Code

@Jammy2211
Jammy2211 merged commit e917269 into main Sep 2, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the claude/cortex-birth-phases-1-3-u9pq77 branch September 2, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(batch): the cortex member kind — separate records, rolling board, carry-forward (Cortex phase 5)

2 participants