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.

fix(chat): default agent replies to short natural conversation

rubenluetke10-beepe258399cdd27
diff --git a/jarvis/agent_chat/jarvis_harness.py b/jarvis/agent_chat/jarvis_harness.py
index 08b06bbe00..7317350901 100644
--- a/jarvis/agent_chat/jarvis_harness.py
+++ b/jarvis/agent_chat/jarvis_harness.py
@@ -43,6 +43,8 @@ from dataclasses import dataclass
from pathlib import Path
from typing import Any, Final
+from jarvis.core.response_style import CONVERSATIONAL_TURN_REMINDER
+
log = logging.getLogger(__name__)
#: Where the tool server is mounted on the app's own web server. The trailing
@@ -70,9 +72,9 @@ SYSTEM_PREAMBLE: Final[str] = (
"stated at the top of this prompt), running as "
"the chat surface of the Personal Jarvis desktop app that is open in front of "
"them right now. This chat is the same assistant they otherwise talk to by "
- "voice; the only difference is that here they type, and here you are expected "
- "to think longer and go deeper.\n\n"
- "Write in a professional Frontier-lab style: direct and precise, no hype, "
+ "voice; here they type and read your replies on screen.\n\n"
+ + CONVERSATIONAL_TURN_REMINDER
+ + "\n\nWrite naturally: direct and precise, no hype, "
"no marketing superlatives, no filler openers. NEVER use emojis unless the "
"person explicitly asks for one in this turn — no emoji headings, tables, "
"status icons or closers. Tables carry plain words, never emoji symbols.\n\n"
diff --git a/jarvis/agent_chat/runner_api.py b/jarvis/agent_chat/runner_api.py
index 620e00e3d9..07e08ddaa8 100644
--- a/jarvis/agent_chat/runner_api.py
+++ b/jarvis/agent_chat/runner_api.py
@@ -1,6 +1,6 @@
"""The in-process agent loop — one turn on a provider's chat API.
-This is "our own Claude Code": the provider's own streaming chat API
+The provider's own streaming chat API
(``jarvis.plugins.brain.*``) driven in a tool-use loop over
:mod:`jarvis.agent_chat.tools`. Per round the model streams text (forwarded
live as ``text_delta``), may request tool calls, each call is gated by the
@@ -92,7 +92,7 @@ def build_brain(provider: str, model: str) -> Any:
def system_prompt(*, cwd: Path, assistant_name: str, plan: bool = False) -> str:
- """The Claude-Code-shaped operating instructions for the API runner.
+ """Operating instructions for the interactive API chat runner.
``plan`` is the composer's Plan mode: the model gets only the reading
tools and is told to investigate and lay out a plan instead of acting.
@@ -108,8 +108,8 @@ def system_prompt(*, cwd: Path, assistant_name: str, plan: bool = False) -> str:
)
return (
f"You are {assistant_name}, an expert software engineer and general assistant "
- "working as an interactive coding agent in the person's own environment — the "
- "same job Claude Code does in a terminal, here inside a chat window.\n\n"
+ "working as an interactive coding agent in the person's own environment, "
+ "here inside a chat window.\n\n"
f"Working directory: {cwd}\n"
f"Operating system: {platform.system()} {platform.release()}\n"
f"Shell for RunCommand: {shell_label()}\n"
@@ -121,11 +121,11 @@ def system_prompt(*, cwd: Path, assistant_name: str, plan: bool = False) -> str:
"style of the surrounding code.\n"
"- A tool result marked denied means the person declined that action. Do not "
"retry it; explain what you would have done and ask, or find another way.\n"
- "- Be concise. Lead with the outcome. Use Markdown: headings only when they "
- "help, fenced code blocks with a language tag, file paths in backticks.\n"
+ "- When sharing code, use fenced blocks with a language tag; put file paths "
+ "in backticks.\n"
"- Never invent file contents, command output or results you did not observe.\n"
- "- When the task is done, stop calling tools and give a short summary of what "
- "changed and anything the person should do next.\n\n"
+ "- When the task is done, stop calling tools. Briefly state the result and "
+ "any important limitation; include a next action only if one is needed.\n\n"
+ CONVERSATIONAL_RESPONSE_STYLE
+ plan_note
)
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index 784cab7874..c461b80dca 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -2373,30 +2373,28 @@ _TOOL_LIST_RULE = (
# dump, and the token cost is identical either way.
_TOOL_LIST_WRAP_CHARS = 88
-# Professional style for typed (written) turns: the front-page chat, society
+# Conversational style for typed (written) turns: the front-page chat, society
# chats and every other surface with {"delivery": "written"}. The shared
# system prompt carries the VOICE persona ("never emit Markdown, never write
# a digit, no emojis — your text is spoken"), which is correct for speech but
# leaves a typed turn with no visual rules at all. Without an explicit
# written block the model falls back to its pretraining default: emoji
-# headers, hype openers ("echter Volltreffer!"), status-dot tables and three
+# headers, hype openers, status-dot tables and three
# redundant closers. This block overrides the spoken-output rules for written
-# turns only and pins the Frontier-lab default: calm, plain, zero emojis.
+# turns only. The shared policy below controls length and conversational tone.
_WRITTEN_CHAT_STYLE = (
"WRITTEN CHAT STYLE (this is a typed turn read on screen, NOT voice — "
"this block overrides the voice persona's spoken-output rules for this turn):\n"
- "This answer is read, not spoken: Markdown (headings, tables, lists, code) "
- "and digits ARE allowed here.\n"
- "Write in a professional, calm Frontier-lab style: direct, precise, no hype, "
+ "This answer is read, not spoken: digits and Markdown are allowed when useful; "
+ "plain chat prose is the default.\n"
+ "Write in a natural, calm style: direct, precise, no hype, "
"no marketing superlatives, no filler openers, no pep-talk before the content.\n"
"NEVER use emojis — not in headings, tables, lists, status columns or body "
"text. Zero emojis unless the user explicitly asks for one in this turn. "
"No emoji status icons (no colored dots, rockets, folders, pointers, check "
"marks as emoji): use plain words such as No risk, Low, Medium, Check first.\n"
- "Structure: lead with the result in one or two sentences, then the details. "
- "Tables only for genuinely tabular data, with plain-text headers and no emoji "
- "column. Keep it tight: one concrete next step at most, never a triple of "
- "summary plus action plan plus emoji question."
+ "Use tables only when requested or when they clarify genuinely tabular data, "
+ "with plain-text headers and no emoji column."
)
# Keep the API chat and the main brain's written delivery equally conversational.
diff --git a/jarvis/core/response_style.py b/jarvis/core/response_style.py
index 6259a4b373..de61bb6318 100644
--- a/jarvis/core/response_style.py
+++ b/jarvis/core/response_style.py
@@ -49,21 +49,27 @@ KEEP_GOING_ON_TOOL_FAILURE = (
)
CONVERSATIONAL_TURN_REMINDER = (
- "Reply naturally in short paragraphs, one idea per paragraph. Answer the latest "
- "point directly, with the observed result first. No mandatory report headings or "
- "handoff checklist. Explain tool results instead of dumping JSON. Share meaningful "
- "new findings as work proceeds, without narrating every click. Use a short list "
- "only when comparing items; expand when the person asks for detail. Keep explicit "
- "user preferences and the selected language. Do not invent outcomes, ongoing work "
- "or a next step just to end with one."
+ "Keep replies short, direct and natural by default, like an everyday chat. "
+ "For a routine reply, aim for one to three short sentences in one paragraph; "
+ "a simple confirmation may need only one sentence. Lead with the answer or "
+ "observed outcome. Expand only when the user asks for detail or the task needs "
+ "it for a complete, useful answer; this is a default, not a hard length limit. "
+ "Skip report headings, repeated summaries, filler and obligatory closing offers. "
+ "Use a short list or headings only when requested or when they make necessary "
+ "detail easier to follow. Keep important results, blockers, uncertainty and "
+ "essential questions clear, even when that takes more space. Follow explicit "
+ "user preferences and the turn's selected language."
)
+# The same default reaches fresh prompts and resumed vendor sessions. Brevity
+# belongs in the instructions, never in a text slicer or a reduced token budget:
+# requested code, detailed answers and failure evidence must remain complete.
CONVERSATIONAL_RESPONSE_STYLE = (
- "Conversational reporting: sound like a capable, approachable colleague. "
- "Lead with the answer or observed outcome, then explain what it means for the person. "
- "For routine work, one short paragraph is usually enough; add detail when requested "
- "or needed to understand a decision. Use natural, complete sentences, not slogans, "
- "telegraphic status fragments or a formal report template. "
+ CONVERSATIONAL_TURN_REMINDER
+ + "\n\nSound like a capable, approachable colleague. Use ordinary words and complete "
+ "sentences, not slogans, clipped status fragments or a formal report template. "
+ "Do not repeat the user's request or restate a fact in an introduction, a list "
+ "and a conclusion. Finish when the useful information has been delivered. "
"Interpret tool results in plain language. Do not paste raw JSON envelopes, token "
"counts, internal provider names or empty result fields into the answer unless the "
"person explicitly asks for raw data or debugging details. Preserve requested code, "
@@ -71,36 +77,14 @@ CONVERSATIONAL_RESPONSE_STYLE = (
"Distinguish intended, attempted, pending and verified work: a successful tool call "
"does not by itself prove the user's goal was achieved. State partial success or "
"failure plainly, with the relevant reason and at most one next action. "
- "During work, report meaningful new information rather than repeating that you "
- "are checking. Never promise ongoing monitoring without a confirmed active schedule. "
- "Ask only for information that changes the next action; do not end every reply with "
- "a question or repeat the user's request. Follow explicit user preferences for length "
- "and tone, and the turn's already-selected output language."
- "\n\nConversation shape:\n"
- "- Reply to the person's latest point directly. Usually use one to three sentences "
- "per paragraph, with one idea per paragraph and ordinary words. Do not turn every "
- "answer into sections named Result, Analysis, Summary or Next steps.\n"
- "- Keep a real conversation moving: when a meaningful tool stage finishes, explain "
- "the new finding briefly before continuing if useful. Do not save every finding "
- "for one large final report, narrate every click, or split one thought into many "
- "messages. If nothing new happened, do not send another progress update.\n"
- "- For a correction, acknowledge the specific change once and apply it; do not "
+ "Progress updates should be brief and add meaningful new information. Do not "
+ "narrate every click, repeat that you are checking, or split one thought into many "
+ "messages. Never promise ongoing monitoring without a confirmed active schedule. "
+ "Ask only for essential missing information that changes the next action; "
+ "do not end every reply with a question or invent a next step. "
+ "For a correction, acknowledge the specific change once and apply it; do not "
"restart the explanation or defend the old answer. If evidence contradicts the "
- "person's assumption, explain that calmly rather than agreeing automatically.\n"
- "- A comparison may use a short list. A difficult explanation may need several "
- "short paragraphs. Supply all requested detail, but do not restate the same facts "
- "in an introduction, a list and a conclusion. Finish when the useful information "
- "has been delivered; no obligatory offer, question or handoff checklist.\n"
- "- Keep implementation vocabulary in the tool details unless it explains a real "
- "limitation. Say what works, what is missing, and what the person needs to do.\n"
- "\nIllustrations of tone and structure, not facts to claim or scripts to copy. "
- "Adapt them to the evidence and the selected language:\n"
- "Verified outcome: 'The page opened correctly. Its heading is Example Domain.'\n"
- "Partial access: 'I can read the account, but posting is not connected yet. "
- "Use the connection card to enable it.' Only mention a card if it exists.\n"
- "Correction: 'Understood. Future release posts will include a short description "
- "of the changes.' This describes intent; confirm saving only after the tool succeeds.\n"
- "New finding: 'The upload failed because this connection lacks upload access. "
- "Reading still works; I am checking the available connection options.' "
- "Use a progress statement only while actually continuing the work."
+ "person's assumption, explain that calmly rather than agreeing automatically. "
+ "Keep implementation vocabulary in the tool details unless it explains a real "
+ "limitation. Say what works, what is missing, and what the person needs to do."
)
diff --git a/tests/unit/agent_chat/test_agent_chat_service.py b/tests/unit/agent_chat/test_agent_chat_service.py
index 89d4d85030..07a0e3d8bd 100644
--- a/tests/unit/agent_chat/test_agent_chat_service.py
+++ b/tests/unit/agent_chat/test_agent_chat_service.py
@@ -17,6 +17,7 @@ from jarvis.agent_chat.catalog import rows_for
from jarvis.agent_chat.service import AgentChatService, SessionBusy
from jarvis.agent_chat.store import AgentChatStore
from jarvis.core.protocols import BrainDelta, BrainRequest
+from jarvis.core.response_style import CONVERSATIONAL_RESPONSE_STYLE
from jarvis.ui.web.agent_chat_routes import router
@@ -55,6 +56,57 @@ def scripted(monkeypatch: pytest.MonkeyPatch):
return ScriptedBrain
+ ("user_text", "reply"),
+ [
+ ("What is two plus two?", "Four."),
+ (
+ "Explain all the steps in detail and include the code.",
+ "## Steps\n" + "Explain the next step completely.\n" * 100
+ + "\n```python\nprint('complete')\n```",
+ ),
+ (
+ "What happened to the upload?",
+ "The draft is saved, but the upload failed because the connection expired. "
+ "Reconnect the account to finish uploading.",
+ ),
+ ],
+ ids=["brief-answer", "requested-detail", "partial-failure"],
+)
+async def test_api_stream_preserves_complete_replies_under_the_short_default(
+ tmp_path: Path, scripted, user_text: str, reply: str,
+) -> None:
+ scripted.script = [[BrainDelta(content=reply[:12]), BrainDelta(content=reply[12:])]]
+ events = []
+
+ async def emit(event):
+ events.append(event)
+
+ async def no_approval(*args):
+ pytest.fail("A text-only turn must not request approval")
+
+ store = AgentChatStore(":memory:")
+ try:
+ session = store.create_session(
+ provider="fakeprov", model="m", effort="high", cwd=str(tmp_path)
+ )
+ handle = runner_api.TurnHandle(
+ session=session, turn_id="style-test", emit=emit, request_approval=no_approval,
+ cancel=asyncio.Event(), output_language="es",
+ )
+ await runner_api.run_api_turn(handle, user_text)
+ sent = scripted.seen[0]
+ assert CONVERSATIONAL_RESPONSE_STYLE in sent.system
+ assert "Respond in this language: es" in sent.system
+ assert sent.messages[-1].content == user_text
+ assert sent.max_tokens == runner_api.MAX_TOKENS
+ assert "".join(e["payload"]["text"] for e in events if e["kind"] == "text_delta") == reply
+ assert [e["payload"]["text"] for e in events if e["kind"] == "assistant_text"] == [reply]
+ assert events[-1]["payload"]["status"] == "done"
+ finally:
+ store.close()
+
+
async def _drain(q: asyncio.Queue, until_kind: str, timeout: float = 5.0) -> list[dict[str, Any]]:
out: list[dict[str, Any]] = []
loop = asyncio.get_running_loop()
diff --git a/tests/unit/agent_chat/test_response_style.py b/tests/unit/agent_chat/test_response_style.py
index abf9d85752..ddea242c7b 100644
--- a/tests/unit/agent_chat/test_response_style.py
+++ b/tests/unit/agent_chat/test_response_style.py
@@ -2,10 +2,14 @@
from pathlib import Path
+from jarvis.agent_chat import jarvis_harness
from jarvis.agent_chat.runner_api import system_prompt
from jarvis.brain.manager import _WRITTEN_CHAT_STYLE
from jarvis.brain.persona_loader import load_compact_persona_prompt, load_persona_prompt
-from jarvis.core.response_style import CONVERSATIONAL_RESPONSE_STYLE
+from jarvis.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:
@@ -14,6 +18,24 @@ def test_api_and_main_chat_receive_the_same_reporting_policy(tmp_path: Path) ->
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 to three short sentences in one paragraph" in policy
+ assert "user asks for detail or the task needs" in policy
+ assert "not a hard length limit" in policy
+ assert "blockers, uncertainty and essential questions" in policy
+ assert "Follow explicit user preferences" in policy
+
+
+async def test_cli_without_brain_layers_still_receives_the_shared_default(monkeypatch) -> None:
+ monkeypatch.setattr(jarvis_harness, "_brain", lambda: None)
+ prompt = await jarvis_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
diff --git a/tests/unit/society/test_reply_style.py b/tests/unit/society/test_reply_style.py
index a7e059312d..233fc132d0 100644
--- a/tests/unit/society/test_reply_style.py
+++ b/tests/unit/society/test_reply_style.py
@@ -1,5 +1,7 @@
"""Agent-specific API and CLI briefings retain conversational reply guidance."""
+import pytest
+
from jarvis.agent_chat.jarvis_harness import Identity, compact_identity, identity_prompt
from jarvis.agent_chat.runner_cli import _with_identity
from jarvis.core.response_style import (
@@ -60,3 +62,19 @@ async def test_reply_policy_survives_long_instructions_in_a_compact_cli_identity
assert len(compact) < len(identity)
assert CONVERSATIONAL_RESPONSE_STYLE in compact
assert KEEP_GOING_ON_TOOL_FAILURE in compact
+
+
[email protected]("resume", [None, "existing-vendor-session"])
[email protected]("compact", [False, True])
+async def test_cli_keeps_explicit_detail_requests_with_the_shared_default(resume, compact) -> None:
+ request = "Explain each step in detail, include the full code, and answer in Spanish."
+ prompt = await identity_prompt(
+ user_text=request, history=[], resume=resume, prompt_override=_briefing()
+ )
+ seat = Identity(
+ session_id="society:reply-style-test", text=prompt, compact=compact_identity(prompt)
+ )
+ delivered = _with_identity(request, seat, resume, compact=compact)
+ assert CONVERSATIONAL_TURN_REMINDER in delivered
+ assert delivered.endswith(request)
+ assert "think longer and go deeper" not in delivered