经 AI Skill Hub 精选评估,claude-mem-lite MCP工具 获评「推荐使用」。这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.8 分,适合有一定技术背景的用户使用。
为Claude Code设计的开源MCP工具,提供轻量级持久化记忆能力。采用FTS5全文搜索引擎,支持记忆批量管理,帮助AI助手跨会话保留上下文信息,适合需要长期记忆管理的开发者和Claude集成应用场景。
claude-mem-lite MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
为Claude Code设计的开源MCP工具,提供轻量级持久化记忆能力。采用FTS5全文搜索引擎,支持记忆批量管理,帮助AI助手跨会话保留上下文信息,适合需要长期记忆管理的开发者和Claude集成应用场景。
claude-mem-lite MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/sdsrss/claude-mem-lite
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"claude-mem-lite-mcp--": {
"command": "npx",
"args": ["-y", "claude-mem-lite"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 claude-mem-lite MCP工具 执行以下任务... Claude: [自动调用 claude-mem-lite MCP工具 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"claude-mem-lite_mcp__": {
"command": "npx",
"args": ["-y", "claude-mem-lite"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
claude -p)CLAUDE.md and session startup for immediate contextdecision, bugfix, feature, refactor, discovery, or changeK8s, DB, auth automatically expand to full forms in FTS5 search (100+ pairs including CJK↔EN cross-language mappings)vocab_state table, preventing vector staleness when document frequencies shift. Vectors stay valid until explicit rebuildmem_registry MCP toolresource-discovery.mjs) used by both runtime scanner and offline indexer, supporting flat directories, plugin nesting, and loose .md filesANTHROPIC_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 setlesson_learned field indexed in FTS5 with weight 8, making past debugging insights directly searchablemem_search normalizes scores across observations, sessions, and prompts before merging, preventing any source from dominating results~ paths with Read() guidance; native plugin skills recommend Skill("full:name"); prevents Skill() misuse for managed resources that aren't registered with Claude Code's native handleruser-prompt-search.js and handleUserPrompt coordinate via temp file to prevent duplicate memory injection~/.claude/plugins/cache/<mp>/<plugin>/<ver>/hooks/hooks.json, not from the marketplace source. When install.mjs-managed settings.json hooks coexist with a stale cache hooks.json (e.g. from a previous marketplace install or a plugin auto-update), the runtime registers hooks twice → every session start / user prompt fires twice. install.mjs and hook-update.mjs now clear cache hooks.json in every version dir, and hook.mjs session-start self-heals on every session (gated by hasInstallManagedHooks so plugin-only users are not affected). install.mjs status reports cache pollution state (since v2.31.1/2.31.2).CLAUDE_MEM_MODEL env varALTER TABLE migrations run on every startup, safely adding new columns and indexes without data loss/clear or /exit, then injects context when the next session detects continuation intent via explicit keywords or FTS5 term overlapgit_sha_at_handoff; any handoff matching the current HEAD counts as continuation regardless of TTL. Code state is a stronger continuation signal than wall-clock timegit status + ~/.claude/tasks/*.json + ~/.claude/plans/*.md + most-recent exit handoff + recent event count into a single structured block injected via hookSpecificOutput.additionalContextevents table + FTS5 for non-memdir types (bugfix, lesson, bug, discovery, refactor, feature, observation, decision) that don't compete with WHAT_NOT_TO_SAVE semantics on the observations table. CLI: claude-mem-lite activity save|search|recent|show. Slash commands: /lesson, /bug. hook-llm routes non-memdir summary types through persistHaikuSummary so upgrades from observations→events are atomicmem_update tool modifies existing observations atomically (field update + FTS text rebuild + vector re-computation in one transaction), preserving original IDs and referencesmem_export tool exports observations as JSON or JSONL, with project/type/date filtering and 1000-row pagination cap with batch guidancemem_fts_check tool verifies FTS5 index health or rebuilds indexes on demand, useful after database recovery or when search results seem wrongsaveObservation wraps observations + observation_files + observation_vectors INSERTs in a single db.transaction(), preventing orphaned rows on crashsynonyms.mjs, stop-words.mjs, scoring-sql.mjs, nlp.mjs) for independent testing and maintenanceclaude command available)better-sqlite3, compiled on install)npm install --omit=dev (compiles native better-sqlite3)mem-lite server with 20 tools (9 core exposed via tools/list + 11 hidden-but-callable; see the Usage section for the full table). The pre-v2.78 generic server name mem is renamed to mem-lite for namespace hygiene; the tool names themselves (mem_search, mem_recall, ...) are unchanged.PostToolUse, SessionStart, Stop, UserPromptSubmit lifecycle hooks~/.claude-mem-lite/ (hidden) for database, runtime, and managed resource files~/.claude-mem/ (original claude-mem) or ~/claude-mem-lite/ (pre-v0.5 unhidden) exists, migrates database and runtime files to ~/.claude-mem-lite/, preserving the original untouchedRestart Claude Code after installation to activate.
/plugin install claude-mem-lite # Install / update /plugin uninstall claude-mem-lite # Uninstall
node install.mjs install # Install and configure node install.mjs uninstall # Remove (keep data) node install.mjs uninstall --purge # Remove and delete all data node install.mjs status # Show current status node install.mjs doctor # Diagnose issues node install.mjs cleanup-hooks # Remove only stale claude-mem-lite hooks from settings.json node install.mjs update # Force-check for updates and install them (direct install / npx mode)
npx claude-mem-lite # Install / reinstall npx claude-mem-lite uninstall # Remove (keep data) npx claude-mem-lite doctor # Diagnose issues
Notes:
- Plugin mode only reports available updates; it does not self-update plugin files.
To upgrade an installed plugin to the latest published version, run **inside Claude Code**:
/plugin marketplace update sdsrss /plugin install claude-mem-lite@sdsrss ``` (The first command refreshes the local marketplace clone; the second reinstalls from it. Without the first command, /plugin install reuses the stale local clone and you stay on whichever version you originally pulled.) - Direct install / npx mode keeps auto-update enabled and uses staged replacement with rollback on install failure. - If you disabled the plugin but still have old mem hooks in ~/.claude/settings.json, run node install.mjs cleanup-hooks.
If you see ERR_MODULE_NOT_FOUND on PreToolUse:Read/Edit/Skill hooks, or claude-mem-lite commands crash with import errors, you're likely hit by a partial auto-update — the updater copied new scripts but missed a sibling lib/* file, breaking the hook chain (and the next auto-update that would have healed it).
v2.84.0+ ships a repair subcommand that re-syncs from the latest GitHub release:
claude-mem-lite repair
If repair itself fails (the bin is older than v2.84.0, or the bin is also broken), run this one-liner — it pulls a fresh tarball into a temp dir and runs that tarball's install.mjs, bypassing every file on your disk:
T=$(mktemp -d) && curl -sL https://api.github.com/repos/sdsrss/claude-mem-lite/tarball | tar xz -C "$T" --strip-components=1 && node "$T/install.mjs" install
After it finishes, ~/.claude-mem-lite/ is back in sync with the latest release and claude-mem-lite repair is available for next time.
```bash
/plugin uninstall only removes the plugin manifest — it does not touch ~/.claude/settings.json. If you've ever run claude-mem-lite install (npx or git-clone path), hook entries pointing at ~/.claude-mem-lite/hook.mjs were written into your user-global settings, and they keep firing after /plugin uninstall. If ~/.claude-mem-lite/hook.mjs still exists they double-fire alongside the plugin; if you also ran rm -rf ~/.claude-mem-lite/ they error every session.
The safe sequence is: run claude-mem-lite uninstall first (which cleans the settings.json hooks plus the global MCP registration), then /plugin uninstall claude-mem-lite, then optionally rm -rf ~/.claude-mem-lite/.
If you already uninstalled in the wrong order, claude-mem-lite doctor flags orphan hooks under Orphan hooks: with the exact cleanup command.
| Variable | Description | Default |
|---|---|---|
CLAUDE_MEM_DIR | Custom data directory. All databases, runtime files, and managed resources are stored here. | ~/.claude-mem-lite/ |
CLAUDE_MEM_MODEL | LLM model for background calls (episode extraction, session summaries). Accepts haiku or sonnet. | haiku |
ANTHROPIC_API_KEY | Anthropic API key. When set, all background LLM calls go directly to the Anthropic Messages API (with prompt caching). Highest priority. | _(unset → CLI)_ |
OPENROUTER_API_KEY | OpenRouter API key (OpenAI-compatible). Used for background LLM calls when ANTHROPIC_API_KEY is **not** set. If neither key is set, calls fall back to the claude -p CLI. | _(unset)_ |
OPENROUTER_MODEL | Overrides the OpenRouter model slug for **all** background calls (e.g. openai/gpt-4o-mini, qwen/qwen-2.5-72b-instruct). When unset, the CLAUDE_MEM_MODEL tier maps to anthropic/claude-haiku-4.5 (haiku) or anthropic/claude-sonnet-4.5 (sonnet). | _(tier default)_ |
CLAUDE_MEM_DEBUG | Enable debug logging (1 to enable). | _(disabled)_ |
MEM_QUIET_HOOKS | Low-noise hooks. 1 drops the File Lessons / Key Context sections from SessionStart injection, the lesson suffix from [mem] Related memories, and the WHEN TO USE / Decision rules blocks from MCP server instructions. IDs and the Recent table still surface so mem_get(ids=[…]) remains reachable. Intended for users running the invited-memory adopt path or who otherwise want minimal auto-injection. **Since v2.82.0 this env no longer gates auto-adopt — use MEM_NO_AUTO_ADOPT=1 for that.** | _(disabled)_ |
MEM_NO_AUTO_ADOPT | Global opt-out for auto-adopt (v2.82.0+). 1 prevents the first-SessionStart auto-write of the invited-memory sentinel across **all** projects. For per-project opt-out use claude-mem-lite adopt --disable instead (writes a durable <memdir>/.mem-no-auto-adopt sentinel that survives marker deletion). | _(disabled)_ |
MEM_NO_ADOPT_HINT | Silences the one-line "Invited-memory 未启用:claude-mem-lite adopt…" hint that SessionStart appends when the current project hasn't been adopted. Since v2.82.1 auto-adopt fires on first SessionStart for any install path, so this hint typically surfaces only when you've explicitly opted out (MEM_NO_AUTO_ADOPT=1 or claude-mem-lite adopt --disable). | _(disabled)_ |
mem0 and the MCP memory server are general-purpose LLM memory frameworks designed for any client. claude-mem-lite is purpose-built for Claude Code's hook lifecycle: it captures episodes (batched tool calls), uses domain-specific synonym expansion for code terms (K8s, DB, 数据库, ...), and surfaces past observations proactively before file edits via the PreToolUse:Edit hook.
Only the Haiku summarization step calls Anthropic's API (or the local claude -p CLI if no API key is set). All search, storage, and retrieval is local SQLite — no telemetry, no third-party services.
/plugin marketplace add sdsrss/claude-mem-lite
/plugin install claude-mem-lite
Plugin mode manages its own hooks/runtime. On session start it only checks and reports new claude-mem-lite versions; it does not self-overwrite plugin files in place. Update plugin-mode installs through Claude's plugin workflow.
The plugin install is complete on its own — hooks, MCP tools, and the bundled slash commands (/mem,/lesson,/bug,/adopt) all run from the plugin with no second step. The slash commands invoke the bundled CLI by an absolute path resolved from the plugin directory (${CLAUDE_PLUGIN_ROOT}/cli.mjs <cmd>), so they work without anything on yourPATH. A globalclaude-mem-liteshell command (for running queries yourself in a terminal) is optional —npm i -g claude-mem-lite— and is a separate npm install: the plugin's auto-update does not refresh it, so re-runnpm i -g claude-mem-lite@latestif you want that shell command kept in sync. You do not need it for the plugin to be fully functional.
Auto-adopt fires on the first SessionStart per project (v2.82.1+). The plugin automatically writes the invited-memory sentinel (a system-authority pointer that boosts Claude's proactive use ofmem_recall/mem_save) into the project's memdir — no manual/adoptneeded, regardless of install path (npm, npx,/plugin, manual). Per-project opt-out:claude-mem-lite adopt --disable(--enableto re-arm). Global opt-out:export MEM_NO_AUTO_ADOPT=1. Manual/adoptremains available for re-applying after edits and for the--allbatch path.
1. mem_search(query="auth bug") -> compact ID index
2. mem_timeline(anchor=12345) -> surrounding context
3. mem_get(ids=[12345, 12346]) -> full details
SessionStart
-> Generate session ID (or save handoff snapshot on /clear)
-> Mark stale sessions (>24h active) as abandoned
-> Clean orphaned/stale lock files
-> Query recent observations (24h)
-> Inject context into CLAUDE.md + stdout
PostToolUse (every tool execution)
-> Bash pre-filter skips noise in ~5ms (Read paths tracked to reads file)
-> Detect Bash significance (errors, tests, builds, git, deploys)
-> Accumulate into episode buffer
-> Proactive file history: show past observations for edited files
-> Flush when: buffer full (10 entries) | 5min gap | context change
-> Collect Read file paths into episode on flush
-> Spawn LLM episode worker for significant episodes
-> Error-triggered recall: search memory for related past fixes
UserPromptSubmit (two parallel paths)
-> [user-prompt-search.js] Auto-search memory via FTS5 + active file context
-> [user-prompt-search.js] Inject relevant past observations with recency/importance weighting
-> [user-prompt-search.js] Write injected IDs to temp file for dedup
-> [user-prompt-search.js] L1 skill auto-load: match managed skill names in prompt
-> Load content with portable ~ path + Read() guidance
-> source="managed-skill|managed-agent", path="~/.claude-mem-lite/managed/..."
-> [hook.mjs handleUserPrompt] Capture user prompt text to user_prompts table
-> [hook.mjs handleUserPrompt] Increment session prompt counter
-> [hook.mjs handleUserPrompt] Handoff: detect continuation intent → inject previous session context
-> [hook.mjs handleUserPrompt] Semantic memory injection (hook-memory.mjs), deduped via temp file
Stop
-> Flush final episode buffer
-> Save handoff snapshot (on /exit)
-> Mark session completed
-> Spawn LLM summary worker (poll-based wait)
/plugin uninstall claude-mem-lite
| claude-mem (original) | claude-mem-lite | |
|---|---|---|
| **LLM calls** | Every tool use triggers a Sonnet call | Only on episode flush (5-10 ops batched) |
| **LLM input** | Raw tool_input + tool_output JSON | Pre-processed action summaries |
| **Conversation** | Multi-turn, accumulates full history | Stateless single-turn extraction |
| **Noise filtering** | LLM decides via "WHEN TO SKIP" prompt | Deterministic code-level Tier 1 filter |
| **Runtime** | Long-running worker process (1.8MB .cjs) | On-demand spawn, exits immediately |
| **Dependencies** | Bun + Python/uv + Chroma vector DB | Node.js only (3 npm packages) |
| **Source size** | ~2.3MB compiled bundles | ~50KB readable source |
| **Data directory** | ~/.claude-mem/ | ~/.claude-mem-lite/ (hidden, auto-migrates) |
| Dimension | Winner | Why |
|---|---|---|
| **Classification accuracy** | Tie | Both produce correct type/title/narrative |
| **Noise filtering** | **lite** | Code-level filtering is deterministic; LLM "WHEN TO SKIP" is unreliable |
| **Observation coherence** | **lite** | Episode batching groups related edits into one coherent observation |
| **Code-level detail** | original | Sees full diffs, but rarely useful for memory search |
| **Search recall** | Tie | Users search semantic concepts ("auth bug"), not code lines |
| **Hook latency** | **lite** | Async background workers; original blocks 2-5s per hook |
How claude-mem-lite differs from the major neighbors in the LLM-memory space (verified May 2026):
| **claude-mem-lite** | [mem0](https://github.com/mem0ai/mem0) | MCP reference [memory](https://github.com/modelcontextprotocol/servers/tree/main/src/memory) | [claude-mem](https://github.com/thedotmack/claude-mem) (original) | |
|---|---|---|---|---|
| **Target client** | Claude Code only | Any LLM app via SDK | Any MCP client | Claude Code only |
| **Capture model** | Auto via hooks | Manual memory.add() | Manual tool calls (create_entities, add_observations) | Auto via hooks |
| **Code-aware retrieval** | FTS5 + 100+ synonym pairs (incl. CJK↔EN) | General-purpose | Generic graph nodes | Code-aware |
| **Search** | Hybrid: FTS5 BM25 + TF-IDF cosine via RRF | Hybrid: semantic + BM25 + entity linking | Knowledge-graph traversal | FTS5 + Chroma vector |
| **Storage** | Single local SQLite | Pluggable; Qdrant or configurable vector store | Single JSONL file (knowledge graph) | SQLite + Chroma |
| **LLM dependency** | Haiku per episode (5–10 ops batched) | LLM per add/search op | None (graph CRUD only) | Sonnet per tool call |
| **Setup** | One command (/plugin install or npx) | SDK integration + vector store config | MCP 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.
Claude Code 怎么跨会话记住内容? 默认不能。claude-mem-lite 通过 MCP 协议和钩子自动把决策、bug 修复、文件历史持久化到本地 SQLite,下次会话开始时再注入。
和 mem0、官方 MCP memory server 有什么区别? 那两个是通用 LLM 记忆框架;claude-mem-lite 是为 Claude Code 钩子生命周期定制的:批量 episode 处理、代码领域同义词扩展(K8s/DB/数据库等)、文件编辑前主动召回相关历史。
支持中文吗? 完整支持。FTS5 + 中英文同义词扩展(100+ 对,含 CJK ↔ EN 跨语言映射),中文记忆也可用英文关键词召回,反之亦然。
claude-mem-lite 是一个专为 Claude Code 设计的轻量化记忆增强插件。它通过集成 MCP 协议,能够自动记录并持久化开发过程中的关键决策、Bug 修复记录及文件变更历史,为开发者提供跨会话的上下文感知能力,让 Claude 能够“记住”之前的开发细节。
本项目具备自动捕获功能,通过挂钩 Claude Code 的生命周期(如 PostToolUse、SessionStart 等)实现无感记录。��心采用混合搜索技术,结合 FTS5 BM25 关键词匹配与 TF-IDF 向量语义相似度,并通过 Reciprocal Rank Fusion (RRF) 算法进行重排序,确保在处理代码术语时既能精准匹配,又能实现语义层面的召回。此外,还支持 Timeline 浏览功能,方便回溯开发轨迹。
运行本项目需要 Node.js >= 18 环境,并且必须已安装并配置好 Claude Code CLI(确保 `claude` 命令可用)。后端存储依赖 SQLite3,系统将在安装时通过 `better-sqlite3` 进行本地编译。目前平台支持 Linux 或 macOS 系统。
推荐使用 Claude Code 内置的插件管理命令进行安装。通过执行 `/plugin install claude-mem-lite` 即可完成安装与 MCP server 的注册。安装过程会自动处理依赖并编译原生模块。若需卸载,可使用 `/plugin uninstall claude-mem-lite`。请注意,安装后会注册一个名为 `mem-lite` 的 MCP server,包含 20 个工具供调用。
安装完成后,插件将作为 MCP server 运行。你可以通过特定的工具指令进行交互,例如使用 `mem_search` 进行语义搜索,或使用 `mem_timeline` 查看特定时间点的上下文。对于高级用户,可以通过查询 ID 索引来获取完整的开发细节,实现高效的记忆检索与���下文注入。
用户可以通过环境变量对插件进行自定义配置。`CLAUDE_MEM_DIR` 用于指定自定义的数据存储目录,所有的数据库文件和运行时资源都将保存在此处(默认路径为 `~/.claude-mem-lite/`)。`CLAUDE_MEM_MODEL` 则用于指定执行后台任务(如 episode 提取和会话摘要)时使用的 LLM 模型,支持 `haiku` 或 `sonnet`。
与通用的 `mem0` 或 MCP `memory` server 不同,claude-mem-lite 是为 Claude Code 的钩子生命周期深度定制的。它采用特殊的 episode 批量处理机制,并针对代码领域进行了同义词扩展(如 K8s、DB 等)。在隐私方面,除了摘要步骤会调用 Anthropic 的 API 外,所有的搜索、存储与检索操作均在本地 SQLite 中完成,确保数据安全且无第三方遥测。
插件采用插件市场模式(Plugin Marketplace)进行管理,确保版本更新的安全。其核心工作流包含 Hook Pipeline:在 SessionStart 时生成会话 ID 并查询近期观察结果以注入上下文;在 PostToolUse 时记录工具执行细节。搜索工作流则通过 `mem_search` 建立索引,配合 `mem_timeline` 实现上下文的精准定位与召回。
针对常见问题:Claude Code 默认无法跨会话记忆,但本项目通过 MCP 协议将决策和历史持久化到本地 SQLite,并在新会话开始时自动注入上下文。相比通用框架,它更擅长处理代码领域的语义扩展(如中英文术语转换)。本项目完整支持中文,通过 FTS5 与中英文同义词扩展,能够精准处理 CJK 与英文的混合检索需求。
创新的轻量级记忆解决方案,FTS5搜索能力强劲,架构简洁高效。Star数量适中但技术方案先进,非常适合Claude生态集成应用。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
AI Skill Hub 点评:claude-mem-lite MCP工具 的核心功能完整,质量良好。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | claude-mem-lite |
| 原始描述 | 开源MCP工具:Lightweight persistent memory system for Claude Code — FTS5 search, episode batc。⭐43 · JavaScript |
| Topics | ClaudeMCP工具记忆系统FTS5搜索持久化 |
| GitHub | https://github.com/sdsrss/claude-mem-lite |
| License | MIT |
| 语言 | JavaScript |
收录时间:2026-05-18 · 更新时间:2026-05-19 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端