Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
chore: auto-save WIP via Claude stop-hook safety net (2026-07-08 08:50)
Ruben Lütke847a8cda44b1
diff --git a/docs/superpowers/specs/2026-07-06-interim-ack-redesign-design.md b/docs/superpowers/specs/2026-07-06-interim-ack-redesign-design.mdindex 79ecc10993..337269d47b 100644--- a/docs/superpowers/specs/2026-07-06-interim-ack-redesign-design.md+++ b/docs/superpowers/specs/2026-07-06-interim-ack-redesign-design.md@@ -1,3 +1,4 @@+<<<<<<< Updated upstream# Interim-Answer (Grounded Tool-Ack) Redesign — Design SpecDate: 2026-07-06@@ -122,3 +123,128 @@ Flash-Brain preamble (off by default), the `_on_announcement` gate chainafter the gap → second publish).- Unit: pipeline dedup + commit-grace using the existing pipeline testharness (`tests/unit/speech/test_ack_continuation_grace.py` pattern).+||||||| Stash base+=======+# Interim-Answer (Grounded Tool-Ack) Redesign — Design Spec++Date: 2026-07-06+Status: approved (maintainer request, autonomous session)++## Problem++The spoken interim answers ("quick acks") that bridge the silent tool-execution+window are perceived as buggy, repetitive, and over-eager. Forensic evidence+(voice session 2026-07-05 19:47, `data/sessions.db`): one session with three+user utterances spoke the byte-identical preamble `"Moment."` three times in a+row — once per utterance — because the first selected tool was `cli_gh` /+`run_shell` each time and that template has exactly ONE phrase. <!-- i18n-allow: forensic quote of the spoken German ack under test -->++Root causes:++- **R1 — no cross-utterance memory.** `BrainManager._build_tool_ack_emitter`+ guards "once per `generate()` call" but nothing prevents the SAME phrase on+ the next utterance seconds later.+- **R2 — single-phrase templates.** Every family in+ `jarvis/brain/ack_generator.py` maps to exactly one string per language.+- **R3 — contentless shell/CLI ack.** `run_shell` and every `cli_<name>` tool+ collapse to `"Moment."` even when the target service (GitHub, Vercel, …) is+ known from the tool name.+- **R4 — no usefulness gate.** The grounded ack publishes the instant a tool is+ selected; a turn that answers quickly still gets the ack queued (only the+ already-speaking stale-drop catches part of this).+- **R5 — ASCII umlauts in spoken phrases.** `"kuemmere"`, `"ausfuehren"`,+ `"pruefe"` etc. mispronounce on TTS and violate the project's umlaut rule+ for German product-surface strings.+- **R6 — fast passive reads ack'd.** `wiki_recall` (72 ms) is not on the+ skip-list, so it can trigger a spoken "one moment" for a sub-100 ms lookup.++Non-problems (already well designed, NOT touched): spawn announcements+(`SpawnAnnouncementComposer` — LLM + curated pools + no-repeat deque),+still-running heartbeats (`STILL_RUNNING_PHRASES` + no-repeat), the speculative+Flash-Brain preamble (off by default), the `_on_announcement` gate chain+(mute/hangup/interrupt-window/floor-deferral/stale-drop/scrub).++## Design++### 1. Phrase engine upgrade (`jarvis/brain/ack_generator.py`)++- Each tool-family handler returns a **pool** of 4–6 phrase variants per+ language, covering **de/en/es** (runtime-output-language doctrine: every+ phrase table carries all supported languages).+- New `AckPhrasePicker`: picks a variant while avoiding the last few picks+ (deque memory, `maxlen=4`, global across families — the irritant is+ repetition in sequence regardless of family). Module-level default instance+ gives process-wide no-repeat across utterances; injectable for tests.+- `cli_<name>` tools resolve a human service name (`cli_gh` → GitHub,+ `cli_vercel` → Vercel, …; unknown suffixes are title-cased) and speak an+ informative line ("I'm taking a quick look at GitHub."). `run_shell` keeps+ service-less neutral variants.+- All German phrases use real umlauts/ß.+- `wiki_recall` / `wiki_search` join `ACK_SKIP_TOOLS`.+- Public API (`generate_ack`, `final_summary_marker`, `should_prepend_marker`,+ `is_voice_control_utterance`, `ACK_SKIP_TOOLS`) keeps its signatures;+ `generate_ack` gains an optional `picker` keyword.++### 2. Cross-utterance cooldown (`BrainManager._build_tool_ack_emitter`)++- Manager-level `_last_grounded_ack_monotonic`; when the previous grounded ack+ was published less than `grounded_ack_min_gap_s` ago (new `[ack_brain]`+ knob, default 20 s, `0` disables), the emitter stays silent for the turn.+ Rationale: if Jarvis just said it is working, another ack within seconds is+ chatter; a genuinely new question after the gap still gets its bridge.++### 3. Usefulness gate (speech pipeline `_on_announcement`)++- For `kind="preamble"` announcements from `source_layer="brain.router.ack"`+ arriving while a voice turn is in `PROCESSING`: reuse the AD-OE5 helper+ `_await_ack_turn_commit(grounded_ack_commit_grace_ms)` (new knob, default+ 900 ms, `0` disables). If the turn leaves `PROCESSING` during the grace+ (answer already speaking, or the user resumed), the ack is dropped — the+ ack only speaks when the brain is demonstrably still busy.+- Announcements arriving with no voice turn in flight keep legacy behavior+ (chat-path acks are not newly suppressed).++### 4. Duplicate-text safety net (speech pipeline `_on_announcement`)++- Preamble/progress-class announcements whose scrubbed text is identical to+ the previously spoken preamble/progress line within+ `preamble_dedup_window_s` (new knob, default 180 s, `0` disables) are+ dropped. This kills "same phrase twice" from ANY emitter (grounded ack,+ Flash-Brain, skills) without touching completion/interrupt readbacks,+ which may legitimately repeat and are owed to the user.++### 5. Umlaut fixes in adjacent canned phrases++- `_ANTI_SILENCE_PHRASES["de"]` in `jarvis/brain/tool_use_loop.py` and the+ equivalent string in `jarvis/brain/manager.py` get real umlauts+ ("ausführen", "dafür").++### Config summary (`AckBrainConfig`, all with safe defaults)++| Knob | Default | Effect when 0 |+|---|---|---|+| `grounded_ack_min_gap_s` | 20 | no cooldown (legacy) |+| `grounded_ack_commit_grace_ms` | 900 | speak immediately (legacy) |+| `preamble_dedup_window_s` | 180 | no dedup (legacy) |++### Compatibility / non-regression contract++- Skip-list, voice-control bypass, once-per-`generate()` guard, circuit+ breaker, suppress-after-interrupt window, floor deferral, hangup/mute gates,+ language resolver precedence: all preserved unchanged.+- `[ack_brain].grounded_tool_ack = false` still disables the feature entirely.+- Spawn announcements, heartbeats, Flash-Brain preamble: untouched.+- Existing exact-string tests in `tests/unit/brain/test_ack_generator.py` are+ rewritten to pool-membership + no-repeat assertions (they tested the old+ single-phrase design, which this spec retires).++## Testing++- Unit: pool membership per family/language, es coverage for every family,+ no-repeat across consecutive picks, cli service-name resolution, skip-list+ additions, determinism of skip/None semantics.+- Unit: emitter min-gap (two `generate()` runs inside the gap → one publish;+ after the gap → second publish).+- Unit: pipeline dedup + commit-grace using the existing pipeline test+ harness (`tests/unit/speech/test_ack_continuation_grace.py` pattern).+>>>>>>> Stashed changesdiff --git a/jarvis/brain/tool_use_loop.py b/jarvis/brain/tool_use_loop.pyindex 7e12a89eeb..ce13ed74e4 100644--- a/jarvis/brain/tool_use_loop.py+++ b/jarvis/brain/tool_use_loop.py@@ -379,6 +379,7 @@ class ToolUseLoop:# loop issues. Safety ceiling, not a target (see BrainConfig.max_tokens).self._max_tokens = max_tokens+<<<<<<< Updated upstreamdef _resolve_tool(self, requested: str) -> tuple[Tool | None, str]:"""Look up a model-requested tool name, tolerating separator/case drift.@@ -420,6 +421,32 @@ class ToolUseLoop:except Exception: # noqa: BLE001 — observability must never break the looplog.debug("guard-denied publish failed", exc_info=True)+||||||| Stash base+=======+ def _resolve_tool(self, requested: str) -> tuple[Tool | None, str]:+ """Look up a model-requested tool name, tolerating separator/case drift.++ Exact match wins. Otherwise the canonical (hyphen/underscore/case-+ insensitive) form resolves — but only when it maps to exactly ONE+ registered tool. Returns ``(tool, registered_name)``; unknown names+ return ``(None, requested)`` so the anti-silence fallback still fires.+ """+ tool = self._tools.get(requested)+ if tool is not None or not requested:+ return tool, requested+ alias = self._alias_map.get(_canonical_tool_name(requested))+ if alias is None:+ return None, requested+ tool = self._tools.get(alias)+ if tool is None:+ return None, requested+ log.info(+ "tool_use_loop: model called tool %r — resolved to registered "+ "tool %r via separator-insensitive alias", requested, alias,+ )+ return tool, alias++>>>>>>> Stashed changesdef _tool_schemas(self) -> list[dict[str, Any]]:"""Schemas in Anthropic-compatible format (providers normalise)."""return [diff --git a/jarvis/core/protocols.py b/jarvis/core/protocols.pyindex e2baa8e2a8..57608e158b 100644--- a/jarvis/core/protocols.py+++ b/jarvis/core/protocols.py@@ -385,6 +385,7 @@ PLUGIN_GROUPS: tuple[str, ...] = ("jarvis.harness","jarvis.tool","jarvis.channel", # NEW+ "jarvis.realtime", # NEW — full-duplex speech-to-speech providers)diff --git a/jarvis/plugins/realtime/__init__.py b/jarvis/plugins/realtime/__init__.pynew file mode 100644index 0000000000..18bccf0316--- /dev/null+++ b/jarvis/plugins/realtime/__init__.py@@ -0,0 +1,5 @@+"""Realtime provider plugins (jarvis.realtime group).++Per the structural plugin rule these modules MUST NOT import ``jarvis.*`` at+module import; keep the provider SDK import lazy inside methods.+"""diff --git a/jarvis/realtime/__init__.py b/jarvis/realtime/__init__.pynew file mode 100644index 0000000000..5e4d5e3d1a--- /dev/null+++ b/jarvis/realtime/__init__.py@@ -0,0 +1,6 @@+"""Realtime (full-duplex speech-to-speech) orchestrator package.++Nothing heavy is imported at module load (AP-26): the OpenAI SDK is imported+lazily inside the provider adapter. Use ``build_realtime_session`` from+``jarvis.realtime.factory`` to construct a session.+"""diff --git a/jarvis/realtime/protocol.py b/jarvis/realtime/protocol.pynew file mode 100644index 0000000000..79b5b44660--- /dev/null+++ b/jarvis/realtime/protocol.py@@ -0,0 +1,77 @@+"""Contracts for the realtime (full-duplex speech-to-speech) plugin group.++A realtime provider fuses STT + reasoning + TTS + VAD into one stateful+WebSocket session. None of the Brain/STT/TTS protocols can express this, so this+is its own ``jarvis.realtime`` group. Provider modules live under+``jarvis/plugins/realtime/`` and MUST NOT import ``jarvis.*`` at module import.+"""++from __future__ import annotations++from collections.abc import AsyncIterator+from dataclasses import dataclass+from typing import Any, Literal, Protocol, runtime_checkable++from jarvis.core.protocols import AudioChunk++RealtimeEventType = Literal[+ "audio_delta",+ "output_transcript_delta",+ "input_transcript",+ "speech_started",+ "interrupted",+ "turn_complete",+ "error",+]+++@dataclass(frozen=True, slots=True)+class RealtimeEvent:+ """One normalized, provider-neutral event from a duplex session."""++ type: RealtimeEventType+ audio: AudioChunk | None = None # audio_delta+ text: str | None = None # output_transcript_delta / input_transcript+ is_final: bool = False+ ms_played: int | None = None # speech_started: ms of our audio already heard+ error: str | None = None+++@dataclass(frozen=True, slots=True)+class RealtimeSessionConfig:+ """Everything a provider needs to open one duplex session."""++ instructions: str = ""+ language: str = "en" # bare de/en/es (resolved once, upstream)+ voice: str = ""+ input_sample_rate: int = 16000+ output_sample_rate: int = 24000+ modalities: tuple[str, ...] = ("audio", "text")+ turn_detection: str = "server_vad" # "server_vad" | "semantic_vad"+++@runtime_checkable+class RealtimeSession(Protocol):+ """A live duplex handle (one connection)."""++ session_id: str++ async def send_audio(self, chunk: AudioChunk) -> None: ...+ def receive(self) -> AsyncIterator[RealtimeEvent]: ...+ async def update_session(self, *, instructions: str | None = None, language: str | None = None) -> None: ...+ async def truncate(self, audio_end_ms: int) -> None: ...+ async def interrupt(self) -> None: ...+ async def close(self) -> None: ...+++@runtime_checkable+class RealtimeProvider(Protocol):+ """The plugin entry-point class."""++ name: str+ supports_realtime: bool+ input_sample_rate: int+ output_sample_rate: int++ async def can_open_duplex_session(self) -> bool: ...+ async def open_session(self, cfg: RealtimeSessionConfig) -> RealtimeSession: ...diff --git a/tests/unit/realtime/__init__.py b/tests/unit/realtime/__init__.pynew file mode 100644index 0000000000..e69de29bb2diff --git a/tests/unit/realtime/test_protocol.py b/tests/unit/realtime/test_protocol.pynew file mode 100644index 0000000000..62dfbf24a4--- /dev/null+++ b/tests/unit/realtime/test_protocol.py@@ -0,0 +1,22 @@+from jarvis.core.protocols import PLUGIN_GROUPS+++def test_realtime_group_registered():+ assert "jarvis.realtime" in PLUGIN_GROUPS+++def test_protocol_types_importable():+ from jarvis.realtime.protocol import (+ RealtimeEvent,+ RealtimeProvider,+ RealtimeSession,+ RealtimeSessionConfig,+ )++ ev = RealtimeEvent(type="audio_delta")+ assert ev.type == "audio_delta"+ cfg = RealtimeSessionConfig(instructions="hi", language="en")+ assert cfg.language == "en"+ # Protocols are runtime_checkable.+ assert hasattr(RealtimeProvider, "_is_runtime_protocol")+ assert hasattr(RealtimeSession, "_is_runtime_protocol")