Overview

The Allternit Memory Kernel is the experimental three-layer memory model that sits on top of the Memory Fabric. It organizes raw session traces into a queryable knowledge graph and periodically distills that graph into compact, reusable summaries. The kernel is intentionally separate from the low-level fabric: the fabric stores and routes opaque key/value entries, while the kernel gives them semantic shape — people, projects, concepts, code, documents, and the facts that connect them. The canonical implementation is the allternit-memory-kernel Rust crate in services/memory/data/memory-kernel.

Three layers

Event layer

Events are append-only. Once written they are never mutated; corrections are modeled as new events or as entity-layer fact supersession.
Every event carries: The kernel can query events by type, by session, or by recency:

Entity layer

Entities turn raw events into structured knowledge. Each entity has a type, a collection of timestamped facts, and bidirectional relationships to other entities.

Entity types

Creating entities and adding facts

Facts are versioned

Facts can be superseded instead of deleted. The old fact keeps its history while the new fact becomes active.
After supersession, the old fact has status = Superseded and superseded_by points to the new fact. Queries that operate on active facts can filter by FactStatus::Active.

Relationships

Relationships are first-class and stored on both participating entities.
Typical relationship queries:

Summary layer

Summaries are regenerated from active facts. A summary captures the most salient information about an entity in a short text block plus metadata counts.
Summaries are cached in the kernel and attached to the entity, so subsequent reads are cheap:
In production, the summary layer is expected to run on a schedule (for example, weekly) and to be driven by the MemoryEvolutionEngine, which can merge, prune, and rewrite summaries based on importance and recency.

Memory evolution engine

The kernel receives an allternit_evolution_layer::MemoryEvolutionEngine at construction. The engine is responsible for higher-order memory maintenance: consolidation, decay, conflict resolution, and summarization policy. The kernel keeps the structured records; the engine decides how they evolve over time.

Determinism and verification

The kernel can compute a SHA-256 hash over its event IDs and entity IDs. This is useful for tests, reproducibility checks, and context-pack validation.
Statistics are also available for health checks:

Error handling

Operations return MemoryError:

Status and relationship to other memory systems

The Memory Kernel is experimental and not yet wired into the main workspace build. It complements, rather than replaces, the production memory stack:
  • Memory Fabric provides the low-level provider trait, ledger, and routing for all memory operations.
  • Memory Agent (services/memory/agent) is the TypeScript long-term memory service with vector search and LLM-driven consolidation.
  • Memory Kernel (services/memory/data/memory-kernel) is the structured, three-layer semantic model that future surfaces can use when they need typed entities and versioned facts.