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.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
Cache is invalidated by:
--freshflag (user override)cache_ttl_hourssetting in config.toml- 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.