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
feat(ack-brain): retire the speculative pre-thinking preamble by default
Ruben Lütkec3b0e6cdb759
diff --git a/jarvis/brain/ack_brain/config.py b/jarvis/brain/ack_brain/config.pyindex f562289925..47efa7d226 100644--- a/jarvis/brain/ack_brain/config.py+++ b/jarvis/brain/ack_brain/config.py@@ -91,7 +91,23 @@ class AckBrainConfig(BaseModel):# The Flash-Brain is on-by-default. The user opted into the# feature by enabling it in the spec; disabling it again is a# deliberate jarvis.toml edit, not the silent ground state.+ # NOTE: `enabled` is the SUBSYSTEM master. It keeps the LLM-composed+ # spawn announcement (`spawn_announcements`, grounded — speaks only+ # after a real worker spawn) wired even when the speculative+ # pre-thinking preamble below is off.enabled: bool = Field(default=True)+ # 2026-06-21: dedicated sub-switch for the speculative pre-thinking+ # PREAMBLE ("Ich schau gerade in Spotify nach …"), symmetric to+ # `spawn_announcements`. OFF by default. Forensic (data/sessions.db):+ # the preamble fired on every utterance with ZERO grounding in the+ # action the deep brain actually takes, reached first token at a+ # median 2.98 s (98 % slower than the 2 s suppress gate, so the gate+ # almost never fired), and was the ONLY spoken output on 22 % of+ # preamble turns ("says it is on it, then does nothing"). When False,+ # build_ack_brain() returns None and the pipeline's fire-and-forget+ # preamble task never spawns; the grounded spawn announcement is+ # unaffected. Set True to opt back into the speculative preamble.+ preamble_enabled: bool = Field(default=False)# "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/factory.py b/jarvis/brain/factory.pyindex 158156e63c..7571ce8769 100644--- a/jarvis/brain/factory.py+++ b/jarvis/brain/factory.py@@ -1416,7 +1416,10 @@ def build_ack_brain(jcfg: Any | None = None) -> Any:See docs/superpowers/specs/2026-05-11-pre-thinking-ack-flash-brain-design.md.Returns ``None`` when:- - ``[ack_brain].enabled = false`` in jarvis.toml (default)+ - ``[ack_brain].enabled = false`` in jarvis.toml (subsystem master off)+ - ``[ack_brain].preamble_enabled = false`` (the default since 2026-06-21 —+ the speculative preamble is retired; the grounded spawn announcer stays+ wired via ``build_spawn_announcer``)- the configured provider is missing from REGISTRY- construction of the provider or breaker raises@@ -1431,6 +1434,18 @@ def build_ack_brain(jcfg: Any | None = None) -> Any:if ack_cfg is None or not getattr(ack_cfg, "enabled", False):log.info("Flash-Brain: disabled in jarvis.toml — skipping wiring.")return None+ # The speculative pre-thinking preamble is gated by its own+ # sub-switch (default off, 2026-06-21). `enabled` stays the+ # subsystem master so the grounded spawn announcer keeps its LLM+ # path; only this blind preamble generator is retired here. With+ # no AckGenerator the pipeline's fire-and-forget preamble task+ # never spawns (pipeline.py guards on `_ack_brain is not None`).+ if not getattr(ack_cfg, "preamble_enabled", False):+ log.info(+ "Flash-Brain: pre-thinking preamble disabled "+ "([ack_brain].preamble_enabled=false) — spawn announcer unaffected."+ )+ return Nonefrom jarvis.brain.ack_brain import AckGenerator, CircuitBreakerdiff --git a/tests/unit/brain/test_ack_brain/conftest.py b/tests/unit/brain/test_ack_brain/conftest.pyindex 20ed69d0af..fd8a8d56eb 100644--- a/tests/unit/brain/test_ack_brain/conftest.py+++ b/tests/unit/brain/test_ack_brain/conftest.py@@ -116,8 +116,15 @@ def make_ack_config(circuit_breaker_threshold: int = 3,circuit_breaker_cooldown_s: int = 60,max_output_tokens: int = 40,+ preamble_enabled: bool = True,) -> AckBrainConfig:- """Build a Pydantic AckBrainConfig with sensible defaults for tests."""+ """Build a Pydantic AckBrainConfig with sensible defaults for tests.++ ``preamble_enabled`` defaults to True here (unlike the production default+ of False) because this helper exists to exercise the pre-thinking preamble+ generator; the production-default (preamble off) path is covered directly+ in test_preamble_gate.py.+ """providers = _ProvidersBundle(gemini=GeminiAckProviderConfig(model="gemini-3.1-flash", max_output_tokens=max_output_tokens@@ -140,6 +147,7 @@ def make_ack_config(circuit_breaker_threshold=circuit_breaker_threshold,circuit_breaker_cooldown_s=circuit_breaker_cooldown_s,providers=providers,+ preamble_enabled=preamble_enabled,)diff --git a/tests/unit/brain/test_ack_brain/test_preamble_gate.py b/tests/unit/brain/test_ack_brain/test_preamble_gate.pynew file mode 100644index 0000000000..6e469cb422--- /dev/null+++ b/tests/unit/brain/test_ack_brain/test_preamble_gate.py@@ -0,0 +1,48 @@+"""Regression guard: the blind pre-thinking preamble is OFF by default, while+the grounded spawn announcement stays fully wired.++Forensic 2026-06-21 (data/sessions.db): the AckGenerator preamble fired on+every utterance with zero grounding in the actual action, a median 2.98 s to+first token (98 % slower than the 2 s suppress gate), and remained the ONLY+spoken output on 22 % of preamble turns ("says it is on it, then does+nothing"). The fix retires the speculative preamble by default via the+dedicated ``[ack_brain].preamble_enabled`` sub-switch (symmetric to+``spawn_announcements``) WITHOUT touching the grounded+``SpawnAnnouncementComposer``, which only speaks after a real worker spawn and+knows what it dispatched.+"""+from __future__ import annotations++from types import SimpleNamespace++from jarvis.brain.ack_brain.config import AckBrainConfig+from jarvis.brain.factory import build_ack_brain, build_spawn_announcer+++def _jcfg(ack: AckBrainConfig, *, primary: str = "gemini") -> SimpleNamespace:+ return SimpleNamespace(ack_brain=ack, brain=SimpleNamespace(primary=primary))+++def test_preamble_disabled_by_default_no_ack_generator() -> None:+ """With production defaults the blind preamble generator is not built —+ build_ack_brain returns None, so the pipeline's fire-and-forget preamble+ task never spawns (pipeline.py guards on ``_ack_brain is not None``)."""+ cfg = AckBrainConfig(provider="gemini") # real production defaults+ assert build_ack_brain(_jcfg(cfg)) is None+++def test_spawn_announcer_stays_llm_wired_when_preamble_disabled() -> None:+ """Disabling the preamble must NOT degrade the grounded spawn+ announcement: with the default config the composer keeps its LLM provider+ (not the pool-only fallback)."""+ cfg = AckBrainConfig(provider="gemini") # preamble off, spawn on, enabled on+ composer = build_spawn_announcer(_jcfg(cfg))+ assert composer is not None+ assert composer._provider is not None # LLM path, not pool-only fallback+++def test_preamble_opt_in_builds_generator() -> None:+ """Explicit opt-in via [ack_brain].preamble_enabled re-enables the+ speculative preamble generator for users who want it back."""+ cfg = AckBrainConfig(provider="gemini", preamble_enabled=True)+ assert build_ack_brain(_jcfg(cfg)) is not None