A self-improving AI knowledge base that helps AI coding assistants work smarter.
Think of it as shared memory for your AI tools.
Quick Start β’ Brain-Map Demo β’ Skills Library β’ Contributing
- What is this?
- How it Works
- Quick Start Guide
- Repository Structure
- The Workers
- Skills Library
- Brain-Map Application
- Key Features
- Examples & Use Cases
- Troubleshooting
- Contributing
Imagine you have an AI coding assistant. Every time you start a new project, it starts from scratch - no memory of what worked before, no knowledge of your patterns, no reusable templates.
Brain fixes that.
Brain is a repository that:
- Remembers what works (patterns, conventions, solutions)
- Shares knowledge across all your projects
- Bootstraps new projects with everything already set up
- Improves itself continuously using AI agents
It's like giving your AI assistant a persistent brain that learns and grows.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BRAIN β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Skills β β Templates β β Workers β β
β β (patterns) β β (scaffolds) β β (AI agents) β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β Your New Project β
β (bootstrapped in ~14s)β
ββββββββββββββββββββββββββ
Three AI workers maintain the brain:
| Worker | Role | Speed | Use Case |
|---|---|---|---|
| Cortex | π§ Manager | Standard | Plans tasks, reviews progress, strategic decisions |
| Ralph | π¨ Builder | Standard | Executes tasks, writes code, commits changes |
| Cerebras | β‘ Fast Builder | 94% faster | Token-efficient iteration with 6K token budget |
Cortex plans β Ralph/Cerebras build β Brain improves β Your projects benefit π
First time here? Pick your goal below. Each path takes 2-5 minutes.
New to Brain? Here are the essential docs to get oriented:
- NEURONS.md - Repository structure map (know where everything lives)
- docs/TOOLS.md - Available tools and utilities
- docs/BOOTSTRAPPING.md - Create new projects from templates
- skills/SUMMARY.md - Skills overview and error quick reference
- workers/IMPLEMENTATION_PLAN.md - Current work plan and task backlog
Contributing? See CONTRIBUTING.md for workflow and conventions.
Best for: Starting a new project with Brain's templates and full AI development infrastructure.
Time: ~2 minutes
# 1. Clone brain
git clone https://github.com/jonathanavis96/brain.git ~/code/brain
cd ~/code/brain
# 2. Create project idea
cat > MY_PROJECT.md << 'EOF'
# Project: My Awesome App
Location: ~/code/my-app
Purpose: A web app that does amazing things
Tech Stack: Next.js, TypeScript, PostgreSQL
Goals: User auth, Dashboard, API integration
EOF
# 3. Bootstrap (creates GitHub repo + local clone with full AI infrastructure)
bash scripts/new-project.sh MY_PROJECT.md
# 4. Start building!
cd ~/code/my-app
bash ralph/loop.sh --iterations 5What you get:
- β GitHub repo created automatically
- β Complete Ralph loop infrastructure (worker + verifier)
- β
Project files:
THOUGHTS.md,NEURONS.md,workers/IMPLEMENTATION_PLAN.md - β Connection to brain's skills library
- β Pre-configured validation rules
π Next steps:
- Read
docs/BOOTSTRAPPING.mdfor advanced bootstrapping options - Review
templates/directory to see available project types - Check
CONTRIBUTING.mdto understand the development workflow
Best for: Enhancing your AI coding assistant with proven patterns and best practices.
Time: ~30 seconds
# Clone brain to a known location
git clone https://github.com/jonathanavis96/brain.git ~/code/brain
# Browse skills
cd ~/code/brain/skills
ls domains/ # shell, python, frontend, backend, infrastructure, etc.
# Reference in your AI prompts
# "Check ~/code/brain/skills/domains/shell/strict-mode.md for best practices"Key skill areas:
- Shell: Variable patterns, validation, cleanup, strict mode
- Python: Error handling, testing, async patterns
- Frontend: React patterns, accessibility, performance
- Backend: API design, auth, caching, error handling
- Infrastructure: Deployment, security, observability
- Code Quality: Token efficiency, testing, markdown lint
π Explore the library:
- skills/SUMMARY.md - Quick overview and error reference
- skills/index.md - Complete catalog of all 145+ skills
- skills/playbooks/ - Step-by-step procedures for common tasks
Best for: Exploring Brain's knowledge connections visually with an interactive graph interface.
Time: ~2 minutes
# 1. Navigate to brain-map
cd ~/code/brain/app/brain-map
# 2. Start backend (Terminal 1)
cd backend
source .venv/bin/activate
python -m uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
# 3. Start frontend (Terminal 2)
cd ../frontend
npm install # First time only
npm run devOpen in browser: http://localhost:5173
What you get:
- π¨ Interactive D3.js force-directed graph of your notes
- π Search nodes by title, tags, or content
- π Create and edit markdown notes with frontmatter
- π Visual relationship mapping between concepts
- π₯ Heat maps showing most-connected and active notes
- π Insights panel with orphan detection and density metrics
π Learn more: app/brain-map/START.md
Best for: Contributing to Brain's development or understanding how it maintains itself.
Time: ~5 minutes setup
Prerequisites:
- WSL (Windows Subsystem for Linux) on Windows 11, or Linux/macOS
- Atlassian CLI: Installation guide
- RovoDev access:
acli rovodev auth && acli rovodev usage site
# 1. Clone and setup
git clone https://github.com/jonathanavis96/brain.git ~/code/brain
cd ~/code/brain
bash setup.sh
# 2. Run Ralph (brain's worker)
cd workers/ralph
bash loop.sh --iterations 5
# 3. Monitor progress (in another terminal)
bash workers/ralph/current_ralph_tasks.shπ Learn more:
- workers/ralph/README.md - Ralph loop design philosophy
- workers/ralph/AGENTS.md - Operational guide for AI agents
- NEURONS.md - Complete repository structure map
- CONTRIBUTING.md - Development workflow and guidelines
Start here if you're exploring Brain for the first time:
- Read this README (you're here!) to understand what Brain does
- Browse skills/SUMMARY.md to see what knowledge is available
- Read NEURONS.md to understand the repository structure
- Read CONTRIBUTING.md to learn the development workflow
- Pick a quick start path above based on your goal
What the loop does:
- Commits changes with verification
- Cortex reviews progress and plans next work
Architecture details: workers/ralph/README.md | Operations guide: AGENTS.md
| Resource | Purpose |
|---|---|
| NEURONS.md | Complete repository map |
| THOUGHTS.md | Strategic vision & goals |
| AGENTS.md | Operational guide for AI agents |
| CONTRIBUTING.md | Guidelines for contributors |
| skills/SUMMARY.md | Skills overview + error reference |
| docs/BOOTSTRAPPING.md | Advanced bootstrapping |
| cortex/docs/RUNBOOK.md | Operations runbook |
brain/
βββ app/ # Applications built with Brain
β βββ brain-map/ # Visual knowledge graph explorer
β βββ backend/ # FastAPI server (search, notes, graph)
β βββ frontend/ # React + D3.js visualization
β βββ notes/ # Markdown notes with frontmatter
β
βββ skills/ # Knowledge base (145+ reusable patterns)
β βββ domains/ # Technical patterns (shell, python, etc.)
β βββ playbooks/ # Step-by-step procedures
β βββ projects/ # Project-specific knowledge
β
βββ templates/ # Project scaffolding templates
β βββ cortex/ # Manager templates
β βββ ralph/ # Worker templates
β βββ website/ # Website project templates
β
βββ workers/ # AI worker infrastructure
β βββ ralph/ # Builder worker (executes tasks)
β βββ cerebras/ # Fast inference worker
β
βββ cortex/ # Manager layer (plans work)
β βββ IMPLEMENTATION_PLAN.md
β βββ THOUGHTS.md
β
βββ rules/ # Acceptance criteria & validation
βββ AC.rules
Ralph executes tasks in iterative PLAN/BUILD cycles:
cd ~/code/brain/workers/ralph
# Single iteration
bash loop.sh
# Multiple iterations
bash loop.sh --iterations 10
# Dry run (preview changes)
bash loop.sh --dry-run
# With specific task
bash loop.sh --task "Fix the typo in README.md"Cortex plans and coordinates work:
cd ~/code/brain/cortex
# Get current brain status
bash snapshot.sh
# Start planning session
bash one-shot.shToken-efficient worker using Cerebras inference:
cd ~/code/brain/workers/cerebras
# Run with low token budget
bash loop.sh --dry-run
# Typically uses ~6K tokens per run (vs 98K before optimization)The brain accumulates knowledge in skills/:
| Category | Examples |
|---|---|
| Shell | Variable patterns, strict mode, validation |
| Python | Error handling, testing patterns |
| Code Quality | Token efficiency, markdown patterns |
| Infrastructure | Deployment, security, state management |
| Ralph Patterns | Bootstrap, change propagation |
# 1. Create a new skill
cat > skills/domains/backend/my-pattern.md << 'EOF'
# My Pattern
## When to Use
[Scenarios where this applies]
## The Pattern
[The actual solution]
## Examples
[Code examples]
EOF
# 2. Update the index
# Edit skills/index.md to include the new skillBrain-Map is a full-stack visual knowledge graph application for exploring and managing markdown notes.
- Interactive Graph Visualization: D3.js force-directed graph showing relationships between notes
- Smart Search: Filter nodes by title, tags, or content with real-time results
- Note Management: Create, edit, and delete markdown notes with YAML frontmatter
- Relationship Mapping: Automatic detection of
[[wiki-style]]links between notes - Heat Mapping: Visual indicators for:
- Node centrality (most connected concepts)
- Temporal activity (recently modified notes)
- Relationship strength
- Insights Panel:
- Orphan node detection
- Density metrics
- Suggested connections
- Real-time Updates: File system watcher automatically reflects changes
Backend (FastAPI + Python):
- REST API for notes, search, and graph data
- Full-text search with ranking
- Frontmatter parsing and validation
- File system watcher with debouncing
- Localhost-only security (no external access)
Frontend (React + Vite + D3.js):
- Force-directed graph layout with zoom/pan
- Toast notifications for all user actions
- Filtering and search UI
- Note editing panel with frontmatter support
# Terminal 1: Backend
cd ~/code/brain/app/brain-map/backend
source .venv/bin/activate
python -m uvicorn app.main:app --reload --port 8000
# Terminal 2: Frontend
cd ~/code/brain/app/brain-map/frontend
npm install && npm run devOpen http://localhost:5173 to explore the graph.
π Full documentation: app/brain-map/START.md
Brain improves itself using the Ralph loop. Tasks in workers/IMPLEMENTATION_PLAN.md get executed automatically.
The Cerebras worker uses a gist-then-prune architecture:
- Reads context files once
- Summarizes to STATE
- Prunes raw reads from memory
- ~6K tokens per run (94% reduction from naive approach)
Critical infrastructure is hash-guarded:
workers/ralph/loop.shworkers/ralph/PROMPT.mdworkers/ralph/verifier.shrules/AC.rules
Changes require human approval via waiver system.
Every commit runs through:
- Shellcheck (shell scripts)
- Ruff (Python)
- Markdownlint (documentation)
- Custom acceptance criteria checks
- Search Before Creating - Always check if something exists
- One Task Per Iteration - Focus, complete, commit
- Token Efficiency - Keep context lean
- Documentation = Reality - If they disagree, fix immediately
- Organic Growth - Add patterns when they emerge in 2+ projects
Brain v2.0 - Production Ready
- β Brain-Map Application - Full-stack visual knowledge graph with React + FastAPI
- β 145+ Skills - Comprehensive patterns library across 10+ domains
- β Bootstrap System - ~14 second project creation with GitHub integration
- β Self-Improving Ralph Loop - Autonomous task execution with verification
- β Token-Efficient Cerebras Worker - ~6K tokens/run (94% reduction)
- β Protected File System - Hash-guarded critical infrastructure with waiver protocol
- β Comprehensive Verification - Shellcheck, Ruff, Markdownlint, custom AC checks
- β 9 Project Templates - Backend, Frontend, Website, Go, Python, JavaScript, etc.
- β Multi-Worker Architecture - Cortex (manager) + Ralph (builder) + Cerebras (fast)
- β Knowledge Graph Tools - Visual exploration, orphan detection, relationship mapping
1. Project Bootstrapping
# Create a new Next.js SaaS project in 14 seconds
cat > saas_project.md << 'EOF'
# Project: My SaaS App
Location: ~/code/my-saas
Tech Stack: Next.js, TypeScript, Supabase
Features: Auth, payments, dashboard
EOF
bash scripts/new-project.sh saas_project.md
# β
GitHub repo created
# β
Ralph loop configured
# β
Connected to brain skills
# β
Ready to start iterating2. Knowledge Graph Exploration
- Use Brain-Map to explore relationships between 145+ skills
- Find orphaned documentation that needs connections
- Visualize how different patterns relate to each other
- Quick lookup for "what skills do I have for X?"
3. Continuous Skill Improvement
# Ralph discovers a new pattern while working
# Automatically documents it in skills/
# Updates the knowledge graph
# Pattern becomes available for all future projects4. Documentation-Driven Development
- Keep
IMPLEMENTATION_PLAN.mdas source of truth - Ralph executes tasks from the plan
- Updates documentation as work progresses
- Never falls out of sync
See skills/projects/brain-example.md for a detailed example of how Brain maintains itself.
Problem: Ralph loop fails with "PLAN_DONE.md not found"
# Solution: Initialize the PLAN_DONE marker
touch workers/PLAN_DONE.mdProblem: Bootstrap script can't find templates
# Solution: Ensure you're running from brain repository root
cd ~/code/brain
bash scripts/new-project.sh MY_PROJECT.mdProblem: Brain-Map backend won't start
# Solution: Install Python dependencies
cd app/brain-map/backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtProblem: Brain-Map frontend shows blank graph
# Solution: Ensure backend is running and check notes directory
curl http://localhost:8000/health
ls app/brain-map/notes/*.md # Should show notesProblem: Verifier fails on protected files
# Solution: Request a waiver for critical changes
cd workers/ralph
bash .verify/request_waiver.sh "Reason for change"
# Follow waiver approval processProblem: Skills not syncing to new project
# Solution: Update brain pointer in new project
cd ~/code/my-project
# Edit workers/IMPLEMENTATION_PLAN.md
# Ensure BRAIN_PATH points to ~/code/brain- Documentation: Start with NEURONS.md to understand structure
- Worker Issues: Check workers/ralph/README.md
- Bootstrap Issues: See docs/BOOTSTRAPPING.md
- Contribution Guide: Read CONTRIBUTING.md
See CONTRIBUTING.md for detailed guidelines.
Key areas for contribution:
- Add Skills - Document patterns you've discovered (use skills/self-improvement/SKILL_TEMPLATE.md)
- Improve Templates - Enhance project scaffolding (follow template sync rules in CONTRIBUTING.md)
- Report Gaps - Add entries to
skills/self-improvement/GAP_BACKLOG.md - Fix Bugs - Create issues or submit PRs (run
pre-commit run --all-filesbefore committing)
# 1. Fork and clone
git clone https://github.com/YOUR_USERNAME/brain.git
cd brain
# 2. Create feature branch
git checkout -b feature/my-improvement
# 3. Make changes (add skills, fix bugs, improve templates)
# 4. Run verification
cd workers/ralph
bash verifier.sh
# 5. Commit and push
git add -A
git commit -m "feat(skills): add new pattern for X"
git push origin feature/my-improvement
# 6. Create PR on GitHub| Type | Example | Where to Add |
|---|---|---|
| New Skill | Shell pattern, Python idiom | skills/domains/<category>/ |
| Template Fix | Better defaults, bug fix | templates/<type>/ |
| Bug Fix | Verifier issue, script error | Anywhere |
| Documentation | Improve clarity, add examples | *.md files |
- Search first - Check if pattern/fix already exists
- Follow structure - Use
skills/self-improvement/SKILL_TEMPLATE.mdfor new skills - Test thoroughly - Run verifier before submitting
- Write clear commits - Use conventional commits (
feat:,fix:,docs:)
π Full contribution guide: CONTRIBUTING.md
For AI agents: AGENTS.md contains operational guidance and architecture details.
MIT
Get Started: bash setup.sh then bash scripts/new-project.sh MY_PROJECT.md