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

Reddit user shares prompt structure to reduce Claude Code output drift in complex tasks
A Reddit user found that using a structured prompt layout for longer Claude Code tasks helps prevent output drift. The approach involves defining specific elements like task scope, required files, success criteria, and avoidance parameters before execution.
Slash Agent Start-Up Tokens by 60%: Clean Up Your Bot's Workspace
One developer dropped start-up tokens from 80k to 31k by having an LLM audit and restructure workspace files—removing bloat, deduplicating info, and organizing tool docs into separate files.

Routing Agent Subtasks to Cheaper Models Dropped Cost from $18 to $4 on Same Refactor
A developer cut agent run costs from $18 to $4 by routing routine subtasks (lint, rename, config edits) to cheap models like DeepSeek V4 Pro and Tencent Hunyuan Hy3, reserving Opus 4.7 for complex reasoning.

Why Your OpenClaw Scheduled/Cronjob Tasks Fail
When you ask an agent to create a scheduled task, it often creates a shell or Python script instead of using OpenClaw's prompt-in-cron feature. This makes tasks non-agentic and inefficient.