Skip to content

feat(agentic): stabilize prompt cache reuse across skill and subagent updates#985

Merged
wsp1911 merged 6 commits into
GCWing:mainfrom
wsp1911:main
May 31, 2026
Merged

feat(agentic): stabilize prompt cache reuse across skill and subagent updates#985
wsp1911 merged 6 commits into
GCWing:mainfrom
wsp1911:main

Conversation

@wsp1911
Copy link
Copy Markdown
Collaborator

@wsp1911 wsp1911 commented May 31, 2026

Summary

This PR improves agentic prompt-cache stability when skills, subagents, reminders, and session flows change at runtime.

What changed

  • preserve first-turn prompt cache baselines by snapshotting turn-level skill and subagent listings
  • inject incremental skill/agent listing updates into user input instead of rebuilding cached prompt prefixes
  • switch reminders from envelope-style prompt wrapping to typed internal messages for more reliable persistence and filtering
  • persist and recover reminder and skill/agent snapshot state across restore, rollback, branching, and compression flows
  • make hidden /btw child sessions inherit the parent prompt cache on creation
  • ignore agent snapshot diffs caused only by default-tool reordering
  • remove prompt assumptions that user input is always wrapped in <user_query> tags
  • add architecture documentation for session-level model request cache reuse and current cache-miss gaps

Why

Previously, dynamic skill/subagent changes or reminder rebuilding could invalidate cached prompt prefixes or create noisy diff/update behavior. This PR makes runtime updates more incremental and keeps prompt-cache state consistent across branching, /btw, mode switching, restore/rollback, and compression paths.

wsp1911 added 5 commits May 30, 2026 20:40
…fix cache

- snapshot turn-level skill and subagent listings to preserve the first-turn prompt baseline
- inject incremental skill and agent listing updates into user input instead of rebuilding cached prefixes
- persist and recover skill-agent snapshots across restore and rollback flows to keep prompt state consistent
- replace prompt-envelope reminder wrapping with explicit prepended reminder messages across coordinator, scheduler, goal mode, cron, /btw, init_agents_md, and session_message flows
- add InternalReminderKind metadata and constructors so reminder messages can be classified, persisted, and filtered consistently, including fork-subagent and goal-continuation paths
- persist a listing-baseline rebuild cutoff in session metadata and lazily strip stale skill/agent listing diff reminders when restoring or rolling back older context snapshots
- teach fallback compression to drop transient reminder kinds and update related tests after removing legacy envelope-based expectations
…prompt cache reuse

- document session-level prompt cache reuse strategy and persistence
- document reuse across branching, /btw, fork_context, mode switching, and compression
- clarify current per-turn tool-manifest cache-miss gap and a possible future direction
- make hidden /btw child sessions clone the parent prompt cache on creation
@wsp1911 wsp1911 marked this pull request as ready for review May 31, 2026 15:36
@wsp1911 wsp1911 merged commit d63431a into GCWing:main May 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant