能力标签
claude-mem-lite MCP工具
🔌
MCP工具

claude-mem-lite MCP工具

基于 JavaScript · 让 AI 助手直接操作你的系统与工具
英文名:claude-mem-lite
⭐ 43 Stars 🍴 2 Forks 💻 JavaScript 📄 MIT 🏷 AI 7.8分
7.8AI 综合评分
ClaudeMCP工具记忆系统FTS5搜索持久化
✦ AI Skill Hub 推荐

经 AI Skill Hub 精选评估,claude-mem-lite MCP工具 获评「推荐使用」。这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.8 分,适合有一定技术背景的用户使用。

📚 深度解析

claude-mem-lite MCP工具 是一款基于 MCP(Model Context Protocol)标准协议的 AI 工具扩展。MCP 协议由 Anthropic 开发并开源,旨在建立 AI 模型与外部工具之间的标准化通信接口,目前已被 Claude Desktop、Claude Code、Cursor 等主流 AI 工具采纳。

通过安装 claude-mem-lite MCP工具,你的 AI 助手将获得额外的工具调用能力,可以用自然语言直接操控该工具的功能,无需学习复杂的命令行语法。MCP 工具的核心价值在于"一次配置,永久增强"——配置完成后,每次与 AI 对话时都可以无缝调用这些工具。

在技术实现上,MCP 工具通过标准的 JSON-RPC 协议与 AI 客户端通信,工具的功能以"工具列表"的形式暴露给 AI 模型,AI 可以按需调用。claude-mem-lite MCP工具 提供了结构化的工具调用接口,使 AI 模型能够精确地理解和使用每个功能点,显著降低 AI 在工具使用上的错误率。

与传统的 API 集成相比,MCP 工具的优势在于无需编写代码——用户只需在配置文件中添加几行 JSON,即可让 AI 获得全新能力。AI Skill Hub 将 claude-mem-lite 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 对话中直接触发,极大提升生产效率。

GitHub Stars
⭐ 43
开发语言
JavaScript
支持平台
Windows / macOS / Linux
维护状态
轻量级项目,按需更新
开源协议
MIT
AI 综合评分
7.8 分
工具类型
MCP工具
Forks
2

📖 中文文档

以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

为Claude Code设计的开源MCP工具,提供轻量级持久化记忆能力。采用FTS5全文搜索引擎,支持记忆批量管理,帮助AI助手跨会话保留上下文信息,适合需要长期记忆管理的开发者和Claude集成应用场景。

claude-mem-lite MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。

📌 核心特色
  • 通过标准 MCP 协议与 Claude、Cursor 等主流 AI 客户端深度集成
  • 提供结构化工具调用接口,显著降低 AI 集成复杂度
  • 支持 Claude Desktop 和 Claude Code 无缝接入,开箱即用
  • 可与其他 MCP 工具组合叠加,构建完整 AI 工作站
  • 轻量无侵入设计,不影响现有系统架构
🎯 主要使用场景
  • 在 Claude Desktop 对话中直接调用本地工具,实现 AI 与系统的深度联动
  • 通过自然语言驱动复杂的多步骤自动化任务,代替繁琐手动操作
  • 将多个 MCP 工具组合使用,构建个人专属 AI 工作站
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一:通过 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
📋 安装步骤说明
  1. 确认已安装 Node.js(v18 或以上版本)
  2. 打开 Claude Desktop 或 Claude Code 的 MCP 配置文件
  3. 按「交给 Agent 安装 → Claude Desktop」标签中的 JSON 配置填入 mcpServers 字段
  4. 保存配置文件并重启 Claude 客户端
  5. 重启后,在对话中即可使用本工具
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 安装后在 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 生效
📑 README 深度解析 真实文档 完整度 75/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

简介

