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(artifacts): the design standard — the app's own tokens, the request read for form, charts by method, no generated-looking defaults
rubenluetke10-beepa1ceb67e9252
diff --git a/jarvis/artifacts/brief.py b/jarvis/artifacts/brief.pyindex 4e0590df1d..5ff95bc691 100644--- a/jarvis/artifacts/brief.py+++ b/jarvis/artifacts/brief.py@@ -8,10 +8,16 @@ reads — the one text that decides whether what comes back is a real artifactscaffold with a README.Everything a finished artifact must be is stated HERE, because the worker-shares none of the app's context. The rules are the sandbox's rules: the page-is framed with scripts allowed but every network request blocked, so an-external font, CDN script or remote image is not "slightly slower" — it is a-broken page. Stated once, in the brief, is the only place that can prevent it.+shares none of the app's context. Two kinds of rule ride together:++* the sandbox's rules — the page is framed with scripts allowed but every+ network request blocked, so an external font, CDN script or remote image is+ not "slightly slower", it is a broken page;+* the design standard (:mod:`jarvis.artifacts.design_guide`) — the app's own+ tokens to paste, how to read the request so the form follows the ask, the+ chart method, and the explicit list of what reads as generated. Without it a+ worker reaches for the defaults every model reaches for, and the result is+ the gradient-hero page our archive was full of (2026-08-23).Pure function of its inputs: no clock, no filesystem, no randomness. What theworker receives for a given request is byte-identical across runs, which is@@ -24,7 +30,15 @@ import refrom dataclasses import dataclassfrom typing import Final-from jarvis.visuals.brand import BRAND+from jarvis.artifacts.design_guide import (+ AVOID,+ CHARTS,+ DESIGN_SYSTEM,+ DONE_MEANS,+ READ_THE_REQUEST,+ THEME_BOOTSTRAP_JS,+ THEME_CSS,+)# How much of a previous version rides along on a revision. The worker rewrites# the whole file from it, so the cap is generous — but a page that outgrew it@@ -126,7 +140,6 @@ def build_artifact_brief()lang_name = _language_name(language)lang_code = (language or "").strip().lower() or "en"- b = BRANDsections: list[str] = [_QUALITY_LEAD,@@ -154,38 +167,29 @@ def build_artifact_brief("never navigate away, and must work with no network at all.",f"- The visible content is written in {lang_name} — every heading, ""label, caption and note. Code identifiers and comments stay English.",+ "- Responsive from 360 px to 1600 px; the page never scrolls sideways.",+ "- Real content, never filler: the numbers, facts and data the request "+ "names go into the page; a missing fact becomes a clearly labelled "+ "assumption — never lorem ipsum, never 'TODO'.",]),+ READ_THE_REQUEST,+ DESIGN_SYSTEM,"\n".join([- "## Design",- "- Dark brand look by default: page background "- f"{b['bg']}, cards {b['bg_card']}, text {b['text']}, muted text "- f"{b['text_muted']}, accent {b['primary']}, borders {b['border']}. "- "Add an `@media (prefers-color-scheme: light)` block with a "- "matching light palette (paper background, near-black text, the "- "same accent) so the page reads well in both modes.",- "- Calm typography on a system-ui font stack, generous spacing, "- "12–14 px rounded cards, 1 px borders, no gratuitous animation.",- "- Responsive: readable from 360 px to 1600 px; wide tables, code "- "and diagrams scroll inside their own container, never the page "- "sideways.",- "- Real content, never filler: put the numbers, facts and data the "- "request names into the page. When something needed is missing, "- "make a clearly labelled assumption — never lorem ipsum, never "- "'TODO'.",- ]- ),- "\n".join(- [- "## Done means",- "- The file opens from disk, with no network, and renders "- "correctly with no console errors.",- "- The page shows what was asked for — the title, the content, the "- "data — and says nothing about how it was built.",- "- Nothing else was created or changed.",+ "```html",+ "<style>",+ THEME_CSS,+ "</style>",+ "<script>",+ THEME_BOOTSTRAP_JS,+ "</script>",+ "```",]),+ CHARTS,+ AVOID,+ DONE_MEANS,]if revision:diff --git a/jarvis/artifacts/design_guide.py b/jarvis/artifacts/design_guide.pynew file mode 100644index 0000000000..5ed6cf5159--- /dev/null+++ b/jarvis/artifacts/design_guide.py@@ -0,0 +1,231 @@+"""The design standard every artifact follows — the pattern, not the content.++Distilled on 2026-08-23 from two sources, in this order of authority:++1. the design guidance Claude itself follows when it builds an artifact+ (read the request first and calibrate the treatment; honour the existing+ design system; typography carries the page; pick neutrals, don't default;+ design both themes at token level; structure encodes information; a+ dashboard is scanned, a document is read; the catalogue of+ generated-looking defaults to avoid) and its data-visualisation method+ (form before colour, thin marks, one axis, legend for two or more series,+ labels selectively, colour follows the entity, validated palettes);+2. what our own archive showed when screenshotted the same day — the three+ pages a worker had produced were textbook generated design: a gradient+ headline over a centred hero, an eyebrow pill, emoji chips, seven to ten+ gradients, twenty-plus rounded corners, a Tailwind rainbow for categories,+ no light theme, and Google Fonts links the sandbox can never load.++So this module hands the worker three things the guidance says a page needs+and a model will not supply on its own: the **design system of the desktop+app it will be shown in** (the tokens below are the app's own light and dark+palettes, ``frontend/src/index.css``), a **way to read the request** so a+bar-chart ask yields a bar chart and a memo ask yields a memo, and the+**explicit list of what reads as generated**. The categorical series colours+were validated with the method's own checker on both surfaces (lightness+band, chroma floor, CVD separation, normal-vision floor, contrast) —+``#C98500,#4F8EF7,#E0633F,#1F9E7F,#9085E9,#C84E8A`` on ``#30302E`` and+``#A86B00,#2A6FD0,#D4532E,#158F6B,#5B46C2,#C23F86`` on white, all checks+passing; keep them in this order and re-validate before changing one.++Pure text; no I/O. ``brief.py`` assembles it into the mission prompt.+"""++from __future__ import annotations++from typing import Final++# --- The app's design system, as a token block the worker pastes verbatim -----+#+# Dark-first, because the desktop app is dark-first and the artifact is framed+# inside it. Light follows the OS preference OR an explicit stamp: the+# Artifacts stage passes the app's current theme as `?theme=light|dark`, and+# the bootstrap script below stamps `data-theme` from it — so the page follows+# the app, not the OS, whenever the app says which it is. Every colour is a+# token defined in BOTH palettes; nothing is defined only inside a media block+# (the classic unreadable-artifact bug).+THEME_CSS: Final = """\+:root{color-scheme:dark;+ --bg:#262624;--bg-2:#30302E;--bg-3:#363634;+ --ink:#F5F4EF;--ink-2:#9C9A92;--ink-3:#73716A;+ --line:#3B3A38;--line-2:#4A4946;+ --accent:#FFD60A;--accent-ink:#0A0A0A;--accent-soft:rgba(255,214,10,.14);+ --good:#4ADE80;--warn:#F2B23D;--bad:#EF5350;+ --s1:#C98500;--s2:#4F8EF7;--s3:#E0633F;--s4:#1F9E7F;--s5:#9085E9;--s6:#C84E8A;+ --seq-1:#5A4A12;--seq-2:#8A6E0C;--seq-3:#B9930A;--seq-4:#E0B30A;--seq-5:#FFD60A;+ --radius:12px;--radius-sm:8px;+ --font:"Inter",ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;+ --mono:"JetBrains Mono",ui-monospace,"SF Mono",Menlo,Consolas,monospace}+@media (prefers-color-scheme:light){+:root:not([data-theme="dark"]){color-scheme:light;+ --bg:#FAF9F5;--bg-2:#FFFFFF;--bg-3:#F5F4ED;+ --ink:#141413;--ink-2:#6C6A5F;--ink-3:#8F8D82;+ --line:#E8E6DC;--line-2:#D9D6C9;+ --accent:#A86B00;--accent-ink:#FFFFFF;--accent-soft:rgba(168,107,0,.12);+ --good:#1F8A4C;--warn:#B26A00;--bad:#C0392B;+ --s1:#A86B00;--s2:#2A6FD0;--s3:#D4532E;--s4:#158F6B;--s5:#5B46C2;--s6:#C23F86;+ --seq-1:#F3E3A6;--seq-2:#E3C25A;--seq-3:#C99500;--seq-4:#A86B00;--seq-5:#7A4D00}}+:root[data-theme="light"]{color-scheme:light;+ --bg:#FAF9F5;--bg-2:#FFFFFF;--bg-3:#F5F4ED;+ --ink:#141413;--ink-2:#6C6A5F;--ink-3:#8F8D82;+ --line:#E8E6DC;--line-2:#D9D6C9;+ --accent:#A86B00;--accent-ink:#FFFFFF;--accent-soft:rgba(168,107,0,.12);+ --good:#1F8A4C;--warn:#B26A00;--bad:#C0392B;+ --s1:#A86B00;--s2:#2A6FD0;--s3:#D4532E;--s4:#158F6B;--s5:#5B46C2;--s6:#C23F86;+ --seq-1:#F3E3A6;--seq-2:#E3C25A;--seq-3:#C99500;--seq-4:#A86B00;--seq-5:#7A4D00}+*,*::before,*::after{box-sizing:border-box}+html{-webkit-text-size-adjust:100%}+body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.55 var(--font);+ -webkit-font-smoothing:antialiased;font-feature-settings:"cv02","cv03","cv04","cv11"}+h1,h2,h3{margin:0;line-height:1.2;letter-spacing:-.01em;text-wrap:balance}+h1{font-size:clamp(26px,3.2vw,34px);font-weight:650}+h2{font-size:20px;font-weight:600}+h3{font-size:16px;font-weight:600}+p{margin:0;max-width:68ch}+a{color:var(--accent)}+code,pre,.mono{font-family:var(--mono);font-size:.92em}+.eyebrow{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-2);font-weight:600}+.card{background:var(--bg-2);border:1px solid var(--line);border-radius:var(--radius);+ padding:16px 18px}+.muted{color:var(--ink-2)}+.num{font-variant-numeric:tabular-nums}+:focus-visible{outline:2px solid var(--accent);outline-offset:2px}+@media (prefers-reduced-motion:reduce){+*,*::before,*::after{animation:none!important;transition:none!important}}"""++# Stamps `data-theme` from the `?theme=` query the Artifacts stage appends, so+# the page follows the app's theme. Harmless anywhere else (no query → OS).+THEME_BOOTSTRAP_JS: Final = """\+(function(){try{+var t=new URLSearchParams(location.search).get("theme");+if(t==="light"||t==="dark"){document.documentElement.setAttribute("data-theme",t);}+}catch(e){}})();"""+++# --- The guide, section by section ---------------------------------------------++READ_THE_REQUEST: Final = """\+## Read the request first — the form follows the ask+The request names the deliverable; honour it literally before any rule below.+- Asked for a chart, "Balken", "Kurve", "Verlauf", "Anteile" → the chart IS the page: \+one clear chart (or a small set of them) with a one-line takeaway above it, not a \+landing page with a chart somewhere inside.+- Asked for a comparison, "Gegenüberstellung", "Vergleich" → a comparison table or \+side-by-side cards with the SAME attributes in the same order for every option.+- Asked to explain, "erklär mir", "wie funktioniert" → a readable document: short \+sections in reading order, running text at most ~68 characters wide, ONE diagram or \+chart exactly where it helps the explanation, never decoration.+- Asked for a dashboard, "Übersicht", "Status" → a UI that is scanned, not read: the \+summary (KPI row / hero figure) before the detail, charts below, a table for the \+long tail; state encoded in form (pill, chip, stripe) so what needs attention reads at \+a glance.+- Asked for a timeline, flow, hierarchy, mind map → a diagram drawn with CSS grid / \+flex or inline SVG: nodes as cards, hairline connectors, arrows only where direction \+carries meaning.+- Asked for a page, landing page, one-pager, tool, game → the editorial treatment: one \+real thesis at the top, then restraint.+Default when unsure: a calm, well-composed document. A utilitarian request (memo, \+plan, comparison, explanation) gets the same craft as a landing page, delivered \+quietly — no hero, no tagline, no marketing voice."""++DESIGN_SYSTEM: Final = """\+## Design system — the page is shown inside the Jarvis desktop app and must look like it+Paste the token block below VERBATIM as the first <style> in <head>, and the \+bootstrap script as the first <script> in <head>. Derive every colour, font and radius \+from these tokens; never introduce a hex that is not in the block (semantic status \+colours included). Dark is the default; light is fully defined; both are complete — \+scan your stylesheet before finishing: no colour may be defined ONLY inside a media \+or [data-theme] block.+- Accent (`--accent`) is spent in ONE place — the one number, the one highlighted \+series, the active state — and is quiet everywhere else. Never a gradient, never a \+glow, never a coloured headline.+- Surfaces: page `--bg`, cards `--bg-2`, recessed/hover `--bg-3`; 1px `--line` \+borders; radius `--radius` (12px) for cards, `--radius-sm` (8px) for controls — not \+every box is a rounded card, and a plain section with a hairline rule is often the \+better choice.+- Type: `--font` for everything, `--mono` only for code, ids, and columns of digits \+(`.num`). One type scale (h1 / h2 / h3 / body / 13px caption / 11px eyebrow) — stay on \+it. Headings carry weight by size and weight, not by colour.+- Spacing: siblings laid out with flex/grid + gap (never stacked margins); an 8px \+rhythm (8/12/16/24/32/48); wide tables, code and diagrams scroll inside their own \+`overflow-x:auto` container — the page body never scrolls sideways.+- Structure encodes information: an eyebrow, a number, a divider, a badge only when it \+says something true about the content. Numbered markers (01/02/03) ONLY for a real \+sequence. Status colour (`--good/--warn/--bad`) only when the colour MEANS good/bad, \+always with a label or icon, never colour alone.+- Copy is design material: the `<title>` is the page's name (a short noun phrase, no \+explainer after a dash), headings say what the reader gets, labels name things the way \+a person would, numbers carry their unit, captions state the source or assumption."""++CHARTS: Final = """\+## Charts and diagrams (when the request calls for them)+Draw charts with inline SVG (or canvas for dense data); write them against the tokens.+- Form before colour. A single current value → a stat tile (label, value, optional \+delta), not a one-bar chart. Magnitude compared → bars/columns. Trend → a line (area \+only for one series, fill at ~10% opacity). Part-to-whole → a stacked bar (horizontal \+for long names). Above/below a baseline → a diverging bar. Never a dual-axis chart: two \+measures of different scale get two charts side by side.+- Marks are thin and calm: bars ≤ 24px thick, 4px rounded at the data end and square at \+the baseline, a 2px surface gap between touching bars/segments; lines 2px with round \+joins; markers ≥ 8px with a 2px `--bg-2` ring; grid and axes hairline 1px solid in \+`--line`, never dashed; generous padding; the data is the only loud thing.+- Colour by job: ONE series → `--accent` (emphasis: the one series that matters in \+`--accent`, the rest in `--ink-3`). TWO OR MORE series → the categorical slots `--s1 … \+--s6` in that fixed order, never cycled, never generated; past six fold the tail into \+"Other". Magnitude → the sequential ramp `--seq-1 … --seq-5` (one hue, light→dark). \+Colour follows the entity, never its rank: filtering must not repaint survivors.+- Text wears text tokens: values, labels, axis ticks and legends in `--ink`/`--ink-2`, \+never in the series colour; identity comes from a swatch or line-key BESIDE the text.+- A legend is always present for two or more series (none for one); label selectively \+(the endpoint, the extreme, the series the story is about) — never a number on every \+point; axis ticks are round numbers with thousands separators.+- Every value is reachable without hovering: tooltips enhance, a compact table (or \+direct labels) carries the data too. Hit targets ≥ 24px.+- Diagrams: nodes are `.card`s (or plain labelled boxes), connectors hairline `--line-2` \+with small arrowheads only where direction matters, the current/selected node in \+`--accent`; a flow reads left→right or top→bottom, never both; no emoji icons — draw \+small inline-SVG icons or use none."""++AVOID: Final = """\+## What reads as generated — never ship these (they were in our own archive)+- A centred hero with a giant headline and a tagline on a page that is not a landing \+page; gradient text; glows, blurred colour blobs, radial backdrops; a gradient anywhere.+- Pills and chips as decoration (an "eyebrow pill" above the headline, emoji chips as \+filters); emoji as section markers or icons; 01/02/03 markers on non-sequences.+- The Tailwind rainbow (#3b82f6, #a855f7, #8b5cf6, #06b6d4, #10b981, #f59e0b, #f43f5e, \+slate greys) and any palette not in the token block; near-black with one acid-green \+or neon accent; purple-to-blue gradients.+- Every box a rounded card with an accent bar on its side; "rounded-lg everywhere"; \+cards nested in cards; three equal columns of icon + title + sentence.+- Marketing voice ("Next-Gen", "Intelligence Hub", "Tracker", "supercharge"); \+lorem ipsum; placeholder numbers; "TODO"; a title with an appended explainer \+("Dashboard — an interactive overview of…").+- Charts: dual axes, thick saturated blocks, dashed grids, rainbow categories, a value \+on every point, a 2-slice pie, legend-less multi-series, text in the series colour.+- Web fonts or anything fetched (the sandbox blocks every request — the page breaks \+silently); scattered micro-animations; animation that runs without being asked for."""++DONE_MEANS: Final = """\+## Done means+- The file opens from disk with no network and renders with no console errors; every \+script, style and image is inline.+- Both themes read correctly: open it once with `?theme=light` and once with \+`?theme=dark` (or flip the OS setting) — same hierarchy, legible contrast, accent \+working on both grounds; no colour defined only in a media/[data-theme] block.+- The page does exactly what the request asked — the chart the user named, the \+comparison, the explanation — with the real numbers and facts from the request; \+where something was missing, a clearly labelled assumption.+- Nothing on the page says how it was built, which model wrote it, or what the \+instructions were.+- Nothing else was created or changed."""+++__all__ = [+ "AVOID",+ "CHARTS",+ "DESIGN_SYSTEM",+ "DONE_MEANS",+ "READ_THE_REQUEST",+ "THEME_BOOTSTRAP_JS",+ "THEME_CSS",+]diff --git a/jarvis/ui/web/frontend/src/views/VisualizationView.tsx b/jarvis/ui/web/frontend/src/views/VisualizationView.tsxindex 9b7bae3df2..a90045a452 100644--- a/jarvis/ui/web/frontend/src/views/VisualizationView.tsx+++ b/jarvis/ui/web/frontend/src/views/VisualizationView.tsx@@ -20,6 +20,7 @@ import { ScrollArea } from "@/components/ui/scroll-area";import { RunGraphPanel } from "@/components/visualization/RunGraphPanel";import { ViewHeader } from "@/views/ChatsView";import { useT } from "@/i18n";+import { useThemeValue } from "@/hooks/useTheme";import { cn } from "@/lib/utils";import { useEventStore } from "@/store/events";import { openExternalUrl } from "@/lib/openExternal";@@ -407,9 +408,10 @@ function ArtifactToolbar({}}, [visual, pushToast, t]);+ const theme = useThemeValue();const externalUrl =visual.kind === "page"- ? artifactPageUrl(visual.slug, visual.path)+ ? `${artifactPageUrl(visual.slug, visual.path)}?theme=${theme}`: visual.url;const tabs: Array<{ id: StageMode; label: string; Icon: typeof Eye; show: boolean }> = [@@ -530,6 +532,10 @@ function ArtifactToolbar({*/function ArtifactStage({ visual }: { visual: VisualArtifact }) {const t = useT();+ /* The page follows the APP's theme, not the OS's: the artifact brief has every+ * page stamp `data-theme` from this query (design_guide.THEME_BOOTSTRAP_JS),+ * so a light app shows a light artifact even on a dark-mode machine. */+ const theme = useThemeValue();const [failed, setFailed] = useState(false);const id = visualId(visual);// A new file must not inherit the previous file's failure verdict.@@ -563,8 +569,8 @@ function ArtifactStage({ visual }: { visual: VisualArtifact }) {return (<div className="flex h-full flex-col"><iframe- key={id}- src={artifactPageUrl(visual.slug, visual.path)}+ key={`${id}:${theme}`}+ src={`${artifactPageUrl(visual.slug, visual.path)}?theme=${theme}`}title={visual.title}data-testid="visualization-frame"onError={() => setFailed(true)}diff --git a/tests/unit/artifacts/test_brief.py b/tests/unit/artifacts/test_brief.pyindex ca9a6503f8..43ea992fcb 100644--- a/tests/unit/artifacts/test_brief.py+++ b/tests/unit/artifacts/test_brief.py@@ -9,13 +9,15 @@ rail strips, and the revision block that carries the previous page.from __future__ import annotations+import re+from jarvis.artifacts.brief import (MAX_PREVIOUS_HTML_CHARS,artifact_filename,build_artifact_brief,)+from jarvis.artifacts.design_guide import THEME_BOOTSTRAP_JS, THEME_CSSfrom jarvis.missions.stream_evidence import clean_request_body-from jarvis.visuals.brand import BRANDdef test_filename_comes_from_the_title_and_stays_short() -> None:@@ -40,9 +42,36 @@ def test_brief_states_the_single_file_and_no_network_contract() -> None:assert "`<title>` that names the artifact: `Plan comparison`" in promptassert "written in English" in promptassert "Compare the three plans by price and features." in prompt- # Brand palette rides along so the page matches the app.- assert BRAND["primary"] in prompt and BRAND["bg"] in prompt- assert "prefers-color-scheme: light" in prompt+ # The app's own design system rides along, verbatim, so the page matches it.+ assert THEME_CSS in prompt and THEME_BOOTSTRAP_JS in prompt+ assert "## Read the request first" in prompt+ assert "## Charts and diagrams" in prompt+ assert "## What reads as generated" in prompt+ assert "## Done means" in prompt+++def test_theme_tokens_are_defined_in_every_scope() -> None:+ """The classic unreadable-artifact bug is a token that exists in one theme+ only. Every `--name` in the dark root block must also exist in the OS-light+ block and in the explicit light stamp."""+ blocks = re.findall(r"\{([^{}]*?--[^{}]*)\}", THEME_CSS)+ scoped = [b for b in blocks if "--bg:" in b]+ assert len(scoped) == 3, "dark root, OS-light, explicit-light"+ names = [set(re.findall(r"(--[a-z0-9-]+):", b)) for b in scoped]+ assert names[0] >= names[1] and names[1] == names[2]+ # The chart palettes documented as validated are the ones shipped.+ dark = "--s1:#C98500;--s2:#4F8EF7;--s3:#E0633F;--s4:#1F9E7F;--s5:#9085E9;--s6:#C84E8A"+ light = "--s1:#A86B00;--s2:#2A6FD0;--s3:#D4532E;--s4:#158F6B;--s5:#5B46C2;--s6:#C23F86"+ assert dark in THEME_CSS and light in THEME_CSS+++def test_the_brief_names_the_forms_the_user_can_ask_for() -> None:+ prompt = build_artifact_brief("x", title="T", language="en").prompt+ for phrase in ("Balken", "Vergleich", "erklär mir", "dashboard", "timeline", "landing page"):+ assert phrase in prompt, phrase+ # And the things our own archive got wrong are named as forbidden.+ for phrase in ("gradient", "Tailwind rainbow", "emoji", "dual axes", "Web fonts"):+ assert phrase in prompt, phrasedef test_language_code_lands_in_the_html_lang_and_the_content_rule() -> None:@@ -81,7 +110,8 @@ def test_an_oversized_previous_page_is_clipped_head_and_tail() -> None:brief = build_artifact_brief("Tweak.", title="Huge", language="en", previous_html=huge)assert "middle of the previous version omitted" in brief.promptassert brief.prompt.rstrip("`\n").endswith("ZEND")- assert len(brief.prompt) < MAX_PREVIOUS_HTML_CHARS + 6_000+ # The guide itself is ~12k chars; the clipped page adds the cap, not more.+ assert len(brief.prompt) < MAX_PREVIOUS_HTML_CHARS + 20_000def test_brief_is_deterministic() -> None: