Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,22 @@ jobs:
run: bash PyAutoBrain/bin/install.sh --check-project-discovery
# A skill's SKILL.md + body is MANDATORY context every time the skill
# loads, so line count is a per-invocation token cost, not a style
# preference. Report-only: `batch` and `prm` are over the 200-line budget
# today and trimming them is its own task — this step makes the debt
# visible on every PR without reddening a gate nobody can currently pass.
# preference. Report-only while `start_dev` and `prm` are over the
# 200-line budget: batch, cortex and Mind's create_issue were trimmed
# under it on 2026-11-07 and PyAutoBrain#597 brings the last two under.
# Once both are on main, drop `continue-on-error` to make this blocking
# (PyAutoMind draft/maintenance/organs/reduce_session_token_load.md).
- name: Skill line-count budget (report-only — known offenders)
continue-on-error: true
working-directory: PyAutoBrain
run: bash bin/check_skill_line_counts.sh
# The token-load numbers the same Mind prompt targets (AGENTS.md tokens,
# start_dev / prm procedure lines, completion-record median), printed on
# every PR so the budget is measured rather than remembered. `report`
# always exits 0: this layout has no workspace AGENTS.md or PyAutoMemory
# checkout, so `check` would fail on what is absent, not on a regression.
- name: Token load report (report-only)
run: python3 PyAutoMind/scripts/token_load.py report --root "$GITHUB_WORKSPACE"
- name: Tenant firewall (instance facts stay in declared config surfaces)
run: >
python3 PyAutoMind/scripts/repos_sync.py --check
Expand Down
152 changes: 39 additions & 113 deletions skills/batch/batch.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ never dipped, and every dipped pick carries a one-line reason in the digest.
Report, per task they named:

- **taken** — with its tier and review-minutes;
- **rejected, and why** — in the planner's own words. The reasons that come up
most: `autonomy human-required — would park at ship` (it cannot run unattended
at all — it would stop at the ship checkpoint and come back as a question,
which is the failure this workflow exists to remove; `supervised` no longer
parks there, see AUTONOMY.md "Decide-and-flag"), `Status: says the work is
already done`, `epic <slug> phase N is not next`, `<repo> already claimed this
shift`, `would exceed the budget`.
- **rejected, and why** — in the planner's own words. Most common:
`autonomy human-required — would park at ship` (it cannot run unattended; it
would come back as a question — `supervised` no longer parks, AUTONOMY.md
"Decide-and-flag"), `Status: says the work is already done`, `epic <slug>
phase N is not next`, `<repo> already claimed this shift`, `would exceed the
budget`.

If everything they named is rejected, **say so plainly and offer the planner's
own proposal instead** — never hand back a batch they did not ask for as though
Expand Down Expand Up @@ -71,65 +70,34 @@ In order:
library; they are the ONLY thing a later "generated by an earlier member"
YELLOW classification may match against (`AUTONOMY.md`, leg 4).
2. Write `PyAutoMind/batches/<YYYY-MM-DD>-<am|pm>.md` from the schema in that
folder's `AGENTS.md` — members, planned review-minutes, the reason set, `expected-effects:` and
**`review-at:`** — **before** any session starts. That file is what makes the
launch auditable. `review-at:` is when the human expects to be back, and it
is where the grant expires; **if they did not say, ask before dispatching.**
It is the one thing only they know — never infer it from a schedule, a
previous batch, or the time of day, and do not dispatch without it.
**If the human says they will want to *run* the batch, write
`- integration: yes` into the record** — collect then builds the review's
integration worktree without anyone remembering a flag.
3. Start one session per member, each carrying `/start_dev <path> --auto`
plus the member-session contract below — the batch record is what informs a
member of the shift's grant (it reads it at leg 4), not the dispatch line. Spawn them if this harness can; otherwise hand
the human the lines to paste. **One session per member, never shared**: a
shared session serialises them and carries one member's context into the
next. **`local-dev` members go first** (2026-08-31): they are pasted into
laptop CLI chats and their RAL submissions queue while the laptop is still
on — the priority use of the remaining laptop hours is getting cluster
queues running; cloud members follow, they do not need the laptop.

**The member-session contract (2026-08-31, both measured that night):**

- *Spawned from the orchestrator's session template, never bare*
(2026-11-03). Under a brief, every worker starts from the same template
the orchestrator uses — sources, bootstrap, the brief's path — so the two
points below are met by construction rather than remembered.

