Skip to main content

BrainGraph V2

Local-first code intelligence for indexing source files, symbols, imports, and graph relationships. V2 preserves the V1 Python package and CLI, adds Tree-sitter JavaScript/TypeScript extraction, and provides a local dashboard with optional source-grounded AI actions.

Install

After the V2 release is published, install the package into the Python environment used by your terminal, VS Code, Antigravity, Claude Code, or Codex:

python -m pip install --upgrade braingraph

The V2 source checkout can be installed locally before publication with python -m pip install .. For development, use an isolated environment:

python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"

On Windows use py -3.12 -m pip install . if python is not the desired interpreter; on macOS/Linux use python3 -m pip install .. The braingraph command is available in terminals using that same environment.

Scan from a terminal

From the repository you want to index:

braingraph scan .

BrainGraph scans locally, creates .braingraph/ inside the selected project, prints a local dashboard URL, opens it in a browser, and keeps the server running in that terminal. Use Ctrl+C to stop it. The dashboard is for viewing/querying; it has no repository picker or scan controls.

braingraph scan "C:\work\my-project"
braingraph scan . --port 8012
braingraph scan . --no-open
braingraph dashboard .
braingraph update .
braingraph query "authentication flow"

dashboard opens an existing index without rescanning. update rescans in the terminal. The local API docs are at /api/docs on the printed URL.

Project data and token estimates

Each project stores its SQLite index, lexical chunks, graph exports, summaries, report, scan timing, and usage.json in .braingraph/. This folder is ignored by Git. Rescans rebuild indexed data but preserve the usage ledger.

Approximate context-use metrics accumulate per query:

  • baseline: estimated tokens across indexed source files
  • prepared context: estimated tokens returned by retrieval
  • estimated saved: max(0, baseline - prepared context)

These use BrainGraph's local estimator, not the provider tokenizer or billing response. They estimate the context prepared, not proof of the amount sent or billed by an AI service. Historical presentation metrics are not hardcoded.

The generated BRAIN_REPORT.md separately reports summary-size reduction (file summaries compared with indexed source). That statistic is not an AI/query context-reduction result and must not be quoted as one.

See QUALITY_AUDIT.md for the clean-install scan result, representative query measurements, tests, and the limits of those estimates.

Small repositories may show 0% savings: source labels/line references can make a grounded context longer than the raw project. BrainGraph reports that honestly rather than dropping useful evidence to force a target percentage.

Dashboard and AI

The dashboard shows repository counts, dependency graph, diagnostics, cumulative approximate context usage/savings, retrieval results, and source references. The graph can be filtered, zoomed, panned, and opened into a source preview. The complete graph is exported to .braingraph/graph.json.

Scanning and retrieval require no AI key. To enable AI actions, put provider settings in the scanned repository's .env or set them in the terminal:

OPENAI_API_KEY=replace-with-your-provider-key
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_MODEL=gpt-4o-mini

The provider must support OpenAI Chat Completions. Only the question and retrieved context are sent. No matching source means no provider request. The local server binds to 127.0.0.1 and has no authentication; do not expose it to an untrusted network. Never commit a real key.

Tests

python -m pytest -q
ruff check .

Tests cover terminal scan and dashboard startup, .braingraph persistence, rescans, graph/retrieval behavior, context ceilings and cumulative estimates, empty/no-match repositories, provider failures, safe source previews, and Tree-sitter extraction.

V1 and V2

Capability V1 baseline V2
CLI scanner, SQLite, lexical retrieval, NetworkX graph Existing Retained
Project data directory braingraph-out/ .braingraph/
JS/TS Tree-sitter Parse tree discarded Extracts declarations/imports
Browser app Static graph export Local dashboard, metrics, graph, source preview, retrieval and optional AI
Scan workflow CLI scan Terminal scan prints/opens URL; browser cannot scan
Token metrics Report-level estimate Persistent approximate context use and estimated savings

V1 source is preserved separately at https://github.com/Dislike12/BrainGraph for comparison. This V2 repository is https://github.com/Dislike12/BrainGraph-V2. Zepto and Power BI material is excluded.

Screenshots

Screenshots are stored in the source checkout under screenshots/. They are not required at runtime and are not included in the wheel.

Metadata

Release files for braingraph 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for braingraph 0.2.0
File Size Uploaded Provenance Actions
braingraph-0.2.0.tar.gz 55.5 kB With provenance Details for braingraph-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for braingraph 0.2.0
File Interpreter ABI Platform Actions
braingraph-0.2.0-py3-none-any.whl Python 3 none any Details for braingraph-0.2.0-py3-none-any.whl

Total release size: 108.6 kB

Release files / braingraph-0.2.0.tar.gz

Download URL braingraph-0.2.0.tar.gz
Size 55.5 kB
Tags Source
SHA-256 checksum
How to use checksums
67ff2b6a4104750cd7a9b06037c15a9eb7de780e38a3081064a784a2470474cf
BLAKE2b-256 checksum
How to use checksums
b436bb03fd1b074cca00933b5386d0d28daadbf12ffad2d4ca7c3641964b31c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / braingraph-0.2.0-py3-none-any.whl

Download URL braingraph-0.2.0-py3-none-any.whl
Size 53.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0c2bdb98006bb8af350f3e6a720b6bfe4b474b0c0f073f9b58c03b923f750c4
BLAKE2b-256 checksum
How to use checksums
c639433847114b31807cb37d9e939f74089ebb91ef4e54030373d7bc6766f7c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Security for braingraph 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for braingraph-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page