Skip to content

FE-1834: Teach Brunch voice agent custom words - #9899

Open
kostandinang wants to merge 28 commits into
mainfrom
kostandin/fe-1834-teach-brunch-your-words
Open

kostandinang wants to merge 28 commits into
mainfrom
kostandin/fe-1834-teach-brunch-your-words

Conversation

@kostandinang

@kostandinang kostandinang commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🌟 What is the purpose of this PR?

Let people teach Brunch names and terms through a default-off Custom words Labs setting. Saved spellings and optional pronunciation hints help the assistant recognize and say those words in Voice conversations.

🔗 Related links

🚫 Blocked by

🔍 What does this change?

  • Add a Voice-only Words header button with a book icon and a Custom words dialog for adding, editing, and removing up to 50 entries.
  • Store words in this browser, scoped to the principal and conversation; clear them with the conversation. Preserve unsaved edits when another tab deletes the edited word.
  • Send spellings to the assistant and both existing voice transcription prompts, and pronunciation hints to the speaking model. Keep the current transcription models and semantic VAD.
  • Keep active Voice sessions on their starting hints until restarted, including retries, and retain the echo guard.
  • Keep the word list, pronunciation and limits in the website's Voice code, and the spelling bounds Brunch receives in the transport. Brunch core, Petrinaut Core and the stock assistant prompt are unchanged.
  • Add a website user guide at apps/petrinaut-website/docs/custom-words.md and a patch changeset for Petrinaut's assistant header controls.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

  • Modifies an npm-publishable library and changeset files are included.

📜 Does this require a change to the docs?

  • Requires changes to docs which are made as part of this PR.

🕸️ Does this require a change to the Turbo Graph?

  • Does not affect the execution graph.

⚠️ Known issues

  • One Live Voice turn was verified with captured microphone and speaker audio; legacy Realtime and physical speaker echo were not tested.
  • The 50-entry limit is also subject to spelling, pronunciation, aggregate-text, and encoded-header size limits.
  • Local frontend checks cannot validate Brunch history without the backend.

🐾 Next steps

Sync the parent branch before marking ready.

🛡 What tests cover this?

  • Tests cover validation, browser persistence, cross-tab edits, transport, prompt wiring, session snapshots, and echo filtering.
  • Latest targeted run: transport, Brunch core, Petrinaut Core, the Petrinaut assistant panel, apps/brunch-agent and the website's Voice and Brunch demo tests pass.
  • Formatting and Markdown lint passed for the latest UI and documentation edits.
  • Browser checks covered the Labs label, dialog copy, accessible Words button, and Voice-only visibility.

❓ How to test this?

  1. Select Use Brunch and enable Custom words in User settings → Labs.
  2. Enter Voice mode, open Words, and add a name with an optional pronunciation.
  3. Edit and remove entries; reload to check persistence. Verify the button is hidden in text mode.
  4. Start Voice and test the name. Change its hint during the session, then restart Voice to apply it.
  5. Clear the conversation and confirm its word list is cleared.

📹 Demo

custom-words-live-demo.mp4

@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
petrinaut Ready Ready Preview Oct 9, 2026 11:04am UTC
petrinaut-docs Ready Ready Preview Oct 9, 2026 11:04am UTC
2 Skipped Deployments
Project Deployment Actions Updated
hash Ignored Ignored Preview Oct 9, 2026 11:04am UTC
hashdotdesign-tokens Ignored Ignored Preview Oct 9, 2026 11:04am UTC

Request Review

@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/tests New or updated tests area/apps labels Oct 2, 2026
Comment thread libs/@hashintel/brunch-agent/packages/core/src/words.ts Fixed
@kostandinang kostandinang changed the title FE-1834: Add Custom words for Voice FE-1834: Teach Brunch your words Oct 2, 2026
@kostandinang
kostandinang marked this pull request as ready for review October 2, 2026 13:59
@cursor

