Skip to content
/

CCCMemory MCP (xiaolai)

cccmemory-mcp · xiaolai/cccmemory · ★ 26 · last commit 2026-01-25

Primitive shape 45 total
MCP tools 45
00

Summary

CCCMemory MCP (xiaolai) — Summary

CCCMemory MCP is a TypeScript/Node.js MCP server that provides comprehensive persistent memory for AI coding agents by indexing Claude Code (and Codex) conversation history into a SQLite database with hybrid semantic + full-text search. Originally published as claude-conversation-memory-mcp, renamed to cccmemory in v1.8.0. It ships 40+ MCP tools organized into eight categories: indexing, search, context, project management, working memory, session handoff, context injection, and tag management. The v2.0 smart chunking, RRF hybrid search (vector + FTS), and memory quality tracking make it the most full-featured SQLite-backed memory system in this batch. It is cross-tool portable (Claude Code, Claude Desktop, Codex) and installs with a single npm install -g cccmemory. Compared to seeds, it is closest to ccmemory (patrickkidd) but substitutes Neo4j+Ollama for SQLite+Transformers.js, sacrificing graph relationship modeling for simpler installation and broader tool compatibility.

01

Overview

CCCMemory MCP (xiaolai) — Overview

Origin

Created by xiaolai, a prominent Chinese software developer and educator. Published in 2025, renamed from claude-conversation-memory-mcp to cccmemory in v1.8.0. Active development with v2.0 major upgrade.

Philosophy

"Give Claude long-term memory by indexing conversation history with semantic search, decision tracking, and cross-project search." The design principle is comprehensiveness over simplicity — unlike minimal file-based approaches, CCCMemory provides a full-featured memory infrastructure with quality tracking, TTL support, versioned tag management, and session handoff protocols.

v2.0 Architecture Improvements

  • Smart Chunking — Long messages split at sentence boundaries; previously truncated at 512 tokens
  • Hybrid Search — Combines semantic search with full-text search using Reciprocal Rank Fusion (RRF)
  • Dynamic Thresholds — Similarity thresholds adjust based on query length
  • Extraction Validation — Reduces false positives in decision/mistake detection
  • Improved Snippets — Search results highlight matching terms in context

Multi-Tool Portability

Explicit support for:

  • Claude Code: ~/.claude.json config
  • Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Codex CLI: ~/.codex/config.toml with codex mcp add cccmemory command

Storage Modes

Two modes selectable via env var:

  • Global mode (default): ~/.cccmemory.db — single database for all projects
  • Per-project mode: ~/.claude/projects/<project>/.cccmemory.db — isolated per project
02

Architecture

CCCMemory MCP (xiaolai) — Architecture

Distribution

npm package (cccmemory). Install globally.

Install

npm install -g cccmemory
cccmemory --version

Add to Claude Code config (~/.claude.json):

{
  "mcpServers": {
    "cccmemory": { "command": "cccmemory" }
  }
}

Directory Structure

Source layout (src/):

src/
├── ConversationMemory.ts    # Core memory class
├── mcp-server.ts            # MCP server entry point
├── index.ts                 # CLI entry
├── cache/                   # Caching layer
├── chunking/                # Smart chunking
├── cli/                     # CLI subcommands
├── context/                 # Context injection
├── documentation/           # Doc generation
├── embeddings/              # Vector embedding (Transformers.js)
├── handoff/                 # Session handoff
├── memory/                  # Working memory
├── parsers/                 # Conversation file parsing
├── realtime/                # Real-time indexing
├── search/                  # Hybrid search (FTS + vector)
├── storage/                 # SQLite storage
├── tools/                   # MCP tool definitions + handlers
├── types/                   # TypeScript types
└── utils/                   # Utilities

State Storage

  • Primary: ~/.cccmemory.db (SQLite, single-file by default)
  • Per-project: ~/.claude/projects/<project>/.cccmemory.db
  • Config: ~/.claude-memory-config.json

Required Runtime

  • Node.js 20 or 22 LTS (strictly — other versions break better-sqlite3)

Embedding Backend

Default: @xenova/transformers (Transformers.js) — bundled, works offline, model auto-downloaded on first use. Alternatives via config: Ollama, OpenAI.

Target AI Tools

Claude Code, Claude Desktop, Codex CLI, any MCP-compatible client.

03

Components

CCCMemory MCP (xiaolai) — Components

MCP Tools (~45 total, organized by category)

Indexing (2)

Tool Purpose
index_conversations Index current project's conversations into SQLite
index_all_projects Index all Claude Code + Codex projects globally

Search (10)

Tool Purpose
search_conversations Hybrid search in current project
search_project_conversations Search a specific project across platforms
search_all_conversations Cross-project global search
get_decisions Find architectural decisions in current project
get_all_decisions Decisions across all projects
search_mistakes Find past errors and their fixes
search_all_mistakes Mistakes across all projects
find_similar_sessions Find related conversation sessions
search_by_file Find all context related to a specific file
search_by_tags Find items by tag

Context (8)

Tool Purpose
check_before_modify Get context before editing a file
get_file_evolution See file history with commits
list_recent_sessions Recent sessions with summaries
get_latest_session_summary Summarize latest session (problem, actions, errors)
recall_and_apply Recall past work for current task
get_requirements Look up component requirements
get_tool_history Query tool usage history
link_commits_to_conversations Connect git commits to sessions

Project Management (4)

Tool Purpose
discover_old_conversations Find folders from renamed projects
migrate_project Migrate/merge conversation history
forget_by_topic Delete conversations by keyword
generate_documentation Generate docs from code scan + conversations

Working Memory (5)

Tool Purpose
remember Store fact/decision/context with optional TTL
recall Retrieve by key
recall_relevant Semantic search across stored memories
list_memory List all memories, optionally filtered by tags
forget Remove memory by key

Session Handoff (3)

Tool Purpose
prepare_handoff Create handoff document for session transition
resume_from_handoff Resume work from a previous handoff
list_handoffs List available handoff documents

Context Injection (2)

Tool Purpose
get_startup_context Get relevant context at conversation start
inject_relevant_context Auto-inject context based on user message

Tag Management (7)

Tool Purpose
list_tags, search_by_tags, rename_tag, merge_tags, delete_tag, tag_item, untag_item Full tag lifecycle management

Hooks / Commands / Skills

None shipped — pure MCP server. No Claude Code plugin hooks.

CLI (via cccmemory binary)

The npm package installs a cccmemory binary. Used for starting the server; also supports --version flag.

05

Prompts

CCCMemory MCP (xiaolai) — Prompts

Tool Description Examples (from ToolDefinitions.ts — verbatim)

CCCMemory ships no prompt files; its "prompts" are the tool descriptions that appear in the LLM's tool list. Key excerpts:

get_startup_context:

"Get relevant context at conversation start"

inject_relevant_context:

"Auto-inject context based on user message"

recall_and_apply:

"Recall past work for current task"

prepare_handoff:

"Create handoff document for session transition"

check_before_modify:

"Get context before editing a file"

Configuration System Prompt Pattern

From README — suggested Claude Code/Codex CLAUDE.md usage pattern:

## Memory
Before starting work, run get_startup_context to load relevant memories.
Before editing files, run check_before_modify.
After significant decisions, use remember() to store them.
Before ending session, run prepare_handoff.

Prompting technique: Tool-injection pattern — no custom system prompt; the tools themselves are the prompts. The agent discovers and invokes them through normal tool calling, guided by their descriptions.

Hybrid Search Explanation (from README)

The v2.0 hybrid search combines:

  1. Vector search — Transformers.js embeddings (Xenova/all-MiniLM-L6-v2, 384 dimensions)
  2. Full-text search — SQLite FTS5
  3. RRF re-ranking — Reciprocal Rank Fusion merges both result lists
  4. Dynamic thresholds — Short queries use lower similarity threshold than long queries

This is architecturally similar to Elasticsearch's hybrid search but runs entirely locally in SQLite.

09

Uniqueness

CCCMemory MCP (xiaolai) — Uniqueness

Differs From Seeds

