6. Cache strategy for collectors
Date: 2026-04-22
Status
Accepted
Context
Collectors (git, opencode, todos) can be expensive. Avoid re-running them on every build.
Decision
Cerebro uses file-based caching:
- Cache stored in
cache.jsonin system cache directory - Each entry tracks:
opencode_last_query,git_last_scan,todo_last_scan --freshflag bypasses cache entirely--project <name>limits to specific project
Cache Invalidation
Cerebro invalidates the cache when:
--freshflag for user override- Timestamps in
cache.jsonshow data is stale - Manual
cerebro statusshows 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.