Skip to main content

Module motif

Module motif 

Source
Expand description

Detector-motif registry: the canonical 16 detectors plus the registry hash that the contract pins.

The detector layer is part of the deterministic execution contract. Two crucial properties live here:

  1. The order of detector motifs. The detector cell encodes which detectors fired in a single 16-bit mask; bit i always refers to MotifClass::variant_at(i). Reordering would silently flip the meaning of every stored mask.
  2. The registry hash. The contract carries a registry_hash field that pins the detector set; if the constant exposed here changes (new motif added, threshold table altered, name renamed) the contract hash must be recomputed and any stored case files become invalid. That is intentional — a detector-set change is a contract breach by design.

Enums§

DetectorProfile
R.9 — detector-axis expansion profiles. Seven profile IDs are reserved (D16, D64, D128, D205, D512, D1024, D2000). At HEAD D16, D64, and D128 are fully implemented: D16 is the legacy 16-motif profile (R.9.a, audit-mode reference); D64 is the R.9.b/R.10/R.11 throughput path that drove the R.13 ~55× full-pipeline campaign reduction; D128 is the R.9.d.1 scaling-ladder proof (commit 99a0f3b, 16 motifs × 8 variants, wide-digest baseline with R.10b compact-pack deferred). D205 and the wider profiles still reserve their identity + registry- hash slots, deferred to paper §16.
MotifClass
The deterministic catalog of detector motifs. Sixteen entries, all in canonical order. Bit i of a DetectorCell::detector_mask is 1 when MOTIF_CATALOG[i].class fired on that cell.

Constants§

MOTIF_CATALOG
Order-locked array of all 16 motif classes. Used by the registry hash and by iteration sites that need to walk every detector in canonical order.

Functions§

registry_canonical_bytes
Canonical bytes of the detector registry: a comma-separated list of the motif names in catalog order, with no whitespace. This format produces a stable hash that changes if any name is renamed or any motif is reordered, which is exactly what we want for breach detection.
registry_canonical_len
Length of the populated prefix of registry_canonical_bytes().
registry_hash
SHA-256 digest of the canonical detector registry. The contract’s registry_hash field must equal this value verbatim; a mismatch is a DetectorRegistryMismatch verdict.
registry_hash_string
Lowercased hex spelling of registry_hash prefixed with sha256:, suitable for direct substitution into contract.toml.