claudecode/crates
Yeachan-Heo bf22c918d8 Expose session cost and budget state in the Rust CLI
The CLI already tracked token usage, but it did not translate that usage into model-aware cost reporting or offer a spend guardrail. This change adds a max-cost flag, integrates estimated USD totals into /status and /cost, emits near-budget warnings, and blocks new turns once the configured budget has been exhausted.

The workspace verification request also surfaced stale runtime test fixtures that still referenced removed permission enum variants, so those test-only call sites were updated to current permission modes to keep full clippy and workspace test coverage green.

Constraint: Reuse existing runtime usage/pricing helpers instead of adding a new billing layer
Constraint: Keep the feature centered in existing CLI/status surfaces with no new dependencies
Rejected: Move budget enforcement into runtime usage/session abstractions | broader refactor than needed for this CLI-scoped feature
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: If resumed sessions later need historically accurate per-turn pricing across model switches, persist model metadata before changing the cost math
Tested: cargo fmt --all --check; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace
Not-tested: Live network-backed prompt/REPL budget behavior against real Anthropic responses
2026-04-01 00:57:54 +00:00
..
api Enable saved OAuth startup auth without breaking local version output 2026-04-01 00:24:55 +00:00
commands Finish the Rust CLI command surface for everyday session workflows 2026-03-31 22:49:50 +00:00
compat-harness Merge remote-tracking branch 'origin/rcc/cli' into dev/rust 2026-03-31 20:46:07 +00:00
runtime Expose session cost and budget state in the Rust CLI 2026-04-01 00:57:54 +00:00
rusty-claude-cli Expose session cost and budget state in the Rust CLI 2026-04-01 00:57:54 +00:00
tools Enforce tool permissions before execution 2026-04-01 00:06:15 +00:00