Skip to content

ankurkakroo2/memory-setup-claude

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Mem0 + Claude Code Integration

GitHub License

Persistent, cross-device memory layer for Claude Code using Mem0 Platform

Overview

This project integrates Mem0 Platform with Claude Code to provide intelligent, persistent memory across all your devices. Claude Code will remember your coding preferences, project context, and past decisions automatically.

Features

  • 🧠 Persistent Memory - Remembers across sessions and devices
  • πŸ”„ Cross-Device Sync - Same memory on laptop, desktop, and cloud VMs
  • 🎯 Context-Aware - Automatically recalls relevant information
  • πŸ” Secure - API keys managed via environment variables
  • πŸ“Š Modular Design - Clean separation of concerns

Quick Start

πŸš€ Automated Setup (Recommended)

The easiest way to get started:

# Clone the repository
git clone https://github.com/ankurkakroo2/memory-setup-claude.git
cd memory-setup-claude

# Run the interactive setup wizard
./setup.sh

The interactive setup wizard will guide you through:

  • βœ“ Prerequisites checking
  • βœ“ Mem0 account setup
  • βœ“ API key configuration
  • βœ“ Environment file creation
  • βœ“ MCP configuration
  • βœ“ Validation testing

Features:

  • 🎨 Beautiful colored terminal UI
  • πŸ“‹ Step-by-step guidance
  • βœ… Automatic validation
  • πŸ”’ Secure configuration

Manual Setup (Alternative)

If you prefer manual setup:

Prerequisites

  • Claude Code installed (Install guide)
  • Python 3.10+ with uv package manager
  • Mem0 Platform account (Sign up)

Setup Steps

  1. Clone and navigate to the repository

    cd /Users/ankur/D/Playground/memory-setup-claude
  2. Configure environment variables

    # Copy the example file
    cp .env.example .env
    
    # Edit .env and add your credentials
    nano .env

    Update these values:

    export MEM0_API_KEY="m0-your-actual-api-key"
    export MEM0_DEFAULT_USER_ID="your-username"
    export MEM0_ENABLE_GRAPH_DEFAULT="false"
  3. Load environment variables

    source .env
  4. Configure MCP for Claude Code

    The ~/.mcp.json file should already be configured. Verify it exists:

    cat ~/.mcp.json
  5. Test the integration

    claude --print --dangerously-skip-permissions "Remember that I prefer TypeScript"

Auto-load Environment (Optional)

Add to your shell profile to automatically load environment variables:

echo 'source /Users/ankur/D/Playground/memory-setup-claude/.env' >> ~/.zshrc
source ~/.zshrc

Architecture

See LLD.md for detailed architecture documentation including:

  • System architecture diagrams
  • Data flow sequences
  • Modular code structure
  • Security design
  • Performance considerations

Project Structure

memory-setup-claude/
β”œβ”€β”€ .env                      # Your config (git-ignored)
β”œβ”€β”€ .env.example              # Template for .env
β”œβ”€β”€ .gitignore                # Git ignore rules
β”œβ”€β”€ setup.sh                  # πŸš€ Interactive setup wizard
β”œβ”€β”€ test_claude_memory.sh     # Validation script
β”œβ”€β”€ README.md                 # This file
β”œβ”€β”€ LLD.md                    # Low-level design document
└── claude-mem0.env.example   # Legacy template

Usage Examples

Personal Preferences

source .env
claude --print --dangerously-skip-permissions "Remember I prefer pytest over unittest"

Later:

claude --print --dangerously-skip-permissions "What's my Python testing preference?"

Search Memories

claude --print --dangerously-skip-permissions "Search my memories for programming preferences"

Configuration Files

Environment Variables (.env)

Variable Description Example
MEM0_API_KEY Your Mem0 Platform API key m0-xxx...
MEM0_DEFAULT_USER_ID Your unique user identifier ankur@example.com
MEM0_ENABLE_GRAPH_DEFAULT Enable graph memory features false

MCP Configuration (~/.mcp.json)

{
  "mcpServers": {
    "mem0": {
      "command": "uvx",
      "args": ["mem0-mcp-server"],
      "env": {
        "MEM0_API_KEY": "${MEM0_API_KEY}",
        "MEM0_DEFAULT_USER_ID": "${MEM0_DEFAULT_USER_ID}",
        "MEM0_ENABLE_GRAPH_DEFAULT": "${MEM0_ENABLE_GRAPH_DEFAULT:-false}"
      }
    }
  }
}

Cross-Device Setup

To use the same memory across multiple devices:

  1. Install Claude Code and UV on each device
  2. Copy configuration files:
    • .env (with your API key)
    • Ensure ~/.mcp.json is configured
  3. Use the SAME MEM0_DEFAULT_USER_ID on all devices
  4. Source the environment before running Claude Code

All devices will automatically share the same memory!

Troubleshooting

"uvx command not found"

brew install uv  # macOS
# or
pip install uv

"Claude Code doesn't recognize memory tools"

  1. Verify ~/.mcp.json exists and is valid JSON
  2. Check that environment variables are loaded: echo $MEM0_API_KEY
  3. Restart Claude Code completely

"Invalid API key"

Memory not syncing across devices

  • Confirm you're using the same MEM0_DEFAULT_USER_ID on all devices
  • Check the Mem0 dashboard to verify memories are being saved
  • Ensure all devices have network access to Mem0 Platform

Available Memory Tools

Claude Code has access to these MCP tools:

  • add_memory - Save new information
  • search_memories - Find relevant memories
  • get_memories - List all memories
  • get_memory - Retrieve specific memory by ID
  • update_memory - Modify existing memory
  • delete_memory - Remove specific memory
  • delete_all_memories - Bulk delete
  • delete_entities - Remove entity and its memories
  • list_entities - View stored entities

Security Best Practices

  • βœ… Never commit .env files to git
  • βœ… Rotate API keys regularly
  • βœ… Use different user_id for different contexts if needed
  • βœ… Review memories periodically in Mem0 dashboard
  • ❌ Don't share your .env file
  • ❌ Don't hardcode API keys in code
  • ❌ Don't use the same API key for public projects

Validation

Run the validation script to test your setup:

./test_claude_memory.sh

This will verify:

  • βœ… Environment variables are loaded correctly
  • βœ… MCP server starts successfully
  • βœ… Claude Code recognizes memory tools
  • βœ… All prerequisites are installed

Resources

Contributing

This is a personal integration project. For contributions to:

License

This integration setup is for personal use. Refer to:


Last Updated: January 7, 2026 Status: Validated & Production Ready βœ…

About

Interactive setup wizard for Mem0 + Claude Code integration. Persistent memory across all your devices with beautiful terminal UI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages