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-07 15:55)
Ruben Lütke352d83e89f00
diff --git a/jarvis/assets/__init__.py b/jarvis/assets/__init__.pyindex 1dd8ec224d..d970d5969d 100644--- a/jarvis/assets/__init__.py+++ b/jarvis/assets/__init__.py@@ -1,10 +1,10 @@"""Bundled binary assets shipped with the Jarvis package.Currently:-- ``wakeword/``: ONNX models for openWakeWord (hey_rhasspy_v0.1 bundled as the- neutral shipped default, hey_jarvis_v0.1 kept for users who type "Jarvis",- melspectrogram, embedding). Loaded via :func:`bundled_wakeword_models` from- the openWakeWord provider so first-boot stays offline.+- ``wakeword/``: the word-agnostic openWakeWord feature backbones+ (melspectrogram, embedding) that a user-trained custom wake model needs to+ load offline. NO named wake model ships (design 2026-07-07). Loaded via+ :func:`bundled_wakeword_models` from the openWakeWord provider.- ``vad/``: the Silero VAD ONNX model (MIT-licensed, ~2.2 MB) that powersend-of-speech detection (:mod:`jarvis.audio.vad`). Bundled so the core voiceloop closes a turn on a base install too: the ``silero-vad`` pip package (which@@ -26,7 +26,6 @@ from pathlib import Path_WAKEWORD_DIR = Path(__file__).resolve().parent / "wakeword"_WAKEWORD_FILES = {- "wakeword": "hey_rhasspy_v0.1.onnx","melspec": "melspectrogram.onnx","embedding": "embedding_model.onnx",}@@ -39,15 +38,15 @@ _APP_ICON_FILE = "jarvis.ico"def bundled_wakeword_models() -> dict[str, Path] | None:- """Return absolute paths to the bundled openWakeWord ONNX assets.+ """Return absolute paths to the bundled openWakeWord backbone assets.- Returns ``None`` when any of the three required files is missing (partial- checkout, slim install, or a forthcoming opt-in extras-only layout). The- caller (``openwakeword_provider``) then falls back to openWakeWord's- built-in keyword names + auto-download.+ Returns ``None`` when either required file is missing (partial checkout).+ The caller (``openwakeword_provider``) then hands a bare custom-model path+ to openWakeWord, which resolves backbones from its own package resources.+ No named wake model ships (design 2026-07-07).- Keys: ``wakeword`` (the hey_rhasspy_v0.1 detector — neutral shipped default),- ``melspec`` (preprocessing), ``embedding`` (shared backbone).+ Keys: ``melspec`` (preprocessing), ``embedding`` (shared backbone) — both+ word-agnostic; they carry no wake vocabulary of their own."""if not _WAKEWORD_DIR.is_dir():return Nonediff --git a/jarvis/plugins/wake/openwakeword_provider.py b/jarvis/plugins/wake/openwakeword_provider.pyindex dade4435c9..d62b455a87 100644--- a/jarvis/plugins/wake/openwakeword_provider.py+++ b/jarvis/plugins/wake/openwakeword_provider.py@@ -1,8 +1,9 @@-"""openWakeWord plugin — detects "Hey Jarvis" / "Jarvis" in the audio stream.+"""openWakeWord plugin — runs a user-trained wake model on the audio stream.-openWakeWord is a free, open-source wake-word system (MIT), uses the-ONNX runtime, and ships "hey_jarvis" as a built-in pretrained model —-zero API key needed.+openWakeWord is a free, open-source wake-word runtime (MIT) on top of the+ONNX runtime — zero API key needed. The product ships NO named wake model+(design 2026-07-07): this provider only ever loads an explicit ``model_path``+(the user's own trained custom .onnx); without one it is a logged no-op.Input format: 16 kHz mono int16 PCM, frame size must be 1280 samples (80 ms).We buffer mic chunks and split on the frame boundary.@@ -135,17 +136,17 @@ class WakeGainNormalizer:class OpenWakeWordProvider:"""Wake-word detector — structurally compatible with `WakeWordProvider`.- By default it listens for "hey_jarvis" — in my testing the pretrained- model reacts to both "Hey Jarvis" and "Jarvis" alone, as long as the- threshold is low enough (0.5 works).+ Runs whatever model ``model_path`` points at (a user-trained custom+ .onnx). Without a model it degrades to a logged no-op — it never loads+ or downloads a named built-in model (design 2026-07-07)."""name = "openwakeword"- supported_keywords = ("hey_jarvis",) # openWakeWord built-in model+ supported_keywords: tuple[str, ...] = () # no shipped model, no fixed vocabularydef __init__(self,- keywords: tuple[str, ...] = ("hey_jarvis",),+ keywords: tuple[str, ...] = (),# The FIRE bar. Defaults to the documented, data-driven# PRODUCTION_WAKE_THRESHOLD so omitting it gives the SAME behaviour the# desktop app wires explicitly — one consistent threshold, not a quieter@@ -161,11 +162,10 @@ class OpenWakeWordProvider:# the user speaks too quietly, or the model doesn't handle German# pronunciation well).score_log_threshold: float = 0.05,- # Explicit ONNX wake-model path. When set (custom-wake-word feature: a- # pretrained alexa/mycroft/rhasspy from the openWakeWord package, or a- # user-supplied custom .onnx) it overrides the bundled hey_jarvis model.- # The shared melspec/embedding backbones are still reused from the- # in-repo bundle so any model loads offline. None = bundled hey_jarvis.+ # Explicit ONNX wake-model path (the user's own trained custom .onnx).+ # The shared word-agnostic melspec/embedding backbones are reused from+ # the in-repo bundle so any model loads offline. None = no model —+ # the provider stays a logged no-op (never a named built-in model).model_path: str | None = None,# Volume-robust wake (root cause of "only triggers when shouted",# 2026-06-28): openWakeWord's score is amplitude-dependent, so on a quiet@@ -260,51 +260,39 @@ class OpenWakeWordProvider:def _model_kwargs(self) -> dict:"""Build the openWakeWord ``Model(...)`` kwargs.- Prefer the ONNX models bundled in-repo (``jarvis/assets/wakeword/``):- passing explicit local paths keeps the wake path offline on first boot- and avoids the package-cache auto-download. When the bundle is absent- (e.g. a partial checkout), fall back to built-in keyword names, which- triggers openWakeWord's own auto-download.+ The ONLY loadable model is an explicit ``model_path`` (the user's own+ trained custom .onnx). The word-agnostic melspec/embedding backbones+ bundled in-repo (``jarvis/assets/wakeword/``) are reused so that model+ loads offline. Returns ``None`` when no model is configured — the+ caller then disables this provider. Never fall back to openWakeWord+ built-in keyword names: that auto-downloads third-party brand models+ (design 2026-07-07)."""import jarvis.assets- bundled = jarvis.assets.bundled_wakeword_models()+ if not self._model_path:+ return None- # Custom-wake-word path: an explicit model overrides the bundled- # hey_jarvis wakeword, but the shared melspec/embedding backbones are- # reused from the bundle (they are model-agnostic) so any pretrained or- # custom model still loads offline. If the bundle is absent, hand the- # bare path to openWakeWord (it auto-resolves backbones from its own+ bundled = jarvis.assets.bundled_wakeword_models()+ kwargs: dict = {+ "wakeword_models": [self._model_path],+ "inference_framework": "onnx",+ }+ # If the backbone bundle is absent (partial checkout), hand the bare+ # path to openWakeWord (it auto-resolves backbones from its own# package resources).- if self._model_path:- kwargs: dict = {- "wakeword_models": [self._model_path],- "inference_framework": "onnx",- }- if bundled is not None:- kwargs["melspec_model_path"] = str(bundled["melspec"])- kwargs["embedding_model_path"] = str(bundled["embedding"])- return kwargs-if bundled is not None:- return {- "wakeword_models": [str(bundled["wakeword"])],- "melspec_model_path": str(bundled["melspec"]),- "embedding_model_path": str(bundled["embedding"]),- "inference_framework": "onnx",- }- return {- "wakeword_models": list(self._keywords),- "inference_framework": self._inference_framework,- }+ kwargs["melspec_model_path"] = str(bundled["melspec"])+ kwargs["embedding_model_path"] = str(bundled["embedding"])+ return kwargsdef _canonical_keyword(self, raw: str) -> str:"""Map a raw openWakeWord model key back to the configured keyword.- Loading the bundled ``hey_jarvis_v0.1.onnx`` makes openWakeWord report- the score under the file stem ``hey_jarvis_v0.1``. Downstream code and- ``supported_keywords`` use the canonical ``hey_jarvis``; normalise so a- bundled load and a built-in load are indistinguishable to consumers.+ Loading a model file like ``my_word_v0.1.onnx`` makes openWakeWord+ report the score under the file stem ``my_word_v0.1``. Downstream code+ uses the canonical configured keyword (``my_word``); normalise so the+ file-stem suffix never leaks to consumers."""for kw in self._keywords:if raw == kw or raw.startswith(f"{kw}_"):@@ -330,11 +318,19 @@ class OpenWakeWordProvider:exc,)return- # wakeword_models=[...] accepts either built-in names or paths to- # .onnx / .tflite files. We prefer the bundled local ONNX paths- # (see _model_kwargs) — no runtime download, offline-capable on- # first boot.- self._model = Model(**self._model_kwargs())+ kwargs = self._model_kwargs()+ if kwargs is None:+ # No model configured -> nothing to arm. The flag doubles as the+ # "disabled" latch so detect() stays a clean no-op (never load or+ # auto-download a named built-in model — design 2026-07-07).+ self._runtime_unavailable = True+ log.warning(+ "OpenWakeWord armed without a model — wake via this provider "+ "is disabled. Configure a custom wake model or use the "+ "generic vosk/whisper wake engines."+ )+ return+ self._model = Model(**kwargs)def _warmup_model(self) -> None:"""Run ONE throwaway inference so the first real wake frame is not cold.diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.pyindex 6604f775f5..87cc24e104 100644--- a/jarvis/speech/pipeline.py+++ b/jarvis/speech/pipeline.py@@ -911,7 +911,9 @@ class SpeechPipeline:# ``cfg.trigger.hotkey`` when ``cfg.trigger.push_to_talk`` is True.ptt_hotkeys: tuple[str, ...] = (),hangup_hotkeys: tuple[str, ...] = ("f1+f2",),- wake_keywords: tuple[str, ...] = ("hey_jarvis",),+ # Legacy keyword seed for the no-plan provider. Empty: no wake model+ # ships (design 2026-07-07); only a wake plan arms a real detector.+ wake_keywords: tuple[str, ...] = (),wake_threshold: float = 0.10,stt: FasterWhisperProvider | None = None,tts: GeminiFlashTTS | None = None,@@ -8215,7 +8217,7 @@ async def _main() -> None:if config.trigger.hotkey_hangup.strip()else ()),- wake_keywords=("hey_jarvis",),+ wake_keywords=(),wake_threshold=0.15,stt=stt,tts=tts,diff --git a/jarvis/speech/wake_verifier.py b/jarvis/speech/wake_verifier.pyindex ccd69cd5d2..3878dc5652 100644--- a/jarvis/speech/wake_verifier.py+++ b/jarvis/speech/wake_verifier.py@@ -1,16 +1,15 @@"""Post-detection prefix verifier for the OpenWakeWord wake path.-The neural ``hey_jarvis_v0.1`` model generalises onto bare "Jarvis" because-its features overlap with the full "Hey Jarvis" utterance. Pendulum-style+A neural wake model generalises onto near-misses of its phrase (historically:+a bare core word fired the full-phrase model — BUG-009). Pendulum-stylethreshold edits have been forbidden by ``tests/unit/speech/test_wake_threshold``since BUG-009 episode 5. The clean fix is a second-stage check: when OWWfires, transcribe the few seconds preceding the hit with the cloud STT that-the rest of the voice path already uses (Groq by default) and require a-strict "hey/hi/hallo + jarv" pattern in the transcript before activating.+the rest of the voice path already uses (Groq by default) and require the+configured phrase's matcher to confirm the transcript before activating.-The regex is the *same* pattern that the heavy ``RollingWhisperWake`` backstop-uses — see ``rolling_whisper_wake.DEFAULT_PATTERN``. We deliberately import-that constant instead of duplicating the literal, so the two wake paths can+The matcher is the *same* object the heavy ``RollingWhisperWake`` backstop+uses (the wake plan's compiled phrase matcher), so the two wake paths cannever drift apart (BUG-008 territory)."""from __future__ import annotationsdiff --git a/jarvis/speech/watchdog.py b/jarvis/speech/watchdog.pyindex dd5183390f..512d6b979f 100644--- a/jarvis/speech/watchdog.py+++ b/jarvis/speech/watchdog.py@@ -130,7 +130,7 @@ async def _main() -> None:if config.trigger.hotkey_hangup.strip()else ()),- wake_keywords=("hey_jarvis",),+ wake_keywords=(),# Single source of truth — see PRODUCTION_WAKE_THRESHOLD and the# data-driven reasoning in openwakeword_provider.py (BUG-009 episode 5,# 2026-05-24: the 0.06 over-correction made OWW fire on ambient speech).diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.pyindex 02c4647503..ac19a506d7 100644--- a/jarvis/ui/desktop_app.py+++ b/jarvis/ui/desktop_app.py@@ -2335,7 +2335,10 @@ class DesktopApp:# the constructor default (1500) always won and the Settings# slider could not change the boot value.vad_silence_ms=self.cfg.speech.vad_silence_ms,- wake_keywords=("hey_jarvis",),+ # No shipped wake model (design 2026-07-07): the wake plan is+ # the only source of a detector; the legacy keyword default+ # is empty.+ wake_keywords=(),# BUG-009 episode 5 (2026-05-24): the 0.06 over-correction from# episode 4 made OWW fire on the entire ambient band (idle# telemetry showed bare "Hallo"/room noise scoring 0.06-0.11 anddiff --git a/tests/unit/plugins/wake/test_openwakeword_bundled.py b/tests/unit/plugins/wake/test_openwakeword_bundled.pyindex 7fe3df421f..8777e68010 100644--- a/tests/unit/plugins/wake/test_openwakeword_bundled.py+++ b/tests/unit/plugins/wake/test_openwakeword_bundled.py@@ -1,7 +1,10 @@-"""OpenWakeWordProvider must prefer the bundled local ONNX models.+"""OpenWakeWordProvider only ever loads an explicit user-trained model.-This keeps the wake path offline-on-first-boot and free of any heavy local-Whisper dependency — openWakeWord alone is the lightweight local detector.+Design 2026-07-07: the product ships NO named wake model. Without a+``model_path`` the provider is a logged no-op; with one, the word-agnostic+melspec/embedding backbones bundled in-repo are reused so the user's model+loads offline. It must never fall back to openWakeWord built-in keyword+names — that auto-downloads third-party brand models."""from __future__ import annotations@@ -9,40 +12,58 @@ import jarvis.assetsfrom jarvis.plugins.wake.openwakeword_provider import OpenWakeWordProvider-def test_model_kwargs_uses_bundled_onnx_paths() -> None:+def test_no_model_path_means_no_model_and_no_upstream_download() -> None:+ provider = OpenWakeWordProvider() # no model_path+ assert provider._model_kwargs() is None # sentinel: nothing to load+++def test_ensure_model_without_a_model_is_a_logged_noop() -> None:provider = OpenWakeWordProvider()- kw = provider._model_kwargs()+ provider._ensure_model()+ assert provider._model is None+ assert provider._runtime_unavailable is True # detect() no-ops cleanly++def test_custom_model_reuses_wordless_backbones(tmp_path) -> None:+ onnx = tmp_path / "my_word.onnx"+ onnx.write_bytes(b"stub")+ provider = OpenWakeWordProvider(model_path=str(onnx))+ kw = provider._model_kwargs()assert kw["inference_framework"] == "onnx"- assert len(kw["wakeword_models"]) == 1- # Neutral shipped default is the bundled hey_rhasspy model (no branded/- # trademarked default wake word). See jarvis.assets.bundled_wakeword_models.- assert kw["wakeword_models"][0].endswith("hey_rhasspy_v0.1.onnx")+ assert kw["wakeword_models"] == [str(onnx)]assert kw["melspec_model_path"].endswith("melspectrogram.onnx")assert kw["embedding_model_path"].endswith("embedding_model.onnx")-def test_model_kwargs_falls_back_to_builtin_names(monkeypatch) -> None:- # Simulate the bundled models being absent → must fall back to built-in- # names (which triggers openWakeWord's package-cache auto-download).+def test_custom_model_without_backbone_bundle_hands_bare_path(+ tmp_path, monkeypatch+) -> None:+ # Partial checkout: the backbone bundle is absent -> hand the bare path to+ # openWakeWord (it resolves backbones from its own package resources).monkeypatch.setattr(jarvis.assets, "bundled_wakeword_models", lambda: None)- provider = OpenWakeWordProvider(keywords=("hey_jarvis",))+ onnx = tmp_path / "my_word.onnx"+ onnx.write_bytes(b"stub")+ provider = OpenWakeWordProvider(model_path=str(onnx))kw = provider._model_kwargs()-- assert kw["wakeword_models"] == ["hey_jarvis"]+ assert kw["wakeword_models"] == [str(onnx)]assert "melspec_model_path" not in kw+def test_bundled_assets_are_only_the_wordless_backbones() -> None:+ bundle = jarvis.assets.bundled_wakeword_models()+ assert bundle is not None+ assert sorted(bundle.keys()) == ["embedding", "melspec"]++def test_canonical_keyword_strips_version_suffix() -> None:- # The bundled ONNX file is "hey_jarvis_v0.1.onnx", so openWakeWord reports- # the score under "hey_jarvis_v0.1". We must report the canonical keyword- # so it stays consistent with supported_keywords / wake_keywords.- provider = OpenWakeWordProvider(keywords=("hey_jarvis",))- assert provider._canonical_keyword("hey_jarvis_v0.1") == "hey_jarvis"- assert provider._canonical_keyword("hey_jarvis") == "hey_jarvis"+ # A model file "my_word_v0.1.onnx" makes openWakeWord report the score+ # under "my_word_v0.1". We must report the canonical configured keyword.+ provider = OpenWakeWordProvider(keywords=("my_word",))+ assert provider._canonical_keyword("my_word_v0.1") == "my_word"+ assert provider._canonical_keyword("my_word") == "my_word"def test_canonical_keyword_passthrough_unknown() -> None:- provider = OpenWakeWordProvider(keywords=("hey_jarvis",))- assert provider._canonical_keyword("alexa_v0.1") == "alexa_v0.1"+ provider = OpenWakeWordProvider(keywords=("my_word",))+ assert provider._canonical_keyword("other_v0.1") == "other_v0.1"diff --git a/tests/unit/plugins/wake/test_openwakeword_configurable.py b/tests/unit/plugins/wake/test_openwakeword_configurable.pyindex 7cd5fc05c8..f5bc091702 100644--- a/tests/unit/plugins/wake/test_openwakeword_configurable.py+++ b/tests/unit/plugins/wake/test_openwakeword_configurable.py@@ -1,10 +1,9 @@-"""OpenWakeWordProvider can load a configurable model (pretrained or custom).+"""OpenWakeWordProvider loads a configurable user-trained model.-The custom-wake-word feature needs the provider to load any ONNX model — a-pretrained alexa/mycroft/rhasspy from the package, or a user-supplied custom-model — while reusing the bundled melspec/embedding backbones so the wake path-stays offline. The default (no model_path) must keep the bundled hey_jarvis-behaviour untouched.+The custom-wake-word feature needs the provider to load any ONNX model the+user supplies, while reusing the bundled word-agnostic melspec/embedding+backbones so the wake path stays offline. Without a model_path there is+nothing to load — the product ships no named model (design 2026-07-07)."""from __future__ import annotations@@ -12,8 +11,8 @@ from jarvis.plugins.wake.openwakeword_provider import OpenWakeWordProviderdef test_explicit_model_path_is_used_with_bundled_backbones() -> None:- fake = "/models/alexa_v0.1.onnx"- provider = OpenWakeWordProvider(keywords=("alexa",), model_path=fake)+ fake = "/models/my_word_v0.1.onnx"+ provider = OpenWakeWordProvider(keywords=("my_word",), model_path=fake)kw = provider._model_kwargs()assert kw["wakeword_models"] == [fake]@@ -24,13 +23,14 @@ def test_explicit_model_path_is_used_with_bundled_backbones() -> None:def test_explicit_model_path_canonicalises_keyword() -> None:- provider = OpenWakeWordProvider(keywords=("alexa",), model_path="/x/alexa_v0.1.onnx")- assert provider._canonical_keyword("alexa_v0.1") == "alexa"+ provider = OpenWakeWordProvider(+ keywords=("my_word",), model_path="/x/my_word_v0.1.onnx"+ )+ assert provider._canonical_keyword("my_word_v0.1") == "my_word"-def test_default_still_uses_bundled_neutral_model() -> None:- # Regression: the zero-arg construction path loads the neutral bundled- # default (hey_rhasspy — no branded/trademarked default wake word).+def test_default_has_no_model_to_load() -> None:+ # Design 2026-07-07: the zero-arg construction path has NOTHING to load —+ # no bundled model, no built-in names, no auto-download.provider = OpenWakeWordProvider()- kw = provider._model_kwargs()- assert kw["wakeword_models"][0].endswith("hey_rhasspy_v0.1.onnx")+ assert provider._model_kwargs() is Nonediff --git a/tests/unit/speech/test_pipeline_wake_plan.py b/tests/unit/speech/test_pipeline_wake_plan.pyindex ca8813e1be..fe658aeffe 100644--- a/tests/unit/speech/test_pipeline_wake_plan.py+++ b/tests/unit/speech/test_pipeline_wake_plan.py@@ -65,8 +65,10 @@ def _pipe(wake_plan: object | None) -> SpeechPipeline:def test_no_plan_keeps_matcher_none_legacy_behaviour() -> None:pipe = _pipe(None)assert pipe._wake_matcher is None- # Default OWW keyword unchanged.- assert pipe._wake._keywords == ("hey_jarvis",)+ # No shipped wake model: the legacy no-plan provider carries no keywords+ # and no model — it degrades to a logged no-op (design 2026-07-07).+ assert pipe._wake._keywords == ()+ assert pipe._wake._model_path is Nonedef test_plan_builds_oww_from_custom_model(tmp_path: Path) -> None: