feat(voice): carry the app guide in session instructions - #528
Merged
Conversation
The guide is build-fixed prose, the same on every turn, so it now rides the Realtime session's instructions — a stable, cacheable prefix — instead of a conversation.item.create user message deleted and recreated beside the developer's own turns. A changed guide travels as a follow-up session.update refreshing only the instructions, flushed at the turn that reads it on the developer's call alone, and an unchanged guide sends nothing. APP_GUIDE leaves the context-item kinds and flush order, and the speak-only announcement call stays guide-free as it was context-free. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Why
The app guide — what Luke knows about himself — is ~16–18 KB of build-fixed prose, the same on every turn. It traveled as a
conversation.item.createuser message beside the four observed context kinds, which is the wrong vehicle for static content: each guide change deleted the old item and created a new one mid-conversation, moving the cached prefix and spending window the developer's own turns are evicted from. The Realtime session'sinstructionsare the right home — a stable, cacheable prefix the service holds outside the conversation — so the guide now rides there, appended behind an[app guide]marker after the standing instruction head, which stays byte-identical as the prefix.How
realtimeInstructions()takes an optional guide text and appends it behind the marker; called bare (the mint, the connect-time sync) it is unchanged, so nothing new reaches the speak-only call or the introduction.appGuideInstructionsEvents(guideText)in@sidecar/realtimebuilds one partialsession.updatecarrying only the refreshed instructions — tools and audio are untouched, so the guide can never widen what a turn may do.RealtimeVoiceSession.updateGuidekeeps the snapshot whole for validation and holds the rendered text pending;#flushContextsends the instructions refresh ahead of the context items, on the items' own economy: at the developer-opened turn that reads it, diffed by text, so an unchanged guide sends nothing and a mid-call guide change (settings, integration facts, update-row state) is a follow-upsession.updateat the next turn.#carriesContext()check as the rosters, andspeak()never flushes, so the speak-only announcement call stays guide-free exactly as it was context-free — it already received only the base instructions via the connect sync, and still does.APP_GUIDEis removed fromCONTEXT_ITEM_KINDand the flush order;appGuideContextEventsis deleted rather than stubbed. RendererAGENTS.mdand the affected comments now describe the instructions carriage.Tests
session.updateinstructions on the developer call (standing head as prefix, guide behind the marker) and never as a[app guide]conversation item.response.createalone).response.create, blank text builds nothing.Checks
./scripts/check.sh— exit 0: lint (biome + oxlint), typecheck, tests (2292 pass / 0 fail across the workspace), and builds all pass../scripts/verify.shwas not run because this environment is Linux; the change is portable (renderer/session logic and packages only, no macOS surface change).🤖 Generated with Claude Code
Automated visual evidence
Download the deterministic macOS evidence · workflow run
bd847ba5d2509b3312d4971b516055caf91f6084smoke