Docs CLI

coding.sh cache

Score prompt-cache health and name what breaks the cached prefix. Every option of coding.sh cache and its subcommands, from its own --help.

coding.sh cache --help
coding.sh cache <action>

  Score prompt-cache health and name what breaks the cached prefix

Commands
  doctor        Hit rate, a grade, and the cache breaks ranked by cost: cause, sessions, tokens re-billed, extra USD, the fix, and two calls to diff

Notes
  Hit rate is cache reads / all prompt tokens, the CACHE READ column of coding.sh usage, over the same sessions. The breaks are the ones coding.sh show and usage count, so tokens and USD match theirs.
  Each break gets the first change between its two calls, in the order the cache reads a request: model-switch; tools-added, tools-removed, tools-reordered, tools-changed; system-volatile-line (a line that differs only in its numbers, such as a timestamp), system-changed; history-rewritten (compaction); then idle (a wait past the cache lifetime) or other. Idle and other are not counted as avoidable.
  Grade: 60% the hit rate against 90%, 40% the share of prompt tokens re-billed for avoidable causes (a quarter or more scores 0). A 90+, B 80+, C 70+, D 60+, else F.
  Tool and system prompt causes need the requests: calls logged by coding.sh proxy in capture mode full. Without them a break is classified from hashes, message counts, the model and timing, and the report says how many were.
  --limit bounds only the sessions whose stored requests are read. The hit rate, breaks, tokens, USD and grade cover every session in the window, and the grade is the same at any --limit wherever the hashes and counts show the change. A session with stored requests past the limit is classified as one without them is, from hashes, message counts, the model and timing: a tools or system prompt change is named without its detail (tools-changed, system-changed), and a history edit that keeps the message count reads as other. --json has sessionsNotRead and breaksNotRead. A session with no stored requests reads the same at any --limit.
  With --json, an answer given before every capture was indexed carries "pending": {"files": N, "indexing": true|false} (files still to ingest; indexing: an ingest is still running). The field is absent once all are indexed.

coding.sh cache doctor

Hit rate, a grade, and the cache breaks ranked by cost: cause, sessions, tokens re-billed, extra USD, the fix, and two calls to diff.

coding.sh cache doctor --help
coding.sh cache doctor [options]

  Hit rate, a grade, and the cache breaks ranked by cost: cause, sessions, tokens re-billed, extra USD, the fix, and two calls to diff

Options
  -a, --agent <AGENT>  Only sessions from this agent (repeatable, or a comma list: a,b)
      --since <WHEN>   Only at or after this time: 7d, 12h, 30m, today, yesterday or a date. A date without a zone is local time: 2026-11-09 is local midnight (default: 30d)
  -n, --limit <N>      Read the stored requests of at most this many sessions with breaks, costliest first; the totals, the causes and the grade cover every session (default: 200)
      --where <QUERY>  Only sessions matching a query, e.g. 'agent:codex cost>0.5 tool:Bash -flag:compaction' (keys: coding.sh sessions --help)
      --fresh          Wait for every pending capture to be ingested (default: answer after 1.5 s)

Examples
  coding.sh cache doctor
  coding.sh cache doctor --agent claude-code --since 7d
  coding.sh cache doctor --json

All commands · Global options