Repository navigation
v1.11.0
writ token-audit now bills each API response once at its own model's rates and includes subagent spend, and the sub-agent roles carry an explicit model, effort and status contract that the orchestrator routes on. The old audit counted most responses about twice and priced every model at one rate; subagent transcripts were not counted at all. Writ no longer runs headless Claude Code anywhere.
Changed
- token-audit bills per API response. Claude Code writes one transcript record per content block, so the audit summed each response about twice. Records sharing a
message.idnow count once; streaming snapshots (onlyoutput_tokensgrows) collapse silently, the last record wins, and any other difference raises aduplicate_id_conflictwarning. - Real per-model prices. A
RATE_CARDholds input, output, cache read and 5-minute and 1-hour cache write rates for each model, including Opus 5.5's 0.05x cache read. Model ids match exactly (a trailing date suffix is stripped); an unknown model is reported as unpriced and the dollar figure is labelled partial.--modelis a fallback for records that carry no model and defaults to none. - Subagent spend is included. The audit links each Agent dispatch to its transcript and reports cost by model, role and dispatch, dispatch coverage, missing and orphan transcripts, and a reconciliation against Claude Code's own
cost-statetotal. Treat the audit as a floor: transcripts omit some billed calls Claude Code makes. - Subagent usage survives a deleted transcript. The SubagentStop hook appends a token-only
subagent_usagerow to the metrics stream; the audit prices a dispatch from it when the transcript is gone.writ token-auditgains--project. - Per-role effort.
SubagentRole.effort_preferenceis exported aseffort:frontmatter: planner and implementer high; explorer, test writer and reviewer medium, matching what each ran at before. HANDBOOK section 8 documents the role table. - Status contracts for every worker. The explorer, test writer and planner end with one status (COMPLETE, INSUFFICIENT_CONTEXT, a REQUIRES_* decision, or CONFLICTING_EVIDENCE); the reviewer's JSON
statusgainsinsufficient_contextandconflicting_evidence, and those two block a commit even with an empty critical list, in any letter case. - Dispatch policy.
PBK-PROC-ORCHESTRATOR-001says when to work directly instead of delegating, to retrieve missing facts before reaching for a stronger model, when to override a dispatch's model (haiku for bounded lookups only; fable only on the user's request), and how to route each returned status. - The fix loop escalates by evidence. Rounds 4-5 dispatch a fresh implementer on the same model with the plan, failing test output, every open finding and prior fix reports, instead of an unspecified "more capable model".
writ/analysisloads pydantic lazily, so the stop hook imports the token audit without it.
Removed
- The
efficacy-abharness (writ/analysis/efficacy_ab.py,variants.py, the command, its task suite and runbook). It was Writ's only headlessclaude -puse;tests/test_no_headless_claude.pynow fails on any new one.