Skip to content

Commit d9f46c1

Browse files
ellatairaclaude
andcommitted
coordinator: docs + allium spec lockstep catch-up
Following CLAUDE.md #5 ("docs and specs stay in lockstep with code"), catching up QUICKSTART, README, and the allium spec for today's rapid-fire changes that drifted them. QUICKSTART: - 6f rewritten: api_token_ceiling is now a panic brake (500M default), not a budget. Real cost control is wall-hours + cost-anomaly tripwire + auto-pause on streak. Mentions --token-ceiling CLI flag. - Step 8: `-u` unbuffered flag added to launch command; CLI flag examples (--token-ceiling, --wall-hours-ceiling) shown. - New §8a "Autopilot behaviors" — summarizes phase pivot, cost anomaly tripwire, cooperative pause (.coordinator/pause), and sdk-errors capture. Things the user doesn't need to trigger but should know exist. README: - Model-routing table rewritten for the proposer-implementer split. Proposer (Opus) authors detailed implementation_plan; Implementer (Sonnet when plan present) executes mechanically with max_turns=25 and Task tool blocked. Reviewers see plan + diff, hack_detector has a plan_fidelity advisory check. - Added a prose block explaining WHY the split: iter 16 Opus-as- implementer reached for Task, spawned 17-min sub-agent, crashed with $291 burned. Moving design into proposer + Sonnet-executes makes it mechanical, bounded, ~5× cheaper. allium spec (via allium:tend subagent): - Config: plateau_pivot_lookback, max_pivots_before_halt, all cost_anomaly_* fields, api_token_ceiling 500M with panic-brake prose, CLI flag override semantics. - Candidate.implementation_plan; Budget.consecutive_cost_anomalies; Db.pivot_banned_families + pivot_count fields. - New rules: AutopilotPivotOnPhasePlateau, CheckCostAnomalyAt IterationEnd, WaitWhilePaused. - Modified rule guidance: UnanimousReviewRequired (plan passthrough), ProposeCandidatesWhenQueueDry (plan requirement + pivot_clause), DiversityBanStuckFamilies (persistent-ban union), PhaseExitOnPlateau (superseded note + hard-halt path retained). - New CoordinatorConsole guarantees: TaskToolBlockedForImplementer, ProposerImplementerSplit, DurableTokenLogging, SdkErrorsCaptured, LiveBudgetCeilingsFromDb, CooperativePause. - allium check: 0 errors, 28 pre-existing warnings. All 102 coordinator tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ab12996 commit d9f46c1

2 files changed

Lines changed: 69 additions & 12 deletions

File tree

tasks/coordinator/QUICKSTART.md

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,15 @@ PYTHONPATH=tasks python -m coordinator.seed_candidates
233233
# different from the baseline-measured version.
234234
PYTHONPATH=tasks python -m coordinator.import_validations
235235

