Skip to content

Parallel Subagent Orchestration Engine for Claude Code implementing the IOSM methodology. Continuous dispatch scheduling, quality gates, auto-spawn protocol.

License

Notifications You must be signed in to change notification settings

rokoss21/swarm-iosm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Swarm-IOSM

Swarm-IOSM

Parallel Orchestration Engine for Claude Code with Built-in Quality Gates

Claude Code Skill IOSM Version License

Features β€’ Quick Start β€’ Architecture β€’ Documentation β€’ Use Cases β€’ Contributing


🎯 What is Swarm-IOSM?

Swarm-IOSM is an advanced orchestration engine for Claude Code that transforms complex development tasks into coordinated parallel work streams with enforced quality standards.

It implements the IOSM methodology (Improve β†’ Optimize β†’ Shrink β†’ Modularize) as an executable system for parallel AI agent coordination, combining:

  • πŸ€– Intelligent Orchestration β€” Continuous dispatch scheduling with dependency analysis
  • πŸ”’ File Conflict Detection β€” Lock management prevents parallel write conflicts
  • πŸ“‹ PRD-Driven Planning β€” Structured requirements β†’ decomposition β†’ execution
  • βœ… IOSM Quality Gates β€” Automated code quality, performance, and modularity checks
  • πŸ”„ Auto-Spawn Protocol β€” Dynamic task discovery and creation during execution
  • πŸ“Š Cost Tracking β€” Budget guardrails with usage monitoring

Core Model: Touches β†’ Locks β†’ Gates β†’ Done

A correctness model for parallel agent work: declare what files you touch, acquire locks to prevent conflicts, pass quality gates, ship.

Why Swarm-IOSM?

Traditional development workflows struggle with:

  • Sequential bottlenecks β€” One task blocks the next, wasting time
  • Context loss β€” Large features lack structured documentation
  • Quality debt β€” No systematic enforcement of engineering standards
  • Manual coordination β€” Developers spend time orchestrating instead of building

Swarm-IOSM solves these by:

  • Parallelizing independent work streams (commonly 3–8x faster than sequential, depends on task independence)
  • Enforcing IOSM quality gates before merge
  • Automating task decomposition and subagent coordination
  • Tracking all decisions and artifacts for full traceability

What Swarm-IOSM is NOT

To set clear expectations:

  • ❌ Not a general-purpose workflow engine β€” Designed specifically for Claude Code agent orchestration
  • ❌ Not a replacement for CI/CD β€” Complements your pipeline, doesn't replace Jenkins/GitHub Actions
  • ❌ Not a code generator "autopilot" β€” Requires human oversight and decision-making
  • ❌ Not safe to run unattended on production repos β€” Always review changes before merge

⚑ 60-Second Demo

# Install
git clone https://github.com/rokoss21/swarm-iosm.git .claude/skills/swarm-iosm

# In Claude Code
/swarm-iosm setup
/swarm-iosm new-track "Add JWT authentication"

What you get:

  • swarm/tracks/<id>/PRD.md β€” Requirements document
  • swarm/tracks/<id>/plan.md β€” Task breakdown with dependencies
  • swarm/tracks/<id>/reports/ β€” Subagent execution reports (after /swarm-iosm implement)
  • swarm/tracks/<id>/integration_report.md β€” Merge plan & results
  • swarm/tracks/<id>/iosm_report.md β€” Quality gate evaluation

See complete example: examples/demo-track/ β€” Full track from PRD to merge (7 tasks, Redis caching feature)


🌟 Key Features

Core Capabilities

Feature Description Benefits
Continuous Dispatch Loop Tasks launch immediately when dependencies are met No artificial wave barriers, maximum parallelism
Parallel Subagent Execution Up to 8 simultaneous background/foreground agents Often 3-8x faster than sequential execution
IOSM Quality Gates Automated checks for code quality, performance, complexity Quality-gated before merge
File Lock Management Hierarchical conflict detection (file/folder) Safe parallel writes, prevents merge conflicts
Auto-Spawn from Discoveries Subagents report new work β†’ orchestrator schedules Self-organizing workflow adaptation
Intelligent Error Recovery Pattern-based diagnosis with suggested fixes Auto-diagnosis with 3 retry limit
Cost & Budget Control Token usage tracking with budget guardrails Predictable API costs (default: $10 limit)
Checkpoint & Resume Crash recovery from last known state Fault-tolerant long-running tasks

Feature Status

Feature Status Command/Location
βœ… Inter-Agent Communication Available in v2.0+ shared_context.md auto-updated
βœ… Task Dependency Visualization Available in v2.0+ --graph flag in orchestration planner
βœ… Anti-Pattern Detection Available in v2.0+ Auto-warns during planning
βœ… Template Customization Available in v2.0+ Override in swarm/templates/
βœ… Simulation Mode Available in v1.3+ /swarm-iosm simulate
βœ… Checkpoint & Resume Available in v1.3+ /swarm-iosm resume
πŸ§ͺ Live Monitoring Experimental /swarm-iosm watch (basic implementation)
πŸ—ΊοΈ IDE Integration Roadmap VS Code extension planned
πŸ—ΊοΈ CI/CD Templates Roadmap GitHub Actions / GitLab CI examples

πŸ—οΈ Architecture

System Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    ORCHESTRATOR (Main Claude Agent)                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚              Continuous Dispatch Loop (v1.1+)                   β”‚ β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
β”‚  β”‚  β”‚ Collect  β”‚β†’ β”‚ Classify β”‚β†’ β”‚ Conflict β”‚β†’ β”‚ Dispatch Batch   β”‚ β”‚ β”‚
β”‚  β”‚  β”‚  Ready   β”‚  β”‚  Modes   β”‚  β”‚  Check   β”‚  β”‚ (max 3-6 tasks)  β”‚ β”‚ β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚  β”‚       ↑                                           β”‚             β”‚ β”‚
β”‚  β”‚       β”‚        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         ↓             β”‚ β”‚
β”‚  β”‚       └────────│  IOSM    │←─│ Auto-    β”‚β†β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚ β”‚
β”‚  β”‚                β”‚  Gates   β”‚  β”‚ Spawn    β”‚                       β”‚ β”‚
β”‚  β”‚                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                                   β”‚                                  β”‚
β”‚               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚               ↓                   ↓                   ↓              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   Subagent (BG)    β”‚ β”‚   Subagent (BG)    β”‚ β”‚  Subagent (FG)  β”‚   β”‚
β”‚  β”‚   Explorer         β”‚ β”‚   Implementer-A    β”‚ β”‚  Architect      β”‚   β”‚
β”‚  β”‚   read-only        β”‚ β”‚   write-local      β”‚ β”‚  needs_user     β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚               β”‚                   β”‚                   β”‚              β”‚
β”‚               ↓                   ↓                   ↓              β”‚
β”‚         reports/T01.md      reports/T02.md      reports/T03.md       β”‚
β”‚         + SpawnCandidates   + SpawnCandidates   + Escalations        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

IOSM Framework Integration

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           IOSM FRAMEWORK                                   β”‚
β”‚                   https://github.com/rokoss21/IOSM                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                            β”‚
β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚    β”‚ IMPROVE  β”‚ β†’  β”‚ OPTIMIZE β”‚ β†’  β”‚  SHRINK  β”‚ β†’  β”‚   MODULARIZE     β”‚    β”‚
β”‚    β”‚          β”‚    β”‚          β”‚    β”‚          β”‚    β”‚                  β”‚    β”‚
β”‚    β”‚ Clarity  β”‚    β”‚ Speed    β”‚    β”‚ Simplify β”‚    β”‚ Decompose        β”‚    β”‚
β”‚    β”‚ No dups  β”‚    β”‚ Resil.   β”‚    β”‚ Surface  β”‚    β”‚ Contracts        β”‚    β”‚
β”‚    β”‚ Invars   β”‚    β”‚ Chaos    β”‚    β”‚ Deps     β”‚    β”‚ Coupling         β”‚    β”‚
β”‚    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚         β”‚               β”‚               β”‚                   β”‚              β”‚
β”‚    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚    β”‚ Gate-I   β”‚    β”‚ Gate-O   β”‚    β”‚ Gate-S   β”‚    β”‚     Gate-M       β”‚    β”‚
β”‚    β”‚ β‰₯0.85    β”‚    β”‚ β‰₯0.75    β”‚    β”‚ β‰₯0.80    β”‚    β”‚     β‰₯0.80        β”‚    β”‚
β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                                                            β”‚
β”‚    IOSM-Index = (Gate-I + Gate-O + Gate-S + Gate-M) / 4                    β”‚
β”‚    Production threshold: β‰₯ 0.80                                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Task State Machine

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ backlog  β”‚  All known tasks
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
     β”‚ dependencies satisfied
     ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  ready   β”‚  Eligible for dispatch
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
     β”‚ no file conflicts
     β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     ↓                 ↓                 ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ running  β”‚    β”‚ blocked_user β”‚   β”‚ blocked_conflict β”‚
β”‚(BG or FG)β”‚    β”‚needs decisionβ”‚   β”‚ file lock held   β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚ completes                          β”‚ lock released
     ↓                                    ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   done   │←────────────────────────│  ready   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚ spawn candidates
     ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ backlog  β”‚  (auto-spawned tasks)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

See the 60-Second Demo above for immediate hands-on, or follow the complete guide:

πŸ“– Full Tutorial: QUICKSTART.md

Key Commands:

/swarm-iosm setup              # Initialize project
/swarm-iosm new-track "..."    # Create feature track
/swarm-iosm implement          # Execute plan
/swarm-iosm integrate <id>     # Merge & run quality gates

Need help? See TROUBLESHOOTING.md for common issues.


πŸ“š Documentation

Core Documentation

Document Purpose Audience
SKILL.md Complete specification (1330+ lines) Advanced users, contributors
QUICKSTART.md 5-minute intro with examples First-time users
RUNBOOK.md Manual orchestration operations Power users
VALIDATION.md Installation & config checklist DevOps, QA
TROUBLESHOOTING.md Common issues & solutions All users

Templates (Progressive Disclosure)

Located in templates/:

  • prd.md β€” Product Requirements Document (10 sections)
  • plan.md β€” Implementation plan with dependencies
  • subagent_brief.md β€” Task instructions for subagents
  • subagent_report.md β€” Structured output format
  • iosm_gates.md β€” Quality gate criteria & scoring
  • iosm_state.md β€” Live execution state tracker
  • integration_report.md β€” Merge plan & conflict resolution
  • shared_context.md β€” Inter-agent communication
  • intake_questions.md β€” Requirements gathering

Scripts (Automation)

Located in scripts/:

  • orchestration_planner.py β€” Generate dispatch plan from plan.md
  • validate_plan.py β€” Check plan structure & dependencies
  • summarize_reports.py β€” Aggregate subagent outputs
  • merge_context.py β€” Update shared context from reports
  • parse_errors.py β€” Error diagnosis & fix suggestions
  • error_patterns.py β€” Known error patterns library
  • errors.py β€” Error handling utilities

πŸ’‘ Use Cases

1. Greenfield Feature Development

Scenario: Add complete email notification system to SaaS app

Workflow:

/swarm-iosm new-track "Add email notification system"
β†’ Intake (mode: greenfield, priority: quality)
β†’ PRD generation (15 min)
β†’ Decomposition:
   - T01: Design email templates (Architect, foreground)
   - T02: Implement SMTP service (Implementer-A, background)
   - T03: Add queue system (Implementer-B, background, parallel with T02)
   - T04: Write integration tests (TestRunner, background, after T02+T03)
   - T05: Add API endpoints (Implementer-C, background, after T02)
β†’ Execute (4-6 hours parallel, vs 12-15h serial)
β†’ IOSM gates: All pass (Gate-I: 0.92, Gate-O: 0.88, Gate-S: 0.85, Gate-M: 0.90)
β†’ Deploy with confidence

Results:

  • ⚑ ~3x faster (4-6h parallel vs 12-15h sequential)
  • βœ… 100% test coverage (Gate-O enforcement)
  • πŸ“‰ Minimal technical debt (Gate-I: 0.92 clarity score)
  • πŸ”„ Full rollback plan auto-generated

2. Brownfield Refactoring

Scenario: Refactor legacy payment processing module (5000+ LOC, 3 years old)

Workflow:

/swarm-iosm new-track "Refactor payment processing"
β†’ Plan mode exploration (T00: Explorer analyzes codebase)
β†’ PRD with rollback strategy
β†’ Decomposition:
   - T01: Map existing payment flows (Explorer, background, read-only)
   - T02: Design new module boundaries (Architect, foreground)
   - T03: Write comprehensive regression tests (TestRunner, background, after T01)
   - T04: Implement new PaymentService (Implementer-A, background, after T02+T03)
   - T05: Migrate first payment method (Implementer-B, background, after T04)
   - T06: Security audit (SecurityAuditor, foreground, after T05)
   - T07: Performance benchmark (PerfAnalyzer, background, after T05)
β†’ Gate-M fails (circular dependency detected)
β†’ Auto-spawn: T08 "Break circular import between Payment and Invoice"
β†’ Re-check Gate-M: Pass
β†’ Integrate with rollback guide

Results:

  • 🎯 Gate-driven quality β€” Forced resolution of hidden issues
  • πŸ”’ Safe refactor β€” All tests passing before merge
  • πŸ“Š Measured improvement β€” 40% reduction in module coupling
  • πŸ—ΊοΈ Clear rollback path β€” Database + code revert instructions

3. Multi-Module Feature with Dependencies

Scenario: Add multi-tenant architecture (affects 8 modules)

Workflow:

/swarm-iosm new-track "Multi-tenant architecture"
β†’ PRD: 20+ tasks identified
β†’ Orchestration plan:
   - Wave 1: T01 Design schema (Architect, foreground, critical path)
   - Wave 2: T02-T04 Database migration scripts (Implementer-A,B,C, parallel, after T01)
   - Wave 3: T05-T10 Update 6 modules (6 Implementers, parallel, after Wave 2)
   - Wave 4: T11-T15 Tests (5 TestRunners, parallel, after Wave 3)
   - Wave 5: T16 Integration (Integrator, foreground, after Wave 4)
β†’ Execute with continuous dispatch (no wave barriers)
β†’ T05 spawns SC-01: "Add tenant_id index to sessions table" (auto-spawn)
β†’ Cost tracking: $6.50 / $10.00 budget used
β†’ IOSM Index: 0.82 (above threshold)

Results:

  • πŸ“ˆ High parallelism β€” 6 modules updated simultaneously
  • πŸ’° Budget control β€” $6.50 spent (within $10 limit)
  • πŸ” Auto-discovery β€” 3 critical tasks auto-spawned from findings
  • ⏱️ Time savings β€” ~18h parallel vs 60h+ sequential (example track)

πŸ† IOSM Quality Gates

Each track enforces 4 quality gates before merge:

Gate-I: Improve (Code Quality)

semantic_coherence: β‰₯0.95  # Clear naming, no magic numbers
duplication_max: ≀0.05     # Max 5% duplicate code
invariants_documented: true # Pre/post-conditions
todos_tracked: true        # All TODOs in issue tracker

Measured by:

  • AST analysis (identifiers, literals)
  • Clone detection (structural similarity)
  • Docstring coverage

Gate-O: Optimize (Performance & Resilience)

latency_ms:
  p50: ≀100
  p95: ≀200
  p99: ≀500
error_budget_respected: true
chaos_tests_pass: true
no_obvious_inefficiencies: true  # N+1 queries, memory leaks

