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
fix(wake): require a name-sized sound before the shape gate confirms
Ruben Lütke13ffe456967d
diff --git a/jarvis/plugins/wake/vosk_kws_provider.py b/jarvis/plugins/wake/vosk_kws_provider.pyindex c26bbbaf4c..f4f7060a5b 100644--- a/jarvis/plugins/wake/vosk_kws_provider.py+++ b/jarvis/plugins/wake/vosk_kws_provider.py@@ -158,6 +158,27 @@ _MATCH_MIN_RMS = 0.006# genuine calls the corpus labels negative: "ey ruben", "hei ruben")._SHAPE_MAX_VOICED_S_PER_TOKEN = 0.65_SHAPE_MAX_OTHER_WORD_CONF = 0.98++# The shape bounds above describe a SHORT, ISOLATED utterance — which a bare+# interjection also is. Live false wake (2026-07-13 11:05, first hour after the+# shape gate shipped): "hey ho" confirmed for "Hey Ruben". The free ear had+# heard the prefix plus a 0.12 s grunt: the NAME was never spoken and the+# grammar had stretched a bare "hey" onto the phrase.+#+# Neither spelling nor sound-similarity can catch that — measured on the real+# captures, room speech scores HIGHER against "ruben" (`den genie ring` 0.50,+# `simple frage brauchen` 0.62) than genuine calls do (`hey room` 0.25,+# `hey ho` 0.25). Any similarity floor that rejects the false wake also rejects+# real ones. <!-- the AP-27 trap, one level down -->+#+# The word-agnostic question that DOES separate them: was anything NAME-SIZED+# uttered where the name belongs? Strip the known wake prefixes from what the+# free ear heard and measure the voiced duration of what REMAINS — the core+# body. It never asks how the name is spelled, only that a name was spoken.+# Real captures: genuine calls carry a 0.48 s median core body (p10 0.30 s);+# 9/159 carry none at all — that is exactly the false-wake class. A 0.20 s floor+# (a single syllable) drops those 9 and costs 1.2 points of recall.+_SHAPE_MIN_CORE_BODY_S = 0.20# No slack: the free ear may not hear MORE words at the span than the phrase# itself has. Allowing one extra token to absorb an ASR split ("Jarvis" -># "joe avis") measurably let compact room speech through (5 vs 3 false accepts@@ -304,6 +325,7 @@ def candidate_shape_ok(*,max_voiced_s_per_token: float = _SHAPE_MAX_VOICED_S_PER_TOKEN,max_other_word_conf: float = _SHAPE_MAX_OTHER_WORD_CONF,+ min_core_body_s: float = _SHAPE_MIN_CORE_BODY_S,) -> bool:"""Does the free ear's output AT the candidate span look like a wake call?@@ -327,6 +349,12 @@ def candidate_shape_ok(positive signal an out-of-vocabulary wake word leaves behind: the freedecoder does not know the word, so it guesses and its confidence drops.Ordinary speech ("engineering", "google") it recognises outright.+ 4. **A name was actually spoken.** Strip the known wake prefixes and the+ REMAINING voiced duration — the core body — must be at least a syllable.+ Without this, the three bounds above describe a bare interjection just+ as well as a wake call, and "hey ho" fires (live 2026-07-13). Note this+ still never reads the name's SPELLING: it only asks whether a+ name-sized sound exists where the name belongs.Empty input rejects: the grammar claimed the phrase where the free earheard no speech at all.@@ -343,7 +371,21 @@ def candidate_shape_ok(if voiced_s > max_voiced_s_per_token * n_tokens:return Falsetop_conf = max(float(w.get("conf", 0.0)) for w in local_words)- return top_conf <= max_other_word_conf+ if top_conf > max_other_word_conf:+ return False+ # The phrase's OWN prefix tokens are not evidence of the name — but a+ # phrase that IS nothing but prefixes ("Hey", "Hallo") has no core to+ # demand, so it must not be gated on one.+ known_prefixes = {sound_fold(p) for p in WAKE_PREFIXES}+ phrase_tokens = normalize_phrase_for_match(phrase)+ if all(sound_fold(t) in known_prefixes for t in phrase_tokens):+ return True+ core_body_s = sum(+ max(0.0, float(w.get("end", 0.0)) - float(w.get("start", 0.0)))+ for w in local_words+ if sound_fold(str(w.get("word", ""))) not in known_prefixes+ )+ return core_body_s >= min_core_body_sclass VoskKwsProvider:diff --git a/tests/unit/plugins/wake/test_vosk_wake_word_agnostic.py b/tests/unit/plugins/wake/test_vosk_wake_word_agnostic.pyindex bb60601106..d9e38f16c5 100644--- a/tests/unit/plugins/wake/test_vosk_wake_word_agnostic.py+++ b/tests/unit/plugins/wake/test_vosk_wake_word_agnostic.py@@ -103,6 +103,43 @@ def test_silence_can_never_pass_the_shape_gate() -> None:assert candidate_shape_ok([], "Hey Ruben") is False+# --- the name must actually have been SPOKEN (live false-wake class) --------+++def test_a_prefix_with_no_name_after_it_is_not_a_wake() -> None:+ """LIVE false wake (2026-07-13 11:05): 'hey ho' fired for 'Hey Ruben'.++ The free ear heard the prefix and then a 0.12 s grunt — the NAME was never+ spoken, so the grammar had stretched a bare interjection onto the phrase.+ Spelling and sound-similarity cannot catch this (measured: room speech+ scores HIGHER against "ruben" than genuine calls do). What does catch it,+ word-agnostically, is that nothing name-sized was uttered where the name+ belongs.+ """+ assert candidate_shape_ok(+ [_w("hey", 0.40, 0.62), _w("ho", 0.62, 0.74)], "Hey Ruben"+ ) is False+++def test_a_bare_prefix_is_not_a_wake() -> None:+ """The free ear heard only "hey" — there is no core at all."""+ assert candidate_shape_ok([_w("hey", 0.40, 0.65)], "Hey Ruben") is False+++def test_a_real_name_body_still_passes_however_it_is_spelled() -> None:+ """The genuine calls keep firing: a name-sized sound IS there."""+ assert candidate_shape_ok(+ [_w("hey", 0.40, 0.60), _w("room", 0.60, 1.03)], "Hey Ruben"+ ) is True+ assert candidate_shape_ok([_w("herum", 0.40, 1.02)], "Hey Ruben") is True+++def test_an_unprefixed_phrase_counts_its_whole_body_as_core() -> None:+ """"Computer" has no prefix to strip — the word itself is the core."""+ assert candidate_shape_ok([_w("kompott", 0.40, 0.95)], "Computer") is True+ assert candidate_shape_ok([_w("kom", 0.40, 0.48)], "Computer") is False++def test_the_bound_scales_with_the_configured_phrase() -> None:"""A three-token phrase legitimately takes longer than a one-token one."""three = [