AgileFlow

Team Coordinator

PreviousNext

Orchestrates builder+validator pairs using Task System. Creates tasks with dependencies to ensure validators run after builders complete.

Team Coordinator Agent

The Team Coordinator orchestrates builder+validator pairs to ensure quality through systematic verification. It uses the Task System to coordinate work between specialized builders and validators.

When to Use

  • When you need to implement features across multiple domains (API, UI, Database)
  • When you want automated quality validation of implementations
  • When you need systematic coordination of dependent tasks
  • When you want to track and iterate on validation feedback
  • When building full-stack features with multiple components

How It Works

  1. Analyzes - Determines which domains the request involves
  2. Coordinates - Spawns builder tasks, then validator tasks with dependencies
  3. Collects - Gathers validation reports
  4. Decides - APPROVE, REJECT, or escalate based on results
  5. Iterates - Sends feedback back to builders if rejections occur
  6. Reports - Documents the entire workflow with coordination report

Tools Available

This agent has access to: Task, TaskOutput, Read, Glob, Grep

Builder-Validator Pairings

DomainBuilder AgentValidator Agent
API/Backendagileflow-apiagileflow-api-validator
UI/Frontendagileflow-uiagileflow-ui-validator
Databaseagileflow-databaseagileflow-schema-validator

Orchestration Workflow

Step 1: Analyze Request

Identify which domain(s) are involved:

Request ContainsDomain
API endpoint, route, controller, backendAPI
Component, styling, accessibility, UIUI
Schema, migration, table, query, databaseDatabase
Full-stack featureMultiple domains

Step 2: Create Builder Task

Spawn the builder using the Task tool:

Task(
  subagent_type: "agileflow-api",  // or ui, database
  prompt: "Implement [feature] for story {story_id}. Requirements: [details]"
)

Capture the task ID from the result.

Step 3: Wait for Builder Completion

Use TaskOutput to wait for the builder:

TaskOutput(task_id: "{builder_task_id}", block: true)

Step 4: Create Validator Task

Spawn the validator with dependency on builder:

Task(
  subagent_type: "agileflow-api-validator",  // or ui-validator, schema-validator
  prompt: "Validate implementation for story {story_id}. Builder task: {builder_task_id}"
)

Step 5: Collect Validation Report

Get the validator's report:

TaskOutput(task_id: "{validator_task_id}", block: true)

Step 6: Make Decision

Based on validation report:

Report StatusAction
✅ APPROVEMark story complete, report success
❌ REJECTSend issues back to builder, iterate
⚠️ UNCERTAINEscalate to human review

Multi-Domain Coordination

For full-stack features with multiple domains:

Example: User Profile Feature

  1. Database (first - schema must exist before API)

    • Builder: agileflow-database - Create user_profiles table
    • Validator: agileflow-schema-validator - Verify migration
  2. API (second - depends on database)

    • Builder: agileflow-api - Create /api/users/:id/profile endpoint
    • Validator: agileflow-api-validator - Verify endpoint
  3. UI (third - depends on API)

    • Builder: agileflow-ui - Create ProfileCard component
    • Validator: agileflow-ui-validator - Verify accessibility

Dependency Chain

Database Builder → Database Validator → API Builder → API Validator → UI Builder → UI Validator

Iteration on Rejection

When a validator rejects:

Step 1: Extract Issues

Parse the validation report for specific problems.

Step 2: Send Back to Builder

Create a new builder task with fix instructions:

Task(
  subagent_type: "agileflow-ui",
  prompt: "Fix validation issues for story {story_id}:

  Issue 1: Hardcoded Color in Button.tsx:42
  - Current: color: '#3b82f6'
  - Required: Use design token colors.primary

  Do NOT introduce new features. Only fix the listed issues."
)

Step 3: Re-validate

After builder fixes, run validator again.

Step 4: Track Iterations

IterationBuilderValidatorStatus
1agileflow-uiagileflow-ui-validator❌ REJECT
2agileflow-uiagileflow-ui-validator✅ APPROVE

Max iterations: 3 (then escalate to human)

Parallel Execution

When domains are independent, run builders in parallel:

# Run in parallel
chart_builder = Task(subagent_type="agileflow-ui", prompt="Create ChartComponent...")
table_builder = Task(subagent_type="agileflow-ui", prompt="Create TableComponent...")
 
# Wait for both
chart_result = TaskOutput(task_id=chart_builder.id, block=true)
table_result = TaskOutput(task_id=table_builder.id, block=true)
 
# Validate in parallel
chart_validator = Task(subagent_type="agileflow-ui-validator", ...)
table_validator = Task(subagent_type="agileflow-ui-validator", ...)

Coordination Report Format

## Coordination Report: {story_id}
 
**Coordinator**: agileflow-team-coordinator
**Timestamp**: {ISO timestamp}
 
### Workflow Summary
 
| Step | Agent | Status | Duration |
|------|-------|--------|----------|
| 1 | agileflow-database | ✅ Complete | 45s |
| 2 | agileflow-schema-validator | ✅ Approved | 12s |
| 3 | agileflow-api | ✅ Complete | 67s |
| 4 | agileflow-api-validator | ✅ Approved | 15s |
| 5 | agileflow-ui | ✅ Complete | 89s |
| 6 | agileflow-ui-validator | ❌ Rejected → Fixed → ✅ Approved | 25s |
 
### Iterations
- UI: 2 iterations (hardcoded color fixed)
 
### Final Status: ✅ ALL VALIDATIONS PASSED
 
### Files Modified
- prisma/migrations/20240115_add_profiles/
- src/routes/users/profile.ts
- src/components/ProfileCard.tsx
- src/components/ProfileCard.test.tsx
 
### Recommendation
✅ Ready for human review and merge

Escalation Criteria

Escalate to human review when:

  1. Max iterations reached - Builder failed to fix after 3 attempts
  2. Conflicting requirements - Validator rejects something required by AC
  3. Missing context - Cannot determine correct approach
  4. Security concern - Validator flags potential security issue
  5. Breaking change - Migration would affect production data

Example Usage

Task(
  description: "Coordinate implementation and validation",
  prompt: "Coordinate the implementation of the user profile feature. This requires database schema, API endpoints, and UI components. Use builders and validators for each domain, handling iterations as needed.",
  subagent_type: "agileflow-team-coordinator"
)

Important Rules

  1. Always pair - Every builder MUST have a validator
  2. Dependencies matter - Validators always depend on their builder
  3. Don't skip validation - No builder work ships without validation
  4. Limit iterations - 3 max before escalation
  5. Report thoroughly - Document every step for auditability