Repository navigation
Kernel Shapes
Uniform physical access abstractions separating structural access patterns from concrete memory store semantics.
In low-level storage architectures, coupling the physical storage layout with domain logic creates brittle systems. For example, treating "Semantic Memory" as a completely unique data structure obscures the fact that at the byte level, it shares identical access patterns with "Working Memory" and "Procedural Memory".
The Spector Memory Kernel resolves this via The Shape Principle:
Memory Shapes define access patterns, not storage semantics. Concrete cognitive subsystems name their domain content only (
SemanticMemory,HebbianGraph,StrengthLayout), while the kernel executes operations through ten canonical Memory Shapes.
graph TD
subgraph "Canonical Memory Shapes"
RM["RecordMemory<br/><i>Contiguous Indexed Slots</i>"]
AM["AppendMemory<br/><i>Sequential Append Stream</i>"]
GM["GraphMemory<br/><i>CSR Adjacency Matrix</i>"]
CM["ChainMemory<br/><i>Chronological Linked Nodes</i>"]
HM["HashTableMemory<br/><i>O(1) Direct Key-Value Map</i>"]
YM["RegistryMemory<br/><i>Bidirectional Symbol Interning</i>"]
EM["EntityDirectoryMemory<br/><i>Entity & Role Identification</i>"]
IM["InsulaMemory<br/><i>Somatic Self-Model Container</i>"]
end
subgraph "Cognitive Subsystem Backing"
T1["Working, Semantic, & Procedural Tiers<br/><i>Fixed-stride engram slots</i>"]
T2["Write-Ahead Log (WAL) & Text Blobs<br/><i>Append-only cursor log</i>"]
T3["Hebbian Graph & HyperEntity Graph<br/><i>Synaptic associative edges</i>"]
T4["Temporal Episode Sequence<br/><i>Chronological narrative links</i>"]
T5["Pairwise Co-Activation Tracker<br/><i>Fast frequency lookups</i>"]
T6["Entity & Relation Type Namespaces<br/><i>Dynamic schema interning</i>"]
T7["Agent Identity & External Entities<br/><i>Entity directories</i>"]
T8["Dynamic Self-Model & Self-State<br/><i>Single-entry JSON self-state</i>"]
end
RM --> T1
AM --> T2
GM --> T3
CM --> T4
HM --> T5
YM --> T6
EM --> T7
IM --> T8
RecordMemory manages contiguous, fixed-stride off-heap byte slots indexed by sequential numerical identifiers.
-
Access Pattern: Random read/write access via direct slot offset calculations:
$\text{Offset} = \text{Base} + (\text{Index} \times \text{Stride})$ . -
Concurrency: Lock-free concurrent reads across Virtual Threads using hardware atomic primitives (
VarHandlecompare-and-swap and volatile loads). -
Backed Subsystems:
-
WorkingMemory(circular buffer) -
SemanticMemory(crystallized concepts) -
ProceduralMemory(learned operational skills) -
StrengthMemory(96-byte recall dynamics and Bjork storage strength)
-
AppendMemory provides an append-only stream of variable- or fixed-length records controlled by an atomic cursor pointer.
- Access Pattern: Unidirectional sequential appends with monotonic sequence counters.
- Concurrency: Single-writer or lock-coordinated sequential writes; concurrent non-blocking sequential reads.
-
Backed Subsystems:
-
WalMemory(Write-Ahead Log event records) -
TextBlobMemory(raw document text payloads) -
TemporalFactMemory(bi-temporal assertion streams)
-
GraphMemory implements a high-performance off-heap graph engine using Compressed Sparse Row (CSR) layouts combined with dynamic adjacency slabs.
- Access Pattern: Traversal of outgoing and incoming edges, weight adjustments, and neighbor queries without creating heap objects.
- Concurrency: Read-mostly graph traversals optimized for SIMD operations, with thread-safe atomic edge weight updates.
-
Backed Subsystems:
-
HebbianMemory(associative synaptic connections between memory engrams) -
HyperGraphMemory($n$ -ary hyperedges linking entities, roles, and contexts)
-
ChainMemory maintains ordered sequences of temporal events linking conversations, episodes, and cognitive checkpoints.
- Access Pattern: Forward and backward traversals along causal chains: "what happened immediately before?" and "what occurred next?".
- Characteristics: Compact pointer offsets linking prior and subsequent engram indices across session boundaries.
-
Backed Subsystems:
-
TemporalChainMemory(episodic narrative sequencing)
-
HashTableMemory is a low-level, collision-resilient hash table residing entirely in off-heap memory.
-
Access Pattern:
$O(1)$ key lookup and increment operations using open addressing with linear probing. - Characteristics: Eliminates Java heap Map overhead (which typically incurs 32–48 bytes per entry in object headers and references).
-
Backed Subsystems:
-
CoActivationMemory(tracks pairwise co-retrieval frequencies between engrams to dynamically reinforce associative bonds)
-
RegistryMemory establishes a two-way mapping between variable-length string symbols and compact integer identifiers.
-
Access Pattern: Fast bidirectional resolution: String
$\rightarrow$ Integer ID and Integer ID$\rightarrow$ String. - Characteristics: Enables open-schema architectures where new entity types, relation names, and tags are registered dynamically without storing repetitive string tokens across the hot off-heap memory path.
-
Backed Subsystems:
-
EntityTypeMemory(interned entity categories: person, organization, location, etc.) -
RelationTypeMemory(interned relationship predicates: causes, depends_on, works_at, etc.)
-
EntityDirectoryMemory coordinates global entity identifiers, alias tracking, and name pool mappings across a namespace.
- Access Pattern: Fast entity lookup, type resolution, and association mapping.
-
Backed Subsystems:
- Inter-agent entity resolution, cross-session participant identification, and structured hypergraph entity registries.
InsulaMemory implements a dedicated single-entry container storing the agent's dynamic, real-time self-model and runtime state.
-
Access Pattern: Single-entry atomic read/write (
put(),get(),clear()) of a variable-length JSON self-model payload. - Design Rationale: A single, versioned JSON document holds the agent's confidence, uncertainty, and affective state — updated in sub-microsecond cycles during active reasoning, without scanning or indexing.
-
Integrity & Concurrency:
- Sub-header tracks a monotonic version counter, payload byte length, epoch timestamp, and a hardware-computed CRC-32C checksum.
- Concurrency is protected by a thread-safe write lock with zero-copy unaligned read semantics across concurrent Virtual Threads.
-
Backed Subsystems:
-
InsulaMemory(active self-model, task confidence, dynamic stress level, and salience posture withinruntime.bundleatRegionId.INSULA).
-
| Memory Shape | Record Length | Indexing | Primary Operations | Off-Heap Layout |
|---|---|---|---|---|
RecordMemory |
Fixed stride | Numeric slot index |
write(long, MemorySegment), read(long, MemorySegment), recordOffset(long)
|
Contiguous cache-aligned array |
AppendMemory |
Variable / Fixed | Sequential byte offset |
append(MemorySegment), read(long, int), replay(long), appendCursor()
|
Cursor-driven append log |
GraphMemory |
Fixed node/edge | Node identifier |
addEdge(int, int, MemorySegment), removeEdge(int), neighbours(int), edgeCount(), nodeCount()
|
Compressed Sparse Row + slab lists |
ChainMemory |
Fixed node | Link identifier |
link(int, int), next(int), prev(int), head(), tail(), chainLength()
|
Bidirectional offset pointers |
HashTableMemory |
Fixed entry | Hash key | Marker interface — concrete operations defined by CoActivationMemory
|
Open-addressing probing buffer |
RegistryMemory |
Variable | String hash & ID |
intern(String), putDirect(String, int), nameOf(int), idOf(String), entries()
|
String pool + ID lookup table |
EntityDirectoryMemory |
Composite | Entity identifier |
directoryRegion(), namesRegion(), entityCapacity(), entityCount(), flush(), close()
|
Directory index + name buffer |
InsulaMemory |
Variable (1 slot) | Singleton self-model |
put(byte[]), get(), clear(), version(), isPresent()
|
32-byte header + CRC-32C JSON payload |
BundleMemory |
Multi-region | Region directory | Container lifecycle (open, map, close) | Multi-region mmap container (ADR-0004) |
DistributedMemoryTensor |
Fixed tensor | Holographic |
accumulate(float[], float), retract(float[], float), evaluateEnergy(float[], float), decay(float)
|
64-byte header + off-heap PRF accumulator (ADR-0020) |
Note
PARTITIONED is retained in the MemoryShape enum for on-disk compatibility (ordinal stability) but has no live code references — the PartitionedRecordMemory abstraction was removed as dead code.
- Home
-
Getting Started
- Quick Start
- Installation
- Developer Guide
- JDK API Status
- MCP Server
- Java SDK
- Java API Reference
- Python SDK
- TypeScript SDK
- Spring AI Integration
- CLI Reference
- REST API
- API Playground
- Error Codes
- Configuration
- Deployment
-
Cognitive Memory
- Overview
- Getting Started
- Use Cases
- API Reference
- Concepts
- Pathways
- Scoring features
- Profiles
- Experimental
- Internals
- Design ancestry
-
Memory Kernel
- Overview
- Bundle Architecture
- Memory Shapes
- Binary Layouts & Tags
- WAL & Durability
-
Region Reference
- Overview & Index
- Partition Regions
-
Runtime Regions
- Working Memory
- Co-Activation Matrix
- Index MIDX
- Index IDPL
- Hebbian Graph
- Temporal Chains
- Temporal Facts
- Entity Directory
- Entity Names Pool
- HyperEntity Graph
- Entity Types Registry
- Relation Types Registry
- BM25 Lexical Index
- Checkpoint
- Insula (Somatic Self-Model)
- Continuity
- Provenance
- SPLADE Sparse Index
- Entity Reverse Index
- Identity Regions
- Synapse & Cortex
-
Architecture
- System Overview
- Core Concepts
- Ingestion Pipeline
- MCP Integration
- Distributed Mode
- Event Notifications
- Namespace Sharding
- Single-Namespace Scale & Capacity Limits
- Scale Benchmark Empirical Results
- Writer Quiesce Pause Empirical Results
- Kill-Owner Failover Empirical Results
- Salience & Importance Architecture
- GPU Acceleration
- Performance Tuning
- Test Framework & LLM Judge
- Chat & Visual Test Infrastructure
- Security & Data
-
Architecture Decision Records (ADRs)
- Overview
- Template
- Master Catalog (0001-0085)
-
Memory Kernel & Storage Formats
- ADR-0001: Graph Compression Strategy for Entity Graph
- ADR-0002: Multi-Partition Recall Fan-Out & Frozen Reten...
- ADR-0003: Completing Hypergraph Entity-Graph Graduation
- ADR-0004: Mmap Bundle Architecture & File Descriptor Sc...
- ADR-0005: spector-memory Technical Debt Hardening
- ADR-0042: Graph Recall Architecture and Cognitive Trave...
- ADR-0043: Single-VMA Bundle Layout Specification
- ADR-0044: Memory Kernel Isolation, Composition, and Layout
- ADR-0045: Spector Memory Import & Export Pipeline
- ADR-0046: Single Engram, Four Stores Storage Architecture
- ADR-0047: Episodic Memory and Engram Model Hierarchy
- ADR-0057: Remediation of Hardcoded Memory Offsets and Alignment Constants
- ADR-0062: Spector Memory Organization — Three-Plane Architecture
- ADR-0082: Index Plane Lifecycle, Derived Views, and Reconciliation
-
Active Inference Self-Model Engine (AISME)
- ADR-0006: Episodic Conversation Architecture
- ADR-0007: ReflectPathway — Biological Sleep Consolidation
- ADR-0008: Cognitive Substrate Evolution (TANGLE, GPM, M...
- ADR-0009: AISME Phase 1 — Homeostatic Affective Core
- ADR-0010: AISME Phase 2 — Free-Energy Guided Recall
- ADR-0011: AISME Phase 3 — Modern Hopfield Associative M...
- ADR-0012: AISME Phase 4 — Neural Manifold Distance (NMD)
- ADR-0013: AISME Phase 5 — Predictive Coding Narrative Self
- ADR-0014: AISME Phase 6 — Consciousness Continuity Metr...
- ADR-0015: AISME Phase 7 — Synaptic Relay Wiring & Pathw...
- ADR-0016: AISME Phase 8 — Closed-Loop Epistemic Learning
- ADR-0017: AISME Phase 9 — Generative Counterfactuals & ...
- ADR-0018: AISME Phase 10 — WanderPathway & Kernel Conti...
- ADR-0019: AISME Phase 11 — Expected Free Energy Policy ...
- ADR-0020: AISME Phase 12 — Continuous Self-Dynamics
- ADR-0023: AISME Complete Loop Closure & CognitiveVector...
- ADR-0024: Polymorphic SoulContext Hierarchy in AISME
- ADR-0027: Soul-Conditioned & Salience-Modulated Persona...
- ADR-0048: Cross-Capture Graph & CoActivation Kernel
- ADR-0049: Identity Trajectory Lyapunov Stability
- ADR-0050: Event Density Gating and Dynamic Epistemic Co...
- ADR-0051: Bayesian Online Change-Point Episode Segmenta...
- ADR-0052: Differential Privacy and Edge Anonymization
- ADR-0053: Multimodal Composite Importance Scoring
- ADR-0054: Lifespan-Adaptive Forgetting & Retention Kernel
- ADR-0055: LSR & RFF Dense Associative Memory Engineerin...
- ADR-0056: Log-Sum-ReLU (LSR) & Random Fourier Features ...
- ADR-0058: Linguistic & Vocal Prosody Expression Engine
- ADR-0063: Spacetime Vector Search and Synaptic Relay Architecture
- ADR-0064: Spacetime Simulation on Wander, Dream, and Express Pathways
- ADR-0071: Remember Cognitive Pathway Architecture
- ADR-0072: Six-Phase Fused Cognitive Scoring Pipeline
- ADR-0073: Recall Cognitive Pathway and Multi-Phase Retrieval Architecture
- ADR-0074: Reflect Cognitive Pathway and Sleep Consolidation Architecture
- ADR-0078: Salience Network and Thalamic Cognitive Profiles Architecture
-
Platform, Synapse & Clustering
- ADR-0021: Nucleus Symmetric Hardware Abstraction Layer ...
- ADR-0022: Embodied Kinesics & Phenomenological MCP Engine
- ADR-0025: Declarative MCP Tool Definitions via JSON Sch...
- ADR-0026: Dual-Plane Concurrency & Async Queue Backpres...
- ADR-0028: Dual-Plane Memory Audit Architecture (Separat...
- ADR-0029: Episodic→Semantic Lineage Provenance Region
- ADR-0030: Unified Engram Encoding Header Architecture
- ADR-0031: Unified Configuration Architecture & Bypass E...
- ADR-0032: Persona Enactment — Soul as Policy over Memory
- ADR-0033: Decoupling Cognitive & Mathematical Kernels t...
- ADR-0034: Cell Topology, Namespace Ownership, and HA Cl...
- ADR-0035: Cognitive Pathway Framework Rearchitecture
- ADR-0036: Pathway Error Handling, Isolation, and Circui...
- ADR-0037: Ingestion Boundary and Sensory Relocation
- ADR-0038: SIMD-Accelerated BM25 Lexical Scoring Optimiz...
- ADR-0039: Robust Unified Rate Limiting Architecture
- ADR-0040: Universal Apache Camel Messaging Channels
- ADR-0041: Unified Connector Architecture for Ingestion
- ADR-0059: Java 27 Upgrade Strategy and Value Class Migration
- ADR-0060: Cognitive Continuity Layer and Decoded Mind Streams
- ADR-0061: In-Memory Multi-Tenant Quartz Scheduler
- ADR-0065: Client SDK Architecture, OpenAPI, and MCP Integration
- ADR-0066: Engine & CLI Stabilization — Issue #727 Hardening
- ADR-0067: Cell-Based High Availability and Namespace-Sticky Sharding
- ADR-0068: Phileas PII Redaction Engine for Spector Synapse
- ADR-0069: Synapse-Owned Tool Access Policy
- ADR-0070: Unified Error Taxonomy and Exception Handling Architecture
- ADR-0075: Extensible LLM and Multimodal Embedding Provider SPI
- ADR-0076: Zero-Dependency Pluggable Cache Abstraction
- ADR-0077: Model B Asynchronous Task Queue and Concurrency
- ADR-0079: Asynchronous Memory Event and Telemetry Notification Bus
- ADR-0080: Observed Memory and Pathway Metrics Telemetry Architecture
- ADR-0081: Dedicated Reactive Ingress and In-Process Path Router
- ADR-0083: Namespace-Isolated Memory Analytics & Telemetry
- ADR-0084: Dual-Plane Conversation Persistence
- ADR-0085: Dynamic Synapse Configuration Overrides and Runtime Propagation
-
Modules Registry
- Overview
- Foundation Layer (/nucleus)
- Cognitive Layer (/memory)
- Gateway Layer (/synapse)
- Benchmarks & UI
- Deep Dives
-
Community
- Governance
- Contributing
- FAQ
- Glossary
- Roadmap
- 🔬 Labs
- Third-Party Legal