Autonomous multi-agent code evolution system powered by Claude. Uses genetic algorithms and specialized AI agents to iteratively improve code solutions.
# 1. Clone and install
git clone https://github.com/Qryptonic/swarmlab.git
cd swarm-lab
npm install
# 2. Set API key
export ANTHROPIC_API_KEY=sk-ant-...
# 3. Run setup
npm start setup| Command | Usage |
|---|---|
| Basic evolution | npm start run "implement quicksort" -l python |
| Meta-evolution | npm start meta "build a web scraper" -l typescript |
| GPU turbo mode | npm start turbo "solve problem" --gpu 184.105.4.39 |
| Security hardening | npm start qscout harden "input handler" -l python |
| Fix vulnerabilities | npm start qscout-fix ./vulnerable.py |
| Design UI | npm start design dashboard "monitoring panel" |
-l, --language <lang> # python, typescript, go, rust
-g, --generations <n> # max generations (default: 100)
-p, --population <n> # population size (default: 10)
--no-dashboard # disable web UI
--gpu <host> # GPU server IP for acceleration
npm start history # see evolution history
npm start export -o out.py # export best solution
npm start dashboard # launch web UI on :3333npm start gpu --status # check connection
npm start gpu --models # list available models
npm start models # recommended models| Agent | Role |
|---|---|
| Builder | Generates initial code solutions |
| Tester | Creates comprehensive test suites |
| Critic | Scores code quality (correctness, security, performance, readability) |
| Evolver | Mutates and improves code through generations |
| Simplifier | Reduces complexity without breaking functionality |
| Stylist | Ensures visual excellence (score >= 80) for any UI/UX output |
| Attacker | Red team - finds vulnerabilities |
| Defender | Blue team - patches vulnerabilities |
| Researcher | Intervenes when evolution gets stuck |
Fixed prompts, basic genetic evolution:
npm start run "problem description" -l python -g 50Self-improving prompts + persistent memory:
npm start meta "problem description" -l python -g 50 -p 83 strategies compete in parallel, best wins:
npm start race "problem description" -l python -t 10Security-focused evolution with QScout scanner:
# Harden code against vulnerabilities
npm start qscout harden "SQL query builder" -l python
# Fix existing vulnerable code
npm start qscout-fix ./vulnerable.py
# Security audit mode
npm start qscout audit "authentication system" -l typescriptLaunch the web UI to monitor evolution in real-time:
npm start dashboard
# Opens http://localhost:3333Features:
- Real-time fitness graphs
- Population visualization
- Agent activity logs
- Best solution preview
- Generation history
swarm-lab/
├── src/
│ ├── agents/ # 9 specialized AI agents
│ ├── runner/ # Evolution engine
│ ├── fitness/ # Scoring functions
│ ├── db/ # SQLite persistence
│ └── cli.ts # Command-line interface
├── dashboard/ # Web UI (React)
└── config/ # Configuration files
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY |
Required - Claude API key |
GPU_HOST |
Optional - A4000 server IP |
QSCOUT_PATH |
Optional - Path to QScout installation |
nohup npm start meta "build a secure auth system" -g 500 > lab.log 2>&1 &
tail -f lab.logMIT