Skip to content

Qryptonic/swarmlab

Repository files navigation

Swarm Lab

Autonomous multi-agent code evolution system powered by Claude. Uses genetic algorithms and specialized AI agents to iteratively improve code solutions.

Quick Start

# 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

Core Commands

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"

Options

-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

View Results

npm start history        # see evolution history
npm start export -o out.py   # export best solution
npm start dashboard      # launch web UI on :3333

GPU Setup (A4000)

npm start gpu --status              # check connection
npm start gpu --models              # list available models
npm start models                    # recommended models

9-Agent Architecture

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

Evolution Modes

Standard Mode

Fixed prompts, basic genetic evolution:

npm start run "problem description" -l python -g 50

Meta Mode (Recommended)

Self-improving prompts + persistent memory:

npm start meta "problem description" -l python -g 50 -p 8

Ensemble Racing

3 strategies compete in parallel, best wins:

npm start race "problem description" -l python -t 10

QScout Integration

Security-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 typescript

Web Dashboard

Launch the web UI to monitor evolution in real-time:

npm start dashboard
# Opens http://localhost:3333

Features:

  • Real-time fitness graphs
  • Population visualization
  • Agent activity logs
  • Best solution preview
  • Generation history

Project Structure

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

Environment Variables

Variable Description
ANTHROPIC_API_KEY Required - Claude API key
GPU_HOST Optional - A4000 server IP
QSCOUT_PATH Optional - Path to QScout installation

Run All Night (Maximum Power)

nohup npm start meta "build a secure auth system" -g 500 > lab.log 2>&1 &
tail -f lab.log

License

MIT

Links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published