Replacing LLM-generated HTML micro-apps with a 0-token JSON compiler and 3-layer null-origin CSP sandbox
Adorable-Cost-3249 · reddit · 2026-12-05
A Reddit engineer details why their team stopped having LLMs regenerate bespoke HTML/React micro-apps every turn and split what to show from how to render:
- The model pays token cost once authoring a small declarative JSON spec (8 typed blocks: KPI strips, sortable comparison tables, timelines, checklists, etc.)
- Everyday usage costs 0 LLM tokens: a pure Go compiler (hq space create) builds portable offline HTML, with CLI commands for goal sync, notes, worktrees, and exports
- UI JS never silently mutates state: checking off a milestone surfaces a one-click hq goals check-off command so updates stay explicit in chat or CLI
- Three-layer sandbox: strict Go compile-time escaping plus SVG/URL allowlists, an iframe sandbox with only allow-scripts (opaque null origin, no parent cookie/localhost access), and CSP default-src 'none' blocking runtime network egress
The author honestly notes single-file HTML requires script-src 'unsafe-inline', which is why the null-origin and CSP walls are non-negotiable.
More from coding & agent
- LangChain on agents going async: background work plus an always-on orchestrator — LangChain · 2026-12-05
- mitchellh: debugging AI agents feels like looping Coldplay's "Fix You" on repeat — Pseudomanifold · 2026-12-05
- eBPF probe feeds kernel taint into Qwen's output head at ~5µs per token — viksit · 2026-12-05
- Claude Code mines 6 months of call transcripts, recovers $37,400 from 'dead' leads in 48 hours — aryanXmahajan · 2026-12-05
- ebpf-lm-head open-sourced: kernel-governed token security for LLM agents — viksit · 2026-12-05
- Rex terminal impresses: no Ghostty-style weaknesses, easy iPad/iPhone server access — Technovangelist · 2026-12-05