Hasty Briefsbeta

Bilingual

HTML as a native data format for LLMs

20 hours ago
  • #AI Agents
  • #HTML Templating
  • #Document Generation
  • Using HTML instead of JSON for document templates made AI agents more efficient and reliable by leveraging the model's pre-trained fluency in HTML.
  • A single tool for whole-tree rewrites (set_template_markup) reduced round trips, prevented intermediate invalid states, and ensured coherent edits.
  • HTML's external labeling (e.g., data attributes) makes the tree readable for both humans and AI, unlike JSON's nested, unlabeled structure.
  • A surgical tool (set_node_attributes) allowed minor tweaks without full rewrites, utilizing browser-native APIs for simplicity.
  • Key lessons include preserving identifiers rigorously, validating at boundaries, and storing typed data internally while exposing HTML only at authoring edges.
  • Reference implementation barkup enforces round-trip integrity, declared type coercion, and structured error handling to avoid common pitfalls.