Opening menu and hands-free mode: call an agent by name (0.3.0)

The app now opens on a menu, which is the root page: "Hands free" first,
"Agents" second. Agents is the 0.2.0 app unchanged. Hands free is the same
agents, conversations and question path with one flag set: the microphone
listens while the app is at rest and the app does not leave by itself.
The mode is never remembered; every launch starts at the menu with the
microphone closed, and double tap at Ready returns to the menu and closes
it.

Client: a loudness-only speech segmenter (core/vad.ts) cuts the stream
into utterances; each goes to the bridge for a wake check. "Wendy, <q>"
becomes a text turn to Wendy, with what was heard shown while she works.
A name alone starts a recording that sends itself when the speaker stops.
The status line starts with a dot for exactly as long as the microphone is
open at rest. In wake mode every microphone open and close goes through
one serialised reconciler; without the option the old path is untouched.

Bridge: POST /v1/wake transcribes one utterance in memory and reports
whether it BEGAN with an agent's name (first word of the display name, or
an alias from HERMEVEN_AGENT_<ID>_WAKE). Exact match only; a near miss is
reported as one word and never acted on. Creates no turn, stores nothing,
returns and logs nothing that was not addressed to an agent. One check at
a time per device, HERMEVEN_WAKE_CHECKS_PER_MINUTE (30).

Docs: decision 0004, bridge API, security gaps 3c/3d, device plan D.
The manifest's microphone description changed.

Not reviewed, not deployed, not uploaded, not device-tested.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Dan
2026-11-28 10:52:06 -08:00
co-authored by Claude Fable 5.2
parent 75b7ea1eff
commit e1d183b54d
26 changed files with 1847 additions and 48 deletions
+3 -2
View File
@@ -40,7 +40,7 @@ answer text is erased from the bridge 15 minutes after a turn ends (configurable
network and no randomness: request ids arrive inside events and work leaves as effects.
```
READY -> LISTENING -> TRANSCRIBING -> THINKING -> ANSWER
MENU -> READY -> LISTENING -> TRANSCRIBING -> THINKING -> ANSWER
plus APPROVAL, ERROR, DISCONNECTED, CANCELLED, UNPAIRED
```
@@ -103,4 +103,5 @@ automatically under a new request id.
- Polling only; no streaming.
- A second question while one is running in the same conversation is refused
(`conversation_busy`), not queued.
- Capture ends by tap or cap. There is no end-of-speech detection.
- A tapped capture ends by tap or cap. Only a recording started by an agent's name ends when
the speaker stops (`docs/decisions/0004-always-listening.md`).
+8
View File
@@ -21,6 +21,7 @@ Every error has the shape:
| `GET /v1/agents` | The agents this device may talk to, default first: `{agents: [{id, name}]}`. Ids and display names only; no address, profile or key. Added after 0.1.x: an older bridge answers 404 `not_found`, which a client must treat as "one agent". | 200 |
| `POST /v1/conversations` | Start a new conversation. Optional `agent_id` (an id from `/v1/agents`; omitted = the default agent; anything else is 400 `invalid_request`). Closes the device's previous conversation **with that agent** only. | 201 |
| `POST /v1/turns` | Create one turn (text or audio). | 202, or 200 for a duplicate |
| `POST /v1/wake` | One stretch of speech heard while the app was open (raw audio body, same format as an audio turn; query: `schema_version`, `locale`, `encoding`, `sample_rate`, `channels`). Transcribed in memory and dropped. Answers `{matched, agent_id, text, near_miss}`: whether it **began** with an agent's name, which agent, and what was said after the name (empty for the name alone). When not matched `text` is always empty; `near_miss` is the first word if it was close to a name. Creates no turn and sends nothing to any agent. 404 `not_found` when speech-to-text is off or no agent has a usable name (also what an older bridge answers); 429 `rate_limited` over `HERMEVEN_WAKE_CHECKS_PER_MINUTE` (default 30) or while this device's previous check is still running. A failed transcription is answered as not matched. | 200 |
| `GET /v1/turns/{request_id}` | Current state and result. | 200 |
| `POST /v1/turns/{request_id}/cancel` | Request cancellation. Idempotent. | 200 |
@@ -39,8 +40,15 @@ HERMEVEN_AGENTS=wendy,cody # extra agent ids, in display order
HERMEVEN_AGENT_WENDY_API_KEY=... # required for each extra agent
HERMEVEN_AGENT_WENDY_PROFILE=wendy # optional; default: the id
HERMEVEN_AGENT_WENDY_NAME=Wendy # optional; default: the id, capitalised
HERMEVEN_AGENT_WENDY_WAKE=wendi,windy # optional; extra spoken forms of the name
HERMEVEN_AGENT_WAKE=peper # the same, for the default agent
```
An agent is called by voice with the first word of its name ("Cody R." answers to "cody"), plus
any aliases. The default agent answers to its name only once `HERMEVEN_AGENT_NAME` is set. Two
agents may not answer to the same word. Wake words are never sent to a client. See
`docs/decisions/0004-always-listening.md`.
The list is the owner's allow-list. A client names an agent only by id, only when creating a
conversation, and the id is checked against the list; it is never used to build an address. A
turn goes to the agent of its conversation. Each agent has its own conversation and its own
+91
View File
@@ -0,0 +1,91 @@
# 0004: An opening menu, and a hands-free mode that listens for an agent's name
Status: implemented with fakes only; **nothing here is device-tested**. Date: 2026-11-28.
Dan (2026-11-28) first asked for the app to be always listening ("I want to be able to say
'Wendy' to send whatever follows to Wendy, Cody to Cody"), then, after reading what that costs,
chose: leave the app as it is, add this as a "hands free" mode, and open on a menu with
"Hands free" first and "Agents" second, so that after "Hey Even, launch Pepper" one tap starts it.
## The menu
The app opens on a menu, which is now the root page:
```
Hermeven
> Hands free
Agents
```
Swipe moves, tap opens, double tap asks the system to exit. Double tap at Ready goes back to the
menu (it used to exit). An untouched menu leaves the glasses after 30 s, like Ready does. A
question that was still running when the app was last closed is shown instead of the menu.
**Agents** is the app exactly as it was in 0.2.0: tap or hold to ask, swipe to choose, leaves
when idle, the microphone opens only on a tap.
**Hands free** is the same screens, agents, conversations and question path, with one flag set.
The flag does two things: the microphone listens while the app is at rest, and the app does not
leave by itself. There is no second implementation of agents. The mode is not remembered: every
launch starts at the menu with the microphone closed, and going back to the menu closes it.
Later entries (Telegram, spoken answers through a headset or Android Auto) are not designed
here. The menu takes more entries; a mode that needs its own screens will need more than a flag.
## Hands free
While in this mode and at rest (Ready, an answer, an error, "Cancelled") the glasses' microphone
is open. The status line starts with `●` for exactly as long as it is.
- "Wendy, what is on my calendar" in one breath: the question goes to Wendy.
- "Wendy" alone: a recording starts for Wendy and is sent when the speaker stops (1.2 s pause).
If nothing is said for 6 s it is dropped.
- The name must be the **first** thing said ("hey"/"ok" before it is allowed). A name in the
middle of a sentence does nothing.
- Tap, hold-to-talk and swipe-to-choose all still work.
- While a question is being transcribed or answered the microphone is closed.
- The app does not leave the glasses by itself while in this mode.
## How
| Step | Where | Why there |
|---|---|---|
| Find stretches of speech | Phone, `core/vad.ts`, loudness only | So silence is never uploaded, and one utterance is one request. |
| Transcribe and test for a leading name | Bridge, `POST /v1/wake`, the Whisper already there | The SDK gives raw PCM only; a keyword model in the WebView would need training per name. |
| Ask the agent | The existing turn path (a text turn, or an audio turn after a name alone) | Request ids, deduplication, cancel and recovery are unchanged. A wake check creates nothing. |
Matching is exact, against the first word of the agent's display name or an alias from
`HERMEVEN_AGENT_<ID>_WAKE`. A word that is only close ("Wendi", "copy") is reported to the phone's
Diagnostics as a near miss and is never acted on.
## What this reverses
- "The microphone opens only on a tap" and "is never reopened without a new tap"
(`docs/feasibility.md` section 2) hold in Agents and not in Hands free.
- Idle exit (0.1.1) is suspended in Hands free.
- Double tap at Ready no longer opens the system exit dialog; the menu is the root page now.
Whether Even's review accepts a root page reached by two double taps is unverified.
- "There is no end-of-speech detection" (0003): there is now, for recordings started by name.
- The phone's Diagnostics may now show one spoken word (a near miss). Nothing else spoken
appears in any log.
## Owner decisions pending (decide on the device)
1. In Hands free, staying open means phone notifications may not reach the lenses (one observation, 2026-11-21).
2. In Hands free, an agent that can act (Pepper sent a Telegram message) can be started by speech nobody
pressed a button for. Mitigations are the first-word rule, exact matching, the "Heard: ..."
line while the agent works, and double tap to cancel. There is no confirmation step.
3. In Hands free, every stretch of speech near the glasses, addressed to an agent or not, is uploaded to the
bridge and transcribed there before being dropped.
4. The names are needed on every question, including follow-ups.
5. The menu costs one extra tap before the first question in Agents.
## Unknown until tried on a G2
Microphone level and background noise against the detector's thresholds (first guesses); whether
Whisper spells the names as configured; delay from the end of speech to "thinking" (one upload
and one transcription, about 1 to 2 s on the server's figures); battery with the microphone open
continuously; whether the stream survives a locked phone for long periods; the server's CPU with
a conversation or a television nearby (each stretch of speech is a transcription; capped at 30
checks a minute, one at a time).
+14
View File
@@ -77,6 +77,20 @@ If A13 fails, stop and report it. It is a product-level blocker, not a bug to wo
| C10 | Battery: glasses and phone percentage at start and after a stated duration and number of questions. | The four numbers and the duration. Do not extrapolate. |
| C11 | Per question: seconds from second tap to answer, noted for at least 10 questions. | The raw list. The phone page shows the STT and agent split for each. |
## D. The menu and hands-free mode (0.3.0; nothing here has been run)
| # | Do | Record | Answers |
|---|---|---|---|
| D0 | "Hey Even, launch Pepper". | Does the menu appear with `>` beside "Hands free"? Do swipes move it? Does double tap at Ready come back to it, and double tap on the menu show the exit dialog? | The menu on a real G2; whether `>` and the indent render. |
| D1 | Tap "Hands free" and leave it. | Does the status line start with `●`? Does the body list the names? | The microphone opens without a further tap on a real G2. |
| D2 | Say "Wendy, what time is it" at a normal volume. Repeat for each agent, five times each. | How many reached the right agent. For misses, the "heard ..." line in Diagnostics, if any. | Detector thresholds; how Whisper spells each name (aliases to add). |
| D3 | Say only a name, wait for "... is listening", ask, stop speaking. | Seconds from the name to the screen changing; whether the question was sent whole. | Name-only flow; the 1.2 s end-of-speech pause. |
| D4 | Talk to someone for two minutes without using a name. Then mention an agent mid-sentence. | Did anything start? | False triggers. |
| D5 | Same with a television or music on. | Did anything start? Did a real "Wendy, ..." still work? | Noise. |
| D6 | Leave it open 30 minutes, phone locked in a pocket, then say "Pepper, are you there". | Did it answer? Battery of glasses and phone before and after. | Whether the stream survives; battery cost. |
| D7 | While it is open, have a notification arrive. | Did it reach the lenses? | The cost of staying open. |
| D8 | Double tap back to the menu, choose "Agents". | Does `●` go away, does tap still work, does the app leave by itself again? | Leaving hands free. |
## Reporting
Anything that fails in A13, A14, A15 or C1 is a blocker or a stated limitation of the product, to
+12
View File
@@ -69,6 +69,18 @@ Stated so they are not mistaken for protections.
sandboxed process. It no longer stalls the bridge (measured 3 ms), but a crash inside the
native runtime could still take the bridge down; systemd restarts it and in-flight turns are
recovered or failed honestly.
3c. **In hands-free mode (0.3.0; chosen on the opening menu at each launch, never on by itself)
the microphone is open whenever the app is at rest**, and every stretch of speech near the glasses is uploaded to the bridge
and transcribed, whoever is speaking and whether or not it is meant for an agent. The bridge
keeps and returns only speech that begins with an agent's name; the rest is dropped after the
transcription call and is not logged. That is a promise about this code, not a technical
barrier: whoever controls the bridge host could record it. People near the wearer are not
told. The HUD marks the open microphone with `●`; nothing outside the lenses does.
3d. **In hands-free mode an agent can be started without a button.** Speech that begins with an agent's name is sent
to that agent with whatever tools its Hermes profile allows, with no confirmation. A name is
matched exactly and only as the first word, and what was heard is shown while the agent
works, but a mis-transcription, another person saying the name, or audio from a speaker can
all start a turn.
4. **In the simulator, raw audio frames are echoed to the WebView console.** Whether the phone
does the same is unknown and is on the device checklist. If it does, recordings would be
visible to whoever can read that console.