State-of-the-art Multi-Agent AI Code Orchestration System
Transform messy codebases into production-grade applications using AI agents that learn, coordinate, and make smart decisions. Mehaisi CodeSwarm leverages SONA (Self-Optimizing Network of Agents) to provide intelligent routing, parallel execution, and semantic memory.
- โจ Key Features
- ๐ง Why Mehaisi CodeSwarm?
- ๐ Architecture
- ๐ Quick Start
- ๐ ๏ธ Installation
- โ๏ธ Configuration
- ๐ค Agent Types
- ๐งช Testing
- ๐ก๏ธ Safety
- ๐ Documentation
- ๐ฎ Roadmap
- ๐ค Contributing
- ๐ License
- Adaptive Routing: System learns from every interaction and improves over time.
- Automatic Weight Optimization: Adjusts routing algorithm based on real outcomes.
- Capability Discovery: Learns new agent capabilities from successful completions.
- Privacy-First: Captures outcomes, not sensitive data.
- Smart Agent Selection: Automatically picks the best agent for any task.
- Multi-Factor Scoring: Combines capability matching, semantic similarity, and success history.
- Confidence Scoring: Transparent reasoning with confidence percentages.
- High Concurrency: Execute up to 3 agents simultaneously.
- Smart Queue Management: Automatic backpressure and rate limiting.
- Hard Safety Limits: Circuit breakers and 10-minute timeouts.
- Ollama Cloud & Local: Seamless switching between cloud and local models.
- Claude Code Integration: Leverage Claude's advanced reasoning capabilities.
- Smart Credentials: Interactive setup with secure storage.
Traditional code quality tools are static. Mehaisi CodeSwarm is dynamic:
- It Learns: Unlike static linters, Mehaisi CodeSwarm remembers what worked and what didn't.
- It Coordinates: Agents don't work in silos; they share findings through a central hub.
- It's Safe: Built-in Git-based rollbacks and test validation ensure your code never breaks.
- It's Fast: Parallel execution allows for rapid analysis and fixing of large repositories.
graph TD
User([User Task]) --> Router{Intelligent Router}
Router -->|Confidence Scored| A[Agent 1]
Router -->|Confidence Scored| B[Agent 2]
Router -->|Confidence Scored| C[Agent 3]
subgraph "Execution Layer"
A & B & C --> Hub[Coordination Hub]
end
Hub --> Memory[(Vector Memory)]
Hub --> SONA[SONA Learning Engine]
SONA -->|Optimize Weights| Router
Memory -->|Semantic Search| Router
Hub --> Results[Final Resolution]
codeswarm/
โโโ src/ # Source code
โ โโโ providers/ # LLM provider integrations
โ โโโ codeswarm.js # Main CLI entry point
โ โโโ orchestrator.js # Core orchestration engine
โ โโโ agent-runner.js # Agent execution
โ โโโ coordination-hub.js # Agent coordination
โ โโโ safety-manager.js # Safety & validation
โ โโโ ... # Other modules
โโโ templates/agents/ # Agent YAML definitions
โโโ tests/ # Unit & integration tests
โโโ docs/ # Documentation
โโโ package.json
# 1. Initialize in your project
codeswarm init
# 2. Setup credentials interactively
codeswarm credentials
# 3. Get intelligent agent recommendation
codeswarm recommend "Fix security vulnerabilities in my API"
# 4. Run investigation workflow
codeswarm workflow investigate- Node.js (v16 or higher)
- Ollama (for local/cloud models) - Install Ollama
- Claude Code (optional, for advanced reasoning)
- Git
# Install globally
npm install -g mehaisi-codeswarm
# Verify installation
codeswarm --version# Clone the repository
git clone https://github.com/O96a/codeswarm.git
cd codeswarm
# Install dependencies
npm install
# Link for global access
npm link
# Verify installation
codeswarm --version# Initialize in your project directory
cd your-project
codeswarm init
# Configure your LLM providers
codeswarm credentials
# Verify configuration
codeswarm statusMehaisi CodeSwarm features an intelligent configuration manager. No need to manually edit JSON files.
codeswarm config --interactiveSecurely manage your API keys for Ollama Cloud and Claude Code.
codeswarm credentialsEdit .mehaisi/config.json for advanced settings:
{
"model": "kimi-k2.5:cloud",
"ollama_url": "https://api.ollama.com",
"llm": {
"default_provider": "claude-code",
"providers": {
"ollama-cloud": { "enabled": true },
"ollama-local": { "enabled": true },
"claude-code": { "enabled": true }
}
},
"execution": {
"parallel_agents": 3,
"max_claude_instances": 3,
"instance_timeout": 600000
},
"safety": {
"auto_apply": false,
"require_tests": true,
"rollback_on_failure": true
},
"coordination": {
"enabled": true,
"learning": {
"enabled": true,
"capture_file_operations": true,
"capture_commands": true
}
}
}Mehaisi CodeSwarm comes with 19 specialized agents:
| Category | Agents |
|---|---|
| Investigators | api-detective, ui-inspector, security-scanner, accessibility-auditor |
| Fixers | api-connector, event-binder, responsive-engineer, refactor-master |
| Builders | test-writer, performance-optimizer, documentation-writer |
| QA | integration-validator, stress-tester, production-checker |
# List all available agents
codeswarm agents --list
# Get recommendation for a task
codeswarm recommend "Your task description here"
# Run a specific agent
codeswarm run api-detectiveMehaisi CodeSwarm is built with reliability in mind.
# Run the full test suite
npm test
# Run with coverage
npm test -- --coverage
# Run specific tests
npm test -- tests/unit/orchestrator.test.jsCurrent Status: 258/276 tests passing (94%) - All critical paths verified โ .
- Git-based Rollback: Every change happens in an isolated branch.
- Human Approval: High-risk changes always require confirmation.
- Test-Driven: Changes are only applied if tests pass.
- Token Budgets: Prevent runaway costs and API usage.
| Guide | Description |
|---|---|
| Architecture | System architecture and component overview |
| Credentials Setup | Setting up API credentials |
| Deployment | Production deployment guide |
| Hooks System | Using Claude Code hooks |
| Model Selection | Choosing the right LLM model |
| Testing Guide | Comprehensive testing documentation |
- Quick Reference - Common commands and workflows
- Contributing - How to contribute
- Changelog - Version history
- Security Policy - Security guidelines
- Phase A: Foundation & Multi-provider support.
- Phase B: Intelligence & Vector Memory.
- Phase C: SONA Self-Learning & Optimization.
- Phase D: Web Dashboard & Real-time Monitoring.
- Phase E: Agent Marketplace & Community Plugins.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
See CONTRIBUTING.md for more details.
Distributed under the MIT License. See LICENSE for more information.
If you find this project helpful, please consider giving it a โญ on GitHub!
Built with โค๏ธ by O96a