Skip to main content
Glama

Rekindle

npm tests license Glama score

专为那些在每次会话时都要重新解释项目上下文而浪费时间的 Claude Code 用户设计。

npx rekindle init

你的 AI 会在会话之间遗忘一切。Rekindle 解决了这个问题。


Rekindle init demo

Rekindle 是一个 MCP 连续性引擎,它解决的不仅仅是存储问题,而是**会话导向(session orientation)**问题。在会话开始时进行导向,在会话结束时进行捕获,并在会话中期的压缩过程中存活下来。全部本地化,全部基于 SQLite,无需 API 密钥。

v0.3.0 — “在漫长的中间阶段存活” — PreCompact 捕获系统、开放循环、审查跟踪。发布说明

快速开始

npx rekindle init

这将在你的项目中创建一个 .rekindle/ 目录,其中包含 SQLite 数据库、身份模板、捕获目录和转录目录。然后为你的客户端添加 MCP 服务器配置:

添加到 ~/.claude.json:

{
  "mcpServers": {
    "rekindle": {
      "command": "npx",
      "args": ["-y", "rekindle"]
    }
  }
}

启用 PreCompact 保护(在会话中期压缩前捕获上下文):

npx rekindle setup-hooks

添加到 claude_desktop_config.json(macOS: ~/Library/Application Support/Claude/,Windows: %APPDATA%\Claude\):

{
  "mcpServers": {
    "rekindle": {
      "command": "npx",
      "args": ["-y", "rekindle"]
    }
  }
}

添加到项目根目录的 .cursor/mcp.json 中:

{
  "mcpServers": {
    "rekindle": {
      "command": "npx",
      "args": ["-y", "rekindle"]
    }
  }
}

然后填写 .rekindle/identity.md 并将引导指令粘贴到你项目的 CLAUDE.md 中。

会话 1 存储。会话 2 记忆。会话 10 预判。


Related MCP server: claude-session-continuity-mcp

问题所在(43 个会话的数据)

在 43 个会话中,我们测量了 AI 助手在会话开始时未能加载的内容:

指标

数值

分析的会话数

43

干净启动(加载所有上下文)

33%

高信号失败(5+ 个缺口)

26%

总检索失败

173

现有的记忆工具(Mem0, Letta, Zep)优化的是检索准确性:AI 能否找到它存储的内容?这是必要的,但还不够。它们都没有解决 AI 是否为本次会话加载了正确的上下文,或者它是否能检测到它错过了什么。

Rekindle 解决了会话导向问题:在助手开始工作前,加载身份、近期上下文、记忆健康状况和缺失上下文的警告。

查看 docs/gap-analysis.md 获取完整的研究数据集。


它能做什么

启动:在会话开始时进行导向

boot_report 在任何工作开始前运行一个导向流水线:

boot_report
  +-- Read identity document (who am I working with?)
  +-- Scan memory stats (what do I know?)
  +-- Find latest checkpoint (where did we leave off?)
  +-- Read last transcript (what actually happened?)
  +-- Surface open loops (what needs follow-up?)
  +-- Surface PreCompact captures (what survived compaction?)
  +-- Detect gaps (what am I missing?)
  +-- Calculate orientation score (how oriented am I?)
  --> "Carrying forward: [context loaded, gaps identified, score: 80/100]"

在漫长的中间阶段存活:PreCompact 捕获 (v0.3)

会话中期的压缩会破坏推理链、失败的方法、关系纹理和语气。PreCompact 钩子会在压缩前自动触发,并保存那些本会被丢失的内容:

PreCompact hook fires
  +-- Parse JSONL transcript (last N messages)
  +-- Write raw Markdown capture (.rekindle/captures/)
  +-- Write structured JSON snapshot (decisions, open loops, files)
  +-- Update manifest for cheap listing
  --> boot_report surfaces captures on next session start
  --> end_session warns if captures exist but weren't reviewed

三种读取模式可控制 Token 成本:

  • summary — 一个段落,廉价

  • structured — 决策/循环/警告,适中

  • raw — 完整的转录摘录,昂贵(仅在需要时使用)

捕获:在会话结束时闭环

end_session 存储结构化的连续性记录 — 而不仅仅是摘要:

字段

捕获内容

checkpoint

我们离开的地方(必需)

decisions

决定了什么以及为什么

open_loops

未解决的任务或问题

constraints

不得违反的边界

relational_delta

工作关系中发生了什么变化

next_session_focus

下次会话从哪里恢复

preferences

学到的新用户偏好

warnings

下次会话应注意的事项

所有记录都带有 type、source 和 session_id 元数据。下一次 boot_report 会自动加载检查点。

会话之间:搜索和管理

工具

描述

store_memory

存储内容、类别、重要性(1-10)和项目范围

search_memory

全文搜索,带有 BM25 排名,并根据重要性加权

list_memories

浏览记忆,最新的优先。按类别或项目过滤

delete_memory

按 ID 删除

update_memory

更新内容、类别或重要性

list_captures

列出 PreCompact 捕获(可选按会话过滤)

read_capture

以摘要、结构化或原始模式读取捕获

capture_now

按需手动捕获当前会话上下文

类别: preference lesson context relationship general


为什么不仅仅使用 CLAUDE.md?

静态文件是被动的。你的 AI 可以读取它,但无法搜索它、对其排名、跟踪已检索的内容或告诉你缺少什么。Rekindle 增加了:

  • 搜索 — 带有重要性加权排名的全文搜索

  • 结构 — 跨记忆的类别和项目范围划分

  • 导向 — 在启动时主动加载上下文,而不仅仅是按需检索

  • 缺口检测 — 标记缺失的身份、空类别、陈旧数据

  • 评分 — 透明的检查清单,让你知道 AI 的导向程度如何

  • 会话捕获 — 带有检查点、决策和开放循环的结构化关闭

  • 压缩生存 — PreCompact 捕获保留了摘要会扁平化的内容


v0.3.0 亮点

  • 10 个 MCP 工具 — 增加了 list_captures, read_capture, capture_now

  • PreCompact 捕获系统 — 会话中期压缩前的自动上下文保留

  • boot_report 中的开放循环 — 呈现之前会话中未解决的任务

  • 审查跟踪 — read_capture 后标记为已审查;end_session 会在未审查时发出警告

  • 钩子设置 — npx rekindle setup-hooks 配置 Claude Code PreCompact 钩子

  • 自动发现 — capture_now 无需手动路径即可发现会话转录

  • 101 个自动化测试 — 单元、集成、捕获管理器、钩子设置


CLI 命令

命令

描述

npx rekindle init

在当前目录设置 .rekindle/

npx rekindle init --global

在主目录设置

npx rekindle init --with-hooks

初始化 + 配置 PreCompact 钩子

npx rekindle setup-hooks

配置 PreCompact 钩子(独立)

npx rekindle precompact-capture

在压缩前捕获上下文(钩子)

npx rekindle capture-now

手动捕获当前会话上下文

npx rekindle

启动 MCP 服务器(由 Claude Code 使用)


从源码安装

git clone https://github.com/Skitchy/rekindle.git
cd rekindle
npm install
npm run build
node dist/init/cli.js init

setup-hooks 命令将此写入 .claude/settings.local.json:

{
  "hooks": {
    "PreCompact": [
      {
        "matcher": "auto",
        "hooks": [
          {
            "type": "command",
            "command": "npx rekindle precompact-capture",
            "timeout": 60
          }
        ]
      },
      {
        "matcher": "manual",
        "hooks": [
          {
            "type": "command",
            "command": "npx rekindle precompact-capture",
            "timeout": 60
          }
        ]
      }
    ]
  }
}

钩子通过 stdin 接收会话上下文(session_id, transcript_path, cwd, hook_event_name)并将捕获内容写入 .rekindle/captures/。

变量

默认值

描述

REKINDLE_PRECOMPACT_MAX_MESSAGES

80

要捕获的最大消息数

REKINDLE_PRECOMPACT_MAX_CHARS

120000

要捕获的最大字符数

REKINDLE_BASE_DIR

自动检测

.rekindle/ 的基目录

  • 所有数据均为本地。 不会发送到外部服务器。

  • 无网络调用。 MCP 服务器通过 stdio 通信。无 HTTP,无遥测,无分析。

  • 转录包含对话文本。 如果你的会话包含秘密或凭据,请勿启用转录捕获。

  • 钩子安装是可选的。 setup-hooks 必须显式运行(init 不会自动安装)。

  • SQLite 数据库是常规文件。 未加密。如有需要,请使用操作系统级磁盘加密。

  • .rekindle/ 已被 gitignore。 init 命令会自动处理此问题。

  • boot_report 读取本地文件。 路径未沙盒化。仅与你信任的 MCP 客户端和提示词一起使用。

