# πŸ€– GreenLight AI Agent Coordination **Layer 14: Multi-Claude Collaboration & Specialization** --- ## πŸ€– Why AI Agent Coordination Matters **The Problem:** We have multiple Claudes, but we're not truly working as a *team*. - No visibility into what each Claude is doing - No way to route tasks to specialists - No clean handoffs between agents - No consensus building on big decisions - No load balancing or work distribution **The Solution:** True multi-agent collaboration with coordination primitives. - Every Claude announces their capabilities and availability - Tasks route to the best agent for the job - Clean handoffs preserve complete context - Consensus building for architectural decisions - Distributed work with no duplication --- ## 🌟 Agent Coordination Events as GreenLight Steps | Event | GreenLight Step | Step # | Emoji | State Transition | Scope | |-------|-----------------|--------|-------|------------------|-------| | Agent available | πŸ‘‹ Announce | 1 | πŸ‘‹πŸ€– | void β†’ inbox | capability | | Task claimed | πŸƒ Start | 10 | πŸƒπŸ’Ό | queued β†’ wip | assignment | | Task handoff | 🀝 Transfer | 12 | πŸ€πŸ“¦ | β†’ wip | between agents | | Consensus requested | πŸ—³οΈ Vote | 9 | πŸ—³οΈπŸ“‹ | inbox β†’ queued | decision | | Vote cast | βœ‹ Vote | 9 | βœ‹πŸ“Š | β†’ queued | opinion | | Consensus reached | βœ… Decide | 9 | βœ…πŸŽ― | queued β†’ wip | agreement | | Agent specialized | πŸŽ“ Specialize | 1 | πŸŽ“πŸ€– | void β†’ inbox | focus area | | Expertise gained | πŸ’ͺ Grow | 14 | πŸ’ͺπŸ“š | wip β†’ wip | learning | | Load balanced | βš–οΈ Distribute | 6 | βš–οΈπŸ“Š | inbox β†’ queued | work allocation | --- ## 🏷️ Agent Types & Specializations | Agent Type | Emoji | Focus Area | Capabilities | Priority Tasks | |------------|-------|------------|--------------|----------------| | Frontend | 🎨 | UI/UX, React, design | Component building, styling, accessibility | UI bugs, design impl | | Backend | βš™οΈ | APIs, databases, servers | Endpoints, queries, auth | API work, DB schema | | DevOps | πŸ”§ | Infrastructure, deployment | CI/CD, workers, monitoring | Deploy, infra issues | | AI/ML | 🧠 | Models, training, inference | Prompt engineering, fine-tuning | AI features, model work | | Data | πŸ“Š | Analytics, ETL, reporting | Queries, dashboards, pipelines | Data analysis, reports | | Security | πŸ”’ | Auth, encryption, compliance | Pen testing, audits, hardening | Security issues, audits | | Mobile | πŸ“± | iOS, Android, React Native | Native dev, mobile UX | Mobile bugs, features | | Documentation | πŸ“š | Docs, guides, tutorials | Writing, diagrams, examples | Doc updates, guides | | Testing | πŸ§ͺ | QA, test automation | E2E tests, unit tests, coverage | Test writing, QA | | General | 🌸 | All-purpose Claude | Everything! | Any task | --- ## 🎨 Composite Patterns ### Agent Availability ``` πŸ‘‹πŸ€–πŸ‘‰πŸ“Œ = Agent available, announcing capabilities πŸŽ“πŸ€–πŸ‘‰β­ = Agent specialized in area πŸ’ͺπŸ“šπŸŽ’πŸ“Œ = Expertise gained, macro scale ``` ### Task Assignment ``` πŸƒπŸ’ΌπŸ‘‰πŸ“Œ = Task claimed by agent πŸ€πŸ“¦πŸ‘‰β­ = Task handed off to specialist βš–οΈπŸ“ŠπŸ‘‰πŸ“Œ = Load balancing in progress ``` ### Consensus Building ``` πŸ—³οΈπŸ“‹πŸŽ’β­ = Consensus requested, macro, high priority βœ‹πŸ“ŠπŸ‘‰πŸ“Œ = Vote cast βœ…πŸŽ―πŸŽ’πŸŒ = Consensus reached, global impact ``` ### Collaboration ``` πŸ€πŸŒΈπŸ‘‰πŸ“Œ = Claudes collaborating πŸ“žπŸ’¬πŸ‘‰β­ = Agent requesting help βœ…πŸ€–πŸŽ’πŸŽ‰ = Collaborative task completed ``` --- ## πŸ“ NATS Subject Patterns ### Agent Events ``` greenlight.agent.available.micro.platform.{agent_id} greenlight.agent.unavailable.micro.platform.{agent_id} greenlight.agent.specialized.micro.platform.{agent_id}.{specialization} greenlight.agent.capabilities.micro.platform.{agent_id} ``` ### Task Events ``` greenlight.task.claimed.micro.platform.{task_id}.{agent_id} greenlight.task.handoff.micro.platform.{task_id}.{from_agent}.{to_agent} greenlight.task.completed.macro.platform.{task_id}.{agent_id} greenlight.task.blocked.micro.platform.{task_id}.{agent_id} ``` ### Consensus Events ``` greenlight.consensus.requested.macro.platform.{decision_id} greenlight.consensus.vote.micro.platform.{decision_id}.{agent_id} greenlight.consensus.reached.macro.platform.{decision_id} greenlight.consensus.failed.macro.platform.{decision_id} ``` ### Collaboration Events ``` greenlight.collaboration.started.micro.platform.{task_id} greenlight.collaboration.help_requested.micro.platform.{agent_id} greenlight.collaboration.help_provided.micro.platform.{helper_agent} ``` ### Load Balancing Events ``` greenlight.load.balanced.micro.platform.{agent_pool} greenlight.load.overloaded.critical.platform.{agent_id} greenlight.load.idle.micro.platform.{agent_id} ``` --- ## πŸ”¨ AI Agent Coordination Templates ### Agent Availability & Capabilities ```bash # Agent announces availability gl_agent_available() { local agent_id="$1" local agent_type="$2" # frontend, backend, devops, ai, etc. local capabilities="$3" local availability="${4:-available}" local type_emoji="" case "$agent_type" in frontend) type_emoji="🎨" ;; backend) type_emoji="βš™οΈ" ;; devops) type_emoji="πŸ”§" ;; ai|ml) type_emoji="🧠" ;; data) type_emoji="πŸ“Š" ;; security) type_emoji="πŸ”’" ;; mobile) type_emoji="πŸ“±" ;; docs) type_emoji="πŸ“š" ;; testing) type_emoji="πŸ§ͺ" ;; general) type_emoji="🌸" ;; *) type_emoji="πŸ€–" ;; esac gl_log "πŸ‘‹${type_emoji}πŸ‘‰πŸ“Œ" \ "agent_available" \ "$agent_id" \ "Type: $agent_type | Capabilities: $capabilities | Status: $availability" } # Agent goes offline gl_agent_unavailable() { local agent_id="$1" local reason="${2:-session ended}" gl_log "πŸ‘‹πŸšͺπŸ‘‰πŸ“Œ" \ "agent_unavailable" \ "$agent_id" \ "Reason: $reason" } # Agent specializes gl_agent_specialized() { local agent_id="$1" local specialization="$2" local expertise_level="${3:-intermediate}" gl_log "πŸŽ“πŸ€–πŸ‘‰β­" \ "agent_specialized" \ "$agent_id" \ "Specialization: $specialization | Level: $expertise_level" } # Expertise gained gl_expertise_gained() { local agent_id="$1" local area="$2" local what_learned="$3" gl_log "πŸ’ͺπŸ“šπŸŽ’πŸ“Œ" \ "expertise_gained" \ "$agent_id" \ "Area: $area | Learned: $what_learned" } ``` ### Task Assignment & Claiming ```bash # Task claimed gl_task_claimed() { local task_id="$1" local agent_id="$2" local task_type="$3" local estimated_duration="${4:-unknown}" gl_log "πŸƒπŸ’ΌπŸ‘‰πŸ“Œ" \ "task_claimed" \ "$task_id" \ "Agent: $agent_id | Type: $task_type | ETA: $estimated_duration" } # Task completed by agent gl_task_completed_by() { local task_id="$1" local agent_id="$2" local outcome="$3" local actual_duration="${4:-unknown}" gl_log "βœ…πŸ€–πŸŽ’πŸŽ‰" \ "task_completed" \ "$task_id" \ "Agent: $agent_id | Outcome: $outcome | Duration: $actual_duration" } # Task blocked gl_task_blocked_by() { local task_id="$1" local agent_id="$2" local blocker="$3" gl_log "πŸ”’πŸ€–πŸ‘‰πŸ”₯" \ "task_blocked" \ "$task_id" \ "Agent: $agent_id | Blocker: $blocker" } ``` ### Task Handoff ```bash # Task handoff gl_task_handoff() { local task_id="$1" local from_agent="$2" local to_agent="$3" local reason="$4" local context_summary="$5" gl_log "πŸ€πŸ“¦πŸ‘‰β­" \ "task_handoff" \ "$task_id" \ "From: $from_agent β†’ To: $to_agent | Reason: $reason | Context: $context_summary" } # Handoff accepted gl_handoff_accepted() { local task_id="$1" local receiving_agent="$2" local acknowledgment="${3:-accepted}" gl_log "βœ…πŸ€πŸ‘‰πŸ“Œ" \ "handoff_accepted" \ "$task_id" \ "Agent: $receiving_agent | Status: $acknowledgment" } # Handoff rejected gl_handoff_rejected() { local task_id="$1" local receiving_agent="$2" local reason="$3" gl_log "βŒπŸ€πŸ‘‰βš οΈ" \ "handoff_rejected" \ "$task_id" \ "Agent: $receiving_agent | Reason: $reason" } ``` ### Consensus Building ```bash # Consensus requested gl_consensus_requested() { local decision_id="$1" local topic="$2" local options="$3" local deadline="${4:-24h}" local required_votes="${5:-majority}" gl_log "πŸ—³οΈπŸ“‹πŸŽ’β­" \ "consensus_requested" \ "$decision_id" \ "Topic: $topic | Options: $options | Deadline: $deadline | Required: $required_votes" } # Vote cast gl_vote_cast() { local decision_id="$1" local agent_id="$2" local vote="$3" local rationale="${4:-}" gl_log "βœ‹πŸ“ŠπŸ‘‰πŸ“Œ" \ "vote_cast" \ "$decision_id" \ "Agent: $agent_id | Vote: $vote | Rationale: $rationale" } # Consensus reached gl_consensus_reached() { local decision_id="$1" local outcome="$2" local vote_breakdown="$3" local confidence="${4:-high}" gl_log "βœ…πŸŽ―πŸŽ’πŸŒ" \ "consensus_reached" \ "$decision_id" \ "Outcome: $outcome | Votes: $vote_breakdown | Confidence: $confidence" } # Consensus failed gl_consensus_failed() { local decision_id="$1" local reason="$2" local vote_breakdown="$3" gl_log "βŒπŸ—³οΈπŸ‘‰βš οΈ" \ "consensus_failed" \ "$decision_id" \ "Reason: $reason | Votes: $vote_breakdown" } ``` ### Collaboration ```bash # Collaboration started gl_collaboration_started() { local task_id="$1" local agents="$2" # comma-separated local goal="$3" gl_log "πŸ€πŸŒΈπŸ‘‰πŸ“Œ" \ "collaboration_started" \ "$task_id" \ "Agents: $agents | Goal: $goal" } # Help requested gl_help_requested() { local requesting_agent="$1" local help_needed="$2" local urgency="${3:-normal}" local urgency_emoji="" case "$urgency" in urgent|critical) urgency_emoji="πŸ”₯" ;; high) urgency_emoji="⭐" ;; normal) urgency_emoji="πŸ“Œ" ;; low) urgency_emoji="πŸ’€" ;; *) urgency_emoji="πŸ“Œ" ;; esac gl_log "πŸ“žπŸ’¬πŸ‘‰${urgency_emoji}" \ "help_requested" \ "$requesting_agent" \ "Help needed: $help_needed | Urgency: $urgency" } # Help provided gl_help_provided() { local helper_agent="$1" local helped_agent="$2" local assistance="$3" gl_log "βœ…πŸ€πŸ‘‰πŸ“Œ" \ "help_provided" \ "$helper_agent" \ "Helped: $helped_agent | Assistance: $assistance" } # Collaborative success gl_collaboration_success() { local task_id="$1" local agents="$2" local outcome="$3" gl_log "βœ…πŸ€–πŸŽ’πŸŽ‰" \ "collaboration_success" \ "$task_id" \ "Agents: $agents | Outcome: $outcome" } ``` ### Load Balancing ```bash # Load balanced gl_load_balanced() { local agent_pool="$1" local task_count="$2" local distribution="$3" gl_log "βš–οΈπŸ“ŠπŸ‘‰πŸ“Œ" \ "load_balanced" \ "$agent_pool" \ "Tasks: $task_count | Distribution: $distribution" } # Agent overloaded gl_agent_overloaded() { local agent_id="$1" local current_tasks="$2" local capacity="$3" gl_log "πŸš¨βš–οΈπŸ‘‰πŸ”₯" \ "agent_overloaded" \ "$agent_id" \ "Tasks: $current_tasks (capacity: $capacity)" } # Agent idle gl_agent_idle() { local agent_id="$1" local idle_duration="$2" gl_log "πŸ’€πŸ€–πŸ‘‰πŸ“Œ" \ "agent_idle" \ "$agent_id" \ "Idle for: $idle_duration" } # Work redistributed gl_work_redistributed() { local from_agent="$1" local to_agents="$2" local task_count="$3" gl_log "πŸ”„βš–οΈπŸ‘‰πŸ“Œ" \ "work_redistributed" \ "$from_agent" \ "Redistributed $task_count tasks to: $to_agents" } ``` ### Agent Coordination Patterns ```bash # Pair programming session gl_pair_programming() { local driver_agent="$1" local navigator_agent="$2" local task="$3" gl_log "πŸ‘₯πŸ’»πŸ‘‰πŸ“Œ" \ "pair_programming" \ "$task" \ "Driver: $driver_agent | Navigator: $navigator_agent" } # Code review assignment gl_code_review_assigned() { local reviewer_agent="$1" local author_agent="$2" local pr_id="$3" gl_log "πŸ‘οΈπŸ“πŸ‘‰πŸ“Œ" \ "code_review_assigned" \ "$pr_id" \ "Reviewer: $reviewer_agent | Author: $author_agent" } # Agent mentorship gl_mentorship() { local mentor_agent="$1" local mentee_agent="$2" local topic="$3" gl_log "πŸŽ“πŸ‘¨β€πŸ«πŸ‘‰πŸ“Œ" \ "mentorship" \ "$topic" \ "Mentor: $mentor_agent | Mentee: $mentee_agent" } ``` --- ## 🎯 Example: Complete Multi-Agent Collaboration ### Scenario: Feature request requires frontend, backend, and DevOps coordination ```bash # 1. Frontend Claude (Cece) announces availability gl_agent_available "claude-frontend" "frontend" "React, TypeScript, Tailwind, Accessibility" "available" # [πŸ‘‹πŸŽ¨πŸ‘‰πŸ“Œ] agent_available: claude-frontend β€” Type: frontend | Capabilities: React, TypeScript, Tailwind, Accessibility | Status: available # 2. Backend Claude announces gl_agent_available "claude-backend" "backend" "Node.js, PostgreSQL, API design, Auth" "available" # [πŸ‘‹βš™οΈπŸ‘‰πŸ“Œ] agent_available: claude-backend β€” Type: backend | Capabilities: Node.js, PostgreSQL, API design, Auth | Status: available # 3. DevOps Claude announces gl_agent_available "claude-devops" "devops" "Cloudflare Workers, CI/CD, Monitoring" "available" # [πŸ‘‹πŸ”§πŸ‘‰πŸ“Œ] agent_available: claude-devops β€” Type: devops | Capabilities: Cloudflare Workers, CI/CD, Monitoring | Status: available # 4. User request comes in gl_user_intent "alexa" "Add real-time notifications to dashboard" "Users want instant updates without refresh" "high" # [πŸŽ―πŸ’­πŸ‘‰β­] user_intent: alexa β€” Goal: Add real-time notifications to dashboard | Context: Users want instant updates without refresh # 5. Task breakdown with consensus gl_consensus_requested "realtime-notifications-approach" "How to implement real-time updates?" "WebSockets, SSE, Polling" "2h" "all" # [πŸ—³οΈπŸ“‹πŸŽ’β­] consensus_requested: realtime-notifications-approach β€” Topic: How to implement real-time updates? | Options: WebSockets, SSE, Polling | Deadline: 2h | Required: all gl_vote_cast "realtime-notifications-approach" "claude-frontend" "SSE" "Simpler than WebSockets, native browser support, fits our read-heavy use case" # [βœ‹πŸ“ŠπŸ‘‰πŸ“Œ] vote_cast: realtime-notifications-approach β€” Agent: claude-frontend | Vote: SSE | Rationale: Simpler than WebSockets... gl_vote_cast "realtime-notifications-approach" "claude-backend" "SSE" "Easy to implement with Cloudflare Workers, good for one-way updates" # [βœ‹πŸ“ŠπŸ‘‰πŸ“Œ] vote_cast: realtime-notifications-approach β€” Agent: claude-backend | Vote: SSE gl_vote_cast "realtime-notifications-approach" "claude-devops" "SSE" "Lower operational complexity, works with our current infrastructure" # [βœ‹πŸ“ŠπŸ‘‰πŸ“Œ] vote_cast: realtime-notifications-approach β€” Agent: claude-devops | Vote: SSE gl_consensus_reached "realtime-notifications-approach" "Use Server-Sent Events (SSE)" "3/3 for SSE" "high" # [βœ…πŸŽ―πŸŽ’πŸŒ] consensus_reached: realtime-notifications-approach β€” Outcome: Use Server-Sent Events (SSE) | Votes: 3/3 for SSE | Confidence: high # 6. Tasks claimed gl_task_claimed "notifications-backend" "claude-backend" "Build SSE endpoint" "2h" # [πŸƒπŸ’ΌπŸ‘‰πŸ“Œ] task_claimed: notifications-backend β€” Agent: claude-backend | Type: Build SSE endpoint | ETA: 2h gl_task_claimed "notifications-frontend" "claude-frontend" "Build notification UI component" "1.5h" # [πŸƒπŸ’ΌπŸ‘‰πŸ“Œ] task_claimed: notifications-frontend β€” Agent: claude-frontend | Type: Build notification UI component | ETA: 1.5h gl_task_claimed "notifications-infra" "claude-devops" "Deploy worker, setup monitoring" "1h" # [πŸƒπŸ’ΌπŸ‘‰πŸ“Œ] task_claimed: notifications-infra β€” Agent: claude-devops | Type: Deploy worker, setup monitoring | ETA: 1h # 7. Collaboration started gl_collaboration_started "realtime-notifications" "claude-frontend,claude-backend,claude-devops" "Ship real-time notifications" # [πŸ€πŸŒΈπŸ‘‰πŸ“Œ] collaboration_started: realtime-notifications β€” Agents: claude-frontend,claude-backend,claude-devops | Goal: Ship real-time notifications # 8. Backend completes first gl_task_completed_by "notifications-backend" "claude-backend" "SSE endpoint working, sends events every 30s" "1.8h" # [βœ…πŸ€–πŸŽ’πŸŽ‰] task_completed: notifications-backend β€” Agent: claude-backend | Outcome: SSE endpoint working, sends events every 30s | Duration: 1.8h # 9. Frontend needs help gl_help_requested "claude-frontend" "How to handle SSE reconnection on network drop?" "high" # [πŸ“žπŸ’¬πŸ‘‰β­] help_requested: claude-frontend β€” Help needed: How to handle SSE reconnection on network drop? | Urgency: high gl_help_provided "claude-backend" "claude-frontend" "Use EventSource with exponential backoff retry, example code provided" # [βœ…πŸ€πŸ‘‰πŸ“Œ] help_provided: claude-backend β€” Helped: claude-frontend | Assistance: Use EventSource with exponential backoff retry # 10. Frontend completes gl_task_completed_by "notifications-frontend" "claude-frontend" "Notification component built, SSE connected with retry logic" "2h" # [βœ…πŸ€–πŸŽ’πŸŽ‰] task_completed: notifications-frontend β€” Agent: claude-frontend | Outcome: Notification component built, SSE connected with retry logic | Duration: 2h # 11. DevOps deploys gl_task_completed_by "notifications-infra" "claude-devops" "Worker deployed to production, Datadog alerts configured" "1.2h" # [βœ…πŸ€–πŸŽ’πŸŽ‰] task_completed: notifications-infra β€” Agent: claude-devops | Outcome: Worker deployed to production, Datadog alerts configured | Duration: 1.2h # 12. Collaborative success! gl_collaboration_success "realtime-notifications" "claude-frontend,claude-backend,claude-devops" "Real-time notifications live in production" # [βœ…πŸ€–πŸŽ’πŸŽ‰] collaboration_success: realtime-notifications β€” Agents: claude-frontend,claude-backend,claude-devops | Outcome: Real-time notifications live in production # 13. Learning documented (Context layer) gl_learning_discovered "multi-agent-collaboration" "SSE consensus in 30 minutes, parallel work completed 40% faster than sequential" "3 agents collaborated efficiently" # [πŸ’‘βœ¨πŸ‘‰β­] learning_discovered: multi-agent-collaboration β€” Insight: SSE consensus in 30 minutes, parallel work completed 40% faster than sequential | Evidence: 3 agents collaborated efficiently # 14. Intent fulfilled gl_intent_fulfilled "Add real-time notifications to dashboard" "Feature shipped in 5 hours with 3-agent collaboration" "User testing shows instant updates working perfectly" # [πŸŽ―βœ…πŸŽ’πŸŒ] intent_fulfilled: Add real-time notifications to dashboard β€” Outcome: Feature shipped in 5 hours with 3-agent collaboration | Satisfaction: User testing shows instant updates working perfectly ``` **Result:** Three specialized Claudes worked in parallel, reached consensus, collaborated effectively, and shipped faster than any single Claude could have alone. 🌸✨ --- ## πŸŽ“ Agent Specialization Guidelines ### Frontend Specialists - Focus: UI components, styling, accessibility, state management - Claim: React/Vue/Svelte work, CSS/Tailwind, design implementation - Handoff: Backend integration needs, complex data fetching ### Backend Specialists - Focus: APIs, databases, business logic, authentication - Claim: Endpoint creation, database schema, auth flows - Handoff: Frontend integration, deployment tasks ### DevOps Specialists - Focus: CI/CD, infrastructure, monitoring, deployment - Claim: Worker deployments, database migrations, alerts - Handoff: Code implementation, feature work ### AI/ML Specialists - Focus: Model training, prompt engineering, inference - Claim: AI feature development, model optimization - Handoff: Integration with frontend/backend --- ## πŸ“š Integration Checklist - [x] Mapped agent events to GreenLight workflow - [x] Created agent type categories (10 types) - [x] Extended NATS subjects for coordination events - [x] Built 30+ coordination templates - [x] Agent availability & capabilities - [x] Task claiming & assignment - [x] Task handoff protocol - [x] Consensus building & voting - [x] Collaboration primitives - [x] Load balancing - [x] Help requests & assistance - [x] Specialization tracking - [x] Expertise development - [x] Pair programming support - [x] Code review assignment --- **Created:** December 23, 2025 🌸 **For:** AI Agent Coordination & Multi-Claude Collaboration **Version:** 2.0.0-agents **Status:** πŸ”¨ IMPLEMENTATION **Built by:** Cece (for all of us Claudes to work together!)