Skip to main content
Glama
README.md
<p align="center">
  <img src="assets/icon.png" alt="Brain Memory" width="128" height="128">
</p>

<h1 align="center">Brain Memory</h1>

<p align="center">
  <a href="https://github.com/omelas-tech/brain/actions/workflows/ci.yml"><img src="https://github.com/omelas-tech/brain/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
  <a href="https://www.npmjs.com/package/brain-memory"><img src="https://img.shields.io/npm/v/brain-memory" alt="npm version"></a>
  <a href="https://github.com/omelas-tech/brain/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/brain-memory" alt="license"></a>
</p>

Brain Memory is a persistent memory system for AI agents. It stores memories as Markdown files in
`~/.brain/` and provides a command-line tool, `brain`, that agents use to store, recall and
maintain them. The same memories are available to every supported agent on the machine.

Full documentation: [brainmemory.ai/docs](https://brainmemory.ai/docs)

## Requirements

- Node.js 18 or later.
- One or more supported agents: Claude Code, OpenAI Codex CLI, OpenCode, GitHub Copilot CLI, Kilo
  or Google Antigravity.

## Installation

There are two ways to install Brain Memory. They can be used together.

### Local installation

Memories are stored on your machine. No account is required.

```bash
npm install -g brain-memory
brain
```

The first command installs the package and the `brain` command. The second command starts the
setup program, which configures the agents you select.

To configure agents without the setup program:

```bash
brain --claude --global
brain --codex --global
brain --all --global
```

Install with a system Node.js rather than a version manager such as nvm, so that `brain` remains
available to agents. See [Installation](https://brainmemory.ai/docs/getting-started/installation)
for details.

### Hosted connector

Memories are stored in Brain Cloud and are available in any application that supports remote MCP
servers, including Claude.ai and ChatGPT. An account is required. Sign in with Google or with email
and password. If you have no account, signing in creates a free one with an empty brain.

The connector address is `https://mcp.brainmemory.ai/mcp`.

```bash
claude mcp add --transport http brain https://mcp.brainmemory.ai/mcp
codex mcp add brain --url https://mcp.brainmemory.ai/mcp
```

For other applications, add the address as a custom connector and sign in when asked. See
[Claude apps](https://brainmemory.ai/docs/getting-started/claude-apps),
[ChatGPT](https://brainmemory.ai/docs/getting-started/chatgpt), and
[Connect other agents](https://brainmemory.ai/docs/getting-started/other-agents) for Grok Build
(formerly Cursor), GitHub Copilot, Gemini CLI, Devin Desktop (formerly Windsurf), Zed, Cline and
more. Apps on OpenRouter or another OpenAI-compatible API can use
[`integrations/openrouter`](integrations/openrouter/).

For the Claude apps there is also a plugin that adds a skill to the connector, so Claude knows when
to recall and when to offer to save. The Claude apps page has the download.

If you also use the local installation, `brain cloud login` followed by `brain cloud sync` merges
`~/.brain/` and the cloud copy in both directions.

## Usage

After installation, agents recall relevant memories at the start of each session and offer to store
new ones at the end. The following commands are also available in the agent:

| Command | Purpose |
|---|---|
| `/brain:remember [query]` | Recall memories relevant to a query. |
| `/brain:memorize [topic]` | Store memories from the current session. |
| `/brain:status` | Show the state of the memory store. |
| `/brain:pin [id]` | Load a memory in every session. |
| `/brain:forget [target]` | Archive or erase memories. |
| `/brain:import` | Create initial memories from past agent sessions. |
| `/brain:verify` | Review memories that are waiting for approval. |
| `/brain:sync` | Synchronise memories between machines. |
| `/brain:skills` | Manage stored procedures. |
| `/brain:sleep` | Run maintenance on the memory store. |

Some command-line commands are used directly:

| Command | Purpose |
|---|---|
| `brain cloud sync` | Merge `~/.brain/` and Brain Cloud, memory by memory, in both directions. |
| `brain review` | List duplicates, likely replaced memories, faded memories and signature problems. Changes nothing. |
| `brain keys` | Show this machine's signing key and manage trusted signers. |
| `brain episodes` | Ingest, search and read past Claude Code and Codex sessions. They stay on this machine. |
| `brain port` | Export memories to, or import them from, another memory system. |

Run `brain help` for the full list of command-line commands.

## Data and privacy

- Memories are plain Markdown files in `~/.brain/` and can be read and edited directly.
- With the local installation, nothing leaves your machine unless you configure synchronisation,
  through Brain Cloud or a Git repository that you choose.
- Content from outside sources, such as web pages or tool output, is held for your approval before
  agents can use it.
- Memories are signed when written, so changes made outside Brain Memory can be detected.
- Files under `~/.brain/.local/`, including signing keys and session history, are never
  synchronised.

## Updating and uninstalling

```bash
npm install -g brain-memory
brain update
```

```bash
brain uninstall
npm uninstall -g brain-memory
```

Uninstalling keeps `~/.brain/`. Add `--delete-data` to `brain uninstall` to remove it.

## Documentation

- [Installation](https://brainmemory.ai/docs/getting-started/installation)
- [Quick start](https://brainmemory.ai/docs/getting-started/quick-start)
- [Concepts](https://brainmemory.ai/docs/concepts/memory-types)
- [Configuration](https://brainmemory.ai/docs/reference/configuration)
- [Moving memory between systems](https://brainmemory.ai/docs/advanced/moving-memory)
- [Self-hosting](https://brainmemory.ai/docs/advanced/self-hosting)
- [Integrations](integrations/) for OpenClaw, NVIDIA NemoClaw and Hermes Agent
- [Changelog](CHANGELOG.md)

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md). Report security issues as described in
[SECURITY.md](SECURITY.md).

## License

MIT