Part of the WebMEM Protocol
Location: /specification/sdt/yaml-in-html/classes/
Last Updated: 2025-07-28
What is an SDT Fragment Class?
The Semantic Data Template (SDT) Fragment Class is a standardized container for embedding structured, machine-readable knowledge fragments directly within HTML using YAML.
Each fragment declares its semantic role using the data-sdt-class attribute (e.g., DataFragment, FAQFragment, MetaFragment) and is wrapped in a <template data-visibility-fragment> tag to ensure it is inert, parsable, and non-disruptive to the DOM.
SDT Fragment Classes serve as the atomic building blocks of Memory-First Publishing, enabling precise fact exposure, trust scoring, glossary alignment, and AI retrievability at the fragment level.
Designed for compatibility with the Semantic Digest Protocol (SDP) and Glossary Term Protocol (GTP), each class enforces a consistent structure and purpose — making it easy for AI agents, public indexers, and model context frameworks (like MCP) to parse, cite, and reflect on individual units of structured knowledge.
Components of the SDT HTML Container
1. <template> Element
- Provides an inert container — content is not rendered in the DOM.
- Ensures compatibility with HTML5 standards.
- Allows AI crawlers, agents, and reflection engines to extract structured data.
2. data-visibility-fragment Attribute
- Flags the template as an AI-readable memory fragment.
- Required for inclusion in Memory-First Publishing and SDP indexing.
3. data-type="text/yaml"
- Declares the embedded format as YAML.
- Ensures any agent or processor knows what to parse.
4. data-sdt-class="..."
- Declares the fragment class type (e.g.,
DataFragment,MetaFragment,FAQFragment). - Determines parsing logic, structure expectations, and schema validation rules.
Example: Minimal Valid Container
<template
data-visibility-fragment
data-type="text/yaml"
data-sdt-class="DataFragment">
# YAML block here
</template>
Container Markup Specification
Key Requirements
<template>must includedata-visibility-fragment- Must specify
data-type="text/yaml"anddata-sdt-class - YAML content must follow the expected structure for its declared class
data-entityis conditionally required depending on the fragment class
Reserved IDs
id="provenance-meta"→ trust anchor (for provenance linkage)id="fragment-*"→ fragment identity anchor (used in digests, citations, or exports)
A. Optional / Reserved Container Attributes
| Attribute | Purpose | Status |
|---|---|---|
data-fragment-id |
Optional override for canonical ID | ❓ Not yet standardized |
data-fragment-scope |
Mirrors YAML, helpful at outer layer | ✅ Standardizing |
data-glossary-scope |
Crawlers use this to resolve term alignment before parsing | ✅ Common in examples |
data-entity |
Enables quick scoping, required on entity fragments | ⚠️ Needs enforcement |
B. Canonical Attribute Order
| Attribute | Required? | Notes |
|---|---|---|
data-visibility-fragment |
✅ | Always present |
data-type="text/yaml" |
✅ | Required for MIME disambiguation |
data-sdt-class |
✅ | Declares behavior and structure |
data-entity |
⚠️ Conditional | Required for entity-scoped fragments |
data-fragment-id |
❌ Optional | Helpful when faq_id or term_id differs from id |
data-fragment-scope |
✅ | Declares memory domain or protocol function |
C. Reserved IDs
| ID Pattern | Purpose |
|---|---|
id="provenance-meta" |
Declares the trust anchor for provenance_ref linking |
id="fragment-*" |
Canonical identity anchor for each SDT fragment |
Best Practice: Never reuse fragment IDs across entities or digest scopes. Use unique
fragment-*identifiers per memory unit.