- *Spawned cloud sessions need sources and a bootstrap preamble.* A session
created bare (environment inherited, no source repos) has no clones, no
skills and no GitHub scope — the whole first wave died on
`Unknown command: /start_dev`. Seed `PyAutoMind@main` as the session
source and prepend: run `scripts/session_bootstrap.sh`; attach
PyAutoLabs/PyAutoBrain via `add_repo` (push) + `register_repo_root`; read
`PyAutoBrain/skills/GITHUB_ACCESS.md`; read the batch record; then follow
`skills/start_dev/start_dev.md` for the prompt in `--auto` mode.
- *Members END at their deliverable — a green PR, a posted verdict, or a
park.* The dispatch line must say, and members must obey: **do not watch
the PR, do not `subscribe_pr_activity`, do not schedule check-ins or
routines after the last push.** The batch review owns everything that
follows. This is no longer a batch-only exemption: every session ends at
its deliverable (`PyAutoMind/policy/end_at_deliverable.md`), `/prm`
included.
Five members self-armed 2–4-hourly check-ins on green PRs overnight and
drained usage with no task active. At collect, the orchestrator deletes
any member-armed routine it finds and archives finished member sessions.
folder's `AGENTS.md` — members, planned review-minutes, the reason set,
`expected-effects:` and **`review-at:`** — **before** any session starts;
that file makes the launch auditable. `review-at:` is when the human expects
to be back and where the grant expires: **if they did not say, ask before
dispatching** — never infer it from a schedule, a previous batch, or the
time of day. **If they will want to *run* the batch, write
`- integration: yes` into the record** (collect then builds the worktree).
3. Start one session per member, each carrying `/start_dev <path> --auto` plus
the member-session contract below (the batch record informs a member of the
shift's grant at leg 4, not the dispatch line). Spawn them if this harness
can; otherwise hand the human the lines to paste. **One session per member,
never shared** — sharing serialises them and leaks context. **`local-dev`
members go first** (2026-08-31): their RAL submissions queue while the
laptop is still on; cloud members follow.

**The member-session contract** (2026-08-31) is in [`reference.md`](reference.md):
members spawn from the orchestrator's template with sources and the bootstrap
preamble, and **END at their deliverable** — no PR watching, no
`subscribe_pr_activity`, no check-ins (`PyAutoMind/policy/end_at_deliverable.md`).
4. **Open the packet at dispatch** (2026-08-31): write the review page to
`PyAutoMind/batches/packets/<date>-<slot>.html` with every member present —
dev members as stubs, overnight runs as **PENDING** entries — and stamp it
`generated:`. The human wakes to a live page, not a blank; the morning
collect fills it in.
5. Confirm what was dispatched, and stop. Do not follow the runs.

**Brief verbs.** `bin/pyauto-brain batch brief --check <file>` validates a
brief against the `batches/AGENTS.md` schema (every error names its key;
exit 1 refuses it), and `batch plan --brief <file>` composes inside it: named
tasks first, then only the backlog its policy covers, against its
`review-minutes:`. Run the check before writing a brief's `review-at:` into
`batches/`. Dispatch is the watcher's (below), not a verb. `batch digest
--record <file>` prints a shift's digest and writes nothing; the record append
and the one issue comment are the watcher's, at `review-at:`.
**Brief verbs** (`batch brief --check`, `batch plan --brief`, `batch digest`):
[`reference.md`](reference.md). Run the check before writing a brief's `review-at:`.

## The watcher (phases 3a–3d)

Expand All @@ -150,47 +118,18 @@ What a tick does, its state, caps and the install commands: `agents/conductors/b
bin/pyauto-brain batch collect --slot <date>-<slot> --evidence ev.json --apply
```

- **Gather the evidence, then hand it over.** Collect has no GitHub of its
own. In a web session, read each member's PRs with the GitHub MCP tools
(`pull_request_read` for state and diff counts, the check rollup or
`actions_list` for the checks — `PyAutoBrain/skills/GITHUB_ACCESS.md` maps
each operation) and write them into the evidence JSON that the conductor's
`AGENTS.md` documents under "The collect recipe". On the laptop lane
`--fetch` does the same by running one `gh pr view` per PR. Run it once
without `--apply` to read the report; run it again with `--apply` to write
the packet and stamp the record.
- **"I want to run the whole batch."** —
`bin/pyauto-brain batch collect --slot <date>-<slot> --integration --apply`
(laptop only). One worktree root per slot under
`~/Code/PyAutoLabs-wt/integration-<slot>/`, each affected repo on
`integration/<slot>` cut from `origin/main` with every member's head merged
in dispatch order. Hand the human the `source <root>/activate.sh` line: once
it is sourced a **library** member's change is live anywhere (it is on the
`PYTHONPATH`), while a **workspace** member's script must be run from inside
`<root>/<workspace>`. A member that conflicts is **left out and named with
the conflicting files** — report that as the answer to "how would this
resolve at the end?", not as a failure. Nothing is pushed, no PR is opened,
no remote ref is touched. If the reviewer needs it on another machine or in
CI, add `--push`: one real `integration/<slot>` per repo, pushed with the
laptop's own git auth, never forced, never a PR, and swept after the record's
`sweep-after:` date. The first push of a slot is the human's call.
- **Gather the evidence, then hand it over** — collect has no GitHub of its own;
the web-session (MCP) and laptop (`--fetch`) recipes are in [`reference.md`](reference.md).
- **"I want to run the whole batch."** — `batch collect --slot <date>-<slot>
--integration --apply` (laptop only; nothing pushed without `--push`, the
human's call). What it builds and how conflicts read: [`reference.md`](reference.md).
- **What comes back is scored, not summarised.** Six legs per member (pr ·
diff · checks · green · witness · adversary), one health word (FAILED ·
NOT-DELIVERED · SUSPECT · HEALTHY · PENDING · MERGED), failures at the top.
A leg with no evidence is UNOBSERVABLE and never delivered — a member you
did not look up reaches the human as SUSPECT, not as clean.
- **The PENDING entries fill themselves in.** `--apply` regenerates each
member's section in place — same path, same id — and stamps the page
`refreshed:`, normally while the human is already reading the finished
members. No other member's markup is touched, so their stored notes and
chips survive.
- **Science runs are not batch members.** Checking in on the science is its
own door — `/cortex`, over `bin/pyauto-brain cortex collect --pull --apply`,
which pulls every active project, scores every `submitted | running` phase
against its pre-registered witness and moves what came back to
`awaiting-ruling`. It needs no record, no slot and no packet. The science
board this conductor once opened (`--kind cortex`) was retired on
2026-09-03; see `PyAutoBrain/skills/cortex/cortex.md`.
- **PENDING entries fill themselves in** on `--apply`, and **science runs are
not batch members** (`/cortex`): [`reference.md`](reference.md).

**Before reading any PR from a batch, the independent adversary leg must have
run** (`AUTONOMY.md` leg 5): `bin/pyauto-brain review --task <name> --witness
Expand All @@ -216,25 +155,12 @@ none of them; that part is yours, member by member:
the **top of `queue.md`**. They never write a prompt file.
- **reject** — route it to `condemned.md`.

**Review closes the batch; follow-ups never block the next one** (2026-08-31).
Every tweak and follow-up is *queued*, enacted in the next batch the human
launches — it is never executed inside the review, and an open follow-up is
never a reason to hold the next dispatch. The batch is complete when: accepted
PRs are merged, science rulings are in their ledgers, follow-ups sit at the top
of `queue.md`, the packet page is archived in `batches/packets/`, and the batch
record carries `reviewed-at:` (when they actually sat down — the calibration of
their own `review-at:` estimate), `delivered:` (see below), `review:` (the
review file's path) and **`review-minutes-actual:`**. That last number is the
only calibration the review estimate will ever get, so ask for it if the human
does not volunteer it.
**Review closes the batch; follow-ups never block the next one** (2026-08-31):
they are queued for the next batch, never executed inside the review. What
"complete" means, and asking for `review-minutes-actual:`: [`reference.md`](reference.md).

**Under a brief, the digest is the review surface** (2026-11-03). Collect
appends a `## Digest` to the record — brief work, then backlog picks with a
one-line reason each, one proof packet per task, then the shift counters — and
posts it once as a comment on the shift's `issue:`. The record plus that comment
is what the human reads; the HTML packet is written only when the brief says
`packet: yes`. Formats: `PyAutoMind/batches/AGENTS.md`, "Digest" and "Proof
packet".
**Under a brief, the digest is the review surface** (2026-11-03) — the record
plus one comment on the shift's `issue:`; see [`reference.md`](reference.md).

**`delivered:` is not "green".** A cloud session's green status means it exited
without an infrastructure error — not that the task succeeded. A member counts
Expand Down
Loading
Loading