brain.md is a free, open source note taking & knowledge management project written in JavaScript and released under Apache-2.0. It has 553 GitHub stars, 51 forks and 0 open issues, and was last pushed 14 days ago. On this registry it ranks #54 of 58 tracked projects in Note Taking & Knowledge Management, with 5 head-to-head comparisons available.

What is brain.md?

brain.md is an open, agent-agnostic, file-based memory layer for coding agents such as Claude Code and Codex, distributed as a zero-dependency JavaScript CLI under the Apache-2.0 licence, and it is aimed at developers and teams who want a project's durable decisions, requirements and constraints to survive beyond a single chat session.

What it is

brain.md is a toolkit rather than a brain in itself. Installing it once and running brain init in a project scaffolds a BRAIN.md protocol file, creates a brain/ directory, and default-wires agent configuration files into that repository. From that point on, any coding agent that reads files learns to use the brain simply by reading the project's BRAIN.md, which makes the knowledge portable across agents, machines and models. The repository's own framing of the test for inclusion is whether something will still matter in six months and is hard to reconstruct from the code itself; pure implementation details and anything readable from the code and git history are deliberately left out.

The concrete problem is that a coding agent's knowledge lives nowhere durable. The reasons behind a decision, the constraints a team agreed on, and the path not taken sit in chat logs and in people's heads, then vanish when the session ends, so the next agent starts from zero. brain.md replaces that disappearing chat context with persistent memory written as plain Markdown stored next to the code inside the repository, travelling in git with or without a runtime on top. Because every write goes through the brain CLI, the brain's invariants cannot be broken by a malformed edit, which the README cites as the reason no separate validator is needed.

Key capabilities

  • brain init ensures BRAIN.md, scaffolds empty brain data in a brainRoot-aware way, and default-wires CLAUDE.md and AGENTS.md, creating them if missing and otherwise updating only the marked brain block rather than overwriting whole files.
  • An agent-agnostic contract expressed as a single file, BRAIN.md, so anything that can read files can use the brain.
  • Brain content is plain Markdown that lives in the project and travels in git across agents, machines and models.
  • All reads and writes go through the brain CLI, including commands such as brain create-page --id, so brain files are never hand-edited.
  • Global installation through npm install -g @mindmux/brain-md plus brain setup -y places brain on the PATH and copies skills into every detected agent directory such as ~/.claude/skills; brain uninstall reverses this without touching any project's brain data.
  • Optional hooks: the brain-setup skill can add a pre-commit hook, and brain install-hooks provides a project-local Claude Code SessionStart snapshot, with --agent codex for Codex.
  • The brain-bootstrap skill seeds real knowledge, reading code, documentation and git log to draft root pages and capture key decisions on an existing project, or interviewing the user on a near-empty one.

Who uses it and how

  • Teams working on long-lived repositories with Claude Code or Codex, where a decision recorded in one session needs to still be present with its rationale weeks later.
  • Projects where the next agent currently starts from zero because context such as "store config as Markdown, not SQLite — easier to diff and migrate" only exists in a chat log.
  • Multi-agent and multi-machine workflows, because the brain is Markdown in the repository and moves through git rather than through a vendor-specific store.
  • Existing codebases that need retrospective seeding, where the brain-bootstrap skill reads the code, docs and git history to draft pages instead of relying on a blank start.
  • Developers who want to maintain the brain while coding: loading relevant pages at task start, capturing decisions and constraints as they settle, and reversing a capture when a decision is overturned.

Getting started

Install the tools globally with npm install -g @mindmux/brain-md followed by brain setup -y, then run brain init from the project root. Those who prefer not to install globally can use npx @mindmux/brain-md setup -y and npx @mindmux/brain-md init, noting that npx does not leave brain on the PATH.

How it compares

The available facts name no paid products that brain.md replaces; instead it works alongside the coding agents themselves, extending Claude Code and Codex rather than competing with them, because its contract is simply a file that any file-reading agent can follow. No comparable memory-layer or project-brain tool is named in these facts, so within this registry it stands alone in Productivity & Utilities / Note Taking & Knowledge Management.

When to use it — and when not to

A self-hoster needs Node.js and npm, since the workflow depends on a global or npx JavaScript CLI, and the team has to accept the discipline that brain files are written only through the brain CLI rather than edited by hand. Anyone wanting a hosted, database-backed knowledge service with synchronisation outside git should look elsewhere, because this project keeps its data as Markdown in the repository. It is also worth noting that the repository ships the toolkit, not a populated brain: seeding content is a deliberate, separate step via the brain-bootstrap skill, so teams unwilling to invest in that step will get little from it.

project readme (upstream, from github) — read inline

brain.md

brain.md