Closest to ccmemory (patrickkidd, seed) in purpose but uses SQLite+Transformers.js hybrid search instead of Neo4j+vector+graph. The architectural tradeoff: ccmemory's graph relationships (SUPERSEDES, CONFLICTS_WITH, DEPENDS_ON) enable causal tracing; cccmemory's hybrid RRF search (vector + FTS5) enables better recall across large conversation histories. cccmemory has 40+ tools vs ccmemory's ~10; cccmemory installs with one npm command vs ccmemory's Docker stack. Also similar to claude-flow (seed) in being MCP-anchored, but claude-flow is a full orchestration framework while cccmemory is pure memory infrastructure.

Distinctive Features

  1. Widest tool coverage in this batch: 40+ MCP tools covering indexing, search, context injection, working memory, session handoff, tag management, documentation generation, project migration.
  2. Cross-platform portability: Explicit support for Claude Code, Claude Desktop, Codex CLI — the only system in this batch explicitly configured for all three.
  3. Smart chunking with RRF: v2.0's hybrid vector+FTS approach with Reciprocal Rank Fusion is more sophisticated than any other file-based memory system in this batch.
  4. Tag management as first-class feature: Full tag lifecycle (list, search, rename, merge, delete) across all memory types.

Observable Failure Modes

  1. Node version sensitivity: Requires strictly Node 20 or 22 LTS; better-sqlite3 breaks on other versions.
  2. No lifecycle hooks: Context is not automatically injected at session start; agent must call get_startup_context explicitly.
  3. No graph relationships: Unlike ccmemory, decisions are flat; no SUPERSEDES or CONFLICTS_WITH — stale decisions coexist with newer ones.
  4. Unbounded growth: No compaction or archiving mechanism; database grows indefinitely.
  5. First-run model download: Transformers.js downloads embedding model on first use, which can fail in air-gapped or sandboxed environments.
04

Workflow

CCCMemory MCP (xiaolai) — Workflow

Core Usage Pattern

CCCMemory is passive infrastructure — the agent uses tools on-demand, not through a prescribed workflow. Suggested usage:

When Tool(s)
Start of session get_startup_context → inject relevant past context
Before editing a file check_before_modify → get historical context for that file
After decisions are made (no auto-capture; must use remember explicitly or wait for indexing)
End of session / before compaction prepare_handoff → create session handoff document
Start of next session resume_from_handoff → reload previous session state
When asking "did we do this before?" search_conversations, find_similar_sessions

Indexing Workflow

Phase Action Artifact
Initial setup index_conversations Populated ~/.cccmemory.db
Cross-project setup index_all_projects All projects in global DB
Conversation happens (auto-indexed if realtime module active) New rows in SQLite
Project renamed discover_old_conversationsmigrate_project Migrated history

Approval Gates

None. All tool calls are on-demand.

Memory Quality Tracking

The system tracks confidence, importance, and verification status on stored memories. This is used internally for ranking search results.

Spec Format

None. Memory is stored as unstructured text (conversations, summaries).

06

Memory Context

CCCMemory MCP (xiaolai) — Memory & Context

Memory Type

hybrid — SQLite database with two search layers:

  1. Vector index (Transformers.js embeddings, 384-dim, cosine similarity)
  2. Full-text search (SQLite FTS5)
  3. Combined via Reciprocal Rank Fusion (RRF)

Persistence Scope

global (default) or project (via CCCMEMORY_DB_MODE=per-project).

State Files

Path Content
~/.cccmemory.db (default) All conversations, decisions, mistakes, working memory, tags, handoffs
~/.claude/projects/<project>/.cccmemory.db Per-project isolated database
~/.claude-memory-config.json Embedding provider config

Memory Categories

From code analysis, the system tracks:

  • Conversations: Indexed session transcripts with chunking
  • Decisions: Extracted architectural decisions
  • Mistakes: Past errors with fixes
  • Working Memory: Keyed fact/decision/context entries with optional TTL
  • Handoffs: Session transition documents
  • Tags: Organizational tags across all memory types

Search Mechanism

