Skip to main content

Module sub_agent_cache

Module sub_agent_cache 

Source
Expand description

Sub-agent result caching — zero-cost retries after compaction. Sub-agent result caching.

Caches sub-agent results keyed by (agent_name, prompt_hash) within a session. On cache hit, returns the previous response immediately — zero-cost retries for compaction-triggered re-planning.

§Why this exists

After compaction, the model sometimes re-issues the same sub-agent call (it forgot it already ran). Without caching, this burns tokens and time re-running identical work. The cache makes this free.

§Invalidation

Cache entries are invalidated when files are mutated (piggybacks on FileReadCache mtime tracking via a generation counter). This ensures stale results aren’t served after the codebase changes.

Structs§

SubAgentCache
Shared sub-agent result cache.