Expand description
The engine-owned preparation registry — the one place that says which preparations exist, on which anchor grains, at which engine touchpoint, and what each grain’s PREPARED FORM is.
A source declares at most one preparation (crate::pipeline::Source::preparation,
a string identifier). The engine refuses any identifier this registry
does not know (crate::binding::CapabilityError::PreparationUnsupported,
raised by crate::binding::validate_binding and mirrored on the
brief-render path for a record that acquired one by hand) and consults the
registry at exactly two touchpoints:
- Touchpoint A — prepared form. Anchor observation asks the registry
for an artifact’s prepared form before hashing it (the engine’s one
per-anchor observation site). The standalone
verify-anchorsoperation and the binding-backed verify share that site, so both inherit every registered preparation without redesign. - Touchpoint B — delivery units. The ingest delivery path asks the
registry for a source’s unit sequence (
unitize): one file can carry many delivery units, addressed<path>#<key>, and the units of a whole source form one deterministic total order derived from the units’ own keys (Touchpoint::DeliveryUnits, first entryDATED_ENTRIES). A source declaring no delivery preparation keeps file-granularity delivery unchanged.
Identity. crate::binding::PREPARATION_IMPL_VERSION is hashed into
every binding’s hash(D) next to the declared identifier. Landing or
changing an implementation bumps the constant, which invalidates every
finding keyed on the old hash by construction (ingest::findings keys on
hash(D) alone).
Prepared forms per grain. The path grains (span / file) hash their
bytes through crate::anchor::prepared_content_hash (the minimal
canonicalization: BOM, line endings, final newline). The url grain uses
the same canonicalization over observation-supplied content — the
engine never fetches, so whoever observed the URL supplies the bytes at
write time (AnchorInput::content) — and defaults to hash_stability: unstable, a served page being a moving target. The entity grain’s
prepared form is computed from the live graph, never from supplied bytes:
the canonical rendered markdown by default, or — under
ENTITY_LOAD_BEARING — the stable serialization of the type’s
load-bearing sections.
Non-goal, by standing decision: PDF / DOCX / audio conversion. An agent with a capable read tool extracts; the raw-byte fallback of the prepared-content hash already drift-detects a binary artifact.
Structs§
- Delivery
Unit - One delivery unit of a file under a delivery preparation.
- Preparation
- One registered preparation.
Enums§
- Path
Prepared - What a path-grain observation yields under a source’s preparation.
- Touchpoint
- The engine touchpoint a registered preparation plugs into.
- Unit
Change - How a unit changed between two states of its file.
Constants§
- CODE_
MAP - Code-map preparation on path-shaped sources (touchpoint A): a scoped
file’s prepared form is its interface digest — imports, exports and
declarations with their signatures; comments, formatting and bodies are
invisible. The digest is heuristic and language-family aware by file
extension: C-like families (JS/TS, Rust, Go, Java, Kotlin, Swift, C#, C,
C++, PHP, Dart, Scala) keep top-level declaration lines and class or
object member signatures, cut at the body’s opening brace; Python keeps
imports,
def/classlines (top level and one level in), decorators and upper-case module constants; a Vue single-file component is its script block under the C-like rule; JSON is its canonical compact form; every other file is taken whole. Atree-grain anchor under this preparation hashes the digest of every scoped file under the tree (path and file hash, path order), which is what closes the tree grain’s recorded-but-unhashed residue for code sources. Values inside declarations (a config object’s members, an array literal’s contents beyond its first line, a scalar property value) are body, not interface: the digest sees names and signatures. A literal object restructured between one line and many reads as a shape change. - DATED_
ENTRIES - Delivery preparation on path-shaped sources: a file is a sequence of
dated entries. A unit begins at every line that opens with an ISO
date or date-time (
2026-08-24,2026-08-24 10:05,2026-08-24T10:05:00Z, after any leading markdown markers such as##,-,>,[); it runs to the next such line. Text before the first entry folds into the first unit; a file with no dated line is one unit keyedWHOLE_FILE_UNIT. The unit key is the stamp normalized toYYYY-MM-DDTHH:MM:SS(missing time parts read00), with.2,.3, … appended to the second, third, … entry carrying the same stamp in one file, in file order — so appending entries never renames an existing unit. The order key is the normalized stamp; across a whole source, units sort by stamp, then path, then key, which is what makes a chronological corpus deliver in its own order regardless of how files were discovered. Undated files (order key empty) come first, in path order. Fractional seconds and zone designators are accepted and ignored for ordering. - ENTITY_
LOAD_ BEARING - Content preparation on the
entitygrain: the prepared form is the stable serialization of the entity type’s load-bearing sections (seeload_bearing_sections), so a dependent’s prepared hash breaks when a load-bearing sentence changes and holds when a comma lands in the notes. - REGISTRY
- The registry — every preparation this engine implements. The refusal in
crate::binding::validate_bindingis exactly “not in this list”. - WHOLE_
FILE_ UNIT - The key of the single unit a file yields when a delivery preparation finds
no unit boundary in it — the whole file, still addressable as
<path>#whole.
Functions§
- applies_
to_ namespace - Whether a registered preparation can apply over a medium whose anchor
namespace is
anchor_namespace(seecrate::binding::medium_capabilities): at least one of the preparation’s grains must be expressible there.entity-load-bearingover acodebasesource would never meet an entity-grain anchor, so it is refused at declaration rather than silently never applying. - code_
map_ digest - The interface digest of one file’s text under
CODE_MAP. - code_
map_ tree_ digest - The code map of a tree: one line per scoped file under it,
<file digest hash> <path>, in path order — hashed by the caller throughprepared_content_hash. A file joining, leaving, or changing its interface changes the tree’s map; an implementation edit does not. - default_
hash_ stability - The medium-declared default hash stability per grain. A
urlanchor defaults tounstable— a served page is a moving target, so a hash break resolvesrecheck, neverdrifted, unless the author assertsstableexplicitly. Every other grain keeps itsstabledefault. - delivery_
preparation - The delivery preparation a source declares, if its declared identifier
is a registered touchpoint-B entry —
Nonefor no declaration, an unregistered identifier, or a prepared-form (touchpoint A) flavour. - diff_
units - The units that differ between two states of one file, keyed by unit key:
a key only in
afterisUnitChange::Added, a key in both whose hash differs isUnitChange::Modified(theafterunit), a key only inbeforeisUnitChange::Deleted(thebeforeunit, so its order key still places it). Unchanged units are not delivered again. - entity_
load_ bearing_ form - The
entity-load-bearingprepared form: the entity’s load-bearing sections serialized stably — each as## <key>, a blank line, the trimmed content, a blank line — in the type’s declared section order. Keyed by section KEY (not heading) so a heading rename in the schema does not read as a content change; a section the entity does not carry is skipped. Title, metadata, and relationships are outside the form: the anchor’s artifact is the entity id, and a rename orphans the anchor on its own. Without a type definition (a type the mem’s schema does not declare) every section the entity carries is load-bearing, in the entity’s own order. - entity_
prepared_ hash - Touchpoint A for the
entitygrain: the prepared-content hash of an entity under the source’s declared preparation.Nonedeclares nothing — the canonical rendered markdown, byte-for-byte today’s form.ENTITY_LOAD_BEARINGhashesentity_load_bearing_form. An identifier the registry does not know yieldsNone: the form cannot be computed, and observation reports the anchor unobserved rather than hashing a fabricated form (validation refuses such a record at every edit path; only a hand-edited file reaches here). - is_
registered - Whether
idnames a registered preparation. - load_
bearing_ sections - The load-bearing sections of a type, in the type’s declared order:
- lookup
- Look a declared identifier up.
- path_
prepared_ hash - The prepared-content hash of one path-grain artifact’s bytes under
preparation— the one rule anchor observation and the write-timecontentpath share, so a hash recorded at write time is the hash a later observation computes. No preparation (or one that does not prepare path grains): the file’s bytes under the minimal canonicalization forfile/span.DATED_ENTRIES: a<path>#<key>span hashes its unit (PathPrepared::UnitAbsentwhen the key is gone), a bare file its bytes.CODE_MAP:file/spanhash the interface digest. Atreeneeds its files enumerated, which is the caller’s job under every preparation (code_map_tree_digest/plain_tree_digest), so it answersNoHashhere. - plain_
tree_ digest - The plain digest of a tree: one line per scoped file under it,
<prepared-content hash> <path>, in path order — hashed by the caller throughprepared_content_hash. Any byte change in any scoped file, and any file joining or leaving the tree, changes the digest — the same whole-content posture afileanchor has, lifted to the directory. This is the no-preparation counterpart ofcode_map_tree_digest; it is what lets a plaintreeanchor adjudicate deterministically instead of resting inrecheckforever. - registered_
identifiers - The registered identifiers, in registry order — the recovery payload of the unknown-identifier refusal.
- registry
- Every registered preparation.
- split_
unit_ id - Split an artifact id into its path and, when it addresses a unit, the
unit key after the first
#. - supplied_
content_ hash - The prepared-content hash of supplied content for a grain — the
write-time observation an agent performs when it hands the engine what it
read (
AnchorInput::content).Nonefor a grain whose prepared form is never computed from supplied bytes:entity(computed from the live graph, so a supplied rendering could disagree with the store) andtree(its prepared form is a digest over the enumerated scoped files — observation-side work no single supplied byte-string can represent). - unit_id
- The addressed form of a unit:
<path>#<key>. - unit_
text - The text of one unit, lines
start_line..=end_lineofcontent. - unitize
- Touchpoint B: the delivery units of one file’s content under a delivery
preparation, in file order.
Nonewhenpreparationis not a registered delivery preparation (the caller keeps file-granularity delivery). - url_
prepared_ hash - The
urlgrain’s canonicalization entry: the prepared form of a URL artifact is the observation-supplied content under the same minimal canonicalization the path grains use, so aurlanchor’s recorded hash means the same thing afileanchor’s does. The engine never fetches; the observer supplies the bytes.