Every reply, from any brain, is drawn from the same six parts, and every brain gets the same answer-shape rules. This page is for developers. What people see is in Agent steps in replies, Progress and Interactive answers.

Enforced interactive UI

Interactive cards use a versioned template ID and validated JSON data. The application owns the layout. Writing outlines and their keyword picker remain model instructions; they are separate from the card enforcement boundary. Prose always uses the fixed Markdown answer view. See Answer template contract for the wire format, rejection rules, state and replay.

Where sources and plans come from

When a model cites a web page, the chat shows that page as a source pill. The pill comes from the model’s own citation: Claude’s citations, ChatGPT’s url citations, Gemini’s grounding, or Claude Code’s web search results. Allternit does not guess sources from the reply text. The agent’s plan always appears as one checklist in the Progress pane, whether the plan came from Claude’s to-do list, Codex’s plan or another CLI agent’s plan. If a model returns no structured sources, Allternit reads the search tool’s output instead, the same way it did before.

The contract

The contract has six parts. Every brain is mapped into them. The types and normalizers are in allternit-ai/src/lib/ai/response-parts.ts, and the runtime copy is in cmd/gizzi-code/src/runtime/session/response-parts.ts. Every new frame field is additive. Older apps ignore source and plan frames they don’t know, and they keep folding plans from todo tool calls. The UI reads sources only through messageSources(parts). That function returns the structured sources first and then the webResults() fallback, marked origin: "parsed". How sources travel. gizzi stores provider citations on the text part as metadata.sources, and search and fetch results on the completed tool part as state.metadata.sources. Both bridges (allternit-api v1_routes.rs and gizzi agent-compat.ts) turn these into source frames. History reloads read the same fields from metadata.parts. How tool progress travels. While a tool call is running, a part whose metadata carries progress_detail (today only media_generate) makes allternit-api send {"type":"tool_progress","messageId","toolCallId","toolName","metadata":{"progress","progress_detail","poster"?}}, once per distinct progress_detail and never after the call settles. Clients merge metadata into that call’s running tool part. Older apps ignore the unknown frame type. How plans travel. Every native plan is written to gizzi’s Todo list, and both bridges forward each todo.updated event as a plan frame.

Brains: native or parsed fallback

Files

Answer shapes and templates

Every brain gets one plain-Markdown block of answer-shape rules (never forced JSON): bottom line first, no step narration, inline source links, a table when comparing 3 or more things, one next step, a length line from the user’s Response Style, and the one placement rule (“Where an answer goes”: the reply by default at any length; an interactive card only to pick, adjust, fill in or explore; an artifact only for something kept, edited or shared on its own, or when asked). The rules and the template registry are two files, byte-identical in both repos; each repo pins their SHA-256 in a test:
  • allternit-ai/src/lib/openui/answer-shapes.md and answer-templates.json
  • cmd/allternit-api/src/answer_shapes.md and answer_templates.json

The templates

Comparison, Plan, Research brief and Status report open with a ## title and an italic dateline, then the bottom line.

The picker

The template is picked before the agent starts, from the user’s message, so the same question always gets the same layout. pickAnswerTemplate (app, src/lib/openui/answer-shapes.ts) and pick_template (server, answer_shapes.rs) try templates by priority, low to high, and take the first one whose trigger phrase appears in the message as whole words, ignoring case; otherwise Quick answer. The picked template rides as one line (“Use answer template: …”) in gizzi’s turn-only turnSystem layer, so the cached system block stays byte-identical turn to turn.

Card repair loop

At the end of a turn, allternit-api checks each openui card (openui_text::check_reply, the same check behind the card_check frame). Failed cards become a short repair note, quoting the card and its errors, queued per user and chat. The next send carries it once in gizzi’s turn-only turnSystem layer, joined with the location layer; it is never stored on the user message. It is bounded to one retry: a turn that carried a note never queues another. Notes are held in memory, so a restart drops them. ALLTERNIT_CARD_REPAIR=0 (or off, false) turns it off; it is on by default. Why not a silent repair turn in the same stream. The reply text has already streamed to the app by the time cards are checked. A second gizzi prompt would leave a synthetic user message and a duplicate reply in session history, and the app has no frame that swaps a card in place. The next-turn note fixes the model’s card without either.

Answer shape lint and eval

lintAnswerShape(markdown, template, { style }) in allternit-ai/src/lib/answers/shape-lint.ts is a pure check that passes or fails each rule: bottom line, title, dateline, sections in order, table, steps list, no narration, one next step, and the length band for the Response Style. Template sections live in ANSWER_TEMPLATE_SHAPES (pass the registry through options.templates to swap them). The eval runner sends a fixed prompt set (2 or 3 per template) to real brains and scores each reply with the lint:
  • Without --yes it only prints what it would send; every prompt is a real, possibly metered model turn.
  • --fixtures scripts/answer-eval/fixtures is a no-network dry run over saved answers (<brain>/<promptId>.md).
  • Env: ALLTERNIT_API_URL (default http://127.0.0.1:8013) and ALLTERNIT_API_TOKEN. Replies are read from the /api/v1/ai/chat SSE stream.