Compartment MCP
Encrypted offline memory for AI agents: one vault on your own computer shared by Claude Code, Cursor, Codex and other clients
- 578 ★ on the repository
- Last commit
- Apache-2.0
Broad access
Why this level
- By its instructions the /compartmentalize skill saves passwords, API keys, tokens and contacts from a conversation into the vault
- Installation registers the server in agent configurations, adds a hook to Claude Code settings and a block to CLAUDE.md, and a copy of the settings is kept
- The write tools change the memory, and `forget --shred` destroys a record's key with no way back
Install
- Works in
In your terminal, with SkillFoxx CLI
npx skillfoxx add mcp/compartmentDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- By its instructions the /compartmentalize skill saves passwords, API keys, tokens and contacts from a conversation into the vault
- Installation registers the server in agent configurations, adds a hook to Claude Code settings and a block to CLAUDE.md, and a copy of the settings is kept
- The write tools change the memory, and `forget --shred` destroys a record's key with no way back
This is third-party code. Review the repository files before installing.
What it does
Compartment keeps the memory of AI agents in one encrypted file on your own computer. What an agent learns in one session is available in every later session, in every project and to every agent on the machine: Claude Code, Claude Desktop, Cursor, Codex and other MCP clients. No API key or account is needed, and it uses no network and no telemetry. Each memory is a single claim with its source and the date the fact was learned. Length is capped at 200 characters; the vault rejects lists, headings and paragraphs and explains how to split the text. A memory can carry an expiry date and removes itself after it. Facts accumulate while opinions replace each other: when a new opinion is stored, the server looks for a similar live one and offers to replace it. Search is hybrid, by meaning and by words, and returns only what holds up against the best result. If the memory knows nothing about a question, the answer is empty. Encryption covers all data on disk, embedding vectors included. The embedding model ships in the package and there is no language model inside: your agent decides what to remember, and Compartment records, encrypts and searches. You can manage the vault from an app in the macOS menu bar, the Windows notification area or a Linux window, and the `compartment dash` panel shows it in a browser on 127.0.0.1, read-only.
Who it is for. For developers and agent users who want long-term memory across sessions and projects without a cloud or accounts.
Good fit when
- The agent forgets your preferences, script paths and decisions from earlier sessions every time, and sending them to a cloud is not allowed
- Several agents run on one computer, such as Claude Code and Cursor, and they need one shared memory
- Before the context is compacted you want to save everything important from the conversation, which the `/compartmentalize` skill does
- Facts go stale on a known date, like a price, a booking or a door code, and the records should remove themselves
- You work in a closed environment: with the `--assert-offline` flag the server aborts on any attempt to reach the network
Not a fit when
- You need a team memory for several people or machines: the vault is local and moves to another computer by copying the file
- You want the memory itself to decide what to remember: there is no language model in Compartment and the decision stays with the agent
- Your system is outside the supported list: 32-bit systems, armv7 and riscv64 do not work, and glibc must be 2.28 or newer
- You want to store long notes whole: the vault refuses a record over 200 characters, so the text must be split
Example request
Search memory for what we decided about the log format and answer with the source and the date of the recordMCP
- Transport
- stdio
- Authentication
- not required
Environment variables
COMPARTMENT_PASSPHRASEsecret- The vault passphrase for scripts and CI; in normal use you type it in the app or with compartment unlock.
COMPARTMENT_VAULT- Which vault to use when there are several.
Limitations
Compartment needs Python 3.11–3.14 (3.12–3.14 on Windows on ARM, up to 3.13 on Intel Macs) and Linux with glibc 2.28 or newer on x86_64 and aarch64. On Windows it requires the Microsoft Visual C++ runtime. After installing, run `compartment init` once: you type the passphrase yourself, even when the server comes from an agent's plugin store. Compartment never generates a password, seed or recovery phrase. The vault locks after 30 idle minutes, on restart or on command.
Termux has no shared memory for the unlock credential, so it needs `COMPARTMENT_PASSPHRASE` or `compartment unlock --once`. On WSL 2 the VM shutting down clears the unlock, so the vault relocks between sessions. The `memory_unlock` tool is off by default because enabling it puts the passphrase into the model's context.
A new vault comes with about 6,700 reference facts on hardware, ports, encodings and shell tools. One switch removes them from search.
How to disable. The `compartment uninstall` command removes the files installed into agents, the skill included. The vault is kept until you explicitly ask to delete it. The capture hook for Claude Code is removed by `compartment hook uninstall`, and you can skip it when connecting with the `--no-hooks` flag.
FAQ
How do I install Compartment in Claude Code?
Run `pip install compartment && compartment init && compartment integrate claude`. The last command registers the MCP server for all projects, imports the memory files Claude Code has already saved, installs the capture hook and the /compartmentalize skill, adds a managed block to CLAUDE.md and, if Claude Desktop is installed, registers the server in its configuration as well. A copy of settings.json is kept.
How do I connect Compartment to Cursor or another MCP client?
The `compartment integrate --list` command shows the 33 clients the installer can wire. For any other, use a configuration block with the stdio transport: the command compartment and the argument serve, no environment variables. If the client starts from the Dock or the Start menu and does not see PATH, give the full path from `which compartment`.
What does the /compartmentalize skill do?
Only the user runs the skill, for example before compacting the context. The agent sweeps the whole conversation and stores in the vault people and contacts, passwords and keys with where each one lives, URLs and hosts, decisions with their reasons, and the session itself as separate short records. It skips the vault's own passphrase.
How does Compartment protect data?
All data on disk is encrypted with XChaCha20-Poly1305, vectors included. The key is protected by Argon2id slots and every record has its own key, so `forget --shred` destroys the content irreversibly. The audit log is hash-chained and verified with `compartment audit verify`. The server opens no ports. The `--assert-offline` flag aborts on any network attempt. A keyfile can be added as a second factor with `compartment 2fa enable`.
How does Compartment differ from other memory servers?
In the author's own comparison table as of 2 September 2026, Compartment encrypts both the data and the vectors, needs no API key and uses no network at runtime. For the other servers on the list on-disk encryption is not documented. mem0, Graphiti, Letta, Cognee and MemOS, for example, need a language model key, and claude-mem requires signing in to an account. The table is built from each project's documentation and corrections are welcome as a pull request.
Discussion
No questions or reviews yet.
Related
MCP serversLocal persistent memory for coding agents: hooks record every session, and Claude Code, Codex or Cursor recall past decisions through 54 MCP tools
Long-term memory for AI agents: Markdown files as the source of truth, a SQLite index as a cache, shared by Claude Code, Codex and others
Local memory for agents: stores conversations and project files verbatim and retrieves them with semantic search over MCP
Long-term memory for agents: a remote MCP server, plugins for Claude Code, Cursor and Codex, and an API for your own apps
Persistent agent memory in a folder of linked markdown notes, so Claude Code remembers a project across sessions
A long-term memory MCP server for AI agents: facts fade along a forgetting curve and related records are compressed into a summary
Comparison with similar tools
Entries that share the main search query, and how they differ.
| Entry | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| Compartment (this entry) | no | not required | 578 | |
| Basic Memory | no | not required | 4,403 | keeps memory in local Markdown files with a relation graph and semantic search |
| MCP Memory Service | no | not required | 2,054 | self-hosted memory with semantic search, a knowledge graph and auto-consolidation |
README in short
The README opens with a short description, install buttons for Cursor, VS Code, LM Studio, goose and Kiro, and a comparison table with other memory servers. It then describes the memory logic: what is stored, how importance is assigned by fixed tiers, how opinions update, how expiry and tags work. Separate sections cover the app and dashboard, the search mathematics, the security model, several agents sharing one vault and measurements on a laptop with 8 GB of memory. The end holds an install table, wiring for each agent, settings, the list of MCP tools and the privacy policy.