A persistent, file-based memory layer for your coding agents.
An open, agent-agnostic standard for capturing a project's durable knowledge as plain Markdown — read and written through one small CLI. It lives in your repo and travels across agents, machines, and models.

License: Apache-2.0 Zero-dependency CLI Agents: Claude Code, Codex, Cursor, Pi Version 0.3.0

Why · Quick start · See it work · CLI · How it works


This repository is the toolkit, not a brain itself. Install it once, then in any project run brain init: it scaffolds a BRAIN.md protocol file, a brain/ directory, and default-wires agent config files into your repo. From then on, any coding agent — Claude Code, Codex, anything that reads files — learns to use that brain just by reading the project's BRAIN.md. The brain is plain Markdown, lives in the repo, and outlives every session.

Why a brain

A coding agent's knowledge lives nowhere durable. The reasons behind a decision, the constraints you agreed on, the path not taken — they sit in chat logs and in your head, and they vanish the moment the session ends. The next agent starts from zero.

A brain fixes that. It is the project's persistent memory: the durable decisions, requirements, and constraints, written down as plain Markdown next to the code.

  • Repo-native — Markdown that lives in your project and travels in git, with or without a runtime on top.
  • Agent-agnostic — the contract is a file (BRAIN.md). Any agent that can read it can use the brain.
  • Correct by construction — every write goes through the brain CLI, so the brain's invariants can't be broken by a malformed edit. There is no validator because none is needed.

The test for what belongs in it: will this still matter in six months, and is it hard to reconstruct from the code itself? If yes, it goes in the brain. Pure implementation details and anything readable straight from the code and git history stay where they are.

Quick start

1. Install the tools once (global) — no clone required. This puts brain on your PATH and copies skills into every detected agent (~/.claude/skills, …):

npm install -g @mindmux/brain-md
brain setup -y
# reverse: brain uninstall   # never touches any project's brain data

Prefer not to install globally? Use npx for both steps (npx does not leave brain on your PATH):

npx @mindmux/brain-md setup -y
npx @mindmux/brain-md init          # same as step 2 — not bare `brain init`
# reverse: npx @mindmux/brain-md uninstall

From a git checkout of this repo you can still run ./setup (same installer; use --symlink while developing the toolkit).

2. Initialize a project (from the project root; requires the global install from step 1, or use npx @mindmux/brain-md init above):

brain init
# or, after setup only (no global bin): node ~/.claude/skills/brain-page/bin/brain.mjs init

This ensures BRAIN.md, scaffolds empty brain data (brainRoot-aware), and default-wires CLAUDE.md + AGENTS.md (creates them if missing; if they already exist, only updates the marked brain block — never whole-file overwrite). Optionally use the brain-setup skill for the same flow plus a pre-commit hook, or brain install-hooks for a project-local Claude Code SessionStart snapshot (--agent codex for Codex).

3. Seed real knowledge — run the brain-bootstrap skill. On an existing project it reads the code, docs, and git log to draft the root pages and capture key decisions; on a near-empty one it interviews you. (Init leaves content seeding as a deliberate next step.)

4. Work as usual. Maintain the brain while coding: load relevant pages at task start; capture decisions/constraints when they settle; skip pure implementation noise; reverse when overturning. All reads/writes go through the brain CLI following BRAIN.md — never hand-edit brain files.

See it work

The point of a brain is what happens across sessions — a decision made today is still there, with its rationale, weeks later:

You    Let's store config as Markdown, not SQLite — easier to diff and migrate.

Agent  Capturing that as a decision so it outlives this session.
       $ brain create-page --id config-as-markdown --category decision \
             --title "Store config as Markdown, not SQLite"
       ✓ page created · indexed

— three weeks and a fresh session later —

You    Why aren't we using a database for config?

Agent  $ brain read-page config-as-markdown
       We chose Markdown for diff-ability and zero migrations. Here's the original call
       and the trade-offs we weighed …

The brain CLI

Reading and writing the brain both go through one zero-dependency Node CLI (run with node):

brain() { node skills/brain-page/bin/brain.mjs "$@"; }   # or use the global `brain` bin after npm install -g

brain init                                   # BRAIN.md + skeleton + default wire CLAUDE.md / AGENTS.md
brain wire                                   # same default wire (no --agent needed)
brain install-hooks                          # opt-in Claude Code SessionStart snapshot (project-local)
brain uninstall-hooks                        # remove that SessionStart hook
brain install-hooks --agent codex            # opt-in Codex startup/resume/compaction snapshot
brain uninstall-hooks --agent codex          # remove only the Codex hook
brain brain-dir                              # where is the brain?
brain list-pages                             # list pages
brain read-page my-decision                  # read a page
brain create-page --id my-decision --category decision --title "Use X over Y"
echo "the new understanding" | brain update-truth --id my-decision --summary "why it changed"
brain append-timeline --id my-decision --kind evidence --summary "benchmark confirmed it"
echo "## Overview …" | brain update-root architecture
brain reindex && brain lint-links

A page carries a rewritable compiled_truth (the current best understanding) plus an append-only timeline (the chain of evidence). update-truth rewrites the truth and appends its timeline entry in one atomic write — so the understanding can never change without a trace.

Codex lifecycle hooks

From the project root, run brain install-hooks --agent codex. It installs .codex/hooks/brain-session-start and merges one SessionStart command into .codex/hooks.json. Run brain uninstall-hooks --agent codex to remove it. No flag still means Claude Code; --agent claude-code is also accepted.

Use Codex CLI 0.153.4 or newer as the supported baseline for this integration (release notes). Older releases have not been validated. Node 18+ and a POSIX shell with awk must be available to the hook (macOS/Linux; native Windows shells are not supported). The hook locates the CLI in installed skill directories or on PATH; BRAIN_CLI can specify its absolute .mjs path.

Trust the project and use Codex /hooks to review and trust the installed command. Hooks must be enabled (features.hooks, enabled by default in this release). The installer leaves global configuration, config.toml, and trust settings alone; malformed settings or a foreign script at the destination produce an error without overwriting them. If inline TOML hooks already exist, Codex loads both sources. The command contains an absolute project path: uninstall before moving a project, then reinstall at its new location. Do the same for a separate clone/worktree; do not share the generated absolute command between machines.

The documented lifecycle covers startup, resume, clear, and post-compaction through SessionStart. The hook resolves the brain via brain brain-dir, including relative or absolute brainRoot redirects, and emits only brain list-pages metadata. It exits successfully without context when the brain is missing/unpopulated or the CLI fails; Codex limits execution to five seconds. Page bodies are read on demand with brain read-page .

Astra experimental context

Codex snapshots are limited to 8 KiB of UTF-8, preserving complete rows and leaving Codex's own context limit enabled. Truncated snapshots tell the agent to run brain list-pages for the full index. This keeps the same bounded behavior with or without Astra's experimental context management. Snapshots refresh at each supported boundary; an unchanged index is not suppressed across context windows.

For eligible clients, opt in yourself in config.toml, then start a new task:

[features.context_management]
experimental_mode = true

See current eligibility and behavior: the launch guide lists ChatGPT Plus/Pro, excluding Business, Enterprise, and API-key sign-in; the configuration reference also lists Pro Lite. The installer does not enable this experiment or change model or compaction settings.

When native notes/history are available, retain relevant brain page IDs and unresolved task state there, search earlier task history for evidence, and re-read brain pages for current facts after a rollover. Run brain wire --agent codex to refresh this guidance in AGENTS.md. Hooks never write native notes or brain pages. Automatic experimental-rollover delivery and the desktop app require separate runtime validation; do not assume all experimental rollovers emit ordinary compaction events. The wired instructions and explicit CLI reads remain available.

How it works

Three design choices keep the brain durable and tamper-evident:

  • Correct by construction, no validator. The CLI is the only writer. Frontmatter is always generated, and update-truth rewrites understanding + records why in a single atomic write. The two things a validator used to guard are now structurally impossible.
  • Exactly one brain, location-independent. It defaults to ./brain, but a project can redirect it via brainRoot in .mindmux/preferences.json (e.g. an external sidecar). Every command resolves the location itself — tools never create a second, shadow brain.
  • Pure files, portable. The brain is Markdown plus one Node script — it lives in your repo and travels in git, and runtimes (MindMux over MCP, more to come) layer on top of the same files.

The skills that drive it all:

skill what it does
brain-setup same scaffold/wire as brain init, plus optional pre-commit and Claude Code/Codex SessionStart hooks — prefer brain init for day-to-day
brain-bootstrap seed the brain from code / docs / git log — or interview you on a greenfield project
brain-page the operating manual for reading and writing pages + root pages (carries the brain CLI)
brain-ingest digest a conversation, document, or research result into the brain

brain.md is led and incubated by MindMux — the standalone open-source landing of MindMux's Brain Spec + coding-agent adapter. The specification layer uses neutral naming so it can be adopted widely; stewardship and maintenance belong to MindMux. Licensed under Apache-2.0.

Frequently asked questions

Is brain.md free to use?

brain.md is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does brain.md do?

A persistent, file-based memory layer for coding agents — give Claude Code, Codex & others a project brain (durable decisions, requirements, constraints) via a

What is brain.md written in?

brain.md is primarily written in JavaScript. Its source is publicly available at https://github.com/mindmuxai/brain.md, and it has 553 GitHub stars.