v0.13.0 — skill/MCP cost attribution (#5 complete)
Roadmap direction #5 — skill/MCP cost attribution is complete. Decomposition, not a verdict: it answers "where did the tokens go?" by attributing each real-work session's footprint to the tool, skill, or MCP server that produced it. Fully orthogonal to the selector/benchmark path — it never promotes, evicts, or measures a rule.
What's new
npx tsx src/attribute.ts(new/warden-attributecommand) renders a cross-session rollup of tool/skill/MCP cost, or a single transcript with--transcript. Filters:--agent,--kind builtin|mcp|skill,--limit,--json.transcript.tsnow joins eachtool_useto itstool_resultby id in the existing single streaming pass, capturing the input chars the model generated and the result chars the tool injected back into context. The hot Stop-hook budget is unchanged (one pass, O(tool calls)).db.tsmigration #8 adds atool_coststable;collect.tspersists per-session costs inside the existing fail-open block (real-work only — golden runs are never attributed)./warden-statusgains a top-costs section.- Footprint is measured in characters (exact, deterministic); a rough ≈tokens figure (chars ÷ 4) is shown for intuition, not as a billed token count.
Hardening
From an adversarial review: a tool_result content array with an odd sibling (a bare string, an image block) no longer zeroes the whole result's footprint — each element is read defensively. A cross-feature regression audit confirmed fail-open is preserved, the verdict path is untouched, and the migration is additive.
219 tests, green on Node 22 and 24.
Roadmap
Of the six directions, #1, #2, #3, #4, #5 (plus automated prompt evolution) are shipped. Only #6 (rule marketplaces) remains.
Full changelog: v0.12.0...v0.13.0