eca icon indicating copy to clipboard operation
eca copied to clipboard

Define dependency-aware invalidation for static prompt cache

Open zikajk opened this issue 7 months ago • 1 comments

To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.

Static prompt caching improves provider-side cache stability, but several inputs that contribute to static instructions can change during a chat: rules, path-scoped rule catalogs, skills, agent prompts, workspace metadata, tool availability used by Selmer variables, and user-created files such as new skills or rules. Today cache invalidation is mostly scoped to agent/model changes, which risks stale system instructions or over-invalidation if we include too much.

Design and implement a clear invalidation model for static prompt inputs:

  • Identify all inputs that contribute to static instructions.
  • Decide which changes should automatically invalidate the cache and which should require an explicit user action/command.
  • Consider workflows like creating a new skill/rule during a chat: should it become available immediately, after /reload, after a new chat, or after explicit command?
  • Include path-scoped rules and fetch_rule catalog availability in the model.
  • Include Selmer-rendered variables such as workspace roots, subagent state, and tool availability.
  • Consider provider-side invalidation as well (OpenAI, Anthropic).
  • Add tests that verify cache reuse vs invalidation for representative cases.

zikajk avatar Apr 24 '26 13:04 zikajk

Closed in favor of #527

zikajk avatar Jul 13 '26 14:07 zikajk