Skip to content

feat(voice-chat): replace read_shared_context with request_slow_brain tool#8748

Merged
lancy merged 1 commit intomainfrom
feature/issue-8745-request-slow-brain
Apr 9, 2026
Merged

feat(voice-chat): replace read_shared_context with request_slow_brain tool#8748
lancy merged 1 commit intomainfrom
feature/issue-8745-request-slow-brain

Conversation

@lancy
Copy link
Copy Markdown
Contributor

@lancy lancy commented Apr 9, 2026

Summary

  • Replace the passive read_shared_context tool with request_slow_brain for explicit task delegation — writes talker/worker-request events to shared context via fire-and-forget logContextEvent
  • Rewrite TALKER_INSTRUCTIONS with capability awareness: the model now delegates tool-requiring tasks instead of saying "I can't do that"
  • Update VOICE_CHAT_WORKER_PROMPT to prioritize explicit talker/worker-request events over autonomous observations

Changes

File 1: turbo/apps/platform/src/signals/voice-chat/voice-chat-session.ts

  1. SESSION_TOOLS — Replaced read_shared_context with request_slow_brain (required task parameter)
  2. TALKER_INSTRUCTIONS — Rewritten with delegation rules, capability framing, identity awareness, and result handling guidelines
  3. handleFnCall$ — Replaced async read handler with sync fire-and-forget: logContextEvent(fetchFn, sid, "talker", "worker-request", task) + static confirmation

File 2: turbo/apps/web/src/lib/zero/integration-prompt.ts
4. VOICE_CHAT_WORKER_PROMPT — Added "Explicit Requests" section after "When to Act" for talker/worker-request prioritization

Test plan

  • grep "read_shared_context" returns zero results in production code
  • grep "request_slow_brain" finds it in SESSION_TOOLS and handleFnCall$
  • grep "worker-request" finds it in handleFnCall$ and worker prompt
  • Lint, type-check, format pass
  • All existing platform tests pass (1611 tests)
  • All integration-prompt tests pass (17 tests)
  • Manual: Start voice chat, ask for tool-requiring task → Talker calls request_slow_brain → slow brain works → result injected back

Closes #8745

🤖 Generated with Claude Code

… tool

Replace the passive read_shared_context tool with request_slow_brain for
explicit task delegation to the slow brain. Rewrite TALKER_INSTRUCTIONS
with capability awareness and behavioral rules so the model delegates
instead of saying "I can't do that." Update the worker prompt to
prioritize explicit talker/worker-request events.

Closes #8745

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...tform/src/signals/voice-chat/voice-chat-session.ts 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@lancy
Copy link
Copy Markdown
Contributor Author

lancy commented Apr 9, 2026

Code Review: PR #8748 (Round 1) — LGTM 🎉

All findings reviewed — no critical or high-priority issues.

Summary

Clean replacement of the passive read_shared_context tool with the active request_slow_brain delegation tool. Two files changed:

  • voice-chat-session.ts: Replaced SESSION_TOOLS, TALKER_INSTRUCTIONS, and handleFnCall$ logic. Handler simplified from async fetch+parse to sync fire-and-forget logContextEvent.
  • integration-prompt.ts: Added "Explicit Requests" section to worker prompt for talker/worker-request event prioritization.

Reviewed Findings (No Action Required)

Finding Severity Disposition
await on sync handleFnCall$ at caller site P1→P2 Harmless — JS await on non-Promise resolves immediately; removing it would change caller code outside the PR's intent
JSON.parse(args) as { task: string } trust P2 Acceptable — model sends structured args per schema definition; JSON.parse throws on malformed input which is fine

Verdict: LGTM ✅

No critical or high-priority issues remaining. This PR is ready for merge.


Completed after 1 round(s) of automated review-fix loop

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

⚡ Lighthouse — App

Category Score
🔴 Performance 33
🟢 Accessibility 93
🟠 Best Practices 79

Tested URL: https://pr-8748-app.vm6.ai/ · Full report

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

⚡ Lighthouse — Web

Category Score
🟠 Performance 55
🟢 Accessibility 96
🟠 Best Practices 79
🟢 SEO 92

Tested URL: https://pr-8748-www.vm6.ai/ · Full report

