Open source · TypeScript · Next.js

Repository intelligence you can check against the code.

Give Brody a folder, a ZIP, or a GitHub repository. It parses with real parsers, builds a symbol and dependency graph, reviews with deterministic analyzers and optional AI, and proves what it can with Lean 4. A claim that does not cite lines that exist is dropped. The code it analyzes is never executed.

  • Evidence on every finding
  • Lean 4 proofs
  • Live AI cost
Code review: a verified finding with evidence, business impact, remediation, and a patch validated against the real file.
Code review. Static analysis, AI review, and formal proofs stay labelled apart.

Features

What you get from one analysis

Every view below is a real Brody screen, generated from the same stored analysis. There is no separate “quality score.”

Findings you can trace

Each finding has an ID, severity, confidence, the exact lines, what happens, why it matters, the business impact, a fix, and, where possible, a patch that has been applied to the real file to prove it fits. Filter by severity, category, source, status, confidence, and functional area.

An AI fix prompt condenses the open issues, with their fixes, validated patches, and evidence, into one Markdown prompt for Claude Code, Cursor, Copilot, or ChatGPT.

Defects proved, not guessed

The functions that most need it — open AI claims first, then high complexity, dense arithmetic, and names that decide amounts, limits, state, or access — are modelled in Lean 4 and checked by Lean’s kernel.

Brody can prove a guarantee, prove a concrete counterexample (the input that breaks the code, ready to become a regression test), confirm an AI claim, or remove a false positive by proving the claimed failure cannot happen. Unchanged functions reuse their proofs.

Formal proofs: a function modelled in Lean 4, its modelling assumptions, the divergences the fidelity audit weighed, and guarantees proved with the axioms each rests on.
Formal proofs: the model, the fidelity audit, and the axioms each guarantee rests on.

See how it fits together

The code map goes from functional areas to files to a single symbol, marks risk, exports Mermaid, and answers “if I change this, what could I affect?” System explanation has four zoom levels — the whole system, groups of files, one file, and a symbol — and every statement links to its source.

Code map: functional areas laid out by layer, with dependencies, risk marks, and a change-impact panel.
Code map of Brody’s own repository, laid out by layer.

Know what the run costs

A gauge on every project page shows the tokens and estimated cost of the latest analysis, updating while it runs, with the model that answered, a per-step breakdown, and the prices used. Local or unpriced models show tokens and “cost n/a” rather than a guess.

Without an API key, every deterministic stage still runs. AI stages say plainly that they were skipped.

The AI usage gauge: live tokens and estimated cost, with the model, a per-step breakdown, and the pricing basis.
Live tokens, estimated cost, and the pricing basis for the run.

Security and privacy

One assessment, two reports

A security assessment covers overall risk and its reasons, the attack surface, OWASP Top 10 (2021) coverage, CWE-mapped findings, the controls found in the code, and a Now / Next / Later plan. A privacy review inventories personal-data fields, subjects, likely third parties, and regulatory indicators. Both are built from the same verified findings as the code review.

Ask and search

Questions answered from the graph

Structural questions — who depends on this, what writes to orders, what happens after POST /checkout — are answered from the graph. Open questions go to the model with retrieved excerpts. Every answer cites lines and says when the evidence is not enough. Search covers files, symbols, code, findings, and generated documentation.

Reports

A deck for the room, files for the record

Every view downloads as PDF, Word, Markdown, a web page, or JSON. The executive deck is a 14-slide briefing in business language, as PowerPoint with speaker notes, PDF, or a page you can present from. Each slide names the report section behind it.

Explainers

The same result, four ways

An Ask answer, a file, an area, a finding, or the whole system can become a clear explanation, a diagram, an interactive explainer, or a narrated video. All four come from one grounded explanation. Animation is cut to measured word timings, not a guessed speaking rate. Narration stays on the machine unless you allow a cloud voice.

Architecture

Layers, routes, and the data model

The architecture view maps layers, entry points, the API, an entity-relationship diagram, external services and what fails if they are down, environment variable names, ports, feature flags, CI, infrastructure, and tests.

Handoff

A Brody bundle

Export a project as one zip: the analysis, source with detected secrets redacted, reports, and one-click launchers. Open it in any Brody with the full interface and no re-analysis, or read the HTML report without Brody at all.

How it works

Deterministic first. Models second. Evidence last.

Brody does not turn a repository into one giant prompt. The pipeline below is the persisted job in src/lib/jobs/stages.ts.

  1. Ingest
  2. Parse
  3. Symbol and dependency graph
  4. Retrieve
  5. Analyze
  6. Prove
  7. Verify
  8. Explain
  9. Map
  10. Report
1

Parse what is actually there

Files are classified, hashed, and language-detected. Tree-sitter grammars cover TypeScript and TSX, JavaScript, Python, Go, Java, C#, Ruby, Rust, PHP, CSS, HTML, JSON, and Shell. SQL, Prisma, GraphQL, Markdown, and YAML have their own parsers. Other languages use text inspection and are marked as such, never as an AST.

2

Build a graph, then retrieve from it

