This repository contains a complete, deterministic, testable specification and reference implementation for a Deterministic Memory Krystal:
- Deterministic time coordinates derived from KKS-1.0 (Kairos lattice/closure math).
- Content-addressed artifacts (hash-addressed objects).
- Append-only registries (portable, offline “memory crystals”).
- Verifiers + test vectors so independent implementations can prove they agree.
A system is a primitive when anyone can independently verify its invariants from the bytes alone.
Krystal is built around four invariants:
- KKS determinism:
pulse -> (dayIndex, beat, stepIndex, pulseInStep)is pure integer math. - Closure: day mapping is exact using
N_DAY_MU = 17,491,270,421 ÎĽpulses/day. - Canonical bytes: objects have one canonical byte representation for hashing.
- Append-only registry: history is extended by appending entries; never by rewriting.
spec/— normative specification (MUST/SHOULD language)schemas/— JSON Schemas for core formatsreference/python/— reference implementation + CLI + teststest-vectors/— conformance vectors (KKS + URL encodings)examples/— sample registries:sigil-registry.json(as received)sigil-registry-normalized.json(capsules corrected to match KKS-1.0)
cd reference/python
python -m venv .venv
source .venv/bin/activate
pip install -e .
pip install -r requirements-dev.txt
krystal --helpCompute beat/step for a pulse:
krystal kks 9777777Verify a registry file:
krystal verify-registry ../../examples/sigil-registry-normalized.jsonIf you have older capsule records that drifted, normalize them (deterministically) and verify again:
krystal normalize-registry ../../examples/sigil-registry.json /tmp/normalized.json
krystal verify-registry /tmp/normalized.jsonRun conformance tests:
pytest -qThis repo defines and supports:
- KRC-0: the minimal registry format used in the wild:
{ "urls": [...] } - KRL-1.0: Krystal Resource Locators (stream URLs and content URLs)
- KKS-1.0: deterministic lattice mapping and closure
A future KRC-1 structured registry (typed entries + checkpoints) is described in spec/ but is not required for conformance.
- Spec: complete
- Reference implementation: complete
- Test vectors: included