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.0a6.tar.gz (376.3 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.0a6-py3-none-any.whl (330.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: brains_ai-0.1.0a6.tar.gz
  • Upload date:
  • Size: 376.3 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.0a6.tar.gz
Algorithm Hash digest
SHA256 c7fe605872fb6d7e9debd8fe317dc8d3d06ceb65a555ae6097c158e6cbcf6240
MD5 7f1b7c3aed28f1dc0bd0bb5c331324f5
BLAKE2b-256 1ba8822b0e0a668875f0e28b414675d1db0b0563b45ea96c9c650fe8ce627ea2

See more details on using hashes here.

Provenance

The following attestation bundles were made for brains_ai-0.1.0a6.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.0a6-py3-none-any.whl.

File metadata

  • Download URL: brains_ai-0.1.0a6-py3-none-any.whl
  • Upload date:
  • Size: 330.3 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.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 301706e07bf818c3129a3784cdeb64b70253eb8ba8f79611208bce3a69616067
MD5 88d146eaf94e395c6d926c1a436aff3d
BLAKE2b-256 0cc45cdfdfaa4fbf5edd88fab73102510c512527b646e71dfde791bac08a301f

See more details on using hashes here.

Provenance

The following attestation bundles were made for brains_ai-0.1.0a6-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