# Compile curated Markdown

Source: https://usecns.dev/engram-topic-compile-curated-markdown/

[Start here](https://usecns.dev/manual-engram/)
[CLI commands](https://usecns.dev/commands-engram/)
[Configuration & integration](https://usecns.dev/engram-topics/)

Review a fact stream before importing a documentation corpus. Markdown is split at level-two headings; for example, save this synthetic section as `fixture.md`:

```
## Fixture retry [key: fixture-retry] [kind: procedure] [authority: curated_knowledge] [globs: fixtures/**]
> summary: Inspect pending synthetic work before retrying the fixture.

Use the fixture's pending-work report before starting another capture.
```

Compile without importing:

```
engram seed compile fixture.md --ring M2 --output seed.jsonl
```

Review the stream and sharing permissions before adding `--import`, which applies it locally. `> summary:` permits up to 160 estimated tokens; `> complete:` permits up to 45 and emits a structural endorsement on seed import, not attested graduation. The estimator takes the larger of rounded-up Unicode characters/4 and the sum per whitespace word of `1 + floor(UTF-8 bytes/6)`. Omit a summary rather than knowingly exceed its limit.

Use the exact kinds, authorities and rings listed in the catalog. Generators must supply explicit section authority for conformance; `canon_mandate` is valid only in M0. Do not copy obsolete aliases such as `owner_directive` into authored content.

For an existing corpus, a strict `engram.frontmatter_map.v1` TOML file maps selected YAML fields to keys, kind, authority and globs. Heading tags override mapping, which overrides CLI defaults. Mapping unknown values or missing fields fails; mapped `skip` excludes a page. Front matter is removed before body hashing. Multi-section mapped keys acquire title slugs; collisions fail. Mechanical mapping does not establish permission to publish source-derived knowledge.

Minimal mapping shape (all mapping rules are optional, but `schema` is required):

```
schema = "engram.frontmatter_map.v1"
[key]
field = "id"
strip_prefix = "fixture:"
[kind]
field = "type"
[kind.values]
lesson = "procedure"
draft = "skip"
[authority]
field = "maturity"
[authority.values]
reviewed = "curated_knowledge"
[globs]
field = "paths"
```

This expects YAML front matter such as `id: fixture:retry`, `type: lesson`, `maturity: reviewed`, `paths: fixtures/**`. Selected key/kind/authority fields must be scalars; globs accept a list or comma-separated scalar. Unselected unsupported YAML is not a general YAML parser promise; selected nested/block syntax fails. A declared prefix must actually be present.

For a specialist bundle, `engram synthesize` compiles selected Markdown fodder and harvests local query results into provisional OTE/playbook/seed material. It carries evidence for re-verification and preserves the base attestation configuration. Its mean threshold is a selection filter, not a graduation verdict; review output and permissions before optional import.