aimem-core
Language / 语言 / 言語: English | 简体中文 | 日本語
aimem-core is AiMem's Rust core library.
It provides:
- Turso-backed storage
- project mining and conversation import
- keyword and semantic retrieval
- memory layers / wake-up context generation
- knowledge graph support
- embedding profile guards
- multimodal content primitives
CLI lives in aimem-cli. MCP server lives in aimem-mcp.
0.3.x capabilities
Current aimem-core includes:
- async embedding flow
LocalEmbedder- opt-in
Gemini2Embedder - multimodal
ContentPart - embedding profile metadata:
- provider
- model
- dimension
- profile guards against mixed stores
Drawerhelper APIMemoryStack::file_text(...)- tighter extractor heuristics with multilingual regression tests
Install
[]
= { = "1", = ["full"] }
Recommended API surface
Prefer either:
use *;
or explicit root imports like:
use ;
Core concepts
- Store — one AiMem DB
- Wing — project or domain
- Room — topic inside a wing
- Drawer — one stored chunk
- ContentPart — multimodal part inside a drawer
- L0/L1/L2/L3 — identity, essential story, recall, deep search
Embedding modes
Local
LocalEmbedder- default recommendation
- embedding stays local
Remote
Gemini2Embedder- explicit opt-in
- only explicit text / data URI / raw bytes are sent
URI-only multimedia parts are not automatically read from disk and uploaded.
Store compatibility guard
aimem-core records embedding profile metadata and validates semantic writes and queries against:
- provider
- model
- dimension
This prevents silent mixing of incompatible embedding stores.
Drawer helpers
use *;
let drawer = new
.with_source_file
.with_chunk_index;
For multimodal drawers:
use *;
let drawer = multimodal;
Semantic search example
use Arc;
use *;
async
Filing text directly
use Arc;
use *;
#
# async
Notes
AimemDb::open()bootstraps schema automatically.Miner::new(db, None)andConvoMiner::new(db, None)work fine for text-only filing.- drawers without embeddings still appear in keyword search.
AimemDb::embedding_profile()reports the current store profile.