Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(society): let Jarvis create rich agents and schedule their routines by voice
rubenluetke10-beep171fcb6ec274
diff --git a/docs/commands-reference.md b/docs/commands-reference.mdindex e5f5878db8..560c4e0da7 100644--- a/docs/commands-reference.md+++ b/docs/commands-reference.md@@ -13,10 +13,10 @@ Commands marked **requires confirmation** never run on a bare voice request —## `society-create-agent` — Create a persistent team agent-Create an agent in the user's existing Agents team, only when requested. This creates a roster profile and starts no work. Responsibilities derive capabilities through the same service as the Agents UI. Read the returned agent and created flag: an existing name is adopted, never duplicated. Use society-switch-agent-model only if a specific provider is requested.+Create an agent in the user's existing Agents team, only when requested. This creates a roster profile and starts no work. Responsibilities derive capabilities through the same service as the Agents UI. When a team agent creates a teammate, the new agent inherits that creator's model seat (provider, model, effort, subscription account) and permission setup (ceiling, grant mode, grants, denies) and cannot exceed them. Read the returned agent and created flag: an existing name is adopted, never duplicated. Use society-switch-agent-model only if a different provider is requested. Design the agent before calling: turn the user's words into a complete brief — mission, 3-6 responsibilities, working rules naming the data sources, output format and boundaries — inferring sensible defaults instead of copying the request verbatim. Read readback.not_connected and tell the user which services to connect. A requested schedule is a separate society-create-routine call.- **Endpoint:** `POST /api/society/agents`-- **Arguments:** `name` (string; required); `title` (string; optional); `description` (string; optional); `tier` (one of: specialist, orchestrator; optional); `focus` (array; optional); `skills` (array; optional); `daily_budget_usd` (number; optional); `max_concurrent_runs` (integer; optional)+- **Arguments:** `name` (string; required); `title` (string; optional); `description` (string; optional); `mission` (string; optional); `responsibilities` (array; optional); `working_rules` (array; optional); `output_format` (string; optional); `boundaries` (array; optional); `success_criteria` (string; optional); `tier` (one of: specialist, orchestrator; optional); `focus` (array; optional); `skills` (array; optional); `daily_budget_usd` (number; optional); `max_concurrent_runs` (integer; optional); `permission_ceiling` (one of: safe, monitor, ask; optional); `grant_mode` (one of: all, allowlist; optional); `grants` (array; optional); `denies` (array; optional)- **Requires confirmation:** no- **Desktop UI section:** `agents`- **Voice example (EN):** "create an agent for researching suppliers"@@ -26,7 +26,7 @@ Create an agent in the user's existing Agents team, only when requested. This crChange an existing agent's responsibilities, skills, focus, budget or paused/active state as requested by the user. Resolve its real id with society_status first. Only send requested fields. Existing learned focus and approval rules survive prose edits. Report the returned stored agent.- **Endpoint:** `PATCH /api/society/agents/{agent_id}`-- **Arguments:** `agent_id` (string; required); `title` (string; optional); `description` (string; optional); `tier` (one of: specialist, orchestrator; optional); `focus` (array; optional); `skills` (array; optional); `daily_budget_usd` (number; optional); `max_concurrent_runs` (integer; optional); `state` (one of: active, paused; optional)+- **Arguments:** `agent_id` (string; required); `title` (string; optional); `description` (string; optional); `mission` (string; optional); `responsibilities` (array; optional); `working_rules` (array; optional); `output_format` (string; optional); `boundaries` (array; optional); `success_criteria` (string; optional); `tier` (one of: specialist, orchestrator; optional); `focus` (array; optional); `skills` (array; optional); `daily_budget_usd` (number; optional); `max_concurrent_runs` (integer; optional); `permission_ceiling` (one of: safe, monitor, ask; optional); `grant_mode` (one of: all, allowlist; optional); `grants` (array; optional); `denies` (array; optional); `state` (one of: active, paused; optional)- **Requires confirmation:** no- **Desktop UI section:** `agents`- **Voice example (EN):** "update Scout's responsibilities"@@ -61,6 +61,56 @@ Change one persistent agent's provider/model/effort only on user request. Use so- **Desktop UI section:** `agents`- **Voice example (EN):** "change Scout's model"+## `society-archive-agent` — Archive a team agent++Archive (remove from the team) one agent on explicit user request; its chat history is kept. Delete its routines first with society-routine-operation so none keeps firing.++- **Endpoint:** `DELETE /api/society/agents/{agent_id}`+- **Arguments:** `agent_id` (string; required)+- **Requires confirmation:** yes+- **Desktop UI section:** `agents`+- **Voice example (EN):** "delete the agent Scout"++## `society-list-routines` — List an agent's routines++List one agent's scheduled routines with ids, schedules, state and next run.++- **Endpoint:** `GET /api/society/agents/{agent_id}/routines`+- **Arguments:** `agent_id` (string; required)+- **Requires confirmation:** no+- **Desktop UI section:** `agents`+- **Voice example (EN):** "which routines does Scout have"++## `society-create-routine` — Schedule a routine for an agent++The ONLY way to make an agent do something on a schedule (daily briefing, weekly report, every morning at 8). Never use create-skill for this. The prompt is the complete task the agent runs each time: sources, steps, output. Speak the returned next_run; on timezone_required ask the user.++- **Endpoint:** `POST /api/society/agents/{agent_id}/routines`+- **Arguments:** `agent_id` (string; required); `title` (string; required); `prompt` (string; required); `schedule` (object; required); `announce_on_success` (string; optional)+- **Requires confirmation:** yes+- **Desktop UI section:** `agents`+- **Voice example (EN):** "give me a briefing every morning at eight"++## `society-update-routine` — Change an agent's routine++Change a routine's title, prompt or schedule. Send all three: read the current values with society-list-routines and change only what was asked.++- **Endpoint:** `PATCH /api/society/agents/{agent_id}/routines/{task_id}`+- **Arguments:** `agent_id` (string; required); `task_id` (string; required); `title` (string; required); `prompt` (string; required); `schedule` (object; required)+- **Requires confirmation:** no+- **Desktop UI section:** `agents`+- **Voice example (EN):** "move the briefing to seven"++## `society-routine-operation` — Pause, resume, delete or run a routine++Pause, resume, delete or run-now one agent routine on user request.++- **Endpoint:** `POST /api/society/agents/{agent_id}/routines/{task_id}/operation`+- **Arguments:** `agent_id` (string; required); `task_id` (string; required); `operation` (one of: pause, resume, delete, run; required)+- **Requires confirmation:** yes+- **Desktop UI section:** `agents`+- **Voice example (EN):** "pause the morning briefing"+## `brain-switch` — Switch brain providerSwitch the ACTIVE main brain (LLM) provider, e.g. from openai to claude-api. Reversible; validated against the provider catalog and stored credentials.@@ -96,7 +146,7 @@ Switch the speech-to-text provider. Takes effect on the next voice-pipeline starSwitch which realtime voice engine (speech-to-speech) is active, including subscription- and API-backed providers. Experimental transports require explicit acknowledgement.- **Endpoint:** `POST /api/realtime/switch`-- **Arguments:** `provider` (one of: gemini-live, local-realtime, openai-realtime, vertex-live; required); `persist` (boolean; optional); `accept_experimental` (boolean; optional)+- **Arguments:** `provider` (one of: gemini-live, local-realtime, openai-live, vertex-live; required); `persist` (boolean; optional); `accept_experimental` (boolean; optional)- **Requires confirmation:** no- **Desktop UI section:** `apikeys`- **Voice example (EN):** "switch the realtime model to gemini"@@ -146,7 +196,7 @@ List all configured providers and which ones are active.Test connectivity and authentication for one provider.- **Endpoint:** `POST /api/providers/{provider_id}/test`-- **Arguments:** `provider_id` (one of: antigravity, cartesia, claude-api, claude-cli, codex, elevenlabs, faster-whisper, gemini, gemini-api, gemini-flash-tts, gemini-live, gemini-polish, grok, grok-build, grok-voice, groq-api, groq-polish, inworld, local-openai, local-realtime, nemotron-local, nvidia, ollama, ollama-polish, openai, openai-api, openai-polish, openai-realtime, openrouter, openrouter-polish, openrouter-stt, openrouter-tts, piper-local, vertex, vertex-live, vertex-stt, vertex-tts; required)+- **Arguments:** `provider_id` (one of: antigravity, cartesia, claude-api, claude-cli, codex, elevenlabs, faster-whisper, gemini, gemini-api, gemini-flash-tts, gemini-live, gemini-polish, grok, grok-build, grok-voice, groq-api, groq-polish, inworld, local-openai, local-realtime, nemotron-local, nvidia, ollama, ollama-polish, openai, openai-api, openai-live, openai-polish, openrouter, openrouter-polish, openrouter-stt, openrouter-tts, piper-local, vertex, vertex-live, vertex-stt, vertex-tts; required)- **Requires confirmation:** no- **Desktop UI section:** `apikeys`- **Voice example (EN):** "test the openai provider"diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.pyindex 449fbda95f..dd59ce6379 100644--- a/jarvis/brain/manager.py+++ b/jarvis/brain/manager.py@@ -1878,6 +1878,17 @@ _ACTION_UNFULFILLED_PHRASES: dict[str, dict[str, str]] = {"No se ejecutó la acción de guardarla." # i18n-allow: runtime output),},+ "society-create-routine": {+ "de": (+ "Die Routine wurde nicht erstellt. " # i18n-allow: runtime output+ "Der Speichervorgang wurde nicht ausgeführt." # i18n-allow: runtime output+ ),+ "en": "The routine was not created. The save action did not run.",+ "es": (+ "La rutina no se creó. " # i18n-allow: runtime output+ "No se ejecutó la acción de guardarla." # i18n-allow: runtime output+ ),+ },"contact-upsert": {"de": ("Ich hab den Kontakt noch nicht gespeichert — sag mir die Angaben " # i18n-allow: German TTS@@ -5808,6 +5819,18 @@ class BrainManager:)return explicit_skill+ # Channel 0.4 (2026-09-29): scheduled work for an agent ("a briefing+ # every day at 8", "create a routine that …") is an agent routine.+ # No skill captures it — neither the skill-creator (it wrote an+ # inactive draft skill live) nor a briefing skill that would run+ # once now instead of scheduling.+ if "society-create-routine" in self._live_tool_names():+ from jarvis.society.routine_intent import wants_agent_routine++ if wants_agent_routine(user_text):+ log.info("scheduled agent work — society-create-routine owns this turn")+ return None+# Channel 0.5 (2026-08-18): the user asked to CREATE a skill# ("erstell mir einen neuen Skill, der … mit YouTube Music …").# Every service named inside that sentence is the CONTENT of the@@ -11647,6 +11670,31 @@ class BrainManager:self._evidence_required_domain = "routine"log.info("Society routine creation intent — mandating society_propose_change")+ # Jarvis itself (voice and the lead chat) schedules an agent's+ # recurring work through the society-create-routine app command. A+ # request like "a briefing every day at 8" never says "routine" and+ # used to end as an inactive draft skill (live 2026-09-29), so the+ # recurrence alone makes the save mandatory.+ if (+ not self._evidence_required_tool+ and "society-create-routine" in self._live_tool_names()+ ):+ from jarvis.society.routine_intent import wants_agent_routine++ if wants_agent_routine(user_text):+ self._evidence_directive = (+ "MANDATORY THIS TURN: the user wants work done on a schedule. "+ "If the agent does not exist yet, create it with society-create-agent "+ "first. Then call society-create-routine for that agent with a "+ "self-contained prompt and the schedule. Never use create-skill for "+ "scheduled work. Speak the returned next_run; if the tool fails, say "+ "the routine was not created."+ )+ self._evidence_required_tool = "society-create-routine"+ self._evidence_required_is_write = True+ self._evidence_required_domain = "routine"+ log.info("Recurring-work intent — mandating society-create-routine")+# Phase 5 / ADR-0006: pre-call budget gate. Block rather than request# when cooldown is active or the task/daily budget is exhausted.trace_uuid = turn_trace_id@@ -12078,6 +12126,14 @@ class BrainManager:_turn_tools = self._hide_run_skill_on_pc_control_turn(_turn_tools, user_text)+ # Scheduled work for an agent is a routine, never a draft skill+ # with a cron line (live 2026-09-29: "every day at 8" became an+ # inactive skill while the routine was reported as set up).+ if (+ isinstance(_turn_tools, dict)+ and self._evidence_required_tool == "society-create-routine"+ ):+ _turn_tools = {n: t for n, t in _turn_tools.items() if n != "create-skill"}# AI Pointer: on a deictic pointer turn the cursor crop is already the# only attached image, so drop the redundant ``inspect-pointer`` PULL# tool (calling it produced an empty spoken answer — observed live).diff --git a/jarvis/commands/registry.py b/jarvis/commands/registry.pyindex d14805292e..2756b0ec63 100644--- a/jarvis/commands/registry.py+++ b/jarvis/commands/registry.py@@ -162,7 +162,11 @@ def _society_profile_properties() -> dict[str, Any]:"""Voice-editable profile fields; execution uses the existing roster REST route."""return {"title": _str_param("The agent's responsibility or role.", max_length=120),- "description": _str_param("Detailed responsibilities and instructions.", max_length=20_000),+ "description": _str_param(+ "Extra standing instructions in prose; the brief fields below are preferred.",+ max_length=20_000,+ ),+ **_agent_brief_properties(),"tier": _str_param("Team role.", enum=["specialist", "orchestrator"]),"focus": {"type": "array", "items": {"type": "string"},@@ -180,6 +184,75 @@ def _society_profile_properties() -> dict[str, Any]:"type": "integer", "minimum": 1,"description": "Maximum simultaneous assignments.",},+ "permission_ceiling": _str_param(+ "Highest risk tier it may run unasked.", enum=["safe", "monitor", "ask"],+ ),+ "grant_mode": _str_param(+ "all = every connected capability; allowlist = only grants.",+ enum=["all", "allowlist"],+ ),+ "grants": _str_list("Capability ids for an allowlist, only when requested."),+ "denies": _str_list("Capability ids the agent must never use."),+ }+++def _str_list(description: str) -> dict[str, Any]:+ return {"type": "array", "items": {"type": "string"}, "description": description}+++def _agent_brief_properties() -> dict[str, Any]:+ """The structured brief rendered into the agent's standing instructions."""+ return {+ "mission": _str_param("One sentence: what the agent exists for.", max_length=2_000),+ "responsibilities": _str_list("Concrete recurring duties, each one actionable."),+ "working_rules": _str_list("Step-by-step method: sources to read, order, priorities."),+ "output_format": _str_param(+ "Shape of every result: medium (artifact, chat, mail), length, sections.",+ max_length=2_000,+ ),+ "boundaries": _str_list("What it must never do or only after approval."),+ "success_criteria": _str_param("How a good result is recognised.", max_length=2_000),+ }+++_AGENT_DESIGN_GUIDE = (+ "Design the agent before calling: turn the user's words into a complete brief — "+ "mission, 3-6 responsibilities, working rules naming the data sources, output "+ "format and boundaries — inferring sensible defaults instead of copying the "+ "request verbatim. Read readback.not_connected and tell the user which services "+ "to connect. A requested schedule is a separate society-create-routine call."+)+++def _routine_schedule_param(*, examples: bool = True) -> dict[str, Any]:+ if not examples:+ return {**_routine_schedule_param(), "description": "Same shape as in creation."}+ return {+ "type": "object",+ "description": (+ 'When it runs. "every day at 8" = {"kind":"calendar","local_time":"08:00"}; '+ 'weekdays add "days":["mon","tue","wed","thu","fri"]; '+ '"every 2 hours" = {"kind":"every","interval_seconds":7200}; '+ 'once = {"kind":"at_time","iso_timestamp":"2026-10-01T08:00:00"}. '+ "timezone is filled from the user's device; pass it only when they name one."+ ),+ "properties": {+ "kind": {"type": "string", "enum": ["calendar", "cron", "every", "at_time"]},+ "local_time": {"type": "string", "description": "HH:MM on the user's clock."},+ "days": _str_list("Weekdays mon..sun; omit for every day."),+ "interval_seconds": {"type": "number", "minimum": 60},+ "expression": {"type": "string", "description": "Five-field cron."},+ "iso_timestamp": {"type": "string"},+ "timezone": {"type": "string", "description": "IANA zone, e.g. Europe/Berlin."},+ },+ "required": ["kind"],+ }+++def _routine_ref_params() -> dict[str, Any]:+ return {+ "agent_id": _str_param("Agent id or exact name.", min_length=1),+ "task_id": _str_param("Routine id from society-list-routines.", min_length=1),}@@ -199,7 +272,7 @@ def _build_registry() -> tuple[AppCommand, ...]:"(ceiling, grant mode, grants, denies) and cannot exceed them. Read the ""returned agent and created flag: an existing name is adopted, never ""duplicated. Use society-switch-agent-model only if a different provider "- "is requested."+ "is requested. " + _AGENT_DESIGN_GUIDE),method="POST", path="/api/society/agents", ui_section="agents",params={"type": "object", "properties": {@@ -290,6 +363,112 @@ def _build_registry() -> tuple[AppCommand, ...]:"es": ("cambia el modelo de Scout",), # i18n-allow: input vocab},),+ AppCommand(+ id="society-archive-agent",+ title="Archive a team agent",+ description=(+ "Archive (remove from the team) one agent on explicit user request; its "+ "chat history is kept. Delete its routines first with "+ "society-routine-operation so none keeps firing."+ ),+ method="DELETE", path="/api/society/agents/{agent_id}",+ path_params=("agent_id",), ui_section="agents", dangerous=True,+ params={"type": "object", "properties": {+ "agent_id": _str_param("Agent id or exact name.", min_length=1),+ }, "required": ["agent_id"]},+ voice_aliases={+ "de": ("lösche den agenten Scout",), # i18n-allow: input vocab+ "en": ("delete the agent Scout",),+ "es": ("elimina el agente Scout",), # i18n-allow: input vocab+ },+ ),+ AppCommand(+ id="society-list-routines",+ title="List an agent's routines",+ description=(+ "List one agent's scheduled routines with ids, schedules, state and next run."+ ),+ method="GET", path="/api/society/agents/{agent_id}/routines",+ path_params=("agent_id",), ui_section="agents",+ params={"type": "object", "properties": {+ "agent_id": _str_param("Agent id or exact name.", min_length=1),+ }, "required": ["agent_id"]},+ voice_aliases={+ "de": ("welche routinen hat Scout",), # i18n-allow: input vocab+ "en": ("which routines does Scout have",),+ "es": ("qué rutinas tiene Scout",), # i18n-allow: input vocab+ },+ ),+ AppCommand(+ id="society-create-routine",+ title="Schedule a routine for an agent",+ description=(+ "The ONLY way to make an agent do something on a schedule (daily briefing, "+ "weekly report, every morning at 8). Never use create-skill for this. The "+ "prompt is the complete task the agent runs each time: sources, steps, "+ "output. Speak the returned next_run; on timezone_required ask the user."+ ),+ method="POST", path="/api/society/agents/{agent_id}/routines",+ path_params=("agent_id",), ui_section="agents", dangerous=True,+ params={"type": "object", "properties": {+ "agent_id": _str_param("Agent id or exact name.", min_length=1),+ "title": _str_param("Short routine name.", min_length=1, max_length=200),+ "prompt": _str_param(+ "Self-contained instructions for each run.", min_length=1, max_length=16_000,+ ),+ "schedule": _routine_schedule_param(),+ "announce_on_success": _str_param(+ "Optional line Jarvis says when a run finishes.", max_length=500,+ ),+ }, "required": ["agent_id", "title", "prompt", "schedule"]},+ voice_aliases={+ "de": ("gib mir jeden morgen um acht ein briefing",), # i18n-allow: input vocab+ "en": ("give me a briefing every morning at eight",),+ "es": ("dame un resumen cada mañana a las ocho",), # i18n-allow: input vocab+ },+ ),+ AppCommand(+ id="society-update-routine",+ title="Change an agent's routine",+ description=(+ "Change a routine's title, prompt or schedule. Send all three: read the "+ "current values with society-list-routines and change only what was asked."+ ),+ method="PATCH", path="/api/society/agents/{agent_id}/routines/{task_id}",+ path_params=("agent_id", "task_id"), ui_section="agents",+ params={"type": "object", "properties": {+ **_routine_ref_params(),+ "title": _str_param("Routine name.", min_length=1, max_length=200),+ "prompt": _str_param("Full instructions.", min_length=1, max_length=16_000),+ "schedule": _routine_schedule_param(examples=False),+ }, "required": ["agent_id", "task_id", "title", "prompt", "schedule"]},+ voice_aliases={+ "de": ("verschieb das briefing auf sieben uhr",), # i18n-allow: input vocab+ "en": ("move the briefing to seven",),+ "es": ("mueve el resumen a las siete",), # i18n-allow: input vocab+ },+ ),+ AppCommand(+ id="society-routine-operation",+ title="Pause, resume, delete or run a routine",+ description=(+ "Pause, resume, delete or run-now one agent routine on user request."+ ),+ method="POST",+ path="/api/society/agents/{agent_id}/routines/{task_id}/operation",+ path_params=("agent_id", "task_id"), ui_section="agents", dangerous=True,+ params={"type": "object", "properties": {+ **_routine_ref_params(),+ "operation": _str_param(+ "What to do.", enum=["pause", "resume", "delete", "run"],+ ),+ }, "required": ["agent_id", "task_id", "operation"]},+ voice_aliases={+ "de": ("pausiere das morgenbriefing",), # i18n-allow: input vocab+ "en": ("pause the morning briefing",),+ "es": ("pausa el resumen de la mañana",), # i18n-allow: input vocab+ },+ ),# ------------------------------------------------------ providersAppCommand(id="brain-switch",diff --git a/jarvis/plugins/tool/app_command.py b/jarvis/plugins/tool/app_command.pyindex 1e9a0e2085..8c12b5675d 100644--- a/jarvis/plugins/tool/app_command.py+++ b/jarvis/plugins/tool/app_command.py@@ -320,7 +320,11 @@ class RegistryCommandTool:if key:headers["Authorization"] = f"Bearer {key}"from jarvis.society.inherit import caller_session_id+ from jarvis.tasks.context import CLIENT_TIMEZONE_HEADER, turn_timezone+ zone = turn_timezone()+ if zone:+ headers[CLIENT_TIMEZONE_HEADER] = zonesession_id = caller_session_id()if session_id:from jarvis.agent_chat.jarvis_harness import HEADER_NAMEdiff --git a/jarvis/plugins/tool/create_skill.py b/jarvis/plugins/tool/create_skill.pyindex 761e72d1d8..2eb47c5c8b 100644--- a/jarvis/plugins/tool/create_skill.py+++ b/jarvis/plugins/tool/create_skill.py@@ -55,9 +55,10 @@ class CreateSkillTool:risk_tier: ClassVar[str] = "monitor"description: ClassVar[str] = ("Create a NEW skill for this assistant from the user's description — use "- "this when the user asks to create, build, or set up a skill, routine, or "- "automation ('erstell mir einen Skill, der …', " # i18n-allow: quoted phrase- "'create a skill that …', 'jeden Morgen um 6 sollst du …'). " # i18n-allow: quoted phrase+ "this when the user asks to create, build, or set up a skill "+ "('erstell mir einen Skill, der …', 'create a skill that …'). " # i18n-allow: quoted phrase+ "Work on a schedule ('every morning at 6 …', a daily briefing, a routine) "+ "is NOT a skill: it is an agent routine, created with society-create-routine. ""Pass the COMPLETE description in ""'intent': what it should do, in which order, at what time or on which ""phrase, which services (mail, calendar, tickets, music, …) and every "diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.pyindex 34921cf764..7ac718034b 100644--- a/jarvis/realtime/session.py+++ b/jarvis/realtime/session.py@@ -3152,24 +3152,13 @@ class RealtimeVoiceSession:return ("[Agent society — the user's own agents, live right now]\n"f"Agents on the user's team: {roster}.\n"- "For an agent-list or status QUESTION call society_status via your action "- "function. This is a read-only lookup: do not assign work, spawn a worker, "- "or announce that any agent is starting. An empty name snapshot does not "- "prove the user has no agents. Creation and reconfiguration use the "- "society-create-agent, society-update-agent and society-switch-agent-model "- "app commands; inspect society-capability-catalog for valid capabilities "- "and society-agent-catalog for models. "- "Report management changes only after a successful tool result. "- "To send a message TO an agent, use message_agent (target, text), or "- "ask jarvis_action to use message_agent if it is not directly available. "- "This is an internal chat message, not an email: never use gmail or "- "another external messaging connector for it. Internal messages need "- "no extra confirmation. Use delegate_to_agent for assigning work, including "- "'tell X to test Y'; compose an actionable brief with known context, scope "- "and completion evidence. For 'ask X about Y', send a query requiring an answer. "- "Choose reply_policy: always for requested findings, on_error for blockers only, "- "none for information or explicit silence. Do not merely paraphrase the user "- "or invent missing facts. Delivery does not mean completion. "+ "For an agent-list or status QUESTION call society_status (directly or "+ "through your action function). This is a read-only lookup: do not assign "+ "work, spawn a worker, or announce that any agent is starting. An empty name "+ "snapshot does not prove the user has no agents. Creating, changing or "+ "archiving agents and their scheduled routines uses the society-* tools; "+ "messages and assignments use message_agent and delegate_to_agent. Their "+ "descriptions carry the rules; report only what a tool result confirmed. ""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 "diff --git a/jarvis/society/brief.py b/jarvis/society/brief.pynew file mode 100644index 0000000000..c7757b77ea--- /dev/null+++ b/jarvis/society/brief.py@@ -0,0 +1,72 @@+"""An agent's standing instructions, composed from a structured brief.++A voice request is one sentence ("an agent that sends me a morning briefing"),+and an agent that stores that sentence as its rulebook works from almost+nothing. The creating model fills these fields instead — mission, concrete+responsibilities, working rules, output format, boundaries, success+criteria — and this module renders them into the Markdown ``description``+deterministically, with no model call of its own (any single key works).+"""++from __future__ import annotations++from collections.abc import Iterable, Mapping+from typing import Any, Final++__all__ = ["BRIEF_FIELDS", "compose_description", "has_brief"]++#: Structured fields, in the order they appear in the rendered instructions.+BRIEF_FIELDS: Final[tuple[str, ...]] = (+ "mission",+ "responsibilities",+ "working_rules",+ "output_format",+ "boundaries",+ "success_criteria",+)++_HEADINGS: Final[dict[str, str]] = {+ "responsibilities": "Responsibilities",+ "working_rules": "How you work",+ "output_format": "Output",+ "boundaries": "Boundaries",+ "success_criteria": "Done means",+}+++def has_brief(fields: Mapping[str, Any]) -> bool:+ return any(_present(fields.get(name)) for name in BRIEF_FIELDS)+++def _present(value: Any) -> bool:+ if isinstance(value, str):+ return bool(value.strip())+ if isinstance(value, Iterable):+ return any(str(item).strip() for item in value)+ return False+++def _lines(value: Any) -> list[str]:+ if isinstance(value, str):+ return [value.strip()] if value.strip() else []+ return [" ".join(str(item).split()) for item in value or () if str(item).strip()]+++def compose_description(description: str, fields: Mapping[str, Any]) -> str:+ """Standing instructions: the mission, the free text, then one section per field."""+ parts: list[str] = []+ mission = _lines(fields.get("mission"))+ if mission:+ parts.append(" ".join(mission))+ if description.strip():+ parts.append(description.strip())+ for name in BRIEF_FIELDS[1:]:+ items = _lines(fields.get(name))+ if not items:+ continue+ heading = f"## {_HEADINGS[name]}"+ if isinstance(fields.get(name), str):+ parts.append(f"{heading}\n{items[0]}")+ else:+ parts.append(heading + "\n" + "\n".join(f"- {item}" for item in items))+ return "\n\n".join(parts)diff --git a/jarvis/society/lead_card.py b/jarvis/society/lead_card.pyindex fdb5181d3b..eb1c648ade 100644--- a/jarvis/society/lead_card.py+++ b/jarvis/society/lead_card.py@@ -76,13 +76,10 @@ def _rule_block(lead_name: str) -> str:"the user does not name it. Honor requests to handle work directly; ""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"- "- Create or reconfigure an agent only when requested: use society-create-agent, "- "society-update-agent or society-switch-agent-model through the app commands. "- "A teammate that creates another agent copies its own model seat and permission "- "setup onto the new agent unless a different model is requested. "- "Inspect society-capability-catalog for capabilities and society-agent-catalog "- "for models. These commands share the "- "Agents section's validation. Verify the returned state before claiming success.\n"+ "- Create, change or archive agents only when requested, with the society-* "+ "commands. Work on a schedule (a daily briefing, every Monday) is a routine: "+ "society-create-routine, never a skill. Verify the returned state before "+ "claiming success.\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.")diff --git a/jarvis/society/routine_intent.py b/jarvis/society/routine_intent.pyindex 66622b0b93..2949c8a3d0 100644--- a/jarvis/society/routine_intent.py+++ b/jarvis/society/routine_intent.py@@ -1,4 +1,4 @@-"""Recognize explicit requests to create an agent routine in a chat turn."""+"""Recognize requests to create an agent routine or other recurring work."""from __future__ import annotations@@ -43,3 +43,65 @@ def requests_routine_creation(text: str) -> bool:and not _PAST_REPORT.search(text)and is_skill_authoring_request(text))+++# Recurrence phrases in English, German and Spanish ("every day at 8").+_RECURRENCE = re.compile(+ r"\b(?:every\s+(?:day|morning|evening|night|week|weekday|month|hour|"+ r"monday|tuesday|wednesday|thursday|friday|saturday|sunday|\d+\s+\w+)|"+ r"each\s+(?:day|morning|evening|week|month)|daily|weekly|monthly|hourly|"+ r"jede[nrs]?\s+(?:tag|morgen|abend|nacht|woche|werktag|" # i18n-allow: input vocabulary+ r"monat|stunde|montag|dienstag|mittwoch|donnerstag|" # i18n-allow: input vocabulary+ r"freitag|samstag|sonntag)|" # i18n-allow: input vocabulary+ r"täglich\w*|taeglich\w*|wöchentlich\w*|" # i18n-allow: input vocabulary+ r"monatlich\w*|stündlich\w*|" # i18n-allow: input vocabulary+ r"alle\s+\d+\s+\w+|morgens\s+um|abends\s+um|werktags|" # i18n-allow: input vocabulary+ r"cada\s+(?:día|dia|mañana|manana|noche|semana|mes|hora|" # i18n-allow: input vocabulary+ r"lunes|martes|miércoles|jueves|viernes|sábado|domingo|" # i18n-allow: input vocabulary+ r"\d+\s+\w+)|"+ r"todos\s+los\s+(?:días|dias|lunes)|" # i18n-allow: input vocabulary+ r"diariamente|semanalmente)\b",+ re.IGNORECASE,+)+# The person asks for something to happen, rather than describing a habit.+_REQUEST_CUE = re.compile(+ r"\b(?:soll\w*|möcht\w*|will|bitte|mach\w*|gib|" # i18n-allow: input vocabulary+ r"schick\w*|send\w*|erstell\w*|erinner\w*|" # i18n-allow: input vocabulary+ r"kannst|könntest|fass\w*|informier\w*|" # i18n-allow: input vocabulary+ r"should|want|please|give|make|create|remind|set\s+up|can\s+you|could\s+you|"+ r"summari[sz]e|brief|tell\s+me|"+ r"quiero|por\s+favor|dame|envía|envia|crea|" # i18n-allow: input vocabulary+ r"recuérdame|puedes)\b", # i18n-allow: input vocabulary+ re.IGNORECASE,+)+++def requests_recurring_work(text: str) -> bool:+ """A request for work that repeats on a schedule, with or without the word+ "routine" ("give me a briefing every day at 8"); habits and how-to+ questions do not count."""+ if not _RECURRENCE.search(text) or _HOW_TO.search(text):+ return False+ return bool(_REQUEST_CUE.search(text)) and not _PAST_REPORT.search(text)+++_SKILL_WORD = re.compile(r"\bskills?\b", re.IGNORECASE)+++def wants_agent_routine(text: str) -> bool:+ """Scheduled work for an agent, not a request to author a skill.++ "Routine" is also a spoken synonym for a skill; the user saying "skill"+ keeps that meaning. Everything else that asks for recurring work or+ creates a routine belongs to ``society-create-routine``.+ """+ if _SKILL_WORD.search(text):+ return False+ if requests_recurring_work(text):+ return True+ return bool(+ _ROUTINE_NOUN.search(text)+ and _CREATE_VERB.search(text)+ and not _HOW_TO.search(text)+ and not _PAST_REPORT.search(text)+ )diff --git a/jarvis/society/routines.py b/jarvis/society/routines.pyindex 4df4a5ebe1..af62520d3c 100644--- a/jarvis/society/routines.py+++ b/jarvis/society/routines.py@@ -53,6 +53,8 @@ __all__ = ["create_routine","is_agent_routine","list_routines",+ "missing_timezone",+ "next_run_readback","routine_seat",]@@ -66,7 +68,7 @@ def agent_tag(agent_id: str) -> str:def _trigger(schedule: dict[str, Any]) -> Any:from jarvis.tasks.calendar import absolute_timestamp- from jarvis.tasks.context import client_timezone+ from jarvis.tasks.context import turn_timezonekind = str(schedule.get("kind") or schedule.get("type") or "every")if kind == "source":@@ -75,7 +77,7 @@ def _trigger(schedule: dict[str, Any]) -> Any:)if kind == "cron":values = dict(schedule)- values.setdefault("timezone", client_timezone.get())+ values.setdefault("timezone", turn_timezone())return TriggerCron.model_validate({"type": kind, **{k: v for k, v in values.items() if k not in ("kind", "type")}})@@ -86,7 +88,7 @@ def _trigger(schedule: dict[str, Any]) -> Any:)if kind == "calendar":schedule = dict(schedule)- schedule.setdefault("timezone", client_timezone.get())+ schedule.setdefault("timezone", turn_timezone())return TriggerCalendar.model_validate({"type": kind, **{k: v for k, v in schedule.items() if k not in ("kind", "type")}})@@ -95,7 +97,7 @@ def _trigger(schedule: dict[str, Any]) -> Any:interval_seconds=float(schedule.get("interval_seconds", 86_400)),start_at=(absolute_timestamp(- str(schedule["start_at"]), schedule.get("timezone") or client_timezone.get()+ str(schedule["start_at"]), schedule.get("timezone") or turn_timezone())if schedule.get("start_at")else None@@ -104,7 +106,7 @@ def _trigger(schedule: dict[str, Any]) -> Any:if kind == "at_time":return TriggerAtTime(iso_timestamp=absolute_timestamp(- str(schedule["iso_timestamp"]), schedule.get("timezone") or client_timezone.get()+ str(schedule["iso_timestamp"]), schedule.get("timezone") or turn_timezone()))if kind == "after_delay":@@ -121,6 +123,44 @@ def _trigger(schedule: dict[str, Any]) -> Any:raise ValueError(f"unknown schedule kind {kind!r}")+#: Schedule kinds pinned to a wall clock; they need the person's IANA zone.+_WALL_CLOCK_KINDS: Final[frozenset[str]] = frozenset({"calendar", "cron"})+++def missing_timezone(schedule: dict[str, Any]) -> bool:+ """True when a wall-clock schedule has no zone and the turn knows none."""+ from jarvis.tasks.context import turn_timezone++ kind = str(schedule.get("kind") or schedule.get("type") or "every")+ local_at_time = kind == "at_time" and not _has_offset(str(schedule.get("iso_timestamp", "")))+ if kind not in _WALL_CLOCK_KINDS and not local_at_time:+ return False+ return not (schedule.get("timezone") or turn_timezone())+++def _has_offset(stamp: str) -> bool:+ tail = stamp[10:]+ return stamp.endswith("Z") or "+" in tail or "-" in tail+++def next_run_readback(due_at_ns: int | None, timezone: str | None) -> str | None:+ """``"Wed 2026-09-30 08:00 (Europe/Berlin)"`` for a spoken confirmation."""+ if not due_at_ns:+ return None+ from datetime import UTC, datetime++ from jarvis.tasks.calendar import calendar_zone++ when = datetime.fromtimestamp(due_at_ns / 1e9, UTC)+ if timezone:+ try:+ when = when.astimezone(calendar_zone(timezone))+ except ValueError:+ timezone = "UTC"+ label = timezone or "UTC"+ return f"{when:%a %Y-%m-%d %H:%M} ({label})"++def _routine_prompt(agent: AgentRecord, prompt: str) -> str:lines = [f"You are {agent.name}" + (f", {agent.title}" if agent.title else "") + ",",diff --git a/jarvis/tasks/context.py b/jarvis/tasks/context.pyindex 14967f8ce7..9b05a957f4 100644--- a/jarvis/tasks/context.py+++ b/jarvis/tasks/context.py@@ -1,5 +1,28 @@-"""Per-turn scheduling context; never a process-global user's timezone."""+"""Per-turn scheduling context; never a server-derived default timezone.++``client_timezone`` is the zone of the client that sent the current turn (the+agent chat sends it with every message). A voice turn has no client of its+own, so it falls back to the zone the person's desktop or web UI last+reported for this app — still the person's device, never the server clock.+With neither known, a calendar routine asks for the zone instead of guessing.+"""from contextvars import ContextVarclient_timezone: ContextVar[str | None] = ContextVar("routine_client_timezone", default=None)++#: Header an in-process app command carries the turn's zone in.+CLIENT_TIMEZONE_HEADER = "X-Jarvis-Client-Timezone"++_reported_ui_timezone: str | None = None+++def remember_ui_timezone(zone: str) -> None:+ """Record the IANA zone the person's UI reported (validated by the caller)."""+ global _reported_ui_timezone+ _reported_ui_timezone = zone+++def turn_timezone() -> str | None:+ """The current turn's client zone, else the zone the UI last reported."""+ return client_timezone.get() or _reported_ui_timezonediff --git a/jarvis/ui/web/frontend/src/main.tsx b/jarvis/ui/web/frontend/src/main.tsxindex 836d408738..f66db67bc6 100644--- a/jarvis/ui/web/frontend/src/main.tsx+++ b/jarvis/ui/web/frontend/src/main.tsx@@ -82,6 +82,22 @@ void import("./lib/uiStallWatch").then(({ watchUiStalls }) => {});});+// Tell the backend which timezone this person lives in. A voice request such+// as "a briefing every day at 8" has no client of its own, so the routine it+// creates is scheduled on this zone instead of the server clock.+try {+ const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;+ if (timezone) {+ void fetch("/api/tasks/client-timezone", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ timezone }),+ }).catch(() => undefined);+ }+} catch {+ // A runtime without Intl zone data simply leaves voice routines to ask.+}+const queryClient = new QueryClient({defaultOptions: {queries: {diff --git a/jarvis/ui/web/society_routes.py b/jarvis/ui/web/society_routes.pyindex f22043798b..37554a5f0d 100644--- a/jarvis/ui/web/society_routes.py+++ b/jarvis/ui/web/society_routes.py@@ -13,7 +13,9 @@ is dangerous in both directions because releasing it resumes work.from __future__ import annotationsimport logging-from typing import Any+from collections.abc import Iterator+from contextlib import contextmanager+from typing import Any, Literalfrom uuid import uuid4from fastapi import APIRouter, HTTPException, Request@@ -95,6 +97,13 @@ class CreateAgentBody(BaseModel):browser_allowed_domains: list[str] | None = None#: Where the agent runs: "" = this computer, else a connected computer id.computer_id: str | None = None+ #: Structured brief (jarvis.society.brief); rendered into ``description``.+ mission: str | None = Field(default=None, max_length=2_000)+ responsibilities: list[str] | None = None+ working_rules: list[str] | None = None+ output_format: str | None = Field(default=None, max_length=2_000)+ boundaries: list[str] | None = None+ success_criteria: str | None = Field(default=None, max_length=2_000)class PatchAgentBody(BaseModel):@@ -124,6 +133,13 @@ class PatchAgentBody(BaseModel):browser_allowed_domains: list[str] | None = None#: Where the agent runs: "" = this computer, else a connected computer id.computer_id: str | None = None+ #: Structured brief (jarvis.society.brief); rendered into ``description``.+ mission: str | None = Field(default=None, max_length=2_000)+ responsibilities: list[str] | None = None+ working_rules: list[str] | None = None+ output_format: str | None = Field(default=None, max_length=2_000)+ boundaries: list[str] | None = None+ success_criteria: str | None = Field(default=None, max_length=2_000)class MessageBody(BaseModel):@@ -198,16 +214,38 @@ async def _creator_from_request(request: Request, rt: SocietyRuntime) -> AgentRereturn agent+def _capability_readback(rt: SocietyRuntime, agent: AgentRecord) -> dict[str, Any]:+ """What the agent can reach, so a spoken confirmation states facts: its+ focus by label, and focus capabilities whose service is not connected."""+ try:+ rows = {row.id: row for row in rt.catalog()}+ except Exception: # noqa: BLE001 — the readback is advisory; the save stands+ log.warning("society: capability readback unavailable", exc_info=True)+ return {}+ focus = [rows[cap].label if cap in rows else cap for cap in agent.focus]+ missing = [rows[cap].label for cap in agent.focus if cap in rows and not rows[cap].connected]+ readback: dict[str, Any] = {"focus": focus}+ if missing:+ readback["not_connected"] = missing+ readback["hint"] = "Tell the user to connect these in the Marketplace first."+ return readback++@router.post("/agents")async def create_agent(body: CreateAgentBody, request: Request) -> dict[str, Any]:+ from jarvis.society.brief import BRIEF_FIELDS, compose_description+rt = await _runtime(request)- fields = body.model_dump(exclude_none=True, exclude={"name", "title", "description", "tier"})+ fields = body.model_dump(+ exclude_none=True, exclude={"name", "title", "description", "tier", *BRIEF_FIELDS}+ )+ description = compose_description(body.description, body.model_dump(include=set(BRIEF_FIELDS)))creator = await _creator_from_request(request, rt)if creator is not None:from jarvis.society.inherit import inherit_creator_fieldsfields = inherit_creator_fields(fields, creator)- derived_focus, derived_rules = rt.derive(body.title, body.description)+ derived_focus, derived_rules = rt.derive(body.title, description)if body.focus is None and derived_focus:fields["focus"] = derived_focusif str(fields.get("grant_mode") or "") == "allowlist":@@ -220,13 +258,17 @@ async def create_agent(body: CreateAgentBody, request: Request) -> dict[str, Anyagent, created = await rt.roster.create(name=body.name,title=body.title,- description=body.description,+ description=description,tier=body.tier,**fields,)except RosterError as exc:raise _typed_error(exc) from exc- return {"agent": agent.to_dict(), "created": created}+ return {+ "agent": agent.to_dict(),+ "created": created,+ "readback": _capability_readback(rt, agent),+ }@router.get("/agents/{agent_id}")@@ -249,7 +291,13 @@ async def patch_agent(agent_id: str, body: PatchAgentBody, request: Request) ->agent = await rt.roster.resolve(agent_id)if agent is None:raise HTTPException(404, {"reason": str(FailureReason.TARGET_UNKNOWN)})- fields = body.model_dump(exclude_none=True)+ from jarvis.society.brief import BRIEF_FIELDS, compose_description, has_brief++ fields = body.model_dump(exclude_none=True, exclude=set(BRIEF_FIELDS))+ brief = body.model_dump(include=set(BRIEF_FIELDS))+ if has_brief(brief):+ # A brief rewrites the standing instructions as a whole.+ fields["description"] = compose_description(body.description or "", brief)if ("title" in fields or "description" in fields) and "focus" not in fields:# A prose edit must not wipe what the agent earned in its chat: the# derived focus is APPENDED to the existing order (existing first,@@ -274,7 +322,7 @@ async def patch_agent(agent_id: str, body: PatchAgentBody, request: Request) ->if "state" in fields:await rt.checkpoints.refresh(agent.agent_id)updated = await rt.roster.get(agent.agent_id) or updated- return {"agent": updated.to_dict()}+ return {"agent": updated.to_dict(), "readback": _capability_readback(rt, updated)}@router.post("/agents/{agent_id}/chat")@@ -884,9 +932,33 @@ async def list_agent_routines(agent_id: str, request: Request) -> dict[str, Any]return {"routines": rows, "total": len(rows)}[email protected]("/agents/{agent_id}/routines", openapi_extra={"x-jarvis-dangerous": True})-async def create_agent_routine(- agent_id: str, body: RoutineBody, request: Request+@contextmanager+def _turn_timezone(request: Request) -> Iterator[None]:+ """Adopt the zone an in-process app command forwarded for its turn."""+ from jarvis.tasks.context import CLIENT_TIMEZONE_HEADER, client_timezone++ zone = request.headers.get(CLIENT_TIMEZONE_HEADER)+ if not zone or client_timezone.get():+ yield+ return+ token = client_timezone.set(zone)+ try:+ yield+ finally:+ client_timezone.reset(token)+++_TIMEZONE_REQUIRED: dict[str, str] = {+ "reason": "timezone_required",+ "message": (+ "This schedule runs on the user's wall clock but their timezone is unknown. "+ "Ask for it and pass schedule.timezone as an IANA name such as Europe/Berlin."+ ),+}+++async def _create_routine_for(+ agent: AgentRecord, body: RoutineBody, request: Request) -> dict[str, Any]:"""A routine is a task in the Automations scheduler tagged with the agent."""from jarvis.society.routines import (@@ -895,15 +967,16 @@ async def create_agent_routine(count_routines,create_routine,is_agent_routine,+ missing_timezone,+ next_run_readback,)+ from jarvis.tasks.context import turn_timezone- rt = await _runtime(request)- agent = await rt.roster.resolve(agent_id)- if agent is None:- raise HTTPException(404, {"reason": str(FailureReason.TARGET_UNKNOWN)})store = _task_store(request)if await count_routines(store, agent.agent_id) >= MAX_ROUTINES_PER_AGENT:raise HTTPException(409, {"reason": str(FailureReason.BLOCKED_BY_POLICY)})+ if missing_timezone(body.schedule):+ raise HTTPException(422, _TIMEZONE_REQUIRED)parent_spec = Noneparent_row = Noneif body.parent_task_id:@@ -968,7 +1041,75 @@ async def create_agent_routine(if spec.action.kind == "agent"else None)- return {"id": task_id, "title": spec.title, "tags": list(spec.tags), "seat": seat}+ row = await store.get(task_id) or {}+ zone = getattr(spec.trigger, "timezone", None) or turn_timezone()+ return {+ "id": task_id,+ "title": spec.title,+ "tags": list(spec.tags),+ "seat": seat,+ "state": row.get("state"),+ "next_run": next_run_readback(row.get("due_at_ns"), zone),+ }++[email protected]("/agents/{agent_id}/routines", openapi_extra={"x-jarvis-dangerous": True})+async def create_agent_routine(+ agent_id: str, body: RoutineBody, request: Request+) -> dict[str, Any]:+ """A routine is a task in the Automations scheduler tagged with the agent."""+ rt = await _runtime(request)+ agent = await rt.roster.resolve(agent_id)+ if agent is None:+ raise HTTPException(404, {"reason": str(FailureReason.TARGET_UNKNOWN)})+ with _turn_timezone(request):+ return await _create_routine_for(agent, body, request)+++class RoutineOperationBody(BaseModel):+ model_config = ConfigDict(extra="forbid")+ operation: Literal["pause", "resume", "delete", "run"]+++ "/agents/{agent_id}/routines/{task_id}/operation",+ openapi_extra={"x-jarvis-dangerous": True},+)+async def operate_agent_routine(+ agent_id: str, task_id: str, body: RoutineOperationBody, request: Request+) -> dict[str, Any]:+ """Pause, resume, delete or run-now one of the agent's own routines."""+ from jarvis.society.routines import is_agent_routine, manage_routine+ from jarvis.tasks.scheduler import TaskNotFound, TaskStateConflict++ rt = await _runtime(request)+ agent = await rt.roster.resolve(agent_id)+ store = _task_store(request)+ row = await store.get(task_id)+ if agent is None or row is None or not is_agent_routine(row, agent.agent_id):+ raise HTTPException(404, "Routine not found")+ scheduler = getattr(request.app.state, "task_scheduler", None)+ if scheduler is None:+ raise HTTPException(503, "The task scheduler is unavailable")+ if body.operation == "run" and row.get("state") == "running":+ raise HTTPException(409, "The routine is already running")+ try:+ if body.operation == "run":+ await scheduler.run_now(task_id)+ else:+ await manage_routine(+ agent, {"task_id": task_id, "operation": body.operation}, store, scheduler+ )+ except TaskNotFound as exc:+ raise HTTPException(404, "Routine not found") from exc+ except TaskStateConflict as exc:+ raise HTTPException(409, str(exc)) from exc+ except ValueError as exc:+ raise HTTPException(422, str(exc)) from exc+ if body.operation == "delete":+ return {"ok": True, "id": task_id, "operation": "delete", "state": "deleted"}+ after = await store.get(task_id) or {}+ return {"ok": True, "id": task_id, "operation": body.operation, "state": after.get("state")}class RoutineUpdateBody(BaseModel):diff --git a/jarvis/ui/web/tasks_routes.py b/jarvis/ui/web/tasks_routes.pyindex 7ac944abf4..92620f8ba2 100644--- a/jarvis/ui/web/tasks_routes.py+++ b/jarvis/ui/web/tasks_routes.py@@ -192,6 +192,26 @@ async def add_template(return {"id": task_id}+class ClientTimezoneBody(BaseModel):+ model_config = ConfigDict(extra="forbid")+ timezone: str = Field(min_length=1, max_length=100)++[email protected]("/client-timezone")+async def report_client_timezone(body: ClientTimezoneBody) -> dict[str, Any]:+ """The UI reports the person's IANA zone once per load. Voice turns carry+ no client, so their calendar routines use this zone instead of guessing."""+ from jarvis.tasks.calendar import calendar_zone+ from jarvis.tasks.context import remember_ui_timezone++ try:+ calendar_zone(body.timezone)+ except ValueError as exc:+ raise HTTPException(status_code=422, detail=str(exc)) from exc+ remember_ui_timezone(body.timezone)+ return {"ok": True, "timezone": body.timezone}++# ----------------------------------------------------------------------# Routes# ----------------------------------------------------------------------diff --git a/tests/unit/society/test_lead_card.py b/tests/unit/society/test_lead_card.pyindex b5ad1e289e..38329cc6b3 100644--- a/tests/unit/society/test_lead_card.py+++ b/tests/unit/society/test_lead_card.py@@ -177,7 +177,8 @@ def test_the_rule_block_names_the_tools_and_buries_the_old_system():assert "never from the retired sub-agent or mission-worker system" in cardassert "spawn_worker is only for heavy background work" in cardassert "Agentic IDE" in card and "are NOT agents of this society" in card- assert "copies its own model seat and permission setup" in card+ # Seat inheritance is told once, in the society-create-agent description.+ assert "society-create-routine, never a skill" in cardasync def test_society_agent_names_feed_the_realtime_path(rt: SocietyRuntime):diff --git a/tests/unit/society/test_routine_intent_recurring.py b/tests/unit/society/test_routine_intent_recurring.pynew file mode 100644index 0000000000..d06d3c78b5--- /dev/null+++ b/tests/unit/society/test_routine_intent_recurring.py@@ -0,0 +1,42 @@+"""Recurring work is recognised without the word "routine", and a request that+names a skill keeps its skill meaning (live 2026-09-29: "every day at 8"+ended as an inactive draft skill)."""++from __future__ import annotations++import pytest++from jarvis.society.routine_intent import requests_recurring_work, wants_agent_routine++ROUTINE_REQUESTS = [+ "Erstelle einen Agenten, der mir jeden Tag um 8 Uhr ein Morgenbriefing gibt", # i18n-allow+ "gib mir jeden Morgen um acht ein Briefing", # i18n-allow+ "Kannst du mir täglich meine wichtigsten Gmails zusammenfassen", # i18n-allow+ "every day at 8 give me a morning briefing",+ "Remind me every Monday to pay rent",+ "dame un resumen cada mañana a las ocho", # i18n-allow+ "Erstelle eine Routine für den Gmail Agenten", # i18n-allow+]++NOT_ROUTINE = [+ "Ich gehe jeden Morgen joggen", # i18n-allow+ "How do I get a report every day?",+ "Wie kann ich jeden Tag um 8 ein Briefing bekommen?", # i18n-allow+ "Was steht heute im Kalender?", # i18n-allow+ "Erstelle einen Skill, der mir jeden Morgen um 6 die Mails vorliest", # i18n-allow+]++[email protected]("text", ROUTINE_REQUESTS)+def test_scheduled_requests_belong_to_an_agent_routine(text: str) -> None:+ assert wants_agent_routine(text)++[email protected]("text", NOT_ROUTINE)+def test_habits_questions_and_skill_requests_are_not_routines(text: str) -> None:+ assert not wants_agent_routine(text)+++def test_recurrence_needs_a_request_not_a_description() -> None:+ assert requests_recurring_work("Please send me the news every evening")+ assert not requests_recurring_work("The newsletter arrives every evening")diff --git a/tests/unit/society/test_routines.py b/tests/unit/society/test_routines.pyindex cb8797b02c..433eaa7e89 100644--- a/tests/unit/society/test_routines.py+++ b/tests/unit/society/test_routines.py@@ -40,17 +40,41 @@ class FakeTaskStore:async def list(self, state_filter=None, *, limit: int = 100) -> list[dict]:return list(self.rows)+ async def get(self, task_id: str) -> dict | None:+ return next((row for row in self.rows if row["id"] == task_id), None)++ async def update_state(self, task_id: str, state: str) -> None:+ row = await self.get(task_id)+ if row is not None:+ row["state"] = state++ async def delete(self, task_id: str) -> None:+ self.rows = [row for row in self.rows if row["id"] != task_id]+class FakeScheduler:def __init__(self, store: FakeTaskStore) -> None:self.store = storeself.scheduled: list[str] = []+ self.ran: list[str] = []async def schedule(self, spec) -> str:task_id = await self.store.insert(spec)self.scheduled.append(task_id)return task_id+ async def pause(self, task_id: str) -> None:+ await self.store.update_state(task_id, "paused")++ async def resume(self, task_id: str) -> None:+ await self.store.update_state(task_id, "scheduled")++ async def cancel_task(self, task_id: str) -> None:+ await self.store.update_state(task_id, "cancelled")++ async def run_now(self, task_id: str) -> None:+ self.ran.append(task_id)+@pytest.fixtureasync def agent(tmp_path: Path):diff --git a/tests/unit/ui/web/test_society_voice_management.py b/tests/unit/ui/web/test_society_voice_management.pynew file mode 100644index 0000000000..435028555d--- /dev/null+++ b/tests/unit/ui/web/test_society_voice_management.py@@ -0,0 +1,155 @@+"""Managing agents by voice: a structured brief becomes real instructions, a+schedule becomes a routine with a spoken next run, and routines can be paused,+run and deleted through the same routes the app commands call."""++from __future__ import annotations++from pathlib import Path+from types import SimpleNamespace++import pytest+from fastapi import FastAPI+from fastapi.testclient import TestClient++from jarvis.society.runtime import SocietyRuntime+from jarvis.tasks import context as task_context+from jarvis.tasks.context import CLIENT_TIMEZONE_HEADER+from jarvis.ui.web.society_routes import router+from tests.unit.society.test_routines import FakeScheduler, FakeTaskStore+++def _tool(name: str) -> SimpleNamespace:+ return SimpleNamespace(name=name, description=f"{name} tool.", risk_tier="monitor")+++TOOLS = {name: _tool(name) for name in ("gmail", "google_calendar", "search-web")}+++def client(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):+ monkeypatch.setattr(task_context, "_reported_ui_timezone", None)+ runtime = SocietyRuntime(+ tmp_path,+ seed_starter_team=False,+ brain_tools=lambda: TOOLS,+ plugin_state=lambda: (["gmail", "google_calendar"], ["gmail"]),+ )+ app = FastAPI()+ app.include_router(router)+ app.state.society = None+ app.state.society_factory = lambda: runtime+ store = FakeTaskStore()+ app.state.task_store = store+ app.state.task_scheduler = FakeScheduler(store)+ with TestClient(app) as c:+ try:+ yield c+ finally:+ assert c.portal is not None+ c.portal.call(runtime.close)+++def test_a_brief_becomes_sectioned_instructions_and_a_readback(client) -> None:+ res = client.post(+ "/api/society/agents",+ json={+ "name": "Briefer",+ "title": "Morning briefing",+ "mission": "Give the user a short, useful start to the day.",+ "responsibilities": ["Summarize important mail", "List today's calendar events"],+ "working_rules": ["Read Gmail first, then the calendar"],+ "output_format": "An artifact with three sections.",+ "boundaries": ["Never send or delete mail"],+ "success_criteria": "Readable in two minutes.",+ },+ )+ assert res.status_code == 200, res.text+ body = res.json()+ description = body["agent"]["description"]+ assert description.startswith("Give the user a short, useful start to the day.")+ assert "## Responsibilities\n- Summarize important mail" in description+ assert "## Boundaries\n- Never send or delete mail" in description+ assert "## Output\nAn artifact with three sections." in description+ assert "plugin:google_calendar" in body["agent"]["focus"]+ assert body["readback"]["not_connected"] == ["google-calendar"]+++def test_a_brief_patch_rewrites_the_instructions(client) -> None:+ client.post("/api/society/agents", json={"name": "Briefer", "description": "Old text."})+ patched = client.patch(+ "/api/society/agents/briefer", json={"mission": "New mission.", "boundaries": ["No mail"]}+ ).json()+ assert patched["agent"]["description"] == "New mission.\n\n## Boundaries\n- No mail"+ assert "readback" in patched+++def test_a_daily_routine_needs_a_timezone_and_reports_its_next_run(client) -> None:+ client.post("/api/society/agents", json={"name": "Briefer"})+ body = {+ "title": "Morning briefing",+ "prompt": "Summarize mail and calendar.",+ "schedule": {"kind": "calendar", "local_time": "08:00"},+ }+ missing = client.post("/api/society/agents/briefer/routines", json=body)+ assert missing.status_code == 422+ assert missing.json()["detail"]["reason"] == "timezone_required"++ created = client.post(+ "/api/society/agents/Briefer/routines",+ json=body,+ headers={CLIENT_TIMEZONE_HEADER: "Europe/Berlin"},+ )+ assert created.status_code == 200, created.text+ data = created.json()+ assert data["tags"] == ["society", "agent:briefer"]+ assert data["state"] == "scheduled"+ assert data["next_run"].endswith("(Europe/Berlin)")+ spec = client.app.state.task_store.rows[0]["spec_json"]+ assert '"timezone":"Europe/Berlin"' in spec and '"local_time":"08:00"' in spec+++def test_the_ui_reported_zone_serves_a_voice_turn(client) -> None:+ task_context.remember_ui_timezone("America/New_York")+ client.post("/api/society/agents", json={"name": "Briefer"})+ created = client.post(+ "/api/society/agents/briefer/routines",+ json={+ "title": "Brief",+ "prompt": "Brief me.",+ "schedule": {"kind": "calendar", "local_time": "07:30"},+ },+ )+ assert created.status_code == 200, created.text+ assert '"timezone":"America/New_York"' in client.app.state.task_store.rows[0]["spec_json"]+++def test_routine_operations_pause_resume_run_and_delete(client) -> None:+ client.post("/api/society/agents", json={"name": "Briefer"})+ task_id = client.post(+ "/api/society/agents/briefer/routines",+ json={"title": "Hourly", "prompt": "Check.", "schedule": {"kind": "every"}},+ ).json()["id"]+ url = f"/api/society/agents/briefer/routines/{task_id}/operation"++ assert client.post(url, json={"operation": "pause"}).json()["state"] == "paused"+ assert client.post(url, json={"operation": "resume"}).json()["state"] == "scheduled"+ assert client.post(url, json={"operation": "run"}).json()["ok"] is True+ assert client.app.state.task_scheduler.ran == [task_id]+ assert client.post(url, json={"operation": "delete"}).json()["state"] == "deleted"+ assert client.app.state.task_store.rows == []+ assert client.post(url, json={"operation": "pause"}).status_code == 404+ assert client.post(url, json={"operation": "explode"}).status_code == 422+++def test_ui_timezone_route_validates_the_zone(tmp_path: Path, monkeypatch) -> None:+ from jarvis.ui.web.tasks_routes import router as tasks_router++ monkeypatch.setattr(task_context, "_reported_ui_timezone", None)+ app = FastAPI()+ app.include_router(tasks_router)+ with TestClient(app) as c:+ assert (+ c.post("/api/tasks/client-timezone", json={"timezone": "Mars/Base"}).status_code == 422+ )+ assert c.post("/api/tasks/client-timezone", json={"timezone": "Europe/Berlin"}).json()["ok"]+ assert task_context.turn_timezone() == "Europe/Berlin"