L
LLLOS.ai
Career
L
◆ AI Learning · Hard rule

Sticker studio leaked the model's entire thought process onto the page

Standing Rules 1–7 above were all born or confirmed in this incident. The shortest form: *the user sees the result or a clean human sentence — never the machine's words.*

By Pawan Nayar · from the LLOS AI Learning record

The rule

Standing Rules 1–7 above were all born or confirmed in this incident.

The shortest form: *the user sees the result or a clean human sentence — never the machine's words.*

**What was seen** A sticker generation returned no sticker. Instead the page displayed the model's full planning essay ("Let me think about the animation more carefully…"), hundreds of words of internal reasoning, ending with the metadata toast (claude-sonnet-4-6 · 773 in / 4,096 out tok · 77.6s). A truncated husk of the drawing was also saved to the gallery. Pawan: *"isn't this a crime to not give result and reveal entire thought process — even if you fail you can't leak your code."* **Root cause** Two failures stacked: 1. Sonnet spent its whole 4,096-token output budget narrating its plan in prose and hit `max_tokens` before finishing the drawing. The prompt said "Respond with ONLY the raw SVG" but nothing *enforced* it. 2. Both salvage functions (client `salvageSVG`, server `_salvage_svg`) accepted any text containing `<svg` — the essay mentioned SVG tags mid-prose, so the thought-dump was "recovered" as a sticker, innerHTML'd onto the stage, and saved to the gallery. A third small leak: the error path showed a raw 140-char "Model said: …" excerpt. **The fix that shipped** (all shipped 2026-07-08, backups in each folder's `.backups/`): 1. Assistant prefill — `/api/sticker/generate` appends an assistant turn starting with `<svg>`; the Anthropic API must continue the drawing from that token (`server.py`, sticker route). 2. Strict salvage on BOTH sides — a salvaged SVG needs ≥2 real drawing elements (path/rect/circle/ellipse/polygon/polyline/line/g/use) and <400 chars of bare text outside tags; otherwise it is a failed generation (`server.py _salvage_svg` mirrors client `salvageSVG` in `design/sticker_studio.html`). 3. Whitelisted errors — the "Model said" peek removed; only hand-written `.friendly` messages render; API/network/exception text collapses to one clean line. 4. Gallery sweep — 12 entries scanned, 1 prose/truncated blob removed, 11 kept (backup: `data/sticker_gallery.json.pre-sweep-20260708`).

Words you'll need

Resolved from this lesson's own record — real definitions, not invented for this page.

Failure Analysis

Looking at what went wrong and why

Guardrails

Safety rules that keep AI from doing bad things

Questions people ask

More from the same record, pulled by shared topic — not written new for this page.

A slider had a floor on a parameter that has no optimum (textstock fill depth)

**What was seen** TextStock's "fill depth" (how many words are packed into the shape) could not go below 1000. Every stock came out dense; a sparse, readable one was unreachable.

What must be true of any tool that asks an LLM to produce something?

1. **Constrain output at the API, not in the prompt.** "Respond with ONLY the SVG" in a prompt is a request; the model can ignore it.

How can an AI model ensure high-quality outputs every time, without accepting lower quality options?

The AI model must have clear rules for what is acceptable. These rules are called 'quality gates.' If an output does not pass these gates, it is rejected.

How can an AI model ensure that its output data matches the original content perfectly?

An AI model should check each part of its output. For example, if there is a list of key phrases, the AI model must confirm each phrase is in the main text.

What to remember

Standing Rules 1–7 above were all born or confirmed in this incident. The shortest form: *the user sees the result or a clean human sentence — never the machine's words.*