Status: done (2026-11-24)
Priority: 3
Size: M
Design ref: .claude/agents/vb-task.md, step 8 (the ceiling and the handover); docs/agents/worker.md, section 1.3 (a task that reports continue); docs/review-agent-workflow.md, sections 2 and 8, and VB-1615’s section 10 (the estimate); tools/inbox.js (CEILING, result, calls); AGENTS.md, Taking a task, step 5 and Spending turns
Goal: An agent whose context has grown past a threshold T hands the rest of its task to a fresh context at a cognitive boundary (the investigation done, or a coherent phase committed with tests green), or when it is stuck. It does so through the existing continuation, with a structured handover that carries what the next context needs and nothing else: verified facts, hypotheses, rejected hypotheses, decisions and their reasons, invariants, the criteria left, commands and source locations. The 120-call ceiling stays as the safety net, unchanged. The reset is enabled as a logged change, which starts a period that VB-1615’s tools compare with the period before. It is then kept, adjusted or abandoned by the rules under Evaluation. A smaller context is not, by itself, evidence of better work.
Acceptance criteria:
docs/agents/handover.md, read only when handing over and not loaded by every sub-agent. Its sections:
file:line that shows it;At most 60 lines or 4 KB, with no transcript excerpts and no file contents beyond a quoted line. The ceiling’s continuation (step 8 of vb-task.md) uses the same template. tests/context-size.js shows vb-task.md and AGENTS.md grown by no more than three lines between them.
node tools/inbox.js note ID handover --body - (a new kind), and node tools/inbox.js handover ID prints the latest. The continuing prompt names the command, so the orchestrator’s context grows by a line, not by the handover. A single-task session hands over the same way: it starts a fresh vb-task sub-agent with that pointer and waits for its result, doing no more exploring itself.node tools/inbox.js result ID status=continue reason=ceiling|boundary|stuck. A voluntary reset (boundary, stuck) is refused below context T (the value VB-1615’s estimate proposes), before a run’s 30th call, or with no new commit since the run started. A task gets at most one voluntary reset in this first period, besides the two continuations at the ceiling. A second stuck in a task ends it needs-review. CEILING, WARN and CONTINUATIONS stay as they are.node tools/inbox.js calls prints, once the context passes T, that the next boundary is the place to hand over. It prints a stuck hint once VB-1615’s failure streak or repeats reach 3. It never ends a run itself.vb-task.md step 8 and AGENTS.md (Taking a task) say the above in at most three lines between them. A run that stays below T is not split into phases.docs/agents/changes.md, which starts the period. The period before (the ceiling alone) is the comparison.tests/inbox.js covers the reasons, the guards and the handover kind. npm test passes.tools/backlog.js new, Waits for: Kim), with the Evaluation section below copied into its criteria. Kim sets it ready once the sample is in.
Method: the reset triggers considered, and what is done with each.
| Trigger | How it is detected | Used as |
|———|——————–|———|
| Context size (estimated tokens) | mechanically, from the transcript’s usage (inbox.js calls) | the gate: no voluntary reset below T |
| Investigation done, before the first edit | the agent’s judgement; checkable (nothing under src/ edited yet, the plan written in the handover) | a boundary |
| A coherent implementation phase done | the agent’s judgement; checkable (a commit, npm test green) | a boundary |
| Repeated failures, or the same thing investigated again | a heuristic (VB-1615’s failure streak and repeats); false positives when a test is legitimately rerun | a hint from calls; reset as stuck, by judgement |
| A change in the understanding of the problem | judgement only; not detectable | not a trigger: the handover’s Not carried section |
| Model calls (120) | mechanically | unchanged: the hard ceiling |needs-review); criteria ticked; merges undone for a red check; PR check failures traced to the task; reopened within 7 days (VB-1615’s proxy); failure streaks of tests.stuck and those tasks fare better, keep stuck and drop boundary, or the reverse.vb-task.md, AGENTS.md and inbox.js, and a row in the log ends the period.
Notes:vb-task sub-agents.docs/review-agent-workflow.md, section 10). The possible saving is nearly all in single-task sessions, which have no ceiling: the session path of the second criterion is where this task earns its cost. Reading again decides it: a reset that costs 15 calls of reconstruction loses money.docs/agents/changes.md, 20:59Z); the evaluation is VB-1617, waiting for Kim. Decisions: (1) T = 160k, the estimate’s proposal, with the other limits in tools/lib/ceiling.js. (2) “A new commit since the run started” is a commit whose time is after the run’s first transcript entry: no state kept for it. (3) The stuck hint reads the current state (the last test’s failure streak, three repeats in the last 20 calls), not totals, which every long run reaches; it shows only past T, where a stuck reset is allowed. (4) The handover lives in the inbox and the prompt names the command, so the orchestrator’s context grows by a line. (5) A session that names its task (--task) and hands it to a sub-agent keeps its own cost on that task on the usage page, rather than becoming an orchestrator. (6) --eligible/--ineligible added to --periods, which VB-1617’s population needs.AGENTS.md and vb-task.md grew by two lines, 22,180 to 22,620 bytes (target 32,000); the details are in docs/agents/handover.md, read only at a handover.