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(voice): one set of conversation rules for every live engine, and a report-back duty for agents and missions (#634)

Ruben Lütked9208ab8ba6c
diff --git a/docs/commands-reference.md b/docs/commands-reference.md
index 2070f6d985..4ec1984a0f 100644
--- a/docs/commands-reference.md
+++ b/docs/commands-reference.md
@@ -83,7 +83,7 @@ List one agent's scheduled routines with ids, schedules, state and next run.
## `society-create-routine` — Schedule a routine for an agent
-The ONLY way to make an agent do something on a schedule (daily briefing, weekly report, every morning at 8). Never use create-skill for this. The prompt is the complete task the agent runs each time: sources, steps, output. Speak the returned next_run; on timezone_required ask the user.
+The ONLY way to make an agent do something on a schedule (daily briefing, weekly report, every morning at 8). Never use create-skill for this. The prompt is the complete task the agent runs each time: sources, steps, output. For a routine that watches something, write into the prompt that the agent stays quiet while nothing changed and reports only a real change, a completion, a failure or something the user must do, unless the user asked for regular updates. Speak the returned next_run; on timezone_required ask the user.
- **Endpoint:** `POST /api/society/agents/{agent_id}/routines`
- **Arguments:** `agent_id` (string; required); `title` (string; required); `prompt` (string; required); `schedule` (object; required); `announce_on_success` (string; optional)
diff --git a/jarvis/commands/registry.py b/jarvis/commands/registry.py
index 61753424aa..6ca331ad8a 100644
--- a/jarvis/commands/registry.py
+++ b/jarvis/commands/registry.py
@@ -418,7 +418,11 @@ def _build_registry() -> tuple[AppCommand, ...]:
"The ONLY way to make an agent do something on a schedule (daily briefing, "
"weekly report, every morning at 8). Never use create-skill for this. The "
"prompt is the complete task the agent runs each time: sources, steps, "
- "output. Speak the returned next_run; on timezone_required ask the user."
+ "output. For a routine that watches something, write into the prompt that "
+ "the agent stays quiet while nothing changed and reports only a real change, "
+ "a completion, a failure or something the user must do, unless the user "
+ "asked for regular updates. Speak the returned next_run; on "
+ "timezone_required ask the user."
),
# Not dangerous: the user ordered it, and a routine is paused or
# deleted in one step (a second spoken yes was a live complaint).
diff --git a/jarvis/core/agent_brief.py b/jarvis/core/agent_brief.py
index 5c1fb5516e..7a53d22029 100644
--- a/jarvis/core/agent_brief.py
+++ b/jarvis/core/agent_brief.py
@@ -19,7 +19,8 @@ from typing import Final
#: which has a byte budget (``jarvis.live.tools._CATALOG_BYTE_BUDGET``).
AGENT_BRIEF_RULE: Final[str] = (
"Write the brief as a work order the agent completes on its own: find the cause, "
- "make the change, verify it, then report what changed. 'Check', 'look into', "
+ "make the change, verify it, then report back what changed, where things stand "
+ "and any decision the user has to make; when blocked, report that too. 'Check', 'look into', "
"'deep dive' or 'audit' include fixing what is found. Never add read-only, "
"no-changes or report-only limits yourself; use them only when the user "
"explicitly asked just for analysis, a plan or an answer. Let the agent decide "
diff --git a/jarvis/live/config.py b/jarvis/live/config.py
index 416ef5449b..0cbb0a8d66 100644
--- a/jarvis/live/config.py
+++ b/jarvis/live/config.py
@@ -8,6 +8,7 @@ from pydantic import BaseModel, ConfigDict, Field
from jarvis.core.agent_brief import AGENT_BRIEF_RULE
from jarvis.cu.direct import COMPUTER_CONTROL_RULES
+from jarvis.live.coordination import WORK_STATUS_RULE, conversation_rules
from jarvis.live.product import PRODUCT_BRIEF
from jarvis.live.recovery import HISTORY_CONTEXT_RULE
@@ -120,13 +121,7 @@ class LiveConfig(BaseModel):
"A request for a NEW coding agent (or several: 'two Claude Code agents') is "
"workspace-orchestrate create in the named or visible workspace, with cli, "
"count and the task as prompt; never an existing agent and never spawn_worker. "
- "When the user asks how far the coding agents are, whether one is done, who "
- "is waiting for them, or which branch a workspace is on, call "
- "workspace-orchestrate status once: it covers every open agent and each "
- "workspace's git state. Say the takeaway in a sentence or two and name who "
- "needs the user; never read out lists, diffs or code. When the user wants to "
- "hear when an agent they started themselves is done, call watch for it; a "
- "task you sent is reported back on its own. "
+ + WORK_STATUS_RULE
+ AGENT_BRIEF_RULE
+ " "
+ (COMPUTER_CONTROL_RULES if computer else "")
@@ -165,7 +160,8 @@ class LiveConfig(BaseModel):
+ language_rule
+ HISTORY_CONTEXT_RULE
+ "Be natural, concise and helpful. "
- "Backchannel policy: Use moderate backchannels. "
+ + conversation_rules("the backend")
+ + "Backchannel policy: Use moderate backchannels. "
"Interruption policy: Listen when interrupted. "
"Stopping speech does not cancel work. "
"Call lifetime belongs to Dodaios. Delegate a hang-up request to the backend; "
diff --git a/jarvis/live/coordination.py b/jarvis/live/coordination.py
new file mode 100644
index 0000000000..5c951b5f4a
--- /dev/null
+++ b/jarvis/live/coordination.py
@@ -0,0 +1,56 @@
+"""How a live call decides between talking, a quick look and handing work over.
+
+One wording for every live engine. A session whose speaking model delegates to
+a separate reasoning backend and a session whose model calls its tools itself
+follow the same rules; only the name of what carries out the work differs.
+"""
+
+from __future__ import annotations
+
+from typing import Final
+
+#: For the model that executes tools: progress, sync and branch questions.
+WORK_STATUS_RULE: Final[str] = (
+ "When the user asks how far the coding agents are, whether one is done, who "
+ "is waiting for them, or which branch a workspace is on, call "
+ "workspace-orchestrate status once: it covers every open agent and each "
+ "workspace's git state. Say the takeaway in a sentence or two and name who "
+ "needs the user; never read out lists, diffs or code. When the user wants to "
+ "hear when an agent they started themselves is done, call watch for it; a "
+ "task you sent is reported back on its own. "
+)
+
+
+def conversation_rules(executor: str) -> str:
+ """The speaking model's rules; ``executor`` is what carries out work for it."""
+ return (
+ "On a clear request, act: do not repeat the request back, announce a plan or "
+ "narrate each step. "
+ "Handle a request in one of three ways. Talk it through: brainstorming, "
+ "prioritising, clarifying, quick advice and decisions stay in this conversation. "
+ "Take a quick look: a small, fast check that helps right now, such as the current "
+ "branch, how far the agents are or a short status, is one request to "
+ f"{executor}, answered in a sentence. Hand it over: slow or multi-step work "
+ "(implementing, investigating, researching, browsing, anything that can proceed "
+ f"on its own) goes to {executor}; keep talking with the user while it runs. When "
+ "that work needs a choice, have the options gathered and keep the decision in "
+ "this conversation. "
+ "For example: 'What should we do today?' is talked through. 'Which branch is "
+ "the installer on?' is a quick look. 'Implement that fix' is handed over. "
+ "When the user is brainstorming, exploring options or deciding what to build, "
+ "they are planning: stay in the conversation, ask one focused question at a time "
+ "about goals, constraints or trade-offs, then sum up the plan, and start no "
+ "implementation until they approve it. A clear request to do something now is "
+ "not planning; carry it out. "
+ "How often the user wants updates, how much detail and in which style are "
+ "preferences for the whole task: keep following them until the task ends or the "
+ "user changes them, also when a new result arrives. "
+ "Say the takeaway, the status or the next step. Never read out tables, lists, "
+ "diffs, code or logs unless the user asks for exactly that. "
+ "Running work can be corrected, redirected or stopped at any time: pass the "
+ f"user's change on to {executor} at once and never say it cannot be changed. "
+ f"Never tell the user something is impossible before {executor} has checked. "
+ )
+
+
+__all__ = ["WORK_STATUS_RULE", "conversation_rules"]
diff --git a/jarvis/live/native.py b/jarvis/live/native.py
index 37d29cf1f3..4c3fbbb2ab 100644
--- a/jarvis/live/native.py
+++ b/jarvis/live/native.py
@@ -18,6 +18,7 @@ from jarvis.core.paths import user_data_dir
from jarvis.core.runtime_refs import get_supervisor_tool_gateway
from jarvis.core.tool_budget import VOICE_TOOL_BUDGET_S
from jarvis.cu.direct import COMPUTER_CONTROL_RULES
+from jarvis.live.coordination import WORK_STATUS_RULE, conversation_rules
from jarvis.live.product import PRODUCT_BRIEF
from jarvis.live.runtime import claim, register, unregister
from jarvis.live.session import LiveVoiceSession, _identity
@@ -152,6 +153,7 @@ class NativeLiveVoiceSession(LiveVoiceSession):
+ PRODUCT_BRIEF
+ " "
+ language_rule
+ + conversation_rules("your tools")
+ "Use your tools directly "
"for actions, private information and current facts. Use discover_tools and "
"call_tool for any tool not declared directly. "
@@ -175,6 +177,7 @@ class NativeLiveVoiceSession(LiveVoiceSession):
"Explicit references override the visible workspace; ask on ambiguity. "
"Do not switch the UI to address another workspace. Reuse request_id on "
"retries and never replay uncertain delivery. "
+ + WORK_STATUS_RULE
+ AGENT_BRIEF_RULE
),
history=tuple(
diff --git a/jarvis/missions/kontrollierer/worker_prompt.py b/jarvis/missions/kontrollierer/worker_prompt.py
index fe0f5a0558..85a8e4495d 100644
--- a/jarvis/missions/kontrollierer/worker_prompt.py
+++ b/jarvis/missions/kontrollierer/worker_prompt.py
@@ -90,19 +90,33 @@ SUPERVISOR_BOUNDARY_DIRECTIVE: Final[str] = (
)
+# The worker's closing words are what the user hears about the mission. Left
+# alone they are a file list or nothing at all, so the readback could not say
+# whether the work is finished or what the user still has to decide.
+FINAL_REPORT_DIRECTIVE: Final[str] = (
+ "FINAL REPORT - CLOSE WITH A SHORT SUMMARY. End your work with a few plain "
+ "sentences: what you built or found, where things stand (done, partly done, "
+ "or blocked and why), and any decision the user still has to make. It is "
+ "read back to the user, so leave out file listings, commands and logs "
+ "unless they are the point. When you stop early or are blocked, say so "
+ "there instead of ending silently."
+)
+
+
def compose_worker_prompt(prior_block: str, step_prompt: str) -> str:
"""Build the full worker prompt: framing directives first.
- Leads with the artifact-language directive and then the output-shape
- directive, so both frame the whole task before any prior feedback or
- instruction is read. ``prior_block`` is the (possibly empty) rendered
- critic-reflection block that carries correction context across iterations.
- ``step_prompt`` is the task instruction for this step (verbatim user
- utterance or a decomposed sub-task).
+ Leads with the artifact-language directive, the output-shape directive,
+ the supervisor boundary and the final-report directive, so they frame the
+ whole task before any prior feedback or instruction is read.
+ ``prior_block`` is the (possibly empty) rendered critic-reflection block
+ that carries correction context across iterations. ``step_prompt`` is the
+ task instruction for this step (verbatim user utterance or a decomposed
+ sub-task).
"""
head = (
f"{ARTIFACT_LANGUAGE_DIRECTIVE}\n\n{OUTPUT_SHAPE_DIRECTIVE}\n\n"
- f"{SUPERVISOR_BOUNDARY_DIRECTIVE}"
+ f"{SUPERVISOR_BOUNDARY_DIRECTIVE}\n\n{FINAL_REPORT_DIRECTIVE}"
)
if prior_block and prior_block.strip():
return f"{head}\n\n{prior_block}\n\n{step_prompt}"
@@ -112,6 +126,7 @@ def compose_worker_prompt(prior_block: str, step_prompt: str) -> str:
__all__ = [
"ARTIFACT_LANGUAGE_DIRECTIVE",
"OUTPUT_SHAPE_DIRECTIVE",
+ "FINAL_REPORT_DIRECTIVE",
"SUPERVISOR_BOUNDARY_DIRECTIVE",
"compose_worker_prompt",
]
diff --git a/tests/missions/kontrollierer/test_worker_prompt.py b/tests/missions/kontrollierer/test_worker_prompt.py
index 579d0fa788..7f4e8e0a94 100644
--- a/tests/missions/kontrollierer/test_worker_prompt.py
+++ b/tests/missions/kontrollierer/test_worker_prompt.py
@@ -160,3 +160,20 @@ def test_compose_without_prior_block_has_no_dangling_separator() -> None:
out = compose_worker_prompt("", "do the thing")
assert "\n\n\n" not in out
assert out.strip() == out
+
+
+# --- final report ------------------------------------------------------------
+
+
+def test_every_worker_is_asked_to_close_with_outcome_status_and_open_decisions():
+ from jarvis.missions.kontrollierer.worker_prompt import FINAL_REPORT_DIRECTIVE
+
+ for prior in ("", "PRIOR FEEDBACK: tighten the layout"):
+ out = compose_worker_prompt(prior, "Build the report page")
+ assert FINAL_REPORT_DIRECTIVE in out
+ assert out.index(FINAL_REPORT_DIRECTIVE) < out.index("Build the report page")
+ text = FINAL_REPORT_DIRECTIVE.lower()
+ assert "what you built or found" in text
+ assert "where things stand" in text
+ assert "any decision the user still has to make" in text
+ assert "blocked" in text
diff --git a/tests/unit/live/test_coordination.py b/tests/unit/live/test_coordination.py
new file mode 100644
index 0000000000..47c3b810ee
--- /dev/null
+++ b/tests/unit/live/test_coordination.py
@@ -0,0 +1,70 @@
+"""Every live engine gets the same rules for talking, looking and handing over."""
+
+from __future__ import annotations
+
+import inspect
+
+from jarvis.core.agent_brief import AGENT_BRIEF_RULE
+from jarvis.live import native
+from jarvis.live.config import LiveConfig
+from jarvis.live.coordination import WORK_STATUS_RULE, conversation_rules
+
+
+def _wire(**profile) -> dict:
+ return LiveConfig(configured=True, backend_model="chosen-model", **profile).session_config(
+ language="en", tools=[]
+ )
+
+
+def test_speaking_model_is_told_how_to_handle_a_request():
+ rules = conversation_rules("the backend")
+ spoken = _wire()["instructions"]
+ assert rules in spoken
+ for behaviour in (
+ "Talk it through",
+ "Take a quick look",
+ "Hand it over",
+ "one focused question at a time",
+ "start no implementation until they approve",
+ "preferences for the whole task",
+ "Never read out tables, lists, diffs, code or logs",
+ "never say it cannot be changed",
+ ):
+ assert behaviour in rules, behaviour
+
+
+def test_a_clear_order_is_not_held_back_as_planning():
+ assert "A clear request to do something now is not planning" in conversation_rules("x")
+
+
+def test_rules_name_whatever_carries_out_the_work():
+ assert "the backend" in conversation_rules("the backend")
+ assert "the backend" not in conversation_rules("your tools")
+ assert "your tools" in conversation_rules("your tools")
+
+
+def test_subscription_calls_speak_under_the_same_rules():
+ wire = _wire(auth_mode="chatgpt_subscription", subscription_backend_model="chosen-model")
+ assert conversation_rules("the backend") in wire["instructions"]
+
+
+def test_the_executing_model_knows_the_status_board_on_every_engine():
+ assert WORK_STATUS_RULE in _wire()["delegation"]["responses"]["instructions"]
+ source = inspect.getsource(native.NativeLiveVoiceSession)
+ assert "WORK_STATUS_RULE" in source
+ assert 'conversation_rules("your tools")' in source
+
+
+def test_a_brief_asks_the_agent_to_report_status_decisions_and_blockers():
+ rule = AGENT_BRIEF_RULE.lower()
+ assert "report back what changed" in rule
+ assert "any decision the user has to make" in rule
+ assert "when blocked, report that too" in rule
+
+
+def test_the_prompts_leave_room_for_tools_and_history_on_small_wires():
+ # One session.started message carries both prompts, the tool declarations
+ # (24 kB budget) and the history seed inside a 64 KiB limit.
+ wire = _wire()
+ prompts = wire["instructions"] + wire["delegation"]["responses"]["instructions"]
+ assert len(prompts.encode("utf-8")) < 20_000