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
17 changes: 15 additions & 2 deletions AUTONOMY.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ What this deliberately does **not** grant: a standing batch, a recurring
approval, or a config flag that makes the next batch launch itself. Each shift
is approved in its own slot, or it does not run.

**Amendment 2026-08-31 — the shift is declared, not scheduled.** The text above
leaves "the end of the shift" to be settled by whatever rhythm the workflow
happens to run on. It is settled here instead, by the human: at dispatch they
state **`review-at:`** — an ISO timestamp for when they expect to be back — and
**the shift is the interval dispatch → `review-at:`**. It is written into
`batches/<date>-<am|pm>.md` beside `dispatched:`, and the grant expires there,
whether or not they actually return. A slot is whenever the human comes in;
there is no daily baseline and no second-slot assumption, so the horizon cannot
be inferred and must be stated. A batch dispatched with no `review-at:` in its
record has no defined expiry, which is the stored grant this section exists to
forbid — so it is not dispatched until the human says when.

*Revert condition:* if a batch is ever found to have launched work its approval
list did not name, batching returns to per-task `--auto` until the cause is
found.
Expand Down Expand Up @@ -362,8 +374,9 @@ So, **for a batch launch only**:
5 gate the branch itself.
- A reason **generated by an earlier member of the same batch** is named as such
in the batch record and does not park later members.
- The grant **expires with the shift**. It is not standing, not ambient, and not
carried into the next batch.
- The grant **expires with the shift** — that is, at the `review-at:` the human
stated at dispatch (see the 2026-08-31 amendment above). It is not standing,
not ambient, and not carried into the next batch.

Unchanged: RED still parks at every level; YELLOW is still never acknowledged
*autonomously* — the acknowledgement is a human act performed in the slot, and
Expand Down
67 changes: 40 additions & 27 deletions agents/conductors/batch/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
> unattended shift*: given the queue, the backlog and the review-queue state, it
> emits a **BatchDecision** — the members, what they will cost the human to
> review, and what it rejected and why. It **proposes; it never dispatches.**
> Approving the proposal in a slot is what launches a batch.
> Approving the proposal in a slot is what launches a batch, and the human says
> at dispatch when they expect to be back (`review-at:`) — that horizon is the
> shift.

## What it is for

Expand All @@ -17,9 +19,12 @@ So the composition rule is a budget in **review-minutes**, not a count:
> Σ `Review-minutes:` over `glance` and `judge` members ≤ the slot's budget
> (default 45 — a slot also has to queue the next batch).

Read against the ledger, an honest hour holds about three library-touching
tasks. Planning by count over-promises capacity roughly threefold, and the
overflow lands on the human at 6am.
The budget is **the human's to set per slot**: they know whether the next one is
a quick morning check or a long afternoon, and the number follows the nature of
the work and their schedule rather than a rhythm. Read against the ledger, an
honest hour holds about three library-touching tasks. Planning by count
over-promises capacity roughly threefold, and the overflow lands on the human at
6am.

