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.

feat(brain): timer mandate class in the local-outcome gate

rubenluetke10-beep8f18a98c4b4b
diff --git a/jarvis/brain/local_outcome_gate.py b/jarvis/brain/local_outcome_gate.py
index 24b22aea48..bc272cb601 100644
--- a/jarvis/brain/local_outcome_gate.py
+++ b/jarvis/brain/local_outcome_gate.py
@@ -28,7 +28,10 @@ Matching contract
A mandate needs BOTH an outcome verb ("erstell", "loesch", "rename", …) AND a
file-system object ("ordner", "datei", "folder", "desktop", …) — the noun is
what separates "erstell einen Ordner" (shell) from "erstell einen
-Kalendereintrag" (plugin/calendar flow, untouched).
+Kalendereintrag" (plugin/calendar flow, untouched). A second, independent
+class covers timers/alarms/countdowns ("stell einen Timer auf 10 Minuten"):
+a timer noun plus a set/stop verb or a bare duration, with its own directive
+that forces a DETACHED background process (the tool call times out at ~30s).
Stand-downs (each defers to the flow that owns the turn):
- external-integration dispatch ("schick die Datei per Mail") — the
@@ -133,6 +136,31 @@ _FOREIGN_DOMAIN_RE = re.compile(
r")\b"
)
+# Timer/alarm/countdown nouns — the second mandate class (maintainer report
+# 2026-08-08, follow-up): "stell einen Timer" worked one day and was refused
+# the next, because a timer utterance carries no file-system noun and thus no
+# mandate. No dedicated timer feature exists in Jarvis (checked 2026-08-08:
+# every "timer" hit in the tree is an internal code timer), so run_shell is
+# the only vehicle and mandating it hijacks nothing.
+_TIMER_OBJECT_RE = re.compile(
+ r"\b(?:timers?|wecker|alarme?|countdowns?|stoppuhr)\b" # i18n-allow
+)
+
+# A timer turn needs a set/start/stop verb OR a bare duration ("Timer 10
+# Minuten" is common verbless voice phrasing).
+_TIMER_VERB_RE = re.compile(
+ r"\b(?:"
+ r"stell\w*|setz\w*|start\w*|mach\w*|leg\w*|aktivier\w*|erstell\w*|" # i18n-allow
+ r"set|create|"
+ r"stopp\w*|stop|beende\w*|abbrech\w*|cancel|loesch\w*|entfern\w*|" # i18n-allow
+ r"delete|remove"
+ r")\b"
+)
+_DURATION_RE = re.compile(
+ r"\b\d+\s*(?:sekunden?|minuten?|stunden?|seconds?|minutes?|hours?|" # i18n-allow
+ r"sek|min|std|s|m|h)\b" # i18n-allow
+)
+
# Per-turn directive injected into the system prompt when the mandate fires
# (English — LLM-facing, mirrors CONTACT_WRITE_DIRECTIVE / the read gate).
RUN_SHELL_OUTCOME_DIRECTIVE = (
@@ -151,6 +179,20 @@ RUN_SHELL_OUTCOME_DIRECTIVE = (
"clarifying question instead of guessing."
)
+RUN_SHELL_TIMER_DIRECTIVE = (
+ "MANDATORY THIS TURN: the user asks for a local timer/alarm/countdown on "
+ "THIS computer. You MUST arrange it NOW by calling the `run_shell` tool. "
+ "CRITICAL: the tool call itself times out after ~30 seconds, so NEVER "
+ "block with a plain sleep — start a DETACHED background process that "
+ "waits and then notifies audibly/visibly (Windows: Start-Process "
+ "powershell -WindowStyle Hidden with a Start-Sleep + beep/toast/msg "
+ "script, or schtasks for clock times; POSIX: nohup sh -c 'sleep …; "
+ "notify-send/afplay …' & ). To cancel a timer, find and kill that "
+ "process honestly. NEVER claim you lack a timer tool — run_shell IS the "
+ "tool. Confirm from the tool result only: the spawn must have succeeded; "
+ "on failure say exactly what failed."
+)
+
def resolve_local_outcome_mandate(utterance: str) -> tuple[str, str] | None:
"""Map a local file/folder/system request to ``(tool_name, directive)``.
@@ -178,6 +220,12 @@ def resolve_local_outcome_mandate(utterance: str) -> tuple[str, str] | None:
# the detector does its own normalisation.
if requires_external_integration(raw):
return None
+ # Timer class first: a timer noun plus a set/stop verb or a bare duration
+ # ("Timer 10 Minuten"). Independent of the file-system nouns below.
+ if _TIMER_OBJECT_RE.search(t) and (
+ _TIMER_VERB_RE.search(t) or _DURATION_RE.search(t)
+ ):
+ return ("run_shell", RUN_SHELL_TIMER_DIRECTIVE)
if not _FS_OBJECT_RE.search(t):
return None
if not _FS_VERB_RE.search(t):
@@ -187,5 +235,6 @@ def resolve_local_outcome_mandate(utterance: str) -> tuple[str, str] | None:
__all__ = [
"RUN_SHELL_OUTCOME_DIRECTIVE",
+ "RUN_SHELL_TIMER_DIRECTIVE",
"resolve_local_outcome_mandate",
]
diff --git a/jarvis/core/capabilities_seed.py b/jarvis/core/capabilities_seed.py
index 4997404e2a..a4d98e1b5a 100644
--- a/jarvis/core/capabilities_seed.py
+++ b/jarvis/core/capabilities_seed.py
@@ -95,6 +95,8 @@ _SEED_CAPABILITIES: list[Capability] = [
"entpack", "entpacke", "komprimier", "komprimiere", # i18n-allow
"create", "delete", "remove", "rename", "move", "copy",
"unzip", "zip", "extract", "list", "liste", # i18n-allow
+ # Timer verbs (2026-08-08 follow-up): "stell/setz einen Timer".
+ "stell", "setz", "set", # i18n-allow
),
objects=_SHELL_OBJECTS + (
# Outcome objects: the file-system nouns natural requests name.
@@ -102,6 +104,9 @@ _SEED_CAPABILITIES: list[Capability] = [
"datei", "dateien", "folder", "folders", "directory", # i18n-allow
"directories", "file", "files", "desktop", "download",
"downloads", "papierkorb", "archiv", "zip", # i18n-allow
+ # Timers ride run_shell as a detached background process — no
+ # dedicated timer feature exists (checked 2026-08-08).
+ "timer", "wecker", "alarm", "countdown", "stoppuhr", # i18n-allow
),
description=(
"Run shell commands for local computer tasks: create/delete/"
diff --git a/tests/unit/brain/test_local_outcome_gate.py b/tests/unit/brain/test_local_outcome_gate.py
index dc1b8b9e65..efb8477a22 100644
--- a/tests/unit/brain/test_local_outcome_gate.py
+++ b/tests/unit/brain/test_local_outcome_gate.py
@@ -13,6 +13,7 @@ import pytest
from jarvis.brain.local_outcome_gate import (
RUN_SHELL_OUTCOME_DIRECTIVE,
+ RUN_SHELL_TIMER_DIRECTIVE,
resolve_local_outcome_mandate,
)
@@ -67,6 +68,26 @@ NO_MANDATE_UTTERANCES = [
]
+# Timer class (2026-08-08 follow-up): "stell einen Timer" was the maintainer's
+# original positive surprise — and the next day it was refused again.
+TIMER_UTTERANCES = [
+ "Stell einen Timer auf 10 Minuten",
+ "Setz mir bitte einen Timer für 5 Minuten",
+ "Kannst du einen Timer auf 20 Minuten stellen?",
+ "Timer 10 Minuten",
+ "Mach mir einen Wecker für 7 Uhr",
+ "Stopp den Timer bitte",
+ "set a timer for 15 minutes",
+ "start a 5 minute countdown",
+]
+
+TIMER_NO_MANDATE = [
+ "Was ist ein Timer?", # definition
+ "Wie funktioniert ein Timer?", # no set/stop verb, no duration
+ "Der Timer gestern war praktisch", # remark, no verb/duration
+]
+
+
@pytest.mark.parametrize("utterance", MANDATE_UTTERANCES)
def test_local_outcome_mandates_run_shell(utterance: str) -> None:
mandate = resolve_local_outcome_mandate(utterance)
@@ -76,6 +97,29 @@ def test_local_outcome_mandates_run_shell(utterance: str) -> None:
assert directive == RUN_SHELL_OUTCOME_DIRECTIVE
[email protected]("utterance", TIMER_UTTERANCES)
+def test_timer_requests_mandate_run_shell_with_detach_directive(utterance: str) -> None:
+ mandate = resolve_local_outcome_mandate(utterance)
+ assert mandate is not None, f"expected a timer mandate for: {utterance!r}"
+ tool, directive = mandate
+ assert tool == "run_shell"
+ assert directive == RUN_SHELL_TIMER_DIRECTIVE
+
+
[email protected]("utterance", TIMER_NO_MANDATE)
+def test_timer_questions_and_remarks_do_not_mandate(utterance: str) -> None:
+ assert resolve_local_outcome_mandate(utterance) is None, (
+ f"expected NO mandate for: {utterance!r}"
+ )
+
+
+def test_timer_directive_forces_detached_process() -> None:
+ # The tool call times out after ~30s — a blocking sleep would fail every
+ # timer, so the directive must demand a detached background process.
+ assert "DETACHED" in RUN_SHELL_TIMER_DIRECTIVE
+ assert "run_shell" in RUN_SHELL_TIMER_DIRECTIVE
+
+
@pytest.mark.parametrize("utterance", NO_MANDATE_UTTERANCES)
def test_conversational_and_foreign_turns_do_not_mandate(utterance: str) -> None:
assert resolve_local_outcome_mandate(utterance) is None, (