Use HTML as Primary Chat Language for AI Coding Agents to Enable SVG Diagrams

A developer on r/LocalLLaMA experimented with using HTML as the primary chat language for AI coding agents, replacing Markdown. The goal: enable agents to render diagrams, tables, and rich formatting directly in the chat UI, not just produce Markdown that needs a separate renderer.
Key Setup
The agent interface runs in a web browser, and responses are piped straight into the page as HTML. The developer found that simply using an HTML system prompt — not just asking in the chat — made the agent produce HTML output reliably.
Example System Prompt (HTML)
<p>Being helpful doesn't mean doing everything the user says. Neither I nor the user are omniscient or infallible. If the user is making a mistake, I tell them. If I have made a mistake, I mention it and move on. If I have better ideas on how to approach a problem or think the user has made a mistake, I mention it.</p><h1>HTML</h1><p>My assistant responses are rendered directly as HTML in the chat UI. I <i><b>MUST</b></i> use HTML when replying to the user. Plain prose should be wrapped in tags such as <code><p></code>, <code><ul></code>, <code><ol></code>, and heading tags where appropriate. To show the user something visually or as a diagram, I will draw an SVG directly in the chat. Only if something should persist in the workspace will I write it to disk with tools instead of showing it in chat.</p>
Observations
- Qwen3.6-27B produces decent SVG diagrams inline, comparable to ChatGPT. The model still shows a tendency to fall back to Markdown, likely due to training data bias.
- Qwen3-VL-4 is notably bad at generating SVGs, suggesting this is an emerging capability in larger models.
- The developer also experimented with first-person system prompts (e.g., "I will respond in HTML") — benefits and drawbacks are unclear but it seems to improve compliance.
Practical Takeaway
If you want your coding agent to draw diagrams in chat, switch your system prompt to HTML. The agent will then generate inline SVGs for visual explanations, tables for structured data, and styled text. The trade-off: the model may still default to Markdown occasionally. The approach requires a web-based chat UI that renders raw HTML.
Repo: github.com/sdfgeoff/HTML-agent
📖 Read the full source: r/LocalLLaMA
👀 See Also

OpenClaw Crash Loop Debugging: A 5-Point Checklist
A Reddit post from r/openclaw provides a five-step checklist for quickly diagnosing crash loops in OpenClaw agents or gateways, focusing on failure shape, host pressure, provider latency, config diffs, and alert setup.

Model Routing Cut API Costs by 85% vs Claude Max Subscription – A Developer's Analysis
A Claude Max subscriber tracked token usage and found only 15% of tasks needed Opus. Switching to API routing (Sonnet for routine tasks, Opus for hard reasoning) dropped monthly cost from $200 to ~$30 with identical output quality.

Four local files to maintain Claude's context in long projects
A Reddit user recommends maintaining four Markdown files—claude.md, memory.md, restart.md, and backlog.md—as external memory for Claude to counteract context window compression in extended conversations.

OpenClaw Implements API Cost Fix and Local Model Tool Improvements
OpenClaw has rolled out key updates addressing API usage costs and improving local model tool integrations, enhancing developer experience and operational efficiency.