Measured by:

  • Load testing (locust, k6)
  • Chaos engineering (kill processes, network faults)
  • Profiling (py-spy, perf)

Gate-S: Shrink (Minimal Complexity)

api_surface_reduction: β‰₯0.20  # Or justified growth
dependency_count_stable: true
onboarding_time_minutes: ≀15

Measured by:

  • Public API endpoint/function count
  • requirements.txt / package.json diff
  • README clarity test

Gate-M: Modularize (Clean Boundaries)

contracts_defined: 1.0       # 100% of modules
change_surface_max: 0.20     # ≀20% of codebase touched
no_circular_deps: true
coupling_acceptable: true

Measured by:

  • Dependency graph analysis
  • Interface stability metrics
  • Import cycle detection

IOSM-Index Calculation

IOSM-Index = (Gate-I + Gate-O + Gate-S + Gate-M) / 4

Production Threshold: β‰₯ 0.80

Auto-spawn rules:

  • If Gate-I < 0.75 β†’ Spawn clarity/duplication fixes
  • If Gate-O fails β†’ Spawn test/performance fixes
  • If Gate-M fails β†’ Spawn boundary clarification tasks

πŸ› οΈ Commands Reference

Command Description Mode
/swarm-iosm setup Initialize project context Auto
/swarm-iosm new-track "<desc>" Create feature track with PRD Auto
/swarm-iosm implement [track-id] Execute implementation plan Auto
/swarm-iosm status [track-id] Check progress & errors Read-only
/swarm-iosm watch [track-id] Live monitoring dashboard (v1.3) Read-only
/swarm-iosm simulate [track-id] Dry-run with timeline (v1.3) Read-only
/swarm-iosm resume [track-id] Resume from checkpoint (v1.3) Auto
/swarm-iosm retry <task-id> [opts] Retry failed task (v1.2) Auto
/swarm-iosm integrate <track-id> Merge work + run IOSM gates Auto
/swarm-iosm revert-plan <track-id> Generate rollback guide Read-only

Retry Options:

  • --foreground β€” Run interactively for debugging
  • --reset-brief β€” Regenerate task brief from scratch

🧩 Subagent Roles

Standard Roles

Role Purpose Concurrency Tools When to Use
Explorer Codebase analysis, IOSM baseline read-only Read, Grep, Glob Brownfield projects, initial assessment
Architect Design decisions, API contracts write-local Read, Write (docs) Complex features, architectural changes
Implementer-{A,B,C} Parallel implementation write-local Read, Write, Edit, Bash Independent modules
TestRunner Gate-O verification read-only Read, Bash After implementation, before merge
SecurityAuditor Gate-I security invariants read-only Read, Grep, Bash Auth, payments, PII handling
PerfAnalyzer Gate-O performance read-only Read, Bash (profiling) High-traffic features, data processing
DocsWriter Gate-S onboarding write-local Read, Write, Edit Public APIs, user-facing features

Concurrency Classes

Class Lock Behavior Parallel Execution Example
read-only No lock Always parallel Code analysis, tests
write-local Lock on touches Parallel if no overlap Module implementation
write-shared Exclusive lock Sequential only Database migrations

πŸ“Š Cost Tracking & Budgets

Model Selection (v1.2)

Swarm-IOSM automatically selects the optimal model:

Model Use Case Cost (input/output per 1M tokens)
Haiku Read-only analysis, simple tasks $0.25 / $1.25
Sonnet Standard implementation, tests $3.00 / $15.00
Opus Architecture, security, critical decisions $15.00 / $75.00

Budget Controls

Default limits:

  • max_parallel_background: 6
  • max_parallel_foreground: 2
  • max_total_parallel: 8
  • cost_limit_per_track: $10.00

Budget alerts:

  • ⚠️ 80% usage β†’ Warning notification
  • πŸ›‘ 100% usage β†’ Pause execution, await user decision

Check current spend:

cat swarm/tracks/<id>/iosm_state.md | grep -A5 "Cost Tracking"

