Open source · MIT · built for Claude Code, works with any agent

Your coding agent forgets everything.
Make it stop.

One file it reads first and writes last. A crew where no agent grades its own homework. Hooks that make both non-optional. Extracted from a 53-repo fleet where it has run every day for months.

$ npx agent-brain-kit setup

The loop that stops the rot

Read the brain, do the work, write the brain. Step three is the one everybody skips, and skipping it is what makes step one worthless. brain-kit makes skipping it fail a hook.

The session loop: read BRAIN.md, the crew works with independent qa and reviewer gates that can send work back to the builder, then write BRAIN.md so the next session starts warm.

Same request. Different memory.

The agent on the right is not smarter. The answer was written down once, it read the file, and the crew caught a test that never ran.

Side by side terminals: without a brain the agent repeats a mistake from March; with brain-kit it reads the gotcha, plans a backoff, qa sends it back once, then it passes and the brain is written.

That was an illustration. This is a real run.

A small sample repo, the published package, and one real Claude Code session given only the prompt setup suggests. The session also wrote a changelog entry, a "left off" pointer and a new date without being asked, because the loop told it to. 60 → 85. §5 stays empty until something bites.

Every line is the command's real output, from these raw captures. The 74-second session is sped up and its summary cut to two of its own sentences.

A crew that can't grade its own homework

Seven Claude Code subagents with one rule between them: the agent that wrote the code never certifies it. QA proves it runs. Review judges if it's good. Either one sends it back with the exact miss.

read-only

explore

Maps the codebase before anyone plans. Never writes a file.

plans

planner

Turns a spec into phased tasks, and appends a QA task and a Review task to every phase. Always.

builds

builder

Implements exactly one scoped task. Out-of-scope writes are a review failure.

tests

test-writer

Writes the tests the builder doesn't get to write for itself.

gate

qa

Trusts nothing it didn't run. Re-runs every check from a clean state. Returns VALIDATED or the exact failures.

gate

reviewer

Runs only after QA passes. Grades against a rubric. Below full marks anywhere means revise.

sourced

researcher

Answers what the codebase can't with one sourced report. Never touches product code.

enforced

+ hooks

Brain-check on session end, a gate that says what it skipped, secret scan, guard rails.

The receipts

Not a weekend demo. Counted from the private fleet this kit was extracted from — names removed, numbers not. How each number was counted →

53
repos running it
product, infra, library and game repos
118
days in daily use
first BRAIN.md commit 2026-07-10
3,142
commits that wrote a brain
~1 in 3 of all commits
~2,600
gotchas written down
each one learned the hard way exactly once
57
times QA failed “done” work
the builder said finished; an independent run said no
296
reviewer REVISE verdicts
sent back with the exact rubric miss
~1,490
sessions handed over
by changelog, not by a lossy handover
8,098
tests in the biggest repo
its latest recorded full run

Hall of Gotchas

Every one of these was learned the hard way exactly once, then written into a brain so no session ever paid for it again. Read all of them →

testing

1,141 tests green. The CLI died on --help.

A vault CLI passed typecheck, lint and every test, then crashed the first time anyone ran it: a value import from a workspace barrel that only real Node ESM rejects.

Rule → Running the real binary is part of the release check.
agents

The launcher passed both gates and launched nothing.

QA and review signed off. The first real click opened a blank session: a list-valued CLI flag had swallowed the brief.

Rule → {ok: true} only proves the code returned. Exercise it and record what you saw.
tooling

| tail turned a failing suite into exit 0.

“1 failed” printed right above “exited with code 0”. The exit code was tail’s, not the suite’s.

Rule → Gates check exit codes with pipefail. Never grep coloured output.
data

Split on '\n', got nothing on CRLF.

A markdown parser returned zero sections on a Windows-written file: a blank dashboard, not an error.

Rule → Tolerance belongs in the parser.
tooling

The migration CLI exits 0 when nothing ran.

Misnamed migration files are skipped with a polite message and a clean exit. Four repos documented that as their migrate command.

Rule → A clean exit is never evidence. Check the catalogue.
deploy

The busiest brain vanished first.

The GitHub contents API stops inlining files at 1 MB. The most active product’s brain crossed it and went “unavailable” every day.

Rule → Ask for the raw media type, and archive history out of the brain.

Is your agent's memory healthy? Find out here.

This is the real doctor, the same code the CLI runs, here in your browser. Enter any public GitHub repo, or paste your own BRAIN.md and CLAUDE.md / AGENTS.md. Pasted text never leaves this page.

Reads BRAIN.md, .claude/CLAUDE.md, CLAUDE.md, AGENTS.md and .claude/agents/ from the default branch, straight from GitHub. Try this kit's own repo or a fresh template.

Pick a repo or paste a brain, and the report appears here.

Sixty seconds to a brain

Install into any repo

Creates BRAIN.md, the loop in .claude/CLAUDE.md, the crew and the hooks. Never overwrites a file you already have.

npx agent-brain-kit setup

Let the agent fill it

Open Claude Code and ask it to fill BRAIN.md §1 and §2 from the codebase. From then on it maintains the rest itself.

Check it any time

Score the brain and get a one-line fix for every miss.

npx agent-brain-kit doctor

"A brain that's updated usually is worse than useless — you can't trust it, so you re-investigate anyway. Read every time. Write every time."