Part of the WebMEM Protocol
Location: /specification/sdt/yaml-in-html/
Last Updated: 2025-07-28
What is YAML-in-HTML?
YAML-in-HTML is the primary format for publishing trust-scored memory fragments using the WebMEM Protocol. It allows structured YAML to be embedded within a <template> tag so that it:
- ✅ Does not render in the browser (inert)
- ✅ Can be parsed by LLMs, agents, and validators
- ✅ Defines a complete, retrievable memory fragment
This transforms HTML into a dual-purpose document: human-readable surface, machine-retrievable memory layer.
Core Structure
<template data-visibility-fragment data-sdt-class="DataFragment">
---
data_id: plan-H1234-456-0
entity_type: Plan
value: 174.70
unit: USD
defined_term: Part B Premium
glossary_id: term-b-premium
source: https://data.cms.gov/...
prov: true
export:
- ttl
- jsonld
- md
...
</template>
Tag Requirements
| Attribute | Purpose |
|---|---|
data-visibility-fragment |
Declares a memory-visible fragment |
data-sdt-class |
Declares the fragment type (e.g. DataFragment, FAQFragment) |
Optional attributes:
data-digest– Digest URI or canonical referencedata-entity-id– Links the fragment to a known entity IDdata-type="text/yaml"– Optional MIME hint for extractors
YAML Rules
- Must begin with
---and end with... - Must be valid YAML 1.2
- Must conform to the schema for its class:
/schema/sdt/[class].schema.json
Use Cases
- Medicare plan benefit fragments
- Glossary-aligned definitions
- Derived statistics or explanations
- FAQs, Q&A, procedural steps
- Speakable content for assistive agents
Each fragment is self-contained, citeable, and independently retrievable via endpoint or inline extraction.
Rendering Behavior
- No visual output in the browser
<template>is inert and excluded from rendered DOM- AI agents, semantic crawlers, and validators can extract and parse structured memory
Compatibility
| Agent / Tool | Behavior |
|---|---|
| LLMs | Parse YAML, infer entity, value, source, and term linkage |
| Validators | Validate fragment against SDT schema for its class |
| Semantic Crawlers | Index fragment-level citations and glossary linkage |
| CMS + Plugins | Export SDTs to structured digest endpoints (TTL, JSON-LD, etc.) |