Brain0-ai/brain0

The black box for AI-written code. Passive decision graph linking every commit to the agent prompts behind it: drift detection, DLP audit of what agents read, evidence-driven risk, MCP memory for coding agents, signed provenance attestations. One command, offline by default.

What it solves

brain0 provides visibility into the "why" behind AI-generated code. While git tracks what changed, brain0 tracks the intent, prompts, and context used by coding agents (like Claude Code or Codex) to make those changes, solving the problem of opaque AI-written diffs and "black box" development.

How it works

It acts as a passive observer that reads git history and the transcripts generated by coding agents on disk without requiring hooks or code changes. It builds a decision graph of the repository, linking commits to agent intents down to the function level. It uses Tree-sitter for symbol extraction and identity tracking, and can integrate with local models (via Ollama) or hosted LLMs for summaries and semantic search. The system also reconciles "declared" changes (what the agent said it did) with "done" changes (what git actually recorded) to detect drift.

Who it’s for

Developers and teams using AI coding agents who need an audit trail, root-cause debugging for AI-introduced bugs, and a way to monitor what sensitive data agents are reading (DLP).

Highlights

  • Passive Observation: No integration or agent cooperation required; it simply reads existing logs and git history.
  • Drift Detection: Identifies gaps between what an AI agent claimed to change and what was actually committed.
  • DLP for Agent Context: Records and scans for secrets in the files agents read during a session.
  • Risk Scoring: Assigns risk scores to files and symbols based on blast radius, churn, and historical evidence (e.g., reverts).
  • MCP Integration: Provides a Model Context Protocol (MCP) server so agents can query the graph to understand the provenance and risk of code before editing it.
  • Local-First: Works offline by default with local embeddings and optional local LLMs via Ollama.

Related

  • Project
  • Project
  • Project
  • Project
  • Dispatch