Local-first control plane and coordination layer for AI coding agents
Project description
Brains
A smart local proxy for AI coding agents. Routes each request to the right-sized model (no more flagship-by-default), proves the dollars saved on the dashboard, and lets every agent share one brain — sessions, tasks, handoffs, recurring jobs.
Why brains
The problem. Every AI coding tool ships its own provider, its own config, its own session memory. Each one defaults to a flagship model for every request — including the trivial ones — so you pay sonnet / o1 rates to "rename this variable." Worse, providers quietly dumbify their flagship tiers under load and then upsell you to the next tier.
What brains does. A local gateway in front of your agents. Every request is classified (trivial / code_fix / architecture / research / docs_lookup), routed to the cheapest provider + model that can handle that class, and logged. Anthropic- and OpenAI-compatible endpoints mean Claude Code, Codex, Copilot CLI, Cursor, and aider all work with no code changes — just a base-URL swap.
What you get. A real number, on the dashboard, every day: "$X saved this week vs. flagship-default." One admin key. One audit log. One coordination fabric so your agents share sessions, hand off tasks, and stop stepping on each other.
Install
pipx install brains-ai # or: uv tool install brains-ai
brains up # init + gateway + dashboard + MCP
brains wire # register brains into every detected agent
Prefer not to install Python at all? Use the Docker image instead. Want to hack on brains? Use a git checkout. Both paths are documented in Operations.
What's inside
- Smart gateway — Anthropic- and OpenAI-compatible endpoints
(
/v1/messages,/v1/chat/completions,/v1/responses), classifier-based routing with an on/off toggle (toggle + full Anthropic streaming / tool-use facade land in v1.1 — see Roadmap), per-request savings ledger (v1.1), multi-provider (Anthropic, OpenAI, GitHub Copilot, Ollama, OpenRouter, LiteLLM, …). - Coordination plane — sessions, tasks, handoffs, advisory locks, recurring jobs, peer-help RPC, brain-session resume across tool restarts, multi-operator + per-workspace visibility.
- MCP server — every brains capability surfaced as an MCP tool;
one command (
brains wire) registers it into Claude Code, Codex, Copilot CLI, and Cursor. - Dashboard + admin — provider health, runtime config (no restarts), audit log, operator presence, runtime overlay editor. Savings panel and provider-first config UI land in v1.1.
Quickstart
- Install
pipx install brains-ai
- Start the stack
brains up # supervises gateway :8787, dashboard :9876, MCP :9877
On first run, brains generates an admin key and prints it to stderr. View it later withbrains admin-key show --reveal. - Wire your agents
brains wire # all detected tools (SSE, global) brains wire --status # show what's registered
- Open the dashboard — http://127.0.0.1:9876/admin and sign in with the admin key.
- Point a tool at the gateway (so its traffic flows through brains):
# OpenAI-compatible (Codex, Copilot CLI, aider, Continue, …) export OPENAI_BASE_URL=http://127.0.0.1:8787/v1 export OPENAI_API_KEY=<your-brains-admin-key> # Claude Code (Anthropic-compatible) export ANTHROPIC_BASE_URL=http://127.0.0.1:8787 export ANTHROPIC_API_KEY=<your-brains-admin-key>
That's it. Every request is now classified, routed, audited, and shared.
Documentation
- Providers & routing — supported providers, config examples, GitHub Copilot OAuth flow, error envelopes
- Agent wiring —
brains wirereference, strict enforcement, per-tool configs (Claude Desktop, Cursor, Copilot CLI, Codex) - Operations — Docker, dev install, upgrades, extras, admin-key management, auth & secrets, dashboard internals, full CLI catalog
- Architecture — runtime flow, components, process topology
- Protocols — wire format for coordination-plane tools
- Decision records — load-bearing design choices
- Roadmap · Changelog · Security
Contributing
See CONTRIBUTING.md and the Code of Conduct. For security issues, follow the disclosure process in SECURITY.md.
License
MIT © mekjr1 and brains contributors.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file brains_ai-0.1.0a5.tar.gz.
File metadata
- Download URL: brains_ai-0.1.0a5.tar.gz
- Upload date:
- Size: 365.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88437b03e459cf658603db457a3a9f333cc076cabae54b3ff25c769ce2e427e9
|
|
| MD5 |
16c7c56e1d0ce2971c31f5d495f38252
|
|
| BLAKE2b-256 |
22689ec861a865c91db6eb0f15ac35174fa9e42fd0938fe8c7a34456acbd6f13
|
Provenance
The following attestation bundles were made for brains_ai-0.1.0a5.tar.gz:
Publisher:
release.yml on mekjr1/brains-v2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
brains_ai-0.1.0a5.tar.gz -
Subject digest:
88437b03e459cf658603db457a3a9f333cc076cabae54b3ff25c769ce2e427e9 - Sigstore transparency entry: 1806127863
- Sigstore integration time:
-
Permalink:
mekjr1/brains-v2@5494a1cebf4906658fd5f4cffd90dc135b1a4a27 -
Branch / Tag:
refs/tags/v0.1.0a5 - Owner: https://github.com/mekjr1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5494a1cebf4906658fd5f4cffd90dc135b1a4a27 -
Trigger Event:
push
-
Statement type:
File details
Details for the file brains_ai-0.1.0a5-py3-none-any.whl.
File metadata
- Download URL: brains_ai-0.1.0a5-py3-none-any.whl
- Upload date:
- Size: 323.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67708999627aed9b082279d7899cb73e1b1dd5e49f51a63cb20a9ba1acf41516
|
|
| MD5 |
66e46c39d4e06ae6767f61d4c9632c2e
|
|
| BLAKE2b-256 |
4314ea8e081d100c5211659113af9ce816be01989f0c6905ef6b11323f6253a7
|
Provenance
The following attestation bundles were made for brains_ai-0.1.0a5-py3-none-any.whl:
Publisher:
release.yml on mekjr1/brains-v2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
brains_ai-0.1.0a5-py3-none-any.whl -
Subject digest:
67708999627aed9b082279d7899cb73e1b1dd5e49f51a63cb20a9ba1acf41516 - Sigstore transparency entry: 1806128214
- Sigstore integration time:
-
Permalink:
mekjr1/brains-v2@5494a1cebf4906658fd5f4cffd90dc135b1a4a27 -
Branch / Tag:
refs/tags/v0.1.0a5 - Owner: https://github.com/mekjr1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5494a1cebf4906658fd5f4cffd90dc135b1a4a27 -
Trigger Event:
push
-
Statement type: