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(planner): stop delegating plain conversation to the Tool Model
Harald419a52027f4c
diff --git a/jarvis/brain/turn_planner.py b/jarvis/brain/turn_planner.pyindex 54bbefad2a..33d9b86b95 100644--- a/jarvis/brain/turn_planner.py+++ b/jarvis/brain/turn_planner.py@@ -104,9 +104,16 @@ _INSTRUCTIONAL_RE = re.compile(r"cuales son tus capacidades)\b" # i18n-allow: speech input# i18n-allow: multilingual speech-input matching data)+# The bare German dative "mir" ("to me") is deliberately NOT ownership+# (removed 2026-08-19): it is the object of telling and explaining — "sag+# mir", "erklaer mir", "es tut mir leid", "kannst du mir helfen" — and as a+# possessive signal it delegated plain conversation ("Hallo, sprich mal mit+# mir" 3.2 s, a relativity question 5.9 s, live 2026-08-18). Real private+# data keeps its possessive ("meine Termine", "mein Wiki") or its recall+# idiom (_RECALL_RE). # i18n-allow: names the German tokens under discussion_OWNERSHIP_RE = re.compile(r"\b(?:my|mine|our|we|about me|remember me|"- r"mein\w*|unser\w*|mir|wir|ueber mich|uber mich|erinner\w* mich|" # i18n-allow: speech input+ r"mein\w*|unser\w*|wir|ueber mich|uber mich|erinner\w* mich|" # i18n-allow: speech inputr"mi|mis|mio|nuestr\w*|sobre mi|recuerd\w* de mi)\b" # i18n-allow: speech input)# Explicit recall of the user's own past ("weisst du noch", "wann war ich",@@ -276,7 +283,7 @@ _ACTION_FALLBACK_RE = re.compile(r"verschieb\w*|schick\w*|send\w*|fuehr\w*|bau\w*|ruf\w*|klick\w*|"r"tipp\w*|buch\w*|kauf\w*|antwort\w*|wechsel\w*|wechsl\w*|schalt\w*|"r"stell\w*|spiel\w*|merk(?!wuerdig)\w*|notier\w*|trag(?!isch|oedi)\w*|"- r"leg(?:e|st|t|en)?\b|setz\w*|pausier\w*|aktivier\w*|deaktivier\w*|"+ r"leg(?:e|st|t|en)?\b|anleg\w*|setz\w*|pausier\w*|aktivier\w*|deaktivier\w*|"r"erinner\w*|dreh\w*|mach\w*|nutz\w*|benutz\w*|verwend\w*|"r"sprich\w*|sprech\w*|brich|brech\w*|abbrech\w*|lauter|leiser|" # i18n-allow: speech inputr"abre\w*|cierra\w*|inicia\w*|crea\w*|escrib\w*|guarda\w*|"@@ -338,6 +345,35 @@ _WHY_RE = re.compile(# Its span is removed before the weak action/current scans so "machst" and# "morgen" cannot delegate; "Woran arbeitest du?" (mission status) is a# separate LOCAL_STATE idiom and stays. # i18n-allow: quoted German utterance+# "Talk to me" is a request for conversation, not an order to act: the verb+# ("sprich", "red", "talk", "speak") is the assistant's ordinary job. Only+# the filler-padded idiom is stripped; "Sprich Englisch mit mir" (a language+# switch) keeps its object between verb and pronoun and still delegates.+# Live 2026-08-18 18:41: "Hallo, sprich mal mit mir." paid a 3.2 s+# delegation to be told "Ich bin da." # i18n-allow: quoted German utterances+_TALK_TO_ME_RE = re.compile(+ # i18n-allow: multilingual speech-input matching data+ r"\b(?:sprich|sprech\w*|red(?:e|et)?|unterhalt(?:e|et)? dich|quatsch\w*|"+ r"plauder\w*)(?:\s+(?:doch|mal|bitte|kurz|einfach|jetzt|ruhig|gern(?:e)?))*"+ r"\s+mit mir\b|"+ r"\b(?:talk|speak|chat)(?:\s+(?:to|with))?\s+(?:to|with)?\s*me\b|"+ r"\bhabla(?:me)?\s+conmigo\b|\bcharla\s+conmigo\b"+)+# Wellbeing / presence chat: "Wie geht's dir heute?", "How are you doing+# today?" carry a time word that reads as a freshness marker and, with the+# question mark, force-delegated the greeting (current_data + uncertain).+# The idiom span — including its trailing today/now — is removed before the+# weak scans; a real freshness topic ("wie ist das Wetter heute") never+# matches it. # i18n-allow: quoted German utterance+_WELLBEING_RE = re.compile(+ # i18n-allow: multilingual speech-input matching data+ r"\bwie geht(?:'?s| es)(?: dir| ihnen| euch)?"+ r"(?:\s+(?:denn|so|gerade|heute|jetzt|momentan|eigentlich))*\b|"+ r"\bhow are you(?: doing| feeling)?(?:\s+(?:today|now|right now))?\b|"+ r"\bhow(?:'s| is) it going(?:\s+(?:today|now))?\b|"+ r"\bwhat(?:'s| is) up(?:\s+(?:today|now))?\b|"+ r"\b(?:que tal|como estas)(?:\s+(?:hoy|ahora))?\b"+)_ASSISTANT_DAYPLAN_RE = re.compile(# i18n-allow: multilingual speech-input matching datar"\bwas machst du\b"@@ -753,12 +789,17 @@ def plan_turn(weak_scan_text = _ASSISTANT_DAYPLAN_RE.sub(" ", normalized)weak_scan_text = _DATE_TRIVIA_RE.sub(" ", weak_scan_text)weak_scan_text = _GERMAN_NONCOMMAND_ACTION_SPAN_RE.sub(" ", weak_scan_text)+ weak_scan_text = _TALK_TO_ME_RE.sub(" ", weak_scan_text)+ weak_scan_text = _WELLBEING_RE.sub(" ", weak_scan_text)action_intent = bool(_ACTION_FALLBACK_RE.search(weak_scan_text))if capability_registry is not None:+ # The registry sweep reads the SAME idiom-stripped text as the+ # fallback regex: a verb inside a suppressed idiom ("sprich mal mit+ # mir", "was machst du heute") is not an order either way. # i18n-allowtry:action_intent = action_intent or bool(- capability_registry.has_action_intent(text)+ capability_registry.has_action_intent(weak_scan_text))except Exception: # noqa: BLE001,S110 - local fallback remains availablepass@@ -902,6 +943,7 @@ def plan_turn(if inherited:reasons.add(TurnReason.UNCERTAIN)+ evidence_domain_hit = Falseif evidence_domains and lookup and not definition:for keywords in evidence_domains.values():if any(@@ -909,6 +951,7 @@ def plan_turn(for keyword in keywords):reasons.add(TurnReason.CONNECTED_DATA)+ evidence_domain_hit = Truebreak# A lookup that names a live capability/tool but no stronger category is@@ -950,8 +993,13 @@ def plan_turn(}if TurnReason.CAPABILITY in reasons and required_without_public_search:non_public_evidence.add(TurnReason.CAPABILITY)+ # An evidence-domain keyword ("steht morgen … an" → calendar) IS connected+ # evidence: without it here, "Was ist morgen? Steht morgen irgendwas an?"+ # was graded a fresh PUBLIC fact and web-searched (live 2026-08-18+ # 19:32: "Ich konnte das gerade nicht zuverlässig prüfen"). # i18n-allow: live quotesif TurnReason.CONNECTED_DATA in reasons and (required_without_public_search+ or evidence_domain_hitor _CONNECTED_DOMAIN_RE.search(normalized)or _CONTACT_DETAIL_RE.search(normalized)or privatediff --git a/jarvis/core/capabilities.py b/jarvis/core/capabilities.pyindex 0b988fd5d7..331ee880fe 100644--- a/jarvis/core/capabilities.py+++ b/jarvis/core/capabilities.py@@ -275,7 +275,16 @@ class CapabilityRegistry:hallucination-prone surface the UNSUPPORTED gate exists toguard.(b) every registered capability's own verb list — so a freshly- added MCP whose verbs are not in (a) still counts.+ added MCP whose verbs are not in (a) still counts. DOMAIN+ capabilities (``source`` ``skill`` / ``cli``) count only when+ one of their OWN objects is named too — the same rule+ ``resolve_intent`` applies. Their verb lists are domain+ vocabulary ("guck", "schau", "check", "weiter"), and # i18n-allow: German tokens+ as universal action verbs they turned ordinary conversation+ into action turns: with gcloud connected, "Kannst mal bitte+ gucken, was morgen für ein Tag ist?" read as an ACTION # i18n-allow: live quote+ and paid a 5.5 s Tool-Model delegation for a date (live+ 2026-08-18 15:35). Only a verb *about that domain* is an order.Smalltalk / Q&A utterances ("wie spaet ist es", "was ist Python")match neither and return False.@@ -294,9 +303,18 @@ class CapabilityRegistry:with self._lock:caps = list(self._caps.values())for cap in caps:- for v in cap.verbs:- if re.search(r"\b" + re.escape(_normalize(v)) + r"\b", normalised):- return True+ verb_hit = any(+ re.search(r"\b" + re.escape(_normalize(v)) + r"\b", normalised)+ for v in cap.verbs+ )+ if not verb_hit:+ continue+ if cap.source in ("skill", "cli") and not any(+ re.search(r"\b" + re.escape(_normalize(o)) + r"\b", normalised)+ for o in cap.objects+ ):+ continue+ return Truereturn False#: Prompt-render budget. Every MCP tool and CLI registers a capability,diff --git a/jarvis/core/capabilities_seed.py b/jarvis/core/capabilities_seed.pyindex a4d98e1b5a..cf8e35e89b 100644--- a/jarvis/core/capabilities_seed.py+++ b/jarvis/core/capabilities_seed.py@@ -256,8 +256,11 @@ _SEED_CAPABILITIES: list[Capability] = [id="local.reset_orb_position",source="local_action",verbs=(- "reset", "zurueck", "zurück", "bring", "bringe", # i18n-allow- "orb", "overlay", "move", "verschiebbe",+ # "zurueck"/"orb"/"overlay" moved to the objects (2026-08-19): as+ # VERBS the adverb "zurück" ("ich bin zurück", "komm zurück") and # i18n-allow+ # the nouns made has_action_intent fire on ordinary speech; the+ # intent still resolves through verb + object ("setz das Orb zurück"). # i18n-allow+ "reset", "bring", "bringe", "move", "verschiebbe", "setz", "setze",),objects=("orb", "overlay", "position", "fenster", "window",@@ -272,7 +275,11 @@ _SEED_CAPABILITIES: list[Capability] = [source="local_action",verbs=("oeffne", "öffne", "starte", "start", "spawne", "spawn", # i18n-allow- "open", "launch", "neue", "new",+ # "neue"/"new" are adjectives, not verbs ("gibt es neue # i18n-allow+ # Nachrichten?", "any new ideas?") — they made has_action_intent+ # fire on plain questions (2026-08-19). The open/start/spawn verbs+ # already cover "öffne zwei neue Terminals". # i18n-allow+ "open", "launch",),objects=("terminal", "terminals", "konsole", "konsolen", "console",@@ -338,7 +345,14 @@ _SEED_CAPABILITIES: list[Capability] = [verbs=("schreib", "schreibe", "mail", "maile","such", "suche", "find", "finde", "zeig", "zeige",- "nenn", "nenne", "kontaktier", "kontaktiere", "wer", "lookup",+ # NB: the question word "wer" was a VERB here until 2026-08-19:+ # every "Wer ist/war/waren …?" question resolved to this+ # capability (has_action_intent True, CAPABILITY + CONNECTED_DATA),+ # so "Wer waren die 10 berühmtesten Wissenschaftler?" paid a # i18n-allow: live quote+ # 5.6 s Tool-Model delegation. A contact lookup is carried by its+ # OBJECTS (kontakt, nummer, telefon, adresse, mail …) plus a real+ # verb; a bare question word is never an order.+ "nenn", "nenne", "kontaktier", "kontaktiere", "lookup",),objects=("kontakt", "kontakte", "contact", "contacts", "person", "leute",diff --git a/tests/unit/brain/test_turn_planner.py b/tests/unit/brain/test_turn_planner.pyindex dda30d197b..b5b6f1d512 100644--- a/tests/unit/brain/test_turn_planner.py+++ b/tests/unit/brain/test_turn_planner.py@@ -759,3 +759,120 @@ def test_recall_of_the_users_past_delegates_as_private_data(utterance: str) -> N)def test_storytelling_past_tense_stays_native(utterance: str) -> None:assert plan_turn(utterance).path is TurnPath.NATIVE_REALTIME+++# --- Conversation mis-routes measured live 2026-08-18 (flight recorder) -----+# Each of these paid a 3–16 s Tool-Model delegation for an answer the live+# model gives in under a second. The maintainer mandate (2026-08-19): a+# mis-routed conversational turn is a bug, latency IS the failure.+++def connected_gcloud_registry() -> CapabilityRegistry:+ """A CLI capability with domain vocabulary as the live box had it."""+ value = CapabilityRegistry()+ value.register(+ Capability(+ id="cli.gcloud",+ source="cli",+ verbs=("zeig", "list", "show", "check", "guck", "gucke", "gucken", "schau"),+ objects=("gcp", "google cloud", "gcloud", "bucket", "billing", "projekt"),+ description="gcloud CLI",+ risk_tier="ask",+ requires_evidence=True,+ )+ )+ value.register(+ Capability(+ id="tool.contact-lookup",+ source="router_tool",+ verbs=("such", "suche", "find", "finde", "zeig", "nenn", "lookup"),+ objects=("kontakt", "contact", "nummer", "telefonnummer", "adresse"),+ description="contact lookup",+ risk_tier="safe",+ requires_evidence=False,+ )+ )+ return value+++ "utterance",+ [+ "Hallo, sprich mal mit mir.", # i18n-allow: live utterance (3.2 s delegation)+ "Sprich doch mal bitte kurz mit mir.", # i18n-allow: German speech-input fixture+ "Talk to me.",+ "Kannst du mir mal, hallo, kannst du mir bitte sagen, was du für Musik " # i18n-allow: live+ "empfehlen würdest?", # i18n-allow: live utterance+ "Okay, es tut mir was zu verstehen. Wie genau die Relativitätstheorie " # i18n-allow: live+ "von Albert Einstein funktioniert?", # i18n-allow: live utterance (5.9 s)+ "Wer waren die 10 berühmtesten Wissenschaftler?", # i18n-allow: live utterance (5.6 s)+ "Wer ist der Präsident von Frankreich?", # i18n-allow: German speech-input fixture+ "Kannst mal bitte gucken, was morgen für ein Tag ist?", # i18n-allow: live (5.5 s)+ "How are you doing today?",+ "Wie geht's dir heute?", # i18n-allow: German speech-input fixture+ "Sag mir was über Berlin.", # i18n-allow: German speech-input fixture+ "Kannst du mir helfen?", # i18n-allow: German speech-input fixture+ "Erklär mir, wie ein Transformer funktioniert.", # i18n-allow: German speech-input fixture+ ],+)+def test_live_conversation_misroutes_stay_native(+ utterance: str, connected_gcloud_registry: CapabilityRegistry+) -> None:+ plan = plan_turn(+ utterance,+ capability_registry=connected_gcloud_registry,+ tool_names=("search_web", "contact-lookup", "cli_gcloud", "google_calendar"),+ )+ assert plan.path is TurnPath.NATIVE_REALTIME, sorted(plan.reasons)+++ "utterance",+ [+ # The same verbs WITH their domain object, a real possessive, or a+ # language switch keep delegating — the fix is precision, not silence.+ "Sprich Englisch mit mir.", # i18n-allow: German speech-input fixture+ "Guck mal in meinem Google Cloud Projekt nach den Buckets.", # i18n-allow: German fixture+ "Such mir die Telefonnummer von Anna raus.", # i18n-allow: German speech-input fixture+ "Zeig mir meine Termine für morgen.", # i18n-allow: German speech-input fixture+ "Ich möchte, dass du mir einen Termin für Montag anlegst.", # i18n-allow: German fixture+ "Wie ist das Wetter heute?", # i18n-allow: German speech-input fixture+ ],+)+def test_domain_verbs_with_their_objects_still_delegate(+ utterance: str, connected_gcloud_registry: CapabilityRegistry+) -> None:+ plan = plan_turn(+ utterance,+ capability_registry=connected_gcloud_registry,+ tool_names=("search_web", "contact-lookup", "cli_gcloud", "google_calendar"),+ )+ assert plan.path is TurnPath.ORCHESTRATOR+++def test_domain_cli_verb_without_its_object_is_not_an_action(+ connected_gcloud_registry: CapabilityRegistry,+) -> None:+ """``has_action_intent`` mirrors ``resolve_intent``: a CLI/skill verb is an+ order only about its own domain."""+ registry = connected_gcloud_registry+ no_object = "Kannst mal bitte gucken, was morgen ist?" # i18n-allow: German fixture+ assert registry.has_action_intent(no_object) is False+ assert registry.has_action_intent("Guck mal in die gcloud Buckets.") is True # i18n-allow+ assert registry.has_action_intent("Schick Anna eine Mail.") is True # i18n-allow+++def test_calendar_evidence_domain_is_connected_not_public(+) -> None:+ """'steht morgen … an' is the user's calendar, never a web search."""+ from jarvis.core.config import EvidenceDomainsConfig++ plan = plan_turn(+ "Was steht morgen an?", # i18n-allow: German speech-input fixture+ evidence_domains=EvidenceDomainsConfig().domains,+ )+ assert plan.path is TurnPath.ORCHESTRATOR+ assert TurnReason.CONNECTED_DATA in plan.reasons+ assert TurnReason.PUBLIC_FACT not in plan.reasons+ assert plan.requires_public_fact_grounding is False