Claude Code session

Compound Memory

Long-term memory for Claude Code and Codex: turns your daily AI sessions into a persistent memory of your preferences, decisions and open threads, injected at the start of every new session, on any machine. Local-first, zero dependencies. 让 AI 跨会话、跨机器、跨工具记住你。

44 stars 1 forksSessions & history Plugin marketplace Source

Install

Add the plugin marketplace
/plugin marketplace add Protocol-zero-0/compound-memory

Run inside Claude Code, then /plugin to pick what to install from it.

Inside Claude Code
/plugin install compound-memory --marketplace Protocol-zero-0/compound-memory

Found in the project README. Check it for setup steps after installing.

From source
git clone https://github.com/Protocol-zero-0/compound-memory.git

From the README

🧠 compound-memory

每次开新对话都要重新自我介绍?让 AI 自动记住你。

一个后台进程,每晚把你和 AI 的对话变成"关于你"的记忆;下一次对话——
换机器、换工具、换模型都一样——开局就带着它,不用你再解释一遍。

中文 · English · 原理与设计 · 检索 · 隐私闸

长这样(下面是虚构示例,不是真实用户数据)

新会话开局,这段会自动出现在上下文里:

工作中随时按话题翻细节,带出处:

为什么好用

- 不用你做任何事。 每晚自动读会话、提炼、写快照,你只管正常用 AI。
- 跨工具、跨机器。 Claude Code、Codex、DeepSeek Harness 共用同一份记忆,三边都自动注入。
- 会更新,不会越堆越乱。 改主意了,旧记忆自动失效;不是无限累积的日志。
- 原文永远留在本机。 只有逐条判定"必要且适合共享"的记忆会出机,出机前清洗密钥。
- 额度有纪律。 精简调用、每晚上限,撞到额度就停,不会偷偷烧钱。

设计取舍(为什么按 session 不按天、为什么不用文件 mtime、修订语义怎么定、完整架构图)
→ docs/design.md

🚩 装之前看一眼

- 它会读你全部的会话记录。 这是它唯一的信息来源。不能接受就别装。
- 它会按配置的模型花钱/花额度。 默认每晚最多 20 个 session,一个 session 一次调用。
  先用 cm distill --dry 看一眼要处理多少个。
- 开局注入会改几个文件(~/.claude/settings.json、~/.codex/AGENTS.md 等),
  都先备份、带标记,cm uninstall 原样摘掉。
- 默认模型是 Claude Opus。 对比实验里 Sonnet 会漏掉约四分之一的条目。省钱可以换,
  但知道你在换什么。
- 推断不是规则。 只有你明确说过的话才带"要求"标记,模型不会替你立规矩。

一键安装

装完会当场跑一次提炼并把快照打出来——不用等到第二天才知道通没通。

前置条件只有一个:一个能调的模型。默认用本机已经登录的 claude 命令(零额外配置);
没有就把 config.yaml 里 llm.backend 改成 openai,填 base_url 和 api_key_env,
任何 OpenAI 兼容接口都行。

在 Claude Code 里也可以装成插件,让 agent 需要旧上下文时自己用 cm recall 去查,
没装时由它带你跑上面的安装:

旧版 Claude Code 分两步:/plugin marketplace add Protocol-zero-0/compound-memory,
再 /plugin install compound-memory@compound-memory。只要 skill:npx skills add Protocol-zero-0/compound-memory。

支持矩阵

再加一个 harness = 写一个 cm/sources/.py,提供 available / scan / load_turns 三个函数。

配置说明

配置在 ~/.compound-memory/config.yaml(装的时候从 config.example.yaml 复制过去)。

提示词在 prompts/ 下,纯文本——这是最该你自己调的东西。想改又想保留原版,
复制到 ~/.compound-memory/prompts/,那边优先。改之前先 cm eval --n 24 存一套题,
改完用同一套题复跑再比较,见 docs/recall.md。

常见问题

装完什么都没有?
cm doctor 看一眼。最常见的是最近 7 天没有够长的对话,试 cm distill --days 60 --limit 5。

怎么补历史?
cm distill --days 365 --limit 0。按 nightly_limit 分几晚跑完也行,水位线记得住。

已经有一堆记忆了,能搬过来吗?
能。python3 tools/import-legacy-jsonl.py…
Read the full README on GitHub

Details

Language
Python
License
MIT
Last updated
26 October 2026
Topics
agent-memoryai-agentsai-memoryclaude-codeclaude-code-hookscodexcoding-agentcontext-engineeringknowledge-managementllmllm-memorylocal-first

FAQ

What is Compound Memory?

Long-term memory for Claude Code and Codex: turns your daily AI sessions into a persistent memory of your preferences, decisions and open threads, injected at the start of every new session, on any machine. Local-first, zero dependencies. 让 AI 跨会话、跨机器、跨工具记住你。 It is a session for Claude Code, from Protocol-zero-0/compound-memory on GitHub.

How do I install Compound Memory?

Run /plugin install compound-memory --marketplace Protocol-zero-0/compound-memory inside Claude Code, then follow the setup in the README.

Is Compound Memory popular?

Protocol-zero-0/compound-memory has 44 GitHub stars and 1 forks. It was last updated on 26 October 2026.

More sessions & history

Browse the most popular Claude Code mods, all sessions & history, or the skills and MCP server directories.