M2.5.2: Cost ledger #25
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 2.5 — Logging & Cost Visibility, milestone 2.
Goal
A persistent JSONL ledger of every
research()call, suitable for cost tracking and operator queries. Supplements (does not replace) the per-callcost_metadatafield returned to callers.Scope
~/.marchwarden/costs.jsonl(configurable viaMARCHWARDEN_COST_LEDGER)completetrace steptimestamp(ISO-8601 UTC)trace_idquestion(truncated to ~200 chars)model_idtokens_used(total)tokens_input/tokens_output(split if available from anthropic usage object)iterations_runwall_time_sectavily_searches(count of tavily_search tool invocations during the loop)estimated_cost_usd(computed from price table)budget_exhausted(bool)confidence(final overall confidence)cost_recordedevent with the same fields, so cost data ships to OpenSearch alongside the ledger filePrice table
~/.marchwarden/prices.toml(created on first run if missing, seeded with current Anthropic + Tavily rates)estimated_cost_usd: nullrather than crashingprices.tomlwhen Anthropic changes rates (no automatic fetching)Tests
prices.tomlis auto-created with seed valuesprices.tomlis not overwrittenDepends on
M2.5.1 (uses the structured logger for the
cost_recordedevent)Branch
feat/cost-ledger