经 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 生效
hooks/hooks.json) to record observations without manual effort--deep still fuses multiple LLM-rewritten queries with Reciprocal Rank Fusionclaude -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)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 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 resultsuser-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/exit, then injects context when the next session detects continuation intent via explicit keywords or FTS5 term overlap. The /clear and /compact arm fires since v5.4.0 (R10-P1-1); before that it had never once written a row — session_handoffs on the maintainer's install held 4 exit rows and 0 clear rows. Two host facts settled it, both measured rather than assumed. (1) Stop runs at the end of every assistant turn, not once per session, and it deleted the session file that SessionStart reads to learn which session just ended — so the branch was unreachable, and mem sessions were minted per turn (58 prompts over 16 host sessions produced 56 mem sessions and 56 summary rows, 2026-09-07). (2) Claude Code rotates its session id across /clear: of 21 real transcripts, 12 carry a /clear command record, and in 12/12 that record's timestamp precedes its own file's first record by ~0.1s — the command is issued in the old session and replayed into a new file under a new id. So Stop no longer deletes the file, SessionStart asks the host's source (startup/clear/compact/resume) instead of guessing from the file, and the handoff's prompt lookup falls back to the unscoped set when the new session's id matches none. Revert path: CLAUDE_MEM_LEGACY_STOP_UNLINK=1git_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. hook-llm routes non-memdir summary types through persistHaikuSummary so upgrades from observations→events are atomic. (v3.39: the /lesson and /bug slash commands were redirected from this events table to searchable observations — mem_search never read the events table, so explicit saves were unfindable; the events table remains the auto-capture activity log.)mem_update tool modifies existing observations atomically (field update + FTS text rebuild 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 the observations + observation_files 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 13, which ships prebuilt binaries for 8 platforms — no compiler needed on any of them; a platform it has no prebuild for falls back to building from source)npm install --omit=dev (compiles native better-sqlite3)mem-lite server with 18 tools (9 core exposed via tools/list + 9 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.SessionStart, PreCompact, PreToolUse, PostToolUse, PostToolUseFailure, Stop, UserPromptSubmit~/.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`.
#### Trust model per install path
The three install paths do **not** carry the same supply-chain guarantees — pick the one that matches your threat model:
| Path | Update mechanism | Ed25519 release-signature verification |
|------|------------------|----------------------------------------|
| npm / npx / git-clone direct install | auto-update from GitHub Releases | **Yes** — every runtime file (140 entries incl. hook scripts, MCP launcher, plugin declaration files) is hash-pinned in a signed manifest; verification is fail-closed |
| `/plugin install` (marketplace) | manual `/plugin marketplace update` + reinstall | **No** — Claude Code installs from a git clone of the marketplace repo; the plugin's own signature chain is not consulted on this path. You are trusting GitHub + the repo's branch protection, not the release signing key |
**Rollback recipe (plugin path).** If an update misbehaves, pin the marketplace clone to the previous release tag and reinstall from it:
bash
If you see ERR_MODULE_NOT_FOUND on PreToolUse:Read/Edit 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) && U=$(curl -sL https://api.github.com/repos/sdsrss/claude-mem-lite/releases/latest | grep -o '"tarball_url"[^,]*' | cut -d'"' -f4) && curl -sL "$U" | tar xz -C "$T" --strip-components=1 && node "$T/install.mjs" install
It resolves the latest release tag first. A shell one-liner cannot verify the release signature the way repair does, so running it is a trust decision you are making explicitly — that is why it is the last resort and not the first suggestion.
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.
Every environment variable the shipped code reads is listed below, grouped by what it controls. Booleans accept 1 unless noted. Anything not listed here is not read by claude-mem-lite.
/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 writes into your project, on every SessionStart (v3.13+). The plugin adds a slug-scoped managed block to your project's own<cwd>/CLAUDE.md— a file that is normally committed to git — plus a<cwd>/.claude/plugin_claude_mem_lite.mddetail file. The block is a system-authority pointer that boosts Claude's proactive use ofmem_recall/mem_save. Everything outside the block is preserved verbatim, and it coexists with other plugins' blocks in the same file (details). This happens on every SessionStart, not just the first: the sync is idempotent and re-applies the block if it is edited away, and refreshes it when the shipped template changes. It applies regardless of install path (npm, npx,/plugin, manual), so no manual/adoptis needed. Opt out per project withclaude-mem-lite adopt --disable(--enableto re-arm), globally withexport MEM_NO_AUTO_ADOPT=1, or freeze an already-adopted block against template refreshes withCLAUDE_MEM_NO_TEMPLATE_REFRESH=1.claude-mem-lite unadoptremoves the block and the detail file. 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
-> Read the host's `source` (startup | clear | compact | resume) from stdin
-> On clear/compact: read the outgoing session from the session file, save its
'clear' handoff, emit the Working State block (R10-P1-1, fixed v5.4.0)
-> Generate session ID (overwrites the session file)
-> 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
-> [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 (type 'exit')
-> Mark session completed
-> Spawn LLM summary worker (poll-based wait)
-> Keep the session file <- Stop fires per TURN; deleting it here re-minted a mem
session every turn and left the SessionStart /clear branch unreachable (v5.4.0)
/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** | FTS5 BM25 + query expansion (PRF, concept co-occurrence) | 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-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 类型,复制安装指令后粘贴到对应客户端