Everything above that budget is the **fill**: work costing zero review-minutes
(`notify`-tier work, slicing, witness authoring, backlog re-grading, deeper
Expand Down Expand Up @@ -59,15 +64,17 @@ named two or more PRs, so a PR-count cap trips on a single healthy batch.
- clear → the full budget;
- above half the cap → the review-bearing half is **halved** (the fill is not:
it does not touch the queue);
- at the cap → the batch is the **floor**: fill only, dispatched whether or not
the human turned up.

A missed slot is the common case for an academic, not an exception, and a
conference week must not stop the thing whose whole purpose is working while
nobody watches. An **empty floor is a finding, not a deadlock** — it means
nothing in the backlog costs zero review-minutes, which is exactly what the
`notify` tier and the `Witness:` field exist to change, and the decision says so
in those words.
- at the cap → the batch is **fill only**: zero-cost work still composes, and
the human still dispatches it.

Backpressure is about review-queue **depth**, never about timing — timing is the
human's, declared as `review-at:` at dispatch, and if they do not come back
nothing new is dispatched at all. (The **floor** — a fill-only batch that
dispatched whether or not the human turned up — was **closed 2026-08-31** and
never built.) An **empty fill-only batch is a finding, not a deadlock** — it
means nothing in the backlog costs zero review-minutes, which is exactly what
the `notify` tier and the `Witness:` field exist to change, and the decision
says so in those words.

## Lane detection

Expand All @@ -81,7 +88,8 @@ hiding it: *"4 local-dev task(s) are ready — run `batch plan` from the laptop.
## It proposes; the human launches

`AUTONOMY.md` ("What a batch launch is") defines a batch dispatch as **one
launch**: membership fixed at approval, the grant expiring with the shift, the
launch**: membership fixed at approval, the grant expiring with the shift — the
interval from dispatch to the `review-at:` the human states at dispatch — the
terms written into `PyAutoMind/batches/<date>-<am|pm>.md`, and the human
performing the dispatch. A scheduler may build the review packet and wake a
session; the act that starts work on the approved list is the human's. That is
Expand All @@ -105,32 +113,37 @@ Phase 5 — automatic fan-out — is deliberately unbuilt. Everything below work
today, costs about two minutes of tapping, and is the honest way to find out
what a dispatcher actually needs before writing one.

**In the slot (about an hour, once a day):**
**In the slot — whenever the human comes in; there is no schedule:**

1. `pyauto-brain batch plan` — read the BatchDecision. Edit it by removing
members you do not want; do not add ones it rejected without reading why.
1. `pyauto-brain batch plan` — read the BatchDecision. Pass `--budget` if this
slot is not a default 45-minute one. Edit the decision by removing members
you do not want; do not add ones it rejected without reading why.
2. **Acknowledge the Heart reason set for the shift**, if Heart is YELLOW
(`pyauto-brain vitals`). Write it verbatim into the batch record — a grant
recorded loosely is how a scoped one becomes standing, which doctrine voids
(`AUTONOMY.md`, "Leg 4 under a batch launch").
3. Open the batch record `PyAutoMind/batches/<YYYY-MM-DD>-<am|pm>.md` from the
3. **Say when you expect to be back** — `review-at:`, an ISO timestamp. The
shift is dispatch → `review-at:`, and the grant expires there. It is the one
thing only the human knows, so it is stated, never inferred.
4. Open the batch record `PyAutoMind/batches/<YYYY-MM-DD>-<am|pm>.md` from the
schema in that folder's `AGENTS.md`, and write the members, the planned
review-minutes and the reason set **before** dispatching. That file is what
makes the launch auditable afterwards.
4. **Dispatch**: paste each line the decision prints into **its own session**.
review-minutes, `review-at:` and the reason set **before** dispatching. That
file is what makes the launch auditable afterwards.
5. **Dispatch**: paste each line the decision prints into **its own session**.
One session per member — they must not share one, because a single session
would serialise them and carry one member's context into the next.
5. Go and do something else.
6. Go and do something else.

**Next slot:**
**At `review-at:` (or whenever they actually sit down):**

6. Read the PRs. Failures first, then anything labelled `decision-taken`, then
7. Read the PRs. Failures first, then anything labelled `decision-taken`, then
clean ones. For each: merge (`/prm <PR>`), or say one line of what you want
changed and let a session draft the follow-up prompt into `queue.md`.
7. Append the outcome to the batch record — `delivered:`, and especially
8. Append the outcome to the batch record — `reviewed-at:` (when they really
sat down, which calibrates their own estimates), `delivered:`, and especially
**`review-minutes-actual:`**. That last number is the only calibration the
estimate will ever get, and everything the planner does rests on it.
8. Plan the next batch.
review estimate will ever get, and everything the planner does rests on it.
9. Plan the next batch, and declare the next `review-at:`.

**The one leg you must not skip.** A batch launch requires the independent
adversary (`AUTONOMY.md` leg 5). Until `batch collect` exists, run it by hand
Expand Down
39 changes: 24 additions & 15 deletions agents/conductors/batch/_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

sum(Review-minutes) over `glance` and `judge` members <= the slot budget

not a task count. Read against the ledger, an honest review hour holds about
three library-touching tasks; a design that plans by count over-promises
capacity roughly threefold and lands the overflow on the human at 6am.
not a task count. The budget is the human's to set per slot (default 45) — a
slot is whenever they come in, not a scheduled hour. Read against the ledger, an
honest review hour holds about three library-touching tasks; a design that plans
by count over-promises capacity roughly threefold and lands the overflow on the
human at 6am.

Everything above that budget is the FILL: work costing zero review-minutes
(`notify`-tier work, slicing, witness authoring, re-grading, deeper verification
Expand All @@ -40,7 +42,9 @@
parse_prompt, priority_rank,
)

# One slot's worth of the human's attention. Not a task count — see the module
# One slot's worth of the human's attention, and only the DEFAULT: the human
# sets it per slot with --budget, because they know whether the next one is a
# quick morning check or a long afternoon. Not a task count — see the module
# docstring. 45 rather than 60 because a slot also has to queue the next batch.
DEFAULT_REVIEW_BUDGET = 45
# Above half the cap the review-bearing half is halved; at the cap the batch is
Expand Down Expand Up @@ -149,9 +153,10 @@ def plan(records: list[dict], *, budget: int = DEFAULT_REVIEW_BUDGET,
"""
rejected: list[tuple[str, str]] = []

# Backpressure RAMPS; it never deadlocks. A missed slot is the common case
# for an academic, and a conference week must not stop the thing whose whole
# purpose is working while nobody watches.
# Backpressure RAMPS; it never deadlocks. It measures review-queue DEPTH,
# never timing: timing is the human's, declared as `review-at:` at dispatch.
# An academic comes back late and vanishes for conference weeks, and a deep
# queue must shrink the next batch rather than refuse to compose one.
if awaiting_review >= cap:
effective_budget, pressure = 0, "at cap — fill only"
elif awaiting_review > cap / 2:
Expand Down Expand Up @@ -268,14 +273,16 @@ def emit(d: dict) -> None:
if not r["witness"]:
print(" (no witness — reviewed as `judge`)")
elif d["effective_budget"] == 0:
# At the cap the batch is the FLOOR: fill only, dispatched whether or
# not the human turned up. An empty floor is a finding, not a deadlock —
# it means nothing in the backlog costs zero review-minutes, which is
# what the `notify` tier and the witness field exist to change.
print(" (no members — at the backpressure cap, so this batch is the")
print(" FLOOR: fill only. Nothing in the backlog currently qualifies")
print(" as fill, which is itself the finding — clear the review queue,")
print(" or write witnesses so work can grade `notify`.)")
# At the cap the batch is fill only — and the human still dispatches it.
# (The FLOOR, a fill-only batch dispatched whether or not they turned
# up, was closed 2026-08-31 and never built.) An empty fill-only batch
# is a finding, not a deadlock: nothing in the backlog costs zero
# review-minutes, which is what the `notify` tier and the witness field
# exist to change.
print(" (no members — at the backpressure cap, so this batch is FILL")
print(" ONLY. Nothing in the backlog currently qualifies as fill,")
print(" which is itself the finding — clear the review queue, or")
print(" write witnesses so work can grade `notify`.)")
else:
print(" (no members — see the rejections below)")
print()
Expand All @@ -301,6 +308,8 @@ def emit(d: dict) -> None:
print("This is a PROPOSAL. Approving it in the slot is what launches the")
print("batch — membership is fixed at approval and the grant expires with")
print("the shift (AUTONOMY.md, \"What a batch launch is\").")
print("State review-at (when you expect to be back) when you say go: the")
print("shift is dispatch -> review-at, and it is where the grant expires.")


def main(argv=None) -> int:
Expand Down
24 changes: 16 additions & 8 deletions skills/batch/batch.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Batch — the slot door

The front door for the two-slot workflow: **what runs unattended, and what came
The front door for the batch workflow: **what runs unattended, and what came
back**. Drive it from a chat; nothing here needs a terminal.

Read [`../../agents/conductors/batch/AGENTS.md`](../../agents/conductors/batch/AGENTS.md)
Expand Down Expand Up @@ -45,8 +45,9 @@ open, and `Unattended: never`. Those are not preferences.

**3. "Go."** — the dispatch. This is the launch, and it is the human's act
(`AUTONOMY.md`, "What a batch launch is"): membership fixed at approval, the
grant expiring with the shift. Never dispatch on your own initiative, on a
schedule, or because a batch looks ready.
grant expiring with the shift — the interval from dispatch to the `review-at:`
they declare here. Never dispatch on your own initiative, on a schedule, or
because a batch looks ready.

In order:

Expand All @@ -55,8 +56,12 @@ In order:
You may not acknowledge it for them, and a set carried from an earlier batch
is void.
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 —
**before** any session starts. That file is what makes the launch auditable.
folder's `AGENTS.md` — members, planned review-minutes, the reason set 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.
3. Start one session per member, each carrying exactly
`/start_dev <path> --auto`. Spawn them if this harness can; otherwise hand
the human the lines to paste. **One session per member, never shared**: a
Expand All @@ -74,9 +79,11 @@ then clean.** For each, offer three things and do the one they pick:
the top of `queue.md`. They should never have to write a prompt file.
- **reject** — route it to `condemned.md`.

Then append the outcome to the batch record: `delivered:` (see below) and
**`review-minutes-actual:`**. That second number is the only calibration the
estimate will ever get, so ask for it if the human does not volunteer it.
Then append the outcome to the batch record: `reviewed-at:` (when they actually
sat down — the calibration of their own `review-at:` estimate), `delivered:`
(see below) 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.

**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 @@ -100,3 +107,4 @@ top.
overruling and why.
- Present the proposal as a schedule. The schedule may carry the timing; it
never carries the authority.
- Dispatch without a `review-at:` in the batch record, or invent one for them.
11 changes: 6 additions & 5 deletions tests/test_batch_plan.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""tests/test_batch_plan.py — the Batch Agent's composition rules.

The planner's whole job is refusing things for stated reasons, so every test
here is a refusal (or the one case that must never be refused: the floor).
here is a refusal (or the one case that must never be refused: zero-cost fill
under full backpressure).
"""

from __future__ import annotations
Expand Down Expand Up @@ -106,10 +107,10 @@ def test_backpressure_ramps_rather_than_cliffs():
assert _batch.plan(pool, budget=60, awaiting_review=8)["effective_budget"] == 0


def test_at_the_cap_the_floor_is_fill_only_and_still_runs():
"""A conference week must not stop the thing whose whole purpose is working
while nobody watches. At the cap the review-bearing half is zero — but
zero-cost work still dispatches."""
def test_at_the_cap_the_batch_is_fill_only_and_still_composes():
"""Backpressure measures review-queue depth, not the human's timing. At the
cap the review-bearing half is zero — but zero-cost work still composes, and
the human still dispatches it."""
d = _batch.plan([rec("a.md"), rec("b.md", tier="notify", minutes=0)],
budget=60, awaiting_review=99)
assert paths(d) == ["b.md"]
Expand Down
Loading