by bobmatnyc
Provides a lightweight, embedded graph‑based memory system that stores and recalls contextual information for AI applications without requiring external LLM calls.
Kuzu Memory offers an offline‑first, graph‑backed store that mimics human cognitive types (semantic, procedural, episodic, etc.) to remember facts, preferences, and recent events. It runs locally, using pattern matching and a single‑file Kuzu graph database, delivering sub‑3 ms recall speeds.
pip install kuzu-memory (or pipx install kuzu-memory for CLI use).kuzu-memory init or let the smart kuzu-memory setup command create the config and database automatically.memory.generate_memories(text) or via CLI kuzu-memory memory store "...".memory.attach_memories(query) or CLI kuzu-memory memory recall "...".kuzu-memory install <integration> (e.g., claude-code) to add MCP hooks for Claude Desktop, VS Code, Cursor, etc.attach_memories() and generate_memories().UserPromptSubmit, Stop).kuzu-memory doctor provides health checks and auto‑fixes.Q: Do I need an internet connection? A: No. All storage, pattern matching, and retrieval happen locally.
Q: Can I use Kuzu Memory with other LLM providers?
A: Yes. The memory layer is LLM‑agnostic; you only need to call attach_memories before passing the prompt to any model.
Q: How does it classify memories?
A: Simple regex patterns and keyword heuristics map sentences to cognitive types; custom patterns can be added in config.yaml.
Q: Will the database bloat over time? A: The DB auto‑compacts and respects size limits (default 50 MB). Episodic and working memories have TTLs (30 days / 1 day).
Q: How do I troubleshoot a broken MCP server?
A: Run kuzu-memory repair or kuzu-memory doctor – they auto‑fix common configuration issues.
Lightweight, embedded graph-based memory system for AI applications
KuzuMemory provides fast, offline memory capabilities for chatbots and AI systems without requiring LLM calls. It uses pattern matching and local graph storage to remember and recall contextual information.
attach_memories() and generate_memories()UserPromptSubmit, Stop)# Install via pipx (recommended for CLI usage)
pipx install kuzu-memory
# Or install via pip
pip install kuzu-memory
# For development
pip install kuzu-memory[dev]
Now available on PyPI! KuzuMemory v1.4.48 is published and ready for production use.
The easiest way to get started is with the smart setup command:
# Navigate to your project directory
cd /path/to/your/project
# Run smart setup - auto-detects and configures everything
kuzu-memory setup
# That's it! The setup command will:
# ✅ Initialize the memory database
# ✅ Detect your AI tools (Claude Code, Cursor, VS Code, etc.)
# ✅ Install/update integrations automatically
# ✅ Verify everything is working
Options:
# Preview what would happen (dry run)
kuzu-memory setup --dry-run
# Setup for specific AI tool
kuzu-memory setup --integration claude-code
# Initialize only (skip AI tool installation)
kuzu-memory setup --skip-install
# Force reinstall everything
kuzu-memory setup --force
If you need granular control, KuzuMemory can be installed manually with various AI systems following the ONE PATH principle:
# Install Claude Code integration (MCP + hooks)
kuzu-memory install claude-code
# Install Claude Desktop integration (MCP only)
kuzu-memory install claude-desktop
# Install Codex integration (MCP only)
kuzu-memory install codex
# Install Cursor IDE integration (MCP only)
kuzu-memory install cursor
# Install VS Code integration (MCP only)
kuzu-memory install vscode
# Install Windsurf IDE integration (MCP only)
kuzu-memory install windsurf
# Install Auggie integration (rules)
kuzu-memory install auggie
# Uninstall an integration
kuzu-memory uninstall claude-code
Available Integrations (ONE command per system):
claude-code - Claude Code IDE with MCP + hooks (complete integration)claude-desktop - Claude Desktop app with MCP server (global memory)codex - Codex IDE with MCP server (global configuration)cursor - Cursor IDE with MCP servervscode - VS Code with Claude extension (MCP server)windsurf - Windsurf IDE with MCP serverauggie - Auggie AI with rules integrationKey Differences:
Claude Code (claude-code):
.kuzu-memory/config.yaml in project directory.kuzu-memory/memorydb/UserPromptSubmit) and learning (Stop)Claude Desktop (claude-desktop):
~/.kuzu-memory/config.yaml in home directory~/.kuzu-memory/memorydb/Codex (codex):
~/.codex/config.toml in home directory (TOML format)mcp_servers convention (TOML)Auggie (auggie):
.augment/rules/ directory with enhanced integration rules.augment/backups/v{version}_{timestamp}/ before upgradeAGENTS.md, .augment/rules/kuzu-memory-integration.md, .augment/rules/memory-quick-reference.md.augment/.kuzu-versionInstallation Options:
--force - Force reinstall even if already installed (overwrites existing config)--dry-run - Preview changes without modifying files--verbose - Show detailed installation steps--mode [auto|pipx|home] - Override auto-detection (claude-desktop only)--backup-dir PATH - Custom backup directory--memory-db PATH - Custom memory database locationAutomatic Initialization:
--force to overwrite)See Claude Setup Guide for detailed instructions on Claude Desktop and Claude Code integration.
Note: Previous installer names (e.g.,
claude-desktop-pipx,claude-desktop-home) still work but show deprecation warnings.
from kuzu_memory import KuzuMemory
# Initialize memory system
memory = KuzuMemory()
# Store memories from conversation
memory.generate_memories("""
User: My name is Alice and I work at TechCorp as a Python developer.
Assistant: Nice to meet you, Alice! Python is a great choice for development.
""")
# Retrieve relevant memories
context = memory.attach_memories("What's my name and where do I work?")
print(context.enhanced_prompt)
# Output includes: "Alice", "TechCorp", "Python developer"
# Initialize memory database
kuzu-memory init
# Store a memory
kuzu-memory memory store "I prefer using TypeScript for frontend projects"
# Recall memories
kuzu-memory memory recall "What do I prefer for frontend?"
# Enhance a prompt
kuzu-memory memory enhance "What's my coding preference?"
# View statistics
kuzu-memory status
Check for updates:
kuzu-memory update --check-only
Check and upgrade:
kuzu-memory update
Include pre-releases:
kuzu-memory update --pre
Silent check (for scripts/cron):
kuzu-memory update --check-only --quiet
# Exit code 0 = up to date, 2 = update available
JSON output for automation:
kuzu-memory update --check-only --format json
The update command queries PyPI for the latest version and uses pip to upgrade. It's safe to run anytime and will preserve your database and configuration files.
Auto-fix broken MCP configurations:
If your MCP server fails to start due to configuration issues, the repair command can automatically fix common problems:
# Auto-detect and repair all installed systems
kuzu-memory repair
# Show detailed repair information
kuzu-memory repair --verbose
What it fixes:
["mcp", "serve"] args → ["mcp"] (common MCP server startup issue)When to use:
See Troubleshooting Guide for more repair scenarios.
Automatically import project commit history as memories:
# Smart sync (auto-detects initial vs incremental)
kuzu-memory git sync
# Force full resync
kuzu-memory git sync --initial
# Preview without storing
kuzu-memory git sync --dry-run
# View sync configuration
kuzu-memory git status
# Install automatic sync hook
kuzu-memory git install-hooks
What gets synced: Commits with semantic prefixes (feat:, fix:, refactor:, perf:) from main, master, develop, feature/, bugfix/ branches.
Retention: Git commits are stored as EPISODIC memories (30-day retention).
Deduplication: Running sync multiple times won't create duplicates - each commit SHA is stored once.
See Git Sync Guide for detailed documentation.
KuzuMemory uses a cognitive memory model inspired by human memory systems:
KuzuMemory automatically classifies memories into cognitive types based on content patterns, providing intuitive categorization that mirrors human memory systems. This standardized model ensures compatibility across Python and TypeScript implementations.
No LLM required! KuzuMemory uses regex patterns to identify and store memories automatically:
# Automatically detected patterns
"Remember that we use Python for backend" # → EPISODIC memory
"My name is Alice" # → SEMANTIC memory
"I prefer dark mode" # → PREFERENCE memory
"Always use type hints" # → PROCEDURAL memory
"Currently debugging the API" # → WORKING memory
"The interface feels slow" # → SENSORY memory
Important: For pattern matching to work effectively, content should include clear subject-verb-object structures. Memories with specific entities, actions, or preferences are extracted more reliably than abstract statements.
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Your App │ │ KuzuMemory │ │ Kuzu Graph │
│ │ │ │ │ Database │
│ ┌─────────────┐ │ │ ┌──────────────┐ │ │ │
│ │ Chatbot │─┼────┼→│attach_memories│─┼────┼→ Query Engine │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │generate_ │ │ │ ┌─────────────┐ │
│ │ │─┼────┼→│memories │─┼────┼→│ Pattern │ │
│ └─────────────┘ │ │ └──────────────┘ │ │ │ Extraction │ │
└─────────────────┘ └──────────────────┘ │ └─────────────┘ │
└─────────────────┘
KuzuMemory uses a service layer architecture with dependency injection for clean separation of concerns:
┌─────────────────────────────────────────────────────────────┐
│ ServiceManager │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │MemoryService │ │GitSyncService│ │DiagnosticSvc │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
│ │ │
▼ ▼ ▼
IMemoryService IGitSyncService IDiagnosticService
(Protocol) (Protocol) (Protocol)
Key Benefits:
For Developers:
Create .kuzu_memory/config.yaml:
version: 1.0
storage:
max_size_mb: 50
auto_compact: true
recall:
max_memories: 10
strategies:
- keyword
- entity
- temporal
patterns:
custom_identity: "I am (.*?)(?:\\.|$)"
custom_preference: "I always (.*?)(?:\\.|$)"
| Operation | Target | Typical | Verified |
|---|---|---|---|
| Memory Recall | <100ms | ~3ms | ✅ |
| Memory Generation | <200ms | ~8ms | ✅ |
| Database Size | <500 bytes/memory | ~300 bytes | ✅ |
| RAM Usage | <50MB | ~25MB | ✅ |
| Async Learning | Smart wait | 5s default | ✅ |
# Install development dependencies
pip install -e ".[dev]"
# Run all tests
pytest
# Run benchmarks
pytest tests/ -m benchmark
# Check coverage
pytest --cov=kuzu_memory
KuzuMemory includes comprehensive MCP server testing and diagnostic tools:
# Run MCP test suite (151+ tests)
pytest tests/mcp/ -v
# Run PROJECT-LEVEL diagnostics (checks project files only)
kuzu-memory doctor
# Quick health check
kuzu-memory doctor health
# MCP-specific diagnostics
kuzu-memory doctor mcp
# Test database connection
kuzu-memory doctor connection
# Performance benchmarks
pytest tests/mcp/performance/ --benchmark-only
Test Coverage:
Diagnostic Tools (Project-Level Only):
Note: The doctor command checks PROJECT-LEVEL configurations only:
kuzu-memory install claude-desktop instead)See MCP Testing Guide and MCP Diagnostics Reference for complete documentation.
The kuzu-memory doctor command provides comprehensive health checks and diagnostics for your project-level KuzuMemory installation.
# Run full diagnostics (interactive, 29 checks)
kuzu-memory doctor
# Auto-fix detected issues (non-interactive)
kuzu-memory doctor --fix
# Quick health check
kuzu-memory doctor health
# MCP-specific diagnostics
kuzu-memory doctor mcp
# Test database connection
kuzu-memory doctor connection
# Selective testing
kuzu-memory doctor --no-server-lifecycle # Skip server checks
kuzu-memory doctor --no-hooks # Skip hooks checks
# JSON output for automation
kuzu-memory doctor --format json > diagnostics.json
# Save report to file
kuzu-memory doctor --output report.html --format html
New in v1.4.x:
--fix flag for automatic issue resolutionConfiguration Checks (11):
Hooks Diagnostics (12):
Server Lifecycle Checks (7):
Performance Metrics:
Severity Levels:
Auto-Fix Suggestions: Most failures include a "Fix:" suggestion with a specific command to resolve the issue.
From QA testing:
Common Issues:
MCP server not configured (INFO)
kuzu-memory install add claude-codeHook executable not found (ERROR)
kuzu-memory install add claude-code --forceDatabase not initialized (CRITICAL)
kuzu-memory init or reinstallSee Diagnostics Reference for detailed check documentation.
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
git clone https://github.com/kuzu-memory/kuzu-memory
cd kuzu-memory
pip install -e ".[dev]"
pre-commit install
MIT License - see LICENSE file for details.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by modelcontextprotocol
A basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.
by topoteretes
Provides dynamic memory for AI agents through modular ECL (Extract, Cognify, Load) pipelines, enabling seamless integration with graph and vector stores using minimal code.
by basicmachines-co
Enables persistent, local‑first knowledge management by allowing LLMs to read and write Markdown files during natural conversations, building a traversable knowledge graph that stays under the user’s control.
by smithery-ai
Provides read and search capabilities for Markdown notes in an Obsidian vault for Claude Desktop and other MCP clients.
by chatmcp
Summarize chat messages by querying a local chat database and returning concise overviews.
by dmayboroda
Provides on‑premises conversational retrieval‑augmented generation (RAG) with configurable Docker containers, supporting fully local execution, ChatGPT‑based custom GPTs, and Anthropic Claude integration.
by qdrant
Provides a Model Context Protocol server that stores and retrieves semantic memories using Qdrant vector search, acting as a semantic memory layer.
by doobidoo
Provides a universal memory service with semantic search, intelligent memory triggers, OAuth‑enabled team collaboration, and multi‑client support for Claude Desktop, Claude Code, VS Code, Cursor and over a dozen AI applications.
by GreatScottyMac
Provides a project‑specific memory bank that stores decisions, progress, architecture, and custom data, exposing a structured knowledge graph via MCP for AI assistants and IDE tools.