兼容性

客户端

传输

状态

Claude Code (macOS)

stdio

已测试

Claude Code (Linux/WSL2)

stdio

已测试

Claude Code (Windows)

stdio

已测试

Claude Desktop

stdio

兼容(相同的 MCP 配置格式)

Cursor

stdio

兼容(相同的 MCP 配置格式)

任何 MCP stdio 客户端

stdio

兼容

rekindle/
  src/
    index.ts          MCP server entry point
    server.ts         Server setup, tool registration (10 tools)
    storage/
      sqlite.ts       SQLite + FTS5, schema migration, sessions
    orientation/
      types.ts        OrientationResult, Gap, ScoreItem
      GapDetector.ts  Structural gap detection (8 codes)
      Scorer.ts       Orientation scoring (6 criteria, 100pts)
      OrientationService.ts   Orchestrator
      OrientationRenderer.ts  Markdown + JSON output
    captures/
      types.ts        CaptureEntry, StructuredSnapshot, HookInput
      CaptureManager.ts   Parse, capture, list, read, review tracking
      discover-transcript.ts  Auto-discover session transcripts
      precompact-capture.ts   CLI hook entry point
      capture-now.ts          Manual capture CLI
    tools/
      boot-report.ts  Orientation + open loops + capture awareness
      end-session.ts  Structured session close + capture warning
      list-captures.ts  List PreCompact captures
      read-capture.ts   Read captures in 3 modes
      capture-now.ts    Model-triggered manual capture
      store.ts search.ts list.ts delete.ts update.ts
    init/
      cli.ts scaffold.ts setup-hooks.ts templates/

存储: 通过 better-sqlite3 使用 SQLite + FTS5。BM25 排名由重要性加权。带有 type、source、session_id 的类型化记录。

传输: stdio(标准 MCP)。可直接与 Claude Code 一起使用。

测试

npm test

101 个测试:存储 CRUD + FTS5 排名、导向领域(缺口检测、评分、服务、渲染)、捕获管理器(解析、限制、审查跟踪、格式化)、钩子设置(模式、幂等性)以及 MCP 集成(所有 10 个工具)。

路线图

v0.4: “它以网络方式思考” — 扩散激活、通过嵌入进行语义搜索、缺口分析工具、评估工具集。

许可证

MIT

Available Tools

10 tools
boot_reportA

Generate a session orientation report. Read-only — does not modify any stored data. Reads the identity document from disk, scans the memory database for statistics and the latest checkpoint, finds the most recent transcript file, detects structural gaps (missing identity, stale memories, no checkpoint, etc.), and calculates a 0-100 orientation score across 6 criteria. Also surfaces open loops from prior sessions and any PreCompact captures that preserve context from compacted sessions. Workflow: call boot_report first thing every session, before any substantive work. Orientation scores are structural checks, not guarantees that every relevant context item was loaded.

Inputs: identity_path (required), transcript_dir (required), project.

capture_nowA

Manually capture current session context to .rekindle/captures/. Use this when you want to preserve the current conversation state — before a complex operation, when context feels at risk, or when the user requests it. Produces the same artifact as the automatic PreCompact hook but triggered on demand. session_id and transcript_path are optional — if omitted, the most recent transcript is discovered automatically.

Inputs: reason, session_id, transcript_path.

delete_memoryA

Permanently delete a single memory from the local SQLite database by its ID. This action is irreversible — the row and its full-text search index entry are removed immediately. Use when a memory is outdated, incorrect, or no longer relevant. Returns {success: true} if the memory was found and deleted, or {success: false, message: 'Memory not found'} if the ID does not exist. Does not affect other memories or session records.

Inputs: id (required), provenance.

end_sessionA

Capture a structured session handoff. Writes multiple records to the local SQLite database: one checkpoint (required), plus optional decisions, open loops, preferences, constraints, warnings, relational delta, and next session focus. Each record is stored with a typed 'type' column (not content prefixes) and linked to a session record via session_id. Also creates a session row in the sessions table with a summary, orientation score, and gap count. The checkpoint is retrievable by boot_report on the next session start. All records are searchable via search_memory and list_memories. Workflow: call end_session at the end of every substantive session so the next session can pick up the thread.

