Skip to main content
Main navigation menu. Use Tab to move between links, Enter to activate.
HomeProjectsBlogAboutContact

How I Built a 3-Agent AI System to Manage 29 Pull Requests in Parallel

Scaling development with specialized AI agents and complete automation from issue to merge

John Schibelli
Published:Published October 13, 2025
16 min read
AutomationAI DevelopmentDevOpsProductivityMulti-Agent SystemsPowerShellWorkflow Automation
How I Built a 3-Agent AI System to Manage 29 Pull Requests in Parallel

How I Built a 3-Agent AI System to Manage 29 Pull Requests in Parallel

The 29-PR Problem

Picture this: It's launch week for your portfolio project. Everything is live, users are engaging, and your GitHub notifications are exploding. Twenty-nine open pull requests stare back at you from the project board—each one important, each one blocking something else.

Four PRs focused on performance optimizations. Sixteen dealing with testing infrastructure and TypeScript compilation errors. Nine implementing a complete AI chatbot enhancement epic. All requiring different expertise: frontend specialists for UI work, infrastructure engineers for testing frameworks, and AI developers for the chatbot features.

The traditional approach? Pick one, context switch, implement, review, merge, repeat. At that pace, you're looking at weeks—maybe months—of serial development. Even with two developers working in parallel, the bottlenecks remain: shared files, merge conflicts, coordination overhead.

This is a problem every developer faces as projects scale. The more successful your project, the more features users want, the more issues pile up, and the more you become the bottleneck.

I needed a different approach. Not just automation—intelligent, parallel automation with specialized expertise. That's when I built what I call the "3-Agent Multi-Development System."

The Journey: From Manual to Multi-Agent

The Evolution

My automation journey didn't start with AI agents. Like most developers, it began with simple scripts:

Stage 1: Basic Scripts (The "I'm tired of typing this" phase)

  • Bash scripts to create branches
  • Git hooks for commit formatting
  • Simple deployment scripts

Stage 2: GitHub Actions (The "Let's automate CI/CD" phase)

  • Automated testing on PRs
  • Deployment pipelines
  • Basic issue triage

Stage 3: PowerShell Orchestration (The "This is getting complex" phase)

  • Unified PR management scripts
  • Issue configuration automation
  • Project board integration

Stage 4: The Multi-Agent Breakthrough (The "Wait, what if..." phase)

The breakthrough came when I realized: AI assistants don't just write code—they can specialize.

Just like a real development team, you don't hire generalists for everything. You have:

  • Frontend specialists who excel at React and UI/UX
  • Infrastructure engineers who live and breathe DevOps
  • Backend developers who architect APIs and databases

What if AI agents could work the same way? Each with their own expertise, their own workspace, all working in parallel without conflicts.

The "Aha" Moment

It hit me while reviewing my 29 open PRs. They naturally clustered into three categories:

  1. Frontend/UI work - Performance, accessibility, dashboard enhancements
  2. Infrastructure/Testing - TypeScript fixes, test framework, CI/CD
  3. AI Features - Chatbot enhancements, streaming responses, analytics

Each category needed different skills. More importantly, they rarely touched the same files. They could be developed in complete isolation.

That's when I designed the 3-agent architecture.

The Solution: 3-Agent Architecture

Agent Distribution Strategy

I divided the 29 PRs across three specialized agents based on expertise and file ownership:

AgentFocusPRsPriorityTimeline
Agent 1Frontend/UI Specialist4P1Weeks 2-3
Agent 2Infrastructure/SEO16P0, P1Weeks 1-3
Agent 3Chatbot Features9P0, P1, P2Weeks 1-2
Total-29-3 weeks

Why This Distribution Works

Agent 1: Frontend/UI Specialist (4 PRs)

  • Specializes in React, Next.js, Tailwind CSS
  • Focuses on user experience and accessibility
  • Owns: UI components, styling, performance optimization
  • Workload: Manageable, focused scope

Agent 2: Infrastructure/SEO Specialist (16 PRs)

  • Handles testing infrastructure, TypeScript, DevOps
  • Critical path: Must fix TypeScript compilation first
  • Owns: Test frameworks, build config, CI/CD, SEO
  • Workload: Largest, but highest priority items

