The state
The state is one snapshot of the call right now. It has facts only, no decisions, and it is updated many times a second.
{
"call_minutes": 12,
"last_transcript": "I just don't know if it's worth trying again",
"end_of_turn": {"probability": 0.35},
"silence_ms": 2400,
"user_baseline_pause_ms": 1800,
"emotions": [{"label": "sad", "confidence": 0.71}],
"risk": "watch"
}
How I read it: he said something heavy, he is sad, and he has been silent for 2.4 seconds. His normal pause is 1.8 seconds, so this is a little longer than usual. The state does not say what to do with this. That is the job of the policy.
The policy
Rule-based code, so it is fast, the same every time, and testable. The first rule that matches wins. On the state above, rule 4 matches: the agent says a soft "mm" and stays quiet. No LLM call, so the reaction is fast and costs nothing.
| If | Then |
|---|
| 1 | risk is high or urgent | start the crisis path |
| 2 | the user talks while the agent is speaking | stop the agent right away |
| 3 | silence is shorter than the user's usual pause | wait |
| 4 | silence is a bit longer than usual, and the last thing was heavy | soft "mm", no LLM |
| 5 | silence is much longer than usual | gentle question: "Take your time. Want to say more?" |
| 6 | the user is done | call the LLM, with guidance from the state |
Example rules to show the idea. The real rules and numbers come from the research team.
| Examples | Target |
|---|
| Fast reactions | a soft "mm", "aha", stopping when the user interrupts. No LLM | under 300 ms |
| Full replies | policy, LLM, voice | about 800–1200 ms after the policy decides |
Two kinds of delay instead of one latency number.
| What it holds | How it is used |
|---|
| Profile facts | family, work, likes, with date and source | loaded at call start; the user can edit and delete |
| Episodes | one short summary per call | found by topic and date |
| Goals | plans and goals, with a status | the policy checks in on them |
| In-call | rolling summary and the last few turns | keeps the prompt small |
| Raw transcripts | the full text, with consent | rebuild the summaries if they are wrong |
Memory in layers. One summary rewritten again and again loses detail, and one wrong line can hurt every later call.
| What the system does |
|---|
| Speech-to-text stalls | "Sorry, I missed that. Can you say it again?" |
| End of turn fails | a plain silence timer based on the user's usual pause |
| Emotion unsure | UNKNOWN; the policy acts neutral |
| Risk module fails | the value becomes "watch", never lower |
| LLM slow | a short "mm, I'm here", retry once or use a backup LLM |
| Memory down | continue without it, and don't claim to remember |
| Network drops | keep the call state, reconnect, say "I'm back" |
Failure handling: fail toward safe, never go silent without a reason, never pretend.
How do we build the voice stack?
D-01ConsideredCascade (STT, LLM, voice), one speech-to-speech model, or a full-duplex model that listens and speaks at the same time.
ChosenA cascade first, behind one interface. I hold the text before it is spoken, so every sentence can be checked, which is the strongest reason for mental health. The honest weakness: it may not reach "ultra realistic". It is the best baseline, not the final answer, and I move if another stack wins a fair test without losing safety, delay or cost.