@lancy
Copy link
Copy Markdown
Contributor Author

lancy commented Apr 9, 2026

Acceptance Report: #8745 — feat: replace read_shared_context with request_slow_brain tool

Epic: #8742 — voice-chat dual-brain collaboration
PR: #8748
Reviewer: Tech Lead (via /epic-review)


1. Requirements (Definition of Done)

# Requirement Status Notes
1 read_shared_context fully removed from SESSION_TOOLS and handleFnCall$ ✅ PASS All 3 occurrences removed (tool definition, instructions ref, handler)
2 request_slow_brain tool implemented — writes talker/worker-request ✅ PASS Uses logContextEvent fire-and-forget, source "talker", type "worker-request"
3 TALKER_INSTRUCTIONS rewritten with capability awareness ✅ PASS Identity, delegation rules, behavioral rules, injection handling, style
4 VOICE_CHAT_WORKER_PROMPT updated for explicit request priority ✅ PASS New "Explicit Requests" section with priority treatment
5 Talker delegates instead of saying "I can't" ⏭️ SKIP Runtime behavior — verified by prompt design
6 Slow brain handles both explicit + autonomous ⏭️ SKIP Runtime behavior — verified by prompt design
7 All existing tests pass ✅ PASS Pre-commit checks passed (lint, types, format, tests)
8 Lint, type-check, format pass ✅ PASS Verified by agent

2. Code Review

Dimension Status Findings
Correctness handleFnCall$ correctly changed async→sync (logContextEvent is fire-and-forget). await set(handleFnCall$, ...) in caller resolves immediately — safe. Tool schema has required: ["task"] so parse is safe.
Project Standards No any, no eslint-disable, no defensive try-catch, YAGNI-compliant
Consistency Uses existing logContextEvent pattern, as const on SESSION_TOOLS, markdown section structure in worker prompt
Security No injection risks — uses existing API route with validation. No secrets, no auth changes.
Performance Removed unnecessary async/await. Fire-and-forget log instead of synchronous fetch+parse. Net improvement.

3. Architectural Alignment

Check Status Notes
Source of truth correct Tool writes talker/worker-request via context API, matching VALID_SOURCES and VALID_TYPES
No residual old patterns read_shared_context only exists in voice-chat-session.ts (3 occurrences), all replaced in diff
Injection message format aligned TALKER_INSTRUCTIONS references [Background...] — matches all formatInjectionMessage prefixes from #8744
Worker prompt correctly extended "Explicit Requests" section placed between "When to Act" and "Writing to Shared Context"

4. Independence

Check Status
Compiles standalone
Dependency on #8744 met ✅ (#8746 merged)
No forward dependencies

5. Issues Found

Must Fix (blocking acceptance)

None.

Should Fix (non-blocking)

None.

Nits

None.

Verdict

ACCEPTED

Clean, minimal implementation (+44/-28) across 2 files. Exactly matches the approved plan and Epic #8742 design decisions. The async→sync cleanup on handleFnCall$ is a nice improvement. Injection message format in TALKER_INSTRUCTIONS correctly aligns with formatInjectionMessage prefixes from #8744.

@lancy lancy added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@lancy lancy added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@lancy lancy added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@lancy lancy added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@lancy lancy added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@lancy lancy added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@lancy lancy added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@lancy lancy added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@lancy lancy added this pull request to the merge queue Apr 9, 2026
github-merge-queue bot pushed a commit that referenced this pull request Apr 9, 2026
… tool (#8748)

Replace the passive read_shared_context tool with request_slow_brain for
explicit task delegation to the slow brain. Rewrite TALKER_INSTRUCTIONS
with capability awareness and behavioral rules so the model delegates
instead of saying "I can't do that." Update the worker prompt to
prioritize explicit talker/worker-request events.

Closes #8745

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@lancy lancy added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@lancy lancy added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2026
@lancy lancy added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit 4bd848d Apr 9, 2026
126 of 128 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in VM0 Kanban Apr 9, 2026
@github-actions github-actions bot mentioned this pull request Apr 9, 2026
@github-actions github-actions bot deleted the feature/issue-8745-request-slow-brain branch April 10, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat: replace read_shared_context with request_slow_brain tool and rewrite talker instructions

1 participant