Inputs: checkpoint (required), project, warnings, decisions, +8 more.

list_capturesA

List PreCompact captures for the current or recent sessions. PreCompact captures preserve context that would otherwise be lost during mid-session compaction. Workflow: if boot_report lists PreCompact captures, call list_captures then read_capture to recover pre-compaction context before relying on the checkpoint. Before calling end_session, check for unreviewed captures.

Inputs: session_id.

list_memoriesA

List stored memories from the local SQLite database, ordered newest first. Unlike search_memory, this does not require a query — it returns all memories matching the optional filters. Read-only; does not modify any data. Use to browse what has been stored, audit memory contents, or check memory counts per category or project. Returns an array of memories with id, content, category, importance, project, and created_at.

Inputs: limit, project, category.

read_captureA

Read a PreCompact capture by ID. Use this to recover context that was lost during mid-session compaction. Three modes control token cost: 'summary' (one paragraph, cheap), 'structured' (decisions/loops/warnings, moderate), 'raw' (full transcript excerpt, expensive — only when summary or structured is insufficient). Workflow: read recovered captures before relying on the latest checkpoint; start with the lightest mode that answers your question.

Inputs: id (required), mode.

search_memoryA

Search stored memories using SQLite full-text search (FTS5). Returns results ranked by relevance with higher-importance memories boosted. Each search increments the retrieval_count on matched memories, tracking which memories are accessed most. Use at session start to load relevant context, or mid-session to recall specific information. Returns an array of matching memories with id, content, category, importance, project, created_at, and retrieval_count. Returns an empty array if no matches are found.

Inputs: query (required), limit, project, category.

store_memoryA

Store a new memory in the local SQLite database. Creates a persistent row with an auto-generated UUID, timestamp, and the provided content. Use for preferences, lessons learned, project context, relationship notes, or general information worth remembering across sessions. Memories persist across sessions and are surfaced by boot_report, search_memory, and list_memories. Returns the generated ID on success. Does not deduplicate — calling twice with the same content creates two separate memories.

Inputs: content (required), project, category, importance, +1 more.

update_memoryA

Update an existing memory in the local SQLite database. Modifies only the fields you provide — omitted fields are left unchanged. The updated_at timestamp is set automatically. If content is changed, the full-text search index is rebuilt for this memory. Returns the full updated memory object on success, or {success: false, message: 'Memory not found'} if the ID does not exist. Use to correct inaccurate memories, adjust importance, or reclassify a memory's category without deleting and re-creating it.

Inputs: id (required), content, category, importance, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 10 tools

    Disambiguation4/5

    Memory operations (store/update/delete/list/search) are clearly distinct, and capture operations (capture_now/list_captures/read_capture) form a coherent group. There is some functional overlap between end_session, capture_now, and store_memory since all persist context, but the descriptions draw clear lines between structured handoffs, ad-hoc snapshots, and discrete memories.

    Naming Consistency4/5

    Most tools follow a verb_noun pattern (store_memory, delete_memory, list_captures, read_capture, end_session), with memory tools consistently suffixed by _memory/_memories. Deviations like boot_report (noun form) and capture_now (verb_adverb) are minor and still readable.

    Tool Count5/5

    Ten tools is well-scoped for a session-context/memory server, covering memory CRUD, search, session handoff, and capture retrieval without redundancy. Each tool has a defensible role in the workflow.

    Completeness4/5

    Memory lifecycle is fully covered (create, update, delete, list, search) and captures are readable/listable. Minor gaps exist: no get-by-ID for a single memory, no deletion of captures or sessions, and session history is only exposed indirectly via boot_report rather than a list_sessions/read_session pair.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables AI coding assistants like Claude Code, Cursor, and Codex to share chat logs, terminal history, and session context with each other. Eliminates the need to re-explain context when switching between different AI coding tools.
      2
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      2-5x longer Claude Code sessions before compaction. Saves 30-40% on input token costs. Remembers your rules and corrections so Claude stops repeating mistakes after compaction. Auto-runs in the background, just install once and forget about it.
      1,207 PyPI
      430
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Persistent memory for Claude Code — a self-evolving knowledge layer that survives across sessions, grows from every conversation, and surfaces relevant context automatically.
      14
      MIT