Skip to content

feat(batch): the collect verb — score members into the review packet - #333

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

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

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Closes #332. PyAutoMind prompt: active/batch_conductor.md (two-slot-batching phase 2; queue.md #8 — "next verb = collect"). Scope: the collect verb only — slice is re-filed as its own prompt at close-out.

Summary

pyauto-brain batch collect — the review-side half of the batch conductor. It reads a batch record, scores every dev member on six legs (pr · diff · checks · green · witness · adversary, each PASS / FAIL / UNOBSERVABLE), gives it one health word (FAILED · NOT-DELIVERED · SUSPECT · HEALTHY · PENDING · MERGED, failures first, not-delivered named loudly at the top), and emits the packet report. --apply writes the standalone HTML review packet per batches/packets/TEMPLATE.md — refreshed in place by member section id, every other member's markup byte-identical — and stamps the record (collected: once, refreshed: per apply, delivered: n/m, packet:). A submitted review (batches/reviews/<slot>.md) freezes the packet and closes the record (reviewed-at:, review-minutes-actual:, review: — fill, never overwrite).

Offline and stdlib-only by default. It has no GitHub of its own: a web session gathers PR state with the GitHub MCP tools and passes --evidence <json>; --fetch is the laptop's opt-in gh pr view per PR. No evidence is UNOBSERVABLE, never delivered — the offline default invents nothing. A self-run adversary leg is FAIL (AUTONOMY leg 5).

Built kind-neutral: KINDS = {"dev": …} is the extension point Cortex phase 5 uses to register the science member kind over the existing cortex conductor's score_phase/member_block — nothing rebuilt there.

Changes

  • agents/conductors/batch/_batch.py — the collect verb (record reader, three-pass active.md match, evidence loader / --fetch, legs + health, kind-neutral scored member, report / --json, packet renderer with pyauto:* sentinels and depth-aware section splicing, line-surgical record update rehearsed on a copy, the close leg, exit codes 0/1/2/4). plan unchanged.
  • agents/conductors/batch/packet.css, packet.js — the packet assets, ported from the 2026-08-31-pm reference and trimmed to what the template names; %%TOKEN%% substitution.
  • agents/conductors/batch/AGENTS.md, batch.sh, skills/batch/batch.md, bin/pyauto-brain (+ regenerated AGENTS.md verb row) — the collect recipe, the two-lane evidence rule, the close leg; "Not built yet" is down to slice.
  • tests/test_batch_collect.py — 32 tests.

API Changes

None to library code. New conductor verb batch collect and its flags (--slot --evidence --fetch --apply --out --stamp); batch plan behaviour unchanged (collect-only flags on plan are refused, rc 2).

Verification

  • python3 -m pytest -q -n auto tests → 776 passed (744 before).
  • Read-only on the real record: batch collect --mind ../PyAutoMind --slot 2026-08-31-pm → nine members SUSPECT (six UNOBSERVABLE legs, no evidence), the two science member lines reported as notes, exit 1, Mind tree untouched.
  • Packet: fresh render 67 KB, complete standalone document (<!DOCTYPE html>, own [hidden] reset, one <style>, one <script>, six sentinel regions), parses; a second --apply differs by exactly the refreshed stamp. Against the archived (sentinel-less) pm packet the refresh degrades to member splices plus a note, zero deletions, second apply byte-identical.
  • Close leg on a copy of the real pm record: the only change is one refreshed: line — PR OPENED AT REVIEW (…) outcomes, the prose delivered: and the annotated reviewed-at: all survive (two under-protections found in review and fixed before this PR).
  • Autonomous-ship gate: tests ✓ · smoke n/a (organ repo, no downstream script surface) · review (adversary, independent model) see the PR comment · Heart YELLOW 65 (manifest drift 1 mismatch; CI status unavailable in the web container — measurement blindness), acknowledged under the human's standing authorisation for this epic and recorded on the active.md entry.

🤖 Generated with Claude Code

https://claude.ai/code/session_011GD9gpi75AT2SgymYQyGiT


Generated by Claude Code

