compound-memory is a local-first shared memory system for multiple agents, designed to solve the problem that every AI agent session starts from scratch, repeatedly asks about preferences, repeatedly discovers project conventions, and repeatedly hits the same pitfalls. It lets all agents share one store, with memories kept on disk as human-readable Markdown files, and every write automatically committed to local git history.
Key capabilities:
- Local-first: data never leaves the local machine; memories are Markdown files with frontmatter rather than an opaque database.
- MCP-native: provides exactly 5 tools (memory_write / memory_search / memory_get / memory_link / memory_feedback) as the sole read/write boundary, compatible with any MCP host (such as Claude Code, ZCode, WorkBuddy, etc.), while also providing a complete CLI.
- Compound growth: confirmed use raises confidence, related memories are recalled as neighbors, verification from different hosts counts as independent evidence, and distillation can merge multiple raw memories into fewer, denser memories.
- Multi-agent design: a _shared namespace readable by everyone, plus private agent-* namespaces owned by each host; cross-host verification is tracked per host.
- Optional semantic recall: vector search via sqlite-vec + BGE embeddings, automatically falling back gracefully to pure lexical search when unavailable. The model can be overridden via COMPOUND_MEMORY_EMBEDDING_MODEL (default Xenova/bge-small-zh-v1.5) and COMPOUND_MEMORY_EMBEDDING_DIM (default 512); changes require an explicit index rebuild.
Usage:
- Requires Python ≥ 3.11. By default the repository is not cloned; it can be run via uvx: uvx --from compound-memory compound-memory-server.
- The default storage root is ~/.agents/memory, overridable via the COMPOUND_MEMORY_ROOT environment variable.
- Multi-agent stores must set COMPOUND_MEMORY_AGENT_ID; process identity takes precedence over model claims, preventing forged-origin writes to other host namespaOccasionally inflate cross-host validation. When unset or empty, stats and doctor exit with code 1 (diagnostics are still printed), and MCP tools continue to run and log a warning at startup.
- Verify connection: have the agent call memory_search (any keyword); returning {"hits": [...]} means it is connected; or run uvx --from compound-memory compound-memory doctor (exits 0 when AGENT_ID is set and storage is writable).
- Provides plugin integrations for Claude Code, WorkBuddy, and ZCode, all installed via a self-hosted marketplace, starting the same PyPI server and setting the corresponding AGENT_ID.
- The usage protocol in skills/compound-memory/SKILL.md (search → feedback → write loop) can be injected into the host.
Scoring mechanism: 0.70·similarity + 0.15·confidence + 0.10·recency + 0.05·type weight; switches to RRF fusion when the vector channel is enabled. New memories start with confidence 0.5; successful feedback raises it and failures lower it (floor 0.05); contradictions are frozen into a review queue, and stale entries are archived immediately. Same-host success boosts are recorded in evidence.host_bumps, with a per-host cap of 0.3 (single-host maximum 0.8). First validation from a different host earns an independent bonus (once per host per memory), and validated_by / evidence traces are retained.
Operations:
- Supports scheduled distillation preparation (launchd / cron / systemd), running dream daily at 09:00 to write a read-only report to <root>/distill/last-plan.json; dream-apply must be invoked explicitly.
- compound-memory maintain is a single daily task: read-only dream → optional decay → health snapshot; no decay by default, requires --with-decay or RUN_DECAY=1.
- Other CLI operations: explain, forget, review-resolve, extract, etc.
Platform support: Python ≥ 3.11 on macOS, Linux, and Windows. CI Runs tests, type checking, and pure wheel install smoke tests across Python 3.11/3.12/3.13 on Linux and Windows.
Limitations:
- Multi-agent shared storage must set COMPOUND_MEMORY_AGENT_ID, otherwise identity can be forged.
- Semantic retrieval depends on sqlite-vec and BGE embeddings, falling back to lexical search when unavailable.
- Changing the embedding model or dimensions requires an explicit index rebuild.
- The plugin marketplace is self-hosted and has not been submitted to the official Anthropic directory.
- Scheduled distillation only generates read-only reports; merging and proposals must be executed explicitly by a human or agent.