memshelf-mcp

memshelf-mcp

Enables AI agents to offload and recall working memory as indexed episodes with LLM-written digests, reducing token usage and preserving detail across sessions.

Category
访问服务器

README

memshelf-mcp

Put your agent's memory on a shelf, hand it the index.

License: MIT Status MCP Sibling: docshelf

                              _          _  __
 _ __ ___   ___ _ __ ___  ___| |__   ___| |/ _|
| '_ ` _ \ / _ \ '_ ` _ \/ __| '_ \ / _ \ | |_
| | | | | |  __/ | | | | \__ \ | | |  __/ |  _|
|_| |_| |_|\___|_| |_| |_|___/_| |_|\___|_|_|
  ____________________________________________
 | INDEX >> | E-01 | E-02 | E-03 | E-04 | ... |
 |__________|______|______|______|______|_____|
        memory shelves for AI agents

Status: M0 complete (Cases A + B), M1 tool surface shipped. The pattern was validated with zero code on a live shelf — measured numbers in docs/demo.md — and the M1 server/CLI now enforces it: memshelf_shelve / recall / index / search / stats / doctor, plus a Claude Code plugin (adapters/claude-code/). Sibling project of docshelf-mcp, which provides the storage/index layer.

What this is

Long-running agent sessions burn tokens re-sending history and lose detail to lossy auto-compaction. memshelf applies the docshelf pattern — tiny index in context, bodies fetched on demand — to the agent's own working memory:

  1. Closed conversation topics, research dumps, and bulky tool output are offloaded to a local shelf as Markdown episodes.
  2. Each episode carries an LLM-written, contract-validated digest that preserves decisions, rejected alternatives, artifacts, and open threads.
  3. The agent keeps only INDEX.md (kilobytes) + digests in context and recalls exact sections via INDEX → SUBINDEX navigation over MCP.

Positioning in one sentence: claude-mem's loop, git's substrate, docshelf's navigation — episodic memory you can grep, diff, review, and carry between hosts. Private and local by default: the standard storage mode is a local git repo with no remote configured.

Quick start

As an MCP server (tools memshelf_init / shelve / recall / index / search / stats / resolve / doctor):

# Claude Code
claude mcp add memshelf -- uvx memshelf-mcp
// Claude Desktop (claude_desktop_config.json)
{
  "mcpServers": {
    "memshelf": { "command": "uvx", "args": ["memshelf-mcp"] }
  }
}

Or from the shell (pip install memshelf-mcp) — the same loop, no MCP:

memshelf init   --shelf ~/my-shelf --name "My working memory"
memshelf shelve --shelf ~/my-shelf --slug 2026-07-23-topic --kind topic \
  --digest "What was decided, what was rejected and why, what stays open." \
  --section "Decisions=..."
memshelf recall --shelf ~/my-shelf --id 2026-07-23-topic --section Decisions --log
memshelf stats  --shelf ~/my-shelf   # claimed + realized savings
memshelf doctor --shelf ~/my-shelf   # exit 1 on integrity errors

Two sessions shelved on parallel branches and the merge collides in INDEX.md / ledger.tsv / .meta.json / stats.svg? That is the multi-writer conflict class (#58) and it resolves mechanically:

memshelf resolve --shelf ~/my-shelf            # union appends, rebuild derived, doctor
memshelf resolve --shelf ~/my-shelf --commit   # same + complete the merge commit

Conflicting episodes are content, not mechanics — resolve reports them and steps aside.

A rejected digest is a feature: the tool prints exactly what to fix and writes nothing. Measured results from a week of dogfooding are in docs/demo.md.

The memory is vendor-portable, and that is now a measured fact, not a design intention: the same live shelf has been read and cross-written by Claude Code (Anthropic) and Gemini CLI (Google) through one shelf-spec server — protocol and field notes in docs/portability.md.

Documents

Doc What it covers
docs/MANIFEST.md Problem, the bet, hero scenarios, principles, non-goals
docs/ARCHITECTURE.md Episode format, digest contract, storage modes, triggers, MCP tool surface, portability model, privacy, failure modes
docs/LANDSCAPE.md Prior-art survey (2026-07), platform built-ins, positioning, risks
docs/ROADMAP.md Milestones M0–M3 with exit criteria
docs/DECISIONS.md Decision log
docs/M0.md M0 experiment protocol and results (complete): cases, token ledger, recall test
docs/demo.md Measured numbers from the dogfood shelf: compression, recall test, doctor findings
docs/portability.md One memory, multiple AIs — the 2026-07-27 experiment: the dogfood shelf read and written by Claude Code (Anthropic) and Gemini CLI (Google) through the same shelf-spec server
docs/examples/ A worked episode file and a memory-shelf INDEX
adapters/claude-code/ Claude Code plugin: /shelve skill + SessionStart/SessionEnd/PreCompact hooks

Origin

Designed as RFC-0001 in the docshelf-mcp repo (#42, #43, #44); this repo is the project's home from 2026-07-13 on. The docshelf copy is frozen as a historical snapshot.

Related projects

  • docshelf-mcp — the sibling project and storage layer: PDFs/Markdown → chat-project-friendly document shelves with the same index-and-fetch economics (measured: ~3.7K tokens vs 1.2M per question). memshelf was born as RFC-0001 in its repo and reuses its splitter/indexer/read/search verbatim.
  • The dogfood memory shelf is a private repo — by design (MANIFEST principle 5): the tool is public, the memory never is.

License

MIT — see LICENSE.


mcp-name: io.github.ignatenkofi/memshelf-mcp

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选