Skip to main content

Crate aimem_core

Crate aimem_core 

Source
Expand description

§aimem-core

Give your AI a memory — reusable core library.

aimem-core is a pure-Rust library that stores, retrieves, and searches text memories using Turso (an in-process SQLite engine with native vector support) as the sole storage backend.

§Feature overview

FeatureImplementation
Vector storageTurso vector32() BLOB column
Semantic searchvector_distance_cos() — SimSIMD-accelerated cosine
Full-text searchSQL LIKE scan (Turso FTS index optional)
Embedding generationGemini 2.0 (Remote) or fastembed (Local)
Knowledge graphTemporal entity-relationship triples in SQLite
Graph traversalBFS over wing/room adjacency — no graph DB needed

§Architecture: 4-Layer Memory Stack

┌─────────────────────────────────────────────────────────┐
│  L0  Identity text           ~100 tokens   always loaded │
│  L1  Essential story         ~500-800 tok  always loaded │
│  L2  On-demand recall        ~200-500 tok  loaded on ask │
│  L3  Deep semantic search    unlimited     full memory   │
└─────────────────────────────────────────────────────────┘

Re-exports§

pub use config::Config;
pub use convo::ConvoMineStats;
pub use convo::ConvoMiner;
pub use db::AimemDb;
pub use db::EmbeddingStoreProfile;
pub use embedder::Embedder;
pub use embedder::Gemini2Embedder;
pub use embedder::LocalEmbedder;
pub use graph::AimemGraph;
pub use graph::TraversalNode;
pub use knowledge::KnowledgeGraph;
pub use layers::MemoryStack;
pub use miner::Miner;
pub use search::Searcher;
pub use types::ContentPart;
pub use types::Drawer;
pub use types::DrawerMeta;
pub use types::Entity;
pub use types::RoomNode;
pub use types::SearchResult;
pub use types::Triple;
pub use types::Tunnel;

Modules§

config
Configuration — mirrors Python’s config.py
convo
Conversation miner — mine chat exports into AiMem.
db
AimemDb — Turso connection wrapper + schema bootstrap.
embedder
Embedder — text-to-vector abstraction and implementations.
extractor
Memory extractor — heuristic keyword extraction, no LLM required.
graph
AiMem graph — traverse rooms and wings in the memory store.
knowledge
Knowledge graph — temporal entity-relationship graph.
layers
4-layer memory stack — mirrors Python’s layers.py.
miner
File miner — scan a project directory and file chunks into AiMem.
prelude
Curated high-level imports for typical AiMem integrations.
search
Semantic search and FTS over the AiMem store.
types
Shared data types.