Skip to main content

Local-first control plane and coordination layer for AI coding agents

Project description

Brains

PyPI Docker CI License: MIT

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

  1. Install
    pipx install brains-ai
    
  2. 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 with brains admin-key show --reveal.
  3. Wire your agents
    brains wire                       # all detected tools (SSE, global)
    brains wire --status              # show what's registered
    
  4. Open the dashboardhttp://127.0.0.1:9876/admin and sign in with the admin key.
  5. 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 wiringbrains wire reference, 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brains_ai-0.1.0a4.tar.gz (364.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brains_ai-0.1.0a4-py3-none-any.whl (322.5 kB view details)

Uploaded Python 3

File details

Details for the file brains_ai-0.1.0a4.tar.gz.

File metadata

  • Download URL: brains_ai-0.1.0a4.tar.gz
  • Upload date:
  • Size: 364.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brains_ai-0.1.0a4.tar.gz
Algorithm Hash digest
SHA256 0d58b6beb2e5ba6ceb865a2e96d2a82ff252f52b13e1934efd018a300bfef785
MD5 74e33d0f8afb1a24c79caa110f62fafe
BLAKE2b-256 01e8708e49fc8b729275fe2d440fed815806a88c7ceb91cd72ac0d4450d3b183

See more details on using hashes here.

Provenance

The following attestation bundles were made for brains_ai-0.1.0a4.tar.gz:

Publisher: release.yml on mekjr1/brains-v2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brains_ai-0.1.0a4-py3-none-any.whl.

File metadata

  • Download URL: brains_ai-0.1.0a4-py3-none-any.whl
  • Upload date:
  • Size: 322.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brains_ai-0.1.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 e5852c7e6f9ae7e97f2d6d400072a7c17db1a7df5f9a6d4909f0ebf5db4bae5a
MD5 f2aa5feadbb07d86bc7378aae76b051b
BLAKE2b-256 0e48d8080f28acc874576e3db3d718e09663e5d2f14c3c9ba567e87240c8b9f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for brains_ai-0.1.0a4-py3-none-any.whl:

Publisher: release.yml on mekjr1/brains-v2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page