SDIF Specification
Overview
This section defines the normative specification for SDIF (Semantic Data Interchange Format) version 1.0. The format version is independent of any library or tooling version.
| Property | Value |
|---|---|
| Format version | SDIF 1.0 |
| Status | Stable |
| Encoding | UTF-8 |
| MIME type | application/sdif (proposed) |
| Canonical extension | .sdif.canon |
| AI extension | .sdif.ai |
Conformance Language
This specification uses the key words MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL as defined in RFC 2119.
Scope
The SDIF 1.0 specification covers the following components:
- Parser — tokenization, directive recognition, block structure, and AST construction
- AST — the abstract syntax tree representing parsed SDIF documents
- Schema validation — type-checking fields, tables, columns, relations, and rule functions against a Schema document
- Canonical syntax v1 — the deterministic serialization form (
canonical-syntax-v1) used for reproducible storage and hashing - AI projection — the compact, alias-enriched
.sdif.aiform intended for language-model consumption
Profiles
SDIF defines three distinct profiles, each with its own directive header and intended use:
| Profile | Directive | Extension | Purpose |
|---|---|---|---|
| Source | @sdif 1.0 | .sdif | Human-authored, may include comments and flexible whitespace |
| Canonical | @sdif 1.0 (with canonical serialization) | .sdif.canon | Deterministic, hashable, machine-produced |
| AI | @sdif.ai 1.0 | .sdif.ai | Compact, alias-enriched projection for language models |
All three profiles share the same fundamental grammar. Canonical and AI profiles impose additional constraints defined in their respective sections.
Specification Pages
- Lexical Structure — encoding, line endings, separators, comments, identifiers
- Directives —
@sdif,@sdif.ai, and@profiledirectives - Document Model —
kind, fields, tables, relations, rules, narratives - Scalar Values — string, integer, float, boolean, null, date, datetime
- Tables — HTAB-delimited table syntax and column types
- Relations — triple-style relation syntax
- Schemas — Schema kind and validation model
- Canonicalization —
canonical-syntax-v1contract and pipeline - AI Projection —
.sdif.aiformat and round-trip requirements - Conformance — test fixture layout and conformance requirements
- Security — threat model and safe-handling guidance