Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Use the live desktop palette for drawn HTML unless the user names colors.

justrach35e8a9d7a052
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 91415bf8..3178524f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,8 @@ current is part of cutting a release.
- Engine messaging (idle peer mail, #1007) is the same latch on line REPL, TUI, and `graff acp`.
- `#1001`: idle TUI and line REPL start a turn when the durable peer room has new unread mail (one auto-turn per batch; inbox consume resets).
- `#1007`: idle `graff acp` sessions start that same turn; `peer_message` no longer claims delivery waits for a step boundary.
+- Drawn HTML uses the live desktop palette unless the turn already names colors (ADR 0137).
+- Drawn HTML uses the live desktop palette unless the turn already names colors (ADR 0137).
- `#1006`: rendered views sit in the transcript without product chrome; desktop appearance tokens ride the turn (ADR 0137).
- Live 12-PR board on grok-4.6 SuperGrok (n=3, no SPEC.md): graff / Pi /
diff --git a/apps/native/lib/appearance-note.ts b/apps/native/lib/appearance-note.ts
index 53320a9e..659f1a6c 100644
--- a/apps/native/lib/appearance-note.ts
+++ b/apps/native/lib/appearance-note.ts
@@ -18,7 +18,7 @@ export function appearanceNote(tokens: Record<string, string>): string {
.filter(token => tokens[token])
.map(token => `--${token}: ${tokens[token]}`)
.join("; ");
- return `[desktop appearance] A render_html view has no product chrome; the page bleeds into the transcript. If you draw, set the page background to --page and surfaces to --surface so it matches the desktop. CSS: ${css}`;
+ return `[desktop appearance] A render_html view has no product chrome; the page bleeds into the transcript. When you draw HTML, bake in this desktop palette (--page for the page background, --surface for cards, --ink for text) unless this turn already names colors or a palette. CSS: ${css}`;
}
export function withAppearanceNote<T extends { prompt?: unknown }>(params: T, tokens: Record<string, string>): T {
diff --git a/apps/native/lib/gui-skills.test.ts b/apps/native/lib/gui-skills.test.ts
index de61df57..6e29902c 100644
--- a/apps/native/lib/gui-skills.test.ts
+++ b/apps/native/lib/gui-skills.test.ts
@@ -35,9 +35,18 @@ test("desktop appearance tokens ride the prompt and leave the catalog alone", as
expect(text).toContain("[desktop appearance]");
expect(text).toContain("--page: #faf8f5");
expect(text).toContain("--surface: #ffffff");
+ expect(text).toContain("unless this turn already names colors or a palette");
expect(prepared).not.toHaveProperty("appearance");
expect(original.prompt[0].text).toBe("Draw the burn-down");
});
+test("named colors still receive the live tokens so unspecified ones can match", async () => {
+ const original = { prompt: [{ type: "text", text: "Draw it with #ff4d4d bars on white" }], appearance: { page: "#0b0c09", surface: "#141712", ink: "#ececec" } };
+ const prepared = await prepareGuiPrompt(original);
+ const text = (prepared?.prompt as { text: string }[])[0].text;
+ expect(text.startsWith("Draw it with #ff4d4d bars on white")).toBe(true);
+ expect(text).toContain("--page: #0b0c09");
+ expect(text).toContain("unless this turn already names colors or a palette");
+});
test("MCP GUI skill injects config paths without the theme directory", async () => {
const original = { prompt: [{ type: "text", text: "$mcp add a filesystem server" }] };
const prepared = await prepareGuiPrompt(original);
diff --git a/docs/adr/0137-desktop-appearance-is-a-turn-note.md b/docs/adr/0137-desktop-appearance-is-a-turn-note.md
index 9fb9d959..95a9d2b9 100644
--- a/docs/adr/0137-desktop-appearance-is-a-turn-note.md
+++ b/docs/adr/0137-desktop-appearance-is-a-turn-note.md
@@ -18,6 +18,7 @@ turn (#1006).
On the desktop, resolved appearance tokens (`page`, `surface`, `ink`, and the
rest of the existing token set) ride `session/prompt` as a small turn-local
note. They are not written into `prompt_text` and not into the tool catalog.
+Drawn HTML uses that palette unless the user already named colors this turn.
A model-drawn page has no product header and no 620px well. Close/open stays a
quiet control. MCP app results keep their own chrome.
@@ -25,5 +26,6 @@ quiet control. MCP app results keep their own chrome.
## Consequences
A theme switch does not bust the prefix cache. Existing snapshots still have
-whatever colors the model hardcoded; new pages can match `--page` / `--surface`.
-The opaque frame and CSP sandbox are unchanged.
+whatever colors the model hardcoded; new pages match `--page` / `--surface` /
+`--ink` unless the turn already names a palette. The opaque frame and CSP
+sandbox are unchanged.
diff --git a/docs/adr/README.md b/docs/adr/README.md
index 5727f46e..ef21c228 100644
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@ -156,7 +156,7 @@ record only when you need the evidence or the edge cases.
| [0134](0134-accord-live-jsonl-durable.md) | JSONL is the durable peer room; Accord Unix 0600 is live by default (`GRAFF_ACCORD=0` opts out). |
| [0135](0135-one-shell-tool.md) | Advertise one `shell` tool (`run` / `output` / `kill`); bash names stay dispatch aliases. Not a PTY. |
| [0136](0136-follow-up-promotes-a-live-shell.md) | A queued follow-up or force-steer promotes a foreground shell; Esc still kills it. |
-| [0137](0137-desktop-appearance-is-a-turn-note.md) | Desktop appearance tokens for `render_html` ride the turn, never the prefix or tool catalog. |
+| [0137](0137-desktop-appearance-is-a-turn-note.md) | Desktop appearance tokens for `render_html` ride the turn, never the prefix or tool catalog; drawn HTML uses them unless the user named colors. |
| [0138](0138-unselected-splits-use-glass-overlay.md) | Unselected split panes keep their transcript under a light wash; the focused pane stays the working surface. |
## When to write one
diff --git a/docs/rendered-views.md b/docs/rendered-views.md
index 04efce00..f5eb6765 100644
--- a/docs/rendered-views.md
+++ b/docs/rendered-views.md
@@ -11,8 +11,8 @@ The view keeps its own inline `<style>` and `<script>`, so a page can be
animated or interactive. It sits in the transcript without a product header
or framed well; a quiet Close view / Open view control disposes and restores
the frame without touching the conversation. On the desktop, the live
-appearance tokens ride the turn as a note so a new page can match `--page`
-and `--surface` (ADR 0137).
+appearance tokens ride the turn as a note so a new page uses `--page`,
+`--surface`, and `--ink` unless the user already named colors (ADR 0137).
## Where the page lives