English | 中文

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 -- LLM-generated summaries at session end (via background workers using claude -p)
  • 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
  • Zero data loss -- If LLM fails, observations are saved with degraded (inferred) metadata instead of being discarded
  • 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
  • Plugin cache hook self-heal -- Claude Code runtime reads plugin hooks from ~/.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).
  • Result-dedup cooldown -- User-prompt memory injection uses result-overlap detection (>80% ID overlap → skip) instead of time-based cooldown, allowing topic switches within seconds while preventing redundant injections
  • OR query fallback -- When AND-joined FTS5 queries return zero results, automatically relaxes to OR-joined queries for broader recall (applied in both user-prompt-search and hook-memory paths)
  • Configurable LLM model -- Switch between Haiku (fast/cheap) and Sonnet (deeper analysis) via CLAUDE_MEM_MODEL env var
  • DB auto-recovery -- Detects and cleans corrupted WAL/SHM files on startup; periodic WAL checkpoints prevent unbounded growth
  • Schema auto-migration -- Idempotent ALTER TABLE migrations run on every startup, safely adding new columns and indexes without data loss
  • LLM concurrency control -- File-based semaphore limits background workers to 2 concurrent LLM calls, preventing resource contention
  • stdin overflow protection -- Hook input truncated at 256KB with regex-based action salvage for oversized tool outputs
  • Cross-session handoff -- Captures session state (request, completed work, next steps, key files) on /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=1
  • Git-SHA continuation anchor (v2.31.0) -- Handoff rows include git_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 time
  • Startup dashboard (v2.31.0) -- SessionStart hook aggregates git status + ~/.claude/tasks/*.json + ~/.claude/plans/*.md + most-recent exit handoff + recent event count into a single structured block injected via hookSpecificOutput.additionalContext
  • Activity namespace (v2.31.0) -- Dedicated events 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 observationsmem_search never read the events table, so explicit saves were unfindable; the events table remains the auto-capture activity log.)
  • In-place observation updates -- mem_update tool modifies existing observations atomically (field update + FTS text rebuild in one transaction), preserving original IDs and references
  • Bulk export -- mem_export tool exports observations as JSON or JSONL, with project/type/date filtering and 1000-row pagination cap with batch guidance
  • FTS integrity management -- mem_fts_check tool verifies FTS5 index health or rebuilds indexes on demand, useful after database recovery or when search results seem wrong
  • Atomic multi-table writes -- saveObservation wraps the observations + observation_files INSERTs in a single db.transaction(), preventing orphaned rows on crash
  • Modular NLP pipeline -- Synonym maps, stop words, scoring constants, and query building extracted into focused modules (synonyms.mjs, stop-words.mjs, scoring-sql.mjs, nlp.mjs) for independent testing and maintenance
  • Porter-aligned PRF -- Pseudo-relevance feedback terms are now stemmed with the same Porter algorithm used by FTS5, ensuring PRF expansion terms match the search index

Requirements

  • Node.js >= 22
  • Claude Code CLI installed and configured (claude command available)
  • SQLite3 support (provided by 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)
  • Platform: Linux or macOS; Windows installs and runs but is not CI-covered and needs Git Bash or WSL for three hooks (see Platform Support)

Installation

What happens during installation

  1. Install dependencies -- npm install --omit=dev (compiles native better-sqlite3)
  2. Register MCP server -- 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.
  3. Configure hooks -- all seven lifecycle events: SessionStart, PreCompact, PreToolUse, PostToolUse, PostToolUseFailure, Stop, UserPromptSubmit
  4. Create data directory -- ~/.claude-mem-lite/ (hidden) for database, runtime, and managed resource files
  5. Auto-migrate -- If ~/.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 untouched
  6. Initialize database -- SQLite with WAL mode, FTS5 indexes created on first server start

Restart Claude Code after installation to activate.

Plugin install:

/plugin install claude-mem-lite # Install / update /plugin uninstall claude-mem-lite # Uninstall

git clone install:

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 install:

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

3. Reinstall from the pinned clone — inside Claude Code:

/plugin install claude-mem-lite@sdsrss

Recovery (stuck install / hook errors)

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.

Uninstall

```bash

Mixed-install residue (read this if you've used multiple install methods)

/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.

Usage

Environment Variables

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.

Efficient Search Workflow

1. mem_search(query="auth bug")     -> compact ID index
2. mem_timeline(anchor=12345)       -> surrounding context
3. mem_get(ids=[12345, 12346])      -> full details

Hook Pipeline

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:

/plugin uninstall claude-mem-lite

Architecture comparison

claude-mem (original)claude-mem-lite
**LLM calls**Every tool use triggers a Sonnet callOnly on episode flush (5-10 ops batched)
**LLM input**Raw tool_input + tool_output JSONPre-processed action summaries
**Conversation**Multi-turn, accumulates full historyStateless single-turn extraction
**Noise filtering**LLM decides via "WHEN TO SKIP" promptDeterministic code-level Tier 1 filter
**Runtime**Long-running worker process (1.8MB .cjs)On-demand spawn, exits immediately
**Dependencies**Bun + 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)

Quality comparison

DimensionWinnerWhy
**Classification accuracy**TieBoth 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**originalSees full diffs, but rarely useful for memory search
**Search recall**TieUsers search semantic concepts ("auth bug"), not code lines
**Hook latency****lite**Async background workers; original blocks 2-5s per hook

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-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 onlyAny LLM app via SDKAny MCP clientClaude Code only
**Capture model**Auto via hooksManual memory.add()Manual tool calls (create_entities, add_observations)Auto via hooks
**Code-aware retrieval**FTS5 + 100+ synonym pairs (incl. CJK↔EN)General-purposeGeneric graph nodesCode-aware
**Search**FTS5 BM25 + query expansion (PRF, concept co-occurrence)Hybrid: semantic + BM25 + entity linkingKnowledge-graph traversalFTS5 + Chroma vector
**Storage**Single local SQLitePluggable; Qdrant or configurable vector storeSingle JSONL file (knowledge graph)SQLite + Chroma
**LLM dependency**Haiku per episode (5–10 ops batched)LLM per add/search opNone (graph CRUD only)Sonnet per tool call
**Setup**One 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.

🇨🇳 中文文档镜像 AI 翻译 2026-05-29
英文原文章节由系统翻译为中文摘要,便于快速理解。完整原文见上方 "📑 README 深度解析"。
📌 简介

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 系统。

🛠 安装步骤(Docker/pip/源码)

推荐使用 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 索引来获取完整的开发细节,实现高效的记忆检索与���下文注入。

⚙️ 配置说明(含 MCP / env)

用户可以通过环境变量对插件进行自定义配置。`CLAUDE_MEM_DIR` 用于指定自定义的数据存储目录,所有的数据库文件和运行时资源都将保存在此处(默认路径为 `~/.claude-mem-lite/`)。`CLAUDE_MEM_MODEL` 则用于指定执行后台任务(如 episode 提取和会话摘要)时使用的 LLM 模型,支持 `haiku` 或 `sonnet`。

🔌 API 说明

与通用的 `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` 实现上下文的精准定位与召回。

❓ FAQ 摘要

针对常见问题:Claude Code 默认无法跨会话记忆,但本项目通过 MCP 协议将决策和历史持久化到本地 SQLite,并在新会话开始时自动注入上下文。相比通用框架,它更擅长处理代码领域的语义扩展(如中英文术语转换)。本项目完整支持中文,通过 FTS5 与中英文同义词扩展,能够精准处理 CJK 与英文的混合检索需求。

🎯 aiskill88 AI 点评 A 级 2026-05-22

创新的轻量级记忆解决方案,FTS5搜索能力强劲,架构简洁高效。Star数量适中但技术方案先进,非常适合Claude生态集成应用。

📚 实用指南(长尾问题)
适合谁
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
  • 构建企业知识库 / RAG 检索应用的团队
最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal
部署方案
  • Docker:claude-mem-lite 提供官方镜像,docker compose up 一键启动
  • CLI:直接 npm install -g / pip install,命令行调用
  • 云端托管:可放在 Vercel / Railway / Fly.io 等 PaaS 平台
相关搜索
claude-mem-lite 中文教程claude-mem-lite 安装报错怎么办claude-mem-lite MCP 配置claude-mem-lite Docker 部署claude-mem-lite Agent 工作流claude-mem-lite 与同类工具对比claude-mem-lite 最佳实践claude-mem-lite 适合谁用

⚡ 核心功能

👥 适合谁
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
  • 构建企业知识库 / RAG 检索应用的团队
⭐ 最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
⚠️ 常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal

👥 适合人群

Claude Desktop / Claude Code 用户AI 工具开发者需要扩展 AI 能力的专业人士自动化工程师

🎯 使用场景

  • 在 Claude Desktop 对话中直接调用本地工具,实现 AI 与系统的深度联动
  • 通过自然语言驱动复杂的多步骤自动化任务,代替繁琐手动操作
  • 将多个 MCP 工具组合使用,构建个人专属 AI 工作站

⚖️ 优点与不足

✅ 优点
  • +MIT 协议,可免费商用
  • +标准化 MCP 协议,生态互联性强
  • +与 Claude 官方生态无缝对接
  • +即插即用,配置简单快捷
⚠️ 不足
  • 依赖 Claude 客户端,非 Claude 用户无法使用
  • MCP 协议仍在持续演进,接口可能变更
  • 需要一定的配置步骤
⚠️ 使用须知

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。

🔗 相关工具推荐

📰 相关 AI 新闻
🍿 AI 圈相关吃瓜
🗺️ 相关解决方案
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合

❓ 常见问题 FAQ

支持文本记忆、对话历史、知识片段等多种类型,通过FTS5索引优化查询性能。
💡 AI Skill Hub 点评

AI Skill Hub 点评:claude-mem-lite MCP工具 的核心功能完整,质量良好。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。

⬇️ 获取与下载
⬇ 下载源码 ZIP

✅ MIT 协议 · 可免费商用 · 直接从 aiskill88 服务器下载,无需跳转 GitHub

📚 深入学习 claude-mem-lite MCP工具
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 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
🔗 原始来源
🐙 GitHub 仓库  https://github.com/sdsrss/claude-mem-lite

收录时间:2026-05-18 · 更新时间:2026-05-19 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。

📺 订阅 AI Skill Hub Daily Telegram 频道
每天 8 条精选 AI Skill、MCP、Agent 与自动化工具推送
加入频道 →