Skip to main content

Crate loci

Crate loci 

Source
Expand description
Loci logo

Cognitive memory for AI agents — persistent, structured, cross-session memory via MCP.

Loci is an MCP server that gives AI agents a memory system inspired by cognitive science. Memories are stored in four types, each with different scoping, decay rates, and lifecycle behaviors:

TypePurposeDefault ScopeDecay
EpisodicEvents, decisions, session logsGroupFast (0.95/cycle)
SemanticFacts, knowledge, preferencesGlobalSlow (0.99/cycle)
ProceduralWorkflows, patterns, how-toGlobalSlow (0.99/cycle)
EntityPeople, places, projectsGlobalSlow (0.99/cycle)

§Architecture

  • Storage: SQLite with FTS5 for keyword search and sqlite-vec for vector search
  • Embeddings: Local ONNX Runtime with all-MiniLM-L6-v2 (384 dimensions)
  • Search: Hybrid vector + BM25 keyword search merged via Reciprocal Rank Fusion
  • Transport: MCP over stdio (primary) or Streamable HTTP/SSE

§Modules

  • config — Configuration loading from TOML files and environment variables
  • db — SQLite database initialization, schema, migrations, and health checks
  • embedding — Text-to-vector embedding pipeline via ONNX Runtime
  • memory — Core memory engine: store, search, forget, relations, and maintenance

Modules§

config
Configuration loading and management.
db
Database initialization and health checking.
embedding
Text-to-vector embedding pipeline.
memory
Core memory engine — storage, search, relations, and maintenance.
tools
MCP tool handlers — bridges JSON-RPC tool calls to the memory engine.