Skip to content

Cache command

Muhammet Şafak edited this page May 27, 2026 · 1 revision

commitbrief cache

Inspect and manage the local response cache. Two subcommands:

commitbrief cache clear
commitbrief cache prune [flags]

The parent command does nothing on its own.

Where the cache lives

<repo-root>/.commitbrief/cache/ — one JSON file per cached review. Cache key is a SHA-256 over diff + system_prompt + provider + model + lang + schema_version. Entries are written atomically (temp file + rename) so an interrupted write does not corrupt the store.

The cache is per-repo. commitbrief cache clear in one repo does not touch another repo's cache.

See Cache for the on-disk format and TTL behavior.

cache clear

Delete every cached entry for the current repo.

commitbrief cache clear

Reports the count and total byte size before the prompt so you can decide:

Found 142 cached entr(y/ies), 2.4 MB on disk at /repo/.commitbrief/cache.
Remove all cached entries? [y/N]:

Confirmation defaults to no. Pass --yes to skip the prompt; in a non-TTY context without --yes the command aborts with Aborted; cache left untouched.

When the cache directory does not exist or is empty, the command prints No cached entries to remove (looked in <path>). and exits 0.

cache prune

Drop old and excess entries while keeping the rest. Defaults to --keep-last 500 --older-than 7d — entries survive when they sit inside both windows (newest 500 AND younger than 7 days).

commitbrief cache prune
commitbrief cache prune --keep-last=200 --older-than=14d
commitbrief cache prune --provider=anthropic --model=claude-opus-4-7

Flags

Flag Default Notes
--keep-last <N> 500 Keep the N newest entries (per the provider/model filter). 0 means keep nothing among the candidate pool. Negative values error.
--older-than <age> 7d Delete entries older than this age. Units: d (day), w (week), m (month = 30d), y (year = 365d). h/m/s and bare integers error.
--provider <name> (none) Only consider entries matching this provider name.
--model <name> (none) Only consider entries matching this model identifier.

Calendar precision is deliberately approximate (m = 30d, y = 365d). Cache TTL does not need calendar arithmetic; "older than a month" gets what humans expect.

Output

Pruned 87 entr(y/ies) (1.2 MB); 213 remain.

The numbers refer to candidates within the provider/model filter (or all entries when those flags are unset). Entries outside the filter are untouched and not counted in the survivor total.

Examples

# Default prune: keep 500 newest + everything from the last 7 days.
commitbrief cache prune

# Keep only the last 50 entries; everything else gone.
commitbrief cache prune --keep-last=50 --older-than=0d

# Drop only the long tail of an outdated model.
commitbrief cache prune --provider=anthropic --model=claude-3-opus

# Wipe everything for this repo (no recovery).
commitbrief cache clear --yes

See also

  • Cache — entry format + TTL semantics + cache-hit reporting.
  • Review command--no-cache to bypass per-invocation.

Clone this wiki locally