πŸ”„ Continuous Dispatch Loop (v1.1+)

Key Innovation: No Wave Barriers

Traditional orchestration waits for entire "waves" to complete. Swarm-IOSM dispatches tasks immediately when dependencies are satisfied.

Before (Wave-based):

Wave 1: [T01, T02, T03] β†’ Wait for ALL to finish
Wave 2: [T04, T05] β†’ Can't start until Wave 1 done

After (Continuous Dispatch):

T01 done β†’ T04 starts immediately (even if T02, T03 still running)

Dispatch Algorithm

while not gates_met:
    # 1. Collect ready tasks (deps satisfied, no conflicts)
    ready = [t for t in backlog if deps_satisfied(t) and not conflicts(t)]

    # 2. Classify by mode (background vs foreground)
    bg = [t for t in ready if can_auto_background(t)]
    fg = [t for t in ready if needs_user_input(t)]

    # 3. Dispatch batch (max 3-6 tasks)
    launch_parallel(bg[:6], mode='background')
    launch_parallel(fg[:2], mode='foreground')

    # 4. Monitor & spawn
    for report in collect_completed():
        spawn_candidates = parse_spawn_candidates(report)
        backlog.extend(deduplicate(spawn_candidates))

    # 5. Check gates
    if all_gates_pass():
        break

πŸ” File Lock Management

Hierarchical Conflict Detection

Lock Granularity:

Lock on FOLDER (core/) conflicts with:
  β”œβ”€β”€ Any lock inside (core/a.py, core/b.py)
  └── Lock on same folder (core/)

Lock on FILE (core/a.py) conflicts with:
  β”œβ”€β”€ Same file only
  └── Parent folder lock (core/)

Conflict Matrix Example:

## Lock Plan

Tasks with overlapping touches (sequential only):
- `backend/core/__init__.py`: T03, T04 β†’ ❌ Cannot run parallel
- `backend/api/`: T05, T06 β†’ ❌ Folder conflict

Safe parallel execution:
- `backend/auth.py` (T02) + `backend/payments.py` (T07) β†’ βœ… No overlap

Read-Only Safety Rules

Problem: Read-only tasks may accidentally write to caches, lockfiles, __pycache__.

Solution:

  1. Read-only tasks write temp files ONLY to swarm/tracks/<id>/scratch/
  2. Use --dry-run flags where available
  3. Never run npm install, pip install in read-only mode

🚨 Error Recovery (v1.2)

Intelligent Error Diagnosis

When a task fails, Swarm-IOSM provides:

  • Error type (e.g., Permission Denied, Import Error)
  • Affected file with line number
  • Root cause analysis
  • 2-4 suggested fixes ranked by likelihood
  • Retry command with appropriate flags

Example:

❌ T04 Failed: Permission Denied

File: backend/migrations/001.sql
Cause: Database user lacks CREATE TABLE privilege

Suggested fixes:
1. GRANT CREATE ON DATABASE app TO user; (High confidence)
2. Run migration as admin: sudo -u postgres psql (Medium)
3. Split into smaller migrations (Low)

Retry: /swarm-iosm retry T04 --foreground

Error-Specific Retry Strategies

Error Type Auto-Fix Mode Max Retries
Permission Denied No Foreground 3
Import Error Yes (pip install) Background 3
Test Failed No Foreground 3
MCP Tool Unavailable No Foreground 1
File Not Found Maybe Foreground 3
Timeout No Foreground 2

Retry workflow:

# Standard retry
/swarm-iosm retry T04

# Force interactive debugging
/swarm-iosm retry T04 --foreground

# Regenerate brief (fresh start)
/swarm-iosm retry T04 --reset-brief

πŸ§ͺ Testing & Validation

Pre-Execution Validation

# Validate plan structure
python scripts/orchestration_planner.py plan.md --validate

# Generate continuous dispatch plan
python scripts/orchestration_planner.py plan.md --continuous

# Simulate execution (dry-run)
/swarm-iosm simulate <track-id>

