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(agentic-ide): give the voice model a brief workspace view instead of the UI snapshot

Ruben Lütke3385bc761a13
diff --git a/docs/commands-reference.md b/docs/commands-reference.md
index b87bae7746..f96fb3e97b 100644
--- a/docs/commands-reference.md
+++ b/docs/commands-reference.md
@@ -245,7 +245,7 @@ Cancel a running or scheduled task by id.
Report the open Agentic-IDE workspace: which folder, which coding agents run in which named terminals, and whether the focused coding mode is on.
-- **Endpoint:** `GET /api/agentic-ide/state`
+- **Endpoint:** `GET /api/agentic-ide/state/brief`
- **Arguments:** none
- **Requires confirmation:** no
- **Desktop UI section:** `agentic-ide`
diff --git a/jarvis/agentic_ide/context.py b/jarvis/agentic_ide/context.py
index c567e657ec..0f67d22861 100644
--- a/jarvis/agentic_ide/context.py
+++ b/jarvis/agentic_ide/context.py
@@ -31,8 +31,14 @@ from __future__ import annotations
import time
# Per-terminal output shown in the block. Enough to say what an agent is doing,
-# small enough that ten panes do not crowd out the conversation.
+# small enough that ten panes do not crowd out the conversation. Past
+# _CROWDED_AT panes the per-pane share shrinks: the block is hard-capped at
+# _MAX_CHARS, and six lines each meant the cap silently dropped the LAST panes
+# entirely — three lines each keeps every pane visible AND costs fewer of the
+# ~1 100 uncacheable input tokens this block adds to every turn.
_LINES_PER_TERMINAL = 6
+_LINES_PER_TERMINAL_CROWDED = 3
+_CROWDED_AT = 5
_MAX_CHARS = 4500
_HEADER = (
@@ -78,7 +84,7 @@ _HEADER = (
)
-def _terminal_block(term) -> list[str]: # noqa: ANN001 - Terminal, avoid import cycle
+def _terminal_block(term, tail_lines: int = _LINES_PER_TERMINAL) -> list[str]: # noqa: ANN001 - Terminal, avoid import cycle
status = term.status
bits = [f"{term.name} ({term.display_name}) — {status}"]
if status == "live" and term.last_output_at:
@@ -93,7 +99,7 @@ def _terminal_block(term) -> list[str]: # noqa: ANN001 - Terminal, avoid import
lines = [f"- {', '.join(bits)}"]
if term.last_prompt:
lines.append(f' last prompt sent: "{term.last_prompt[:200]}"')
- tail = term.transcript.tail(_LINES_PER_TERMINAL)
+ tail = term.transcript.tail(tail_lines)
if tail:
lines.append(" recent output:")
lines.extend(f" {line[:200]}" for line in tail)
@@ -115,9 +121,14 @@ def focus_context_block(max_chars: int = _MAX_CHARS) -> str:
parts.extend(session.profile.summary_lines())
parts.append("")
if session.terminals:
+ tail_lines = (
+ _LINES_PER_TERMINAL
+ if len(session.terminals) < _CROWDED_AT
+ else _LINES_PER_TERMINAL_CROWDED
+ )
parts.append(f"Terminals in this workspace ({len(session.terminals)}):")
for term in session.terminals:
- parts.extend(_terminal_block(term))
+ parts.extend(_terminal_block(term, tail_lines))
else:
parts.append("No terminals are open in this workspace yet.")
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index ed56412c47..eb53621731 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -797,7 +797,12 @@ class Terminal:
None if self.last_output_at is None else round(time.time() - self.last_output_at, 1)
),
"prompts_sent": self.prompts_sent,
- "last_prompt": self.last_prompt,
+ # A composed brief runs to MAX_PROMPT_CHARS (6 000); nothing reads
+ # more than the opening line back (the UI never renders the field
+ # at all), while the full text used to ride along in every /state
+ # poll AND every model-facing status payload — per pane. 200 chars
+ # matches the focus block's per-pane budget.
+ "last_prompt": self.last_prompt[:200],
"submitted": self.submitted,
"lines_captured": len(lines),
# What this pane is doing, in the two lengths the header needs: one
@@ -891,6 +896,41 @@ class Session:
"terminals": [t.to_dict() for t in self.terminals],
}
+ def to_brief(self) -> dict[str, Any]:
+ """This workspace as a language model needs it to steer the panes.
+
+ Deliberately not ``to_dict``: the full state runs to ~25 000
+ characters (profiles, prompts, transcript statistics), which a
+ tool-result cap then slices mid-JSON — the model pays thousands of
+ input tokens per loop iteration for a broken fragment. Steering
+ needs exactly: which pane, which agent, alive or not, busy or idle,
+ and one recap line of what it is doing.
+ """
+ terminals = []
+ for term in self.terminals:
+ lines = term.transcript.lines()
+ summary = recap_engine.recap_for(term, lines=lines)
+ terminals.append(
+ {
+ "name": term.name,
+ "agent": term.agent,
+ "status": term.status,
+ "accepts_prompts": accepts_prompts(term.agent),
+ "idle_seconds": (
+ None
+ if term.last_output_at is None
+ else round(time.time() - term.last_output_at, 1)
+ ),
+ "recap": summary.headline,
+ }
+ )
+ return {
+ "folder": self.folder,
+ "name": self.name,
+ "focus_mode": self.focus_mode,
+ "terminals": terminals,
+ }
+
def to_card(self, *, active: bool) -> dict[str, Any]:
"""This workspace as one tab in the workspace bar.
@@ -1024,6 +1064,20 @@ class Registry:
"accounts": self.active_accounts(),
}
+ def brief_state(self) -> dict[str, Any]:
+ """The workspace as the voice/tool model reads it — see ``to_brief``."""
+ session = self.session
+ return {
+ "active": session is not None,
+ "workspace": session.to_brief() if session else None,
+ "max_terminals": MAX_TERMINALS,
+ "other_workspaces": [
+ {"name": s.name, "terminals": len(s.terminals)}
+ for s in self._sessions.values()
+ if session is None or s.id != session.id
+ ],
+ }
+
# ------------------------------------------------------------- accounts
def active_account_id(self, agent: str) -> str | None:
"""Which subscription of ``agent`` the next new pane opens on.
diff --git a/jarvis/commands/registry.py b/jarvis/commands/registry.py
index 484f2afa4b..1c713ac83f 100644
--- a/jarvis/commands/registry.py
+++ b/jarvis/commands/registry.py
@@ -635,7 +635,11 @@ def _build_registry() -> tuple[AppCommand, ...]:
"focused coding mode is on."
),
method="GET",
- path="/api/agentic-ide/state",
+ # The brief projection, deliberately not /state: the full state is
+ # a ~25 000-character UI snapshot whose tail the tool-result cap
+ # slices off mid-JSON — the model paid ~2 000 input tokens per
+ # loop iteration for a broken fragment (2026-07-28 cost audit).
+ path="/api/agentic-ide/state/brief",
ui_section="agentic-ide",
voice_aliases={
"de": ("was läuft in der agentic ide",), # i18n-allow: input vocab
@@ -662,6 +666,13 @@ def _build_registry() -> tuple[AppCommand, ...]:
"lines": {
"type": "integer",
"default": 40,
+ # Model-facing ceiling only; the REST route itself
+ # clamps at 300 for the UI. Past ~60 lines the
+ # tool-result cap truncates the report anyway, so a
+ # larger ask just burns input tokens on every
+ # further loop iteration (2026-07-28 cost audit).
+ "minimum": 1,
+ "maximum": 60,
"description": "How many recent output lines to read.",
},
},
diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.py
index 4074d0ddaf..6f29b85b86 100644
--- a/jarvis/ui/web/agentic_ide_routes.py
+++ b/jarvis/ui/web/agentic_ide_routes.py
@@ -794,6 +794,19 @@ async def get_state() -> dict:
return get_registry().state()
[email protected]("/state/brief", summary="Agentic-IDE workspace state, briefly")
+async def get_state_brief() -> dict:
+ """The workspace as a language model needs it to steer the panes.
+
+ Pane names, agents, status, idleness, and one recap line each — never
+ transcripts, prompts, or project profiles. This is what the
+ ``agentic-ide-status`` voice command reads; the full ``/state`` payload
+ is the UI's and runs ~25 000 characters, which a model-facing
+ tool-result cap would slice mid-JSON.
+ """
+ return get_registry().brief_state()
+
+
@router.get("/agents", response_model=AgentsResponse, summary="Coding agents available")
async def get_agents() -> AgentsResponse:
"""What this machine can open in a terminal, and how to install it.