Compartment
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**Encrypted, fully offline memory for AI agents.** One vault on your own
computer, read and written by Claude Code, Claude Desktop, Hermes Agent,
OpenClaw, Cursor, Codex and any other MCP client. No API key, no account, no
network, no telemetry.
**One-click install** (after pip install compartment && compartment init):
Claude Code, Claude Desktop, Hermes Agent and OpenClaw are wired by one
command instead: compartment integrate claude, hermes or openclaw.
Compartment is persistent memory for AI agents, stored on your own computer.
What an agent learns in one session is available in every later session, in
every project, to every agent on the machine, and nothing leaves the machine.
Each memory is a single claim, recorded with its source and the date it was
learned. Memories can expire: set expires and the memory is removed after
that date. When a preference changes, the new one replaces the old one.
Recall is a hybrid vector and keyword search over an in-memory index. It
answers in about 12 ms and returns only what is relevant.
The embedding model is included in the package. Everything on disk is
encrypted, including the embedding vectors, and only your passphrase opens
it. A new vault comes with about 6,700 reference facts about hardware,
operating systems, ports, encodings and shell tools. They are ordinary
memories, and one switch removes them from search.
How it compares with other memory servers
Where each server keeps memory and what protects it, as documented by each
project on 2 September 2026. Sources and the full table are in
docs/COMPARISON.md; corrections are welcome as a PR
against that file.
| | Memory at rest | Encrypted | Account / API key | Network at runtime |
|---|---|---|---|---|
| **Compartment** | one encrypted file; index in RAM | **yes, vectors too** | none | none, CI-enforced |
| @modelcontextprotocol/server-memory | plaintext memory.jsonl, substring search | no | none | none |
| mem0 (open source) | vector store + LLM-extracted facts; its MCP server is hosted only | not documented | LLM key | LLM calls; telemetry on by default |
| Graphiti (Zep) / Letta | Neo4j / server + database | not documented | LLM key | LLM calls; telemetry on by default |
| claude-mem | local SQLite + Chroma | not documented | sign-in required | account + provider calls; telemetry on by default |
| basic-memory (AGPL) | Markdown + SQLite | not documented | none | telemetry on by default |
| Hindsight (Vectorize) | one container with embedded PostgreSQL | not documented | LLM key (local models configurable) | LLM calls; vendor states no telemetry |
| Supermemory | cloud service, or a self-hosted prebuilt binary | not documented | account (cloud) or LLM key (self-host) | cloud calls; self-host: vendor states no telemetry |
| Cognee | SQLite + LanceDB + Kuzu locally, or cloud | not documented | LLM key | LLM calls; telemetry on by default |
| MemOS | Neo4j + Qdrant self-hosted, or cloud | not documented | LLM key | LLM calls; telemetry on by default |
The memory logic
**Almost everything is stored.** Only empty turns are dropped. A bare "OK" is
a decision, not noise: when the agent asks *"Want me to send this reply to
the client now?"* and the user answers *"OK"*, Compartment stores the
decision together with the question it answered. Small talk is kept but
ranked last.
**Importance is assigned by fixed tiers.** Decisions and consent 0.90,
personal facts and preferences 0.80, the user's machine and configuration
0.75, other substantive statements 0.55, small talk 0.20. Importance
multiplies a match score rather than adding to it, so it breaks near-ties in
favour of what matters and can never surface a memory that did not match the
question.
**One claim per memory, enforced.** The store rejects anything longer than
200 characters (the max_memory_chars setting), and anything containing
lists, headings or paragraphs, with an error that says how to split it.
Instructions alone did not work: on a real vault, the median memory written
by an agent was 1,938 characters of bulleted session log. memory_store_many
stores a batch in one call. compartment atomize splits over-limit memories
in an existing vault; each piece keeps the original's dates, and the original
is marked superseded but stays readable by id.
**Every memory records its source and date.** source is required: "from
chat", "read from pyproject.toml", "web search". discovered is the date the
fact was learned, separate from the date it was saved. Both are appended to