CFN Loop Flow Diagram: Modular AI Agent Orchestration

ML & AI · flowchart diagram · unknown license

Illustrates a modular, iterative workflow for orchestrating AI agents, focusing on complexity reduction through helper scripts and distinct implementation/

Source: https://github.com/masharratt/claude-flow-novice/blob/19a7b70491c6e348c848600530b7d2465f614d7f/readme/cfn-loop-flow-diagram.md
Curated by masharratt
AI Agents Workflow Orchestration Iterative Process Modular Architecture Validation Shell Scripting

Mermaid source

graph TD
    Start[Main Chat] --> Coordinator[cfn-v3-coordinator<br/>Complexity: 5-8]

    Coordinator --> Orchestrator[orchestrate.sh<br/>Main Loop Logic<br/>Target Complexity: 15-20]

    Orchestrator --> Helpers[Helper Scripts]

    Helpers --> ArgParser[argument-parser.sh<br/>Complexity: 8]
    Helpers --> ContextBuilder[context-builder.sh<br/>Complexity: 5]
    Helpers --> AgentSpawner[agent-spawner.sh<br/>Complexity: 6]
    Helpers --> Validator[validation-checker.sh<br/>Complexity: 10]
    Helpers --> IterMgr[iteration-manager.sh<br/>Complexity: 7]

    Orchestrator --> Loop3[Loop 3: Implementation]
    Loop3 --> L3Spawn[Spawn Agents via CLI]
    L3Spawn --> L3Wait[Wait Helper<br/>parallel-wait.sh<br/>Complexity: 6]
    L3Wait --> L3Gate[Gate Check<br/>validation-checker.sh]

    L3Gate -->|Fail| IterMgr
    IterMgr --> Loop3

    L3Gate -->|Pass| Loop2[Loop 2: Validation]
    Loop2 --> L2Spawn[Spawn Validators]
    L2Spawn --> L2Wait[Wait Helper]
    L2Wait --> L2Consensus[Consensus Check<br/>validation-checker.sh]

    L2Consensus -->|Fail| IterMgr
    L2Consensus -->|Pass| PO[Product Owner]

    PO --> Decision{Decision}
    Decision -->|ITERATE| IterMgr
    Decision -->|PROCEED| Complete[Success]
    Decision -->|ABORT| Fail[Abort]

    style Orchestrator fill:#f9f,stroke:#333,stroke-width:2px
    style Helpers fill:#bbf,stroke:#333,stroke-width:2px
    style ArgParser fill:#bfb,stroke:#333,stroke-width:1px
    style ContextBuilder fill:#bfb,stroke:#333,stroke-width:1px
    style AgentSpawner fill:#bfb,stroke:#333,stroke-width:1px
    style Validator fill:#bfb,stroke:#333,stroke-width:1px
    style IterMgr fill:#bfb,stroke:#333,stroke-width:1px
    style L3Wait fill:#bfb,stroke:#333,stroke-width:1px

What this diagram shows

This diagram outlines an ideal low-complexity structure for an iterative AI agent orchestration system. It details the flow from a main chat through a coordinator and orchestrator, which leverages various helper scripts for tasks like argument parsing, context building, agent spawning, and validation. The core process involves two main loops: an 'Implementation Loop' for spawning and gate-checking agents, and a 'Validation Loop' for spawning validators and performing consensus checks. Both loops can trigger iteration via an iteration manager. A Product Owner makes a final decision to iterate, proceed, or abort the process.

When to use it

Use this diagram when designing complex, iterative AI agent workflows, automating multi-step processes, or refactoring monolithic scripts into modular components. It's particularly useful for systems requiring structured iteration, automated validation, and potential human oversight at decision points, aiming to reduce overall system complexity.

How to adapt it for your project

Adapt this pattern by customizing helper scripts for specific domain tasks (e.g., data processing, code generation, deployment). The 'Implementation' and 'Validation' loops can be modified to incorporate different agent types, validation criteria, or feedback mechanisms. The 'Product Owner Decision' can be automated for fully autonomous systems or integrated with external approval workflows. The complexity metrics can guide refactoring efforts in other script-based or microservice architectures.

Key concepts