how-it-works

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

How claude-mem works

claude-mem 工作原理

What it does

功能介绍

Every Read, Edit, and Bash that Claude makes turns into a compressed observation. Observations get summarized at session end. Relevant ones get auto-injected into future prompts so the next session starts with context from the last one — no re-explaining the codebase, no re-discovering decisions.
Claude 执行的每一次读取(Read)、编辑(Edit)和命令行操作(Bash)都会转化为一条压缩后的观测数据。观测数据会在会话结束时进行汇总,相关的内容会自动注入到后续的提示词中,这样下一次会话就能以上一次的上下文为起点——无需重新解释代码库,也无需重新梳理之前的决策。

When it kicks in

生效时机

Memory injection starts on your second session in a project.
The first session in a fresh project seeds memory; subsequent sessions receive auto-injected context for relevant past work. Run
/learn-codebase
if you want to front-load the entire repo into memory in a single pass (~5 minutes, optional).
记忆注入会在同一个项目的第二次会话时启动。
在全新项目的第一次会话中会初始化记忆;后续会话会自动注入与过往相关工作的上下文。如果想要一次性将整个代码库加载到内存中,可以运行
/learn-codebase
(约5分钟,可选操作)。

Where data lives

数据存储位置

Everything stays in ~/.claude-mem on this machine.
Nothing leaves your machine except calls to whichever AI provider you configured for compression (Claude / OpenRouter / Gemini). The SQLite database, vector index, logs, and settings all live under that directory and are removed cleanly on
npx claude-mem uninstall
.
所有数据都存储在本机的~/.claude-mem目录下。
除了向你配置的用于压缩的AI服务商(Claude / OpenRouter / Gemini)发起调用外,没有任何数据会离开你的机器。SQLite数据库、向量索引、日志和设置都存放在该目录下,执行
npx claude-mem uninstall
即可干净地删除所有相关内容。