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
feat(safety): explicit-intent skip — the Claude-Code permission model
rubenluetke10-beepcb0bddecb5ad
diff --git a/jarvis.toml.example b/jarvis.toml.exampleindex dd01029496..2a626865ec 100644--- a/jarvis.toml.example+++ b/jarvis.toml.example@@ -125,9 +125,15 @@ always_confirm_tiers = ["ask"]always_block_tiers = ["block"][safety.whitelist]-# fnmatch patterns against "<tool_name> <args>"; a match downgrades to "safe".+# fnmatch patterns against "<tool_name> <args>" or the bare "<args>"; a match+# downgrades to "safe". Do NOT add "run_shell *": shell commands come with a+# tiered model out of the box (Claude-Code permission style) — commands that+# only read or modify run without confirmation, destructive commands (rm,+# del, format, Remove-Item, ...) ask first UNLESS the user's own request+# already named the destruction ("delete the folder X"). A blanket+# "run_shell *" entry would switch all of that off.commands = [- "open_app *", "type_text *", "run_shell *", "search_web *", "remember *",+ "open_app *", "type_text *", "search_web *", "remember *","dispatch_to_harness *", "screenshot *","git status", "git log *", "git diff *",]diff --git a/jarvis/plugins/tool/run_shell.py b/jarvis/plugins/tool/run_shell.pyindex b1d27c4d89..c1abd4db1e 100644--- a/jarvis/plugins/tool/run_shell.py+++ b/jarvis/plugins/tool/run_shell.py@@ -35,6 +35,7 @@ from typing import Anyfrom jarvis.core.process_utils import NO_WINDOW_CREATIONFLAGSfrom jarvis.core.protocols import ExecutionContext, ToolResultfrom jarvis.safety.command_impact import DESTRUCTIVE, classify_command+from jarvis.safety.explicit_intent import utterance_confirms_destructionif sys.platform == "win32":_SHELL_LABEL = "Windows PowerShell 5.1"@@ -166,6 +167,21 @@ class RunShellTool:return "ask"return None+ def intent_confirms_args(self, args: dict[str, Any], utterance: str) -> bool:+ """True when the user's own words already authorize this command.++ Claude-Code permission model: a destructive command the USER asked+ for by name ("delete the folder Urlaub") needs no second question —+ the ToolExecutor consults this hook before arming a confirmation.+ Only the destruction verb-class is matched (deterministic vocabulary,+ no entity matching — STT garbles names); a brain-initiated deletion+ whose utterance never mentioned deleting still confirms.+ """+ command = (args.get("command") or "").strip()+ if not command or classify_command(command).level != DESTRUCTIVE:+ return False+ return utterance_confirms_destruction(utterance)+def describe_args(self, args: dict[str, Any]) -> dict[str, str] | None:"""Plain-language impact summary for the confirmation question.diff --git a/jarvis/safety/explicit_intent.py b/jarvis/safety/explicit_intent.pynew file mode 100644index 0000000000..c0d9c52406--- /dev/null+++ b/jarvis/safety/explicit_intent.py@@ -0,0 +1,54 @@+"""Deterministic check: did the USER explicitly ask for the destructive act?++The Claude-Code permission model, adapted for voice (Ruben's mandate,+2026-08-08): harmless commands run silently, destructive commands confirm —+UNLESS the user's own utterance already named the destruction ("lösch den+Ordner Urlaub"). Asking "do you really want me to delete?" right after the+user said "delete" is confirmation fatigue, the exact failure the whitelist+era was built to avoid. The flip side stays protected: when the brain decides+ON ITS OWN that deleting something is a useful step (the utterance never+mentioned it), the confirmation fires.++Deliberately dumb: a word-boundary vocabulary match, no LLM (AP-11 — the+safety path must be deterministic and fast). The vocabulary is speech-input+vocabulary in de/en/es (CLAUDE.md §1 — registered in the german-allowlist);+it covers DESTRUCTION verbs only. STT-confidence doubts are not this+module's job: a plausibility-forced confirmation is never skipped (see+ToolExecutor).+"""+from __future__ import annotations++import re++# Word stems that only appear when the speaker explicitly asks for deletion,+# formatting, or a machine power action. Stems (not full words) so German+# inflection ("lösch", "lösche", "löschst", "gelöscht") matches without a+# morphology engine; the \w* tail absorbs endings. Compiled once.+_DESTRUCTION_STEMS: tuple[str, ...] = (+ # German+ "lösch", "gelöscht", "entfern", "entfernt", "wegwerfen", "wegschmeiß",+ "papierkorb", "formatier", "runterfahren", "herunterfahren", "neustart",+ "neu starten",+ # English+ "delete", "remove", "erase", "wipe", "trash", "uninstall", "format",+ "shut down", "shutdown", "restart", "reboot", "power off",+ # Spanish+ "borra", "borrar", "elimina", "eliminar", "quita", "quitar", "formatea",+ "apaga", "apagar", "reinicia", "reiniciar",+)++_PATTERN = re.compile(+ r"\b(?:" + "|".join(re.escape(stem) + r"\w*" for stem in _DESTRUCTION_STEMS) + r")",+ re.IGNORECASE,+)+++def utterance_confirms_destruction(utterance: str) -> bool:+ """True when the utterance itself explicitly asks for a destructive act.++ Empty/whitespace utterances (API calls, missions without a spoken turn)+ never confirm — the confirmation question stays the default there.+ """+ if not utterance or not utterance.strip():+ return False+ return bool(_PATTERN.search(utterance))diff --git a/jarvis/safety/tool_executor.py b/jarvis/safety/tool_executor.pyindex bcac69262c..b41cc8504e 100644--- a/jarvis/safety/tool_executor.py+++ b/jarvis/safety/tool_executor.py@@ -210,9 +210,31 @@ class ToolExecutor:# TaskAutoApprover may answer synchronously from that event; registering# afterward loses the answer and turns a valid grant into a timeout.approved_by = decision.approved_by or "auto"- needs_confirm = self._evaluator.needs_user_confirmation(decision) or (- plaus is not None and plaus.require_confirmation- )+ tier_confirm = self._evaluator.needs_user_confirmation(decision)+ plaus_confirm = plaus is not None and plaus.require_confirmation+ # Explicit intent (Claude-Code permission model, mandate 2026-08-08):+ # a consequential action the user's own utterance already asked for by+ # name ("delete the folder X") skips the redundant confirmation. Only+ # the TIER requirement may be waived — a plausibility-forced+ # confirmation (low STT confidence, stale wake) stays binding, because+ # the whole doubt there is whether the utterance was heard right.+ if tier_confirm and not plaus_confirm and user_utterance:+ confirms = getattr(tool, "intent_confirms_args", None)+ if callable(confirms):+ try:+ if confirms(args, user_utterance):+ tier_confirm = False+ approved_by = "explicit-intent"+ log.info(+ "explicit-intent: %s authorized by the utterance, "+ "skipping confirmation", tool.name,+ )+ except Exception as exc: # noqa: BLE001 — keep the confirmation on a broken hook+ log.warning(+ "intent_confirms_args on %r raised %r — keeping confirmation",+ tool.name, exc,+ )+ needs_confirm = tier_confirm or plaus_confirmvoice_confirm = bool((config_snapshot or {}).get("voice_confirm"))approval_ticket = Noneif needs_confirm and not voice_confirm:diff --git a/scripts/ci/german-allowlist.txt b/scripts/ci/german-allowlist.txtindex 207c4f2886..890812dd14 100644--- a/scripts/ci/german-allowlist.txt+++ b/scripts/ci/german-allowlist.txt@@ -257,6 +257,12 @@ tests/unit/voice/test_echo_confirmation_es.py# jarvis/voice/action_phrases.py) ---jarvis/voice/tool_confirmation.py+# --- Explicit-intent vocabulary: German speech-input stems ("lösch",+# "entfern", ...) that mark a destruction the user asked for HIMSELF —+# de/en/es, same speech-input-vocabulary rationale as the wake words ---+jarvis/safety/explicit_intent.py+tests/unit/safety/test_explicit_intent.py+# --- awareness-recall tool: forensic comments quote the German runtime phrase# ("der lokale Verlaufsspeicher ist nicht verfügbar") the DI fix addresses ---jarvis/plugins/tool/awareness_recall.pydiff --git a/tests/unit/safety/test_explicit_intent.py b/tests/unit/safety/test_explicit_intent.pynew file mode 100644index 0000000000..78f19ec8f9--- /dev/null+++ b/tests/unit/safety/test_explicit_intent.py@@ -0,0 +1,82 @@+"""Explicit-intent vocabulary: the user's own words authorize the destruction.++Claude-Code permission model (mandate 2026-08-08): "lösch den Ordner Urlaub"+must not be answered with "do you really want me to delete?". The check is a+deterministic de/en/es verb-stem match — no LLM, no entity matching.+"""+from __future__ import annotations++import pytest++from jarvis.plugins.tool.run_shell import RunShellTool+from jarvis.safety.explicit_intent import utterance_confirms_destruction+++ "utterance",+ [+ "Lösch den Ordner Urlaub vom Desktop.",+ "Bitte lösche die alte Datei",+ "kannst du das entfernen",+ "wirf das in den Papierkorb",+ "formatier den Stick",+ "fahr den Rechner runterfahren", # STT word salad still carries the stem+ "delete the old build folder",+ "please remove that file",+ "wipe the temp directory",+ "shut down the computer",+ "borra la carpeta vieja",+ "elimina ese archivo",+ "apaga el ordenador",+ ],+)+def test_destruction_verbs_confirm(utterance: str) -> None:+ assert utterance_confirms_destruction(utterance) is True+++ "utterance",+ [+ "",+ " ",+ "Leg einen Ordner Urlaub auf dem Desktop an.",+ "Was liegt auf meinem Desktop?",+ "Räum die Dateien in Unterordner", # organizing is NOT deleting+ "create a folder called delete-me-later"+ .replace("delete-me-later", "archive"), # no destruction verb at all+ "Stelle einen Timer auf acht Minuten.",+ ],+)+def test_harmless_utterances_do_not_confirm(utterance: str) -> None:+ assert utterance_confirms_destruction(utterance) is False+++class TestRunShellIntentHook:+ def test_destructive_command_with_spoken_delete_confirms(self) -> None:+ tool = RunShellTool()+ assert tool.intent_confirms_args(+ {"command": "Remove-Item -Recurse C:\\Users\\x\\Desktop\\Urlaub"},+ "Lösch den Ordner Urlaub vom Desktop.",+ ) is True++ def test_brain_initiated_deletion_does_not_confirm(self) -> None:+ # The utterance never mentioned deleting — the brain chose rm on its+ # own as a means to an end. The confirmation must stay.+ tool = RunShellTool()+ assert tool.intent_confirms_args(+ {"command": "rm -rf ./build"},+ "mach das Projekt startklar",+ ) is False++ def test_non_destructive_command_never_needs_the_shortcut(self) -> None:+ tool = RunShellTool()+ assert tool.intent_confirms_args(+ {"command": "ls -la"},+ "lösch nachher mal was",+ ) is False++ def test_empty_utterance_never_confirms(self) -> None:+ tool = RunShellTool()+ assert tool.intent_confirms_args(+ {"command": "rm -rf ./build"}, "",+ ) is Falsediff --git a/tests/unit/safety/test_tool_executor_voice_confirm.py b/tests/unit/safety/test_tool_executor_voice_confirm.pyindex cbdf6fbcc7..8c211f307f 100644--- a/tests/unit/safety/test_tool_executor_voice_confirm.py+++ b/tests/unit/safety/test_tool_executor_voice_confirm.py@@ -124,6 +124,77 @@ async def test_broken_describe_args_never_blocks_the_deferral() -> None:assert "impact" not in result.output+class _IntentTool(_AskTool):+ """Ask-tier tool whose ``intent_confirms_args`` mirrors run_shell's."""++ name = "run_shell"++ def intent_confirms_args(self, args: dict[str, Any], utterance: str) -> bool:+ return "lösch" in utterance.lower() # i18n-allow — speech-input stem+++async def test_explicit_intent_skips_the_confirmation() -> None:+ # Claude-Code permission model: the user asked for the deletion themselves —+ # the ask-tier action runs immediately, recorded as explicit-intent.+ executor, approval, _bus = _executor()+ tool = _IntentTool()+ result = await executor.execute(+ tool, args={"command": "rm -rf x"},+ user_utterance="Lösch den Ordner x.", # i18n-allow — spoken German turn+ config_snapshot={"voice_confirm": True},+ )+ assert result.success is True+ assert tool.calls == 1+ assert approval.wait_calls == 0+ assert tool.last_ctx is not None+ assert tool.last_ctx.approved_by == "explicit-intent"+++async def test_brain_initiated_destruction_still_defers() -> None:+ # Same tool, but the utterance never asked for a deletion — the two-turn+ # confirmation flow stays.+ executor, _approval, _bus = _executor()+ tool = _IntentTool()+ result = await executor.execute(+ tool, args={"command": "rm -rf x"},+ user_utterance="mach das Projekt startklar",+ config_snapshot={"voice_confirm": True},+ )+ assert result.error == VOICE_CONFIRM_SENTINEL+ assert tool.calls == 0+++async def test_empty_utterance_never_skips_the_confirmation() -> None:+ # API/mission calls carry no spoken turn — explicit intent cannot apply.+ executor, _approval, _bus = _executor()+ tool = _IntentTool()+ result = await executor.execute(+ tool, args={"command": "rm -rf x"},+ config_snapshot={"voice_confirm": True},+ )+ assert result.error == VOICE_CONFIRM_SENTINEL+ assert tool.calls == 0+++async def test_broken_intent_hook_keeps_the_confirmation() -> None:+ class _BrokenIntentTool(_AskTool):+ def intent_confirms_args(self, args: dict[str, Any], utterance: str) -> bool:+ raise RuntimeError("boom")++ executor, _approval, _bus = _executor()+ tool = _BrokenIntentTool()+ result = await executor.execute(+ tool, args={}, user_utterance="lösch alles", # i18n-allow+ config_snapshot={"voice_confirm": True},+ )+ assert result.error == VOICE_CONFIRM_SENTINEL+ assert tool.calls == 0++@pytest.mark.asyncioasync def test_execute_confirmed_runs_the_stashed_action() -> None:executor, _approval, bus = _executor()