Post-Execution Validation

# Summarize reports
python scripts/summarize_reports.py swarm/tracks/<id>

# Check IOSM gates
/swarm-iosm integrate <track-id>

# Verify no circular deps
grep -A10 "Gate-M" swarm/tracks/<id>/iosm_report.md

🌐 Integration with IOSM Ecosystem

IOSM Methodology

The theoretical foundation. See IOSM Repository for:

  • Complete specification (algorithm, gates, metrics)
  • iosm.yaml configuration schema
  • CI/CD integration patterns (GitHub Actions, GitLab CI)
  • Language-specific checkers (Python, Rust, TypeScript)

Swarm-IOSM (This Repo)

The Claude Code execution engine implementing IOSM for parallel agent orchestration.

FACET Ecosystem

For deterministic AI contracts, see:


πŸ—‚οΈ File Structure

.claude/skills/swarm-iosm/
β”œβ”€β”€ SKILL.md                    # Main skill definition (1330+ lines)
β”œβ”€β”€ README.md                   # This file
β”œβ”€β”€ QUICKSTART.md               # 5-minute tutorial
β”œβ”€β”€ RUNBOOK.md                  # Manual orchestration operations
β”œβ”€β”€ VALIDATION.md               # Installation checklist
β”œβ”€β”€ TROUBLESHOOTING.md          # Common issues & solutions
β”œβ”€β”€ LICENSE                     # MIT License
β”œβ”€β”€ CONTRIBUTING.md             # Contribution guidelines
β”‚
β”œβ”€β”€ templates/                  # Progressive disclosure templates
β”‚   β”œβ”€β”€ prd.md                  # Product Requirements Document
β”‚   β”œβ”€β”€ plan.md                 # Implementation plan
β”‚   β”œβ”€β”€ subagent_brief.md       # Task instructions
β”‚   β”œβ”€β”€ subagent_report.md      # Structured output
β”‚   β”œβ”€β”€ iosm_gates.md           # Quality gate criteria
β”‚   β”œβ”€β”€ iosm_state.md           # Live execution state
β”‚   β”œβ”€β”€ integration_report.md   # Merge plan
β”‚   β”œβ”€β”€ shared_context.md       # Inter-agent communication
β”‚   └── intake_questions.md     # Requirements gathering
β”‚
β”œβ”€β”€ scripts/                    # Automation scripts
β”‚   β”œβ”€β”€ orchestration_planner.py # Generate dispatch plan
β”‚   β”œβ”€β”€ validate_plan.py        # Plan structure validation
β”‚   β”œβ”€β”€ summarize_reports.py    # Aggregate outputs
β”‚   β”œβ”€β”€ merge_context.py        # Update shared context
β”‚   β”œβ”€β”€ parse_errors.py         # Error diagnosis
β”‚   β”œβ”€β”€ error_patterns.py       # Known error patterns
β”‚   └── errors.py               # Error handling utilities
β”‚
└── examples/                   # Demo tracks
    └── demo-track/             # Example project
        β”œβ”€β”€ plan.md
        β”œβ”€β”€ continuous_dispatch_plan.md
        β”œβ”€β”€ iosm_state.md
        └── reports/