cursor Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes how untrusted user vocabulary reaches model instructions, Flue messages, and OpenAI voice endpoints; mitigated by strict validation and stripping envelopes from canonical history, but still expands the prompt-injection surface.

Overview
Adds Custom words for Brunch on the Petrinaut website: a default-off Labs toggle and a Voice-only Words header control (via new optional headerActions / actionsInputMode on the assistant panel) to manage spellings and optional pronunciation notes per browser conversation.

The website persists and validates the list locally, attaches spellings to Brunch chat through a new v2 contextual user-message envelope and transport words snapshot (captured per message for retries), and passes encoded vocabulary to Live/Realtime/transcription voice APIs. Brunch strips that envelope from model history/UI transcripts while useWords turns admitted spellings into a bounded system instruction; pronunciation stays on the speaking side only.

Voice sessions pin hints at connect (including retries) until the session ends or Live restarts after panel close; transcription prompts and echo filtering now use the pinned prompt, including a shadow prompt-regurgitation skip so taught vocabulary is not submitted as user speech.

Reviewed by Cursor Bugbot for commit d763a50. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread libs/@hashintel/brunch-agent/packages/transport-aisdk/src/words.ts Dismissed
@kostandinang kostandinang changed the title FE-1834: Teach Brunch your words FE-1834: Teach Brunch voice agent custom words Oct 2, 2026
Comment thread libs/@hashintel/brunch-agent/packages/transport-aisdk/src/words.ts Fixed

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread apps/petrinaut-website/src/main/app/local-storage-demo/conversation-words.ts Outdated
The approval coordinator now reports refused calls, so Live progress treats a
denied or stopped edit as finished while its refusal output is still on its
way back, instead of reading the stale input-available part as executing.

Co-authored-by: Cursor <cursoragent@cursor.com>
lunelson
lunelson previously approved these changes Oct 7, 2026
…kostandin/fe-1834-teach-brunch-your-words

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	apps/petrinaut-website/src/main/app/local-storage-demo/local-storage-demo-app.tsx
#	apps/petrinaut-website/src/main/app/voice-interview/live-conversation-control.tsx
…ch-brunch-your-words

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	apps/petrinaut-website/src/main/app/local-storage-demo/local-storage-demo-app.tsx
#	apps/petrinaut-website/src/main/app/voice-interview/live-conversation-control.test.tsx
#	apps/petrinaut-website/src/main/app/voice-interview/live-conversation-control.tsx
lunelson
lunelson previously approved these changes Oct 8, 2026
kostandinang and others added 3 commits October 8, 2026 16:11
…ch-brunch-your-words

# Conflicts:
#	apps/petrinaut-website/src/main/app/local-storage-demo/local-storage-demo-app.tsx
#	apps/petrinaut-website/src/main/app/plugins/voice/live/live-brunch-bridge/utterance-pipeline.ts
#	apps/petrinaut-website/src/main/app/plugins/voice/live/live-conversation.ts
#	apps/petrinaut-website/src/main/app/plugins/voice/realtime/openai-realtime-session.ts
#	apps/petrinaut-website/src/main/app/plugins/voice/session/voice-interview-control.tsx
#	apps/petrinaut-website/src/main/app/plugins/voice/shared/classify-interruption.test.ts
…ch-brunch-your-words

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	apps/petrinaut-website/src/main/app/local-storage-demo/local-storage-demo-app.tsx
Co-authored-by: Cursor <cursoragent@cursor.com>

This branch was successfully deployed

4 active (2 outdated) deployments
Preview – petrinaut-docs — d763a506 Deployed Oct 9, 2026 by vercel[bot]
Preview – petrinaut — d763a506 Deployed Oct 9, 2026 by vercel[bot]
Preview – hash — 03b27e67 Deployed Oct 9, 2026 by vercel[bot]
Preview – hashdotdesign-tokens — c7c41eb1 Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

4 participants