Skip to content

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.

chore: auto-save WIP via Claude stop-hook safety net (2026-07-14 09:37)

Ruben Lütke0feca64ab840
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.md
index 337269d47b..9f61b43fe1 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,4 +1,5 @@
<<<<<<< Updated upstream
+<<<<<<< Updated upstream
# Interim-Answer (Grounded Tool-Ack) Redesign — Design Spec
Date: 2026-07-06
@@ -248,3 +249,128 @@ Flash-Brain preamble (off by default), the `_on_announcement` gate chain
- Unit: pipeline dedup + commit-grace using the existing pipeline test
harness (`tests/unit/speech/test_ack_continuation_grace.py` pattern).
>>>>>>> Stashed changes
+||||||| 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 changes
diff --git a/jarvis/brain/tool_use_loop.py b/jarvis/brain/tool_use_loop.py
index dd20fad07c..23a8d6901d 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 upstream
def _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 loop
log.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 changes
def _tool_schemas(self) -> list[dict[str, Any]]:
"""Schemas in Anthropic-compatible format (providers normalise)."""
return [
diff --git a/scripts/ci/privacy_gate/references/distribution-denylist.txt b/scripts/ci/privacy_gate/references/distribution-denylist.txt
index e8277b86f7..bda1db979b 100644
--- a/scripts/ci/privacy_gate/references/distribution-denylist.txt
+++ b/scripts/ci/privacy_gate/references/distribution-denylist.txt
@@ -264,3 +264,10 @@ docs/realtime-voice/**
# Root-level Codex dev-handoff task prompts are internal working notes, not
# user-facing docs.
codex-*.md
+
+# --- Tests for withheld maintainer tooling (2026-07-14, v1.0.6 CI forensic) ---
+# These test the privacy gate and the drift-guard config-soll pin — both of
+# which are themselves denylisted above, so the tests can only fail in the
+# public snapshot (FileNotFoundError on the withheld files).
+tests/unit/ci/test_privacy_pre_push.py
+tests/unit/scripts/test_drift_guard_brain_primary_contract.py
diff --git a/tests/board/test_sync.py b/tests/board/test_sync.py
index d5deb256bc..d11d434af0 100644
--- a/tests/board/test_sync.py
+++ b/tests/board/test_sync.py
@@ -15,6 +15,9 @@ from uuid import uuid4
import httpx
import pytest
+pytest.importorskip(
+ "board_backend", reason="board-backend module not on sys.path (public snapshot / plain checkout)"
+)
from board_backend.config import Settings
from board_backend.main import create_app
from jarvis.board.aggregator import BoardAggregator
diff --git a/tests/integration/mcp/__init__.py b/tests/integration/mcp/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/integration/memory/test_three_triggers.py b/tests/integration/memory/test_three_triggers.py
index 24ed1b44a6..e3e9b8e3c0 100644
--- a/tests/integration/memory/test_three_triggers.py
+++ b/tests/integration/memory/test_three_triggers.py
@@ -34,6 +34,7 @@ Design notes
from __future__ import annotations
import asyncio
+import sqlite3
import time
from collections.abc import AsyncIterator
from pathlib import Path
@@ -59,6 +60,7 @@ from jarvis.memory.wiki.curator_llm import WikiCuratorLLM
from jarvis.memory.wiki.log_writer import LogWriter
from jarvis.memory.wiki.page import MarkdownPageRepository
from jarvis.memory.wiki.protocols import PageUpdate
+from jarvis.memory.wiki.fts_index import rebuild_index
from jarvis.memory.wiki.search import VaultSearch
from jarvis.memory.wiki.session_rollup import SessionRollupWorker
from jarvis.memory.wiki.telemetry import telemetry
@@ -264,8 +266,14 @@ async def stack(tmp_path: Path):
rollup._cfg = rollup._cfg.model_copy(update={"wiki_write_enabled": True}) # noqa: SLF001
await rollup.start()
- # Context injector consumes the same on-disk vault.
- search = VaultSearch(vault_root)
+ # Context injector consumes the same on-disk vault. VaultSearch reads
+ # the FTS index, which in production is fed by the boot reconcile
+ # (wiki_boot_index -> rebuild_index) and the live vault watcher; neither
+ # runs in this fixture, so tests re-run rebuild_index (the boot step)
+ # before every injector expectation.
+ fts_conn = sqlite3.connect(":memory:", check_same_thread=False)
+ rebuild_index(vault_root, fts_conn)
+ search = VaultSearch(vault_root, conn=fts_conn)
injector = WikiContextInjector(
search=search, max_chars=1500,
latency_budget_ms=500, # generous; tmpfs is fast
@@ -286,6 +294,7 @@ async def stack(tmp_path: Path):
"clock_holder": clock_holder,
"injector": injector,
"search": search,
+ "fts_conn": fts_conn,
}
bridge.stop()
@@ -329,6 +338,7 @@ async def test_voice_fact_becomes_context_on_next_turn(stack) -> None:
# Next turn: the injector finds the freshly-written page and
# prepends it to the system prompt.
base_prompt = "You are Personal Jarvis."
+ rebuild_index(s["vault_root"], s["fts_conn"]) # the boot/watcher index step
augmented = await s["injector"].maybe_inject(
user_text="Was war nochmal mein Lieblingsfilm?",
system_prompt=base_prompt,
@@ -372,6 +382,7 @@ async def test_rollup_produces_session_page_visible_to_injector(stack) -> None:
# The injector finds the session page (the rollup paragraph mentions
# "wiki memory rebuild" via wikilinks).
+ rebuild_index(s["vault_root"], s["fts_conn"]) # the boot/watcher index step
augmented = await s["injector"].maybe_inject(
user_text="Was haben wir letzte Session am Wiki gemacht?",
system_prompt="You are Personal Jarvis.",
@@ -718,7 +729,9 @@ async def test_fresh_triggers_recover_existing_vault_state(stack) -> None:
s["bridge"].stop()
await s["rollup"].stop()
- fresh_search = VaultSearch(vault_root)
+ fresh_conn = sqlite3.connect(":memory:", check_same_thread=False)
+ rebuild_index(vault_root, fresh_conn) # the boot's wiki_boot_index step
+ fresh_search = VaultSearch(vault_root, conn=fresh_conn)
fresh_injector = WikiContextInjector(
search=fresh_search, max_chars=1500,
latency_budget_ms=500, min_keyword_length=4,
diff --git a/tests/skills/test_web_search.py b/tests/skills/test_web_search.py
index aca2531973..e985f68422 100644
--- a/tests/skills/test_web_search.py
+++ b/tests/skills/test_web_search.py
@@ -10,6 +10,9 @@ import time
import pytest
+pytest.importorskip(
+ "skills.web_search", reason="top-level skills package absent (public snapshot / plain checkout)"
+)
from skills.web_search import (
SKILL_NAME,
SKILL_RISK_TIER,
diff --git a/tests/skills/test_web_search_sanitize.py b/tests/skills/test_web_search_sanitize.py
index 455ffbf6e2..a404cbdd25 100644
--- a/tests/skills/test_web_search_sanitize.py
+++ b/tests/skills/test_web_search_sanitize.py
@@ -11,6 +11,9 @@ import string
import pytest
from hypothesis import HealthCheck, given, settings, strategies as st
+pytest.importorskip(
+ "skills.web_search", reason="top-level skills package absent (public snapshot / plain checkout)"
+)
from skills.web_search._sanitize import (
INJECTION_TOKENS,
MAX_QUERY_LEN,
diff --git a/tests/skills/test_web_search_voice_override.py b/tests/skills/test_web_search_voice_override.py
index 21b21ab21f..7668e47958 100644
--- a/tests/skills/test_web_search_voice_override.py
+++ b/tests/skills/test_web_search_voice_override.py
@@ -4,6 +4,9 @@ from __future__ import annotations
import pytest
+pytest.importorskip(
+ "skills.web_search", reason="top-level skills package absent (public snapshot / plain checkout)"
+)
from skills.web_search._voice_override import (
SearchSettings,
TEXT_LATENCY_BUDGET_MS,
diff --git a/tests/unit/mcp/__init__.py b/tests/unit/mcp/__init__.py
new file mode 100644
index 0000000000..e69de29bb2