swarm/                          # Project workflow data (auto-created)
β”œβ”€β”€ context/                    # Project metadata
β”‚   β”œβ”€β”€ product.md              # Product overview
β”‚   β”œβ”€β”€ tech-stack.md           # Technology stack
β”‚   └── workflow.md             # Development workflow
β”‚
β”œβ”€β”€ tracks/                     # Feature tracks
β”‚   └── YYYY-MM-DD-NNN/         # Track directory
β”‚       β”œβ”€β”€ intake.md           # Requirements intake
β”‚       β”œβ”€β”€ PRD.md              # Product requirements
β”‚       β”œβ”€β”€ spec.md             # Technical specification
β”‚       β”œβ”€β”€ plan.md             # Implementation plan
β”‚       β”œβ”€β”€ metadata.json       # Track metadata
β”‚       β”œβ”€β”€ continuous_dispatch_plan.md  # Execution plan
β”‚       β”œβ”€β”€ iosm_state.md       # Live state (auto-updated)
β”‚       β”œβ”€β”€ shared_context.md   # Inter-agent knowledge
β”‚       β”œβ”€β”€ reports/            # Subagent reports
β”‚       β”‚   β”œβ”€β”€ T01.md
β”‚       β”‚   β”œβ”€β”€ T02.md
β”‚       β”‚   └── ...
β”‚       β”œβ”€β”€ checkpoints/        # Crash recovery
β”‚       β”‚   └── latest.json
β”‚       β”œβ”€β”€ integration_report.md  # Merge plan
β”‚       β”œβ”€β”€ iosm_report.md      # Quality gate results
β”‚       └── rollback_guide.md   # Revert instructions
β”‚
└── tracks.md                   # Track registry

🀝 Contributing

We welcome contributions! Key areas:

High Priority

  • Gate Automation Scripts β€” Measure IOSM criteria automatically
  • CI/CD Integration β€” GitHub Actions, GitLab CI examples
  • Language-Specific Checkers β€” Python, TypeScript, Rust evaluators

Documentation

  • More examples in examples/
  • Video tutorials
  • Integration guides for popular frameworks

Templates

  • Additional subagent role templates
  • Domain-specific PRD templates
  • Custom iosm.yaml configurations

Integrations

  • IDE plugins (VS Code, JetBrains)
  • Issue tracker integrations (Jira, Linear)
  • Monitoring/observability tools

See CONTRIBUTING.md for guidelines.


πŸ“œ Version History

v2.1 (2026-01-19) β€” Current

  • Automated State Management (auto-generated iosm_state.md)
  • Status Sync CLI (--update-task)
  • Improved Report Conflict Detection

v2.0 (2026-01-18)

  • Inter-Agent Communication (shared_context.md)
  • Task Dependency Visualization (--graph)
  • Anti-Pattern Detection
  • Template Customization

v1.3 (2026-01-17)

  • Simulation Mode (/swarm-iosm simulate) with ASCII Timeline
  • Live Monitoring (/swarm-iosm watch)
  • Checkpointing & Resume (/swarm-iosm resume)

v1.2 (2026-01-16)

  • Concurrency Limits (Resource Budgets)
  • Cost Tracking & Model Selection (Haiku/Sonnet/Opus)
  • Intelligent Error Diagnosis & Retry (/swarm-iosm retry)

v1.1 (2026-01-15)

  • Continuous Dispatch Loop (no wave barriers)
  • Gate-Driven Continuation
  • Auto-Spawn from SpawnCandidates
  • Touches Lock Manager
  • iosm_state.md Progress Tracking

v1.0 (2026-01-10)

  • Initial release
  • PRD generation
  • Wave-based orchestration
  • IOSM quality gates

πŸ‘€ Author

Emil Rokossovskiy (@rokoss21) AI & Platform Engineer | Equilibrium LLC

Creator of:

πŸ“§ Email: ecsiar@gmail.com 🌐 Web: rokoss21.tech


πŸ“„ License

MIT License β€” Copyright (c) 2026 Emil Rokossovskiy


πŸ”— Related Projects

Project Description Status
IOSM The methodology Swarm-IOSM implements Active
FACET Standard Deterministic Contract Layer for AI Active
FACET Compiler Reference Compiler (Rust) Active
FACET Agents Conformance Test Agents Active
FACET MCP Server Protocol Adapter Active

πŸŽ“ Learn More

Documentation

Videos & Tutorials

Community


IOSM: Improve β†’ Optimize β†’ Shrink β†’ Modularize
Orchestrate complexity. Enforce quality. Ship faster.

Made with ⚑ by @rokoss21

About

Parallel Subagent Orchestration Engine for Claude Code implementing the IOSM methodology. Continuous dispatch scheduling, quality gates, auto-spawn protocol.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages