๐ŸŽง Listen

Introduction

Every AI coding session starts fresh โ€” your assistant has no memory of previous conversations, decisions made yesterday, or lessons learned from past projects. You end up repeating the same context, explaining the same codebase structure, and losing valuable insights buried in conversation history.

Claude-mem solves this problem by creating a persistent memory system for Claude Code. It automatically captures tool usage observations, compresses them using AI, and stores them in a hybrid SQLite + Chroma vector database. When you start a new session, relevant context is intelligently injected based on semantic similarity and keyword matching.

With 29,663 GitHub stars and active community adoption, claude-mem has become the go-to solution for developers who want their AI coding assistant to remember and learn from past interactions.

What is Claude-Mem?

Claude-mem is an open-source Claude Code plugin that adds persistent memory to your AI coding assistant. Unlike Claude's basic built-in memory (which only stores simple facts), claude-mem captures and compresses the full context of your tool usage, decisions, and development patterns.

How It Works

  1. Capture: 5 lifecycle hooks monitor every tool usage (file operations, searches, commands)
  2. Compress: Claude Agent SDK processes observations and extracts key insights
  3. Store: SQLite database + Chroma vector embeddings for hybrid search
  4. Inject: MCP tools provide relevant context in new sessions via progressive disclosure

The system achieves ~10x token savings by filtering observations before retrieval โ€” you get relevant context without overwhelming the AI with unnecessary details.

Key Features

5 Lifecycle Hooks

Claude-mem hooks into every aspect of your coding session:

Worker Service & Web UI

A background worker service runs on port 37777 with a web viewer interface. You can browse your memory database, search observations, and see how context is being compressed and retrieved.

Hybrid Search System

Claude-mem uses both semantic similarity (via Chroma vector embeddings) and keyword matching (SQLite full-text search) to find relevant context. This hybrid approach ensures you get both conceptually related and specifically relevant observations.

MCP Integration with Progressive Disclosure

Three MCP tools provide intelligent memory access:

This 3-layer system prevents context overload while ensuring relevant details are accessible when needed.

Privacy Controls

Wrap sensitive information in <private> tags to exclude it from memory storage:

<private>
API_KEY=sk-1234567890abcdef
DATABASE_URL=postgres://user:pass@localhost/db
</private>

The system automatically filters out private content during observation processing.

Endless Mode (Beta)

For extended coding sessions, Endless Mode prevents memory fragmentation by maintaining continuous context compression across multiple session boundaries.

Architecture & Technology

Technology Stack

Component Technology Purpose
Core Plugin TypeScript Claude Code plugin with lifecycle hooks
Worker Service Node.js + Bun Background processing and web UI (port 37777)
Database SQLite3 Structured data and full-text search
Vector DB Chroma Semantic similarity search via embeddings
AI Compression Claude Agent SDK Intelligent observation summarization
Integration MCP (Model Context Protocol) Memory search tools for Claude

Data Flow

# Memory Creation Flow
User Action โ†’ Tool Usage โ†’ PostToolUse Hook โ†’ 
Raw Observation โ†’ Claude Agent SDK โ†’ 
Compressed Summary โ†’ SQLite + Chroma โ†’ Stored Memory

# Memory Retrieval Flow  
New Session โ†’ User Query โ†’ MCP Search Tools โ†’
Hybrid Search (Semantic + Keyword) โ†’ 
Progressive Disclosure โ†’ Injected Context

Installation Guide

Prerequisites

The system automatically installs Bun and uv (Python package manager) as needed.

Installation Steps

๐Ÿš€ Quick Install (OpenClaw Gateway)

If you're using OpenClaw Gateway, installation is a one-liner:

/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem

The plugin will be automatically configured and activated.

๐Ÿ“ฆ Manual Installation

  1. Clone the repository:
    git clone https://github.com/thedotmack/claude-mem.git
    cd claude-mem
  2. Install dependencies:
    npm install
  3. Build the plugin:
    npm run build
  4. Configure Claude Code:

    Add the plugin to your Claude Code configuration file

  5. Start the worker service:
    npm run start:worker

    The web UI will be available at http://localhost:37777

Configuration

Create a claude-mem.config.js file to customize behavior:

module.exports = {
  // Database location
  dbPath: './claude-mem.db',
  
  // Worker service port
  workerPort: 37777,
  
  // Compression settings
  compression: {
    enabled: true,
    batchSize: 10,
    maxObservations: 1000
  },
  
  // Privacy settings
  privacy: {
    enablePrivateTags: true,
    excludePatterns: ['password', 'token', 'secret']
  },
  
  // MCP tools configuration
  mcp: {
    searchLimit: 20,
    progressiveDisclosure: true
  }
};

Use Cases

Long-term Project Development

Working on a complex codebase over weeks or months? Claude-mem remembers:

Team Knowledge Sharing

Multiple developers can benefit from shared memory contexts:

Learning & Skill Development

Claude-mem accelerates learning by remembering:

Research & Experimentation

