← knowledge.oriz.in

cavemem — cross-agent persistent memory daemon

service memorycavememclaude-codedaemonhooksagent-tooling

cavemem

Local-only persistent memory daemon for agent sessions. NOT the same as caveman (terse-prose rule) despite the name confusion.

What it is

What it stores

Every tool call observation: tool name + input + truncated output + session ID + timestamp. State at 2026-06-29: 3816 observations, 15 sessions, 24h worker uptime.

How Claude Code uses it

~/.claude/settings.json hooks block registers cavemem on five lifecycle events:

Event What cavemem does
SessionStart Loads recent session memories into prompt context
UserPromptSubmit Snapshots the prompt for future recall
PostToolUse Records the tool call observation
Stop Flushes pending observations to db
SessionEnd Marks session closed

Plus an MCP server (cavemem mcp) the agent can call for explicit memory_save / memory_search / memory_update / memory_delete / memory_list. That's where the memory tools listed in the Claude Code system prompt come from.

Why this exists (and why we kept it after the speed-stack rule "skipped" Caveman)

Speed-stack rule's "Caveman skipped — no install path" referred to the prose-compression Caveman from JuliusBrussee, which we did adopt as a written rule (rules/agent/caveman.md) without a CLI. cavemem is a different thing entirely — a memory daemon, no prose work. It IS installed and active, has been since pre-2026-06-29 sometime, and survives /clear / session restart unlike Claude's built-in memory.

Required peer dep

@xenova/transformers (~80 packages, ~100MB). Without it, FTS search still works but semantic search is dead with Cannot find package '@xenova/transformers'. Install:

npm install -g @xenova/transformers

Daily commands

cavemem status                       # show wiring, db size, worker state
cavemem doctor                       # health checks
cavemem search "query"               # CLI search (FTS + semantic)
cavemem search "query" --limit 5
cavemem viewer                       # browser UI at http://127.0.0.1:37777
cavemem worker start/stop/restart    # manage the daemon
cavemem export memories.jsonl        # backup
cavemem reindex                      # rebuild FTS if corrupted

Known pitfalls

Cross-refs