60 — Canonical datum identity and hyphae flags
DesignedRendered from 60-canonical-datum-and-hyphae-flags.md in the public repository. Edits belong there.
A datum's hyphae value is a content-derived token for that datum; a hyphae flag binds a tool or a lens to a hyphae value. The values are computed today; no flag is registered and nothing consults the flag registry.
A datum address (layer-value_group-iteration) is positional: inserting or moving a row changes its siblings' iterations. A binding that must survive copying, re-nesting and re-addressing therefore needs a key derived from content, not from the address.
What is built
All in micyte/core/datum_semantics/engine.py and micyte/core/hyphae_flags/__init__.py.
| Function or object | Effect |
|---|---|
build_document_semantics(document) | For every row: a semantic_hash that replaces local addresses with the hashes of the rows they reference (so it does not change when the row is re-addressed), and a hyphae_hash over the row's abstraction chain, folded under the document's anchor_context_hash |
compile_hyphae_value(document, address) | Returns that row's hyphae_hash as a sha256: token: the datum's hyphae value |
build_minimum_complete_path(document, address) | The datum's local-reference closure, dependencies first and the datum last, with no rudi range added |
derive_hyphae_chain (in micyte/core/mss/datum_identity.py) | The rudi chain 0-0-1 … 0-0-K for a datum |
HyphaeFlag, RaisedFlag, HyphaeFlagRegistry, raise_flags | A registry from hyphae value to tool_id and/or lens_id, with scope datum or family_root. DEFAULT_HYPHAE_FLAG_REGISTRY is empty |
The hyphae value includes every preceding rudi datum, even one the datum does not reference directly: a datum that uses 0-0-5 carries 0-0-1 through 0-0-5. The rudis are the ordinal, incremental and nominal frames, and the value is canonical because it is anchored at the first rudi. The binary specification states the same rule (docs/contracts/mss_binary_sequence/).
The algorithm is versioned by HYPHAE_CHAIN_POLICY (mos.hyphae_chain_v1).
How tools and lenses bind today
- Tools bind by
applies_to_archetypeandapplies_to_source_kind, widened along the hyphae chain (40). - Lenses bind by recognized family, overlay kind and value kind. The family comes from
_family_contractinmicyte/domains/datum_recognition/service.py, which matches substrings of the anchor label (title-babelette,fiatwithbabelette,samras,hops, and others). An unrecognized label givesunrecognized_family.
Neither key is a hyphae value. A family is a bucket of many different datums.
Not built
- No flag is registered.
- Nothing calls
raise_flags. DatumLensRegistry.resolveaccepts aflag_lens_idand gives it first priority, but no caller passes one.- Tool eligibility does not read flags.
- No surface registers or lists flags.
The intended binding
- After a document is read, each datum computes its hyphae value and looks it up in the registry. A hit is a raised flag carrying the bound
tool_ids andlens_id. - A family-root flag is raised when the hyphae value of a family's common root datum matches; every member of the family inherits it.
- The lens resolver uses a raised flag's
lens_idfirst, then falls back to family, overlay and value kind. - Tool eligibility adds the tools bound to a raised flag to the archetype-based matches.
The existing archetype and family bindings stay as the fallback, so an unflagged datum behaves as it does now.
Open questions
- Datum or family root. "Family root common datum" needs a precise definition: the shared prefix of the members' paths, or their deepest common ancestor in the dependency graph.
- Form of the fold. The value is a SHA-256 over canonical JSON today. The binary MSS form (61) may replace the representation; the rudi-inclusion rule stays.
- Versioning. A change to the algorithm must produce different values so that old registry entries are detectably stale. Policy strings do this:
HYPHAE_CHAIN_POLICYfor hyphae values,ARCHETYPE_SHAPE_POLICYfor archetype shape signatures. - Where the flag registry is kept. In code, as a MOS document, or in per-instance configuration. The archetype registry is kept as MOS documents (41); the flag registry is an in-code object.
- Precedence. When a per-datum flag and a family-root flag name different lenses, the proposal is that the per-datum flag wins.