Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

6. Cache strategy for collectors

Date: 2026-04-22

Status

Accepted

Context

Collectors (git, opencode, todos) can be expensive. We need to avoid re-running them on every build.

Decision

We will use file-based caching:

  • Cache stored in cache.json in system cache directory
  • Each entry tracks: opencode_last_query, git_last_scan, todo_last_scan
  • --fresh flag bypasses cache entirely
  • --project <name> limits to specific project

Cache Invalidation

Cache is invalidated by:

  1. --fresh flag (user override)
  2. cache_ttl_hours setting in config.toml
  3. Manual cerebro status shows cache status

Consequences

Pros

  • Fast subsequent builds
  • Respects user intent

Cons

  • Stale data if TTL too long
  • System cache dependency

Notes

See cache.rs for implementation.