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-01 13:37)

Ruben Lütke2a0c95e86d6f
diff --git a/jarvis/audio/wake_normalizer.py b/jarvis/audio/wake_normalizer.py
new file mode 100644
index 0000000000..15806b563a
--- /dev/null
+++ b/jarvis/audio/wake_normalizer.py
@@ -0,0 +1,128 @@
+"""Shared, level-independent input normalization for every wake path.
+
+Root cause of "the wake word only triggers when I shout": the microphone
+capture applies no normalization (``capture.pcm_bytes_to_np`` only scales
+int16 -> float), and each wake engine gated detection on ABSOLUTE amplitude with
+its own fixed thresholds and its own bolt-on gain stage that sat AFTER that
+gate. On a quiet mic (a laptop's built-in mic, a headset with low input gain) a
+normal-volume utterance never reached the level the detector expected, so the
+gate — not the wake pattern — decided detection, and only a shout crossed it.
+
+``AdaptiveWakeNormalizer`` is the one reusable AGC every wake path can share so
+absolute loudness is no longer the gate. Per processed frame:
+
+* it tracks the ambient noise floor with an EMA over *quiet* frames (the same
+ idea as :class:`jarvis.audio.mic_level.LevelNormalizer`), so on a quiet mic the
+ floor settles low and a genuinely quiet wake rises above it;
+* it AMPLIFIES ONLY toward a target peak — an already-loud wake is never turned
+ down, so the level band a downstream threshold was calibrated on never
+ regresses;
+* the gain is derived from a rolling peak over the last ``window_s`` of audio
+ (not a single frame) so it stays stable across a wake phrase and the
+ intra-phrase envelope the neural model relies on is preserved;
+* it is gated by the adaptive floor (times ``speech_margin``): flat digital
+ silence and steady sub-floor hiss — which never rise above their own tracked
+ floor — are returned UNCHANGED, so the AGC can never manufacture an ambient
+ false-fire band (the AGC-level analogue of the BUG-009 guard);
+* the gain is capped at ``max_gain_db`` so a near-silent floor can't be blown up
+ to full scale.
+
+Pure mechanism — no I/O, no model, no OS-specific code — so it behaves
+identically on Windows, Linux and macOS. ``reset()`` clears the rolling envelope
+so a stale loud burst cannot suppress the gain on the next quiet utterance.
+"""
+from __future__ import annotations
+
+from collections import deque
+
+import numpy as np
+
+__all__ = ["AdaptiveWakeNormalizer"]
+
+# openWakeWord's native frame is 1280 samples (80 ms). Used only to size the
+# rolling-peak window in frames from ``window_s``; any frame length may be
+# passed to ``process``.
+_DEFAULT_FRAME_SAMPLES = 1280
+_DEFAULT_SAMPLE_RATE = 16_000
+
+
+class AdaptiveWakeNormalizer:
+ """Amplify-only, adaptive-noise-floor, capped streaming AGC for wake audio."""
+
+ def __init__(
+ self,
+ target_peak_dbfs: float = -3.0,
+ max_gain_db: float = 30.0,
+ # Starting ambient-floor estimate. On a FRESH normalizer this doubles as
+ # the sub-floor guard: a frame below ``floor_start * speech_margin`` is
+ # treated as silence and left unchanged, so the first wake in a session
+ # cannot false-fire on idle hiss. It then adapts down on a quiet mic.
+ floor_start: float = 0.006,
+ # The floor never drops below this, so a dead-silent mic cannot drive the
+ # speech threshold to zero (which would treat any faint noise as speech).
+ floor_min: float = 0.002,
+ # A frame counts as speech when its rolling peak exceeds
+ # ``noise_floor * speech_margin``. 1.8 keeps a quiet wake (well above the
+ # settled ambient floor) in while rejecting hiss that merely equals it.
+ speech_margin: float = 1.8,
+ window_s: float = 1.5,
+ sample_rate: int = _DEFAULT_SAMPLE_RATE,
+ frame_samples: int = _DEFAULT_FRAME_SAMPLES,
+ ) -> None:
+ self._target_peak = float(10.0 ** (target_peak_dbfs / 20.0)) # -3 dBFS ~= 0.707
+ self._max_gain = float(10.0 ** (max_gain_db / 20.0))
+ self._floor_start = float(floor_start)
+ self._floor_min = float(floor_min)
+ self._margin = float(speech_margin)
+ frame_s = max(1, int(frame_samples)) / float(sample_rate)
+ self._window_frames = max(1, int(round(window_s / frame_s)))
+ self._recent_peaks: deque[float] = deque(maxlen=self._window_frames)
+ self._floor = self._floor_start
+ self._speech_present = False
+
+ # -- introspection (used by callers + tests) ---------------------------
+ @property
+ def speech_present(self) -> bool:
+ """Whether the last processed frame's rolling peak cleared the adaptive
+ speech threshold — a level-INDEPENDENT "is someone speaking" signal."""
+ return self._speech_present
+
+ @property
+ def noise_floor(self) -> float:
+ """The current adaptive ambient-floor estimate (for diagnostics/tests)."""
+ return self._floor
+
+ def reset(self) -> None:
+ """Forget the rolling envelope and re-seed the floor (call on stop/re-arm)."""
+ self._recent_peaks.clear()
+ self._floor = self._floor_start
+ self._speech_present = False
+
+ # -- the mechanism -----------------------------------------------------
+ def process(self, frame: np.ndarray) -> np.ndarray:
+ """Return ``frame`` (int16) amplified toward the target peak, or unchanged
+ when below the adaptive floor / already loud enough. Never mutates input."""
+ f32 = np.asarray(frame, dtype=np.float32) / 32768.0
+ frame_peak = float(np.max(np.abs(f32))) if f32.size else 0.0
+
+ # Adaptive noise floor: EMA only on quiet frames, so it tracks the ambient
+ # baseline between words and does not creep up on the speech itself.
+ if frame_peak < self._floor * 1.5:
+ self._floor = 0.95 * self._floor + 0.05 * frame_peak
+ if self._floor < self._floor_min:
+ self._floor = self._floor_min
+
+ self._recent_peaks.append(frame_peak)
+ rolling_peak = max(self._recent_peaks) if self._recent_peaks else frame_peak
+
+ speech_threshold = self._floor * self._margin
+ if rolling_peak < speech_threshold:
+ self._speech_present = False
+ return np.asarray(frame, dtype=np.int16) # silence / sub-floor hiss
+
+ self._speech_present = True
+ gain = min(self._target_peak / rolling_peak, self._max_gain)
+ if gain <= 1.0:
+ return np.asarray(frame, dtype=np.int16) # already loud — amplify-only
+ boosted = np.clip(f32 * gain, -1.0, 1.0)
+ return (boosted * 32767.0).astype(np.int16)
diff --git a/jarvis/brain/output_filter.py b/jarvis/brain/output_filter.py
index 5eba92da91..447164cdd9 100644
--- a/jarvis/brain/output_filter.py
+++ b/jarvis/brain/output_filter.py
@@ -656,6 +656,18 @@ def scrub_for_voice(
actions.append("removed_em_dash")
out = new
+ # 7d. Numbers -> words. TTS reads a bare digit inconsistently across engines
+ # and locales, and the persona mandates spelling every number out as
+ # words. A flash-tier model still emits digits despite that rule, so this
+ # is the deterministic backstop (num2words, rule-based — NO LLM, AP-11
+ # safe). Locale-aware; a transparent no-op when num2words is missing.
+ from jarvis.voice.number_speller import spell_out_numbers
+
+ new = spell_out_numbers(out, language=language)
+ if new != out:
+ actions.append("spelled_out_numbers")
+ out = new
+
# 8. Whitespace normalisieren
out = re.sub(r"\s{2,}", " ", out).strip()
out = re.sub(r"\s+([,.!?;:])", r"\1", out)
diff --git a/jarvis/voice/number_speller.py b/jarvis/voice/number_speller.py
new file mode 100644
index 0000000000..4b3544554a
--- /dev/null
+++ b/jarvis/voice/number_speller.py
@@ -0,0 +1,144 @@
+"""Deterministic number-to-words normalization for the voice path.
+
+Text-to-speech reads a bare digit inconsistently across engines and locales, so
+the voice persona mandates spelling every number out as words ("drei Komma acht
+Zentimeter", never "3,8 cm"). This module is the deterministic backstop that
+guarantees it regardless of which brain/provider produced the text — the
+open-source doctrine forbids relying on one model obeying a prose rule, and a
+flash-tier model in particular still emits digits despite the instruction.
+
+Rule-based via ``num2words`` — no LLM call, microsecond-fast, safe on the AP-11
+hot path. It never raises, and when ``num2words`` is unavailable (a minimal
+install that did not pull the dependency) it is a transparent no-op so text
+passes through unchanged instead of crashing the voice path.
+
+Locale-aware separators: German/Spanish use a comma decimal and dot thousands
+("3,8" = three-point-eight, "1.000" = one thousand); English is the reverse.
+Times ("20:30") are spoken as "zwanzig Uhr dreißig" before the general pass so
+the colon parts are not spelled as two bare integers.
+"""
+from __future__ import annotations
+
+import logging
+import re
+
+log = logging.getLogger(__name__)
+
+try: # optional dependency — a minimal install may lack it (open-source doctrine)
+ from num2words import num2words as _num2words
+
+ _HAVE_NUM2WORDS = True
+except Exception: # noqa: BLE001 — any import failure degrades to a no-op
+ _HAVE_NUM2WORDS = False
+
+# Supported locales. Anything else falls through unchanged (honesty over a wrong
+# guess — never spell a French number with German words).
+_SUPPORTED = ("de", "en", "es")
+
+# (decimal separator, thousands separator) per locale.
+_SEPARATORS: dict[str, tuple[str, str]] = {
+ "de": (",", "."),
+ "es": (",", "."),
+ "en": (".", ","),
+}
+
+# Time connector between hour and minute words, per locale.
+_TIME_JOIN: dict[str, str] = {"de": " Uhr ", "en": " ", "es": " y "}
+_TIME_JOIN_OCLOCK: dict[str, str] = {"de": " Uhr", "en": " o'clock", "es": " en punto"}
+
+# A clock time, optionally followed by a German "Uhr" that we consume so the
+# spoken form is not doubled ("09:17 Uhr" -> "neun Uhr siebzehn", not
+# "neun Uhr siebzehn Uhr").
+_TIME_RE = re.compile(r"\b(\d{1,2}):(\d{2})\b(\s*Uhr\b)?")
+# A number token: a digit, or a run of digits possibly carrying group/decimal
+# separators, always ending on a digit so a trailing "." / "," stays as
+# punctuation. Letter-adjacent digits are skipped (a lookbehind/lookahead for a
+# Unicode letter) so an identifier like "abc123def456", "cp1252", or "utf8" is
+# left intact — only a free-standing number is spoken.
+_LETTER = r"[^\W\d_]"
+_NUMBER_RE = re.compile(
+ rf"(?<!{_LETTER})(?:\d[\d.,]*\d|\d)(?!{_LETTER})"
+)
+
+
+def _norm_lang(language: str | None) -> str:
+ if not language:
+ return "de"
+ low = language.lower()
+ if low.startswith("en"):
+ return "en"
+ if low.startswith("es"):
+ return "es"
+ if low.startswith("de"):
+ return "de"
+ return low # unknown → not in _SUPPORTED → passthrough
+
+
+def _spell_value(value: int | float, lang: str) -> str | None:
+ try:
+ return _num2words(value, lang=lang)
+ except Exception: # noqa: BLE001 — never let a spelling failure raise
+ return None
+
+
+def _spell_number_token(token: str, lang: str) -> str | None:
+ decimal_sep, thousands_sep = _SEPARATORS[lang]
+ cleaned = token.replace(thousands_sep, "")
+ if decimal_sep in cleaned:
+ int_part, _, frac_part = cleaned.partition(decimal_sep)
+ if not frac_part.isdigit():
+ return None
+ try:
+ value: float | int = float(f"{int_part or '0'}.{frac_part}")
+ except ValueError:
+ return None
+ return _spell_value(value, lang)
+ if not cleaned.isdigit():
+ return None
+ # Guard pathological runs (e.g. a 60-digit id) — leave them for the reader.
+ if len(cleaned) > 18:
+ return None
+ return _spell_value(int(cleaned), lang)
+
+
+def _spell_time(hour: str, minute: str, lang: str) -> str | None:
+ h_word = _spell_value(int(hour), lang)
+ if h_word is None:
+ return None
+ if int(minute) == 0:
+ return f"{h_word}{_TIME_JOIN_OCLOCK[lang]}"
+ m_word = _spell_value(int(minute), lang)
+ if m_word is None:
+ return None
+ return f"{h_word}{_TIME_JOIN[lang]}{m_word}"
+
+
+def spell_out_numbers(text: str, language: str = "de") -> str:
+ """Spell every digit run in ``text`` out as words for the given locale.
+
+ Never raises. A no-op when ``num2words`` is missing, the language is
+ unsupported, or the text has no digits. Individual tokens that cannot be
+ parsed are left untouched rather than dropped.
+ """
+ if not _HAVE_NUM2WORDS or not text:
+ return text
+ lang = _norm_lang(language)
+ if lang not in _SUPPORTED:
+ return text
+ if not any(ch.isdigit() for ch in text):
+ return text
+
+ def _time_sub(match: re.Match[str]) -> str:
+ spelled = _spell_time(match.group(1), match.group(2), lang)
+ return spelled if spelled is not None else match.group(0)
+
+ out = _TIME_RE.sub(_time_sub, text)
+
+ def _num_sub(match: re.Match[str]) -> str:
+ spelled = _spell_number_token(match.group(0), lang)
+ return spelled if spelled is not None else match.group(0)
+
+ return _NUMBER_RE.sub(_num_sub, out)
+
+
+__all__ = ["spell_out_numbers"]
diff --git a/pyproject.toml b/pyproject.toml
index b8f213a3a3..2c32882d5b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -73,6 +73,7 @@ dependencies = [
# Server-side markdown→HTML for the Outputs "view in browser" action
# (pure-Python; the /view route degrades to <pre> if it is ever absent).
"markdown>=3.5",
+ "num2words>=0.5.13", # deterministic number->words for the voice path (spoken-safe)
"jinja2>=3.1",
"croniter>=6.0",
"gitpython>=3.1",
diff --git a/tests/unit/audio/test_wake_normalizer.py b/tests/unit/audio/test_wake_normalizer.py
new file mode 100644
index 0000000000..79a7e8cdc2
--- /dev/null
+++ b/tests/unit/audio/test_wake_normalizer.py
@@ -0,0 +1,141 @@
+"""Unit contract for the shared, level-independent wake input normalizer.
+
+Root cause of "the wake word only triggers when I shout" (mission 2026-06-30):
+the microphone capture applies NO normalization, and each wake engine gated
+detection on ABSOLUTE amplitude with its own fixed thresholds. On a quiet mic (a
+laptop's built-in mic, a low input-gain headset) a normal-volume utterance never
+reached the level the detector expected, so only a shout crossed the bar.
+
+``AdaptiveWakeNormalizer`` is the single, reusable input AGC every wake path can
+share. It removes absolute loudness as the gate: it tracks the ambient noise
+floor (EMA over quiet frames, the same idea as ``mic_level.LevelNormalizer``) and
+amplifies a signal that rises a margin ABOVE that floor toward a target peak,
+capped and amplify-only. A quiet-but-real utterance is lifted into the band the
+detector expects; flat digital silence and steady sub-floor hiss (which never
+rise above their own tracked floor) are left unamplified, so the AGC can never
+manufacture an ambient false-fire band. Pure numpy — no I/O, no model, no
+OS-specific code — so it behaves identically on Windows, Linux and macOS.
+"""
+from __future__ import annotations
+
+import numpy as np
+
+from jarvis.audio.wake_normalizer import AdaptiveWakeNormalizer
+
+
+def _sine_int16(peak: float, n: int = 1280) -> np.ndarray:
+ """A 440 Hz sine of ``n`` int16 samples whose float peak is ``peak`` (0..1)."""
+ t = np.arange(n, dtype=np.float32)
+ wave = np.sin(2.0 * np.pi * 440.0 * t / 16_000.0) * float(peak)
+ return (np.clip(wave, -1.0, 1.0) * 32767.0).astype(np.int16)
+
+
+def _float_peak(frame: np.ndarray) -> float:
+ return float(np.max(np.abs(frame.astype(np.float32) / 32768.0)))
+
+
+# ---------------------------------------------------------------------------
+# Level independence — the whole point.
+# ---------------------------------------------------------------------------
+
+def test_same_utterance_at_three_levels_normalizes_into_a_common_band() -> None:
+ """A loud, a normal, and a quiet copy of the same utterance all leave the
+ normalizer at a comparable level — absolute loudness is no longer the gate."""
+ outs = []
+ for peak in (0.6, 0.06, 0.015):
+ norm = AdaptiveWakeNormalizer()
+ out = norm.process(_sine_int16(peak))
+ outs.append(_float_peak(out))
+ for peak_in, peak_out in zip((0.6, 0.06, 0.015), outs, strict=True):
+ assert 0.4 <= peak_out <= 0.98, (
+ f"input peak {peak_in} normalized to {peak_out:.3f}, outside the band"
+ )
+ # And the three normalized levels are close to each other (level-independent).
+ assert max(outs) - min(outs) <= 0.35
+
+
+def test_flat_digital_silence_is_returned_unchanged() -> None:
+ norm = AdaptiveWakeNormalizer()
+ frame = np.zeros(1280, dtype=np.int16)
+ out = norm.process(frame)
+ assert np.array_equal(out, frame)
+
+
+def test_steady_subfloor_hiss_is_not_lifted_into_the_speech_band() -> None:
+ # A fresh normalizer must treat a sub-floor frame (idle hiss) as silence and
+ # leave it quiet, so the AGC cannot manufacture an ambient false-fire band.
+ norm = AdaptiveWakeNormalizer()
+ out = norm.process(_sine_int16(peak=0.004))
+ assert _float_peak(out) < 0.05
+
+
+def test_loud_input_is_never_attenuated() -> None:
+ norm = AdaptiveWakeNormalizer()
+ out = norm.process(_sine_int16(peak=0.8))
+ assert _float_peak(out) >= 0.79
+
+
+def test_gain_is_capped() -> None:
+ # cap = 6 dB == 2x: a 0.05-peak frame reaches ~0.10, NOT the -3 dBFS target a
+ # >10x uncapped gain would produce.
+ norm = AdaptiveWakeNormalizer(max_gain_db=6.0)
+ out = norm.process(_sine_int16(peak=0.05))
+ assert 0.05 * 2 * 0.9 <= _float_peak(out) <= 0.05 * 2 * 1.05
+
+
+# ---------------------------------------------------------------------------
+# Adaptive floor — the quiet-mic unlock and the noisy-room guard.
+# ---------------------------------------------------------------------------
+
+def test_adaptive_floor_unlocks_a_very_quiet_wake_on_a_quiet_mic() -> None:
+ """On a quiet mic the ambient floor settles low, so a genuinely quiet wake
+ (peak 0.008 — below the legacy fixed 0.02 floor that silently dropped it)
+ rises above the adapted floor and IS amplified. This is the core fix."""
+ norm = AdaptiveWakeNormalizer()
+ # Simulate a quiet room: sustained near-silent hiss lets the floor adapt down.
+ for _ in range(60):
+ norm.process(_sine_int16(peak=0.0015))
+ out = norm.process(_sine_int16(peak=0.008))
+ assert _float_peak(out) > 0.008 * 3.0, (
+ f"a quiet wake on a quiet mic must be amplified, got {_float_peak(out):.3f}"
+ )
+ assert norm.speech_present
+
+
+def test_fresh_normalizer_keeps_the_legacy_subfloor_guard() -> None:
+ # Before any adaptation a 0.008 frame is below the start floor's speech
+ # threshold and must NOT be amplified (mirrors the OWW subfloor guard so the
+ # first wake in a session cannot false-fire on idle hiss).
+ norm = AdaptiveWakeNormalizer()
+ out = norm.process(_sine_int16(peak=0.008))
+ assert _float_peak(out) < 0.05
+ assert not norm.speech_present
+
+
+def test_speech_present_is_level_independent() -> None:
+ norm = AdaptiveWakeNormalizer()
+ norm.process(_sine_int16(peak=0.2))
+ assert norm.speech_present
+ norm.reset()
+ norm.process(np.zeros(1280, dtype=np.int16))
+ assert not norm.speech_present
+
+
+def test_reset_clears_the_envelope_state() -> None:
+ norm = AdaptiveWakeNormalizer()
+ norm.process(_sine_int16(peak=0.8)) # arm a high rolling peak
+ norm.reset()
+ out = norm.process(_sine_int16(peak=0.06))
+ assert _float_peak(out) > 0.06 * 1.5
+
+
+def test_pure_numpy_no_side_channels() -> None:
+ # A defensive smoke test: process returns an int16 array of the same length
+ # and never mutates its input (the caller reuses the buffer).
+ norm = AdaptiveWakeNormalizer()
+ frame = _sine_int16(peak=0.05)
+ original = frame.copy()
+ out = norm.process(frame)
+ assert out.dtype == np.int16
+ assert out.shape == frame.shape
+ assert np.array_equal(frame, original), "process must not mutate its input"
diff --git a/tests/unit/plugins/wake/test_openwakeword_quiet_mic.py b/tests/unit/plugins/wake/test_openwakeword_quiet_mic.py
new file mode 100644
index 0000000000..0aa57c3ff6
--- /dev/null
+++ b/tests/unit/plugins/wake/test_openwakeword_quiet_mic.py
@@ -0,0 +1,98 @@
+"""The OWW input AGC uses an ADAPTIVE floor + a real warm-up.
+
+Two mission-2026-06-30 defects on the default openWakeWord path:
+
+1. "Only triggers when I shout" — even after the 2026-06-28 gain fix, the AGC's
+ noise floor was a FIXED 0.02. A genuinely quiet wake whose peak sat between
+ the old floor (0.02) and true silence got ZERO amplification and under-scored
+ the pinned 0.15 threshold. The floor must ADAPT to the mic's real ambient
+ level so a quiet mic is no longer deaf.
+2. Cold-start latency — ``start()`` loaded the ONNX model but ran no inference,
+ so the FIRST real "Hey Jarvis" frame paid the onnxruntime graph-init cost.
+ ``start()`` must prime the model with one throwaway inference.
+
+The pinned 0.15 threshold and the amplify-only + sub-floor guards are unchanged,
+so this lifts quiet wakes without widening the ambient false-fire band.
+"""
+from __future__ import annotations
+
+import numpy as np
+
+from jarvis.plugins.wake.openwakeword_provider import (
+ OWW_FRAME_SAMPLES,
+ OpenWakeWordProvider,
+ WakeGainNormalizer,
+)
+
+
+def _sine_int16(peak: float, n: int = OWW_FRAME_SAMPLES) -> np.ndarray:
+ t = np.arange(n, dtype=np.float32)
+ wave = np.sin(2.0 * np.pi * 440.0 * t / 16_000.0) * float(peak)
+ return (np.clip(wave, -1.0, 1.0) * 32767.0).astype(np.int16)
+
+
+def _float_peak(frame: np.ndarray) -> float:
+ return float(np.max(np.abs(frame.astype(np.float32) / 32768.0)))
+
+
+# ---------------------------------------------------------------------------
+# Adaptive floor — a quiet wake below the legacy 0.02 fixed floor is amplified.
+# ---------------------------------------------------------------------------
+
+def test_quiet_wake_below_legacy_fixed_floor_is_amplified() -> None:
+ # peak 0.012 sat BELOW the old fixed 0.02 noise floor -> the legacy AGC left
+ # it unchanged and it under-scored the 0.15 threshold ("only when shouting").
+ # With the adaptive floor (start ~0.006) it is above the speech threshold and
+ # IS amplified toward the target.
+ norm = WakeGainNormalizer()
+ out = norm.process(_sine_int16(peak=0.012))
+ assert _float_peak(out) > 0.012 * 2.0, (
+ f"a quiet wake must be lifted, got {_float_peak(out):.3f}"
+ )
+
+
+def test_adaptive_floor_settles_down_on_a_quiet_mic() -> None:
+ # After sustained near-silent ambient the floor adapts DOWN, so an even
+ # quieter wake (0.008) that a fresh normalizer would gate now gets amplified.
+ norm = WakeGainNormalizer()
+ for _ in range(60):
+ norm.process(_sine_int16(peak=0.0015))
+ out = norm.process(_sine_int16(peak=0.008))
+ assert _float_peak(out) > 0.008 * 2.0
+
+
+# ---------------------------------------------------------------------------
+# Warm-up — start() primes the model so the first real frame is not cold.
+# ---------------------------------------------------------------------------
+
+class _WarmupSpyModel:
+ """Records predict calls so we can prove start() ran a warm inference."""
+
+ def __init__(self) -> None:
+ self.predict_calls = 0
+
+ def predict(self, _frame: object) -> dict[str, float]:
+ self.predict_calls += 1
+ return {"hey_jarvis": 0.0}
+
+
+async def test_start_primes_the_model_with_a_warmup_inference() -> None:
+ prov = OpenWakeWordProvider()
+ spy = _WarmupSpyModel()
+ prov._model = spy # noqa: SLF001 — inject a fake so start() skips the real load
+ await prov.start()
+ assert spy.predict_calls >= 1, (
+ "start() must run one throwaway inference so the first real wake frame "
+ "does not pay the onnxruntime cold-start"
+ )
+
+
+async def test_start_warmup_never_raises_on_a_broken_model() -> None:
+ class _BoomModel:
+ def predict(self, _frame: object) -> dict[str, float]:
+ raise RuntimeError("cold graph blew up")
+
+ prov = OpenWakeWordProvider()
+ prov._model = _BoomModel() # noqa: SLF001
+ # A warm-up failure must degrade to a no-op, never break voice boot.
+ await prov.start()
diff --git a/tests/unit/speech/test_wake_latency.py b/tests/unit/speech/test_wake_latency.py
new file mode 100644
index 0000000000..4582c7df56
--- /dev/null
+++ b/tests/unit/speech/test_wake_latency.py
@@ -0,0 +1,26 @@
+"""Latency contract for the wake path (mission 2026-06-30, "~0.5 s delay").
+
+The Jarvis-Bar is pre-created and merely shown on wake, so the reveal itself is
+fast. The controllable latency lives BEFORE the reveal:
+
+* the custom-phrase (``stt_match`` = RollingWhisperWake) detector polls on a
+ wall-clock cadence, so a slow poll interval directly delays the reaction to a
+ spoken wake. It must be snappy;
+* the openWakeWord model must be warm (covered by
+ ``test_openwakeword_quiet_mic``) so the first frame is not cold.
+
+This file pins the poll cadence so a future "save GPU" edit cannot silently
+regress the custom-wake reaction time back toward half a second.
+"""
+from __future__ import annotations
+
+from jarvis.plugins.stt.fwhisper import FasterWhisperProvider
+from jarvis.speech.rolling_whisper_wake import RollingWhisperWake
+
+
+def test_rolling_whisper_poll_interval_is_snappy() -> None:
+ wake = RollingWhisperWake(FasterWhisperProvider())
+ assert wake._poll_interval_s <= 0.2, ( # noqa: SLF001
+ "the custom-wake detector must poll at least every 200 ms so a spoken "
+ "wake reaches the bar quickly"
+ )
diff --git a/tests/unit/voice/test_number_speller.py b/tests/unit/voice/test_number_speller.py
new file mode 100644
index 0000000000..35b9549203
--- /dev/null
+++ b/tests/unit/voice/test_number_speller.py
@@ -0,0 +1,94 @@
+"""Unit tests for the voice number speller (deterministic digit->words)."""
+from __future__ import annotations
+
+import importlib.util
+
+import pytest
+
+from jarvis.voice.number_speller import spell_out_numbers
+
+_HAVE_NUM2WORDS = importlib.util.find_spec("num2words") is not None
+requires_num2words = pytest.mark.skipif(
+ not _HAVE_NUM2WORDS, reason="num2words not installed"
+)
+
+
+@requires_num2words
+def test_no_bare_digit_survives_german():
+ out = spell_out_numbers("Der Mond entfernt sich 3,8 Zentimeter pro Jahr.", "de")
+ assert not any(c.isdigit() for c in out)
+ assert "drei Komma acht" in out
+
+
+@requires_num2words
+def test_integer_and_large_number_german():
+ out = spell_out_numbers("Vor 4 Milliarden Jahren, im Jahr 2026.", "de")
+ assert not any(c.isdigit() for c in out)
+ assert "vier Milliarden" in out
+ assert "zweitausendsechsundzwanzig" in out
+
+
+@requires_num2words
+def test_thousands_separator_german_is_one_number():
+ # German dot is a thousands separator, not a decimal point.
+ out = spell_out_numbers("Das kostet 1.000 Euro.", "de")
+ assert not any(c.isdigit() for c in out)
+ assert "eintausend" in out
+
+
+@requires_num2words
+def test_decimal_english_uses_point():
+ out = spell_out_numbers("It moves 3.8 centimeters.", "en")
+ assert not any(c.isdigit() for c in out)
+ assert "three point eight" in out
+
+
+@requires_num2words
+def test_time_german():
+ out = spell_out_numbers("Wir treffen uns um 20:30.", "de")
+ assert not any(c.isdigit() for c in out)
+ assert "zwanzig Uhr dreißig" in out
+
+
+@requires_num2words
+def test_full_hour_german():
+ out = spell_out_numbers("Es ist 15:00.", "de")
+ assert not any(c.isdigit() for c in out)
+ assert "fünfzehn Uhr" in out
+
+
+@requires_num2words
+def test_spanish_integer():
+ out = spell_out_numbers("Hay 4 proyectos.", "es")
+ assert not any(c.isdigit() for c in out)
+ assert "cuatro" in out
+
+
+def test_no_digits_passthrough_unchanged():
+ text = "Ein ganz normaler Satz ohne Zahlen."
+ assert spell_out_numbers(text, "de") == text
+
+
+def test_empty_and_none_safe():
+ assert spell_out_numbers("", "de") == ""
+
+
+def test_unsupported_language_passthrough():
+ # A French sentence must not be spelled with German words — pass through.
+ text = "Il y a 4 projets."
+ assert spell_out_numbers(text, "fr") == text
+
+
+@requires_num2words
+def test_never_raises_on_weird_input():
+ # Long digit run + trailing separators must not crash; returns a string.
+ weird = "id 123456789012345678901234567890, ratio 5,, code 7."
+ out = spell_out_numbers(weird, "de")
+ assert isinstance(out, str)
+
+
+@requires_num2words
+def test_trailing_punctuation_preserved():
+ out = spell_out_numbers("Es sind 3.", "de")
+ assert out.endswith(".")
+ assert "drei" in out