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.

fix(voice): scrubbing the agent compound leaves a sentence, not a hole

rubenluetke10-beepec09d9ec516d
diff --git a/jarvis/brain/output_filter.py b/jarvis/brain/output_filter.py
index 0fae80bea5..f4251a8840 100644
--- a/jarvis/brain/output_filter.py
+++ b/jarvis/brain/output_filter.py
@@ -457,6 +457,35 @@ JARGON_COMPOUND_RE = re.compile(
re.IGNORECASE,
)
+# 2026-08-24: the compound is REPLACED by the user-facing brand, not deleted.
+# Live voice session 10:24: "…a complete overview using a Sub-Agent for your
+# morning briefing…" was spoken as "…using a for your morning briefing…", and
+# "Ich starte dafür einen Subagenten." became "Ich starte dafür einen." —
+# Jarvis could not even announce the thing he was starting. This is exactly
+# the failure the OF-04 audit recorded four lines above for "Provider" and
+# "MCP": a noun cannot be deleted out of the middle of a sentence by regex,
+# and a bare remnant falls through to the residue guard and is spoken as an
+# error. The mandate itself is untouched — the user must not hear the
+# internal compound — but "Agent" IS the user-facing name (the product surface
+# is "<wake-name> Agent" and the app has an Agents board), so substituting it
+# satisfies the mandate and leaves a sentence behind. Declension is preserved
+# so the German accusative stays right ("einen Subagenten" -> "einen Agenten").
+_JARGON_COMPOUND_BRAND = "Agent"
+
+
+def _compound_to_brand(match: re.Match[str]) -> str:
+ """Swap an internal agent compound for the user-facing brand word."""
+ return (
+ f"{_JARGON_COMPOUND_BRAND}en"
+ if match.group(0).lower().endswith("en")
+ else _JARGON_COMPOUND_BRAND
+ )
+
+
+# English needs "an" before the vowel the substitution introduces ("a Sub-Agent"
+# -> "a Agent"). German articles are unaffected because they do not elide.
+_A_BEFORE_AGENT_RE = re.compile(rf"\ba(?=\s+{_JARGON_COMPOUND_BRAND}\b)")
+
# 2026-05-24: strip the retired "OpenClaw" brand from voice output. Removes the
# "OpenClaw-" compound prefix ("OpenClaw-Mission" -> "Mission"; "OpenClaw-
# Subagent" -> "Subagent", which JARGON_COMPOUND_RE then drops) and any
@@ -735,7 +764,8 @@ def scrub_for_voice(
# Erweiterung 2026-04-28).
new = LEGACY_BRAND_RE.sub("", out)
new = JARGON_RE.sub("", new)
- new = JARGON_COMPOUND_RE.sub("", new)
+ new = JARGON_COMPOUND_RE.sub(_compound_to_brand, new)
+ new = _A_BEFORE_AGENT_RE.sub("an", new)
if new != out:
actions.append("removed_engineering_jargon")
out = new
diff --git a/tests/unit/brain/test_output_filter.py b/tests/unit/brain/test_output_filter.py
index f29eea50d8..3d6f4c1591 100644
--- a/tests/unit/brain/test_output_filter.py
+++ b/tests/unit/brain/test_output_filter.py
@@ -446,6 +446,43 @@ def test_sub_agent_jargon_is_removed() -> None:
assert "removed_engineering_jargon" in result.actions
+def test_agent_compound_leaves_a_sentence_not_a_hole() -> None:
+ """Live 2026-08-24 10:24: the scrub gutted the sentence around the word.
+
+ Spoken to the user: "…a complete overview using a for your morning
+ briefing…". Deleting a noun mid-sentence is the failure OF-04 already
+ recorded for "Provider"/"MCP"; the compound is now swapped for the
+ user-facing brand instead, so the mandate holds AND a sentence survives.
+ """
+ text = (
+ "I understand you would like a complete overview using a Sub-Agent "
+ "for your morning briefing."
+ )
+ cleaned = scrub_for_voice(text, language="en").cleaned
+ assert "Sub-Agent" not in cleaned
+ assert "using an Agent for your morning briefing" in cleaned
+
+
+def test_agent_compound_keeps_the_german_declension() -> None:
+ """"einen Subagenten" must not become "einen Agent" — nor "einen"."""
+ result = scrub_for_voice("Ich starte dafür einen Subagenten.") # i18n-allow
+ assert result.cleaned == "Ich starte dafür einen Agenten." # i18n-allow
+
+
+def test_agent_compound_announcement_survives() -> None:
+ """Jarvis must be able to say that he is starting one.
+
+ Before the fix this became "Ich starte dafür einen." — the announcement
+ of a spawn with the spawned thing deleted out of it.
+ """
+ cleaned = scrub_for_voice(
+ "Ich aktiviere einen Subagent für die Aufgabe." # i18n-allow
+ ).cleaned
+ assert "Subagent" not in cleaned
+ assert "Agent" in cleaned
+ assert cleaned.endswith("für die Aufgabe.") # i18n-allow
+
+
def test_official_jarvis_agent_label_is_preserved() -> None:
"""The public product label is not the retired generic engineering term."""
text = "Ein Jarvis-Agent prüft das gründlich und meldet sich."