Repository navigation
Description
Overview
Phase 4 of the mind-post-cortex epic (assessment gaps 3, 4, 5 and 7). The
batch conductor plans every shift as if the review queue were empty, ignores
the one file the human maintains by hand (queue.md), declines to say what
order the shift's PRs should be merged in, and leaves per-member outcomes
UNREVIEWED forever. lifecycle.py check never opens a batch record at all,
so a member citing a prompt path that does not resolve — the 2026-08-31-pm
record has one — is invisible.
Two PRs: PyAutoBrain (agents/conductors/batch/_batch.py, its AGENTS.md,
tests) and PyAutoMind (scripts/lifecycle.py check + tests, queue.md
contract wording, batches/AGENTS.md, the pm record's bad member line).
Prompt: PyAutoMind/active/mind_post_cortex_p4_batch_plan_fidelity.md.
Epic ledger: draft/maintenance/pyautomind/mind_post_cortex_epic.md.
Plan
- Derive
--awaiting-reviewfromactive.mdinstead of defaulting to 0:
a row carrying alibrary-pr:/workspace-pr:key (phase 3's keys, the
primary signal) or astatus:containingawaiting-merge/PR open
(the fallback for rows written before phase 3) is a task awaiting review.
The flag still overrides; the plan header prints which source was used. - Wire
queue.mdorder into the plan's ranking — a queued prompt outranks
an unqueued one, and among queued the file order wins — then correct
queue.mdto say exactly whatplanreads (that file, thedraft/backlog
and the derived awaiting-review count; nothing live from GitHub). - Fill a per-member
outcome:atbatch collectfrom the ledger alone
(complete/record →merged; still inactive.md→carried; a review
ruling →rejected-at-review; otherwiseunreviewed), record it on the
batch record, and let the nextplanreport the previous slot's carried
members first. - Emit a
merge-order:block in the collect packet and the record —
dispatch order, library repos first, same-repo members serialised. It is
advice for the human's/prmsequence, never an action. - Two batch-record drift legs in
lifecycle.py check: a member whose
prompt path resolves nowhere (error), and a closed record with no
review-minutes-actual:(warning — the only calibration there is). Fix the
2026-08-31-pm record's bad member line as part of it.
Detailed implementation plan
Affected Repositories
- PyAutoBrain (primary)
- PyAutoMind
Suggested branch: feature/mind-post-cortex-p4-batch-fidelity
Branch survey: PyAutoBrain main clean, PyAutoMind main clean. The Mind leg
is stacked on phase 3 (feature/mind-post-cortex-p3-pr-ledger, PR #393):
phase 3 adds registry_multi, _record_fields and the cmd_check tail this
phase extends, and _as_root to tests/test_lifecycle_check.py. The Mind PR
therefore targets that branch and is retargeted to main after #393 merges.
PyAutoBrain branches from main — phases 2 and 3 touch _intake.py,
_sizing.py and skills, never _batch.py.
Implementation Steps
_batch.py—derive_awaiting_review(mind): readactive.mdthrough the
existingread_active(), count entries whoselibrary-pr:/workspace-pr:
keys carry a PR URL, or whosestatus:matchesawaiting-merge/
pr open/pr-open. CLI--awaiting-reviewdefaults toNoneso a
flag of0is still an override;_main_planderives when it is absent.
plan()records the source inbackpressure["source"]andemit()prints
it in the header._batch.py—read_queue(mind): parsequeue.md's## <n>. <label>
sections, keepkind: promptentries with aref:, in file order.
queue_rank(record, queue)returns the entry index, orlen(queue)for an
unqueued prompt (match on the rel path, then the basename, so a prompt that
moved still ranks). The pool sort becomes
(queue_rank, review_minutes, priority_rank, path);emit()marks queued
members and prints how many queue entries were read._batch.py—member_outcome(member, ctx):complete/<slug>.mdrecord
exists →merged; a review file rules the member rejected →
rejected-at-review; the member'sactive.mdentry still exists →
carried; elseunreviewed.collect()puts it on each scored member and
record_update()writes an- outcomes:block (- <slug>: <outcome>),
set on an open record and filled on a closed one, asdelivered:/packet:
already are._batch.py—merge_order(members, dispatch_order): order by
(library-touching first, then dispatch order), annotate each entry with why
it sits there and which earlier member shares a repo with it. Rendered in
collect_report()'s summary and written to the record as- merge-order:.
plan()gains acarriedlist read from the previous record'soutcomes:.agents/conductors/batch/AGENTS.md— documentoutcome:,merge-order:,
the derived backpressure input and the queue read.lifecycle.py—batch_member_problems(root)(every top-level
batches/*.md; parse the member grammar; a prompt-shaped path must resolve
underdraft/,active/orcomplete/, by path or basename, or have
existed in git history — a moved-and-absorbed prompt is not drift) and
batch_record_warnings(root)(a record withreview:/reviewed-at:and no
realreview-minutes-actual:). Wired intocmd_check's phase-3 tail:
problems extendproblems, warnings extendwarnings.PyAutoMind/queue.md— replace the "reads this file, the backlog and the
open-PR state" sentence with whatplanactually reads.
PyAutoMind/batches/AGENTS.md— theoutcome:/merge-order:schema.
batches/2026-08-31-pm.mdL37 — cite the completion record that resolves
and drop the false "a path that never existed" clause (git history shows the
draft path existed and was deleted when the prompt was routed).- Tests:
PyAutoBrain/tests/test_batch_plan.py(derived count, flag override,
queue order),test_batch_collect.py(outcomes, merge order) and the
Cortex-conductor suite (the_batchsubstring trap in_cortex.py);
PyAutoMind/tests/test_lifecycle_check.py(both legs fire, and stay quiet
on a clean tree) with fictional fixtures only.
Key Files
PyAutoBrain/agents/conductors/batch/_batch.py—plan,emit,collect,
record_update, the CLI.PyAutoBrain/agents/conductors/batch/AGENTS.md— the record schema.PyAutoMind/scripts/lifecycle.py—cmd_checkand the two new legs.PyAutoMind/queue.md,PyAutoMind/batches/AGENTS.md,
PyAutoMind/batches/2026-08-31-pm.md.
Testing
pytest -q in both repos, plus python3 scripts/lifecycle.py check in Mind.
Known: test_cortex_conductor::test_a_fixture_tree_finds_the_schema_its_checkout_ships
fails in any task worktree (it reads the checkout's own schema), on main too.
Original Prompt
Click to expand starting prompt
Batch plan fidelity: derive backpressure, honour queue.md, emit merge order, check batch records
Type: feature
Target: pyautobrain
Repos:
- PyAutoBrain
- PyAutoMind
Themes: - mind-workflow
Difficulty: medium
Autonomy: safe
Priority: normal
Status: draft
Consequence: judge
Witness:pyauto-brain batch plan --dry-runwith a fixtureactive.mdholding threeawaiting-mergerows reportsawaiting_review=3without the flag and shrinks the proposal accordingly; a fixturequeue.mdorder is reflected inpriority_rank(top entry first among equals);batch collecton the 2026-08-31-pm fixture emits amerge-order:list that places library PRs before their workspace dependants and serialises same-repo members;lifecycle.py checkflags a batch record member whose prompt path does not exist and a closed record with noreview-minutes-actual:; all Brain and Mind tests pass
Review-minutes: 20
Unattended: ready
Epic: mind-post-cortex
Phase: 4
Filed: 2026-09-03
Phase 4 of mind-post-cortex — assessment gaps 3, 4, 5 and 7. Two PRs: Brain
(agents/conductors/batch/_batch.py + tests) and Mind (lifecycle.py + docs).
- Derive
--awaiting-review(gap 4, S)._batch.py~L2978: the flag
defaults to 0 and is never derived, so every plan assumes an empty review
queue. Countactive.mdrows whosestatus:containsawaiting-merge/
PR open(after phase 3, rows carrying a*-pr:key) and use that as the
default; the flag overrides. Print the derived count in the plan header. - Make
queue.md's contract true (gap 5, S).queue.mdL10-12 says the
planner reads it and the open-PR state;plan()(~L160-260) reads neither.
Wire queue order intopriority_rank(a queued prompt outranks an
unqueued one; among queued, file order wins) and correct the doc to say
exactly what is read. Open-PR state = the derived count from item 1; say
so. - Dev batch outcome accounting (gap 3, M — the part not covered by
carry-forward). Extend the batch record schema (batches/AGENTS.md)
with a per-memberoutcome:ofmerged | rejected-at-review | carried | unreviewedand makebatch collectfill it from the ledger (a
complete/record → merged; still inactive.md→ carried; review file
ruling → rejected) rather than leavingdecision: UNREVIEWED. The next
planreads the previous record'scarriedmembers first. - Merge order in the packet (gap 7, M).
collectdeclines today
(~L1261-1264: "members is sorted by HEALTH, so it cannot drive a merge
order"). Add amerge-order:block computed fromdispatch_order+
library-first (LIBRARY_REPOS) + shared-repo serialisation, rendered in
the packet's summary and the record. It is advice for the human's/prm
sequence, not an action. - Batch-record drift checks (gap 7, S).
lifecycle.py check: every
batches/*.mdmemberprompt:path must resolve (the pm record cites one
that never existed, L37); a record withclosed:/review present but no
review-minutes-actual:warns ("the only calibration there is",
batches/AGENTS.mdL66). Fix the pm record's bad path as part of this.
Tests: extend PyAutoBrain/tests batch fixtures (mind the _batch substring
trap in _cortex.py noted in memory) and Mind tests/test_lifecycle*.py.
Activity
Jammy2211 commentedon Sep 3, 2026
Shipped to two PRs, both green — merge stays human.
main): batch: derive backpressure, honour queue.md, account outcomes, emit a merge order #346 — pytest 3.12 + 3.13 pass._batch.pyitems 1–4 (derived backpressure,queue.mdorder, ledgeroutcome:,merge-order:), the conductor'sAGENTS.md, +25 tests.feature/mind-post-cortex-p3-pr-ledger— stacked on maintenance: resolve the session-start hook and the last hardcoded workspace paths #393, retarget to main after it merges): mind: drift-check the batch ledger, and say what the planner really reads PyAutoMind#394 — drift + refresh + privacy pass.lifecycle.py check's two batch-ledger legs,queue.md's corrected contract,batches/AGENTS.md, the 2026-08-31-pm record's bad member line, +19 tests.Test counts: PyAutoBrain 883 passed / 1 known worktree-only failure (
test_cortex_conductor::test_a_fixture_tree_finds_the_schema_its_checkout_ships, which fails onmainin a worktree too); PyAutoMind 394 passed,lifecycle.py checkOK with one honest warning (the pm record's missingreview-minutes-actual:).git merge-treeagainst the sibling phases: PyAutoBrain clean against both p2 and p3; PyAutoMind clean against p3 (its base), and against p2 the only conflicts are the generated dashboard pages — a control merge of p2 into p3 alone produces the identical hunks.Heart was RED at PR-open (PyAutoLens CI failure; release validation FAILED at stage integrate; PyAutoArray open PR 11d old). None touches this diff and the reason set is unacked for this task — merge needs your own call. Recorded verbatim on the
active.mdrow.Two notes for whoever merges: the witness line names
batch plan --dry-run, and there is no such flag —planwrites nothing, so it is dry by construction; and the merge order can only name repos it can see (promptRepos:, PR URLs, theactive.mdrow), so on a historical slot whose prompts were absorbed into completion records it falls back to dispatch order and says so.Jammy2211 commentedon Sep 3, 2026
Shipped
Phase 4 of the
mind-post-cortexepic. Both PRs merged 2026-09-03.d442df5dc00098e1Brain (
agents/conductors/batch/_batch.py, itsAGENTS.md, two test modules).--awaiting-reviewis derived fromactive.mdinstead of defaulting to 0 (a rowcarrying
library-pr:/workspace-pr:, or astatus:readingawaiting-merge/PR open); the flag still overrides and the plan header names the source.queue.mdorder is wired into the ranking — a queued prompt outranks an unqueuedone, file order wins among queued, and an entry written against
draft/…keepsits place after the prompt moves to
active/.batch collectfills a per-memberoutcome:(merged | rejected-at-review | carried | unreviewed) from the ledgeralone — no
ghcall — and emits amerge-order:block (dispatch order, libraryrepos first, same-repo members serialised) as advice for the human's
/prmsequence, never an action. The next
planreads the previous slot'scarriedmembers first.
Mind (
scripts/lifecycle.py, tests,queue.md,batches/AGENTS.md, the pmrecord).
lifecycle.py checknow opens the batch records: a member whoseprompt:path resolves in no state folder and has never existed in git historyis drift (error); a closed record with no
review-minutes-actual:is a warning(and stays a warning — it is the only calibration there is). The check degrades
to a single warning in a shallow clone, where "has this path ever existed" is
unanswerable, so
lifecycle_drift.ymlnow checks out atfetch-depth: 0.queue.mdsays whatplanactually reads (this file, thedraft/backlog, thederived review-queue depth — nothing live from GitHub);
batches/AGENTS.mddocuments the
outcomes:/merge-order:schema; the 2026-08-31-pm record'ssubhalo-follow-up-wavemember now cites a path that resolves, and its false"a path that never existed" clause is gone.
CI green on both merge heads: Brain Tests pytest 3.12 + 3.13; Mind Dashboard
Refresh, Lifecycle Drift and Spawn Drift.
Closed out via
/prm; recordcomplete/2026/09/mind-post-cortex-p4-batch-fidelity.md.Next: phase 5 (Heart freeze flag, issue PyAutoHeart#196).