| Crates.io | memory-wiki |
| lib.rs | memory-wiki |
| version | 0.2.0 |
| created_at | 2025-11-27 18:38:36.123465+00 |
| updated_at | 2025-11-27 18:38:36.123465+00 |
| description | A local-first, semantic knowledge base and MCP server for LLMs. |
| homepage | |
| repository | https://github.com/Algiras/memory-wiki |
| max_upload_size | |
| id | 1954230 |
| size | 843,791 |
A semantic knowledge base with graph relations, powered by local embeddings. Built with Rust for high performance and low memory usage.
temporal - How knowledge evolved over timerelational - Graph-based multi-hop connectionshierarchical - Abstract concepts to specific detailsentity - Focus on mentioned entitiescontextual - Group by themes/collectionssummary - CAG-powered hierarchical summarieshyde - Hypothetical Document Embeddingsreason - Chain-of-Thought retrievalreflect - Self-reflection & memory consolidationcargo install memory-wiki
git clone https://github.com/Algiras/memory-wiki
cd memory-wiki/memory-wiki
cargo build --release
cargo build --release --features llm
Copy .env.example to .env and customize:
# Key settings
MEMORY_WIKI_DATA_DIR=data
MEMORY_WIKI_MODEL=bge-small-en-v1.5
MEMORY_WIKI_INDEX_DIRS=/path/to/notes,/path/to/docs
MEMORY_WIKI_ENABLE_RERANKER=true
See .env.example for all options.
| Variable | Description | Default |
|---|---|---|
MEMORY_WIKI_DATA_DIR |
Directory for storing data | data |
MEMORY_WIKI_PORT |
Port for the web interface | 3001 |
MEMORY_WIKI_MODEL |
Embedding model to use | bge-small-en-v1.5 |
RUST_LOG |
Set logging level | info |
| Variable | Description | Default |
|---|---|---|
MEMORY_WIKI_INDEX_DIRS |
Comma-separated directories to index on startup | - |
MEMORY_WIKI_INDEX_PATTERNS |
File patterns to index | *.md,*.txt,*.rs |
MEMORY_WIKI_CHUNK_SIZE |
Size of text chunks for embedding | 1000 |
MEMORY_WIKI_CHUNK_OVERLAP |
Overlap between chunks | 200 |
MEMORY_WIKI_MAX_FILE_SIZE |
Max file size to process in bytes | 10MB |
| Variable | Description | Default |
|---|---|---|
OPENROUTER_API_KEY |
OpenRouter API key (recommended) | - |
OPENROUTER_MODEL |
OpenRouter model | anthropic/claude-3.5-haiku |
OPENAI_API_KEY |
OpenAI API key | - |
OPENAI_BASE_URL |
Custom OpenAI-compatible endpoint | - |
OPENAI_MODEL |
OpenAI model | gpt-4o-mini |
ANTHROPIC_API_KEY |
Anthropic API key | - |
OLLAMA_HOST |
Ollama server URL | http://localhost:11434 |
OLLAMA_MODEL |
Ollama model | (auto-detected) |
| Variable | Description | Default |
|---|---|---|
MEMORY_WIKI_ENABLE_RERANKER |
Enable BGE reranking for better search | true |
MEMORY_WIKI_ENABLE_SCHEDULER |
Enable background file watching | true |
MEMORY_WIKI_SIMILARITY_THRESHOLD |
Threshold for duplicate/similarity detection | 0.85 |
MEMORY_WIKI_COLLECTION_DEFAULT |
Default collection name | general |
MEMORY_WIKI_DISABLE_GIT_METADATA |
Disable git metadata detection | false |
MEMORY_WIKI_SAMPLING_MODEL |
Model hint for MCP sampling (e.g., claude-3-5-sonnet) |
- |
| Variable | Description | Default |
|---|---|---|
MEMORY_WIKI_ROOTS_ENABLED |
Enable per-workspace root isolation | true |
MEMORY_WIKI_MAX_ROOT_SIZE_MB |
Max storage size per root in MB | 100 |
./target/release/memory-wiki
Add to your MCP client config:
{
"mcpServers": {
"memory-wiki": {
"command": "/path/to/memory-wiki",
"args": []
}
}
}
./target/release/memory-wiki --web --port 3001
Then open http://localhost:3001
Memory Wiki exposes a set of Simplified Tools designed for easy interaction with LLMs. For detailed documentation, see docs/api.md.
| Tool | Description |
|---|---|
memory |
Manage entries (store, get, update, delete, list) |
search |
Search knowledge (semantic, hybrid, time-based) |
graph |
Manage relations (link, path, related, hubs) |
ask |
Smart interactive assistant (remember, find, summarize, connect, review) |
stores |
Multi-root storage management (list, switch, global, info) |
perspective |
Multi-perspective exploration (temporal, relational, hierarchical, etc.) |
| Tool | Description |
|---|---|
files |
Ingest and watch files/directories |
analyze |
Extract entities, find duplicates, auto-tag, merge |
collections |
Manage collections (list, create, delete) |
stats |
Get knowledge base statistics |
export |
Export data to JSON |
| Endpoint | Description |
|---|---|
GET /api/entries |
List all entries |
POST /api/entries |
Create new entry |
GET /api/search?query=... |
Semantic search |
GET /api/graph |
Get knowledge graph |
GET /api/perspective/:mode |
Perspective exploration |
POST /api/index/start |
Start background indexing |
GET /api/index/status |
Get indexing progress |
Explore your knowledge base from different angles using the perspective tool:
{
"tool": "perspective",
"arguments": {
"mode": "relational",
"query": "machine learning",
"depth": 2
}
}
Available modes:
Index directories with optional LLM-powered analysis:
curl -X POST http://localhost:3001/api/index/start \
-H "Content-Type: application/json" \
-d '{
"directory": "/path/to/docs",
"patterns": ["*.md", "*.rs"],
"enable_llm": true,
"build_graph": true
}'
LLM analysis extracts:
When storing entries from files in git repositories, Memory Wiki automatically captures:
Disable with MEMORY_WIKI_DISABLE_GIT_METADATA=true.
Memory Wiki can isolate storage per workspace root:
stores tool to list, switch, or enable global searchWhen enabled, search results are reranked using BGE cross-encoder:
"reranked": true indicatorMEMORY_WIKI_ENABLE_RERANKER=trueFull documentation is available in the docs/ directory:
| Model | Params | Dimensions | Best For |
|---|---|---|---|
| bge-small-en-v1.5 | 33M | 384 | Fast, good quality |
| bge-base-en-v1.5 | 109M | 768 | Balanced |
| bge-large-en-v1.5 | 335M | 1024 | Best quality |
| all-minilm-l6-v2 | 22M | 384 | Very fast |
| multilingual-e5-small | 118M | 384 | Multi-language |
| multilingual-e5-base | 278M | 768 | Multi-language, larger |
| nomic-embed-text-v1 | 137M | 768 | Long context |
| paraphrase-albert | 11M | 768 | Smallest |
src/
├── main.rs # Entry point
├── config.rs # Environment configuration
├── handler_simplified.rs # MCP request handler
├── tools/ # Tool definitions
│ ├── mod.rs # Tool registry
│ └── simplified.rs # Simplified tool schemas
├── handlers/ # Tool handlers
│ ├── memory.rs # Entry management
│ ├── search.rs # Search operations
│ ├── graph.rs # Graph operations
│ ├── perspective.rs # Multi-perspective exploration
│ └── ...
├── embeddings.rs # Embedding model wrapper
├── storage_embedded.rs # Entry storage
├── graph.rs # Graph storage
├── multi_store.rs # Multi-root storage manager
├── git_metadata.rs # Git metadata extraction
├── scheduler.rs # File scheduler
├── reranker.rs # Cross-encoder reranking
├── ingestion.rs # Document ingestion engine
├── consolidation.rs # Duplicate detection
├── time_parser.rs # Natural language time parsing
├── hybrid_search.rs # BM25 + vector search
├── entity.rs # Entity extraction
├── cag.rs # Context-Augmented Generation
├── advanced_retrieval.rs # HyDE, CoT, Self-Reflection
├── background_indexer.rs # Async directory indexing
├── llm_indexer.rs # LLM-powered analysis
├── web.rs # Web UI server
└── models.rs # Data structures
All data is stored in the data/ directory:
data/
├── entries.json # Knowledge entries with embeddings
├── graph.json # Relations between entries
├── scheduler.json # File tracking state
├── collections/ # Collection metadata
└── roots/ # Per-workspace root stores (when multi-root enabled)
└── <hash>/
├── entries.json
└── graph.json
MIT