Repository navigation
feat(context): remind the model of changed blocks without busting the prompt cache (#2089) - #2405
Merged
threepointone merged 3 commits intoSep 28, 2026
Conversation
🦋 Changeset detectedLatest commit: 94b7f6f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
threepointone
added this pull request to stack #2407
September 28, 2026 14:47
threepointone
marked this pull request as ready for review
September 28, 2026 14:50
threepointone
force-pushed
the
feat/2089-context-reminders
branch
from
September 28, 2026 15:46
62a5145 to
64a089d
Compare
Contributor
|
✅ agents import sizes: no significant changes ( |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
… prompt cache (#2089) A block declared whenChanged: "remind" is re-read each turn. While its rendering no longer appears in the frozen prompt, ContextBlocks.reminder() returns its current value, and Think adds it to the last user message of the model request without persisting it. refreshSystemPrompt() promotes the value and ends the reminders. Co-authored-by: Cursor <cursoragent@cursor.com>
…n is exact Co-authored-by: Cursor <cursoragent@cursor.com>
…ply continuation Co-authored-by: Cursor <cursoragent@cursor.com>
threepointone
force-pushed
the
feat/2089-context-reminders
branch
from
September 28, 2026 16:54
64a089d to
94b7f6f
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2089.
Problem
A frozen system prompt keeps the provider's prefix cache warm, but it also freezes context that changes between turns: the date, workspace state, project instructions. Today the only way to update it is
refreshSystemPrompt(), which throws away the cached prefix.Change
whenChanged: "remind".ContextBlocks.reminder()re-reads those blocks and returns the current value of any whose rendering no longer appears in the frozen prompt.refreshSystemPrompt()promotes the value. Think already refreshes after a compaction.Edge cases:
Tests
context.test.tscovers promotion, restart through a shared prompt store, and the edge-change and emptiness cases, each with the block first and last. It also checks thatinit()is not called again.prompt-cache.test.tsruns six turns and shows that the system message stays byte-identical, reminders appear only while the value differs, the only prefix break before the refresh is the previous user message, and the refresh busts the cache once. It fails without the Think wiring.