Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Claude Code Multi-Agent Orchestration System

An efficient, token-optimized orchestration system that coordinates specialized AI agents to complete complex software projects without redundant research or context exhaustion.

🎯 Core Philosophy

"Research once, reuse everywhere."

This system prevents different agents from performing the same research by implementing a file-based memory architecture where research is done ONCE during planning, saved to persistent files, and reused by all implementing agents.

πŸ“Š The Problem This Solves

Traditional AI coding workflows suffer from:

  • Redundant research - Multiple agents searching for the same information
  • Context exhaustion - Token limits hit from repeated documentation lookups
  • Lost knowledge - Research done early gets forgotten later
  • Inconsistent decisions - Different agents making different architectural choices

πŸ—οΈ Architecture Overview

Orchestrator (You)
    β”œβ”€β”€ Planning Phase
    β”‚   └── task-planner
    β”‚       └── task-context-gatherer (for each task)
    β”‚           β”œβ”€β”€ research-specialist (Context7/Web)
    β”‚           └── Explore (codebase patterns)
    β”‚
    β”œβ”€β”€ Implementation Phase
    β”‚   β”œβ”€β”€ task-coder (reads research files)
    β”‚   β”œβ”€β”€ script-kitty (system operations)
    β”‚   └── debug-resolver (error fixing)
    β”‚
    └── Documentation Phase
        β”œβ”€β”€ doc-maintainer (function stubs)
        └── historian (checkpoint snapshots)

πŸ“ Directory Structure

When agents work on a project, they organize everything under agent_context/:

project_root/
β”œβ”€β”€ src/                     # Your application code
β”œβ”€β”€ tests/                   # Your test files
└── agent_context/           # Agent workspace (never pollutes your code)
    β”œβ”€β”€ tasks/
    β”‚   β”œβ”€β”€ Current_tasks.md        # Active task list with status
    β”‚   β”œβ”€β”€ TASK1_research.md       # Research for task 1
    β”‚   β”œβ”€β”€ TASK2_research.md       # Research for task 2
    β”‚   └── archived/               # Completed/pivoted work
    β”‚       └── 2024-11-01_auth/
    β”‚           β”œβ”€β”€ Current_tasks.md
    β”‚           └── TASK*_research.md
    β”‚
    β”œβ”€β”€ context/
    β”‚   β”œβ”€β”€ PROJECT_CONTEXT.md      # Architectural decisions
    β”‚   └── ENVIRONMENT.md           # Deployment & infrastructure
    β”‚
    └── docs/
        β”œβ”€β”€ UserService.md           # Function stubs (not full code)
        └── AuthController.md        # Token-efficient documentation

πŸ”„ How It Prevents Duplicate Research

1. Research Happens ONCE (Planning Phase)

User Request β†’ task-planner β†’ task-context-gatherer
                                    β”œβ”€β”€ research-specialist (APIs/syntax)
                                    └── Explore (codebase patterns)
                                           ↓
                                    TASK1_research.md (saved)
Loading

2. Implementation Uses Saved Research

task-coder β†’ Reads TASK1_research.md β†’ Implements β†’ Complete
    ↓
    (If more info needed - rare)
    ↓
task-coder β†’ research-specialist/Explore directly β†’ Updates research file
Loading

3. Key Efficiency Features

  • No redundant Context7 searches - Results cached in TASK{N}_research.md
  • No re-reading source code - Function stubs in docs/{file}.md
  • Parallel research - Multiple agents can research simultaneously
  • Persistent across crashes - File-based system survives interruptions

πŸ‘₯ Agent Roles

Core Agents

Agent Role When Called What It Saves
task-planner Breaks down features into micro-tasks Start of any feature Current_tasks.md, PROJECT_CONTEXT.md
task-context-gatherer Coordinates research for tasks By task-planner ONLY TASK{N}_research.md
task-coder Implements production-ready code For each coding task Updated files, calls doc-maintainer
debug-resolver Fixes compilation/runtime errors When errors occur Fixed code, known issues
script-kitty System operations, deployments Terminal/cloud tasks ENVIRONMENT.md, scripts
research-specialist API/syntax documentation When current info needed Returns only diffs
doc-maintainer Creates function stub docs After file changes docs/{file}.md

