loci/lib.rs
1#![doc(html_logo_url = "https://raw.githubusercontent.com/KyleWMiller/Loci/main/assets/Loci-logo.png")]
2
3//! <div align="center">
4//! <img src="https://raw.githubusercontent.com/KyleWMiller/Loci/main/assets/Loci-logo.png" width="200" alt="Loci logo" />
5//! </div>
6//!
7//! Cognitive memory for AI agents — persistent, structured, cross-session memory via MCP.
8//!
9//! Loci is an [MCP](https://modelcontextprotocol.io/) server that gives AI agents a memory
10//! system inspired by cognitive science. Memories are stored in four types, each with
11//! different scoping, decay rates, and lifecycle behaviors:
12//!
13//! | Type | Purpose | Default Scope | Decay |
14//! |------|---------|---------------|-------|
15//! | **Episodic** | Events, decisions, session logs | Group | Fast (0.95/cycle) |
16//! | **Semantic** | Facts, knowledge, preferences | Global | Slow (0.99/cycle) |
17//! | **Procedural** | Workflows, patterns, how-to | Global | Slow (0.99/cycle) |
18//! | **Entity** | People, places, projects | Global | Slow (0.99/cycle) |
19//!
20//! # Architecture
21//!
22//! - **Storage**: SQLite with FTS5 for keyword search and
23//! [sqlite-vec](https://github.com/asg017/sqlite-vec) for vector search
24//! - **Embeddings**: Local ONNX Runtime with all-MiniLM-L6-v2 (384 dimensions)
25//! - **Search**: Hybrid vector + BM25 keyword search merged via Reciprocal Rank Fusion
26//! - **Transport**: MCP over stdio (primary) or Streamable HTTP/SSE
27//!
28//! # Modules
29//!
30//! - [`config`] — Configuration loading from TOML files and environment variables
31//! - [`db`] — SQLite database initialization, schema, migrations, and health checks
32//! - [`embedding`] — Text-to-vector embedding pipeline via ONNX Runtime
33//! - [`memory`] — Core memory engine: store, search, forget, relations, and maintenance
34
35pub mod config;
36pub mod db;
37pub mod embedding;
38pub mod memory;
39pub mod tools;