# Compartment

> Compartment is a free MCP server for knowledge and memory. Encrypted, fully offline long-term memory vault shared by every agent on your computer. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Free
- **Platforms:** macOS, Windows, Linux, CLI, self-hosted
- **Website:** https://maxfreedompollard.github.io/Compartment/
- **Repository:** https://github.com/maxfreedompollard/compartment
- **MCP Registry name:** io.github.MaxFreedomPollard/compartment
- **Categories:** knowledge and memory
- **Listing updated:** 2026-11-14

## About

Each memory is a single claim stored with its source and the date it was learned. The store rejects anything over 200 characters or containing lists, headings or paragraphs, with an error that says how to split it; the author reports that without this rule the median memory an agent wrote on a real vault was 1,938 characters of bulleted session log. A batch tool, memory_store_many, stores several at once, and a compartment atomize command splits oversized memories in an existing vault.

Recall is a hybrid of vector and keyword search over an in-memory index and is stated to answer in about 12 ms. Importance is set by fixed tiers, with decisions and consent highest and small talk lowest, and it multiplies the match score so it can only break ties. A bare reply such as OK is kept together with the question it answered. Memories can expire on a set date, and a changed preference replaces the old one.

Everything on disk is encrypted, vectors included, and only your passphrase opens the vault. The embedding model ships in the package, and a new vault includes about 6,700 reference facts on hardware, operating systems, ports, encodings and shell tools that one switch removes from search. The README compares it with other memory servers on storage, encryption, accounts and network use.

## Features

- **Encrypted vault:** One encrypted file on your machine, with embedding vectors encrypted too.
- **Offline by design:** No API key, account, network use or telemetry; the project says this is enforced in CI.
- **Hybrid recall:** Vector and keyword search over an in-memory index.
- **One claim per memory:** Length and format limits keep memories short and searchable.
- **Expiry and replacement:** Memories can expire, and a new preference supersedes the old one.
- **Agent integration:** Commands wire Claude Code, Claude Desktop, Hermes Agent, OpenClaw, AntiGravity and Codex.
- **Memory map GUI:** The site mentions a GUI with a memory map.

## Good for

- Keep decisions and preferences across sessions and projects
- Share one memory between several coding agents on the same machine
- Store sensitive context without sending it to a cloud service
- Carry reference facts about your machine into every session

## Install

### Claude Code (Terminal)

```sh
claude mcp add compartment -- uvx compartment
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "compartment": {
      "command": "uvx",
      "args": [
        "compartment"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "compartment": {
      "command": "uvx",
      "args": [
        "compartment"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "compartment": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "compartment"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "compartment": {
      "command": "uvx",
      "args": [
        "compartment"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "compartment": {
      "command": "uvx",
      "args": [
        "compartment"
      ]
    }
  }
}
```

## Tools

- `memory_store_many`: Stores a batch of memories in one call.

## FAQ

### Does it need an API key or network?

No. The README says no API key, no account, no network and no telemetry.

### How do I connect Claude Code?

After installing and running compartment init, run compartment integrate claude. Equivalent commands exist for hermes, openclaw, antigravity and codex.

### How long can a memory be?

200 characters by default (the max_memory_chars setting), with no lists, headings or paragraphs.

### How is it installed?

The registry lists it as the compartment package on PyPI.

### Is Compartment free?

Yes. Compartment is free to use.

### How do I add Compartment to Claude Code?

Run this command in your terminal: claude mcp add compartment -- uvx compartment

### What are the best alternatives to Compartment?

The closest alternatives to Compartment are Codebase Memory, XERJ, Claude Code Ultimate Guide, Nautilus Compass Memory and note1.

## Alternatives

- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Nautilus Compass Memory](https://ai-powered.com/mcp/nautilus-compass-memory): Nautilus Compass Memory is an open-source MCP server for knowledge and memory.
- [note1](https://ai-powered.com/mcp/note1): note1 is an MCP server for productivity.
- [MedXpert 图书馆连接器（通用版）](https://ai-powered.com/mcp/medxpert): MedXpert 图书馆连接器（通用版） is an open-source MCP server for knowledge and memory.
- [Context Nest](https://ai-powered.com/mcp/context-nest): Context Nest is a freemium MCP server for knowledge and memory.
- [Tulsa Ecosystem Map](https://ai-powered.com/mcp/tulsa-ecosystem-map): Tulsa Ecosystem Map is a free MCP server for knowledge and memory.

---
Source: https://ai-powered.com/mcp/compartment
