Brian bridges human project context and LLM coding agents. It ingests engineering signals, stores searchable context, distills durable decisions into Markdown, and exposes that project memory through a web app, an agent API, and a local MCP server.
This repository is a monorepo with a Next.js frontend, a Python agent service, and a Git-backed Markdown "brain" for shared project knowledge.
frontend/ Next.js app, UI, API routes, integrations, and Drizzle database code
agent/ Python brain-agents package, FastAPI app, MCP server, retrieval, and update flows
brian/ Tracked reference knowledge base and architecture docs
brain/ Runtime writable knowledge base, generated locally and gitignored
docs/ Demo and walkthrough docs
On first run, the agent can bootstrap the writable brain/ directory from the tracked brian/ reference tree.
- Node.js and npm
- Python 3.11+
uvfor Python dependency management- Optional: Postgres with
pgvectorfor production persistence - Optional: OpenAI, GitHub, Google Workspace, Slack, and webhook credentials for live integrations
The app can run locally without most credentials. In that mode, it uses deterministic fallbacks and local/in-memory behavior for demos.
Start from the example files and fill in only the integrations you need:
cp .env.example .env
cp frontend/.env.example frontend/.env
cp agent/.env.example agent/.envImportant variables include:
NEXT_PUBLIC_APP_URLfor the frontend URL, usuallyhttp://localhost:3000AGENT_API_URLandNEXT_PUBLIC_AGENT_API_URLfor the Python agent API, usuallyhttp://localhost:8000OPENAI_API_KEY,OPENAI_MODEL, andOPENAI_EMBEDDING_MODELfor LLM and embedding callsDATABASE_URLfor Postgres persistenceGITHUB_TOKEN,BRAIN_REPO_OWNER,BRAIN_REPO_NAME, andBRAIN_REPO_BRANCHfor Git-backed brain storageGOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET, andGOOGLE_COOKIE_SECRETfor Google Workspace importsGITHUB_WEBHOOK_SECRET,GITLAB_WEBHOOK_SECRET,SLACK_SIGNING_SECRET,DISCORD_WEBHOOK_SECRET, andMEETINGS_WEBHOOK_SECRETfor webhook verification
The frontend intentionally reads .env files from the repo root and frontend/.env. Prefer those over .env.local for local setup.
Install and run the agent API:
cd agent
uv sync
uv run brain-apiIn another terminal, install and run the frontend:
cd frontend
npm install
npm run devOpen http://localhost:3000. The agent API defaults to http://localhost:8000.
From frontend/, you can also start the agent API with:
npm run brain-apiFrontend commands:
cd frontend
npm run dev
npm run lint
npm run typecheck
npm run build
npm run db:generate
npm run db:pushAgent commands:
cd agent
uv sync
uv run brain-api
uv run brain-mcpThe Python package includes a local MCP server that exposes Brian's project memory to compatible coding agents:
brain_queryreads context from the knowledge base.brain_updateproposes updates to the writable brain.
Run it locally with:
cd agent
uv run brain-mcpSee agent/LOCAL_MCP_SETUP.md for registration instructions and smoke tests.
The frontend includes webhook-shaped ingestion endpoints for common engineering sources:
POST /api/ingest/githubPOST /api/ingest/gitlabPOST /api/ingest/slackPOST /api/ingest/discordPOST /api/ingest/meetings
If a matching secret is configured, the endpoint verifies incoming requests. If the secret is omitted, endpoints are easier to smoke test locally.
For a production deployment:
- Create a Postgres database with the
vectorextension enabled. - Set
DATABASE_URLand runnpm run db:pushor generate migrations withnpm run db:generate. - Set
OPENAI_API_KEYfor real embeddings and distillation. - Configure Git-backed brain storage with a GitHub token and brain repository settings.
- Set webhook secrets for every external source you enable.
- Deploy the frontend to Vercel or another Next.js host.
- Run the Python agent API somewhere reachable by the frontend and browser WebSocket clients.
frontend/README.mdfor web app details and API smoke testsagent/LOCAL_MCP_SETUP.mdfor local MCP setupagent/brain_agents/retrieval/README.mdfor retrieval internalsagent/brain_agents/update/README.mdfor update and reconciliation internalsbrian/architecture/for system architecture docsbrian/integrations/for integration notesbrian/decisions/for architecture decision recordsdocs/demo-walkthrough-85s.mdfor the demo walkthrough