中文版 | English
Local-first AI memory with project isolation — for terminal, for private use
Local memory persistence system for AI CLI tools, providing cross-session memory recovery, knowledge accumulation, and conversation archival.
- Project Isolation — Auto-detect git root, .mr_pid persistence, independent memory per project
- Semantic Search — Local ONNX model (384-dim), zero API cost, all data stays local
- Cross-Project Search —
--allflag to discover related knowledge across projects - AI-first Design — JSON output by default, concise commands, Skill integration
- High Performance — Rust, <1ms latency, ~118MB memory (including model)
- Auto-splitting — Long content (>7.5KB) automatically split into chunks
- Systemd Integration — Manage daemon with
systemctl --user
cargo build --release
cargo install --path memrec --locked
cargo install --path memrecd --locked
cp ~/.cargo/bin/memrec ~/.local/bin/
cp ~/.cargo/bin/memrecd ~/.local/bin/mkdir -p ~/.memrec/models/Qdrant--all-MiniLM-L6-v2-onnx
cd ~/.memrec/models/Qdrant--all-MiniLM-L6-v2-onnx
wget https://huggingface.co/Qdrant/all-MiniLM-L6-v2-onnx/resolve/main/model.onnx
wget https://huggingface.co/Qdrant/all-MiniLM-L6-v2-onnx/resolve/main/tokenizer.json
wget https://huggingface.co/Qdrant/all-MiniLM-L6-v2-onnx/resolve/main/config.json
wget https://huggingface.co/Qdrant/all-MiniLM-L6-v2-onnx/resolve/main/special_tokens_map.json
wget https://huggingface.co/Qdrant/all-MiniLM-L6-v2-onnx/resolve/main/tokenizer_config.json# Foreground (debugging)
memrecd
# Or systemd service (recommended)
systemctl --user enable memrecd
systemctl --user start memrecd# Add memories
memrec add "Choose JWT auth" --mtype decision --tag critical
memrec add "RAII: resource acquisition is initialization" --mtype knowledge --tag best-practice --tag rust
memrec add "User prefers verbose output" --mtype preference --tag output --global
# Semantic search
memrec search "auth" # Current project + global
memrec search "performance" --project-only # Current project only
memrec search "preferences" --global-only # Global memories only
memrec search "xlsb" --all # Across all projects
# Other commands
memrec list --limit 20
memrec get <id>
memrec stats
memrec versionMemRec automatically creates independent memory spaces for different projects:
project-a/ project-b/
├── .mr_pid ├── .mr_pid ← Auto-created, different IDs
├── .gitignore ├── .gitignore ← Add .mr_pid to .gitignore
└── src/ └── src/
- Git repos: Auto-detect git root
- Non-git dirs: Use current working directory
- Global memories:
--globalflag, accessible from all projects - Cross-project search:
--allsearches across all projects
| Type | Flag | Purpose |
|---|---|---|
| Decision | decision |
Key technical/business decisions |
| Knowledge | knowledge |
Knowledge (subdivide via tags: fact/best-practice/algorithm/tool) |
| Context | context |
Project config, environment info |
| Preference | preference |
User preferences (recommend --global) |
| Conversation | conversation |
Conversation records (default) |
~/.memrec/
├── memrecd.sock # Unix Socket
├── data/ # RocksDB memory metadata
├── vectors/ # RocksDB vector storage
└── models/ # ONNX Embedding model
| Variable | Purpose | Default |
|---|---|---|
MEMREC_MODEL_DIR |
Custom model path | ~/.memrec/models/Qdrant--all-MiniLM-L6-v2-onnx/ |
MEMREC_MIN_SCORE |
Min similarity score | 0.75 |
RUST_LOG |
Log level | info |
memrec/
├── common/ # Shared types and protocol
├── memrecd/ # Daemon service
├── memrec/ # CLI tool
└── docs/ # Documentation
Apache-2.0
See CHANGELOG.md