Documentation
Everything you need to install, configure, and use shodh-memory. From one-command setup to full API reference.
Quick Start
Get shodh-memory running with a single command.
Claude Code (recommended)
One command. No server to run. MCP handles everything.
claude mcp add shodh-memory -- npx -y @shodh/memory-mcpCursor
Add to your MCP configuration file at ~/.cursor/mcp.json:
{
"mcpServers": {
"shodh-memory": {
"command": "npx",
"args": ["-y", "@shodh/memory-mcp"]
}
}
}Python
pip install shodh-memoryModels and ONNX runtime bundled. Works on Windows, macOS, and Linux.
Installation
All platforms and package managers.
npm (MCP Server)
npx -y @shodh/memory-mcp
# Or install globally
npm install -g @shodh/memory-mcpPython (PyPI)
pip install shodh-memoryRust (crates.io)
[dependencies]
shodh-memory = "0.1"Models auto-download on first use to ~/.cache/shodh-memory/ (~37MB).
Docker
docker run -d -p 3030:3030 \
-e SHODH_HOST=0.0.0.0 \
-v shodh-data:/data \
roshera/shodh-memoryBinary (Linux / macOS)
# Linux x64
curl -L https://github.com/varun29ankuS/shodh-memory/releases/latest/download/shodh-memory-x86_64-linux -o shodh-memory
chmod +x shodh-memory
./shodh-memory
# macOS ARM64 (Apple Silicon)
curl -L https://github.com/varun29ankuS/shodh-memory/releases/latest/download/shodh-memory-aarch64-darwin -o shodh-memory
chmod +x shodh-memory
./shodh-memoryPlatform Support
| Platform | Architecture | Status |
|---|---|---|
| Linux | x86_64 | Supported |
| Linux | ARM64 | Supported |
| macOS | x86_64 (Intel) | Supported |
| macOS | ARM64 (Apple Silicon) | Supported |
| Windows | x86_64 | Supported |
MCP Setup
Step-by-step setup for Claude Code, Claude Desktop, and Cursor.
Claude Code (CLI)
Single command — no config files needed.
claude mcp add shodh-memory -- npx -y @shodh/memory-mcpThis registers shodh-memory as an MCP server. All 45 tools become available in your Claude Code sessions immediately.
Claude Desktop
Add to your Claude Desktop config file:
| OS | Config Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
{
"mcpServers": {
"shodh-memory": {
"command": "npx",
"args": ["-y", "@shodh/memory-mcp"],
"env": {
"SHODH_API_KEY": "your-api-key"
}
}
}
}Cursor
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"shodh-memory": {
"command": "npx",
"args": ["-y", "@shodh/memory-mcp"],
"env": {
"SHODH_API_KEY": "your-api-key"
}
}
}
}Verify Connection
If running the standalone server, check it's healthy:
curl http://localhost:3030/health
# {"status":"ok"}Configuration
Environment variables for the standalone server.
Authentication
# Production: multiple API keys (comma-separated)
SHODH_API_KEYS=sk-key-1,sk-key-2
# Development: single key (fallback if SHODH_API_KEYS not set)
SHODH_DEV_API_KEY=sk-shodh-dev-change-me
# Client-side: must match one of the server's accepted keys
SHODH_API_KEY=sk-shodh-dev-change-meServer
# Bind address (default: 127.0.0.1)
# Use 0.0.0.0 only behind authenticated reverse proxy
SHODH_HOST=127.0.0.1
# Port (default: 3030)
SHODH_PORT=3030
# Storage directory
SHODH_MEMORY_PATH=./shodh_memory_data
# Environment mode
SHODH_ENV=production
# Logging level
RUST_LOG=infoRate Limiting
SHODH_RATE_LIMIT=4000
SHODH_RATE_BURST=8000
SHODH_MAX_CONCURRENT=200Defaults are high intentionally — shodh-memory is designed for LLM workloads with rapid-fire tool calls.
CORS (optional)
SHODH_CORS_ORIGINS=https://your-frontend.com
SHODH_CORS_CREDENTIALS=falseYour First Memory
Store and retrieve memories using the REST API, Python, or Rust.
REST API
curl -X POST http://localhost:3030/api/remember \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"user_id": "user-1",
"content": "User prefers dark mode",
"memory_type": "Decision",
"tags": ["preferences", "ui"]
}'curl -X POST http://localhost:3030/api/recall \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"user_id": "user-1",
"query": "user preferences",
"limit": 5
}'Python
from shodh_memory import Memory
memory = Memory(storage_path="./my_agent_data")
# Store with types for prioritization
memory.remember("User prefers dark mode", memory_type="Decision")
memory.remember("JWT tokens expire after 24h", memory_type="Learning")
memory.remember("Deploy failed: missing env var", memory_type="Error")
# Semantic search
results = memory.recall("user preferences", limit=5)
for r in results:
print(f"{r['content']} (importance: {r['importance']:.2f})")
# Context summary for LLM bootstrap
summary = memory.context_summary()
print(summary["decisions"])
print(summary["learnings"])Rust
use shodh_memory::memory::{MemorySystem, MemoryConfig, Experience, ExperienceType, Query};
fn main() -> anyhow::Result<()> {
let config = MemoryConfig {
storage_path: "./my_agent_data".into(),
..Default::default()
};
let memory = MemorySystem::new(config)?;
let experience = Experience {
content: "User prefers dark mode".to_string(),
experience_type: ExperienceType::Decision,
..Default::default()
};
memory.remember(experience, None)?;
let query = Query::builder()
.query_text("user preferences")
.max_results(5)
.build();
let results = memory.recall(&query)?;
for mem in results {
println!("{}", mem.experience.content);
}
Ok(())
}Memory Types
Types affect importance scoring and decay rates:
| Type | Weight | Use For |
|---|---|---|
| Decision | +0.30 | Choices, preferences, conclusions |
| Learning | +0.25 | New knowledge acquired |
| Error | +0.25 | Mistakes to avoid |
| Discovery | +0.20 | Findings, insights |
| Pattern | +0.20 | Recurring behaviors |
| Task | +0.15 | Work items |
| Context | +0.10 | General information |
| Conversation | +0.10 | Chat history |
| Observation | +0.05 | Low-priority notes (default) |
MCP Tools
45 tools available via the Model Context Protocol.
Core Memory
| Tool | Description |
|---|---|
| remember | Store a memory with type, tags, and metadata |
| recall | Semantic search across all memories |
| proactive_context | Auto-surface relevant memories for current context |
| context_summary | Categorized overview (decisions, learnings, context) |
| list_memories | List all stored memories |
| read_memory | Read full content of a specific memory |
| forget | Delete a memory by ID |
| memory_stats | Storage and index statistics |
Todo / GTD
| Tool | Description |
|---|---|
| add_todo | Create task with project, context, priority, due date |
| list_todos | Filter by status, project, context, due date |
| update_todo | Update task properties |
| complete_todo | Mark done (auto-advances recurring tasks) |
| delete_todo | Remove a task |
| add_project | Create project for grouping todos |
| list_projects | List all projects with stats |
| todo_stats | Counts by status, overdue items |
Reminders
| Tool | Description |
|---|---|
| set_reminder | Time-based, duration-based, or context-triggered |
| list_reminders | View pending, triggered, or all reminders |
| dismiss_reminder | Acknowledge a triggered reminder |
Maintenance
| Tool | Description |
|---|---|
| verify_index | Check vector index health for orphaned memories |
| repair_index | Re-index orphaned memories |
| backup_create | Create full backup with checksum |
| backup_list | List available backups |
| backup_verify | Verify backup integrity |
| backup_purge | Purge old backups, keep recent N |
| consolidation_report | View memory consolidation activity |
| token_status | Check context window token usage |
| reset_token_session | Reset token counter for new session |
API Reference
REST endpoints on localhost:3030. All requests require X-API-Key header.
Core Memory
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/remember | Store a memory |
| POST | /api/remember/batch | Store multiple memories |
| POST | /api/recall | Semantic search |
| POST | /api/recall/tags | Search by tags |
| POST | /api/recall/date | Search by date range |
| GET | /api/memory/{id} | Get memory by ID |
| DELETE | /api/memory/{id} | Delete memory |
| POST | /api/memories | List with filters |
| POST | /api/proactive_context | Context-aware retrieval |
| POST | /api/context_summary | Categorized summary |
| POST | /api/reinforce | Hebbian feedback |
Todos & Projects
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/todos | List todos |
| POST | /api/todos/add | Create todo |
| POST | /api/todos/update | Update todo |
| POST | /api/todos/complete | Mark complete |
| POST | /api/todos/delete | Delete todo |
| GET | /api/todos/{id} | Get todo |
| GET | /api/todos/{id}/subtasks | List subtasks |
| POST | /api/todos/stats | Statistics |
Health & Metrics
| Method | Endpoint | Description |
|---|---|---|
| GET | /health | Health check |
| GET | /metrics | Prometheus metrics |
| GET | /api/context/status | Context window status |
Performance
| Operation | Latency |
|---|---|
| Store memory | 55-60ms |
| Semantic search | 34-58ms |
| Tag search | ~1ms |
| Entity lookup | 763ns |
| Graph traversal (3-hop) | 30us |
Hooks & Automation
Automatic memory capture via Claude Code hooks. Memories are recorded without manual tool calls.
How Hooks Work
Claude Code fires events at key moments: session start, user prompt, before/after tool use. The shodh-memory hook script intercepts these events and streams context to the memory server automatically. You get persistent memory without changing your workflow.
Supported Events
| Event | Triggers On | Captures |
|---|---|---|
| SessionStart | New Claude Code session | Surfaces relevant past memories |
| UserPromptSubmit | User sends a message | Records conversation context |
| PreToolUse | Before Edit, Write, Bash | Records intent and patterns |
| PostToolUse | After Edit, Write, Bash, Read | Records outcomes and file access |
Setup
Add to your Claude Code settings (~/.claude/settings.json):
{
"hooks": {
"SessionStart": [{
"hooks": [{
"type": "command",
"command": "bun run $SHODH_HOOKS_DIR/memory-hook.ts SessionStart"
}]
}],
"UserPromptSubmit": [{
"hooks": [{
"type": "command",
"command": "bun run $SHODH_HOOKS_DIR/memory-hook.ts UserPromptSubmit"
}]
}],
"PreToolUse": [{
"matcher": { "tool_name": ["Edit", "Write", "Bash"] },
"hooks": [{
"type": "command",
"command": "bun run $SHODH_HOOKS_DIR/memory-hook.ts PreToolUse"
}]
}],
"PostToolUse": [{
"matcher": { "tool_name": ["Edit", "Write", "Bash", "Read"] },
"hooks": [{
"type": "command",
"command": "bun run $SHODH_HOOKS_DIR/memory-hook.ts PostToolUse"
}]
}]
}
}Set SHODH_HOOKS_DIR to the path where you cloned the shodh-memory hooks directory.
Need Help?
Open an issue on GitHub or join the discussions.