236-
# 6f. Before the real run, set a hard API-token ceiling. Edit
237-
# tasks/coordinator/config.py:
236+
# 6f. Token ceiling is now a PANIC BRAKE, not a budget. Default is
237+
# 500M tokens (≈ $2.5k-7.5k Opus list price) — deliberately set very
238+
# high so a 72h run finishes without nagging halts. Actual cost control
239+
# is wall-hours + per-iter cost-anomaly tripwire + autopilot pause on
240+
# consecutive-anomaly streak (see §Autopilot behaviors below).
238241
#
239-
# api_token_ceiling: int | None = 20_000_000 # ≈ $50-200 of Opus
240-
#
241-
# Prevents a runaway edge case from burning $1-5k of API spend.
242-
# Leave None while smoke-testing.
242+
# To tighten the ceiling for a specific cost-bounded run, pass
243+
# --token-ceiling N to the driver CLI. Same for wall hours:
244+
# --wall-hours-ceiling H. Both persist to db.budget on first save.
243245
```
244246

245247
If `eval-results/` doesn't exist on this driver workspace yet, pull it
@@ -284,13 +286,62 @@ Expected flow:
284286
## 8. Launch the forever loop
285287

286288
```bash
287-
PYTHONPATH=tasks python -m coordinator.driver --forever 2>&1 | tee -a .coordinator/driver.log
289+
PYTHONPATH=tasks python -u -m coordinator.driver --forever 2>&1 | tee -a .coordinator/driver.log
290+
```
291+
292+
`-u` is important — unbuffered Python output so `tail -f driver.log` updates live.
293+
294+
Optional CLI overrides (both persist to `db.budget` so you don't need to re-pass on restart):
295+
296+
```bash
297+
# Tighten the panic-brake for a bounded run
298+
PYTHONPATH=tasks python -u -m coordinator.driver --forever \
299+
--token-ceiling 50000000 \
300+
--wall-hours-ceiling 48 \
301+
2>&1 | tee -a .coordinator/driver.log
288302
```
289303

290304
Detach from tmux with `Ctrl-b d`. The loop keeps running.
291305

292306
---
293307

308+
## 8a. Autopilot behaviors (you don't need to do anything for these)
309+
310+
Three autonomous reactions the coordinator takes without user input:
311+
312+
**Phase plateau → pivot.** After `plateau_patience` (5) consecutive
313+
non-improving iterations, the driver auto-bans every `approach_family`
314+
from the last 5 iters into `db.pivot_banned_families` (persistent),
315+
resets the plateau counter, fires a `phase_pivot` PR comment, and
316+
keeps running. The proposer's next call sees a "this is a pivot"
317+
block in its prompt and generates structurally-different candidates.
318+
Only hard-halts (requires_ack) after `max_pivots_before_halt` (4)
319+
pivots without any ship — "structurally un-improvable."
320+
321+
**Per-iter cost anomaly tripwire.** At iteration end, driver compares
322+
this iter's token cost to the rolling mean of the last 5. If
323+
`this_cost > 2× rolling_mean` OR `this_tokens > 10M`, a `cost_anomaly`
324+
PR comment fires with the triggers enumerated. After 3 consecutive
325+
anomalous iters, driver writes `.coordinator/pause` to cooperatively
326+
halt at the next iter boundary — user must `rm .coordinator/pause`
327+
to resume. Nothing in flight is wasted (iter finishes normally first).
328+
329+
**Cooperative pause.** Touch `.coordinator/pause` at any time to stop
330+
the loop at the next iter boundary. Safer than Ctrl-C (doesn't lose
331+
mid-iter implementation work). Remove the file to resume. Used by the
332+
auto-pause above; also usable manually for "let me look at recent
333+
comments before you spend more money."
334+
335+
**SDK error capture.** When an SDK call crashes (claude CLI subprocess
336+
exits non-zero, which unfortunately surfaces as bare "exit code 1"
337+
through the SDK), the driver dumps full context to
338+
`.coordinator/sdk-errors/<ts>-<purpose>.txt`: exception repr, cause
339+
chain, traceback, plus enrichment (token-log stats for the iter, last
340+
N SDK message types, git state at crash, SDK versions). Referenced
341+
in the `iter_impl_failed` PR comment.
342+
343+
---
344+
294345
## 9. Watch it
295346

296347
From the driver workspace (or by sshing in from your laptop):

tasks/coordinator/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,15 +413,21 @@ experiment for audit.
413413

414414
## Model routing
415415

416-
Deep-thinking SDK calls use Opus; lightweight summaries use Sonnet.
416+
Design/judgment work uses Opus; mechanical execution uses Sonnet.
417417
Tune in `config.py`:
418418

419419
| Role | Model | Task |
420420
|---|---|---|
421-
| Implementation agent | `model_deep` (Opus) | writing code for a candidate |
422-
| Review personas | `model_deep` (Opus) | judging approve/reject |
423-
| Proposer | `model_deep` (Opus) | brainstorming new candidates from history |
424-
| Inbox interpreter | `model_light` (Sonnet) | summarizing a user message |
421+
| **Proposer** | `model_deep` (Opus) | Brainstorm novel directions AND author a detailed `implementation_plan` per candidate (30-80 lines: exact files, interface contract, numbered algorithm steps, data shapes, test plan, perf). Opus does the design work. |
422+
| **Implementation agent** | `model_light` (Sonnet) when a plan is present | Execute the plan mechanically. `max_turns=25`. No design discretion. Task tool hard-blocked via PreToolUse hook. Falls back to Opus if the candidate has no plan (rare). |
423+
| Review personas (×3) | `model_deep` (Opus) | Judge approve/reject. See both the diff AND the plan; `plan_fidelity` check flags deviations. A net-positive deviation ships; a net-negative one doesn't. |
424+
| Inbox interpreter | `model_light` (Sonnet) | Distill a user PR comment into (interpretation, planned_change). |
425+
426+
Why this split: Opus-as-implementer reached for the Task tool on big
427+
candidates, spawning sub-agents that crashed after 17 minutes and
428+
burned $291 per iter (iter 16 matrix-profile). Moving design into the
429+
proposer + executing with Sonnet + plan makes implementations
430+
mechanical, bounded, and ~5× cheaper.
425431

426432
Set `CONFIG.model_deep` / `CONFIG.model_light` to an empty string to fall
427433
back to the SDK default.

0 commit comments

Comments
 (0)