Research Flow Rules

  1. task-planner is the ONLY agent that calls task-context-gatherer
  2. task-context-gatherer coordinates research and saves to files
  3. Implementing agents (task-coder, debug-resolver, script-kitty) read research files
  4. If more research needed, they call research-specialist/Explore directly

πŸš€ Key Features

1. Production-Ready Only

  • No stub functions or placeholder code
  • No fake credentials or TODO comments
  • Complete, working implementations only

2. Smart Credential Handling

Discover need for API key
    ↓
Check ENVIRONMENT.md
    ↓
Check .env files
    ↓
Check task research files
    ↓
Ask script-kitty to check system
    ↓
ONLY if not found β†’ Block and ask user

3. Research Priority

  • Context7 (PRIMARY) - Curated documentation, returns only diffs
  • Web Search (SECONDARY) - For recent updates or missing info

4. Blocker Discovery Model

  • Planning phase - task-planner catches obvious blockers
  • Implementation phase - Agents discover runtime blockers
  • All blockers - Stop immediately, report to orchestrator

πŸ“ˆ Token Efficiency Metrics

Traditional Approach This System Savings
Each agent searches docs Research once, save to file 80% fewer API calls
Re-read full source files Read function stubs only 90% fewer tokens
Repeat Context7 searches Cache in research files 100% elimination
Hold research in memory File-based persistence Unlimited scale

πŸ”§ Installation

Global Setup (All Projects)

git clone https://github.com/Xananthium/claude-code-agents.git
cp claude-code-agents/CLAUDE.md ~/.claude/CLAUDE.md
cp -r claude-code-agents/agents ~/.claude/agents/

Per-Project Setup

mkdir -p .claude
cp claude-code-agents/CLAUDE.md .claude/CLAUDE.md
cp -r claude-code-agents/agents .claude/agents/

🎭 Example Workflow

User Request: "Add Stripe payment processing"

  1. Planning Phase

    Orchestrator β†’ task-planner: "Plan Stripe integration"
    task-planner β†’ Creates 8 micro-tasks in Current_tasks.md
    task-planner β†’ task-context-gatherer for each task
    task-context-gatherer β†’ Saves Stripe API docs to TASK1_research.md
    
  2. Implementation Phase

    Orchestrator β†’ task-coder: "Implement TASK1"
    task-coder β†’ Reads TASK1_research.md (no new research!)
    task-coder β†’ Implements using saved syntax
    task-coder β†’ Tests and completes
    
  3. Result

    • Stripe integrated with zero redundant research
    • All agents used the same research files
    • Token usage minimal

πŸ—„οΈ Archiving System

When a feature is complete OR direction changes:

ARCHIVE_NAME="$(date +%Y-%m-%d)_feature_name"
mkdir -p agent_context/tasks/archived/${ARCHIVE_NAME}/
mv agent_context/tasks/Current_tasks.md agent_context/tasks/archived/${ARCHIVE_NAME}/
mv agent_context/tasks/TASK*_research.md agent_context/tasks/archived/${ARCHIVE_NAME}/

This preserves the relationship between tasks and their research for future reference.

πŸ’‘ Why This Works

  1. Separation of Concerns - Each agent has one job and does it perfectly
  2. Write Once, Read Many - Research happens once, gets reused forever
  3. External Memory - Agents don't hold state, files do
  4. Progressive Enhancement - Start with planning, research fills in progressively
  5. Crash Resilient - File-based system survives any interruption

🀝 Contributing

Found a way to make the system even more efficient? PRs welcome!

πŸ“„ License

MIT - Because good orchestration should be free.


Built for Claude Code by developers who believe in never doing the same research twice.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors