Skip to content

🧠 Context Engineering Research - Not just another agent collection, but using research and context engineering to function as a collective. Hub-and-spoke coordination through Claude Code.

License

Notifications You must be signed in to change notification settings

vanzan01/claude-code-sub-agent-collective

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

99 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hub-and-Spoke Agent Coordination Research

A Message from the Creator

Hey everyone! Building on Cursor Memory Bank (2,400+ stars), I've been pioneering what's now called Context Engineering with Claude Code.

πŸ”₯ The Problem I Discovered:
Agents lose context, forget instructions, and can't coordinate reliably.

🧠 My Context Engineering Solution:
β€’ JIT Context Loading - Agents get exactly what they need, when they need it
β€’ HANDOFF_TOKEN Validation - Confirms agents actually understand
β€’ Hub-and-Spoke Coordination - Eliminates context drift between agents

⚑ What Makes This Different:
Instead of overwhelming agents with everything (which breaks them), my system delivers just-in-time context - precise, relevant information loaded dynamically per task.

πŸš€ The Result:
A true agent collective that functions as unified intelligence, not just another agent collection.

Come be part of this context engineering breakthrough! 🎯


Research: Solving Multi-Agent Coordination

After months of researching and testing agent coordination problems in my Cursor Memory Bank project, I identified three critical failures that plague ALL multi-agent systems. This breakthrough was only possible with Claude Code's sub-agent architecture and hooks system - each agent having its own isolated context window, combined with deterministic hooks for validation, allowed me to reach this next level of coordination research:

πŸ”₯ Context Degradation - Agents lose context across interactions and forget critical instructions
πŸ”₯ Coordination Drift - Peer-to-peer communication becomes unreliable and non-deterministic
πŸ”₯ Quality Inconsistency - Agents skip steps and behave inconsistently without enforcement

Research Hypotheses Under Test

πŸ“Š JIT Context Loading Hypothesis

  • Testing: Can graph-based context delivery prevent agent focus loss?
  • Hypothesis: Dynamic context assembly from knowledge graphs will outperform global context approaches

πŸ”— Hub-and-Spoke Coordination Hypothesis

  • Testing: Can central hub routing eliminate context drift?
  • Hypothesis: Routing-agent orchestration will prove more reliable than peer-to-peer communication

πŸ”’ HANDOFF_TOKEN Validation Hypothesis

  • Status: PAUSED - Redesigning handoff mechanism
  • Issue: Current token validation approach needs refinement for better agent coordination
  • Next: Exploring simplified handoff patterns without explicit token requirements

Usage

Research framework for reliable multi-agent coordination.

Usage: @routing-agent your request

Core Innovation: Solves fundamental agent coordination problems through hub-and-spoke pattern, automated routing, and mandatory quality gates.

Note: HANDOFF_TOKEN validation is currently disabled while redesigning the handoff mechanism for better reliability.

Quick Start

  1. Copy .claude/ directory to your project
  2. Install MCP dependencies: task-master, context7, playwright
  3. Use: @routing-agent your request

System Management

Using the VAN Maintenance Agent

The van-maintenance-agent manages the agent ecosystem and handles system maintenance:

@van-maintenance-agent [maintenance task]

Common Use Cases:

πŸ†• Adding New Agents

@van-maintenance-agent integrate new agent [agent-name] into the ecosystem
  • Automatically updates interaction diagrams
  • Adds agent to categorization system
  • Creates proper handoff relationships
  • Updates workflow patterns

πŸ”§ Troubleshooting Agent Issues

@van-maintenance-agent fix mermaid syntax errors in agent files
@van-maintenance-agent update agent relationships after changes
@van-maintenance-agent validate handoff token consistency

πŸ“Š System Health Checks

@van-maintenance-agent perform comprehensive ecosystem audit
@van-maintenance-agent analyze agent categorization accuracy
@van-maintenance-agent review workflow pattern coverage

πŸ› οΈ Documentation Maintenance

@van-maintenance-agent update agent interaction documentation
@van-maintenance-agent fix outdated agent relationships
@van-maintenance-agent validate ecosystem integrity

The van-agent ensures your agent ecosystem stays healthy and properly coordinated as it evolves.

Architecture

Central Hub (routing-agent): Graph-based semantic analysis, JIT context loading Quality Gates: 6 mandatory gates with no bypass (Planning β†’ Infrastructure β†’ Implementation β†’ Testing β†’ Polish β†’ Completion) Specialized Agents: Ultra-narrow domain focus (component, feature, infrastructure, testing, polish) Validation: Progressive retry system (HANDOFF_TOKEN temporarily disabled for redesign)

Hub-and-Spoke Coordination Architecture

graph TB
    subgraph "Central Hub"
        RA[🎯 Routing Agent<br/>Semantic Analysis]
    end
    
    subgraph "Coordination"  
        EPM[πŸ—οΈ Project Manager<br/>6 Quality Gates]
    end
    
    subgraph "Research"
        PRD[πŸ“‹ PRD Research<br/>Context7]
        RESEARCH[πŸ”¬ Research Agent<br/>Analysis]
    end
    
    subgraph "Implementation"
        COMP[🎨 Components<br/>UI & Styling]
        FEAT[πŸ’Ύ Features<br/>Business Logic]
        INFRA[πŸ—οΈ Infrastructure<br/>Build & Deploy]
        TEST[πŸ§ͺ Testing<br/>Validation]
        POLISH[✨ Polish<br/>Performance]
    end
    
    subgraph "Quality Gates"
        EQG[πŸ›‘οΈ Quality Gate]
        CG[βœ… Complete Gate]
        RG[🎯 Ready Gate]
    end
    
    subgraph "System"
        HOOKS[βš™οΈ Hooks<br/>Validation]
        TM[πŸ“Š TaskMaster<br/>State]
    end
    
    %% Hub connections
    RA -.-> EPM
    RA -.-> PRD
    RA -.-> RESEARCH
    RA -.-> COMP
    RA -.-> FEAT
    RA -.-> INFRA
    RA -.-> TEST
    RA -.-> POLISH
    
    %% Return to hub
    EPM -.-> RA
    PRD -.-> RA
    RESEARCH -.-> RA
    COMP -.-> RA
    FEAT -.-> RA
    INFRA -.-> RA
    TEST -.-> RA
    POLISH -.-> RA
    
    %% Quality flow
    EPM --> EQG --> CG --> RG
    
    %% System coordination
    HOOKS -.-> RA
    TM -.-> EPM
    
    classDef hub fill:#ffd700,stroke:#ff8c00,stroke-width:6px,color:#1a1a1a,font-size:20px
    classDef coordination fill:#e3f2fd,stroke:#1976d2,stroke-width:4px,color:#1a1a1a,font-size:16px
    classDef research fill:#f3e5f5,stroke:#7b1fa2,stroke-width:4px,color:#1a1a1a,font-size:16px
    classDef implementation fill:#e8f5e8,stroke:#2d5a27,stroke-width:3px,color:#1a1a1a,font-size:16px
    classDef quality fill:#fce4ec,stroke:#a91e63,stroke-width:4px,color:#1a1a1a,font-size:16px
    classDef system fill:#fff3e0,stroke:#f57c00,stroke-width:3px,color:#1a1a1a,font-size:16px
    
    class RA hub
    class EPM coordination
    class PRD,RESEARCH research
    class COMP,FEAT,INFRA,TEST,POLISH implementation
    class EQG,CG,RG quality
    class HOOKS,TM system
Loading

Semantic Analysis & JIT Context Loading

graph TD
    REQUEST[πŸ‘€ REQUEST] --> PARSE[🧠 SEMANTIC<br/>ANALYSIS]
    
    PARSE --> CLASSIFY{🎯 INTENT<br/>CLASSIFICATION}
    
    CLASSIFY -->|UI| UI[🎨 UI CONTEXT<br/>JIT LOAD]
    CLASSIFY -->|DATA| DATA[πŸ’Ύ DATA CONTEXT<br/>JIT LOAD]
    CLASSIFY -->|BUILD| BUILD[πŸ—οΈ BUILD CONTEXT<br/>JIT LOAD]
    CLASSIFY -->|TEST| TEST[πŸ§ͺ TEST CONTEXT<br/>JIT LOAD]
    CLASSIFY -->|INFO| INFO[πŸ”¬ RESEARCH CONTEXT<br/>JIT LOAD]
    
    UI --> AGENT_UI[🎨 COMPONENT<br/>AGENT]
    DATA --> AGENT_DATA[πŸ’Ύ FEATURE<br/>AGENT]
    BUILD --> AGENT_BUILD[πŸ—οΈ INFRASTRUCTURE<br/>AGENT]
    TEST --> AGENT_TEST[πŸ§ͺ TESTING<br/>AGENT]
    INFO --> AGENT_INFO[πŸ”¬ RESEARCH<br/>AGENT]
    
    AGENT_UI --> TOKEN[πŸ”’ HANDOFF<br/>TOKEN]
    AGENT_DATA --> TOKEN
    AGENT_BUILD --> TOKEN
    AGENT_TEST --> TOKEN
    AGENT_INFO --> TOKEN
    
    TOKEN --> VALIDATE{βœ… VALID?}
    
    VALIDATE -->|PASS| SUCCESS[🎯 EXECUTE<br/>WITH CONTEXT]
    VALIDATE -->|FAIL| RETRY[πŸ”„ RETRY<br/>3X MAX]
    
    RETRY --> ESCALATE[πŸ†˜ ESCALATE<br/>TO PM]
    
    SUCCESS -.-> HUB[πŸ”„ RETURN<br/>TO HUB]
    ESCALATE -.-> HUB
    HUB -.-> PARSE
    
    classDef input fill:#e1f5fe,stroke:#0277bd,stroke-width:4px,color:#1a1a1a,font-size:18px
    classDef semantic fill:#ffd700,stroke:#ff8c00,stroke-width:6px,color:#1a1a1a,font-size:20px
    classDef classify fill:#e3f2fd,stroke:#1976d2,stroke-width:4px,color:#1a1a1a,font-size:16px
    classDef context fill:#f3e5f5,stroke:#7b1fa2,stroke-width:3px,color:#1a1a1a,font-size:16px
    classDef agent fill:#e8f5e8,stroke:#2d5a27,stroke-width:3px,color:#1a1a1a,font-size:16px
    classDef token fill:#fce4ec,stroke:#a91e63,stroke-width:4px,color:#1a1a1a,font-size:16px
    classDef validate fill:#fff3e0,stroke:#f57c00,stroke-width:3px,color:#1a1a1a,font-size:16px
    classDef system fill:#f1f8e9,stroke:#689f38,stroke-width:3px,color:#1a1a1a,font-size:16px
    
    class REQUEST input
    class PARSE semantic
    class CLASSIFY classify
    class UI,DATA,BUILD,TEST,INFO context
    class AGENT_UI,AGENT_DATA,AGENT_BUILD,AGENT_TEST,AGENT_INFO agent
    class TOKEN token
    class VALIDATE validate
    class SUCCESS,RETRY,ESCALATE,HUB system
Loading

Research Results

Context Engineering Hypothesis Testing:

  • Context retention - Hub-and-spoke coordination vs peer communication patterns
  • Instruction comprehension - HANDOFF_TOKEN validation vs standard agent handoffs
  • Coordination reliability - Progressive retry systems vs single-attempt coordination

Dependencies

claude mcp add task-master -s user -- npx -y --package=task-master-ai task-master-ai
claude mcp add context7 -s user -- npx -y context7-server
claude mcp add playwright -s user -- npx -y playwright-mcp-server

Key Files

  • .claude/agents/routing-agent.md - Central hub with graph-based routing
  • .claude/agents/enhanced-project-manager-agent.md - 6-gate quality process
  • .claude/agents/van-maintenance-agent.md - Agent ecosystem maintenance
  • .claude/hooks/routing-executor.sh - Routing validation (HANDOFF_TOKEN disabled)

Built on: cursor-memory-bank (2,400+ stars) research into agent coordination problems.

About

🧠 Context Engineering Research - Not just another agent collection, but using research and context engineering to function as a collective. Hub-and-spoke coordination through Claude Code.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages