claude-memory

claude-memory

A persistent semantic memory system for Claude Code, using vector search and a judgment ledger to surface prior decisions and calibrate predictions.

Category
Visit Server

README

claude-memory

A persistent, semantic memory system for Claude Code, exposed as an MCP server. Instead of re-reading flat markdown files each session, Claude searches a vector database by meaning — surfacing prior decisions, evolved thinking, and relevant context automatically.

It also includes a judgment ledger: log predictions and assessments, resolve them later against reality, and generate calibration patterns and bias maps so the assistant learns where your judgment is systematically off.

How it works

  • StorageChromaDB vector store on disk (./chroma_db).
  • Embeddings — OpenAI (text-embedding-3 family) for semantic similarity.
  • Synthesis — Anthropic Claude for context briefs, consolidation, calibration, and bias maps.
  • Retrieval — memories are ranked by relevance × salience, so important context surfaces first.

Memories are typed: episodic (events/decisions), semantic (extracted patterns, usually written by consolidation), user (facts about you), feedback (how to work with you), project (ongoing initiatives), reference (pointers to external systems).

Tools

Memory

  • search_memory — semantic search over all memories
  • save_memory — persist a decision, insight, or piece of context
  • get_context_brief — Claude-synthesized brief on a topic (what's known, how thinking evolved, what to challenge)
  • get_related — memories related to a given one
  • consolidate — extract durable semantic patterns from recent episodes
  • list_memories, memory_stats — inspect the store

Judgment ledger

  • log_assessment — record a prediction with confidence, horizon, and reasoning
  • list_pending_assessments — assessments awaiting resolution
  • resolve_assessment — score what actually happened (right / partial / wrong)
  • generate_calibration — extract a calibration pattern for a domain (needs 3+ resolved)
  • get_bias_map — cross-domain map of where judgment is strong vs. poor

Setup

Requires Python 3.12+.

git clone https://github.com/allenc84/claude-memory.git
cd claude-memory
python3.12 -m venv venv
./venv/bin/pip install -r requirements.txt
cp .env.example .env   # then edit .env

Set your keys and persona in .env (see .env.example):

MEMORY_USER_CONTEXT="Jane Doe, founder of Acme"
OPENAI_API_KEY=sk-proj-...
ANTHROPIC_API_KEY=sk-ant-...

On macOS, run_server.sh reads the API keys from the Keychain if present, falling back to .env:

security add-generic-password -U -s "OPENAI_API_KEY"    -a "claude-memory" -w 'sk-proj-...'
security add-generic-password -U -s "ANTHROPIC_API_KEY" -a "claude-memory" -w 'sk-ant-...'

Pass the key as the -w argument, not via the interactive prompt — the prompt truncates at 128 characters and silently corrupts longer keys.

Wire into Claude Code

Add to your MCP config (e.g. ~/.claude.json or project .mcp.json):

{
  "mcpServers": {
    "claude-memory": {
      "command": "/absolute/path/to/claude-memory/run_server.sh"
    }
  }
}

Restart Claude Code. The server caches keys and config at launch, so restart after changing either.

The /log command

.claude/commands/log.md provides a /log slash command for the judgment ledger — logging, reviewing, resolving, and generating calibrations/bias maps in natural language. Copy it into your project's .claude/commands/ to use it.

Automation (optional)

  • run_consolidate.sh — nightly: extract semantic patterns from recent episodes. Schedule via cron/launchd.
  • run_weekly_review.sh — weekly judgment-ledger review; designed to be triggered from a Claude Code Stop hook.

Migrating existing markdown memories

To import legacy flat-file memories into the vector store:

MEMORY_MIGRATE_DIR="$HOME/path/to/memory" ./venv/bin/python migrate.py

License

MIT — see LICENSE.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured