aibast-agents-library / rapp_brainstem
CLAUDE.md8 starsChanged 3 months agoMITView on GitHub
RAPP Brainstem is a local-first AI agent server. It's a Flask app that proxies conversation through the GitHub Copilot API with automatic tool-calling via user-defined agents. Single dependency: a GitHub account with Copilot access. Runs on port 7071. Philosophy: "engine, not experience" — infrastructure only, no opinionated UI or workflows (see CONSTITUTION.md). No build step, linter, or type checker is configured. Entry point: brainstem.py — a single-file Flask server (~2,000 lines) that handles auth, chat, agent orchestration, and the web…
- Reads credentials
- Installs packages
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
No build step, linter, or type checker is configured.
- Distinctive: line 37
Call GitHub Copilot API with system prompt + conversation history + tools
- Very specific: line 38
If the LLM returns tool calls, execute agent .perform() methods and loop (up to 3 rounds)
- Very specific: line 69
Use self.metadata["description"] to tell the LLM when to invoke the agent
≈ “Common” is an estimate: at least 1 in 5 of the 25,680 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
RAPP Brainstem is a local-first AI agent server. It's a Flask app that proxies conversation through the GitHub Copilot API with automatic tool-calling via user-defined agents. Single dependency: a GitHub account with Copilot access. Runs on port 7071.
Philosophy: "engine, not experience" — infrastructure only, no opinionated UI or workflows (see CONSTITUTION.md).
Commands
# Start server
./start.sh # macOS/Linux (creates venv, installs deps, runs)
python brainstem.py # Direct run (assumes deps installed)
# Install dependencies
python3 -m pip install -r requirements-dev.txt
# Run all tests
python3 -m pytest tests -v
# Run a single test
python3 -m pytest tests/test_local_agents.py::TestLocalStorage::test_write_and_read -vNo build step, linter, or type checker is configured.
Architecture
Entry point: brainstem.py — a single-file Flask server (~2,000 lines) that handles auth, chat, agent orchestration, and the web UI.
Request flow (POST /chat):
- Load
soul.md(system prompt) and fresh-discover agents fromagents/ - Build OpenAI-format tool definitions from agent metadata
- Call GitHub Copilot API with system prompt + conversation history + tools
- If the LLM returns tool calls, execute agent
.perform()methods and loop (up to 3 rounds) - Return final response +
agent_logs
Agent system:
- Auto-discovered via glob
agents/*_agent.py(flat directory only —agents/experimental/is intentionally excluded) - Each agent is a Python class extending
BasicAgentwithmetadata(OpenAI function schema) andperform(**kwargs)method - Optional
system_context()injects text into the system prompt every turn - Agents are reloaded from disk on every request — edit and test without restart
- Missing pip dependencies are auto-installed at import time
Local storage shim (local_storage.py): Agents import from utils.azure_file_storage import AzureFileStorageManager — brainstem intercepts via sys.modules and provides a local JSON-file implementation under .brainstem_data/. This enables transparent migration to Azure later.
Auth chain: GITHUB_TOKEN env var → .copilot_token file (device-code OAuth) → gh auth token CLI. The GitHub token is exchanged for a short-lived Copilot API token, cached in .copilot_session with auto-refresh.
Key Files
| File | Purpose |
brainstem.py | Main server: all routes, agent loading, Copilot API integration |
agents/basic_agent.py | Base class for all agents |
local_storage.py | Local shim for Azure File Storage |
soul.md | Default system prompt loaded every request |
index.html | Built-in web UI served at / |
VERSION | Semantic version string (currently 0.6.14) |
CONSTITUTION.md | Governance doc defining what belongs in this repo |
Writing Agents
Agents must:
- Live in
agents/with filename matching*_agent.py - Define a class extending
BasicAgentwithmetadatadict (OpenAI function-calling schema) andperform(**kwargs)returning a string - Use
self.metadata["description"]to tell the LLM when to invoke the agent
The agents/experimental/ subdirectory exists for agents that should not be auto-loaded.
Environment
Configuration via .env (auto-created from .env.example by start.sh):
GITHUB_TOKEN— auto-detected fromghCLI if blankGITHUB_MODEL— defaultauto(auto-selects the highest Claude Haiku the account can use — fastest responses — else the highest Sonnet, elsegpt-4o); or pin a specific id. A UI pick is persisted to.brainstem_modeland overrides this. Switchable at runtime via/models/set(autore-selects)SOUL_PATH,AGENTS_PATH,PORT,VOICE_MODE
In this repository509 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- rapp_ai/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- rapp_ai/.github/copilot-instructions.mdCopilot instructions
- community_rappSkill
- generate-demoSkill
- rapp-brainstemSkill
- aibast-easy-mode-brainstemSkill
- aibast-easy-mode-copilotSkill
- aibast-staging-ring-testSkill
- account-intelligence-account-overviewSkill
- account-intelligence-competitive-intelSkill
- account-intelligence-executive-briefingSkill
- account-intelligence-risk-assessmentSkill
- account-intelligence-stakeholder-mapSkill
- account-intelligence-value-messagingSkill
- escalation-routingSkill
- follow-up-planSkill
- handle-inquirySkill
- interaction-summarySkill
- knowledge-searchSkill
- prepare-actionsSkill
- recommend-resolutionSkill
- satisfaction-surveySkill
- benefits-summarySkill
- health-insuranceSkill
- leave-balanceSkill
- parental-leaveSkill
- remindersSkill
- remote-workSkill
- submit-time-offSkill
- time-off-checkSkill
- asset-maintenance-forecast-asset-healthSkill
- asset-maintenance-forecast-budget-projectionSkill
- asset-maintenance-forecast-maintenance-forecastSkill
- asset-maintenance-forecast-work-order-planSkill
- compare-plansSkill
- deadline-remindersSkill
- document-checklistSkill
- election-draftSkill
- enrollment-windowSkill
- life-event-changeSkill
- provider-networkSkill
- approval-routeSkill
- content-scanSkill
- draft-briefSkill
- figure-checkSkill
- gap-reportSkill
- list-templatesSkill
- proactive-applicant-updatesSkill
- new-application-intake-checkSkill
- automated-code-compliance-reviewSkill
- synthetic-permit-fee-estimateSkill
- inspector-board-and-coverageSkill
- intake-triage-and-review-routingSkill
- permit-backlog-and-complaint-riskSkill
- permit-issuance-packageSkill
- permit-status-and-zoning-detailSkill
- permit-review-checklistSkill
- plan-review-routingSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

