Skip to content

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

Closed

Description

@Jammy2211

Overview

The batch conductor is plan-only; both 2026-08-31 review packets were hand-built. This task ships pyauto-brain batch collect — the two-slot-batching epic's remaining review-side verb (queue.md #8): assert each member's delivery (a PR with a non-empty diff and checks that ran — green is not delivered), report not-delivered members loudly at the top, run failures-first, write/refresh the standalone HTML review packet in place, stamp the batch record, and close it from the human's review file (the only calibration the review-minute estimate ever gets). Built kind-neutral so Cortex phase 5 registers the science member kind without a rebuild. slice is out of scope and is re-filed as its own prompt at close-out.

Plan

  • Add collect to agents/conductors/batch/_batch.py: read the batch record losslessly, resolve each member's prompt (Witness:), active.md entry (three-pass match) and optional --evidence JSON (filled from the GitHub MCP tools on the web; --fetch via gh on the laptop).
  • Score six legs (pr · diff · checks · green · witness · adversary) as PASS/FAIL/UNOBSERVABLE; health FAILED · NOT-DELIVERED · SUSPECT · HEALTHY · PENDING · MERGED, sorted failures-first; a self-run adversary leg is an absent leg (AUTONOMY leg 5).
  • Emit the markdown report / --json; --apply renders the TEMPLATE.md packet (batches/packets/<slot>.html, sentinels + in-place per-member section refresh) and stamps the record (collected:, refreshed:, delivered:, packet:); a submitted review closes the record and freezes the packet.
  • KINDS = {"dev": …} registry as the phase-5 extension point.
  • Doctrine: batch AGENTS.md, skills/batch/batch.md, batch.sh, bin/pyauto-brain description + agents-surface regen.
  • Tests: tests/test_batch_collect.py (~25 cases).
Detailed implementation plan

Affected Repositories

  • PyAutoBrain (primary)
  • PyAutoMind (ledger only: prompt → active/, active.md, completion record)

Branch Survey

Repository Current Branch Dirty?
./PyAutoBrain claude/cortex-birth-phases-1-3-u9pq77 (= origin/main) clean
./PyAutoMind claude/cortex-birth-phases-1-3-u9pq77 (= origin/main) clean

Suggested branch: claude/cortex-birth-phases-1-3-u9pq77 (web-github lane: the session branch is the PR branch; no worktree)

Implementation Steps

  1. _batch.py: parse_member (split on —, maxsplit 3; -- accepted; unparsable lines → notes), lossless line-indexed read_record, newest_slot, find_prompt/prompt_facts (basename across draft/active/complete), read_active/active_for (slug · prompt basename · "member ").
  2. Evidence: load_evidence (--evidence JSON schema: prs[] with checks[], witness{holds}, adversary{ran, model, author_model}, flagged[], pending, summary), fetch_evidence (gh pr view --json … only when gh exists; else one pointer line).
  3. Legs LEGS = (pr, diff, checks, green, witness, adversary), health_of, HEALTHS sort order; score_dev/dev_blocks; KINDS registry; collect() → the decision dict; collect_report/emit/--json.
  4. Packet: packet.css/packet.js assets ported from the 2026-08-31-pm reference with %%TOKEN%% substitution; packet_html with pyauto:* sentinels, section_span depth-aware in-place refresh, PENDING sections, archived sentinel-less packets degrade to member splices + a note.
  5. record_update (member outcome rewritten unless it starts with a ruling word; collected: once; refreshed: per apply; delivered:/packet: by key lookup; inserts before - notes:), rehearsed on a temp copy; close leg from batches/reviews/<slot>.md (reviewed-at:, review-minutes-actual:, review:; packet never rewritten).
  6. CLI: verb plan|collect; --slot --evidence --fetch --apply --out --stamp; exit 0/1/2/4.
  7. Doctrine + surface regen; tests.

Key Files

  • agents/conductors/batch/_batch.py — the conductor (plan + collect)
  • agents/conductors/batch/packet.css, packet.js — packet assets
  • agents/conductors/batch/AGENTS.md, batch.sh, skills/batch/batch.md, bin/pyauto-brain — doctrine and surface
  • tests/test_batch_collect.py — the witness
  • agents/conductors/cortex/_cortex.py — the science collect this mirrors (phase 5 registers it as a kind)
  • PyAutoMind/batches/AGENTS.md, batches/packets/TEMPLATE.md, batches/reviews/AGENTS.md — the schemas

Original Prompt

Click to expand starting prompt

PyAutoMind/draft/feature/pyautobrain/batch_conductor.md (Batch phase 2 — the batch conductor: plan, slice, collect). This issue covers the collect section only:

batch collect — the packet

Gather each member's outcome: what changed and why in one line, the witness and whether it holds, the diff size, which gate legs actually ran and what they returned, any flagged decision, and the links. Ordered failures-first.

Assert delivery rather than inferring it: a PR exists, its diff is non-empty, its checks ran. Green is not done — officially, a cloud session's green status "means the session started and exited without an infrastructure error. It does not mean the task in your prompt succeeded." A member that ends green with no PR is reported not delivered, loudly, at the top.

Record the human's actual review minutes per member when the slot ends. That is the only thing that will ever calibrate phase 0's estimate.

Done when

  • plan | slice | collect run offline and stdlib-only, like every Brain entrypoint.

Full prompt: PyAutoMind draft/feature/pyautobrain/batch_conductor.md (moved to active/ on issue).

Activity

  1. Jammy2211 commented on Sep 2, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    • PR: feat(batch): the collect verb — score members into the review packet #333 — merged 16e2a77 (head 11c319b; feature 590e203 + tenant-firewall fix 11c319b).
    • What landed: pyauto-brain batch collect — six legs (pr · diff · checks · green · witness · adversary, PASS / FAIL / UNOBSERVABLE), one health word (FAILED · NOT-DELIVERED · SUSPECT · HEALTHY · PENDING · MERGED, failures first), the markdown report / --json, --apply rendering the standalone review packet in place by member section id and stamping the record, the close leg from a submitted review (fill, never overwrite), --evidence (web, via the GitHub MCP tools) / --fetch (laptop, gh), KINDS as Cortex phase 5's extension point. Doctrine in the batch conductor's AGENTS.md ("The collect recipe"), skills/batch/batch.md, batch.sh, the registry row. 32 tests; suite 776 green on 3.12 and 3.13.
    • Gate: tests ✓ · smoke n/a (organ repo) · review CLEAN by an independent Sonnet adversary (witness run, dispositions on the PR) · Heart YELLOW 65 acknowledged under the human's standing authorisation, recorded on the Mind active.md entry.
    • Scope: the collect verb only. slice is re-filed as PyAutoMind/draft/feature/pyautobrain/batch_slice.md; queue.md PyAutoBrain: full Stages 0-3 release-validation orchestrator (M4) #8 retires with this. Unblocks cortex-birth phase 5.
    • Mind: completion record complete/2026/09/batch-collect.md (close-out commit follows).

    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions