- Scope is implicit (never repeat full paths unless scope changes)
- Each line = one semantic unit
- Minimal structural symbols
- Lossy allowed
- Deterministic compilation
- Optimized for token count, not human reconstruction
LLMD is a UTF-8, line-oriented format.
Each non-empty line begins with exactly one of:
~ metadata
@ scope declaration
: attribute line (scoped)
plain text (no prefix — paragraphs, prose)
- list item (scoped, both ordered and unordered)
→ forward relation (scoped)
← reverse relation (scoped)
= equivalence relation (scoped)
:: block start (scoped)A line is plain text if it does not start with any of the above prefixes.
Horizontal rules (---, ***, ___) are stripped during parsing and never appear in output.
@node- Sets current scope.
- All following lines inherit this scope.
- Scope persists until next
@.
Scope names:
- SHOULD be short
- SHOULD be normalized (see §7)
- SHOULD NOT contain
/(hierarchy flattened by compiler)
Example:
@Auth
:methods=oauth2¦apikey rate=1000/m
-oauth2 user-appNo repeated Auth/... prefixes.
Optional. SHOULD appear only once at top.
~k=v k=vNo pipes. Space-separated pairs.
Example:
~v=0.2 c=2 title=api_specMetadata SHOULD be omitted at high compression unless required.
Structured facts for current scope.
:k=v k=v k=vRules:
- No leading scope prefix
- Keys lowercase
- No spaces around
= - Space separates pairs
¦(U+00A6, broken bar) separates multiple values within a single attribute- Split on the first
=to separate key from value. Keys never contain=.
Example:
:methods=oauth2¦apikey rate=1000/m required=truePreferred over prose whenever possible.
Keys prefixed with _ are reserved for compiler-generated metadata:
:_col=<header>— column header for a 2-column property table (emitted when the value column header is informative):_cols=col1¦col2¦col3— column headers for a multi-column table:_pfx=<prefix>— common prefix extracted from subsequent keys; the reader should prepend this prefix to restore full key names
At c1+, consecutive :k=v pairs are merged onto one line. When the number of pairs exceeds max_kv_per_line (default 4), they are split across multiple : lines for chunk-safe splitting:
:k1=v1 k2=v2 k3=v3 k4=v4
:k5=v5 k6=v6 k7=v7 k8=v8
:k9=v9Unstructured prose or paragraph content. Text lines have no prefix — they are plain text.
platform requires minimum three application nodesExample:
@auth
API supports authentication via OAuth2 API keysCompiler MAY:
- Remove stopwords (c2+)
- Apply phrase map replacements (c2)
- Strip trailing periods (c2)
Both ordered and unordered Markdown lists compile to - prefixed lines.
-item textNested list depth uses . prefixes:
- depth 0:
-item - depth 1:
-. child - depth 2:
-.. grandchild
Example:
@compute
-Application nodes: 3 minimum
-. high availability recommended
-Worker nodes: 2 minimumDeclares relation from current scope.
→Node
←Node
=NodeOptional uncertainty:
→Node?Example:
@API
→DB
→Cache?This means:
API depends on DB API optionally depends on Cache
No repeated prefixes.
Used for code or preserved literals.
::type
<<<
raw content
>>>Example:
::json
<<<
{"retry":3,"backoff":"exp"}
>>>Rules:
<<<and>>>must be alone on their lines- Block content is raw and not parsed
- Compiler MAY minify JSON/YAML at c2+
Hierarchy is flattened at compile time.
Example Markdown:
# API
## AuthenticationCompiler options:
@API
@Auth@API_AuthLLMD itself does NOT encode explicit multi-level hierarchy. Hierarchy is compiler concern, not runtime syntax.
This removes / token repetition.
c ∈ {0,1,2}
- Convert Markdown structure
- Preserve most wording
- Preserve URLs
- Preserve punctuation
- Strip horizontal rules (
---,***,___)
Goal: clean but not compressed.
- Convert lists →
- - Convert
Key: Value→:k=v - Collapse whitespace
- Remove extra blank lines
- No stopword removal yet
-
Remove stopwords (configurable list)
-
Remove filler phrases:
- in order to → to
- due to → because
- is able to → can
-
Normalize units:
- "1000 requests per minute" →
1000/m
- "1000 requests per minute" →
-
Strip trailing periods from text and list lines (but not
...,e.g.,i.e.,etc.) -
Convert obvious sentences into attributes
-
Drop URLs unless flagged
Must preserve:
- negation words
- modal strength (must/should/may)
At minimum:
- Trim whitespace
- Replace spaces with
_
At c2+:
- Lowercase
Always:
- Lowercase
- Spaces →
_ - Strip punctuation except
_and- - Trim leading/trailing
-
Example:
Rate Limit → rate_limit
flm-text--secondary → flm-text--secondaryPreserving - is critical for CSS class names and other hyphenated identifiers.
- Single LF line endings
- No trailing spaces
- No multiple blank lines
- No extra spaces around operators
A valid LLMD file must:
- Begin with optional metadata
- Declare a scope before any scoped line
- Not mix block markers
- Not contain unknown line prefixes
Original Markdown (64 tokens approx):
## Authentication
The API supports authentication via OAuth2 and API keys.
- Use OAuth2 for user-facing apps.
- Use API keys for server-to-server.
Rate limit: 1000 requests per minute.LLMD v0.2 (c2):
@authentication
API supports authentication via OAuth2 and API keys
-Use OAuth2 user-facing apps
-Use API keys server-to-server
:rate_limit=1000/m.~22 tokens
No repeated paths. No verbose prose. No unnecessary punctuation.
Compared to v0.1:
Removed:
>prefix on every text line (saves 1 token per line)- Trailing periods on text and list lines
- Horizontal rules (no semantic value)
Added:
-prefix distinguishes list items from prose→/←Unicode arrows replace->/<-- Expanded stopword and phrase map for more aggressive c2
Minimal pipeline:
- Extract Markdown structure
- Track current heading → scope
- Emit
@scopewhen heading changes - Convert lists →
- - Convert simple pairs →
:k=v - Apply compression rules by level
- Emit file
No AST required (line-based parser is sufficient).
- Stable scope IDs for chunk-safe slicing
- Inline scope hash markers
- Global term alias table at file top
LLMD v0.2 is:
- Scoped
- Minimal
- Deterministic
- Lossy by design
- Token-optimized
- Easy to implement
- Proven to reduce tokens substantially