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

✍️ OpenClawRadar📅 Published: June 15, 2026🔗 Source
Use HTML as Primary Chat Language for AI Coding Agents to Enable SVG Diagrams
Ad

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>&lt;p&gt;</code>, <code>&lt;ul&gt;</code>, <code>&lt;ol&gt;</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>
Ad

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

Ad

👀 See Also