Imports resolve to files, including tsconfig path aliases. Calls resolve to symbols with a confidence score. ORM and query calls become reads and writes. Routes, models, entry points, external services, environment names, tests, and infrastructure are detected from those facts. Retrieval ranks excerpts with BM25, graph neighbours, and a PageRank importance prior.

3

Review in layers, and say which layer spoke

Static checks come first: built-in rules, TypeScript syntax diagnostics, ESLint with a fixed embedded config, Python ast, Ruff in isolated mode, gofmt -e, plus structural and privacy checks. Six AI passes then run over retrieved excerpts: security; privacy; reliability and correctness; performance and data; architecture and API; testing and operations. Lean 4 follows, then a verifier that re-anchors quotes and rejects patches that do not apply.

4

Explain from the bottom up

Documentation is built symbol, then file, then functional area, then architecture, then an executive summary. A deterministic baseline always exists. AI may enrich it, and statements whose evidence does not resolve to real lines are dropped. Re-analysing a changed repository reprocesses only what changed.

The fourteen persisted stages

A refresh or a restart does not lose the job. Each stage ends done, skipped with a reason, warning, or failed.

  1. Importing repository
  2. Enumerating files
  3. Parsing source
  4. Building symbol and dependency graph
  5. Indexing for retrieval
  6. Detecting architecture
  7. Running static analysis
  8. Reviewing code
  9. Formally verifying complex code (Lean 4)
  10. Verifying findings
  11. Generating documentation
  12. Building code map
  13. Building executive deck
  14. Finalizing report

Quick start

Run it locally. It does not need a key to be useful.

Node 24 is the version CI and the Docker image use (.nvmrc). AI keys are optional. Then upload fixtures/sample-shop, a small shop backend with deliberate flaws. Then open http://brody.localhost (Docker) or http://brody.localhost:3003 (npm run dev); it needs no setup.

Docker

The image includes Ruff and a Lean 4 toolchain, runs as non-root with all capabilities dropped, and keeps SQLite in the brody-data volume.

cp .env.example .env
docker compose up --build

Local

Dependencies install without running their install scripts. Optional: ruff and python3 for Python analysis, and Lean 4 for proofs. If Lean is missing, the home page can install it.

npm install
cp .env.example .env
npm run dev

Command line

Writes Markdown, PDF, Word, HTML, and JSON. The same npm scripts run on Windows. start brody is the macOS and Linux background helper.

npm run analyze -- ./path/to/project --out ./report

Brody answers on loopback, including any .localhost name, and on the names in ALLOWED_HOSTS (default brody), and refuses other host names. The README quick start covers that check, Windows, and start brody.

Home: upload files, a folder, or a ZIP, import from GitHub, or open a Brody export.
Start from files, a folder, a ZIP, a GitHub repository, or a Brody export.

Architecture

One Next.js process, one SQLite file

The UI, the JSON API, and an in-process job worker share a SQLite database. Parsing uses tree-sitter WebAssembly, so install does not need a compiler. The worker can be split out with EMBEDDED_WORKER=off and npm run worker. Design notes live in docs/ARCHITECTURE.md.

src/lib/ingest

Upload, ZIP, and GitHub import. Classification and secret redaction.

src/lib/parse

Tree-sitter extractors, text fallbacks, and parse worker threads.

src/lib/graph

Imports, calls, data access, and importance.

src/lib/review

AI review passes, verification, patch checks, and dedupe.

src/lib/formal

Lean 4 targets, models, repair, the axiom check, and the fidelity audit.

src/lib/explainer

Explanation IR, narration, measured timing, and video jobs.

src/lib/map

Trees, graphs, change impact, and diagrams.

src/lib/deck

The 14-slide executive deck, from the same analysis as the report.

System explanation at the whole-system level, with statements linked to source.
System explanation. Four zoom levels, each statement linked to the lines it came from.

Security model

Imported code is data. It is never executed.

ZIPs are read in memory with entry, size, and compression-ratio limits. Paths that escape the archive are rejected, and symlinks are skipped. Analyzers only parse. Repository ESLint configs are ignored because they are JavaScript. mypy and go vet are not run, because they load plugins or resolve modules.

Lean source is written by a model that read untrusted code, so constructs that can execute code or fake a proof are refused before Lean runs. Lean itself gets no inherited environment, a private temporary directory, a memory cap, a heartbeat limit, and a hard kill.

What a result does not mean

  • A proof is about a model of the function. Lean checks the proof. An audit checks the model, and a proof the audit disputes is never used as a finding.
  • Call and data-flow edges are static and carry confidence scores. Dynamic dispatch, reflection, and routes registered at runtime are not visible.
  • There is no user authentication. Brody is single-tenant: anyone who can reach the port can read every project. Run it locally, or behind an authenticating proxy.
  • Dependency CVEs are not looked up. Brody works offline. Regulatory indicators in the privacy review are not legal advice.
  • Languages without a tree-sitter grammar in this repo are read as text, so their symbols are approximate.

To report a vulnerability in Brody itself, use private vulnerability reporting. See SECURITY.md.