Agent 3: Chatbot Features Specialist (9 PRs)

  • Dedicated to AI chatbot enhancement epic (#321)
  • Exclusive ownership of chatbot component (2,026 lines)
  • Owns: Chatbot.tsx, chat API routes, analytics
  • Workload: Medium, well-defined scope

The Key Insight: Exclusive File Ownership

The magic of this system is conflict prevention through exclusive ownership:

Agent 1 owns:
  - apps/site/components/ui/*
  - apps/dashboard/components/*
  - Performance-related files

Agent 2 owns:
  - **/*.test.tsx
  - jest.config.js
  - tsconfig.json
  - CI/CD workflows

Agent 3 owns:
  - apps/site/components/features/chatbot/Chatbot.tsx
  - apps/site/app/api/chat/route.ts
  - apps/site/app/api/tts/route.ts

Zero overlap = Zero conflicts = Maximum parallelization

Automation Pipeline: The 5-Phase Workflow

Here's where the real magic happens. Each agent follows a complete end-to-end workflow:

Phase 1: Issue Analysis & Configuration

When an issue is created, the system automatically:

# Analyzes issue requirements
.\scripts\issue-config-unified.ps1 -IssueNumber 333 -Preset chatbot -AddToProject

# This automatically:
# - Analyzes issue complexity and requirements
# - Sets project fields (Status=In progress, Priority, Size, App, Area)
# - Assigns to appropriate agent
# - Creates detailed implementation plan

Real example from the system:

Issue #333: Implement streaming responses with OpenAI
├── Analyzed: High complexity, AI/Frontend hybrid
├── Priority: P0 (Critical)
├── Size: M (Medium, 1-1.5 hours)
├── Area: Chatbot
└── Assigned to: Agent 3 (Chatbot Specialist)

Phase 2: Branch Creation & Environment Setup

Each agent works in isolated worktrees:

# Create branch from develop
.\scripts\create-branch-from-release.ps1 -IssueNumber 333 -BaseBranch "develop"

# This automatically:
# - Creates feature/chatbot-streaming-responses-333 branch
# - Sets up agent's worktree environment
# - Syncs with latest changes
# - Validates environment

Worktree structure:

portfolio-os/                  # Main repo
├── worktrees/
│   ├── agent-1-chris/        # Frontend agent workspace
│   ├── agent-2-jason/        # Infrastructure agent workspace
│   └── agent-3-chatbot/      # Chatbot agent workspace
├── worktree-state.json       # Central coordination
└── scripts/                  # Automation scripts

Each worktree is a complete, isolated clone of the repository on a different branch. No conflicts, no interference.

Phase 3: Implementation & Testing

The implementation phase is fully automated:

# Implement the issue with AI assistance
.\scripts\issue-implementation.ps1 -IssueNumber 333 -Agent Agent3

# This automatically:
# - Generates implementation code
# - Runs linters and type checkers
# - Executes test suites
# - Validates accessibility and performance
# - Updates documentation

Phase 4: PR Creation & Review

PR creation is streamlined and intelligent:

# Create PR with auto-generated description and metadata
.\scripts\pr-automation-unified.ps1 -IssueNumber 333 -Action create -BaseBranch "develop"

# This automatically:
# - Creates PR with comprehensive description
# - Links to issue and epic
# - Adds appropriate labels (agent-3, chatbot, P0)
# - Assigns reviewers
# - Updates project status to "Ready"
# - Triggers CI/CD pipeline

Phase 5: Review Automation & Merge

The most powerful part—automated review handling:

# Monitor PR and automate review responses
.\scripts\pr-automation-unified.ps1 -PRNumber 333 -Action all -AutoFix

# This automatically:
# - Monitors CR-GPT bot comments
# - Categorizes feedback by priority
# - Generates threaded responses to comments
# - Implements fixes for critical issues
# - Runs quality checks (lint, test, build)
# - Updates project status
# - Merges when all checks pass

The result? A complete hands-off workflow from issue creation to merge.

The Agent Assignment System

One of the most critical pieces is intelligent agent assignment. Here's the actual script that assigns all chatbot PRs to Agent 3:

# Define all 9 chatbot PRs with metadata
$chatbotPRs = @(
    @{
        Number = 333
        Issue = 322
        Title = "feat(chatbot): implement streaming responses"
        Priority = "P0"
        Phase = 1
    },
    @{
        Number = 337
        Issue = 324
        Title = "fix(chatbot): improve error handling"
        Priority = "P0"
        Phase = 1
    },
    # ... 7 more PRs
)

# Verify all PRs exist and are open
foreach ($pr in $chatbotPRs) {
    $prInfo = gh pr view $($pr.Number) --json number,title,state
    if ($prData.state -eq "OPEN") {
        # Assign to Agent 3
        gh pr edit $($pr.Number) --add-assignee "@me"
        # Add tracking labels
        gh pr edit $($pr.Number) --add-label "agent-3,chatbot,$($pr.Priority)"
    }
}

The script provides phase-based guidance:

Phase 1: Critical Features (P0)
  - PR #333 - Streaming responses (HIGHEST PRIORITY)
  - PR #337 - Error handling
  - PR #336 - Analytics tracking

Phase 2: UX Enhancements (P1)
  - PR #340 - Typing indicators (depends on #333)
  - PR #334 - Conversation persistence
  - PR #335 - Quick reply suggestions
  - PR #332 - Context window expansion

Phase 3: Quality (P2 - Optional)
  - PR #338 - Component modularization
  - PR #339 - TypeScript types & documentation

This creates a dependency-aware workflow where Phase 1 must complete before Phase 2 begins.

Real-World Results

The Numbers

Before Multi-Agent System:

  • Time to complete 29 PRs: 8-12 weeks (serial development)
  • Context switching: High (constant area changes)
  • Merge conflicts: Frequent (shared file edits)
  • Developer cognitive load: Overwhelming

After Multi-Agent System:

  • Time to complete 29 PRs: 3 weeks (parallel development)
  • Context switching: Minimal (agents stay in domain)
  • Merge conflicts: Nearly zero (exclusive ownership)
  • Developer cognitive load: Manageable (orchestration only)

Specific wins:

  • Chatbot epic: 3+ weeks → 2 weeks (33% faster)
  • TypeScript critical fixes: From blocking everything → Non-blocking (parallel work continues)
  • Code review response time: Hours → Minutes (automated responses)

Quality Improvements

The system didn't just make things faster—it made them better:

Automated Quality Gates:

  • ✅ TypeScript compilation: Automatic on every commit
  • ✅ Linting: ESLint + Prettier on all files
  • ✅ Testing: Jest + React Testing Library
  • ✅ Accessibility: Automated a11y checks
  • ✅ Performance: Lighthouse CI on every PR

CR-GPT Integration: Every PR gets AI-powered code review with:

  • Security vulnerability detection
  • Performance optimization suggestions
  • Best practice recommendations
  • Automated response generation

Developer Experience

The most surprising benefit? Mental clarity.

Instead of juggling 29 different contexts, I focus on:

  1. Orchestration - Ensuring agents have clear tasks
  2. Quality review - Final approval on completed work
  3. Strategy - Planning the next phase

The agents handle:

  • Implementation details
  • Testing and validation
  • Documentation updates
  • Routine code review responses

Conflict Prevention & Coordination

The Central State System

Conflict prevention starts with state management:

// worktree-state.json
{
  "version": "1.0.0",
  "agents": {
    "agent-3-chatbot": {
      "name": "Chatbot Specialist",
      "worktree": "worktrees/agent-3-chatbot",
      "branch": "feature/chatbot-streaming-responses-333",
      "assignedIssues": [322, 323, 324, 325, 326, 327, 328, 329, 330, 331],
      "status": "active",
      "lastSync": "2025-10-13T10:30:00Z"
    }
  },
  "fileOwnership": {
    "apps/site/components/features/chatbot/Chatbot.tsx": "agent-3-chatbot",
    "apps/site/app/api/chat/route.ts": "agent-3-chatbot",
    "apps/dashboard/tsconfig.json": "agent-2-jason"
  }
}

Before any work begins:

  1. Check if file is owned by another agent
  2. If owned, coordinate the change
  3. If not owned, claim ownership
  4. Proceed with implementation

Automatic Conflict Detection

# Check for conflicts before starting work
.\scripts\check-agent-conflicts.ps1 `
  -Agents "Agent1,Agent2,Agent3" `
  -PRs "262,320,333"

# Output:
# ✅ No conflicts detected
# ✅ All agents have exclusive file ownership
# ✅ Safe to proceed with parallel development

Coordination for Shared Changes

When agents must touch shared files (rare, but happens):

# Coordinate changes to shared file
.\scripts\coordinate-shared-changes.ps1 `
  -File "apps/site/components/features/chatbot/Chatbot.tsx" `
  -Agents "Agent3" `
  -Exclusive $true

# This:
# - Locks the file for Agent3
# - Notifies other agents
# - Prevents concurrent modifications
# - Releases lock after merge

How You Can Apply This

When Multi-Agent Makes Sense

This approach works best when:

✅ You have 15+ PRs/issues in your backlog ✅ Work naturally clusters into 2-3 domains ✅ File ownership can be divided (minimal overlap) ✅ You want to reduce context switching ✅ Parallel work is possible (independent features)

It's probably overkill if: ❌ You have < 10 issues ❌ All work touches the same core files ❌ You're a solo developer working sequentially ❌ Issues are highly interdependent

Starting Small: 2-Agent Approach

Don't start with three agents. Start with two:

Agent 1: Frontend Specialist

  • All React/UI components
  • Styling and responsive design
  • Client-side logic

Agent 2: Backend/Infrastructure Specialist

  • API routes and backend logic
  • Testing and CI/CD
  • Database and infrastructure

Key scripts to build first:

  1. Agent Assignment Script (assign-agents.ps1)

    • Analyzes issues
    • Routes to appropriate agent
    • Updates project board
  2. Worktree Manager (manage-worktrees.ps1)

    • Creates isolated workspaces
    • Syncs with main branch
    • Cleans up after merge
  3. PR Automation (automate-pr.ps1)

    • Creates PRs with metadata
    • Monitors review comments
    • Handles automated responses
  4. Conflict Checker (check-conflicts.ps1)

    • Validates file ownership
    • Detects potential conflicts
    • Coordinates shared changes

Tools & Technologies

My stack:

  • PowerShell - Automation scripts (cross-platform with PowerShell Core)
  • GitHub CLI (gh) - API interactions
  • GitHub Actions - CI/CD and webhooks
  • Git Worktrees - Isolated development environments
  • CR-GPT - AI-powered code review
  • Next.js - The actual application being developed

Why PowerShell?

  • Rich object model (not just string manipulation)
  • Cross-platform (runs on Windows, macOS, Linux)
  • Excellent GitHub CLI integration
  • Strong error handling and retry logic
  • Great for complex orchestration

The core automation pattern:

# 1. Detect event (new issue, PR update, etc.)
# 2. Analyze context (what changed, what's needed)
# 3. Determine action (which agent, what workflow)
# 4. Execute with retry logic
# 5. Update state and notify
# 6. Monitor for completion

Implementation Roadmap

Week 1: Foundation

  • Set up git worktrees
  • Create basic agent assignment logic
  • Build branch creation automation
  • Test with 2-3 simple issues

Week 2: PR Automation

  • Automate PR creation
  • Integrate with GitHub Actions
  • Add review comment monitoring
  • Test full workflow end-to-end

Week 3: Intelligence

  • Add conflict detection
  • Implement file ownership tracking
  • Create coordination mechanisms
  • Build monitoring dashboard

Week 4: Scale

  • Add third agent if needed
  • Optimize performance
  • Enhance error handling
  • Document everything

Lessons Learned

What Worked

  1. Exclusive File Ownership is Key

    • The single biggest factor in preventing conflicts
    • Worth spending time to analyze and divide files upfront
  2. Start with Manual, Then Automate

    • Don't automate until you've done it manually 3+ times
    • Understand the edge cases before coding them
  3. State Management is Critical

    • Central state file (worktree-state.json) prevents races
    • File locking mechanisms are essential
    • Always validate state before actions
  4. Phase-Based Execution

    • Dependencies matter (Phase 1 before Phase 2)
    • Clear phases reduce complexity
    • Easy to track progress
  5. AI Agents Love Clear Constraints

    • Narrow focus = Better results
    • Exclusive file lists prevent confusion
    • Clear acceptance criteria guide implementation

What Didn't Work (At First)

  1. Dynamic Agent Assignment

    • Initially tried to auto-assign based on AI analysis
    • Too complex, too many edge cases
    • Manual categorization with automated routing works better
  2. Full Automation From Day 1

    • Tried to automate everything immediately
    • Hit edge cases constantly
    • Better to automate incrementally
  3. Shared File Coordination

    • First attempt at real-time locking failed
    • File system locks aren't reliable across worktrees
    • Moved to state-based ownership tracking
  4. Too Many Agents

    • Tried 5 agents initially
    • Coordination overhead was too high
    • 3 agents is the sweet spot for this project size

Best Practices

For Agent Design:

  • ✅ Give each agent a clear, narrow focus
  • ✅ Define explicit file ownership
  • ✅ Create dedicated worktrees
  • ✅ Use descriptive agent names (not just "Agent 1")

For Automation:

  • ✅ Always use dry-run mode first
  • ✅ Implement comprehensive logging
  • ✅ Build retry logic with exponential backoff
  • ✅ Monitor and alert on failures

For Coordination:

  • ✅ Maintain central state file
  • ✅ Validate before every operation
  • ✅ Lock files during critical operations
  • ✅ Sync worktrees regularly

For Scaling:

  • ✅ Start with 2 agents
  • ✅ Add third only when proven need
  • ✅ Monitor agent utilization
  • ✅ Rebalance workload as needed

The Future: What's Next

Planned Enhancements

Machine Learning-Based Assignment

  • Train on historical issue→agent assignments
  • Predict optimal agent based on issue content
  • Continuous learning from outcomes

Advanced Conflict Resolution

  • Automatic merge conflict resolution for simple cases
  • AI-powered code integration suggestions
  • Predictive conflict detection

Cross-Project Agents

  • Reusable agents across multiple projects
  • Shared agent marketplace
  • Standardized agent interfaces

Visual Dashboard

  • Real-time agent activity monitoring
  • Interactive workload balancing
  • Visual dependency graphs
  • Performance analytics

Applying to Other Domains

This pattern works beyond web development:

Mobile App Development

  • iOS agent, Android agent, Backend agent
  • Shared business logic coordination

Data Science

  • Data pipeline agent, Model training agent, Visualization agent
  • Shared dataset management

DevOps

  • Infrastructure agent, Monitoring agent, Security agent
  • Coordinated deployments

Content Creation

  • Writing agent, Editing agent, Publishing agent
  • Content workflow automation

Conclusion

Building a multi-agent development system transformed how I work. What started as a crisis—29 overwhelming PRs—became an opportunity to rethink development workflows.

The key insights:

  1. Specialization beats generalization when work can be divided
  2. Parallel execution is possible with proper isolation
  3. Automation enables scale but requires thoughtful design
  4. AI agents work best with clear constraints and exclusive ownership
  5. Incremental automation beats big-bang approaches

The results speak for themselves:

  • ✅ 29 PRs → 3 weeks (vs 8-12 weeks before)
  • ✅ Nearly zero merge conflicts
  • ✅ Significantly reduced cognitive load
  • ✅ Higher code quality through automation
  • ✅ Faster iteration and deployment

This isn't just about automation—it's about sustainable development at scale.

Whether you're a solo developer drowning in issues or a team looking to optimize workflows, the multi-agent approach offers a path forward. Start small, focus on file ownership, automate incrementally, and watch your productivity soar.

The future of development isn't just AI-assisted—it's AI-orchestrated with specialized agents working in harmony. And that future is available today.


Resources & Next Steps

Want to implement this yourself?

  1. Explore the code: Check out my portfolio-os repository (scripts in /scripts/agent-management/)

  2. Start with basics:

    • Set up git worktrees
    • Create simple agent assignment logic
    • Automate one workflow end-to-end
  3. Join the conversation:

    • Share your multi-agent experiments
    • Discuss challenges and solutions
    • Build the future of development together
  4. Follow along: I'll be sharing more automation patterns, lessons learned, and advanced techniques.

Questions? Ideas? Drop them in the comments below. I'd love to hear about your automation journey and help you build your own multi-agent system.


This blog post is part of my ongoing series on development automation and AI-assisted workflows. Subscribe to get notified when new posts drop!

Written by John Schibelli

Published: Oct 13, 2025

© 2026 John Schibelli. All rights reserved.