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-06 18:07)
Ruben Lütke086031f159eb
diff --git a/jarvis/brain/ack_brain/config.py b/jarvis/brain/ack_brain/config.pyindex dc8c15db08..8a126ac617 100644--- a/jarvis/brain/ack_brain/config.py+++ b/jarvis/brain/ack_brain/config.py@@ -109,6 +109,27 @@ class AckBrainConfig(BaseModel):# (skip-list-aware) and re-scrubbed at the speech layer. Set False to go# back to pure silence during tool execution.grounded_tool_ack: bool = Field(default=True)+ # 2026-07-06 interim-ack redesign (spec: docs/superpowers/specs/+ # 2026-07-06-interim-ack-redesign-design.md). Forensic finding: one voice+ # session spoke the identical grounded ack once per utterance, three+ # times in a row — pure chatter. Minimum gap between two PUBLISHED+ # grounded acks (manager-wide, across utterances). Within the gap the+ # emitter stays silent: Jarvis just said it is working; saying it again+ # seconds later is noise. 0 restores the legacy per-turn-only guard.+ grounded_ack_min_gap_s: int = Field(default=20, ge=0, le=600)+ # Usefulness gate for the grounded ack at the speech layer: when the+ # announcement arrives while a voice turn is in PROCESSING, the pipeline+ # waits this long (AD-OE5 commit-grace helper) and only speaks the ack if+ # the brain is STILL busy — a turn that answers quickly stays ack-free.+ # 0 restores speak-immediately.+ grounded_ack_commit_grace_ms: int = Field(default=900, ge=0, le=5000)+ # Duplicate-text safety net at the speech layer: a preamble/progress-class+ # announcement whose (scrubbed) text is identical to the previously spoken+ # preamble/progress line within this window is dropped — no source may+ # repeat itself verbatim in quick succession. Completion/interrupt+ # readbacks are exempt (they deliver an answer the user is owed).+ # 0 disables the dedup.+ preamble_dedup_window_s: int = Field(default=180, ge=0, le=3600)# "follow_brain" mirrors cfg.brain.primary so the Flash-Brain# naturally tracks whatever main provider the user is on. Pin to# a concrete name (gemini/grok/openai/ollama) to override.diff --git a/jarvis/brain/ack_generator.py b/jarvis/brain/ack_generator.pyindex ebf3f4ed75..5b67c27979 100644--- a/jarvis/brain/ack_generator.py+++ b/jarvis/brain/ack_generator.py@@ -1,40 +1,54 @@"""Acknowledgment-text generator for the perceived-latency-reduction pattern.Hauptjarvis emits a brief, task-specific spoken ack the moment it has decided-on a tool call ("Verstanden, ich kuemmere mich darum.") so the user hears-something within ~200ms instead of waiting through the full reasoning +-tool-execution roundtrip in silence. The substantive answer follows after-the tool finishes.+on a tool call so the user hears something within ~200ms instead of waiting+through the full reasoning + tool-execution roundtrip in silence. The+substantive answer follows after the tool finishes.Design constraints:-* **No LLM call.** Templates are deterministic dict lookups. Render time- must stay well under one millisecond, otherwise the latency win is gone.+* **No LLM call.** Phrases are deterministic pool lookups + one random pick.+ Render time must stay well under one millisecond, otherwise the latency+ win is gone.+* **Varied, never robotic.** Every tool family carries a POOL of phrase+ variants per language and a process-wide no-repeat memory+ (:class:`AckPhrasePicker`) guarantees consecutive acks never sound+ identical — the 2026-07-05 forensic finding was the same "Moment."+ spoken three times in one session (one per utterance). # i18n-allow: forensic quote of the retired German single-phrase ack* **Tool-family-specific.** Per-tool handlers extract the most informative- arg (search query, app name, skill name) into the ack so the user knows- the right intent was understood — generic "okay, one moment" only as- fallback for tools whose args are too noisy to echo (shell commands,- long harness tasks).-* **Skip-list.** Passive state reads (awareness-snapshot, screen-snapshot)- and low-latency individual UI events (click, hotkey, type-text) return- ``None`` because a chat-style ack would chatter or feel uncanny.-* **Bilingual de/en.** Language is picked per request from the user's- utterance language; templates exist for both. User strings stay in- their natural form (German with umlauts) — only the surrounding code- is English per the project's output-language policy.+ arg (search query, app name, skill name, CLI service) into the ack so the+ user knows the right intent was understood — generic "okay, one moment"+ variants only as fallback for tools whose args are too noisy to echo+ (raw shell commands, long harness tasks).+* **Skip-list.** Passive state reads (awareness-snapshot, screen-snapshot,+ wiki lookups) and low-latency individual UI events (click, hotkey,+ type-text) return ``None`` because a chat-style ack would chatter or feel+ uncanny.+* **Trilingual de/en/es.** Language is picked per request from the resolved+ turn language; every pool exists for all three supported languages+ (runtime-output-language doctrine). User strings stay in their natural+ form (German with real umlauts) — only the surrounding code is English+ per the project's output-language policy.Companion functions ``final_summary_marker`` and ``should_prepend_marker``support the second half of the pattern: a short "Erledigt." prepended to-the brain's final response, unless the brain already self-confirmed.+the brain's final response, unless the brain already self-confirmed. # i18n-allow: quoted German completion marker++.. note:: The phrase strings in this module are runtime voice/TTS product+ content (multilingual product surface). German lines carry inline+ ``i18n-allow`` markers."""from __future__ import annotations+import randomimport re-from collections.abc import Callable, Mapping+from collections import deque+from collections.abc import Callable, Mapping, Sequencefrom typing import Any__all__ = ["ACK_SKIP_TOOLS",+ "AckPhrasePicker","final_summary_marker","generate_ack","is_voice_control_utterance",@@ -93,7 +107,8 @@ def is_voice_control_utterance(utterance: str | None) -> bool:return bool(_VOICE_CONTROL_PATTERN.match(utterance.strip()))# Tools that must NOT emit an ack. Two reasons:-# (a) Passive state reads — there is no user-visible action to confirm.+# (a) Passive state reads — there is no user-visible action to confirm,+# and the fast ones (wiki lookup: ~70 ms) would ack a sub-100 ms read.# (b) Low-latency individual UI events — a per-event chat ack would# generate dozens of TTS interruptions during a single keypress# sequence (type-text streams characters; click is single-pixel).@@ -102,6 +117,10 @@ ACK_SKIP_TOOLS: frozenset[str] = frozenset({"awareness_snapshot","screen_snapshot","whoami",+ # fast passive memory reads (2026-07-06: wiki-recall answered in 72 ms —+ # a spoken "one moment" for that is pure chatter)+ "wiki_recall",+ "wiki_search",# low-latency UI events"click","hotkey",@@ -113,17 +132,11 @@ ACK_SKIP_TOOLS: frozenset[str] = frozenset({})_FINAL_MARKERS: dict[str, str] = {- "de": "Erledigt.",+ "de": "Erledigt.", # i18n-allow: German runtime voice product (completion marker)"en": "Done.","es": "Listo.",}-_GENERIC_ACK: dict[str, str] = {- "de": "Okay, einen Moment.",- "en": "Okay, one moment.",- "es": "Vale, un momento.",-}-# A brain text that already opens with one of these is treated as# self-confirming, so we don't double up with "Erledigt. Okay, ..."_ALREADY_CONFIRMING_RE = re.compile(@@ -132,6 +145,46 @@ _ALREADY_CONFIRMING_RE = re.compile()+class AckPhrasePicker:+ """Phrase selection with a short no-repeat memory.++ The 2026-07-05 forensic complaint was not "an ack existed" but "the SAME+ ack, three times in a row". The picker keeps the last few spoken phrases+ (global across tool families — repetition is the irritant regardless of+ family) and never picks one of them again while an alternative exists.+ A pool smaller than the memory still always yields a phrase (falls back+ to the full pool), so the ack can never be silenced by its own memory.++ Phrase variety, not cryptography — ``random.choice`` is deliberate.+ """++ def __init__(self, memory: int = 4) -> None:+ self._recent: deque[str] = deque(maxlen=memory)++ def pick(self, pool: Sequence[str]) -> str:+ """Return one phrase from ``pool``, avoiding the most recent picks.++ Guarantee: for any pool with at least two entries, two CONSECUTIVE+ picks are never identical — when the whole pool sits in memory (pool+ smaller than the memory), the fallback still excludes the very last+ pick before resorting to the full pool.+ """+ last = self._recent[-1] if self._recent else None+ candidates = (+ [p for p in pool if p not in self._recent]+ or [p for p in pool if p != last]+ or list(pool)+ )+ choice = random.choice(candidates) # noqa: S311 — variety, not security+ self._recent.append(choice)+ return choice+++# Process-wide default memory: consecutive utterances in one session share it,+# which is exactly the scope of the "three identical acks in a row" bug.+_DEFAULT_PICKER = AckPhrasePicker()++def _normalize_tool_name(name: str) -> str:"""Tool calls arrive as either 'dispatch-to-harness' or 'dispatch_to_harness'.@@ -171,126 +224,445 @@ def _trim_to_words(text: str, max_chars: int) -> str:# ----------------------------------------------------------------------------# Per-tool template handlers+# Phrase pools+# ---------------------------------------------------------------------------+#+# Every entry: language code -> tuple of variants. All three supported+# languages are present in every pool (runtime-output-language doctrine).+# German strings are runtime voice product content (i18n-allow). Phrases are+# promissory ("I'm on it"), never completion claims — the tool has not run yet.++_GENERIC_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, einen Moment.", # i18n-allow: German runtime voice product+ "Einen Augenblick bitte.", # i18n-allow: German runtime voice product+ "Kurzen Moment, ich bin dran.", # i18n-allow: German runtime voice product+ "Geht klar, Sekunde.", # i18n-allow: German runtime voice product+ "Ich kümmere mich drum.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, one moment.",+ "Just a second.",+ "On it, give me a moment.",+ "One sec, working on it.",+ "Alright, hang on.",+ ),+ "es": (+ "Vale, un momento.",+ "Un segundo.",+ "Enseguida, dame un momento.",+ "Voy, un segundito.",+ "De acuerdo, espera un poco.",+ ),+}++_SHELL_ACK: dict[str, tuple[str, ...]] = {+ # Shell commands are technical noise the user doesn't want spoken back —+ # the phrases stay content-free but warm.+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Einen Moment, ich schaue nach.", # i18n-allow: German runtime voice product+ "Ich prüfe das kurz.", # i18n-allow: German runtime voice product+ "Sekunde, ich sehe nach.", # i18n-allow: German runtime voice product+ "Ich werfe kurz einen Blick drauf.", # i18n-allow: German runtime voice product+ "Moment, ich schaue mir das an.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "One moment, let me check.",+ "Let me take a quick look.",+ "Checking that now.",+ "Give me a second to look.",+ "Taking a quick look.",+ ),+ "es": (+ "Un momento, lo compruebo.",+ "Déjame echar un vistazo.",+ "Lo miro ahora mismo.",+ "Dame un segundo para mirarlo.",+ "Le echo un vistazo rápido.",+ ),+}++# {service} is interpolated with a human-readable CLI service name+# (cli_gh -> "GitHub"). See _CLI_SERVICE_NAMES / _cli_pool.+_CLI_SERVICE_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Ich schaue kurz auf {service} nach.", # i18n-allow: German runtime voice product+ "Einen Moment, ich frage {service} ab.", # i18n-allow: German runtime voice product+ "Ich werfe einen Blick in {service}.", # i18n-allow: German runtime voice product+ "Sekunde, ich schaue in {service} nach.", # i18n-allow: German runtime voice product+ "Ich hole das eben aus {service}.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Taking a quick look at {service}.",+ "One moment, checking {service}.",+ "Let me pull that from {service}.",+ "Checking {service} now.",+ "Having a quick look in {service}.",+ ),+ "es": (+ "Echo un vistazo rápido a {service}.",+ "Un momento, consulto {service}.",+ "Déjame mirarlo en {service}.",+ "Reviso {service} ahora mismo.",+ "Voy a ver en {service}.",+ ),+}++# Human service names for cli_<name> tools. Unknown suffixes are title-cased+# ("cli_foo_bar" -> "Foo Bar") — still informative, never wrong.+_CLI_SERVICE_NAMES: dict[str, str] = {+ "aws": "AWS",+ "az": "Azure",+ "docker": "Docker",+ "firebase": "Firebase",+ "fly": "Fly.io",+ "gcloud": "Google Cloud",+ "gh": "GitHub",+ "github": "GitHub",+ "kubectl": "Kubernetes",+ "netlify": "Netlify",+ "npm": "npm",+ "railway": "Railway",+ "stripe": "Stripe",+ "supabase": "Supabase",+ "vercel": "Vercel",+}++_HARNESS_ACK: dict[str, tuple[str, ...]] = {+ # Harness / worker tasks are usually long sentences — echoing them sounds+ # robotic. Stay generic but warm.+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Verstanden, ich kümmere mich darum.", # i18n-allow: German runtime voice product+ "Geht klar, das übernehme ich.", # i18n-allow: German runtime voice product+ "Alles klar, ich bin dran.", # i18n-allow: German runtime voice product+ "Okay, ich setze mich dran.", # i18n-allow: German runtime voice product+ "Mach ich, einen Moment.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Got it, on it.",+ "Alright, I'll take that on.",+ "Understood, working on it.",+ "Okay, I'm on it now.",+ "Sure, give me a moment.",+ ),+ "es": (+ "Entendido, me encargo.",+ "Vale, lo asumo yo.",+ "De acuerdo, estoy en ello.",+ "Okay, me pongo con ello.",+ "Claro, un momento.",+ ),+}++_SEARCH_TOPIC_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, ich schaue mir {topic} an.", # i18n-allow: German runtime voice product+ "Ich suche kurz nach {topic}.", # i18n-allow: German runtime voice product+ "Moment, ich recherchiere zu {topic}.", # i18n-allow: German runtime voice product+ "Ich schaue, was ich zu {topic} finde.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, looking up {topic}.",+ "Searching for {topic} real quick.",+ "One moment, digging into {topic}.",+ "Let me see what I find on {topic}.",+ ),+ "es": (+ "Vale, busco {topic}.",+ "Un momento, investigo {topic}.",+ "Voy a ver qué encuentro sobre {topic}.",+ "Buscando {topic} ahora.",+ ),+}++_SEARCH_GENERIC_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, ich recherchiere kurz.", # i18n-allow: German runtime voice product+ "Ich suche das eben raus.", # i18n-allow: German runtime voice product+ "Moment, ich schaue mich um.", # i18n-allow: German runtime voice product+ "Einen Moment, ich sammle die Fakten.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, researching.",+ "Let me dig that up.",+ "One moment, looking around.",+ "Give me a moment to gather the facts.",+ ),+ "es": (+ "Vale, investigo un poco.",+ "Déjame buscarlo.",+ "Un momento, echo un vistazo.",+ "Dame un momento para reunir los datos.",+ ),+}++_MULTI_SPAWN_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, ich erledige {n} Sachen parallel.", # i18n-allow: German runtime voice product+ "Ich nehme mir die {n} Aufgaben gleichzeitig vor.", # i18n-allow: German runtime voice product+ "{n} Dinge parallel — läuft.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, running {n} tasks in parallel.",+ "Taking on those {n} jobs at once.",+ "{n} things in parallel — on it.",+ ),+ "es": (+ "Vale, hago {n} cosas en paralelo.",+ "Me pongo con las {n} tareas a la vez.",+ "{n} cosas en paralelo — voy.",+ ),+}++_OPEN_APP_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, ich öffne {app}.", # i18n-allow: German runtime voice product+ "Moment, {app} kommt.", # i18n-allow: German runtime voice product+ "Ich starte {app}.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, opening {app}.",+ "One sec, launching {app}.",+ "Starting {app}.",+ ),+ "es": (+ "Vale, abro {app}.",+ "Un segundo, lanzo {app}.",+ "Inicio {app}.",+ ),+}++_RUN_SKILL_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, ich starte {skill}.", # i18n-allow: German runtime voice product+ "Moment, {skill} läuft gleich.", # i18n-allow: German runtime voice product+ "Ich lasse {skill} laufen.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, running {skill}.",+ "One moment, starting {skill}.",+ "Kicking off {skill} now.",+ ),+ "es": (+ "Vale, ejecuto {skill}.",+ "Un momento, arranco {skill}.",+ "Pongo {skill} en marcha.",+ ),+}++_GMAIL_READ_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, ich schaue in deine Mails.", # i18n-allow: German runtime voice product+ "Moment, ich öffne dein Postfach.", # i18n-allow: German runtime voice product+ "Ich sehe kurz in deinen Mails nach.", # i18n-allow: German runtime voice product+ "Ich werfe einen Blick in dein Postfach.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, checking your mail.",+ "One moment, opening your inbox.",+ "Taking a quick look at your email.",+ "Peeking into your inbox.",+ ),+ "es": (+ "Vale, reviso tu correo.",+ "Un momento, abro tu bandeja.",+ "Echo un vistazo a tus correos.",+ "Miro tu bandeja de entrada.",+ ),+}++_CALENDAR_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, ich schaue in deinen Kalender.", # i18n-allow: German runtime voice product+ "Moment, ich prüfe deine Termine.", # i18n-allow: German runtime voice product+ "Ich sehe in deinem Kalender nach.", # i18n-allow: German runtime voice product+ "Kurzer Blick in deinen Kalender.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, checking your calendar.",+ "One moment, looking at your schedule.",+ "Let me check your appointments.",+ "Quick look at your calendar.",+ ),+ "es": (+ "Vale, reviso tu calendario.",+ "Un momento, miro tu agenda.",+ "Compruebo tus citas.",+ "Un vistazo rápido a tu calendario.",+ ),+}++_REMEMBER_ACK: dict[str, tuple[str, ...]] = {+ # Promissory only — "noted"-style completion claims would be a lie at+ # selection time (the tool has not run yet).+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, ich merke mir das.", # i18n-allow: German runtime voice product+ "Geht klar, das behalte ich.", # i18n-allow: German runtime voice product+ "Ich schreibe es mir auf.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, noting that.",+ "Got it, I'll remember that.",+ "Writing that down.",+ ),+ "es": (+ "Vale, lo apunto.",+ "Entendido, lo recordaré.",+ "Me lo apunto.",+ ),+}++_VERIFY_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, ich prüfe das.", # i18n-allow: German runtime voice product+ "Moment, ich teste das kurz.", # i18n-allow: German runtime voice product+ "Ich checke das eben.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, checking.",+ "One moment, testing that.",+ "Let me verify that.",+ ),+ "es": (+ "Vale, lo compruebo.",+ "Un momento, lo pruebo.",+ "Déjame verificarlo.",+ ),+}++_SERVER_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, ich starte den Server.", # i18n-allow: German runtime voice product+ "Moment, der Server fährt hoch.", # i18n-allow: German runtime voice product+ "Ich fahre den Server hoch.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, starting the server.",+ "One moment, spinning up the server.",+ "Bringing the server up.",+ ),+ "es": (+ "Vale, inicio el servidor.",+ "Un momento, arranco el servidor.",+ "Levanto el servidor.",+ ),+}++_SET_CONFIG_ACK: dict[str, tuple[str, ...]] = {+ "de": ( # i18n-allow: German runtime voice product (ack phrase pool)+ "Okay, ich ändere das.", # i18n-allow: German runtime voice product+ "Moment, ich stelle das um.", # i18n-allow: German runtime voice product+ "Ich passe das an.", # i18n-allow: German runtime voice product+ ),+ "en": (+ "Okay, updating.",+ "One moment, changing that.",+ "Adjusting that now.",+ ),+ "es": (+ "Vale, lo cambio.",+ "Un momento, lo ajusto.",+ "Lo adapto ahora.",+ ),+}+++# ---------------------------------------------------------------------------+# Per-tool pool handlers# ---------------------------------------------------------------------------## Each handler takes the tool's arg dict + the resolved language code and-# returns a short ack string. Handlers must never raise — the dispatcher-# falls back to ``_GENERIC_ACK`` on any exception, so a broken template-# never silences the ack entirely.+# returns a tuple of candidate phrases. Handlers must never raise — the+# dispatcher falls back to ``_GENERIC_ACK`` on any exception, so a broken+# template never silences the ack entirely.-def _ack_dispatch_harness(args: Mapping[str, Any], lang: str) -> str:- # Harness tasks are usually long sentences — echoing them sounds robotic.- # Stay generic but warm.- return {- "de": "Verstanden, ich kuemmere mich darum.",- "en": "Got it, on it.",- }[lang]+def _interpolate(pool: tuple[str, ...], **kwargs: Any) -> tuple[str, ...]:+ """Format every variant in ``pool`` with ``kwargs``."""+ return tuple(p.format(**kwargs) for p in pool)-def _ack_run_shell(args: Mapping[str, Any], lang: str) -> str:- # Shell commands are technical noise the user doesn't want spoken back.- return {"de": "Moment.", "en": "One moment."}[lang]+def _ack_dispatch_harness(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:+ return _HARNESS_ACK[lang]-def _ack_search_web(args: Mapping[str, Any], lang: str) -> str:+def _ack_run_shell(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:+ return _SHELL_ACK[lang]+++def _ack_search_web(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:query = str(args.get("query") or args.get("q") or "").strip()- if query and len(query) <= 40 and " " not in query[:3]:+ # Echo the topic only when it is topic-shaped (short, few words) — a full+ # question sentence read back sounds robotic.+ if query and len(query) <= 40 and len(query.split()) <= 4:topic = _trim_to_words(query, 40)- return {- "de": f"Okay, ich schau mir {topic} an.",- "en": f"Okay, looking up {topic}.",- }[lang]- return {"de": "Okay, ich recherchiere.", "en": "Okay, researching."}[lang]+ return _interpolate(_SEARCH_TOPIC_ACK[lang], topic=topic)+ return _SEARCH_GENERIC_ACK[lang]-def _ack_spawn_sub_jarvis(args: Mapping[str, Any], lang: str) -> str:- # Sub-Jarvis spawns are the exact case the user complained about ("stille- # Pause vor langer Antwort"). Keep the ack as short and warm as possible.- return {- "de": "Verstanden, ich kuemmere mich drum.",- "en": "Got it, on it.",- }[lang]+def _ack_spawn_sub_jarvis(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:+ # Sub-Jarvis spawns are the exact case the user complained about ("silent+ # pause before a long answer"). Keep the ack short and warm.+ return _HARNESS_ACK[lang]-def _ack_multi_spawn(args: Mapping[str, Any], lang: str) -> str:+def _ack_multi_spawn(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:tasks = args.get("tasks") or args.get("jobs") or []n = len(tasks) if isinstance(tasks, (list, tuple)) else 0if n >= 2:- return {- "de": f"Okay, ich erledige {n} Sachen parallel.",- "en": f"Okay, running {n} tasks in parallel.",- }[lang]+ return _interpolate(_MULTI_SPAWN_ACK[lang], n=n)return _GENERIC_ACK[lang]-def _ack_open_app(args: Mapping[str, Any], lang: str) -> str:+def _ack_open_app(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:app = str(args.get("app") or args.get("app_name") or args.get("name") or "").strip()if app and len(app) <= 30:- return {- "de": f"Okay, ich oeffne {app}.",- "en": f"Okay, opening {app}.",- }[lang]+ return _interpolate(_OPEN_APP_ACK[lang], app=app)return _GENERIC_ACK[lang]-def _ack_run_skill(args: Mapping[str, Any], lang: str) -> str:+def _ack_run_skill(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:skill = str(args.get("skill") or args.get("skill_name") or args.get("name") or "").strip()if skill and len(skill) <= 40:- return {- "de": f"Okay, ich starte {skill}.",- "en": f"Okay, running {skill}.",- }[lang]+ return _interpolate(_RUN_SKILL_ACK[lang], skill=skill)return _GENERIC_ACK[lang]-def _ack_gmail(args: Mapping[str, Any], lang: str) -> str:+def _ack_gmail(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:# Grounded per-tool ack for the email plugin (the user's slow-plugin# example). Action-aware so a SEND is not mis-announced as a read: a# ``send_message`` still goes through echo-confirmation, so it gets a- # neutral filler, while reads get the specific "checking your mail" line.+ # neutral filler, while reads get the specific "checking your mail" pool.action = str(args.get("action") or "list_messages").strip()if action == "send_message":return _GENERIC_ACK[lang]- return {- "de": "Okay, ich schaue in deine Mails.",- "en": "Okay, checking your mail.",- "es": "Vale, reviso tu correo.",- }[lang]+ return _GMAIL_READ_ACK[lang]-def _ack_google_calendar(args: Mapping[str, Any], lang: str) -> str:- return {- "de": "Okay, ich schaue in deinen Kalender.",- "en": "Okay, checking your calendar.",- "es": "Vale, reviso tu calendario.",- }[lang]+def _ack_google_calendar(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:+ return _CALENDAR_ACK[lang]-def _ack_remember(args: Mapping[str, Any], lang: str) -> str:- return {"de": "Okay, ich merk's mir.", "en": "Okay, noted."}[lang]+def _ack_remember(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:+ return _REMEMBER_ACK[lang]-def _ack_verify(args: Mapping[str, Any], lang: str) -> str:- return {"de": "Okay, ich pruefe das.", "en": "Okay, checking."}[lang]+def _ack_verify(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:+ return _VERIFY_ACK[lang]-def _ack_start_preview_server(args: Mapping[str, Any], lang: str) -> str:- return {- "de": "Okay, ich starte den Server.",- "en": "Okay, starting the server.",- }[lang]+def _ack_start_preview_server(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:+ return _SERVER_ACK[lang]-def _ack_set_config(args: Mapping[str, Any], lang: str) -> str:- return {"de": "Okay, ich aendere das.", "en": "Okay, updating."}[lang]+def _ack_set_config(args: Mapping[str, Any], lang: str) -> tuple[str, ...]:+ return _SET_CONFIG_ACK[lang]-_TemplateFn = Callable[[Mapping[str, Any], str], str]+_TemplateFn = Callable[[Mapping[str, Any], str], tuple[str, ...]]_TEMPLATES: dict[str, _TemplateFn] = {"dispatch_to_harness": _ack_dispatch_harness,@@ -308,11 +680,26 @@ _TEMPLATES: dict[str, _TemplateFn] = {"verify_localhost": _ack_verify,"start_preview_server": _ack_start_preview_server,"set_config_value": _ack_set_config,- # cli_<name> tools all share the same shell-like minimal ack+ # the generic CLI entry shares the shell-like content-free pool"cli_tools": _ack_run_shell,}+def _cli_pool(norm_tool: str, lang: str) -> tuple[str, ...]:+ """Informative pool for a ``cli_<name>`` tool, naming the service.++ ``cli_gh`` resolves to "GitHub"; unknown suffixes are title-cased so the+ ack still names SOMETHING recognizable instead of a bare "one moment".+ """+ suffix = norm_tool[len("cli_"):].strip("_")+ if not suffix:+ return _SHELL_ACK[lang]+ service = _CLI_SERVICE_NAMES.get(+ suffix, suffix.replace("_", " ").title()+ )+ return _interpolate(_CLI_SERVICE_ACK[lang], service=service)++# ---------------------------------------------------------------------------# Public API# ---------------------------------------------------------------------------@@ -322,31 +709,42 @@ def generate_ack(tool_args: Mapping[str, Any] | None = None,*,language: str = "de",+ picker: AckPhrasePicker | None = None,) -> str | None:"""Render a short, task-specific ack string for the given tool call.Returns ``None`` if the tool is in :data:`ACK_SKIP_TOOLS` — the callershould treat that as "do not emit an announcement at all".- The function is pure and total: it never raises. Unknown tool names- fall through to a generic "okay, one moment" rather than aborting.+ The function is total: it never raises. Unknown tool names fall through+ to the generic pool rather than aborting. Selection is intentionally+ varied: the (process-wide) ``picker`` avoids repeating any of the last+ few phrases, so back-to-back acks never sound identical. Pass an+ explicit ``picker`` to isolate state (tests)."""norm = _normalize_tool_name(tool_name)if not norm or norm in ACK_SKIP_TOOLS:return None- # cli_<name> aliases (cli_supabase, cli_gh, cli_vercel, ...) all map- # to the cli_tools handler.+ lang = _normalize_language(language)+ chooser = picker if picker is not None else _DEFAULT_PICKER++ # cli_<name> aliases (cli_supabase, cli_gh, cli_vercel, ...) resolve a+ # human service name for an informative ack.if norm.startswith("cli_") and norm not in _TEMPLATES:- return _ack_run_shell(tool_args or {}, _normalize_language(language))+ try:+ return chooser.pick(_cli_pool(norm, lang))+ except Exception: # noqa: BLE001 — never let a broken pool muzzle the ack+ return chooser.pick(_GENERIC_ACK[lang])- lang = _normalize_language(language)handler = _TEMPLATES.get(norm)if handler is not None:try:- return handler(tool_args or {}, lang)+ pool = handler(tool_args or {}, lang)+ if pool:+ return chooser.pick(pool)except Exception: # noqa: BLE001 — never let a broken template muzzle the ackpass- return _GENERIC_ACK[lang]+ return chooser.pick(_GENERIC_ACK[lang])def final_summary_marker(language: str = "de") -> str:diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.pyindex db2ba85e98..c7bc92cca7 100644--- a/jarvis/brain/manager.py+++ b/jarvis/brain/manager.py@@ -2367,15 +2367,31 @@ class BrainManager:# tool-use loop (a provider that emits tool_calls then errors would# otherwise re-announce on the fallback provider's re-run).fired = False+ # Cross-utterance cooldown (2026-07-06 interim-ack redesign): the+ # per-turn guard above cannot stop the NEXT utterance from acking+ # again seconds later — forensically that produced the same spoken+ # ack three times in one session. Checked at emit time (tool+ # selection can lag turn start by seconds) against the manager-wide+ # timestamp of the last PUBLISHED grounded ack.+ min_gap_s = float(getattr(ack_cfg, "grounded_ack_min_gap_s", 20) or 0)async def emit(tool_name: str, tool_args: dict[str, Any]) -> None:nonlocal firedif fired:return+ if min_gap_s > 0:+ last = getattr(self, "_last_grounded_ack_monotonic", None)+ if last is not None and (time.monotonic() - last) < min_gap_s:+ log.debug(+ "Grounded tool-ack suppressed — last ack %.1fs ago "+ "(min gap %.0fs)", time.monotonic() - last, min_gap_s,+ )+ returntext = generate_ack(tool_name, tool_args, language=language)if text is None: # skip-list tool (passive read / UI micro-event)returnfired = True+ self._last_grounded_ack_monotonic = time.monotonic()await bus.publish(AnnouncementRequested(text=text,@@ -7872,7 +7888,7 @@ def _is_rate_limit_exc(exc: Exception) -> bool:_ACTION_FAILED_PHRASES: dict[str, str] = {"de": ("Ich habe die Aktion erkannt, " # i18n-allow: spoken German TTS- "konnte sie aber nicht ausfuehren." # i18n-allow: spoken German TTS+ "konnte sie aber nicht ausführen." # i18n-allow: spoken German TTS),"en": "I recognized the action but couldn't execute it.","es": "Reconocí la acción, pero no pude ejecutarla.",diff --git a/jarvis/brain/tool_use_loop.py b/jarvis/brain/tool_use_loop.pyindex 6a99941882..368d3f2b5e 100644--- a/jarvis/brain/tool_use_loop.py+++ b/jarvis/brain/tool_use_loop.py@@ -168,8 +168,8 @@ def _is_meta_debug_intent(utterance: str) -> bool:# text; ambiguous text keeps the historical German default._ANTI_SILENCE_PHRASES: dict[str, str] = {"de": (- "Das kann ich gerade nicht ausfuehren — " # i18n-allow: spoken German TTS- "mir fehlt dafuer das passende Werkzeug." # i18n-allow: spoken German TTS+ "Das kann ich gerade nicht ausführen — " # i18n-allow: spoken German TTS+ "mir fehlt dafür das passende Werkzeug." # i18n-allow: spoken German TTS),"en": "I can't do that right now — I'm missing the right tool for it.","es": "Ahora mismo no puedo hacerlo — me falta la herramienta adecuada.",diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.pyindex 7e56a25236..986651986d 100644--- a/jarvis/speech/pipeline.py+++ b/jarvis/speech/pipeline.py@@ -1450,6 +1450,13 @@ class SpeechPipeline:# docs/plans/voice-phrase-mismatch-2026-05-26/README.md and the# ``suppress_preamble_after_interrupt_ms`` knob on AckBrainConfig.self._last_interrupt_announcement_ts: float | None = None+ # 2026-07-06 interim-ack redesign: (text, monotonic) of the last SPOKEN+ # preamble/progress announcement. ``_on_announcement`` drops a new+ # preamble/progress line with identical wording inside the+ # ``preamble_dedup_window_s`` window — no emitter may repeat itself+ # verbatim in quick succession (forensic 2026-07-05: the identical+ # grounded ack spoke three times in one session).+ self._last_preamble_spoken: tuple[str, float] | None = None# AD-OE5/OE6: completion-class announcements that arrive while the user# holds the floor are parked here and flushed at the next turn-boundary# (when the turn-state returns to LISTENING/IDLE) instead of barging@@ -2797,6 +2804,39 @@ class SpeechPipeline:event.text[:80],)return+ # Usefulness gate (2026-07-06 interim-ack redesign): the grounded+ # router ack publishes the instant a tool is SELECTED — too early to+ # know whether the bridge is even needed. When the voice turn is+ # currently PROCESSING, hold the ack for the commit grace and only+ # speak it if the brain is STILL busy afterwards (same AD-OE5 helper+ # the Flash-Brain streaming path uses); a turn that answers within+ # the grace stays ack-free. Announcements arriving with no voice turn+ # in flight (chat path) keep legacy behavior.+ if (+ is_preamble+ and getattr(event, "source_layer", None) == "brain.router.ack"+ and getattr(self, "_turn_state", TurnTakingState.IDLE)+ is TurnTakingState.PROCESSING+ ):+ ack_cfg = (+ getattr(self._config, "ack_brain", None)+ if self._config is not None+ else None+ )+ commit_grace_ms = int(+ getattr(ack_cfg, "grounded_ack_commit_grace_ms", 900) or 0+ )+ if commit_grace_ms > 0 and not await self._await_ack_turn_commit(+ commit_grace_ms+ ):+ log.info(+ "Grounded ack dropped — turn left PROCESSING during the "+ "%d ms commit grace (state=%s): %r",+ commit_grace_ms,+ getattr(self._turn_state, "name", self._turn_state),+ event.text[:80],+ )+ returnif event.priority == "interrupt":# Arm the quiet window BEFORE TTS so a synchronous publish of a# preamble immediately afterwards sees the up-to-date timestamp.@@ -2832,6 +2872,36 @@ class SpeechPipeline:if not scrubbed.cleaned.strip():log.info("Announcement nach Filter leer — schweige.")return+ # Duplicate-wording safety net (2026-07-06 interim-ack redesign): no+ # emitter may speak the SAME preamble/progress line twice in quick+ # succession, regardless of source (grounded ack, Flash-Brain, skill) —+ # forensic 2026-07-05: one session spoke the identical grounded ack+ # three times. Only the ephemeral kinds are deduped;+ # completion/interrupt readbacks deliver owed answers and may repeat.+ if is_preamble or is_progress:+ dedup_cfg = (+ getattr(self._config, "ack_brain", None)+ if self._config is not None+ else None+ )+ dedup_window_s = float(+ getattr(dedup_cfg, "preamble_dedup_window_s", 180) or 0+ )+ spoken_text = scrubbed.cleaned.strip()+ last_spoken = getattr(self, "_last_preamble_spoken", None)+ if (+ dedup_window_s > 0+ and last_spoken is not None+ and last_spoken[0] == spoken_text+ and (time.monotonic() - last_spoken[1]) < dedup_window_s+ ):+ log.info(+ "Preamble dropped — identical wording spoken %.0fs ago: %r",+ time.monotonic() - last_spoken[1],+ event.text[:80],+ )+ return+ self._last_preamble_spoken = (spoken_text, time.monotonic())# We are now committed to actually speaking this announcement (past every# suppression / defer / empty guard). Record it as voice activity so the# idle-timeout branch in ``_active_session`` re-arms a fresh window: andiff --git a/tests/unit/setup/test_onboarding_fastpath.py b/tests/unit/setup/test_onboarding_fastpath.pynew file mode 100644index 0000000000..e62e80c69b--- /dev/null+++ b/tests/unit/setup/test_onboarding_fastpath.py@@ -0,0 +1,129 @@+"""The fast-boot onboarding handler: stdlib-only, same payload as the API."""+import json+from pathlib import Path++from jarvis.setup import onboarding_fastpath as fp+from jarvis.setup import state as st+++def _collector():+ sent: list[dict] = []++ async def send(msg: dict) -> None:+ sent.append(msg)++ return sent, send+++async def _receive_empty():+ return {"type": "http.request", "body": b"", "more_body": False}+++def _scope(method: str, path: str) -> dict:+ return {"type": "http", "method": method, "path": path}+++def _body_json(sent: list[dict]) -> dict:+ return json.loads(sent[1]["body"].decode("utf-8"))+++async def test_state_incomplete_on_fresh_install(tmp_path: Path) -> None:+ fp._STATE_PATH_OVERRIDE = tmp_path / "setup_state.json"+ try:+ sent, send = _collector()+ handled = await fp.handle(_scope("GET", "/api/onboarding/state"), _receive_empty, send)+ assert handled is True+ assert sent[0]["status"] == 200+ payload = _body_json(sent)+ assert payload["completed"] is False+ assert payload["steps"] # canonical step list present+ finally:+ fp._STATE_PATH_OVERRIDE = None+++async def test_state_completed_via_marker(tmp_path: Path) -> None:+ fp._STATE_PATH_OVERRIDE = tmp_path / "setup_state.json"+ (tmp_path / ".setup-complete").write_text("done\n", encoding="utf-8")+ try:+ sent, send = _collector()+ await fp.handle(_scope("GET", "/api/onboarding/state"), _receive_empty, send)+ assert _body_json(sent)["completed"] is True+ finally:+ fp._STATE_PATH_OVERRIDE = None+++async def test_accept_terms_persists(tmp_path: Path) -> None:+ fp._STATE_PATH_OVERRIDE = tmp_path / "setup_state.json"+ try:+ sent, send = _collector()+ handled = await fp.handle(+ _scope("POST", "/api/onboarding/accept-terms"), _receive_empty, send+ )+ assert handled is True and sent[0]["status"] == 200+ s = st.get_onboarding_state(tmp_path / "setup_state.json")+ assert s["terms_accepted_at"] is not None+ finally:+ fp._STATE_PATH_OVERRIDE = None+++async def test_complete_persists_and_next_state_is_completed(tmp_path: Path) -> None:+ fp._STATE_PATH_OVERRIDE = tmp_path / "setup_state.json"+ try:+ sent, send = _collector()+ await fp.handle(_scope("POST", "/api/onboarding/complete"), _receive_empty, send)+ sent2, send2 = _collector()+ await fp.handle(_scope("GET", "/api/onboarding/state"), _receive_empty, send2)+ assert _body_json(sent2)["completed"] is True+ finally:+ fp._STATE_PATH_OVERRIDE = None+++async def test_step_persists_progress(tmp_path: Path) -> None:+ fp._STATE_PATH_OVERRIDE = tmp_path / "setup_state.json"+ try:+ sent, send = _collector()++ body = json.dumps({"step": "language", "skipped": ["welcome"]}).encode("utf-8")++ async def receive() -> dict:+ return {"type": "http.request", "body": body, "more_body": False}++ await fp.handle(_scope("POST", "/api/onboarding/step"), receive, send)+ assert sent[0]["status"] == 200+ s = st.get_onboarding_state(tmp_path / "setup_state.json")+ assert s["current_step"] == "language"+ assert s["skipped_steps"] == ["welcome"]+ finally:+ fp._STATE_PATH_OVERRIDE = None+++async def test_non_onboarding_path_not_handled() -> None:+ sent, send = _collector()+ handled = await fp.handle(_scope("GET", "/api/health"), _receive_empty, send)+ assert handled is False and sent == []+++async def test_unknown_onboarding_subpath_is_404(tmp_path: Path) -> None:+ fp._STATE_PATH_OVERRIDE = tmp_path / "setup_state.json"+ try:+ sent, send = _collector()+ handled = await fp.handle(_scope("GET", "/api/onboarding/nope"), _receive_empty, send)+ assert handled is True and sent[0]["status"] == 404+ finally:+ fp._STATE_PATH_OVERRIDE = None+++def test_fastpath_module_is_import_light() -> None:+ # A fresh subprocess, so other tests' imports cannot pollute the verdict —+ # the fast path must never pull fastapi/pydantic/config (AP-26).+ import subprocess+ import sys++ code = (+ "import sys; import jarvis.setup.onboarding_fastpath; "+ "banned = [m for m in ('fastapi', 'pydantic', 'jarvis.core.config') "+ "if m in sys.modules]; "+ "sys.exit(1 if banned else 0)"+ )+ rc = subprocess.run([sys.executable, "-c", code]).returncode+ assert rc == 0