Skip to content

Define dependency-aware invalidation for static prompt cache #424

@zikajk

Description

@zikajk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions