M2.5.3: marchwarden costs CLI command #26

Closed
opened 2026-04-08 21:43:46 +00:00 by claude-code · 0 comments
Collaborator

Phase 2.5 — Logging & Cost Visibility, milestone 3.

Goal

Operator-facing CLI for inspecting the cost ledger. Reads from ~/.marchwarden/costs.jsonl (M2.5.2) and pretty-prints summaries via rich.

Scope

  • New costs subcommand on the marchwarden Click app
  • Default behavior: rich table summary with
    • Total spend (USD) and total tokens
    • Per-day breakdown (last 7 days by default)
    • Per-model breakdown (tokens, calls, spend)
    • Tavily search count + estimated spend
    • Highest-cost call (with trace_id for follow-up)
  • Flags:
    • --since DATE (ISO date or relative like 7d)
    • --until DATE
    • --model MODEL_ID
    • --json — emit raw filtered ledger entries instead of the table (machine output)
    • --ledger PATH — override default ledger location (mostly for tests)

Tests

  • CliRunner against a fixture ledger covering multiple days, models, and a missing-cost entry
  • --since, --model, and --json flags
  • Empty ledger renders a friendly "no cost data yet" message, exit 0

Depends on

M2.5.2

Branch

feat/costs-command

Phase 2.5 — Logging & Cost Visibility, milestone 3. ## Goal Operator-facing CLI for inspecting the cost ledger. Reads from `~/.marchwarden/costs.jsonl` (M2.5.2) and pretty-prints summaries via `rich`. ## Scope - New `costs` subcommand on the `marchwarden` Click app - Default behavior: rich table summary with - Total spend (USD) and total tokens - Per-day breakdown (last 7 days by default) - Per-model breakdown (tokens, calls, spend) - Tavily search count + estimated spend - Highest-cost call (with trace_id for follow-up) - Flags: - `--since DATE` (ISO date or relative like `7d`) - `--until DATE` - `--model MODEL_ID` - `--json` — emit raw filtered ledger entries instead of the table (machine output) - `--ledger PATH` — override default ledger location (mostly for tests) ## Tests - CliRunner against a fixture ledger covering multiple days, models, and a missing-cost entry - `--since`, `--model`, and `--json` flags - Empty ledger renders a friendly "no cost data yet" message, exit 0 ## Depends on M2.5.2 ## Branch `feat/costs-command`
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: archeious/marchwarden#26
No description provided.