Skip to content

v0.13.0 — skill/MCP cost attribution (#5 complete)

Choose a tag to compare

@vukkt vukkt released this 16 Jun 07:56
· 27 commits to main since this release

Roadmap direction #5skill/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-attribute command) 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.ts now joins each tool_use to its tool_result by 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.ts migration #8 adds a tool_costs table; collect.ts persists per-session costs inside the existing fail-open block (real-work only — golden runs are never attributed). /warden-status gains 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