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
"""Human-facing chat runners share the reporting policy; voice keeps spoken rules."""
from pathlib import Path
import pytest
from dodaios.agent_chat import dodaios_harness
from dodaios.agent_chat.runner_api import system_prompt
from dodaios.brain.manager import _WRITTEN_CHAT_STYLE
from dodaios.brain.persona_loader import load_compact_persona_prompt, load_persona_prompt
from dodaios.core.response_style import (
CONVERSATIONAL_RESPONSE_STYLE,
CONVERSATIONAL_TURN_REMINDER,
)
def test_api_and_main_chat_receive_the_same_reporting_policy(tmp_path: Path) -> None:
prompt = system_prompt(cwd=tmp_path, assistant_name="Assistant")
assert CONVERSATIONAL_RESPONSE_STYLE in prompt
assert CONVERSATIONAL_RESPONSE_STYLE in _WRITTEN_CHAT_STYLE
def test_fresh_and_resumed_defaults_allow_detail_and_preserve_essential_information() -> None:
assert CONVERSATIONAL_TURN_REMINDER in CONVERSATIONAL_RESPONSE_STYLE
for policy in (CONVERSATIONAL_RESPONSE_STYLE, CONVERSATIONAL_TURN_REMINDER):
assert "one or two short paragraphs" in policy
assert "is not technical" in policy
assert "Go longer only when asked or needed" in policy
assert "failure evidence" in policy
assert "Follow explicit user preferences" in policy
def test_reply_style_keeps_the_person_oriented_without_a_persona() -> None:
# State first, a line before the first tool call, concrete outcome, plain words.
for phrase in (
"reads only your messages",
"open with the state or the answer",
"Before your first tool call",
"concrete terms (numbers, times, names)",
"no headings",
):
assert phrase in CONVERSATIONAL_RESPONSE_STYLE, phrase
# A general style: no persona, name or flirt register leaks in.
for leak in ("Jenny", "flirt", "Discord"):
assert leak not in CONVERSATIONAL_RESPONSE_STYLE
async def test_cli_without_brain_layers_still_receives_the_shared_default(monkeypatch) -> None:
monkeypatch.setattr(dodaios_harness, "_brain", lambda: None)
prompt = await dodaios_harness.identity_prompt(user_text="Hello", history=[], resume=None)
assert CONVERSATIONAL_TURN_REMINDER in prompt
assert "think longer and go deeper" not in prompt
assert "Frontier-lab style" not in prompt
def test_plan_mode_keeps_its_read_only_contract(tmp_path: Path) -> None:
prompt = system_prompt(cwd=tmp_path, assistant_name="Assistant", plan=True)
assert CONVERSATIONAL_RESPONSE_STYLE in prompt
assert "PLAN MODE is on" in prompt
assert "you have no tools that change anything" in prompt
def test_both_voice_personas_include_reporting_without_losing_spoken_rules() -> None:
for prompt in (load_persona_prompt(), load_compact_persona_prompt()):
assert "REPORTING RESULTS" in prompt
assert "SPOKEN" in prompt
assert "spell every number" in prompt
@pytest.mark.parametrize("briefed", [True, False])
def test_society_api_turn_carries_the_reply_policy_exactly_once(briefed: bool) -> None:
from types import SimpleNamespace
from dodaios.brain.manager import _TURN_OVERRIDE, BrainManager
from dodaios.brain.turn_override import TurnOverride
briefing = "## How to reply to the person\n" + CONVERSATIONAL_RESPONSE_STYLE
manager = BrainManager.__new__(BrainManager)
manager._config = SimpleNamespace(performance=SimpleNamespace(cache_optimized_prompt=True))
manager._render_live_tool_block = lambda: "TOOLS"
manager._reply_language_directive = lambda: "LANGUAGE"
token = _TURN_OVERRIDE.set(
TurnOverride(
provider="test",
system_extra=briefing if briefed else "## Agent\nScout",
tool_context={"tool_origin": "society"},
)
)
try:
prompt = manager._build_system_prompt()
finally:
_TURN_OVERRIDE.reset(token)
assert prompt.count(CONVERSATIONAL_RESPONSE_STYLE) == 1
assert "WRITTEN CHAT STYLE" in prompt