Love this framing. Think “Sense → Think → Act,” with each part dumb and focused. The listener senses. The speaker acts. The brain thinks, plans, and arbitrates the floor. Glue it all with events so every move is observable and reproducible.
Roles and clean boundaries
- Sense (listening-only)
- Capture audio, run wake-word, VAD, diarization, ASR, prosody, acoustic scene detection.
- Publish observations; no decisions. Never decides to answer, interrupt, or backchannel.
- Think (decision + policy)
- Fuse observations, track conversation state, infer intent, manage turn-taking, and choose behaviors (backchannel, wait, interrupt, schedule).
- Can schedule future actions (“say X at wake-up”), set priorities, and issue commands to the speaker.
- Act (speaking-only)
- TTS + playback controller. Follows commands, handles barge-in (stop/resume), and reports progress. No intent logic.
Event contracts (pub/sub)
Use consistent trace_id/span_id. Version schemas.
Core fields for all events
- event_id, event_time, trace_id/span_id, producer/version, env
- subject_id/session_id (pseudonymous), privacy flags
- for model-related events: model_name/version; for audio: sample_rate, device_id
Sense → Think
- audio.frame: raw/encoded frames (or URI), sequence_no
- vad.start / vad.end: timestamps, energy, SNR
- wakeword.detected: keyword, confidence
- diarization.turn: speaker_id (user/bot/other/unknown), start/end, confidence
- asr.partial: text, start/end, confidence, is_final=false
- asr.final: text, tokens with timestamps, confidence, language
- prosody.features: pitch contour, speaking_rate, volume, pause_len, end-of-utterance prob
- acoustic.scene: noise_class (quiet/tv/music/street), doa (direction-of-arrival), alarm/keyword flags
- device.state: mic muted/unmuted, proximity, wearable on/off
Think ↔ Think
- floor.state: {idle, listen, respond, duplex}, who_has_floor, policy_version
- intent.inferred: intent, slots, confidence, safety flags
- plan.update: dialogue plan items, priorities, deadlines
- schedule.item: speak_request_id, run_at or condition (e.g., user_awake), content_hash
Think → Act
- speak.request: speak_request_id, text or ssml, persona/style, priority, can_overlap, bargein_allowed, max_duration, earcon=yes/no
- speak.control: pause, resume, stop, replace_with {earcon/text}
- tts.config.update: voice, speed, pitch, emotions, locale
Act → Think
- tts.started / tts.chunk / tts.completed: timings, token_count
- playback.started / playback.progress / playback.completed / playback.stopped: reason (finished, bargein, error)
- bargein.detected: at_time, policy_applied (pause/duck/ignore)
Floor control as a small state machine
States
- idle: no one speaking
- listen: user holds floor
- respond: bot holds floor
- duplex: controlled overlap allowed (backchannels, brief interjections)
Transitions (driven by Sense)
- to listen: vad.start by user (ASR confidence passes threshold) and not self-echo (AEC ref matched)
- to respond: end-of-utterance (pause > 300–600 ms, falling intonation, EOU prob > threshold) or explicit handoff (“go ahead”)
- to duplex: user speaking but backchannel window open (short pause, low volume, rising pitch), or urgent interrupt from Think
Policies (tunable per persona/context)
- backchannel policy:
- trigger when pause 150–300 ms AND falling pitch AND clause boundary AND user_not_fighting_for_floor
- choose one of: “mm-hmm”, “got it”, head-nod sound; 200–400 ms long; never stack two within 2 s
- assertiveness levels:
- polite: avoid overlap, ask permission to interject, duck TTS on barge-in
- neutral: overlap only for short backchannels or safety
- assertive: preempt for guidance/alerts; shorter time-to-interrupt
- urgency and preemption:
- urgent (alarms, safety, timers, calls): immediate earcon + concise message; allow overlap; retry once if masked
- important (calendar start, reminders): queue until EOU or backchannel window; escalate if approaching deadline
- low: schedule for later or wait for explicit handoff
Useful timing defaults (adapt to user over time)
- end-of-utterance pause: start at 400 ms; personalize within 250–700 ms
- backchannel window after boundary: 100–300 ms
- maximum overlap for backchannel: ≤ 250 ms; for interrupts: immediate with earcon
- interruption cool-off: ≥ 2 s between non-urgent interjections
Scheduling and “say it when they wake”
- Scheduler consumes schedule.item and device.state
- triggers on conditions: user_awake=true, user_present, quiet_scene, time_window
- On trigger, emits speak.request with priority and persona style
- If user starts speaking, policy decides:
- low priority: defer; re-arm with jitter
- medium: backchannel first (“quick note”), then deliver in ≤ 3 s
- urgent: earcon + one-sentence alert; follow-up later if masked
Acoustics musts for duplex
- Acoustic echo cancellation (AEC): feed TTS audio as reference so ASR ignores your own voice
- Noise suppression/beamforming: keep SNR high so pause/EOU is detectable
- Barge-in handling: playback controller supports pause/resume/duck with <50 ms reaction time
- Self-voice suppression: mark bot speech intervals; ASR drops or tags them for the floor manager
Where the LLM/VLM fits (in Think)
- NLU: intent/slot extraction and summarizing ASR into a “gist”
- Policy helper: propose candidate responses and backchannel text; your policy decides “say now vs later”
- Tool use: timers, reminders, calls, home devices
- Safety/verifier: content filters, persona guardrails, fact-checkers for claims
Example flows
- Backchannel during user talk
- Sense: asr.partial + prosody.features → pause 200 ms, falling pitch
- Think: floor=duplex; backchannel policy fires → speak.request(“mm-hmm”, can_overlap=true, low volume)
- Act: playback.started; AEC active; playback.completed; floor stays with user
- Urgent interrupt
- Sense: timer.expired or alarm detected
- Think: classify urgent → speak.request(“Your 3pm call is starting.”, priority=urgent, can_overlap=true, earcon=true)
- Act: playback.started; user continues → Think may follow with speak.request(“Should I join?”) once EOU
- “Say it when they wake”
- Think: schedule.item(run_when=user_awake, text=“It snowed overnight… leave 10 minutes early.”)
- Sense: device.state(user_awake=true)
- Think: emit speak.request with neutral assertiveness
- Act: playback; if user speaks over it, policy either finishes sentence or pauses and retries
Observability and guardrails
- Metrics
- ASR: WER, EOU precision/recall, diarization accuracy
- Floor: false holds/yields, overlap rate, interrupt success, backchannel acceptance (user continues smoothly)
- TTS/Playback: time-to-first-audio, barge-in latency, AEC leakage rate
- UX: task success, satisfaction, “felt interrupted” rate, reminder delivery on-time
- Traces
- One trace per interaction burst; stitch scheduled events back to the originating plan/update
- Safety
- Content filters on speak.request; never speak sensitive content on shared devices without confirmation
- Privacy: on-device wake word/VAD; redact/aggregate prosody features; store hashes/URIs for raw audio
Minimal walking skeleton
- Services
- listener (audio in + VAD/AEC) → asr (streaming) → acoustics (prosody/scene/diarization)
- brain (state + floor manager + policy + scheduler)
- tts (synthesis) + playback (device control)
- Topics
- sense.* (audio.frame, vad., asr., prosody., scene., device.state)
- think.* (floor.state, intent.inferred, plan.update, schedule.item)
- act.* (speak.request, speak.control, playback., tts.)
- Policies (config)
- persona: backchannel_rate, assertiveness, bargein_allowed, style
- thresholds: pause_ms, EOU_prob, overlap_limits
This keeps each part single-purpose, but the overall system feels conversationally fluid: it can hold the floor, yield it, overlap briefly for “uh-huhs,” and cut in for urgent stuff—exactly when the policy says so. If you want, we can sketch concrete schemas or a reference policy for one persona (polite, neutral, assertive) next.