Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Agentic Memory System
An intelligent, tiered memory management system for Claude AI agents, implementing hierarchical storage with semantic search capabilities. Built as an MCP (Model Context Protocol) server for seamless integration with Claude Desktop and Claude Code.
Features
- 🧠 Hierarchical Memory Tiers: Working, Warm, and Cold storage with automatic migration
- 🔍 Semantic Search: Vector-based similarity search using pgvector
- 🚀 MCP Integration: Native support for Claude Desktop and Claude Code
- 📊 Performance Monitoring: Built-in metrics, health checks, and observability
- 🔒 Security First: Secure credential handling, encryption support, audit logging
- 🎯 Flexible Embeddings: Support for Ollama (local), OpenAI, or mock providers
- 💾 PostgreSQL Backend: Robust storage with pgvector for vector operations
- 🛡️ Production Ready: Comprehensive error handling, retries, and circuit breakers
- 💡 Codex Dreams (Optional): AI-powered insight generation from stored memories
Insight Generation (Codex Dreams)
Codex Dreams analyzes your stored memories to discover patterns, connections, and learnings using local LLMs via Ollama. This feature is completely manual by default - no automatic processing occurs unless explicitly requested.
Key Features
- Generate insights on-demand through Claude
- Discover patterns, learnings, and connections in your memories
- Export insights in Markdown or JSON format
- Privacy-first: All processing happens locally
Usage
Simply ask Claude to generate insights:
- "Generate insights from my memories from the last week"
- "Find patterns in my coding-related memories"
- "Export my insights as markdown"
For detailed documentation, automation options, and troubleshooting, see INSIGHTS.md.
Quick Start
Claude Desktop Extension (Easiest)
New! Install Codex Memory as a Claude Desktop extension for the simplest setup:
- Download
codex-memory.dxtfrom Releases - Open Claude Desktop → Settings → Extensions
- Click "Install Extension" and select the
.dxtfile - Configure your database URL and embedding provider in the UI
- Start using memory commands in Claude!
See extension/README.md for detailed extension documentation.
Manual Installation
Prerequisites
- Rust 1.70+ and Cargo
- PostgreSQL 15+ with pgvector extension
- Ollama (for local embeddings) or OpenAI API key
- macOS/Linux/Windows
Build from Source
# Clone the repository
# Build the release binary
# Run setup validation
Configuration
- Copy the example environment file:
- Edit
.envwith your credentials:
DATABASE_URL=postgresql://username:password@localhost:5432/memory_db
EMBEDDING_PROVIDER=ollama
EMBEDDING_BASE_URL=http://localhost:11434
EMBEDDING_MODEL=nomic-embed-text
- Test your configuration:
MCP Integration
Claude Desktop Setup (macOS)
- Generate configuration template:
- Add to Claude Desktop configuration:
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
- Restart Claude Desktop to load the new MCP server.
Claude Code Setup (Project-Level)
- Create
.mcp.jsonin your project root:
- The MCP server will automatically start when you open the project in Claude Code.
Database Setup
PostgreSQL with pgvector
- Install PostgreSQL and pgvector:
# macOS (Homebrew)
# Ubuntu/Debian
# From source
&& &&
- Create database and user:
;
;
\c codex_db
CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
- Run migrations:
Embedding Setup
Option 1: Ollama (Recommended for Local Development)
- Install Ollama:
# macOS
# Linux
|
- Start Ollama and pull embedding model:
Option 2: OpenAI
Set your API key in .env:
EMBEDDING_PROVIDER=openai
OPENAI_API_KEY=sk-your-api-key-here
EMBEDDING_MODEL=text-embedding-3-small
Usage
Start the MCP Server
# Using environment file
# Or with explicit configuration
DATABASE_URL="postgresql://..."
CLI Commands
# MCP Management
# Database Management
# System Management
Memory Operations (via MCP)
Once integrated with Claude, you can use natural language to interact with the memory system:
- "Remember that the user prefers dark mode"
- "What do you know about my database configuration?"
- "Search for memories about API endpoints"
- "Forget everything about passwords"
Architecture
┌─────────────────────────────────────────────────────┐
│ Claude Desktop/Code │
│ (MCP) │
└─────────────────────┬───────────────────────────────┘
│
┌─────────────────────┴───────────────────────────────┐
│ Agentic Memory System │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────┐ │
│ │ Working │ │ Warm │ │ Cold │ │
│ │ Memory │◄─┤ Memory │◄─┤ Memory │ │
│ │ (Hot tier) │ │ (Medium tier)│ │(Archive) │ │
│ └──────────────┘ └──────────────┘ └──────────┘ │
│ │
│ ┌──────────────────────────────────────────────┐ │
│ │ Embedding Service │ │
│ │ (Ollama/OpenAI/Mock) │ │
│ └──────────────────────────────────────────────┘ │
└─────────────────────┬───────────────────────────────┘
│
┌─────────────────────┴───────────────────────────────┐
│ PostgreSQL + pgvector │
└─────────────────────────────────────────────────────┘
Performance
- Working Memory Access: <1ms P99
- Semantic Search: <100ms P99 for 1M vectors
- Embedding Generation: ~10ms (Ollama local)
- Batch Operations: 100+ ops/second
- Memory Capacity: 1K working, 10K warm, unlimited cold
Security
- Credential Management: Environment variables with secure defaults
- Connection Security: TLS/SSL support for database connections
- Access Control: Database user with minimal required permissions
- Audit Logging: Complete audit trail of all operations
- Data Encryption: At-rest and in-transit encryption support
Monitoring
Prometheus Metrics
The system exposes metrics on :8080/metrics:
- Memory operations (create, read, update, delete)
- Search performance and hit rates
- Tier migration statistics
- Database connection pool metrics
- Embedding generation latency
Health Checks
# System health
# Detailed diagnostics
Troubleshooting
Common Issues
Database Connection Failed:
# Check PostgreSQL is running
# Verify credentials
Ollama Not Responding:
# Check Ollama is running
# Pull embedding model
MCP Not Loading in Claude:
# Validate configuration
# Check logs
Debug Mode
Enable detailed logging:
LOG_LEVEL=debug
Development
Building from Source
# Debug build
# Release build with optimizations
# Run tests
# Run with hot reload
Running Tests
# All tests
# Specific test suites
# With output
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Development Workflow
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run
cargo fmtandcargo clippy - Submit a pull request
License
This project is licensed under the MIT License - see LICENSE for details.
Support
- Documentation: MCP_SETUP.md
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Acknowledgments
- Built for the Claude AI ecosystem
- Uses pgvector for efficient vector operations
- Inspired by hierarchical memory architectures in cognitive science