
cavemem
why agent forget when agent can remember
接入你的智能体
發布者自己的指令。不是 PlugMCP 端點。
用我們的金鑰與日誌託管一份副本。
npx -y [email protected]Claude Code 沒有本機指令的安裝連結。複製下方指令並在終端機中執行。
claude mcp add cavemem -- npx -y cavemem@0.2.1在終端機中執行。
{ "mcpServers": { "cavemem": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}claude_desktop_config.json
遠端 URL 還是本機指令? 兩種安裝方式的差異
Install • How it works • CLI • MCP • Settings
Status: frozen (August 2026). cavemem is no longer in active development. Everything below still installs and works, but expect no new features or fixes. Its compressed-memory core lives on inside caveman — the actively developed home of the family, alongside caveman-browse.
Cross-agent persistent memory for coding assistants. Hooks fire at session boundaries, compress observations with the caveman grammar (~75% fewer prose tokens, code and paths preserved byte-for-byte), and write to local SQLite. Agents query their own history through three MCP tools. No network. No cloud.
Supports: Claude Code · OpenCode · Codex · GitHub Copilot · Augment Code · Cursor (query-only) · Gemini CLI (query-only) · Antigravity (query-only) · IBM Bob (query-only)
search, timeline, get_observations — agents filter before fetching.http://localhost:37777 for browsing sessions in human-readable form. Token-protected: the worker generates a local bearer token on first start and injects it into the served page, so cavemem viewer still opens with zero friction while /api/* rejects requests without it.<private>...</private> stripped at write boundary. Path globs exclude whole directories.npm install -g cavemem
cavemem install # Claude Code
cavemem install --ide cursor # cursor | gemini-cli | opencode | codex | copilot | augment | antigravity | bob
cavemem status # see wiring + embedding backfill
cavemem viewer # open http://127.0.0.1:37777
No daemon to start. Hooks write synchronously. A local worker auto-spawns in the background on the first hook to build embeddings and serve the viewer; it self-exits when idle (set embedding.idleShutdownMs to 0 to keep it running until killed). Disable auto-spawn — and with it the HTTP listener — with cavemem config set embedding.autoStart false.
"Query" means the MCP server can search memory captured elsewhere. "Capture" means this IDE's own sessions write new observations — without it, the DB never fills for that IDE no matter how healthy cavemem status otherwise looks (#58).
¹ OpenCode has no hooks.json-style event system. Capture instead goes through a bundled bridge plugin (opencodeBridge.js, symlinked into OpenCode's plugin dir on install) that subscribes to OpenCode's native event and tool.execute.after hooks and shells out to the same cavemem hook run handlers every other IDE uses — same lifecycle coverage, different wiring.
² Copilot's and Codex's hook payloads are close enough to Claude Code's shape that the same handlers are reused unmodified, but neither event set is complete: Codex and Copilot have no SessionEnd, and Augment has no UserPromptSubmit. Every other lifecycle moment still fires and gets written.
Run cavemem status after installing to see which IDEs are wired up, with query-only ones flagged inline (ides: claude-code, antigravity (query-only)).
Claude Code runs hook commands through sh -c even on Windows. If Git for Windows' Git\bin isn't
on your user Path, sh doesn't resolve, hooks fail silently, and capture quietly stops — cavemem doctor/status keep reporting healthy because the failure never reaches the CLI. Add
C:\Program Files\Git\bin (or <scoop dir>\apps\git\current\usr\bin for a Scoop install) to your
user Path, then verify with where.exe sh. cavemem doctor and cavemem install both check
sh resolvability on win32 and print a warning if it's missing.
Claude Code's hooks docs also describe a shell field ("bash" / "powershell") and a shell-free
args exec form. We looked at emitting either instead of the plain sh-shaped command string, but
held off: we can't verify those fields against every Claude Code version in the wild, and the
current command has no shell metacharacters, so it already tokenizes the same way whether Claude
Code runs it through sh or falls back to PowerShell. Once there's a way to gate on a minimum
Claude Code version, switching to the shell-free args form would drop the sh dependency
entirely.
session event → redact <private> → compress → SQLite + FTS5
↑
MCP queries on demand
What compression looks like in practice:
Input: "The auth middleware throws a 401 when the session token expires; we should add a refresh path."
Stored: "auth mw throws 401 @ session token expires. add refresh path."
Viewed: "The auth middleware throws a 401 when session token expires. Add refresh path."
Code blocks, URLs, paths, identifiers, and version numbers are never touched. Hook handlers complete in under 150ms. Full bodies fetched on demand via get_observations.
Manual cross-device transfer: on machine A, cavemem export backup.jsonl. Copy the file to machine B, then on B, stop the worker (cavemem stop), run cavemem import backup.jsonl, and restart it (cavemem start). Records already present are skipped, and imported observations whose ids clash with different local ones get fresh ids — nothing is overwritten, and importing the same file twice is a no-op. Imported observations keep their original compressed content and get picked up by the embedding backfill like any new write — vectors themselves aren't exported.
Progressive disclosure: search and timeline return compact results; get_observations fetches full bodies.
enrich is off by default. When enrich.enabled is false the tool is not registered and cavemem makes no network call, ever. When enabled, it searches DuckDuckGo, stores compressed plain-text extracts as observations (tagged source: web + URL for provenance), and returns them.
<cavemem home>/settings.json, where the cavemem home directory resolves in this order:
CAVEMEM_HOME env var, if set.~/.cavemem — zero breaking change for current installs.$XDG_DATA_HOME/cavemem whenever XDG_DATA_HOME is explicitly set — on any platform,
not just Linux. Without the var, Linux uses the XDG default ~/.local/share/cavemem;
macOS/Windows keep ~/.cavemem.Non-absolute env values (no leading / or ~) are ignored, per the XDG spec — otherwise
hooks running from a project directory would fragment the store per-project.
Run cavemem doctor or cavemem status to see which directory is actually in use.
Content inside <private>...</private> is stripped before write. Paths matching excludePatterns are never captured into memory, whether they appear in a tool's file_path/path/notebook_path field or embedded in a command string. The worker binds to 127.0.0.1 only, checks the Host/Origin headers on every request, and requires a local bearer token (<dataDir>/worker-token, mode 0600) on /api/*.
Four tools. One philosophy: agent do more with less.
They compose: cavekit orchestrates the build, caveman compresses what the agent says, cavemem compresses what the agent remembers, cavegemma bakes the compression into the model weights. Install one, some, or all — each stands alone.
MIT
Cross-agent persistent memory with compressed storage. Plug-and-play memory for Claude Code, Gemini CLI, OpenCode, Codex, and Cursor.
{ "mcpServers": { "cavemem": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}工具
尚無工具清單。遠端伺服器會在首次健康檢查後取得工具清單。
常見問題
在本頁複製適用於 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 設定。它使用發布者的安裝方式,而不是 PlugMCP 代理伺服器。
這筆記錄未列出必要的環境變數。
Cavemem 透過 stdio 在本機執行。
上次檢查時間:2026-11-15。 Cross-agent persistent memory with compressed storage. Plug-and-play memory for Claude Code, Gemini CLI, OpenCode, Codex, and Cursor.