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): agents and their routines can build artifacts

rubenluetke10-beep5055530cdefc
diff --git a/jarvis/brain/artifact_gate.py b/jarvis/brain/artifact_gate.py
index d6de535c33..8be4ac4865 100644
--- a/jarvis/brain/artifact_gate.py
+++ b/jarvis/brain/artifact_gate.py
@@ -101,17 +101,30 @@ _EXPLICIT_RE = re.compile(
)
+# --- 0. The capability pinned by its tool name — an explicit ask ------------
+# An agent chat's @mention pins it as ``[tools: plugin:create_artifact]`` and an
+# agent routine that must deliver a page says ``create_artifact`` in its
+# instructions (jarvis/society/routines.py). Both are written by a person's
+# explicit choice, so they open the gate before rules 1 and 2 — a routine's
+# standing instructions may well contain "what is …". The ``_`` makes the
+# word rule below blind to it (``_`` is a word character), hence its own rule.
+_PIN_RE = re.compile(r"(?<![\w-])(?:plugin:)?create_artifact\b")
+
+
def wants_artifact(text: str) -> bool:
"""True when the utterance literally names an artifact to be built.
The single WORD decision point for offering the ``create_artifact`` tool
- at all. See the module docstring for the three rules. The Add-menu pin
- is the second path and bypasses this function through the turn
+ at all. See the module docstring for the three rules; a pin of the tool
+ by name (rule 0 above) counts as the request. The Jarvis chat's Add-menu
+ pin is the other path and bypasses this function through the turn
override's extra hands.
"""
t = (text or "").strip()
if not t:
return False
+ if _PIN_RE.search(t):
+ return True
if _NAVIGATION_RE.search(t):
return False
if _DEFINITION_RE.search(t):
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index 8fe5785077..449fbda95f 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -13508,6 +13508,14 @@ class BrainManager:
"""
del prefer_api
intent = "deep" if model_tier == "deep" else "fast"
+ # A routine whose prompt asks for its result as an artifact is granted
+ # the builder for that turn — the same explicit-word rule the chat gate
+ # applies, so "every morning at 8, my briefing as an artifact" works
+ # without the person knowing the tool has a grant of its own.
+ from jarvis.brain.artifact_gate import wants_artifact # noqa: PLC0415
+
+ if wants_artifact(prompt) and _ARTIFACT_TOOL_NAME not in allowed_tools:
+ allowed_tools = (*allowed_tools, _ARTIFACT_TOOL_NAME)
tools = self._select_task_tools(allowed_tools)
from jarvis.core.model_selection import operation_model, worker_selection
from jarvis.core.task_agent import run_selected, subscription_seat
diff --git a/jarvis/plugins/tool/create_artifact.py b/jarvis/plugins/tool/create_artifact.py
index 3964498fdf..348483f613 100644
--- a/jarvis/plugins/tool/create_artifact.py
+++ b/jarvis/plugins/tool/create_artifact.py
@@ -19,8 +19,11 @@ enforcement — this description is the second line, for the turns where the
gate opens but the request was about something else.
Router-tier. It is a dispatch (risk ``monitor``, like ``spawn_worker``), so it
-never enters a worker tool set (AP-5/AP-14): a worker building an artifact
-cannot spawn another worker to build it.
+never enters a mission worker's tool set (AP-5/AP-14): a worker building an
+artifact cannot spawn another worker to build it. Society agents and their
+routines MAY hold it (maintainer decision 2026-09-29, see
+``jarvis.society.capabilities``); such a call builds quietly — no jump to the
+Artifacts section, no spoken readback.
"""
from __future__ import annotations
@@ -89,6 +92,23 @@ def _turn_language(ctx: Any, args: dict[str, Any]) -> str:
return lang or resolve_ambient_language()
+def _called_in_background(ctx: Any) -> bool:
+ """True when no person is looking at Jarvis's own surface for this call.
+
+ An agent's chat or routine (session ``society:…``) and an unattended
+ scheduled task build a page too, but the screen must not jump to the
+ Artifacts section under the person's hands, and the finished build must
+ not be read aloud into an idle room (mandate 2026-09-28: Jarvis never
+ speaks uncalled). The executor's config snapshot says which it is.
+ """
+ config = getattr(ctx, "config", None)
+ if not isinstance(config, dict):
+ return False
+ if config.get("unattended") or config.get("approval_surface") == "unattended":
+ return True
+ return "society:" in str(config.get("approval_ref") or "")
+
+
def _utterance(ctx: Any) -> str:
"""What the user said this turn, when the context carries it."""
for attribute in ("user_utterance", "user_text", "utterance", "text"):
@@ -286,6 +306,7 @@ class CreateArtifactTool:
# The mission dispatch contract is de/en; an "es" turn keeps the German
# mission readback (the same cap spawn_worker applies).
mission_language = language if language in ("de", "en") else "de"
+ background = _called_in_background(ctx)
# UI/telemetry announce — the agent strip shows "builds the artifact".
# Best-effort like every other announce: the build happens either way.
@@ -314,21 +335,24 @@ class CreateArtifactTool:
trace_id=ctx.trace_id,
mission_language=mission_language,
readback_language=language,
+ background=background,
),
name=f"jarvis-agent-artifact-{ctx.trace_id.hex[:8]}",
)
- # Move the UI to the Artifacts section so the "building…" row is seen.
- # Best-effort on purpose: the build exists either way.
- try:
- await self._bus.publish(
- NavigateSidebar(
- section=ARTIFACTS_SECTION,
- source_layer="brain.tool.create_artifact",
+ # Move the UI to the Artifacts section so the "building…" row is seen —
+ # only for the person who asked Jarvis directly. Best-effort on
+ # purpose: the build exists either way.
+ if not background:
+ try:
+ await self._bus.publish(
+ NavigateSidebar(
+ section=ARTIFACTS_SECTION,
+ source_layer="brain.tool.create_artifact",
+ )
)
- )
- except Exception as exc: # noqa: BLE001 — see comment above
- log.warning("create_artifact navigate failed error=%s", exc)
+ except Exception as exc: # noqa: BLE001 — see comment above
+ log.warning("create_artifact navigate failed error=%s", exc)
ack = (str(args.get("spoken_ack") or "").strip()) or action_phrase(
"artifact_revising" if brief.revision else "artifact_building",
@@ -398,6 +422,7 @@ class CreateArtifactTool:
trace_id: UUID,
mission_language: str,
readback_language: str,
+ background: bool = False,
) -> None:
"""Read the facts, compose the brief, persist the mission and run it —
the two-step contract spawn_worker documents (dispatch → PENDING,
@@ -406,6 +431,11 @@ class CreateArtifactTool:
Every dead end becomes a spoken failure through the same completion
event a finished mission uses, never a log line alone (AU-11): the
user already heard a promise.
+
+ A ``background`` build (an agent's chat or routine) is dispatched as a
+ ``system`` mission, which the mission voice listener does not read back,
+ and its failures are logged instead of spoken: nobody called Jarvis, and
+ the page (or its absence) shows in the Artifacts section.
"""
try:
source_data = await self._source_data(needs, trace_id=trace_id, utterance=utterance)
@@ -413,7 +443,7 @@ class CreateArtifactTool:
mission_id = await manager.dispatch(
prompt=prompt,
language=mission_language,
- source_actor="hauptjarvis",
+ source_actor="system" if background else "hauptjarvis",
)
if kontrollierer is None:
log.warning(
@@ -421,9 +451,10 @@ class CreateArtifactTool:
"available — it stays PENDING until the next app start",
mission_id,
)
- await self._publish_failure(
- utterance, action_phrase("spawn_no_runner", readback_language)
- )
+ if not background:
+ await self._publish_failure(
+ utterance, action_phrase("spawn_no_runner", readback_language)
+ )
return
await kontrollierer.run_mission(mission_id)
except asyncio.CancelledError:
@@ -431,7 +462,8 @@ class CreateArtifactTool:
raise
except BaseException as exc: # noqa: BLE001 — fire-and-forget task, see docstring
log.exception("create_artifact background dispatch crashed")
- await self._publish_failure(utterance, f"{type(exc).__name__}: {exc}")
+ if not background:
+ await self._publish_failure(utterance, f"{type(exc).__name__}: {exc}")
async def _publish_failure(self, utterance: str, error: str) -> None:
try:
diff --git a/jarvis/society/capabilities.py b/jarvis/society/capabilities.py
index 080d1492ae..c973b12cce 100644
--- a/jarvis/society/capabilities.py
+++ b/jarvis/society/capabilities.py
@@ -11,7 +11,16 @@ or deny them, and the model card can list them grouped by kind.
Never granted, structurally (AP-5/AP-14): every dispatch tool and general app
control tool. Scoped coding-session control is a separate grantable capability.
The prohibited tools are filtered out here, so no later layer can hand them to
-an agent by accident.
+an agent by accident. A ban entry matches the registry name in either
+spelling: tools register as ``spawn_worker`` while the list was written as
+``spawn-worker``, and for a while that mismatch let every spawn tool through.
+
+One deliberate exception (maintainer decision 2026-09-29): ``create_artifact``.
+It starts a background build, but the build is a page, not a worker that can
+hire more workers, and the user asked for agents and their routines to be
+able to deliver one. It stays ask-only: an API seat sees it only on a turn that
+names an artifact (``jarvis.brain.artifact_gate``), and an allowlist agent
+needs the grant ``plugin:create_artifact``.
Pure functions over the objects passed in — no registry is imported at
module import time (AP-26); the runtime wires the live sources.
@@ -25,11 +34,13 @@ from enum import StrEnum
from typing import Any, Final
__all__ = [
+ "ARTIFACT_TOOL_NAME",
"CapabilityKind",
"CapabilityRow",
"NEVER_GRANTED",
"build_catalog",
"capability_id_for_tool",
+ "is_never_granted",
"select_tools",
"tool_name_for_capability",
]
@@ -53,7 +64,6 @@ NEVER_GRANTED: Final[frozenset[str]] = frozenset(
"dispatch-to-harness",
"dispatch-to-admin",
"dispatch-with-review",
- "create-artifact",
"navigate",
"switch-provider",
"manage-mcp-server",
@@ -67,6 +77,9 @@ NEVER_GRANTED: Final[frozenset[str]] = frozenset(
}
)
+#: The artifact builder — the one dispatch tool an agent may hold (see above).
+ARTIFACT_TOOL_NAME: Final[str] = "create_artifact"
+
#: Built-in hands that are not "a plugin someone connected".
_CORE_TOOLS: Final[frozenset[str]] = frozenset(
{
@@ -141,11 +154,16 @@ class CapabilityRow:
}
+def is_never_granted(tool_name: str) -> bool:
+ """True for a banned tool, whichever spelling its registry name uses."""
+ return tool_name in NEVER_GRANTED or tool_name.replace("_", "-") in NEVER_GRANTED
+
+
def capability_id_for_tool(tool_name: str) -> str | None:
"""The catalog id of a brain tool name; ``None`` for never-granted tools."""
if tool_name in {"society_browser", "society_browser_action"}:
return "core:browser"
- if tool_name in NEVER_GRANTED:
+ if is_never_granted(tool_name):
return None
if tool_name.startswith("cli_"):
return f"cli:{tool_name[4:]}"
@@ -188,6 +206,10 @@ def _label(tool_name: str, kind: CapabilityKind, tool: Any = None) -> str:
return tool_name[4:] if tool_name.startswith("cli_") else tool_name
if kind is CapabilityKind.MCP:
return tool_name
+ if tool_name == ARTIFACT_TOOL_NAME:
+ # Bilingual like the Jarvis chat's Add row, so an @mention finds it
+ # by "Artefakt" as well as "Artifact".
+ return "Artifact / Artefakt"
return tool_name.replace("_", "-")
diff --git a/jarvis/society/routines.py b/jarvis/society/routines.py
index 7f18511a77..4df4a5ebe1 100644
--- a/jarvis/society/routines.py
+++ b/jarvis/society/routines.py
@@ -17,6 +17,7 @@ from collections.abc import Sequence
from typing import Any, Final
from uuid import UUID
+from jarvis.brain.artifact_gate import wants_artifact
from jarvis.tasks.schema import (
AgentAction,
PluginGrant,
@@ -35,7 +36,17 @@ from jarvis.tasks.schema import (
from .roster import AgentRecord
+#: Appended to a routine whose prompt asks for an artifact. The build runs in
+#: the background; the routine's own reply only says it was started.
+ARTIFACT_DELIVERY: Final[str] = (
+ "Deliver the result as an artifact: gather what the routine needs first, then "
+ "call create_artifact exactly once with a short title and a self-contained "
+ "request carrying every fact, number and item the page must show. Your reply "
+ "then says in one sentence that the page is being built."
+)
+
__all__ = [
+ "ARTIFACT_DELIVERY",
"ROUTINE_TAG",
"agent_tag",
"build_task_spec",
@@ -120,6 +131,11 @@ def _routine_prompt(agent: AgentRecord, prompt: str) -> str:
if agent.focus:
lines += ["", "Reach for these capabilities first: " + ", ".join(agent.focus)]
lines += ["", "Routine:", prompt.strip()]
+ if wants_artifact(prompt):
+ # The person asked for the result as an artifact. Naming the tool pins
+ # it through the artifact gate (rule 0) even when the standing
+ # instructions above read like a question.
+ lines += ["", ARTIFACT_DELIVERY]
return "\n".join(lines)
diff --git a/jarvis/ui/web/frontend/src/components/society/chat/mentionItems.test.ts b/jarvis/ui/web/frontend/src/components/society/chat/mentionItems.test.ts
index 7ef092abf4..a939f96b8a 100644
--- a/jarvis/ui/web/frontend/src/components/society/chat/mentionItems.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/chat/mentionItems.test.ts
@@ -389,3 +389,14 @@ describe("groupMentions / mentionsInText / mentionToken", () => {
expect(mentionToken("mail [email protected]", 10)).toBeNull();
});
});
+
+it("tags the artifact builder as @artifact and pins its capability", () => {
+ const catalog = buildMentionCatalog(
+ [],
+ [cap({ id: "plugin:create_artifact", label: "Artifact / Artefakt", tool_name: "create_artifact" })],
+ );
+ const item = catalog.find((row) => row.key === "plugin:create_artifact");
+ expect(item?.value).toBe("artifact");
+ expect(filterMentions(catalog, "artefakt").map((row) => row.key)).toContain("plugin:create_artifact");
+ expect(mentionsInText("@artifact morning brief", catalog).pinIds).toEqual(["plugin:create_artifact"]);
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/chat/mentionItems.ts b/jarvis/ui/web/frontend/src/components/society/chat/mentionItems.ts
index 5f29a50479..e06b145d2d 100644
--- a/jarvis/ui/web/frontend/src/components/society/chat/mentionItems.ts
+++ b/jarvis/ui/web/frontend/src/components/society/chat/mentionItems.ts
@@ -13,6 +13,9 @@ import { PLUGIN_FAMILIES, marketplacePluginId, pluginFamily } from "@/lib/plugin
import type { Capability, SocietyAgent } from "../data";
import type { AgentStatus } from "@/lib/agenticIdeApi";
+/** The one plugin-kind capability that is not a connector: the artifact builder. */
+const ARTIFACT_CAPABILITY = "plugin:create_artifact";
+
/** "plugin:gmail" → "gmail"; "mcp:github/create_issue" → "github/create_issue". */
function capabilityName(id: string): string {
return id.replace(/^(plugin|cli|mcp|skill|core):/, "");
@@ -229,7 +232,7 @@ export function buildMentionCatalog(
continue;
}
const kind = kindOf(cap);
- if (kind === "plugin") {
+ if (kind === "plugin" && cap.id !== ARTIFACT_CAPABILITY) {
// Coding commands and other non-connector tools are not plugins.
continue;
}
@@ -288,14 +291,17 @@ export function buildMentionCatalog(
}
for (const cap of rest) {
- const short = capabilityName(cap.id);
+ // The artifact builder is tagged by what it makes ("@artifact") and sits
+ // with Jarvis's own tools; the pin still carries its capability id, which
+ // is what opens the artifact gate for the turn.
+ const isArtifact = cap.id === ARTIFACT_CAPABILITY;
+ const short = isArtifact ? "artifact" : capabilityName(cap.id);
const value = takeValue(short, cap.id, taken);
- items.push(
- capabilityItem(cap, value, {
- key: cap.id,
- detail: false,
- }),
- );
+ const item = capabilityItem(cap, value, {
+ key: cap.id,
+ detail: false,
+ });
+ items.push(isArtifact ? { ...item, group: "tools" } : item);
}
for (const [server, tools] of mcpByServer) {
diff --git a/tests/unit/brain/test_artifact_gate.py b/tests/unit/brain/test_artifact_gate.py
index c1cd3fa2a4..569f364791 100644
--- a/tests/unit/brain/test_artifact_gate.py
+++ b/tests/unit/brain/test_artifact_gate.py
@@ -126,3 +126,20 @@ def test_a_visual_noun_alone_is_not_a_request() -> None:
assert wants_artifact("die webseite") is False # i18n-allow: input vocab
assert wants_artifact("visualisier mir das") is False # i18n-allow: input vocab
assert wants_artifact("mach mir ein dashboard") is False # i18n-allow: input vocab
+
+
+ "text",
+ [
+ "Prepare the weekly numbers [tools: plugin:create_artifact]",
+ "Routine: what is new today?\n\nDeliver it as an artifact: call create_artifact once.",
+ ],
+)
+def test_a_pin_by_tool_name_is_an_explicit_ask(text: str) -> None:
+ """An agent chat's @mention and an artifact routine name the tool itself —
+ a person's explicit choice, so it opens the gate even past a question."""
+ assert wants_artifact(text) is True
+
+
+def test_a_similar_tool_name_is_no_pin() -> None:
+ assert wants_artifact("call my_create_artifact_helper") is False
diff --git a/tests/unit/plugins/tool/test_create_artifact.py b/tests/unit/plugins/tool/test_create_artifact.py
index 5c7bf7a64d..960fec9893 100644
--- a/tests/unit/plugins/tool/test_create_artifact.py
+++ b/tests/unit/plugins/tool/test_create_artifact.py
@@ -339,3 +339,61 @@ async def test_revise_of_an_unknown_artifact_is_a_retryable_error(
assert result.success is False
assert "budget forecast" in (result.error or "")
assert manager.dispatched == []
+
+
+def _background_ctx(config: dict[str, Any]) -> ExecutionContext:
+ return ExecutionContext(
+ trace_id=uuid4(),
+ user_utterance="Morning briefing as an artifact",
+ config={"output_language": "en", **config},
+ memory_read=None,
+ )
+
+
+ "config",
+ [
+ {"approval_ref": "agent-chat:society:agent-7", "approval_surface": "interactive"},
+ {"approval_ref": "agent-chat:society:agent-7:routine:t1:r1"},
+ {"unattended": True, "delivery": "written"},
+ {"approval_surface": "unattended", "approval_ref": "agent-chat:task-1"},
+ ],
+)
+async def test_an_agent_or_routine_builds_quietly(config: dict[str, Any]) -> None:
+ """An agent's chat or a routine at 08:00 builds the page without moving the
+ screen and without a spoken readback (mandate 2026-09-28: Jarvis never
+ speaks uncalled) — the mission is a ``system`` one the voice listener skips."""
+ bus, manager, kontrollierer = _FakeBus(), _FakeManager(), _FakeKontrollierer()
+ tool = CreateArtifactTool(bus, manager=manager, kontrollierer=kontrollierer)
+
+ args = {"title": "Morning brief", "request": "Today."}
+ result = await tool.execute(args, _background_ctx(config))
+ await _settle()
+
+ assert result.success is True
+ assert manager.dispatched[0]["source_actor"] == "system"
+ assert kontrollierer.ran == ["mission-1"]
+ assert not any(isinstance(e, NavigateSidebar) for e in bus.published)
+
+
+async def test_a_background_failure_is_logged_not_spoken() -> None:
+ bus = _FakeBus()
+ tool = CreateArtifactTool(
+ bus, manager=_FakeManager(), kontrollierer=_FakeKontrollierer(fail=True)
+ )
+ await tool.execute({"title": "T", "request": "R"}, _background_ctx({"unattended": True}))
+ await _settle()
+ assert not any(isinstance(e, JarvisAgentBackgroundCompleted) for e in bus.published)
+
+
+async def test_the_jarvis_chat_still_asks_in_the_foreground() -> None:
+ bus, manager = _FakeBus(), _FakeManager()
+ tool = CreateArtifactTool(bus, manager=manager, kontrollierer=_FakeKontrollierer())
+ ctx = _background_ctx({"approval_ref": "agent-chat:jarvis:main"})
+ await tool.execute({"title": "T", "request": "R"}, ctx)
+ await _settle()
+ assert manager.dispatched[0]["source_actor"] == "hauptjarvis"
+ assert any(isinstance(e, NavigateSidebar) for e in bus.published)
diff --git a/tests/unit/society/test_capabilities.py b/tests/unit/society/test_capabilities.py
index 6df6416796..6aa6a17b28 100644
--- a/tests/unit/society/test_capabilities.py
+++ b/tests/unit/society/test_capabilities.py
@@ -176,3 +176,26 @@ def test_select_tools_is_deterministic():
)
)
assert a == b
+
+
+def test_the_ban_holds_in_the_registrys_underscore_spelling() -> None:
+ """Tools register as ``spawn_worker``; the ban list says ``spawn-worker``.
+ The mismatch once let every spawn and dispatch tool reach an agent."""
+ for name in (
+ "spawn_worker",
+ "spawn_subagents",
+ "multi_spawn",
+ "dispatch_to_harness",
+ "dispatch_to_admin",
+ "dispatch_with_review",
+ "app_command",
+ "switch_provider",
+ ):
+ assert capability_id_for_tool(name) is None, name
+
+
+def test_an_agent_may_hold_the_artifact_builder() -> None:
+ """Maintainer decision 2026-09-29: agents and their routines build artifacts."""
+ assert capability_id_for_tool("create_artifact") == "plugin:create_artifact"
+ rows = build_catalog({"create_artifact": _tool("create_artifact", "Build an ARTIFACT.")})
+ assert [(r.id, r.label) for r in rows] == [("plugin:create_artifact", "Artifact / Artefakt")]
diff --git a/tests/unit/society/test_routines.py b/tests/unit/society/test_routines.py
index 530b6210a2..cb8797b02c 100644
--- a/tests/unit/society/test_routines.py
+++ b/tests/unit/society/test_routines.py
@@ -252,3 +252,25 @@ async def test_update_keeps_the_pin_unless_the_seat_moves(agent):
"effort": "",
"account_id": "",
}
+
+
+async def test_an_artifact_routine_names_the_builder(agent):
+ """ "Every day at 8, my morning briefing as an artifact": the routine's
+ prompt tells the agent to call create_artifact, which is also what opens
+ the artifact gate for that unattended turn."""
+ from jarvis.brain.artifact_gate import wants_artifact
+ from jarvis.society.routines import ARTIFACT_DELIVERY
+
+ spec = build_task_spec(
+ agent,
+ title="Morning brief",
+ prompt="Give me my morning briefing as an artifact.",
+ schedule={"kind": "every", "interval_seconds": 86400},
+ )
+ assert ARTIFACT_DELIVERY in spec.action.prompt
+ assert wants_artifact(spec.action.prompt)
+
+ plain = build_task_spec(
+ agent, title="Brief", prompt="Summarize new mail.", schedule={"kind": "every"}
+ )
+ assert ARTIFACT_DELIVERY not in plain.action.prompt