Show my usage and my leaks

Tokens by session, worker and model, the bytes crush kept off the wire, and the habits that waste them.

Prompt#

Show me what this workspace is spending, and where I'm leaking context.

What the Chair does#

Reads the local ledger — no provider call — and prints spend by seat, then the leak telemetry that names the wasteful habit.

MCP calls#

usage_status({ "recent": 10 })
usage_status({ "view": "leaks" })
usage_status({ "view": "governance" })

CLI, for the human-readable version:

orch usage                      # table: by session, by worker, by model
orch usage --format json --limit 10
orch usage --leaks              # rereads, repeated calls, oversized results, silent streaks
orch usage --leaks --format json
orch usage --governance         # conflict_rate / duplicate_rate per session
orch gateway status             # live/cooldown, ring position, rotations per provider

Expected response#

usage_status takes an optional view: summary (default), leaks or governance; an unknown value errors with view must be summary|leaks|governance.

  • view: summary (or omitted) returns summary, saved_pct, total_bytes_saved, by_session[], by_worker[], by_model[], agents[], counters[]. Every breakdown row is {key, attempts, prompt_tokens, completion_tokens, bytes_saved}. A graph block carries what code_snippet and trace_path returned against the size of the files they stood in for.
  • view: leaks returns the same content-free rows as orch usage --leaks, keyed by session (reread_files, repeated_calls, large_results, silent_streaks).
  • view: governance returns {sessions[], pairs[]} — the same conflict/duplicate metrics as orch usage --governance, plus pairwise conflicts.

Gotchas#

  • It is content-free, so you can paste it to a human. The gateway ledger stores counts, never prompts. orch gateway status is content-free too: no keys, no bodies.
  • Leaks and governance are also over MCP. usage_status({ "view": "leaks" }) and usage_status({ "view": "governance" }) return the same rows as the CLI flags — no shell needed.
  • cache_hits is spend avoided, not spend. A request the gateway answered from its exact-match cache carries X-Orchemax-Cache: hit and is not counted as an upstream attempt. Read saved and spent as two columns, never as one net number.
  • The cache is off by default. gateway.cache.ttl_sec is 0 unless you set it, and streaming is never cached — so cache_hits: 0 usually means "not enabled", not "never hit".
  • Only traffic through the gateway is counted. A preset on agents.auth.<preset>: account — Claude Code on its own plan login, codex and cursor by default — routes no model traffic here, so it shows attempts but not provider tokens.
  • recent (MCP) and --limit (CLI) are the same idea: attach the N most recent attempts. Leave it out for the aggregate only.
  • What the leak columns mean: rereading a file you already read, calling the same tool with the same arguments, returning results too big to be useful, and long silent streaks. Each one has a cheaper move in Stop reading whole files.