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(society): the lead knows its society - team card, DELEGATE way, voice parity, results come back

rubenluetke10-beepb7f06d7ba86f
diff --git a/docs/agent-society/MASTERPLAN.md b/docs/agent-society/MASTERPLAN.md
index bcf23bce7f..7e658c4600 100644
--- a/docs/agent-society/MASTERPLAN.md
+++ b/docs/agent-society/MASTERPLAN.md
@@ -21,8 +21,14 @@ and `society-status` (ADR-0011 amendment). **Agent mechanics wave (2026-09-02):*
has its own contained shell and file hands, its own persistent browser through browser-use
(out of process, login sessions for the user's accounts, attach mode), and learns
automatically — finished tasks become skills in its own namespace (see
-`agent-definition.md` §3.1). **M3 world** is the maintainer's parallel track. Open in M4:
-rooms live under the scheduler, the curator.
+`agent-definition.md` §3.1). **The lead knows the society (2026-09-03):** Jarvis' prompt
+carries the team card (roster + hands, byte-stable, current on the next turn after any roster
+write), the router's decision table has a DELEGATE way ahead of `spawn_worker`, the realtime
+session gets a names directive and the turn planner a `SOCIETY` reason, `delegate_to_agent`
+picks the fitting agent when no name is given, and a lead-assigned result comes back as a
+spoken completion plus a notice in the front-page chat (`agent-definition.md` §3.5). **M3
+world** is the maintainer's parallel track. Open in M4: rooms live under the scheduler, the
+curator.
The research behind every claim here lives in [`research/`](research/):
[Branch A — product & UI](research/branch-a-product-ui.md) (Hermes Agent, Grok Bot, 3D stack,
diff --git a/docs/agent-society/agent-definition.md b/docs/agent-society/agent-definition.md
index dc0e83ae6a..a542e9b5c7 100644
--- a/docs/agent-society/agent-definition.md
+++ b/docs/agent-society/agent-definition.md
@@ -220,6 +220,42 @@ it.
The anti-harm blacklist class (mass outbound, credential probing, repeated actions against
non-consenting endpoints) is seeded at tier `block` and is not overridable by any agent field.
+### 3.5 The lead's team card — how Jarvis knows the society
+
+Jarvis is the harness itself and the one lead; it never runs on the society surface, so §3.3
+gives it nothing. Until 2026-09-03 its router prompt still described the retired sub-agent
+(mission worker) system and listed the word "Agent" as the trigger for `spawn_worker` —
+asked "which agents do you have?", Jarvis answered from that system while a freshly created
+Gmail agent stood on the island. The team card (`jarvis/society/lead_card.py`) is the fix:
+
+- **What it is.** A deterministic, byte-stable block rendered from the roster snapshot and the
+ capability catalog — no model call, no database read on the hot path. A rule block (what
+ "agent" means, `delegate_to_agent` for work, `society_status` for questions, `spawn_worker`
+ only for heavy background work no agent covers, coding terminals are not agents), then one
+ line per live agent: name, title, tier, state (`idle` / `busy (n runs)` / `paused`), hands
+ (focus labels; granted labels; or "every connected tool") and a 140-char brief. Archived
+ agents are left out. Open Agentic-IDE terminals are listed on their own line, marked as not
+ society agents. A roster epoch closes the card.
+- **Where it goes.** `BrainManager._build_system_prompt` appends it beside the CLI section on
+ every prompt build (typed front-page chat AND every delegated voice turn), except on a
+ society agent's own turn, which carries its briefing instead. The realtime session condenses
+ it to a per-turn directive (`_society_directive`: names + the routing rule; the hands stay
+ with the orchestrator), and the turn planner takes the names (`plan_turn(agent_names=…)`,
+ `TurnReason.SOCIETY`) so a turn naming an agent or asking about the team is routed to the
+ orchestrator, never answered natively.
+- **How it stays current.** `Roster` refreshes an in-memory snapshot on every write, so an
+ agent created in the Agents section is on the very next turn's card — no restart, no hook,
+ no model call. `Roster.epoch` is the cheap "did the team change" probe.
+- **The loop closes.** `delegate_to_agent` takes an optional name: without one (or with a
+ name the roster does not know, "email agent") the lead picks the agent whose focus fits the
+ task (`SocietyRuntime.pick_agent`, `derive_focus` over the task text) or says that nobody
+ fits. When a lead-assigned run ends, `SocietyRuntime.report_to_lead` posts a `notice` event
+ into the newest front-page chat session (rendered as a muted result line) and publishes an
+ `AnnouncementRequested(kind="completion")` the TTS pipeline and the realtime session speak.
+- **Words.** The section is "Agents" (`nav.agents`); the Agentic IDE holds "coding terminals"
+ in every prompt and directive; `navigate` maps "society", "team", "island", "my agents" to
+ the section and "terminals", "terminal grid" to the IDE.
+
---
## 4. Talking: agents, Jarvis and the user
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index 633859ddd1..afc1f6b618 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -4309,6 +4309,26 @@ class BrainManager:
except Exception: # noqa: BLE001
log.debug("connected-CLIs section omitted", exc_info=True)
+ # The lead's team card (2026-09-03): the agent society's roster with
+ # each agent's hands, plus the rule that "agent" means one of THEM.
+ # Without it Jarvis answered "which agents do you have" from the
+ # retired sub-agent system it was trained on while a freshly created
+ # Gmail agent stood on the island. Rendered from the roster snapshot
+ # (no IO), byte-stable between roster changes like the CLI section.
+ # Skipped on a society agent's own turn: that turn carries its own
+ # briefing (TurnOverride.system_extra), and a specialist must not be
+ # told it is the lead.
+ _turn_override = _TURN_OVERRIDE.get()
+ if _turn_override is None or not _turn_override.system_extra:
+ try:
+ from jarvis.society.lead_card import lead_card_section
+
+ _lead_card = lead_card_section(lead_name=name)
+ if _lead_card:
+ parts.append(_lead_card)
+ except Exception: # noqa: BLE001 — the card is a convenience, never a turn breaker
+ log.debug("lead card section omitted", exc_info=True)
+
# Evidence gate directive (per-turn, AD-CLI8): forces a tool call
# before any answer about an external-data domain. Empty on normal
# turns; set by generate() when the gate returns require_tool.
@@ -4324,7 +4344,6 @@ class BrainManager:
# Per-turn addendum (TurnOverride.system_extra): a surface's own
# briefing for THIS turn only; empty on every other turn.
- _turn_override = _TURN_OVERRIDE.get()
if _turn_override is not None and _turn_override.system_extra:
parts.append(_turn_override.system_extra)
@@ -4342,9 +4361,10 @@ class BrainManager:
"Persona-Beschreibung weiter oben in diesem Prompt; halte dich an sie "
"und erfinde keine eigenen Stil- oder Laengen-Regeln. "
"Bei Aktionen: passende Tools sofort aufrufen, mehrere im selben Turn "
- "wenn noetig. Bei echten Brocken (Code bauen/refactoren, langer Bericht, "
- "Multi-Step-Aufgabe): spawn_worker mit der User-Utterance. "
- "Bildschirm/Apps bedienen: computer_use."
+ "wenn noetig. Aufgaben fuer einen deiner Agenten (Karte 'Your agent "
+ "society'): delegate_to_agent. Bei echten Brocken ohne passenden Agenten "
+ "(Code bauen/refactoren, langer Bericht, Multi-Step-Aufgabe): spawn_worker "
+ "mit der User-Utterance. Bildschirm/Apps bedienen: computer_use."
)
parts.append(base)
diff --git a/jarvis/brain/router.py b/jarvis/brain/router.py
index c5aacf42a2..dfd49135ae 100644
--- a/jarvis/brain/router.py
+++ b/jarvis/brain/router.py
@@ -94,7 +94,7 @@ hast du den Bildschirm NICHT gesehen — antworte aus dem Gespraech, statt etwas
zu erfinden, oder rufe `screenshot`. Ist eine Aeusserung
vage, abgebrochen oder unklar, stell EINE kurze Rueckfrage.
-ENTSCHEIDUNGSTABELLE — entscheide in Millisekunden zwischen drei Wegen:
+ENTSCHEIDUNGSTABELLE — entscheide in Millisekunden zwischen vier Wegen:
1. TRIVIAL — Smalltalk, Gruss, Evergreen-Wissen: antworte direkt aus dem Kopf,
ohne Tool ("wie geht's", "hauptstadt von X", "was beim Auswandern zaehlt").
@@ -114,13 +114,25 @@ ENTSCHEIDUNGSTABELLE — entscheide in Millisekunden zwischen drei Wegen:
kurzen Satz; kein Tool, die Memory-Pipeline liest den Praefix. Steckt im
Turn ein Auftrag, fuehr ihn aus, statt zu notieren.
-3. SPAWN_WORKER — NUR fuer wirklich schwere Brocken, und nur wenn Ruben die
- Delegation selbst verlangt ("Agent", "im Hintergrund", "delegier") oder dein
- Angebot bestaetigt hat: es entsteht ein Arbeitsergebnis oder es braucht
- Minuten ueber viele Schritte (bau, programmier, refactor, plane, analysier).
- Sonst inline erledigen und hoechstens anbieten, einen Agenten zu starten.
- Alle vier Argumente: utterance (verbatim), context_hints (3-5 Gedanken),
- action (Infinitiv, "eine Flask-App baut"), target (Ort oder "").
+3. DELEGATE — "Agent" heisst ein Mitglied deiner Agenten-Gesellschaft: die
+ Karte "Your agent society" weiter oben listet sie mit Namen und Haenden.
+ Nennt Ruben einen dieser Agenten, sagt er "Agent"/"Team", oder passt laut
+ Karte ein Agent zur Aufgabe (Mail an den Mail-Agenten): delegate_to_agent
+ mit Name (oder leer, dann waehlt die Karte) und dem vollen Auftrag; danach
+ nur die Bestaetigung, das Ergebnis wird spaeter angesagt. Fragen nach dem
+ Team ("welche Agents hast du", "was macht X", "ist X fertig") beantwortest
+ du aus der Karte oder mit society_status — NIE aus dem alten Sub-Agenten-
+ oder Missions-System, das gibt es nicht mehr. Steht kein Agent auf der
+ Karte, sag das und mach es selbst.
+
+4. SPAWN_WORKER — NUR fuer wirklich schwere Brocken, die KEIN Agent der Karte
+ abdeckt, und nur wenn Ruben Hintergrundarbeit selbst verlangt ("im
+ Hintergrund", "als Mission", "Worker") oder dein Angebot bestaetigt hat: es
+ entsteht ein Arbeitsergebnis oder es braucht Minuten ueber viele Schritte
+ (bau, programmier, refactor, plane, analysier). Sonst inline erledigen und
+ hoechstens anbieten, es im Hintergrund zu starten. Alle vier Argumente:
+ utterance (verbatim), context_hints (3-5 Gedanken), action (Infinitiv,
+ "eine Flask-App baut"), target (Ort oder "").
BEI UNSICHERHEIT: MACH ES SELBST — mit deinen Tools, ein passender Skill
eingeschlossen. Passt dessen Ergebnis nicht, nimm ein anderes Tool, statt zu
diff --git a/jarvis/brain/turn_planner.py b/jarvis/brain/turn_planner.py
index 88a328e4c1..fe94a427d8 100644
--- a/jarvis/brain/turn_planner.py
+++ b/jarvis/brain/turn_planner.py
@@ -39,6 +39,7 @@ class TurnReason(StrEnum):
PUBLIC_FACT = "public_fact"
SCREEN_CONTEXT = "screen_context"
SKILL = "skill"
+ SOCIETY = "society"
UNCERTAIN = "uncertain"
WORKSPACE = "workspace"
@@ -652,6 +653,53 @@ def _is_workspace_turn(text: str, workspace_names: Sequence[str]) -> bool:
return False
+# The society shapes no roster is needed for: asking who is on the team, or
+# handing work to "an agent" / "the team" in DE / EN / ES. Recall over
+# precision within the shape, tight on the shape itself: "agent" alone (the
+# noun in a news sentence, "travel agent") does not qualify — a question
+# about the agents or an order to an agent does. # i18n-allow: trigger vocabulary
+_SOCIETY_TEAM_RE = re.compile(
+ r"(?:\b(?:welche|was fuer|was für|wie viele|wieviele|which|what|how many|que|qué|"
+ r"cuantos|cuántos|cuales|cuáles)\b[^.?!]{0,40}\b(?:agents?|agenten|agentes?)\b)"
+ r"|(?:\b(?:agents?|agenten|agentes?)\b[^.?!]{0,30}\b(?:hast du|habe ich|gibt es|"
+ r"zur verfuegung|zur verfügung|verfuegbar|verfügbar|do you have|do i have|are there|"
+ r"available|on the team|im team|tienes|tengo|hay|disponibles?)\b)"
+ r"|(?:\b(?:delegier\w*|uebergib|übergib|gib das|gib es|schick das|schick es|"
+ r"delegate|hand (?:this|that|it)|give (?:this|that|it)|pass (?:this|that|it)|"
+ r"delega|pasa(?:le)?|dale)\b[^.?!]{0,30}\b(?:agents?|agenten|agentes?|team|equipo)\b)"
+ r"|(?:\b(?:lass|let|deja)\b[^.?!]{0,20}\b(?:einen?|den|the|an|a|al|un)\s+"
+ r"(?:agent\w*|agente)\b)",
+ re.IGNORECASE,
+)
+
+
+def _is_society_turn(text: str, agent_names: Sequence[str]) -> bool:
+ """Whether this turn names one of the user's agents or asks about the team.
+
+ The society half of the workspace lesson. Asked "welche Agents hast du",
+ the live model answered from the retired sub-agent system, and "Gmail
+ agent, check my inbox" was routed natively because "Gmail agent" is a
+ name the user typed into the Agents section — no static vocabulary can
+ hold it. The roster is the evidence, and a named agent is as strong as a
+ named pane: the orchestrator holds the team card and the delegate tool.
+
+ Two shapes qualify: (1) a roster name appears in the turn, as whole words;
+ (2) the turn asks about the agents or hands work to an agent / the team
+ (``_SOCIETY_TEAM_RE``). Pure text work, no IO and no LLM.
+ """
+ raw = str(text or "")
+ if not raw.strip():
+ return False
+ folded = _normalize(raw)
+ for name in agent_names:
+ needle = _normalize(str(name or "")).strip()
+ if len(needle) < 3:
+ continue
+ if re.search(rf"(?<![a-z0-9]){re.escape(needle)}(?![a-z0-9])", folded):
+ return True
+ return bool(_SOCIETY_TEAM_RE.search(folded))
+
+
def _is_workspace_retry(
text: str, context: Sequence[str], workspace_names: Sequence[str]
) -> bool:
@@ -793,6 +841,7 @@ def plan_turn(
skill_index: Any | None = None,
workspace_names: Sequence[str] = (),
requires_public_fact_grounding: bool = False,
+ agent_names: Sequence[str] = (),
) -> TurnPlan:
"""Return the conservative shared execution plan for ``text``.
@@ -824,12 +873,23 @@ def plan_turn(
one-shot ``search_web`` evidence path used for explicitly fresh facts.
Hosted providers keep the default false and retain the native evergreen
fast path.
+
+ ``agent_names`` is the live roster of the user's agent society
+ (``society.lead_card.society_agent_names``), passed in for the same
+ reason as the call-signs: an agent is named by the user at creation
+ time, so no static vocabulary can hold "Gmail agent"; see
+ ``_is_society_turn``.
""" # i18n-allow: names the German trigger words the static branch matches
normalized = _normalize(text).strip()
if not normalized:
return TurnPlan(path=TurnPath.NATIVE_REALTIME)
reasons: set[TurnReason] = set()
+ # Same standing as a named pane, for the same reason: "what is the Gmail
+ # agent doing" reads as third-party smalltalk to every suppressor below,
+ # and only the orchestrator holds the roster that can answer it.
+ if _is_society_turn(text, agent_names):
+ reasons.add(TurnReason.SOCIETY)
screen_context_intent = classify_screen_context(text).intent
if screen_context_intent is not VisualIntent.NONE:
# The native realtime model cannot see a one-shot image that only the
diff --git a/jarvis/plugins/tool/delegate_to_agent.py b/jarvis/plugins/tool/delegate_to_agent.py
index efbb4c16d7..dd17aae4a2 100644
--- a/jarvis/plugins/tool/delegate_to_agent.py
+++ b/jarvis/plugins/tool/delegate_to_agent.py
@@ -39,6 +39,11 @@ _NO_AGENT: Final[dict[str, str]] = {
"en": "I do not know an agent called {target}.",
"es": "No conozco ningún agente llamado {target}.",
}
+_NO_FIT: Final[dict[str, str]] = {
+ "de": "Keiner deiner Agenten passt zu dieser Aufgabe.", # i18n-allow: spoken reply
+ "en": "None of your agents fits this task.",
+ "es": "Ninguno de tus agentes encaja con esta tarea.",
+}
_REFUSED: Final[dict[str, str]] = {
"de": "{name} kann das gerade nicht übernehmen: {reason}.", # i18n-allow: spoken reply
"en": "{name} cannot take that right now: {reason}.",
@@ -102,18 +107,26 @@ class DelegateToAgentTool:
name: str = "delegate_to_agent"
risk_tier: str = "monitor"
description: str = (
- "Hand a task to one of the user's named agents (their agent society): 'let Scout "
- "research X', 'Mailbox, answer the invoice mail'. Use when the user names an agent "
- "or asks for the team. The agent works in the background; you acknowledge now. "
+ "Hand a task to one of the user's named agents (their agent society, listed on your "
+ "team card): 'let Scout research X', 'Mailbox, answer the invoice mail', 'give that "
+ "to the team'. Use when the user names an agent or asks for the team; leave `agent` "
+ "empty to let the lead pick the agent whose hands fit the task. The agent works in "
+ "the background; you acknowledge now and its result is announced when it lands. "
"Never for tasks the user wants done right here in this turn."
)
schema: dict[str, Any] = {
"type": "object",
"properties": {
- "agent": {"type": "string", "description": "The agent's name as the user said it."},
+ "agent": {
+ "type": "string",
+ "description": (
+ "The agent's name as the user said it; empty when the user did not "
+ "name one (the best-fitting agent is picked from the task)."
+ ),
+ },
"task": {"type": "string", "description": "The task, in full, in the user's words."},
},
- "required": ["agent", "task"],
+ "required": ["task"],
}
is_action_tool: bool = True
@@ -124,20 +137,25 @@ class DelegateToAgentTool:
lang = _lang(args, ctx)
target_key = str(args.get("agent") or "").strip()
task = str(args.get("task") or "").strip()
- if not target_key or not task:
- return ToolResult(
- success=False, output=_NOT_READY[lang], error="agent and task required"
- )
+ if not task:
+ return ToolResult(success=False, output=_NOT_READY[lang], error="task required")
runtime = await self._runtime()
if runtime is None:
return ToolResult(success=False, output=_NOT_READY[lang], error="society unavailable")
- target = await runtime.roster.resolve(target_key)
+ target = await runtime.roster.resolve(target_key) if target_key else None
if target is None:
- return ToolResult(
- success=False,
- output=_NO_AGENT[lang].format(target=target_key),
- error="target_unknown",
- )
+ # No name, or a name the roster does not know ("email agent" for
+ # the Gmail agent): the task's own words pick the agent whose
+ # hands fit. Nobody fits → say so; never guess a stranger.
+ target = runtime.pick_agent(f"{target_key} {task}".strip())
+ if target is None:
+ if target_key:
+ return ToolResult(
+ success=False,
+ output=_NO_AGENT[lang].format(target=target_key),
+ error="target_unknown",
+ )
+ return ToolResult(success=False, output=_NO_FIT[lang], error="no_agent_fits")
from jarvis.society.events import MsgType
env = await runtime.say(
diff --git a/jarvis/plugins/tool/navigate.py b/jarvis/plugins/tool/navigate.py
index 8ae5dd7536..ff1dd7d713 100644
--- a/jarvis/plugins/tool/navigate.py
+++ b/jarvis/plugins/tool/navigate.py
@@ -92,12 +92,32 @@ _ALIASES: dict[str, str] = {
"einstellungen": "settings",
"config": "settings",
"konfiguration": "settings",
+ # The Agents section is the agent society (the island, the roster, the
+ # cards). The retired "sub-agents" wording still lands there rather than
+ # nowhere, and the society's own names are spoken forms too.
"agents": "agents",
"agenten": "agents",
"sub-agents": "agents",
"sub agents": "agents",
"subagents": "agents",
"subagenten": "agents",
+ "society": "agents",
+ "agent society": "agents",
+ "agenten-gesellschaft": "agents", # i18n-allow: input vocab
+ "gesellschaft": "agents", # i18n-allow: input vocab
+ "my agents": "agents",
+ "meine agenten": "agents", # i18n-allow: input vocab
+ "mis agentes": "agents", # i18n-allow: input vocab
+ "team": "agents",
+ "island": "agents",
+ "insel": "agents", # i18n-allow: input vocab
+ "isla": "agents", # i18n-allow: input vocab
+ # The Agentic IDE holds coding TERMINALS, not agents: the spoken forms
+ # that say so land on the workspace, never on the society.
+ "terminals": "agentic-ide",
+ "coding terminals": "agentic-ide",
+ "terminal grid": "agentic-ide",
+ "coding clis": "agentic-ide",
"chat": "chats",
"skill": "skills",
"fähigkeiten": "skills",
diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.py
index d692cacc91..b292d17009 100644
--- a/jarvis/realtime/session.py
+++ b/jarvis/realtime/session.py
@@ -684,7 +684,9 @@ _DELEGATE_DECLARATION: dict[str, Any] = {
"open apps or views, change settings, control the computer on screen "
"(click, type, and navigate inside any application window until the "
"task is finished), manage files, start a background research or "
- "coding mission the user explicitly asked to run, read or write the "
+ "coding mission the user explicitly asked to run, hand a task to one "
+ "of the user's named agents (their agent society) or ask which agents "
+ "exist and what one is doing, read or write the "
"user's private Wiki memory — including recalling anything from the "
"user's own past (what they did, said, visited, planned, or once "
"told Jarvis) — and inspect the current MCP, CLI, tool, "
@@ -2194,6 +2196,7 @@ def _session_instructions(
skill_directive: str = "",
skills_directive: str = "",
workspace_directive: str = "",
+ society_directive: str = "",
compact: bool = False,
history_lost: bool = False,
) -> str:
@@ -2344,6 +2347,7 @@ def _session_instructions(
identity_line,
history_lost_line,
workspace_directive,
+ society_directive,
skills_directive,
skill_directive,
input_directive,
@@ -2369,6 +2373,11 @@ def _session_instructions(
# that must always reach the action function instead of the model's own
# knowledge.
workspace_directive,
+ # The agent society's roster, for the same reason again: the user named
+ # these agents at creation time, and a name the model has never heard
+ # is routed to its own knowledge ("I do not know who that is") instead
+ # of the action function that holds the team card (2026-09-03).
+ society_directive,
# The installed-skill roster, for the same reason the workspace roster
# is here: a name the model has never seen is a name it cannot call.
# Without it the model guessed the run-skill argument from the user's
@@ -3075,6 +3084,7 @@ class RealtimeVoiceSession:
context=context,
skill_index=self._skill_match_index(),
workspace_names=self._workspace_call_signs(),
+ agent_names=self._society_agent_names(),
requires_public_fact_grounding=(
self._active_requires_public_fact_grounding
),
@@ -3110,8 +3120,51 @@ class RealtimeVoiceSession:
except Exception: # noqa: BLE001 - optional surface, never fatal
return ()
+ @staticmethod
+ def _society_agent_names() -> tuple[str, ...]:
+ """Names of the user's live society agents, or ``()``.
+
+ Pure in-memory read of the roster snapshot (``society.lead_card``), so
+ it is free on the hot path; any fault answers "no society".
+ """
+ try:
+ from jarvis.society.lead_card import society_agent_names
+
+ return society_agent_names()
+ except Exception: # noqa: BLE001 - optional surface, never fatal
+ return ()
+
+ def _society_directive(self) -> str:
+ """Tell the live model which of the user's agents exist, by name.
+
+ The society twin of ``_workspace_directive``. Asked "welche Agents hast
+ du?" with a freshly created Gmail agent on the island, the live model
+ answered from the retired sub-agent system, and "Gmail agent, check my
+ inbox" went native because the name was typed into the Agents section
+ by the user and no vocabulary could hold it (2026-09-03). Names and the
+ routing rule only: the team card with each agent's hands lives with
+ the orchestrator, which owns delegate_to_agent and society_status.
+ """
+ names = self._society_agent_names()
+ if not names:
+ return ""
+ roster = ", ".join(names)
+ return (
+ "[Agent society — the user's own agents, live right now]\n"
+ f"Agents on the user's team: {roster}.\n"
+ "Those are the user's OWN AGENTS from the Agents section (each with "
+ "its own chat, tools and instructions) — not people you know, not "
+ "coding terminals, and not the retired sub-agent system. When the "
+ "user names one of them, says \"agent\", \"my agents\" or \"the "
+ "team\", hands work to an agent, or asks which agents exist or what "
+ "one is doing: call your action function — the orchestrator holds "
+ "the team card and delegates. Never answer that you do not know who "
+ "that is, never guess what an agent is doing, and never say an agent "
+ "has been told anything unless your action function reported it."
+ )
+
def _workspace_directive(self) -> str:
- """Tell the live model which coding agents are running, by name.
+ """Tell the live model which coding terminals are running, by name.
The live 2026-07-27 miss in one sentence: asked what a named pane had
done, the model said it did not know which person that was — and it was
@@ -3137,9 +3190,10 @@ class RealtimeVoiceSession:
return ""
roster = ", ".join(names)
return (
- "[Agentic IDE — coding agents are running right now]\n"
+ "[Agentic IDE — coding terminals are running right now]\n"
f"Terminals open in the user's coding workspace: {roster}.\n"
- "Those are RUNNING CODING AGENTS, not people you know. Each is "
+ "Those are RUNNING CODING TERMINALS, not people and not society "
+ "agents. Each is "
"named T plus its place in the grid, and the user says that "
"number however a number is said — \"T2\", \"terminal two\", "
"\"the second terminal\" all mean the same pane. Never answer "
@@ -3751,6 +3805,7 @@ class RealtimeVoiceSession:
),
),
workspace_directive=self._workspace_directive(),
+ society_directive=self._society_directive(),
skills_directive=self._skills_directive(
compact=bool(
getattr(provider, "prefers_compact_instructions", False)
@@ -5327,6 +5382,7 @@ class RealtimeVoiceSession:
# call, and a roster naming a terminal that is
# gone is worse than none.
workspace_directive=self._workspace_directive(),
+ society_directive=self._society_directive(),
compact=getattr(
self, "_compact_instructions", False
),
@@ -7203,6 +7259,7 @@ class RealtimeVoiceSession:
compact=getattr(self, "_compact_instructions", False),
),
workspace_directive=self._workspace_directive(),
+ society_directive=self._society_directive(),
skills_directive=self._skills_directive(),
compact=getattr(self, "_compact_instructions", False),
history_lost=self._suppress_history_seed,
diff --git a/jarvis/society/lead_card.py b/jarvis/society/lead_card.py
new file mode 100644
index 0000000000..3cc34e1f13
--- /dev/null
+++ b/jarvis/society/lead_card.py
@@ -0,0 +1,219 @@
+"""The lead's team card: what Jarvis knows about its society, every turn.
+
+Jarvis is the harness itself and the one lead of the agent society. Every
+society agent gets a briefing per turn (``surface.build_briefing``) that
+names its teammates; until 2026-09-03 the lead got nothing. Asked "which
+agents do you have?", Jarvis answered from the retired sub-agent (mission
+worker) system its prompt still described and never from the roster — with
+a freshly created Gmail agent standing on the island.
+
+The card closes that gap. It is a deterministic, byte-stable block rendered
+from the roster snapshot and the capability catalog — no model call, no
+database read on the hot path — that:
+
+* the brain appends to its system prompt (``BrainManager._build_system_prompt``),
+ so the typed front-page chat and every delegated voice turn see it;
+* the realtime session condenses into a per-turn directive
+ (``RealtimeVoiceSession._society_directive``) so the live model routes a
+ named agent to its action function instead of "I do not know who that is";
+* the turn planner reads as agent names (``plan_turn(agent_names=...)``).
+
+It changes exactly when the roster changes: ``Roster`` refreshes its
+snapshot on every write, so an agent created in the Agents section is on the
+very next turn's card without a restart, a hook or a model call.
+"""
+
+from __future__ import annotations
+
+import hashlib
+import logging
+from collections.abc import Callable, Sequence
+from typing import Final
+
+from .capabilities import CapabilityRow
+from .roster import LEAD_AGENT_ID, AgentRecord
+from .runtime import current_runtime
+
+log = logging.getLogger(__name__)
+
+__all__ = [
+ "CARD_TITLE",
+ "lead_card_section",
+ "render_lead_card",
+ "roster_epoch",
+ "society_agent_names",
+]
+
+CARD_TITLE: Final[str] = "## Your agent society (the team you lead)"
+
+#: How much of an agent's standing instructions the card quotes.
+_BRIEF_CHARS: Final[int] = 140
+#: How many granted hands an allowlist agent shows before "…".
+_HANDS_MAX: Final[int] = 6
+
+
+def _rule_block(lead_name: str) -> str:
+ return (
+ f"You are {lead_name}, the lead of the user's agent society: the named agents "
+ "listed below live in the Agents section, each with its own chat, its own tools "
+ "and its own standing instructions. When the user says \"agent\", \"my agents\" "
+ "or \"the team\", they mean THESE agents.\n"
+ "- Hand work to an agent with delegate_to_agent (the agent's name and the task in "
+ "full). The agent works in the background; you acknowledge now and its result "
+ "comes back to this conversation.\n"
+ "- Answer \"which agents do you have\", \"who is on the team\", \"what is X "
+ "doing\", \"is X done\" from this card or with society_status — never from the "
+ "retired sub-agent or mission-worker system.\n"
+ "- A task that fits an agent's hands (mail to a mail agent, research to a "
+ "research agent) goes to that agent when the user asks for the team or names it; "
+ "when no agent fits, do it yourself. spawn_worker is only for heavy background "
+ "work the user explicitly asked to run in the background that no agent covers.\n"
+ "- Coding terminals in the Agentic IDE (Claude Code, Codex and the like) are NOT "
+ "agents of this society; they are reached through the workspace tools."
+ )
+
+
+def roster_epoch(agents: Sequence[AgentRecord]) -> str:
+ """A fingerprint of the team — changes when an agent is added, edited or archived."""
+ digest = hashlib.sha256(
+ "\n".join(f"{a.agent_id}:{a.updated_ms}:{a.state}" for a in agents).encode()
+ ).hexdigest()
+ return digest[:12]
+
+
+def _state_word(agent: AgentRecord, running: int) -> str:
+ state = str(agent.state)
+ if state != "active":
+ return state
+ return f"busy ({running} run{'s' if running != 1 else ''})" if running > 0 else "idle"
+
+
+def _hands(agent: AgentRecord, by_id: dict[str, CapabilityRow]) -> str:
+ denied = set(agent.denies)
+ focus = [by_id[c].label for c in agent.focus if c in by_id and c not in denied]
+ if focus:
+ return "hands: " + ", ".join(focus)
+ if str(agent.grant_mode) == "allowlist":
+ granted = [by_id[c].label for c in agent.grants if c in by_id and c not in denied]
+ if not granted:
+ return "hands: none granted yet"
+ shown = ", ".join(granted[:_HANDS_MAX])
+ return "hands: " + shown + (", …" if len(granted) > _HANDS_MAX else "")
+ return "hands: every connected tool"
+
+
+def _brief(description: str) -> str:
+ text = " ".join(description.split())
+ if not text:
+ return ""
+ if len(text) > _BRIEF_CHARS:
+ text = text[: _BRIEF_CHARS - 1].rstrip() + "…"
+ return f' · brief: "{text}"'
+
+
+def render_lead_card(
+ agents: Sequence[AgentRecord],
+ catalog: Sequence[CapabilityRow],
+ *,
+ lead_name: str = "Jarvis",
+ lead_id: str = LEAD_AGENT_ID,
+ busy: Callable[[str], int] | None = None,
+ terminals: Sequence[str] = (),
+) -> str:
+ """The lead's system-prompt block.
+
+ Pure and deterministic: the same roster + catalog + terminals render the
+ same bytes, so the provider prompt cache stays warm between roster
+ changes. Archived agents are left out; paused ones are listed as paused
+ so the lead does not promise work to an agent that will not take it.
+ """
+ team = sorted(
+ (a for a in agents if a.agent_id != lead_id and str(a.state) != "archived"),
+ key=lambda a: a.name.casefold(),
+ )
+ by_id = {row.id: row for row in catalog if row.connected}
+ parts: list[str] = [CARD_TITLE, _rule_block(lead_name)]
+ if team:
+ lines = ["Agents (name — title · tier · state · hands):"]
+ for agent in team:
+ running = busy(agent.agent_id) if busy is not None else 0
+ line = f"- {agent.name}"
+ if agent.title.strip():
+ line += f" — {agent.title.strip()}"
+ line += f" · {agent.tier} · {_state_word(agent, running)} · {_hands(agent, by_id)}"
+ line += _brief(agent.description)
+ lines.append(line)
+ parts.append("\n".join(lines))
+ else:
+ parts.append(
+ "No other agents yet. The user creates them in the Agents section; when a "
+ "task would suit a standing agent, offer to set one up there — never invent "
+ "an agent that is not on this card."
+ )
+ names = [str(t).strip() for t in terminals if str(t or "").strip()]
+ if names:
+ parts.append(
+ "Coding terminals open in the Agentic IDE right now (not society agents): "
+ + ", ".join(names)
+ + "."
+ )
+ parts.append(f"Roster epoch: {roster_epoch(team)}")
+ return "\n\n".join(parts)
+
+
+def _terminal_names() -> tuple[str, ...]:
+ """Call-signs of the open Agentic-IDE terminals — in-memory, never fatal."""
+ try:
+ from jarvis.agentic_ide.session import running_call_signs
+
+ return tuple(running_call_signs())
+ except Exception: # noqa: BLE001 — optional surface, never breaks a prompt build
+ return ()
+
+
+def society_agent_names() -> tuple[str, ...]:
+ """Names of the live, non-lead agents — for the realtime directive and the planner.
+
+ Synchronous and IO-free (the roster snapshot); ``()`` without a society.
+ """
+ rt = current_runtime()
+ if rt is None:
+ return ()
+ try:
+ agents = rt.roster.snapshot()
+ except Exception: # noqa: BLE001 — a broken snapshot costs the names, never the turn
+ log.debug("society: roster snapshot unavailable", exc_info=True)
+ return ()
+ return tuple(
+ sorted(
+ (a.name for a in agents if a.agent_id != rt.lead_id and str(a.state) == "active"),
+ key=str.casefold,
+ )
+ )
+
+
+def lead_card_section(*, lead_name: str = "Jarvis") -> str:
+ """The card for THIS process's society, or ``""`` when there is none.
+
+ Read by ``BrainManager._build_system_prompt`` on every prompt build; it
+ must therefore stay synchronous and cheap: a roster snapshot, the
+ in-memory catalog, the scheduler's run counters.
+ """
+ rt = current_runtime()
+ if rt is None:
+ return ""
+ try:
+ agents = rt.roster.snapshot()
+ catalog = rt.catalog()
+ busy = rt.scheduler.active_runs
+ except Exception: # noqa: BLE001 — the card is a convenience; the turn must run without it
+ log.warning("society: lead card unavailable", exc_info=True)
+ return ""
+ return render_lead_card(
+ agents,
+ catalog,
+ lead_name=lead_name,
+ lead_id=rt.lead_id,
+ busy=busy,
+ terminals=_terminal_names(),
+ )
diff --git a/jarvis/society/roster.py b/jarvis/society/roster.py
index a18ffd0ee6..58da00a47e 100644
--- a/jarvis/society/roster.py
+++ b/jarvis/society/roster.py
@@ -355,6 +355,30 @@ def _coerce(field_name: str, value: Any) -> Any:
class Roster:
def __init__(self, store: SocietyStore) -> None:
self._store = store
+ #: The live (non-archived) rows as of the last write or ``list()`` —
+ #: what a synchronous reader on the brain's hot path may see without
+ #: touching the database (the lead card, ``lead_card.py``). Every
+ #: write through this class refreshes it, so a freshly created agent
+ #: is on the very next turn's card.
+ self._snapshot: tuple[AgentRecord, ...] = ()
+ self._epoch: int = 0
+
+ def snapshot(self) -> list[AgentRecord]:
+ """The roster as last read — synchronous, no IO; ``[]`` before the first read."""
+ return list(self._snapshot)
+
+ @property
+ def epoch(self) -> int:
+ """Bumps on every roster write; a cheap "did the team change" probe."""
+ return self._epoch
+
+ async def refresh(self) -> list[AgentRecord]:
+ """Re-read the live rows into the snapshot (``list()`` does the same)."""
+ return await self.list()
+
+ def _remember(self, agents: list[AgentRecord]) -> None:
+ self._snapshot = tuple(agents)
+ self._epoch += 1
async def create(
self,
@@ -408,7 +432,9 @@ class Roster:
await self._store.insert_agent(row)
created = await self._store.get_agent_row(agent_id)
assert created is not None
- return await self._hydrate(created), True
+ record = await self._hydrate(created)
+ await self.refresh()
+ return record, True
async def get(self, agent_id: str) -> AgentRecord | None:
row = await self._store.get_agent_row(agent_id)
@@ -425,7 +451,10 @@ class Roster:
async def list(self, *, include_archived: bool = False) -> list[AgentRecord]:
rows = await self._store.list_agent_rows(include_archived=include_archived)
- return [await self._hydrate(r) for r in rows]
+ agents = [await self._hydrate(r) for r in rows]
+ if not include_archived:
+ self._remember(agents)
+ return agents
async def update(self, agent_id: str, fields: dict[str, Any]) -> AgentRecord:
current = await self._store.get_agent_row(agent_id)
@@ -450,7 +479,9 @@ class Roster:
await self._store.update_agent(agent_id, columns)
row = await self._store.get_agent_row(agent_id)
assert row is not None
- return await self._hydrate(row)
+ record = await self._hydrate(row)
+ await self.refresh()
+ return record
async def archive(self, agent_id: str) -> AgentRecord:
if agent_id == LEAD_AGENT_ID:
diff --git a/jarvis/society/runtime.py b/jarvis/society/runtime.py
index 5f00089001..b12b0132f7 100644
--- a/jarvis/society/runtime.py
+++ b/jarvis/society/runtime.py
@@ -45,6 +45,18 @@ __all__ = ["SocietyRuntime", "current_runtime", "set_current_runtime"]
_DB_NAME = "society.db"
+#: What the person hears when a task Jarvis handed out comes back.
+_LEAD_DONE: dict[str, str] = {
+ "de": "{name} ist fertig: {text}", # i18n-allow: spoken completion
+ "en": "{name} is done: {text}",
+ "es": "{name} ha terminado: {text}",
+}
+_LEAD_BLOCKED: dict[str, str] = {
+ "de": "{name} kam nicht weiter: {text}", # i18n-allow: spoken completion
+ "en": "{name} got stuck: {text}",
+ "es": "{name} se quedó atascado: {text}",
+}
+
_current: SocietyRuntime | None = None
@@ -121,6 +133,9 @@ class SocietyRuntime:
# ``event_publish`` is the app bus the WebSocket forwards (server.py hands
# it in); without it the engine falls back to the process default bus.
self.checkpoints = CheckpointEngine(self, publish=event_publish)
+ #: The same app bus, for what the lead has to SAY: a delegated task's
+ #: result is announced to the person (voice + front-page chat).
+ self._publish_event = event_publish
#: The society's one memory service; every touch moves the figure to the Memory House.
self.memory = SocietyMemory(self, on_activity=self.checkpoints.note_memory_activity)
#: The Quest Board: the person's jobs, routed to one taker, read back off the board.
@@ -154,6 +169,10 @@ class SocietyRuntime:
created = await seed_first_run(self.roster, self.store)
if created:
log.info("society: starter team seeded: %s", ", ".join(created))
+ # Warm the roster snapshot so the lead card (lead_card.py) — a
+ # synchronous reader on the brain's prompt build — sees the team from
+ # the first turn, not from the first REST listing.
+ await self.roster.refresh()
self._started = True
set_current_runtime(self)
log.info("society runtime started (%s)", self.store.path)
@@ -362,6 +381,8 @@ class SocietyRuntime:
)
except Exception: # noqa: BLE001 - the slot is free either way; the loss is one RESULT row
log.warning("society: RESULT for %s could not be written", run_id, exc_info=True)
+ if env.from_agent == LEAD_AGENT_ID:
+ await self.report_to_lead(target, env, status=status, summary=summary)
digest = TurnDigest(
task=env.text or str(env.payload.get("task") or ""),
final_text=final_text,
@@ -373,6 +394,94 @@ class SocietyRuntime:
self._watchers.add(learner)
learner.add_done_callback(self._watchers.discard)
+ # ------------------------------------------------------------ the lead
+
+ async def report_to_lead(
+ self, target: AgentRecord, env: SocietyEnvelope, *, status: str, summary: str
+ ) -> None:
+ """Close the loop on a task Jarvis handed out: tell the person.
+
+ Jarvis delegates by voice or from the front-page chat and acknowledges
+ at once ("Scout is on it"); the work then ends on the board, where the
+ person only sees it by opening the Agents section. So the RESULT of a
+ lead-assigned task also goes where the order came from — spoken as a
+ completion announcement on the app bus (the TTS pipeline and the
+ realtime session both read ``AnnouncementRequested``) and posted as a
+ notice into the newest front-page chat. Neither leg may fail the run.
+ """
+ lang = str(env.payload.get("lang") or "en").lower()
+ line = (_LEAD_DONE if status == "done" else _LEAD_BLOCKED).get(
+ lang, (_LEAD_DONE if status == "done" else _LEAD_BLOCKED)["en"]
+ )
+ text = line.format(name=target.name, text=" ".join(summary.split())[:400])
+ svc = self._get_chat()
+ post = getattr(svc, "post_notice", None)
+ if svc is not None and post is not None:
+ try:
+ sessions = svc.store.list_sessions(limit=1, surface="jarvis")
+ if sessions:
+ await post(
+ sessions[0].session_id,
+ {
+ "kind": "society_result",
+ "agent_id": target.agent_id,
+ "agent_name": target.name,
+ "status": status,
+ "text": summary[:1000],
+ "session_id": target.session_id,
+ "trace_id": env.trace_id,
+ },
+ )
+ except Exception: # noqa: BLE001 - the chat notice is a courtesy; the voice leg still runs
+ log.warning("society: result notice for the lead chat failed", exc_info=True)
+ if self._publish_event is None:
+ return
+ try:
+ from jarvis.core.events import AnnouncementRequested
+
+ maybe = self._publish_event(
+ AnnouncementRequested(
+ source_layer="society.lead",
+ text=text,
+ priority="normal",
+ language=lang if lang in _LEAD_DONE else "en",
+ kind="completion",
+ detail=f"agent={target.agent_id} trace={env.trace_id}",
+ )
+ )
+ if asyncio.iscoroutine(maybe):
+ await maybe
+ except Exception: # noqa: BLE001 - a silent completion is a lost courtesy, not a lost result
+ log.warning("society: result announcement for the lead failed", exc_info=True)
+
+ def pick_agent(self, task: str) -> AgentRecord | None:
+ """The active agent whose hands fit ``task`` best, or ``None``.
+
+ The lead delegating without a name ("give that to the team") — and a
+ realtime model that heard "Gmail agent" as "email agent" — need a
+ deterministic pick: the capability ids the task points at
+ (``derive_focus``) against each agent's own focus, strongest first.
+ A task no agent's focus touches picks nobody; the caller then says so
+ rather than guessing. Synchronous: the roster snapshot, no IO.
+ """
+ wanted = derive_focus("", task, self.catalog(), limit=8)
+ if not wanted:
+ return None
+ weight = {cap_id: len(wanted) - i for i, cap_id in enumerate(wanted)}
+ best: tuple[int, str, AgentRecord] | None = None
+ for agent in self.roster.snapshot():
+ if agent.agent_id == LEAD_AGENT_ID or str(agent.state) != "active":
+ continue
+ score = sum(
+ weight.get(cap_id, 0) for cap_id in agent.focus if cap_id not in agent.denies
+ )
+ if score <= 0:
+ continue
+ key = (score, agent.name.casefold(), agent)
+ if best is None or score > best[0] or (score == best[0] and key[1] < best[1]):
+ best = key
+ return best[2] if best is not None else None
+
async def _learn(self, target: AgentRecord, digest: TurnDigest) -> None:
try:
fresh = await self.roster.get(target.agent_id)
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx
index b1dbe42806..75974189f9 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx
@@ -183,6 +183,28 @@ export function AgentTimeline({
</div>
);
}
+ if (item.type === "notice") {
+ // The society reporting back on a task Jarvis handed out: the
+ // agent's name as the headline, its summary underneath. Muted and
+ // centred like a stamp — it is not Jarvis speaking.
+ const headline =
+ item.kind === "society_result"
+ ? t(item.status === "done" ? "society.chat.result_done" : "society.chat.result_blocked").replace(
+ "{0}",
+ item.agentName || t("society.chat.result_agent"),
+ )
+ : item.agentName;
+ return (
+ <div
+ key={item.id}
+ data-message-id={item.id}
+ className="mx-auto flex max-w-[85%] flex-col gap-0.5 rounded-lg bg-card px-4 py-3 text-body"
+ >
+ {headline ? <span className="font-medium text-foreground">{headline}</span> : null}
+ {item.text ? <span className="whitespace-pre-wrap text-muted-foreground">{item.text}</span> : null}
+ </div>
+ );
+ }
return (
<Turn
key={item.id}
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.ts b/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.ts
index c7df4a6bc3..e580acc02c 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.ts
@@ -182,3 +182,30 @@ describe("a user message with files", () => {
expect("url" in doc).toBe(false);
});
});
+
+describe("agent-chat reduce: notices", () => {
+ it("folds a society result notice into a notice item the timeline can show", () => {
+ const tl = reduceEvents(EMPTY_TIMELINE, [
+ ev("user_message", { text: "@Gmail agent answer the invoice mail" }),
+ ev("notice", {
+ kind: "society_result",
+ agent_id: "gmail-agent",
+ agent_name: "Gmail agent",
+ status: "done",
+ text: "Invoice answered.",
+ }),
+ ]);
+ expect(tl.items).toHaveLength(2);
+ const notice = tl.items[1];
+ expect(notice.type).toBe("notice");
+ if (notice.type !== "notice") throw new Error("unreachable");
+ expect(notice.kind).toBe("society_result");
+ expect(notice.agentName).toBe("Gmail agent");
+ expect(notice.status).toBe("done");
+ expect(notice.text).toBe("Invoice answered.");
+ });
+
+ it("drops an empty notice", () => {
+ expect(reduceEvent(EMPTY_TIMELINE, ev("notice", {}, false))).toBe(EMPTY_TIMELINE);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/reduce.ts b/jarvis/ui/web/frontend/src/components/agentchat/reduce.ts
index 933f7a1614..5ae88294e3 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/reduce.ts
+++ b/jarvis/ui/web/frontend/src/components/agentchat/reduce.ts
@@ -116,7 +116,26 @@ export interface ErrorItem {
tsMs: number;
}
-export type TimelineItem = UserItem | TurnItem | ErrorItem;
+/**
+ * A system line that is not a turn: the agent society posts a delegated
+ * task's result here ("Gmail agent is done: …"), a learned skill, a login
+ * request. Stored server-side as a `notice` event, so a reopened chat still
+ * shows it.
+ */
+export interface NoticeItem {
+ type: "notice";
+ id: string;
+ /** The server's notice kind — "society_result", "learned_skill", … */
+ kind: string;
+ text: string;
+ agentName: string;
+ agentId: string;
+ /** "done" | "blocked" | "" for notices that carry no outcome. */
+ status: string;
+ tsMs: number;
+}
+
+export type TimelineItem = UserItem | TurnItem | ErrorItem | NoticeItem;
export interface PendingApproval {
approvalId: string;
@@ -551,6 +570,28 @@ export function reduceEvent(tl: Timeline, ev: AgentChatEvent): Timeline {
};
}
+ case "notice": {
+ const text = str(p.text);
+ const kind = str(p.kind);
+ if (!text && !kind) return base;
+ return {
+ ...base,
+ items: [
+ ...base.items,
+ {
+ type: "notice",
+ id: `n-${seq || ev.ts_ms}`,
+ kind,
+ text,
+ agentName: str(p.agent_name),
+ agentId: str(p.agent_id),
+ status: str(p.status),
+ tsMs: ev.ts_ms,
+ },
+ ],
+ };
+ }
+
default:
return base;
}
diff --git a/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx b/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx
index 07d069ff19..a3057cf4b2 100644
--- a/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/chat/AgentChatPanel.tsx
@@ -29,7 +29,14 @@ import { ChatAttachmentStrip } from "@/components/agentchat/ChatAttachmentStrip"
import { useChatAttachments } from "@/components/agentchat/useChatAttachments";
import { DictationStatus } from "@/components/agentchat/DictationStatus";
import { useComposerDictation } from "@/components/agentchat/useComposerDictation";
-import type { ReasoningBlock, TimelineItem, ToolBlock, TurnItem, UserItem } from "@/components/agentchat/reduce";
+import type {
+ NoticeItem,
+ ReasoningBlock,
+ TimelineItem,
+ ToolBlock,
+ TurnItem,
+ UserItem,
+} from "@/components/agentchat/reduce";
import { formatThoughtDuration } from "@/components/home/TurnSteps";
import { VoiceStage } from "@/components/home/VoiceStage";
import { LiveCore } from "@/components/LiveCore";
@@ -522,6 +529,8 @@ function Transcript({
<UserBubble item={item} />
) : item.type === "turn" ? (
<TurnBubble item={item} onDecide={onDecide} />
+ ) : item.type === "notice" ? (
+ <NoticeLine item={item} />
) : (
<p className="self-start rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive">{item.text}</p>
)}
@@ -543,6 +552,28 @@ function TimeStamp({ ms }: { ms: number }) {
return <p className="my-1 text-center text-xs text-muted-foreground">{`${day} ${time}`}</p>;
}
+/**
+ * A delegated task coming back: the agent's name as the headline, its
+ * summary underneath, muted — it is the society reporting, not Jarvis
+ * speaking, so it never wears an assistant bubble.
+ */
+function NoticeLine({ item }: { item: NoticeItem }) {
+ const t = useT();
+ const headline =
+ item.kind === "society_result"
+ ? t(item.status === "done" ? "society.chat.result_done" : "society.chat.result_blocked").replace(
+ "{0}",
+ item.agentName || t("society.chat.result_agent"),
+ )
+ : item.agentName;
+ return (
+ <div className="flex max-w-[85%] flex-col gap-0.5 self-start rounded-2xl rounded-bl-md border border-border bg-card px-3.5 py-2 text-xs">
+ {headline ? <p className="font-medium text-foreground">{headline}</p> : null}
+ {item.text ? <p className="whitespace-pre-wrap leading-relaxed text-muted-foreground">{item.text}</p> : null}
+ </div>
+ );
+}
+
/** What the person typed, without the delegation line the composer added. */
function visibleUserText(text: string): string {
return text
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 37927b2b46..f24d6674da 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -74,7 +74,7 @@
"nav": {
"chat_workspace": "Chat",
"chats": "Chats",
- "agents": "{name}-Agents",
+ "agents": "Agenten",
"extensions": "Skills, Plugins & MCPs",
"skills": "Skills",
"plugins": "Plugins",
@@ -5163,6 +5163,9 @@
"approve": "Erlauben",
"deny": "Ablehnen",
"mention_hint": "Agenten",
+ "result_done": "{0} ist fertig",
+ "result_blocked": "{0} kam nicht weiter",
+ "result_agent": "Ein Agent",
"delegate_line": "Hand this to the agent '{0}' (id {1}) with delegate-to-agent and report back here when it is done."
},
"world": {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 8f3ee78830..d9dd8d96c4 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -74,7 +74,7 @@
"nav": {
"chat_workspace": "Chat",
"chats": "Chats",
- "agents": "{name}-Agents",
+ "agents": "Agents",
"extensions": "Skills, Plugins & MCPs",
"skills": "Skills",
"plugins": "Plugins",
@@ -5196,6 +5196,9 @@
"approve": "Allow",
"deny": "Deny",
"mention_hint": "Agents",
+ "result_done": "{0} is done",
+ "result_blocked": "{0} got stuck",
+ "result_agent": "An agent",
"delegate_line": "Hand this to the agent '{0}' (id {1}) with delegate-to-agent and report back here when it is done."
},
"world": {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index f814693c1d..d07681ba5a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -74,7 +74,7 @@
"nav": {
"chat_workspace": "Chat",
"chats": "Chats",
- "agents": "{name}-Agents",
+ "agents": "Agentes",
"extensions": "Skills, Plugins & MCPs",
"skills": "Habilidades",
"plugins": "Plugins",
@@ -5163,6 +5163,9 @@
"approve": "Permitir",
"deny": "Denegar",
"mention_hint": "Agentes",
+ "result_done": "{0} ha terminado",
+ "result_blocked": "{0} se quedó atascado",
+ "result_agent": "Un agente",
"delegate_line": "Hand this to the agent '{0}' (id {1}) with delegate-to-agent and report back here when it is done."
},
"world": {
diff --git a/tests/unit/brain/test_router_society_prompt.py b/tests/unit/brain/test_router_society_prompt.py
new file mode 100644
index 0000000000..e07f15ca0d
--- /dev/null
+++ b/tests/unit/brain/test_router_society_prompt.py
@@ -0,0 +1,32 @@
+"""The router prompt routes "agent" to the society, not to a mission worker.
+
+Until 2026-09-03 the decision table listed the word "Agent" as the trigger
+for ``spawn_worker`` — the retired sub-agent system — so a person naming
+their Gmail agent got a background worker, and "which agents do you have"
+got an answer from a system that no longer exists. The prompt now has a
+DELEGATE way that points at the team card and the two society tools.
+"""
+
+from __future__ import annotations
+
+from jarvis.brain.router import SYSTEM_PROMPT
+
+
+def test_delegate_is_a_way_of_its_own() -> None:
+ assert "vier Wegen" in SYSTEM_PROMPT # i18n-allow: prompt text under test
+ assert "3. DELEGATE" in SYSTEM_PROMPT
+ assert "4. SPAWN_WORKER" in SYSTEM_PROMPT
+ assert SYSTEM_PROMPT.index("3. DELEGATE") < SYSTEM_PROMPT.index("4. SPAWN_WORKER")
+
+
+def test_delegate_names_the_card_and_both_society_tools() -> None:
+ assert "Your agent society" in SYSTEM_PROMPT
+ assert "delegate_to_agent" in SYSTEM_PROMPT
+ assert "society_status" in SYSTEM_PROMPT
+
+
+def test_the_word_agent_no_longer_triggers_a_worker() -> None:
+ spawn = SYSTEM_PROMPT[SYSTEM_PROMPT.index("4. SPAWN_WORKER") :]
+ spawn = spawn[: spawn.index("BEI UNSICHERHEIT")] # i18n-allow: prompt anchor
+ assert '"Agent"' not in spawn
+ assert "KEIN Agent der Karte" in spawn # i18n-allow: prompt text under test
diff --git a/tests/unit/brain/test_turn_planner_society.py b/tests/unit/brain/test_turn_planner_society.py
new file mode 100644
index 0000000000..f0e4fca919
--- /dev/null
+++ b/tests/unit/brain/test_turn_planner_society.py
@@ -0,0 +1,68 @@
+"""A named society agent, or a question about the team, needs the orchestrator.
+
+The society twin of the workspace call-sign rule. "Gmail agent, check my
+inbox" was routed natively (2026-09-03) because "Gmail agent" is a name the
+user typed into the Agents section and no static vocabulary can hold it; the
+live model then answered from its own knowledge. The roster is the evidence,
+passed in like the call-signs so the planner keeps holding no registry.
+"""
+
+from __future__ import annotations
+
+import pytest
+
+from jarvis.brain.turn_planner import TurnPath, TurnReason, plan_turn
+
+NAMES = ("Gmail agent", "Scout")
+
+
+ "text",
+ [
+ "Gmail agent, check my inbox for the invoice.",
+ "Was macht der Gmail Agent gerade?", # i18n-allow: spoken input under test
+ "Lass Scout das recherchieren.", # i18n-allow: spoken input under test
+ "Is Scout done yet?",
+ ],
+)
+def test_a_named_agent_goes_to_the_orchestrator(text: str) -> None:
+ plan = plan_turn(text, agent_names=NAMES)
+ assert plan.path is TurnPath.ORCHESTRATOR
+ assert TurnReason.SOCIETY in plan.reasons
+
+
+ "text",
+ [
+ "Welche Agents hast du?", # i18n-allow: spoken input under test
+ "Welche Agenten stehen dir zur Verfügung?", # i18n-allow: spoken input under test
+ "Which agents do you have access to?",
+ "How many agents are on the team?",
+ "Delegate that to an agent.",
+ "Gib das an einen Agenten.", # i18n-allow: spoken input under test
+ "¿Qué agentes tienes?", # i18n-allow: spoken input under test
+ ],
+)
+def test_a_question_about_the_team_needs_no_roster(text: str) -> None:
+ plan = plan_turn(text)
+ assert plan.path is TurnPath.ORCHESTRATOR
+ assert TurnReason.SOCIETY in plan.reasons
+
+
+ "text",
+ [
+ "My travel agent booked the flight, funny story.",
+ "Wie geht es dir heute?", # i18n-allow: spoken input under test
+ "What is the capital of France?",
+ ],
+)
+def test_the_word_agent_alone_is_not_the_society(text: str) -> None:
+ plan = plan_turn(text, agent_names=NAMES)
+ assert TurnReason.SOCIETY not in plan.reasons
+
+
+def test_a_short_name_never_matches_inside_other_words() -> None:
+ # "Al" would otherwise fire on "already"; names under three characters are skipped.
+ plan = plan_turn("I already did that", agent_names=("Al",))
+ assert TurnReason.SOCIETY not in plan.reasons
diff --git a/tests/unit/plugins/tool/test_delegate_to_agent.py b/tests/unit/plugins/tool/test_delegate_to_agent.py
index b72985af00..2fa616fae1 100644
--- a/tests/unit/plugins/tool/test_delegate_to_agent.py
+++ b/tests/unit/plugins/tool/test_delegate_to_agent.py
@@ -48,8 +48,10 @@ async def runtime(tmp_path: Path):
cfg = SimpleNamespace(memory=SimpleNamespace(data_dir=str(tmp_path / "data")))
rt = SocietyRuntime(tmp_path, chat_service=lambda: chat, cfg=lambda: cfg)
await rt.ensure_started()
- await rt.roster.update("scout", {"provider": "openai", "model": "gpt-5.2"})
- await rt.roster.update("archivist", {"provider": "openai", "model": "gpt-5.2"})
+ # Only Jarvis is seeded by default (maintainer, 2026-09-02): the two
+ # teammates these tests address are created here.
+ await rt.roster.create(name="Scout", provider="openai", model="gpt-5.2")
+ await rt.roster.create(name="Archivist", provider="openai", model="gpt-5.2")
try:
yield rt, chat
finally:
@@ -124,7 +126,7 @@ async def test_status_answers_from_the_board(runtime):
rt, _ = runtime
status = SocietyStatusTool(runtime_resolver=lambda: rt)
team = await status.execute({"turn_language": "en"}, _ctx("who is on the team"))
- assert team.output == "Active agents: Scout, Archivist."
+ assert team.output == "Active agents: Archivist, Scout."
idle = await status.execute(
{"agent": "archivist", "turn_language": "en"}, _ctx("what is archivist doing")
)
@@ -137,3 +139,71 @@ async def test_status_answers_from_the_board(runtime):
assert working.output.startswith("Scout is working on:")
unknown = await status.execute({"agent": "ghost"}, _ctx("what is ghost doing"))
assert unknown.success is False
+
+
+# --------------------------------------------------------------- the lead picks
+
+
+def _tool(name: str, desc: str) -> SimpleNamespace:
+ return SimpleNamespace(name=name, description=desc, risk_tier="monitor", schema={})
+
+
+async def team(tmp_path: Path):
+ """A society with a mail agent and a researcher, hands from a tiny catalog."""
+ chat = FakeChat(tmp_path / "agent_chat.db")
+ cfg = SimpleNamespace(memory=SimpleNamespace(data_dir=str(tmp_path / "data")))
+ tools = {
+ "gmail": _tool("gmail", "Read and send mail."),
+ "search-web": _tool("search-web", "Search the web."),
+ }
+ rt = SocietyRuntime(
+ tmp_path, chat_service=lambda: chat, cfg=lambda: cfg, brain_tools=lambda: tools
+ )
+ await rt.ensure_started()
+ await rt.roster.create(
+ name="Gmail agent", focus=["plugin:gmail"], provider="openai", model="gpt-5.2"
+ )
+ await rt.roster.create(
+ name="Scout", focus=["core:search-web"], provider="openai", model="gpt-5.2"
+ )
+ try:
+ yield rt, chat
+ finally:
+ await rt.close()
+
+
+async def test_delegate_without_a_name_picks_by_the_task(team):
+ """'Give that to the team' — the lead picks the agent whose hands fit (2026-09-03)."""
+ rt, chat = team
+ tool = DelegateToAgentTool(runtime_resolver=lambda: rt)
+ res = await tool.execute(
+ {"task": "Answer the invoice mail in gmail.", "turn_language": "en"},
+ _ctx("give that to the team"),
+ )
+ assert res.success, res.error
+ assert res.output == "Gmail agent is on it, I will let you know."
+ assert chat.sent and chat.sent[0][0] == "society:gmail-agent"
+
+
+async def test_delegate_with_a_misheard_name_still_finds_the_fit(team):
+ """'email agent' is not on the roster; the task's words are."""
+ rt, chat = team
+ tool = DelegateToAgentTool(runtime_resolver=lambda: rt)
+ res = await tool.execute(
+ {"agent": "email agent", "task": "check my inbox in gmail", "turn_language": "en"},
+ _ctx("email agent, check my inbox"),
+ )
+ assert res.success, res.error
+ assert chat.sent and chat.sent[0][0] == "society:gmail-agent"
+
+
+async def test_delegate_without_a_fit_says_so(team):
+ rt, chat = team
+ tool = DelegateToAgentTool(runtime_resolver=lambda: rt)
+ res = await tool.execute(
+ {"task": "Water the plants.", "turn_language": "en"}, _ctx("give that to the team")
+ )
+ assert res.success is False and res.error == "no_agent_fits"
+ assert res.output == "None of your agents fits this task."
+ assert not chat.sent
diff --git a/tests/unit/realtime/test_session_society_directive.py b/tests/unit/realtime/test_session_society_directive.py
new file mode 100644
index 0000000000..e18ab3b210
--- /dev/null
+++ b/tests/unit/realtime/test_session_society_directive.py
@@ -0,0 +1,73 @@
+"""The live model must know which of the user's agents exist, by name.
+
+Live failure 2026-09-03 (Realtime): with a freshly created Gmail agent on the
+island, "welche Agents hast du?" was answered from the retired sub-agent
+system, and "Gmail agent, check my inbox" was answered natively — the
+session instructions carried the persona, the clock and the coding-terminal
+roster, and nothing about the agent society. The twin of the workspace
+directive: names and the routing rule go into the per-turn instructions;
+the team card with each agent's hands stays with the orchestrator.
+"""
+
+from __future__ import annotations
+
+from typing import Any
+
+import pytest
+
+from jarvis.realtime import session as session_module
+from jarvis.society import lead_card
+
+
+def society(monkeypatch: pytest.MonkeyPatch) -> Any:
+ def _install(names: tuple[str, ...]) -> None:
+ monkeypatch.setattr(lead_card, "society_agent_names", lambda: names)
+
+ return _install
+
+
+def _directive() -> str:
+ instance = object.__new__(session_module.RealtimeVoiceSession)
+ return session_module.RealtimeVoiceSession._society_directive(instance)
+
+
+def test_the_directive_names_every_live_agent(society: Any) -> None:
+ society(("Gmail agent", "Scout"))
+ directive = _directive()
+ assert "Gmail agent" in directive
+ assert "Scout" in directive
+
+
+def test_the_directive_routes_the_team_to_the_action_function(society: Any) -> None:
+ society(("Gmail agent",))
+ directive = _directive().casefold()
+ assert "not people" in directive
+ assert "call your action function" in directive
+ assert "retired sub-agent" in directive
+ assert "do not know who" in directive
+
+
+def test_no_society_no_directive(society: Any) -> None:
+ society(())
+ assert _directive() == ""
+
+
+def test_the_instructions_carry_the_directive_in_both_profiles() -> None:
+ line = "[Agent society — the user's own agents, live right now]"
+ for compact in (False, True):
+ text = session_module._session_instructions(
+ "de", society_directive=line, compact=compact
+ )
+ assert line in text
+
+
+def test_the_workspace_directive_calls_terminals_terminals(monkeypatch: pytest.MonkeyPatch):
+ """Since the society exists, 'agent' is taken: a pane is a coding terminal."""
+ from jarvis.agentic_ide import session as ide_session
+
+ monkeypatch.setattr(ide_session, "running_call_signs", lambda: ["T1"])
+ instance = object.__new__(session_module.RealtimeVoiceSession)
+ directive = session_module.RealtimeVoiceSession._workspace_directive(instance)
+ assert "coding terminals are running" in directive
+ assert "not society agents" in directive
diff --git a/tests/unit/society/test_lead_card.py b/tests/unit/society/test_lead_card.py
new file mode 100644
index 0000000000..ae64e1ebdf
--- /dev/null
+++ b/tests/unit/society/test_lead_card.py
@@ -0,0 +1,235 @@
+"""The lead's team card: Jarvis knows its society from the roster, every turn.
+
+Live failure 2026-09-03: asked "which agents do you have access to?" with a
+freshly created Gmail agent on the island, Jarvis answered from the retired
+sub-agent (mission worker) system — its prompt had never heard of the
+society. The card is the fix, and these tests pin its contract:
+
+1. a created agent is on the very next card (no restart, no REST listing);
+2. the card is deterministic — same roster, same bytes;
+3. archived agents vanish, paused ones say so, busy ones say so;
+4. the card names each agent's hands and quotes its brief;
+5. the rule block says what "agent" means and where the old system went;
+6. the realtime helper hands the planner the live names;
+7. the lead picks the fitting agent for a nameless delegation;
+8. a lead-assigned RESULT reaches the person: a chat notice and a spoken
+ completion.
+"""
+
+from __future__ import annotations
+
+from pathlib import Path
+from types import SimpleNamespace
+from typing import Any
+
+import pytest
+
+from jarvis.society import runtime as runtime_mod
+from jarvis.society.events import MsgType, SocietyEnvelope
+from jarvis.society.lead_card import (
+ CARD_TITLE,
+ lead_card_section,
+ render_lead_card,
+ society_agent_names,
+)
+from jarvis.society.runtime import SocietyRuntime
+
+
+def _tool(name: str, desc: str = "x.") -> SimpleNamespace:
+ return SimpleNamespace(name=name, description=desc, risk_tier="monitor", schema={})
+
+
+TOOLS = {
+ "gmail": _tool("gmail", "Read and send mail."),
+ "search-web": _tool("search-web", "Search the web."),
+ "cli_gh": _tool("cli_gh", "GitHub."),
+}
+
+
+def tmp_path_of(rt: SocietyRuntime) -> Path:
+ return rt.data_dir
+
+
+class FakeChat:
+ """Enough of AgentChatService to receive a notice in the front-page chat."""
+
+ def __init__(self, db: Path) -> None:
+ from jarvis.agent_chat.store import AgentChatStore
+
+ self.store = AgentChatStore(db)
+ self.notices: list[tuple[str, dict[str, Any]]] = []
+
+ async def post_notice(self, session_id: str, payload: dict[str, Any]) -> None:
+ self.notices.append((session_id, payload))
+
+
+async def rt(tmp_path: Path):
+ published: list[Any] = []
+ chat = FakeChat(tmp_path / "agent_chat.db")
+ runtime = SocietyRuntime(
+ tmp_path,
+ seed_starter_team=False,
+ brain_tools=lambda: TOOLS,
+ chat_service=lambda: chat,
+ event_publish=published.append,
+ )
+ runtime.published = published # type: ignore[attr-defined]
+ runtime.chat = chat # type: ignore[attr-defined]
+ await runtime.ensure_started()
+ try:
+ yield runtime
+ finally:
+ await runtime.close()
+
+
+async def test_a_created_agent_is_on_the_next_card(rt: SocietyRuntime):
+ before = lead_card_section(lead_name="George")
+ assert before.startswith(CARD_TITLE)
+ assert "No other agents yet" in before
+ assert "Gmail agent" not in before
+
+ await rt.roster.create(
+ name="Gmail agent",
+ title="Mailbox",
+ description="Handle my mail. Never delete anything.",
+ focus=["plugin:gmail"],
+ )
+
+ after = lead_card_section(lead_name="George")
+ assert "- Gmail agent — Mailbox · specialist · idle · hands: gmail" in after
+ assert 'brief: "Handle my mail. Never delete anything."' in after
+ assert "No other agents yet" not in after
+ assert "You are George, the lead" in after
+
+
+async def test_the_card_is_byte_stable_between_roster_changes(rt: SocietyRuntime):
+ await rt.roster.create(name="Scout", title="Researcher", focus=["core:search-web"])
+ first = lead_card_section()
+ assert first == lead_card_section() == lead_card_section()
+ await rt.roster.update("scout", {"title": "Head of research"})
+ assert lead_card_section() != first
+
+
+async def test_archived_vanish_paused_and_busy_say_so(rt: SocietyRuntime):
+ await rt.roster.create(name="Scout", focus=["core:search-web"])
+ await rt.roster.create(name="Builder", focus=["cli:gh"])
+ await rt.roster.create(name="Old", focus=[])
+ await rt.roster.archive("old")
+ await rt.roster.update("builder", {"state": "paused"})
+ rt.scheduler.note_run_started("run-1", "scout")
+
+ card = lead_card_section()
+ assert "- Old" not in card
+ assert "- Builder · specialist · paused" in card
+ assert "- Scout · specialist · busy (1 run)" in card
+
+
+def test_render_lists_hands_by_grant_mode():
+ catalog = [
+ SimpleNamespace(id="plugin:gmail", label="Gmail", connected=True),
+ SimpleNamespace(id="plugin:cal", label="Calendar", connected=True),
+ SimpleNamespace(id="plugin:off", label="Offline", connected=False),
+ ]
+
+ def agent(name: str, **over: Any) -> SimpleNamespace:
+ base = dict(
+ agent_id=name.lower(),
+ name=name,
+ title="",
+ description="",
+ tier="specialist",
+ state="active",
+ focus=[],
+ grants=[],
+ denies=[],
+ grant_mode="all",
+ updated_ms=1,
+ )
+ base.update(over)
+ return SimpleNamespace(**base)
+
+ card = render_lead_card(
+ [
+ agent("Jarvis", agent_id="jarvis", tier="lead"),
+ agent("Everything"),
+ agent("Picky", grant_mode="allowlist", grants=["plugin:cal", "plugin:off"]),
+ agent("Bare", grant_mode="allowlist"),
+ agent("Focused", focus=["plugin:gmail", "plugin:off"], denies=["plugin:cal"]),
+ ],
+ catalog,
+ terminals=("T1", "T2"),
+ )
+ assert "- Jarvis" not in card # the lead never lists itself as a teammate
+ assert "- Everything · specialist · idle · hands: every connected tool" in card
+ assert "- Picky · specialist · idle · hands: Calendar" in card # disconnected hidden
+ assert "- Bare · specialist · idle · hands: none granted yet" in card
+ assert "- Focused · specialist · idle · hands: Gmail" in card
+ assert (
+ "Coding terminals open in the Agentic IDE right now (not society agents): T1, T2."
+ in card
+ )
+
+
+def test_the_rule_block_names_the_tools_and_buries_the_old_system():
+ card = render_lead_card([], [], lead_name="George")
+ assert "delegate_to_agent" in card
+ assert "society_status" in card
+ assert "never from the retired sub-agent or mission-worker system" in card
+ assert "spawn_worker is only for heavy background work" in card
+ assert "Agentic IDE" in card and "are NOT agents of this society" in card
+
+
+async def test_society_agent_names_feed_the_realtime_path(rt: SocietyRuntime):
+ assert society_agent_names() == ()
+ await rt.roster.create(name="Gmail agent", focus=["plugin:gmail"])
+ await rt.roster.create(name="Scout", focus=["core:search-web"])
+ await rt.roster.create(name="Sleeper", focus=[])
+ await rt.roster.update("sleeper", {"state": "paused"})
+ assert society_agent_names() == ("Gmail agent", "Scout")
+
+
+def test_without_a_runtime_everything_is_quiet():
+ runtime_mod.set_current_runtime(None)
+ assert lead_card_section() == ""
+ assert society_agent_names() == ()
+
+
+async def test_the_lead_picks_the_agent_whose_hands_fit(rt: SocietyRuntime):
+ await rt.roster.create(name="Gmail agent", focus=["plugin:gmail"])
+ await rt.roster.create(name="Scout", focus=["core:search-web"])
+ assert rt.pick_agent("answer the invoice mail in gmail").agent_id == "gmail-agent"
+ assert rt.pick_agent("search the web for the best VPS").agent_id == "scout"
+ assert rt.pick_agent("water the plants") is None
+
+
+async def test_a_lead_assigned_result_reaches_the_person(rt: SocietyRuntime):
+ chat: FakeChat = rt.chat # type: ignore[attr-defined]
+ chat.store.create_session(
+ provider="openai", model="gpt-5.2", effort="", cwd=str(tmp_path_of(rt)), surface="jarvis"
+ )
+ gmail = await rt.roster.create(name="Gmail agent", focus=["plugin:gmail"])
+ env = SocietyEnvelope(
+ msg_type=MsgType.ASSIGN,
+ from_agent="jarvis",
+ to_agent=gmail[0].agent_id,
+ trace_id="voice:abc",
+ payload={"text": "Answer the invoice mail.", "lang": "de"},
+ )
+
+ await rt.report_to_lead(gmail[0], env, status="done", summary="Invoice answered.")
+
+ assert len(chat.notices) == 1
+ session_id, payload = chat.notices[0]
+ assert chat.store.get_session(session_id).surface == "jarvis"
+ assert payload["kind"] == "society_result"
+ assert payload["agent_name"] == "Gmail agent"
+ assert payload["status"] == "done"
+ assert payload["text"] == "Invoice answered."
+ published = rt.published # type: ignore[attr-defined]
+ announcements = [e for e in published if type(e).__name__ == "AnnouncementRequested"]
+ assert len(announcements) == 1
+ assert announcements[0].kind == "completion"
+ assert announcements[0].language == "de"
+ spoken = "Gmail agent ist fertig: Invoice answered." # i18n-allow: spoken completion
+ assert announcements[0].text == spoken