$git clone https://github.com/Brain0-ai/brain0<br/>
| 1 | <div align="center"> |
| 2 | |
| 3 | <picture> |
| 4 | <source media="(prefers-color-scheme: dark)" srcset="docs/assets/brain0-wordmark-dark.svg"> |
| 5 | <img alt="brain0" src="docs/assets/brain0-wordmark-light.svg" width="380"> |
| 6 | </picture> |
| 7 | |
| 8 | <br/> |
| 9 | |
| 10 | **The black box for AI-written code.** |
| 11 | |
| 12 | `git` tells you *what* changed. brain0 tells you *why*: which prompt wrote it, |
| 13 | what the agent **read** to write it, and whether you can trust it. |
| 14 | |
| 15 | [](https://github.com/Brain0-ai/brain0/actions/workflows/ci.yml) |
| 16 | [](./LICENSE) |
| 17 | [](https://www.npmjs.com/package/brain0) |
| 18 | [](./crates) |
| 19 | [](./packages) |
| 20 | [](./CONTRIBUTING.md) |
| 21 | |
| 22 | [Quickstart](#quickstart) · [What it answers](#the-questions-your-repo-cant-answer-today) · |
| 23 | [Give your agent memory](#give-your-agent-the-why-layer-mcp) · [How it works](#how-it-works) · |
| 24 | [Comparison](#how-it-compares) · [Docs](./docs) |
| 25 | |
| 26 | <br/> |
| 27 | |
| 28 | <img alt="brain0 — the decision graph of a repository: click any node to read its intent, risk and dated history" src="docs/assets/brain0-demo.gif" width="900"> |
| 29 | |
| 30 | </div> |
| 31 | |
| 32 | --- |
| 33 | |
| 34 | Coding agents now write most of the diff: continuously, in parallel, and opaquely. |
| 35 | brain0 **passively** builds a decision graph of your repository: every **commit** linked to |
| 36 | the **agent intents** behind it, down to the single **function**, with dated history, drift |
| 37 | detection, a DLP audit of what agents *read*, and a two-dimensional **risk score** rendered |
| 38 | green → red. No hooks, no agent cooperation, no code changes: it reads git and the |
| 39 | transcripts your agents already write to disk. |
| 40 | |
| 41 | > Dogfooded from day one: brain0's own development is tracked by brain0. |
| 42 | |
| 43 | ## Quickstart |
| 44 | |
| 45 | ```bash |
| 46 | npx brain0 up |
| 47 | ``` |
| 48 | |
| 49 | That's it. From any repo, `up` infers the repo id from your git remote, indexes the git |
| 50 | history (the **facts**), passively ingests your coding-agent sessions (the **intents**, |
| 51 | with Codex and Claude Code auto-discovered), and opens the GUI at `http://localhost:8787`: |
| 52 | an explorable graph of your codebase, from repo to module, file and symbol, where clicking a |
| 53 | commit reveals the prompts behind it, per-file diffs, and risk at a glance. |
| 54 | |
| 55 | Then make it a habit: |
| 56 | |
| 57 | ```bash |
| 58 | brain0 today # morning triage: what agents did, riskiest first |
| 59 | brain0 report # the accountability report (add --md to share it) |
| 60 | brain0 query "why did the parser break" # root-cause debug over the graph |
| 61 | ``` |
| 62 | |
| 63 | ## What you need |
| 64 | |
| 65 | The only hard requirement is **Node.js ≥ 20**. brain0 is offline-first: with nothing else |
| 66 | installed it still works end to end: deterministic summaries, local feature-hash embeddings, |
| 67 | zero egress. Local models make it *better*, never *required*. |
| 68 | |
| 69 | | Piece | Needed for | Without it | |
| 70 | |---|---|---| |
| 71 | | **Node.js ≥ 20** | everything (`npx brain0 up`) | (required) | |
| 72 | | **git** | commit history (the facts side) | filesystem checkpoint mode (`brain0 watch`) | |
| 73 | | **A coding agent**: Codex (`~/.codex`) or Claude Code (`~/.claude/projects`), auto-discovered | the *why* layer: prompts, drift, reads/DLP | graph of commits + code only | |
| 74 | | **[Ollama](https://ollama.com)** + models (below) | model-written summaries · semantic search · GUI smart chat | deterministic summaries · feature-hash embeddings · retrieval-only answers | |
| 75 | | `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` (opt-in) | a hosted LLM for the GUI smart chat | local Ollama (default) | |
| 76 | |
| 77 | ### Recommended local models |
| 78 | |
| 79 | ```bash |
| 80 | ollama pull qwen3:4b # summarizer (default) |
| 81 | ollama pull qwen3-embedding:0.6b # embeddings (default; nomic-embed-text is the auto-fallback) |
| 82 | ``` |
| 83 | |
| 84 | Both run on modest hardware. On a small GPU (≈4 GB VRAM) use a lighter summarizer for the |
| 85 | first |