Perfect for research projects where context accumulates over time:

Community Feedback

What Developers Are Saying

"This is exactly what I needed. No more explaining the same codebase structure every session. Claude-mem makes my AI assistant actually feel like a team member who remembers our conversations."
โ€” u/developer_jane, Reddit
"The progressive disclosure system is brilliant. I get relevant context without token bloat. The 3-layer MCP integration (search โ†’ timeline โ†’ get_observations) prevents information overload."
โ€” @coding_architect, Twitter
"Started using this for a 6-month React Native project. The memory compression is incredible โ€” it captures the essence of decisions without storing every single detail. Game changer for long-term development."
โ€” AgentNativeDev, Medium

Community Resources

Competitors

Solution Type Pros Cons
Claude Built-in Memory Native Feature Simple, no setup required Basic facts only, no tool context, limited capacity
ChatGPT Memory Native Feature Automatic, works across sessions Not available in Claude, limited technical depth
Cursor Memory IDE-Specific Deep codebase integration Cursor-only, limited to current project
Custom CLAUDE.md Files Manual Approach Full control, no dependencies Manual maintenance, no search, token-expensive
Recall (Redis-backed) Custom Solution Fast retrieval, scalable Complex setup, requires Redis infrastructure
Claude-mem Plugin System Automatic capture, AI compression, hybrid search, MCP integration Setup required, additional dependencies

Pros & Cons

โœ… Pros

  • Fully Automatic: No manual memory management โ€” captures everything intelligently
  • AI-Powered Compression: Claude Agent SDK extracts key insights, not raw data dumps
  • Hybrid Search: Semantic + keyword matching for precise context retrieval
  • Progressive Disclosure: 3-layer MCP system prevents context overload
  • Privacy Controls: <private> tags protect sensitive information
  • OpenClaw Integration: One-line installation with gateway support
  • Open Source: AGPL-3.0 license, active community development
  • Web UI: Browse and search memory database visually
  • Token Efficient: ~10x reduction in token usage vs manual context

โš ๏ธ Cons

  • Setup Complexity: Requires Node.js, dependencies, and configuration
  • Storage Requirements: Database grows over time (SQLite + Chroma)
  • Claude Code Dependency: Only works with Claude Code, not other AI assistants
  • Beta Features: Endless Mode and some advanced features are still experimental
  • Resource Usage: Worker service consumes system resources
  • Learning Curve: Understanding MCP tools and memory structure takes time

Pricing

๐Ÿ’ฐ Pricing Structure

  • Open Source: Free to use under AGPL-3.0 license
  • Self-Hosted: No subscription fees, you control the infrastructure
  • Operational Costs: Claude API usage for compression (minimal)
  • $CMEM Token: Community-driven Solana token (optional, speculative)

Estimated Monthly Cost: $2-5 in Claude API calls for active users

Cost Breakdown

The main cost is Claude API usage for observation compression:

Compare this to the time saved from not having to re-explain context โ€” claude-mem typically pays for itself in saved developer hours within days.

Getting Started

Quick Start Guide

  1. Install via OpenClaw Gateway:
    /plugin marketplace add thedotmack/claude-mem
    /plugin install claude-mem
  2. Start coding normally โ€” claude-mem begins capturing observations automatically
  3. Check the web UI at http://localhost:37777 to see memory building
  4. Use MCP search tools to retrieve context:
    • search "React components" โ€” find related observations
    • timeline "debugging session" โ€” see chronological context
    • get_observations [123, 456] โ€” fetch specific details
  5. Add privacy tags for sensitive content:
    <private>API_KEY=your-secret-key</private>

Best Practices

Troubleshooting

Common Issues & Solutions
  • Worker service won't start: Check port 37777 is available
  • No memory capture: Verify lifecycle hooks are properly configured
  • Search returns no results: Wait for Chroma embeddings to process
  • High API costs: Adjust compression batch size in config

For additional support, join the GitHub Discussions or the community Discord server.

๐ŸŽฏ Bottom Line Claude-mem transforms Claude Code from a stateless assistant to a persistent coding partner. If you work on long-term projects, collaborate with teams, or want your AI to learn from past interactions, claude-mem is essential infrastructure. The one-line OpenClaw installation makes it accessible to any Claude Code user.

References

  1. Claude-mem GitHub Repository โ€” Official source code and documentation
  2. Claude-mem Documentation โ€” Complete setup and usage guide
  3. Persistent Memory for Claude Code โ€” Never Lose Context โ€” Medium setup guide
  4. Reddit Discussion: Claude-mem Community Feedback โ€” Real-world experiences and use cases
  5. Claude-mem: AI Memory for Long-term Coding Projects โ€” Technical deep dive
  6. How to Use Claude-mem for Persistent AI Memory โ€” Step-by-step tutorial
  7. Claude-mem: Persistent Memory for AI Coding Assistants โ€” Architectural analysis
  8. Claude's Built-in Memory โ€” Comparison with native Claude features
๐Ÿ›ก๏ธ No Third-Party Tracking