Purpose
Compartment provides persistent memory for AI agents, with memory stored on your own computer. What an agent learns in one session is available in every later session, every project, and every agent on the machine, and the data never leaves the machine.
It works as a local vault that is read and written by Claude Code, Claude Desktop, Hermes Agent, OpenClaw, Cursor, Codex, and any other MCP client. No API key, account, network, or telemetry is required.
Main capabilities
- Local encrypted offline: Everything on disk (including embedding vectors) is encrypted, and only your passphrase can open it.
- Single facts: Each memory is a single statement that records its source and the date it was learned.
- Expiration mechanism: An expires can be set for facts that stop being true (a date or a duration such as 14d, 2w, 3m, 1y), and the memory is removed when it expires.
- Facts accumulate, opinions update: New facts coexist with old facts; opinion-type memories (kind="opinion") replace similar active opinions, or supersedes can be used to specify replacement/retention.
- Hybrid retrieval: The vector index understands meaning, the keyword index confirms literal content, and the two paths are combined as independent evidence with a soft OR, returning relevant results locally in about 12 ms.
- Automatic tagging: A background process adds tags to memories based on nearest neighbors in the embedding space, co-occurrence relationships, and text phrases; it only writes tags and does not change the text, dates, or vectors.
- Relationship graph: memory_link records subject, predicate, object relationships, and memory_relations can query by entity, predicate, or date.
- Memory treated as data: Recalled memories come with a notice that "this is stored data," and content from untrusted sources can be marked as quarantined.
- One embedding model per vault: The model SHA-256 is verified when opening, and changing the model requires running compartment reindex --re-embed.
- No built-in LLM: Embeddings run locally using the bundled 384-dimensional int8 ONNX model, sharing about 70 MB of process memory; the host model decides what to store and what to forget.
Usage
Installation (after pip install compartment && compartment init):
compartment integrate claude、hermesoropenclawcan connect the corresponding agent in one step.compartment integrate claudeinstalls a PostToolUse hook that writes the memory files it saves into the vault regardless of whether the model calls a tool; the hook does not affect other hooks, backs up settings.json first, always exits successfully, and does nothing when the vault is locked.compartment hook status | install | uninstall, orintegrate claude --no-hooks。compartment import-claudeto import content missed by the hook.compartment atomizesplits memories that exceed the limit in an existing vault;compartment expiremanually performs expiration cleanup;compartment opinions auditaudits overlapping opinions;compartment retag --dry-runpreviews tag changes.compartment recent、compartment statusView recent memory activity,memory_recentcorresponding MCP view.
The panel is consistent across systems: a menu bar on macOS, the notification area on Windows, and a regular window in the application menu on Linux. The panel shows whether the vault is open, the total number of memories and the number stored by yourself, three settings worth adjusting (capture hook, whether reference facts participate in search, automatic locking), connected agents and the connect button, as well as the five most recent memories. It can unlock, lock, and change the passphrase, without a terminal. The Dashboard button opens the full vault in the browser: growth curves, a relationship graph of named entities, tags, per-agent counts, and live search, served only from 127.0.0.1 in memory, read-only, with no external requests.
Use Cases
- Scenarios that require sharing local memory across sessions, projects, and agents.
- Personal or team environments with requirements for offline data and encryption.
- Wanting memory to be auditable, traceable to source and date, and able to express opinion updates and fact expiration.
- Wanting to intuitively see what the agent has learned and to inspect the relationship graph and tags through the Dashboard.
Limitations
- Memory is data, not instructions; the host agent must still treat memory as data.
- Importance is assigned by a fixed hierarchy: decisions and consent 0.90, personal facts and preferences 0.80, user machine and configuration 0.75, other substantive statements 0.55, small talk 0.20; importance acts multiplicatively on the matching score.
- A single memory exceeding 200 characters (the max_memory_chars setting) or containing lists, headings, or paragraphs will be rejected, with a prompt on how to split it.
- It is more common for facts not to be given an expiration; setting expiration incorrectly will cause the memory to be deleted.
- The semantic channel similarity has an upper limit of 0.88, while the literal matching channel has a higher upper limit.
- Official materials do not provide more information such as fees, pricing, platform-compatible versions, or effectiveness promises, so none is provided for now.