`pyauto-brain batch collect` reads a batch record, scores every dev member on
six legs (pr · diff · checks · green · witness · adversary — PASS / FAIL /
UNOBSERVABLE), gives it one health word (FAILED · NOT-DELIVERED · SUSPECT ·
HEALTHY · PENDING · MERGED, failures first) and emits the packet report.
`--apply` writes the standalone HTML packet per batches/packets/TEMPLATE.md,
refreshed in place by member section id with every other section
byte-identical, and stamps the record (collected: once, refreshed: per apply,
delivered:, packet:). A submitted review freezes the packet and closes the
record — fill, never overwrite; once closed no member line changes.

Offline and stdlib-only by default: a web session hands PR state over as
--evidence <json> (gathered with the GitHub MCP tools); --fetch is the laptop's
opt-in gh pr view per PR. No evidence is UNOBSERVABLE, never delivered. A
self-run adversary leg is FAIL (AUTONOMY leg 5). KINDS = {"dev": …} is the
extension point Cortex phase 5 registers the science member kind on.

Doctrine: batch AGENTS.md (the collect recipe), skills/batch/batch.md,
batch.sh, the registry description + regenerated verb row. 32 tests.

Closes #332.

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 590e203.

Witness — falsified and holds, on all three legs, by running it:

  • batch collect --slot 2026-08-31-pm offline → 9 SUSPECT dev members, the 2 science member lines reported as notes, exit 1; Mind tree untouched (the one dirty file, active.md, was this task's own pre-existing heart-ack edit — stash-and-rerun left git status clean).
  • Fresh slot, --apply twice → a complete standalone document; the second apply differs by the refreshed stamp only, plus one refreshed: record line.
  • Closed batch (2026-08-31-pm, has a review file) → record gains exactly one refreshed: line, packet byte-identical.

Adversarial inputs tried: an outcome with seven — segments (preserved whole, maxsplit=3); - notes: before - members: (no member misparse, no notes leakage); a merged PR with checks: [] (MERGED short-circuits — by design, a retrospective is not scored on missing evidence); a slug with a double quote (id escaped, MEMBERS JSON round-trips); a slug containing </script><script>… (exactly one real script pair; the payload appears only <-escaped inside JSON).

Dispositions (one per lifted claim):

  • "no evidence is UNOBSERVABLE, never delivered" → basis-cited: the offline run + test_no_evidence_at_all_is_unobservable_not_delivered
  • "a self-run adversary leg is FAIL" → basis-cited: test_a_self_run_adversary_is_an_absent_leg + leg_adversary
  • "every other member's markup byte-identical on refresh" → basis-cited: the fresh-slot diff + test_a_refresh_regenerates_one_section_and_leaves_the_others_alone
  • "the notes: | block is never touched" → basis-cited: test_the_notes_block_survives_a_record_rewrite_byte_for_byte + the closed-batch diff
  • "html-escaped; a </script> slug cannot end the script" → basis-cited: the adversarial slug run + test_every_interpolated_value_is_escaped
  • "plan behaviour unchanged" → basis-cited: the diff touches no pre-existing function body; live plan run sane
  • "stdlib only, offline by default" → basis-cited: the import list; --fetch/--evidence gating by code read
  • "exit codes 0/1/2/4" → basis-cited: RC_* constants + test_exit_codes + the live rc=1
  • "the packet is a complete standalone document" → basis-cited: the fresh-slot run + test_apply_writes_a_complete_document_and_the_record_keys
  • "collect writes nothing without --apply" → basis-cited: the stash-and-rerun isolation

Verdict: CLEAN. No must-fix findings. Tests: 776 passed (pytest -n auto). 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

CI's tenant-firewall leg flagged the packet renderer's literal Mind home
and the test fixtures' repo names. `_mind_home` now resolves the owner from
the Mind checkout's origin remote, then its README, and otherwise returns
nothing — the packet's Commit-on-GitHub button disables itself with a hint
rather than the renderer guessing a home. Test fixtures use neutral names.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011GD9gpi75AT2SgymYQyGiT
@Jammy2211
Jammy2211 merged commit 16e2a77 into main Sep 2, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the claude/cortex-birth-phases-1-3-u9pq77 branch September 2, 2026 03:34
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 collect verb — score members into the review packet

2 participants