# cogito-mem (Cogi)

> cogito-mem (Cogi) is a free MCP server for knowledge and memory. Local long-term memory for Claude Code that keeps every message word for word. It runs locally on your machine and is started by your AI client.

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

## About

Cogi, a squirrel mascot, runs alongside Claude Code and stores each exchange in a single SQLite file under `~/.cogito-mem/`. Nothing is summarised by an AI: you get back the original wording and the date it was said, which is what lets Claude recover a decision from last month or a detail lost when a long session compacts.

The plugin installs four Claude Code hooks and one MCP server. The hooks save new messages after each reply and add roughly 400 tokens of relevant memories at the start of a session and with each prompt. The MCP server gives Claude three tools for searching, opening and appending memories, served by a small service that listens only on 127.0.0.1:7327. It also records commands run, files touched, sub-agent reports and up to 800 characters of each command's output, with common API key and password formats replaced by `[redacted]` before saving.

The project reports its own LongMemEval results: on the long test (about 480 sessions, 1.2 million tokens per question) the right session is among the first five results for 93% of 500 questions, with 99% on the short test. The first start downloads a 310 MB embedding model; after that it makes no network calls.

## Features

- **Word-for-word storage:** Keeps every message and reply with its date instead of an AI summary.
- **Automatic saving:** Hooks collect new messages after each answer without any action from you.
- **Memory injected per prompt:** Adds about 400 tokens of the most relevant memories to each prompt, each with an id Claude can open.
- **Tool activity recall:** Remembers commands run, files touched, sub-agent reports and the key lines of command output.
- **Secret redaction:** Replaces common forms of API keys, tokens, private keys and passwords with [redacted] before saving.
- **Fully local:** Stores everything in one SQLite file on your machine and needs no account or API key.

## Good for

- Recover an exact decision or name from an earlier session after /clear
- Keep context across long sessions that compact
- Look up which commands failed in a past run
- Give Claude Code a private memory with no cloud service

## Install

### Claude Code (Terminal)

```sh
claude mcp add cogito-mem -- uvx cogito-mem
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "cogito-mem": {
      "command": "uvx",
      "args": [
        "cogito-mem"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "cogito-mem": {
      "command": "uvx",
      "args": [
        "cogito-mem"
      ]
    }
  }
}
```

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

```json
{
  "servers": {
    "cogito-mem": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "cogito-mem"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "cogito-mem": {
      "command": "uvx",
      "args": [
        "cogito-mem"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "cogito-mem": {
      "command": "uvx",
      "args": [
        "cogito-mem"
      ]
    }
  }
}
```

## Tools

- `memory_query`: Searches stored messages and returns the few that matter.
- `memory_open`: Opens a stored memory by its id.
- `memory_append`: Adds a note to the memory.

## FAQ

### Does my history leave my computer?

No. Messages are stored in ~/.cogito-mem/ on your machine, and after the one-time downloads Cogi makes no network calls.

### What does it download on first start?

The cogito-mem package and numpy from PyPI, llama.cpp's llama-server from its GitHub releases (skipped if present) and the 310 MB EmbeddingGemma 2 model from Hugging Face.

### Which apps does it work with?

Claude Code in a terminal or IDE gets everything. Codex saves every turn and searches when asked. Claude Desktop chat gets save and search tools without automatic saving. Cloud sessions on claude.ai are not supported yet.

### Which operating systems are supported?

macOS and Linux; Windows is described as experimental.

### Which MCP tools does it expose?

memory_query, memory_open and memory_append.

### Is cogito-mem (Cogi) free?

Yes. cogito-mem (Cogi) is free to use.

### How do I add cogito-mem (Cogi) to Claude Code?

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

### What are the best alternatives to cogito-mem (Cogi)?

The closest alternatives to cogito-mem (Cogi) 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/cogito-mem-cogi