hybrid — vector + full-text with RRF re-ranking.

Configurable via environment variables:

  • CCCMEMORY_CHUNKING_ENABLED — Smart chunking (default: true)
  • CCCMEMORY_CHUNK_SIZE — Target 450 tokens (default)
  • CCCMEMORY_RERANK_ENABLED — RRF hybrid (default: true)
  • CCCMEMORY_RERANK_WEIGHT — Vector weight 0.7, FTS 0.3 (default)
  • CCCMEMORY_QUERY_EXPANSION — Synonym expansion (default: false)

Context Compaction Strategy

Partial. The get_startup_context tool fetches relevant context at session start. The prepare_handoff / resume_from_handoff tools provide explicit session boundary management. No automatic compaction hook into Claude Code lifecycle events.

Cross-Session Handoffs

yes — via prepare_handoff (creates handoff doc) + resume_from_handoff (loads it). Also via get_startup_context which auto-queries relevant past context.

Comparison to ccmemory Seed

Dimension cccmemory-mcp ccmemory (seed)
Database SQLite Neo4j
Embedding Transformers.js (local) Ollama (local)
Search Vector + FTS5 (hybrid) Vector + graph traversal
Relationships None (flat) Typed edges (SUPERSEDES, etc.)
Install npm one-liner Docker + docker compose
Lifecycle hooks None SessionStart/Stop/UserPromptSubmit
Cross-tool High (any MCP client) Low (Claude Code only)
07

Orchestration

CCCMemory MCP (xiaolai) — Orchestration

Multi-Agent

No. Single-agent memory system.

Orchestration Pattern

none — Pure infrastructure (MCP server). No agent coordination.

Isolation

none (in-place edits). The database is shared; no per-feature isolation.

Multi-Model

No explicit multi-model routing.

Execution Mode

event-driven — the MCP server responds to tool calls on demand. No daemon, no scheduled tasks beyond indexing.

Crash Recovery

SQLite WAL mode provides crash recovery at the database level.

Notes

CCCMemory is infrastructure, not an orchestration framework. The agent using it decides when and how to call tools.

08

Ui Cli Surface

CCCMemory MCP (xiaolai) — UI & CLI Surface

Dedicated CLI Binary

cccmemory — installed globally via npm. Primary use is as MCP server (cccmemory in MCP config) and version check (cccmemory --version). Also used by Codex CLI via codex mcp add cccmemory -- npx -y cccmemory.

Local Web Dashboard

None visible in repository.

IDE Integration

Configured in:

  • Claude Code: ~/.claude.json (MCP servers section)
  • Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Codex CLI: ~/.codex/config.toml
  • Codex TUI: /mcp command to verify server is active

Observability

SQLite database is directly inspectable. No dedicated log viewer. The list_recent_sessions and memory_stats tools provide basic observability from within the agent.

Multi-platform Installation

Codex-specific install shortcut:

codex mcp add cccmemory -- npx -y cccmemory

Per-project database mode:

export CCCMEMORY_DB_MODE="per-project"

Explicit DB path for sandboxed environments:

export CCCMEMORY_DB_PATH="/path/to/cccmemory.db"

Related frameworks

same archetype · same primary tool · same memory type

MemPalace ★ 53k

Verbatim local-first AI memory with 96.6% R@5 retrieval on LongMemEval using zero API calls — structured into a palace hierarchy…

Beads (Yegge) ★ 24k

Dolt-powered distributed graph issue tracker where AI agents track tasks with hierarchical IDs and dependency edges, claim work…

deepagents (LangChain) ★ 23k

Opinionated Python agent harness on top of LangGraph with sub-agents, filesystem, memory, and context compaction bundled in

agentmemory ★ 18k

Persistent, searchable memory for AI coding agents that captures every tool interaction, compresses it via LLM, and injects…

Open Multi-Agent ★ 6.3k

Give a natural-language goal to a coordinator agent and get a dynamically decomposed, parallelized task DAG executed by…

Basic Memory ★ 3.1k

Gives AI agents a persistent, human-readable knowledge graph of project decisions, observations, and relations stored as plain…