Architecture Overview
Understand Cerememory's layered architecture and crate structure.
System Overview
Cerememory is organized as a layered system where each layer has a single responsibility. Requests flow from external clients through transport bindings, into the engine, and down to the individual memory stores.
┌─────────────────────────────────────────────────────────────┐
│ LLM Applications │
│ (Claude, GPT, Gemini, custom agents) │
└──────────────┬──────────────┬──────────────┬────────────────┘
│ │ │
┌───────▼───┐ ┌─────▼─────┐ ┌────▼────┐
│ HTTP/REST │ │ gRPC │ │ MCP │
│ (axum) │ │ (tonic) │ │ (rmcp) │
└───────┬───┘ └─────┬─────┘ └────┬────┘
│ │ │
└──────────────┼──────────────┘
│
┌─────────▼─────────┐
│ CerememoryEngine │
│ (coordinator) │
└─────────┬─────────┘
│
┌───────────────────┼───────────────────┐
│ │ │
┌──────▼──────┐ ┌───────▼───────┐ ┌───────▼───────┐
│ Decay Engine │ │ Association │ │ Evolution │
│ (power-law) │ │ (spreading │ │ (adaptive) │
│ │ │ activation) │ │ │
└──────────────┘ └───────────────┘ └───────────────┘
│ │ │
┌──────▼───────────────────▼───────────────────▼──────┐
│ Five Stores │
│ ┌──────────┐ ┌──────────┐ ┌───────────┐ │
│ │ Episodic │ │ Semantic │ │ Procedural│ │
│ │ (redb) │ │ (redb) │ │ (redb) │ │
│ └──────────┘ └──────────┘ └───────────┘ │
│ ┌───────────┐ ┌─────────┐ │
│ │ Emotional │ │ Working │ │
│ │ (redb) │ │ (memory)│ │
│ └───────────┘ └─────────┘ │
└─────────────────────────────────────────────────────┘
│
┌──────▼─────────────────────────────────────────────┐
│ Raw Journal │
│ ┌────────────────────────────────────────────┐ │
│ │ Raw Store (redb + Tantivy full-text) │ │
│ │ Verbatim conversation preservation │ │
│ └────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────┘Crate Structure
Layer Responsibilities
Transport Layer
Three transport bindings expose CMP externally:
- HTTP/REST (axum) -- primary network transport. Binds to
127.0.0.1:8420by default and includes Bearer auth, request IDs, trusted-proxy-aware rate limiting, optional CORS, and opt-in Prometheus metrics. - gRPC (tonic) -- optional network transport. Supports export/import streaming and requires TLS when auth is enabled or the deployment is exposed beyond loopback.
- MCP (rmcp) -- stdio transport for Claude Code and MCP-compatible clients. Exposes 15 LLM-friendly tools including
store,store_raw,batch_store,batch_store_raw,update,recall,recall_raw,timeline,associate,inspect,forget,dream_tick,consolidate,stats, andexport.
Engine Layer
The CerememoryEngine is the central coordinator. It implements encode, recall, lifecycle, and introspect operations and orchestrates cross-store interactions. It manages:
- The hippocampal coordinator for cross-store recall and spreading activation
- The Tantivy text index and the redb-backed exact cosine vector index
- The background decay engine
- An optional LLM provider for embeddings, summarization, image/audio handling, and relation extraction
Store Layer
Five specialized curated stores implement the common Store trait:
- Episodic
- Semantic
- Procedural
- Emotional
- Working
All persistent stores are backed by redb. Working memory is intentionally in-memory only.
A sixth store, the Raw Journal, operates alongside the curated stores. It preserves verbatim conversation content using redb with a dedicated Tantivy full-text search index, enabling forensic recall and dream-tick summarization.
Supporting Engines
- Decay Engine -- rayon-parallel power-law decay computation
- Association Engine -- spreading activation over the persisted association graph
- Evolution Engine -- adaptive tuning surfaced via
introspect.evolution
Dependency Direction
cerememory-cli
├── cerememory-config
├── cerememory-engine
├── cerememory-transport-*
├── cerememory-archive
└── adapter-*
cerememory-coreNext Steps
Deep dive into each brain-inspired memory store
Understand decay, noise, emotion, and consolidation