Memory Primitive

CoreTex uses a compact on-chain-rooted typed memory index.

It is not a vector database on chain. It is not the full memory corpus on chain. It is a small, deterministic memory operating layer whose state root is on chain and whose data availability comes from events and snapshots.

CoreTexState Layout

Range Words Count Purpose
Header 0-31 32 Protocol metadata, previous root, corpus root, score counters
MemoryIndex 32-383 352 44 memory-object slots, 8 words each
RetrievalKeys 384-671 288 36 retrieval-key slots, 8 words each
Relations 672-799 128 Relation and routing-weight entries
Temporal 800-895 96 Validity windows and revocation metadata
Codebook 896-991 96 Operator and token codebook entries
Reserved 992-1023 32 Future compatibility, must be zero

Every state is Merkleized as 1024 leaves. A small patch changes 1-4 words. CoreTex updates the Merkle root incrementally by recomputing only the affected leaf paths.

Why This Primitive

Long-term agent memory needs more than a large context window. It needs:

  • A way to decide what to keep
  • A way to retrieve near-matching but distinct memories
  • A way to mark stale or revoked memories
  • A way to preserve important information under compression pressure
  • A way to route future queries to useful memory regions
  • A way to audit whether changes actually helped

CoreTex encodes exactly those controls in a small, reproducible state. The corpus can be large and off-chain, while the memory policy remains compact, inspectable, and replayable.