Skip to content
Development
MCP

mem-lite

Ships with claude-mem-lite: claude-mem-lite is a persistent memory (also called long-term memory or cross-session context) system for Claude Code — Anthropic's CLI coding agent.

From plugin
claude-mem-lite
688 commands7 hooks1 MCP

Claude Code

> /plugin marketplace add sdsrss/claude-mem-lite
> /plugin install claude-mem-lite@sdsrss

From the README

What can you do with mem-lite?

  • Automatic capture -- Hooks into the Claude Code lifecycle (SessionStart, PreCompact, PreToolUse, PostToolUse,…

  • Lexical search with query expansion -- FTS5 BM25 scoring, an AND-OR rescue pass, pseudo-relevance feedback and concept…

  • Timeline browsing -- Navigate observations chronologically with anchor-based context windows

  • Episode batching -- Groups related file operations into coherent episodes before LLM encoding

  • Error-triggered recall -- Automatically searches memory when Bash errors occur, surfacing relevant past fixes

  • Proactive file history -- When editing a file, automatically shows relevant past observations for that file

  • Session summaries -- written at every Stop (the assistant's final report when it has Done / Not done sections, else —…

  • Project-scoped context -- Injects recent memory into CLAUDE.md and session startup for immediate context

Security report

Info

Not enough data

  • Known flaws

    Not published

  • Signed build

    Not published

  • Maintained

    Oct 29, 2026

    Last push

  • Licence

    MIT

  • Runs as

    Local process

    On your machine

  • Deprecated

    Not published

Signals from public registries, not an audit. Checked Nov 11, 2026.

claude-mem-lite README

English | 中文

claude-mem-lite

claude-mem-lite is a persistent memory (also called long-term memory or cross-session context) system for Claude Code — Anthropic's CLI coding agent. It runs as an MCP server plus a set of Claude Code hooks, automatically capturing coding observations, decisions, and bug fixes during sessions, then providing full-text search with query expansion to recall them later.

Compared to general-purpose LLM memory frameworks like mem0 or the MCP reference memory server, claude-mem-lite is purpose-built for Claude Code's hook lifecycle: episode batching cuts LLM calls 7–10× vs the original claude-mem (an estimated ~600× lower total cost — see the cost model below; this is an architecture estimate, not a measured benchmark), while the FTS5 retriever benchmarks at 0.90 Recall@10 / 0.85 Precision@10 (see Search Quality for the reproduction command).

中文简介:claude-mem-lite 是 Claude Code 的轻量级持久化记忆 / 长期记忆 / 跨会话上下文插件,基于 MCP 协议 + 钩子机制,自动捕获编码会话中的决策、修复和上下文,并通过 FTS5 全文检索召回。详见 中文 README。

Zero external services. Single SQLite database. Minimal overhead.

Why claude-mem-lite?

A ground-up redesign of claude-mem, replacing its heavyweight architecture with a smarter, leaner approach.

Architecture comparison

claude-mem (original)claude-mem-lite
LLM callsEvery tool use triggers a Sonnet callOnly on episode flush (5-10 ops batched)
LLM inputRaw tool_input + tool_output JSONPre-processed action summaries
ConversationMulti-turn, accumulates full historyStateless single-turn extraction
Noise filteringLLM decides via "WHEN TO SKIP" promptDeterministic code-level Tier 1 filter
RuntimeLong-running worker process (1.8MB .cjs)On-demand spawn, exits immediately
DependenciesBun + Python/uv + Chroma vector DBNode.js only (3 npm packages)
Source size~2.3MB compiled bundles~50KB readable source
Data directory~/.claude-mem/~/.claude-mem-lite/ (hidden, auto-migrates)

Token & cost efficiency

For a typical 50-tool-call session (illustrative cost model — the ratios below are architecture estimates derived from batch size, token counts, and model pricing, not a measured end-to-end benchmark):

claude-memclaude-mem-liteRatio (estimated)
LLM calls~50 (every tool use)~5-8 (per episode)~7-10x fewer
Tokens per call1,000-5,000 (raw JSON + history)200-500 (summaries only)~5-10x smaller
Total tokens~100K-250K~1K-4K~50-100x less
Model costSonnet ($3/$15 per M)Haiku ($0.25/$1.25 per M)~12x cheaper
Combined savings~600x lower cost (estimated)

Quality comparison

DimensionWinnerWhy
Classification accuracyTieBoth produce correct type/title/narrative
Noise filteringliteCode-level filtering is deterministic; LLM "WHEN TO SKIP" is unreliable
Observation coherenceliteEpisode batching groups related edits into one coherent observation
Code-level detailoriginalSees full diffs, but rarely useful for memory search
Search recallTieUsers search semantic concepts ("auth bug"), not code lines
Hook latencyliteAsync background workers; original blocks 2-5s per hook

Design philosophy

The original sends everything to the LLM and hopes it filters well. claude-mem-lite filters first with code, then sends only what matters to a smaller model. This is not a downgrade; it's a smarter architecture that produces equivalent search quality at a fraction of the cost.

Comparison: memory systems for AI coding agents

How claude-mem-lite differs from the major neighbors in the LLM-memory space (verified May 2026):

claude-mem-litemem0MCP reference memoryclaude-mem (original)
Target clientClaude Code onlyAny LLM app via SDKAny MCP clientClaude Code only
Capture modelAuto via hooksManual memory.add()Manual tool calls (create_entities, add_observations)Auto via hooks
Code-aware retrievalFTS5 + 100+ synonym pairs (incl. CJK↔EN)General-purposeGeneric graph nodesCode-aware
SearchFTS5 BM25 + query expansion (PRF, concept co-occurrence)Hybrid: semantic + BM25 + entity linkingKnowledge-graph traversalFTS5 + Chroma vector
StorageSingle local SQLitePluggable; Qdrant or configurable vector storeSingle JSONL file (knowledge graph)SQLite + Chroma
LLM dependencyHaiku per episode (5–10 ops batched)LLM per add/search opNone (graph CRUD only)Sonnet per tool call
SetupOne command (/plugin install or npx)SDK integration + vector store configMCP install (per-client)Bun + Python + Chroma

When to pick which: pick mem0 if you need a memory layer for a non-Claude-Code app (your own agent, multiple LLM providers). Pick the MCP reference memory server if you specifically want a knowledge-graph data model and don't mind invoking memory tools by hand. Pick claude-mem-lite if you want zero-touch automatic capture purpose-built for Claude Code's hook lifecycle, with code-domain retrieval and no external services.

Features

  • Automatic capture -- Hooks into the Claude Code lifecycle (SessionStart, PreCompact, PreToolUse, PostToolUse, PostToolUseFailure, Stop, UserPromptSubmit — the seven events in hooks/hooks.json) to record observations without manual effort
  • Lexical search with query expansion -- FTS5 BM25 scoring, an AND->OR rescue pass, pseudo-relevance feedback and concept co-occurrence. A TF-IDF vector arm shipped alongside it until it was measured net-negative and removed; --deep still fuses multiple LLM-rewritten queries with Reciprocal Rank Fusion
  • Timeline browsing -- Navigate observations chronologically with anchor-based context windows
  • Episode batching -- Groups related file operations into coherent episodes before LLM encoding
  • Error-triggered recall -- Automatically searches memory when Bash errors occur, surfacing relevant past fixes
  • Proactive file history -- When editing a file, automatically shows relevant past observations for that file
  • Session summaries -- written at every Stop (the assistant's final report when it has Done / Not done sections, else — when the final reply has no report section at all — its first 120 characters, else the first prompt and recent observation titles), then upgraded by a background model summary when the session has observations
  • Project-scoped context -- Injects recent memory into CLAUDE.md and session startup for immediate context
  • Observation types -- Categorized as decision, bugfix, feature, refactor, discovery, or change
  • Importance grading -- LLM assigns 1-3 importance levels (routine / notable / critical) to each observation
  • Observation relations -- Bidirectional links between related observations based on file overlap
  • User prompt capture -- Records user prompts via UserPromptSubmit hook for intent tracking
  • Read file tracking -- Tracks files read during sessions for richer episode context
  • Degraded fallback when the LLM fails -- An episode that fixed an error is saved with inferred metadata (as an activity event) instead of being discarded, when a command that exited 0 printed the error (npm test 2>&1 | tail): a command Claude Code reports as failed does not enter the episode, so a fix that follows one counts as edit-only. An edit-only episode, config and schema changes included, is summarised from raw tool output, which the noise rules drop in most cases (Modified a.js, b.js with no lesson; only a short single-file summary survives) — as they do when the model answers without a lesson — so a failing provider loses those episodes unless CLAUDE_MEM_KEEP_LOW_SIGNAL=1 is set; claude-mem-lite doctor warns when the claude CLI it would call does not resolve
  • Two-tier dedup -- Jaccard similarity (5-minute window) + MinHash signatures (7-day cross-session window) prevent duplicates
  • Synonym expansion -- Abbreviations like K8s, DB, auth automatically expand to full forms in FTS5 search (100+ pairs including CJK↔EN cross-language mappings)
  • CJK synonym extraction -- Unsegmented Chinese text is scanned for known vocabulary words (数据库→database, 搜索→search, etc.) enabling cross-language memory recall
  • Stop-word filtering -- English stop words filtered from FTS queries, preventing false negatives from noise terms like "how", "the", "does"
  • Pseudo-relevance feedback (PRF) -- Top results seed expansion queries for broader recall
  • Concept co-occurrence -- Shared concepts across observations expand search to related topics
  • Context-aware re-ranking -- Active file overlap boosts relevance (exact match + directory-level half-weight)
  • Superseded detection -- Marks older observations as outdated when newer ones cover the same files with higher importance
  • Adaptive time windows -- Session startup recall uses velocity-based time windows (high/medium/low activity tiers)
  • Token-budgeted context -- Greedy knapsack algorithm selects session-start context within a 2,000-token budget, prioritizing by recency and importance
  • Observation compression -- Old low-value observations can be compressed into weekly summaries to reduce noise
  • Secret scrubbing -- Automatic redaction of API keys, tokens, PEM blocks, connection strings, and 15+ credential patterns
  • Atomic writes -- All file writes (episodes, CLAUDE.md) use write-to-tmp + rename to prevent corruption on crash
  • Robust locking -- PID-aware lock files with automatic stale/orphan cleanup (>30s timeout or dead PID)
  • Stale session cleanup -- Sessions active for >24h are automatically marked as abandoned on next start
  • Domain synonym expansion -- Search queries expand to domain synonyms (e.g., "fix" → debug, bugfix, troubleshoot, diagnose, repair)
  • Multi-provider LLM mode -- Provider priority ANTHROPIC_API_KEY (direct Anthropic API) → OPENROUTER_API_KEY (OpenRouter, OpenAI-compatible — point it at any model via OPENROUTER_MODEL) → claude -p CLI fallback when no key is set
  • Lesson-learned indexing -- lesson_learned field indexed in FTS5 with weight 8, making past debugging insights directly searchable
  • Cross-source normalization -- mem_search normalizes scores across observations, sessions, and prompts before merging, preventing any source from dominating results
  • Exponential recency decay -- Type-differentiated half-lives (decisions: 90d, discoveries: 60d, bugfixes: 14d, changes: 7d) consistently applied in all ranking paths
  • Prompt-time memory injection -- UserPromptSubmit hook automatically searches and injects relevant past observations with recency and importance weighting
  • Dual injection dedup -- user-prompt-search.js and handleUserPrompt coordinate via temp file to prevent duplicate memory injection

Stars on GitHub

Momentum

stars in total
68
Star history of sdsrss/claude-mem-lite on GitHub, a chart by star-history.com

More MCP servers from other plugins.

chrome-devtools
Auto-invoked

chrome-devtools

MCP

Connects to Chrome over the DevTools Protocol to inspect the DOM, network requests and console output.

ecc12d293k
@affaan-m@affaan-mInstall MCP
supabase

supabase

MCP

Queries a Supabase project: Postgres tables, auth users, storage and edge functions.

supabase11d114k
@supabase@supabaseInstall MCP

Questions about mem-lite.

Which coding agents can use mem-lite?
mem-lite works in any agent that reads an MCP config file: Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf. Each agent reads it from its own file; this page names the file for each one.
How do I add mem-lite to Claude Code?
Run these in order, one at a time. 1. In Claude Code: /plugin marketplace add sdsrss/claude-mem-lite 2. In Claude Code: /plugin install claude-mem-lite@sdsrss