Repository navigation
💡 Warm-Start Voice Turns: Persistent Agent Session and Turn Telemetry to Hit the 3-Second Voice Target #575
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Every TalkTerm turn currently calls
sdk.query()again in single-message mode, which starts a fresh Claude Code process for each message. The SDK vendor's recommended alternative is streaming input mode: one long-lived session that accepts queued messages and real-time interruption. This idea moves TalkTerm to that mode, pre-warms the agent process during app launch, and adds turn-latency telemetry (speech end → first text event → first audio). NFR1a and NFR1b are then measured, not assumed.Market Signal
prewarm()andSpareProcess.claim()(alpha) plus a smaller/coreentry point. The docs showstartup()to pre-warm before the firstquery()(TS SDK CHANGELOG, DeepWiki: performance).query()(issue).User Signal
claude-sdk-backend.tsbuilds new options and callssdk.query({ prompt: message, options })inside a retry loop on everysendMessage.Technical Opportunity
AgentBackend.sendMessage()stays the same. InsideClaudeSdkBackend, a per-sessionAsyncIterable<SDKUserMessage>queue feeds one livequery().cancelCurrentAction()becomesinterrupt()on that query, which TalkTerm already calls at line ~306.voice:speech-ended, the firsttextAgentEvent and the first TTSonstart. Write p50/p95 through the audit/telemetry repository, and optionally export OTel spans for dev builds.Assessment
prewarm()needs the 0.3.x upgrade. The process lifecycle needs careful tests withFakeAgentBackend.Adversarial Review
Strongest objection: This is premature optimization. Model time to first token probably dominates, and a long-lived process adds new failure modes: crashes, stale permission state, memory growth across long sessions.
Rebuttal: Phase 1 is measurement only. If process spawn and initialization are under 10% of time to first audio on Windows and macOS, stop and focus on TTS. Streaming input is not a niche hack. It is the vendor's recommended mode and unlocks interruption and image input, so the lifecycle work pays off several times. Crash handling reuses the existing
resumeSessionpath with the persisted SDK session ID.Suggested Next Step
ClaudeSdkBackendbehind the existing contract tests, then evaluateprewarm()as part of the SDK upgrade.All reactions