Skip to content

Fleet Intelligence Data Flow ​

mermaid
flowchart TD
    subgraph Session["CLI Session"]
        REPL["REPL Input"]
        Coordinator["CoordinatorEngine"]
        Workers["Worker Agents<br/>(explorer, coder, reviewer, tester)"]
    end

    subgraph Events["Event System"]
        FSS["FleetStateStore"]
        EL["EventListeners"]
    end

    subgraph Phase1["Phase 1: Observe"]
        IC["IntelCollector"]
        PR["PiiRedactor"]
        DB["IntelDatabase<br/>(SQLite — ~/.fleet/intel/fleet-intel.db)"]
    end

    subgraph Phase2["Phase 2: Analyze"]
        Summary["/fleet-intel summary"]
        Agents["/fleet-intel agents"]
        Failures["/fleet-intel failures"]
        Tokens["/fleet-intel tokens"]
        Stats["/fleet-intel stats"]
        Search["/fleet-intel search"]
        Skills["/fleet-intel skills"]
    end

    subgraph Phase3["Phase 3: Suggest"]
        SE["SuggestionEngine"]
        CA["Classifier Analyzer<br/>(&lt;60% success, ≥10 runs)"]
        DA["Decomposition Analyzer<br/>(worker count vs completion)"]
        RA["Resource Analyzer<br/>(model cost vs success)"]
    end

    subgraph Phase4["Phase 4: Evolve"]
        SKE["SkillEvolver"]
        Shadow["Shadow Proposals"]
        ER["EvalRunner<br/>(A/B comparison)"]
        VN["VerifierNode<br/>(deterministic checks)"]
        EJ["EvalJudge<br/>(LLM judge)"]
        ES["EvalScheduler<br/>(30m periodic)"]
        OB["OutcomeBackfiller<br/>(git merge/revert check)"]
    end

    subgraph Phase5["Phase 5: Assist"]
        AM["Auto-Memory<br/>(≥3 tasks → memory.md)"]
        SE2["SteeringExtractor<br/>(user preference mining)"]
        LS["LoopScheduler<br/>(30m consolidation)"]
        FIC["formatIntelContext()"]
        CP["Coordinator Prompt<br/>&lt;fleet-intelligence&gt;"]
        MF[".fleet/context/memory.md"]
    end

    %% Session flow
    REPL --> Coordinator
    Coordinator --> Workers
    Workers -->|events| EL
    EL --> FSS

    %% Phase 1: Observe
    FSS -->|agent spawned/completed/failed<br/>token usage, errors| IC
    IC --> PR
    PR -->|redacted data| DB

    %% Phase 2: Analyze
    DB --> Summary
    DB --> Agents
    DB --> Failures
    DB --> Tokens
    DB --> Stats
    DB --> Search
    DB --> Skills

    %% Phase 3: Suggest
    DB -->|session history| SE
    SE --> CA
    SE --> DA
    SE --> RA
    CA --> DB
    DA --> DB
    RA --> DB

    %% Phase 4: Evolve
    DB -->|telemetry| SKE
    SKE -->|propose| Shadow
    Shadow --> DB
    Shadow --> ER
    ER --> VN
    ER --> EJ
    ER -->|win/loss/tie| DB
    ES -->|periodic| ER
    OB -->|merge/revert data| DB

    %% Phase 5: Assist
    DB -->|session summary| AM
    AM --> MF
    SE2 -->|insights| DB
    SE2 -->|high confidence| MF
    LS -->|periodic prompts| AM
    DB -->|top 3 suggestions| FIC
    MF -->|auto-loaded| CP
    FIC --> CP
    CP -->|injected into| Coordinator

    %% Styling
    style Phase1 fill:#1a3a2a,stroke:#2d6a4f,color:#fff
    style Phase2 fill:#1a2a3a,stroke:#2a6a9d,color:#fff
    style Phase3 fill:#3a2a1a,stroke:#9d6a2a,color:#fff
    style Phase4 fill:#2a1a2a,stroke:#9d2a6a,color:#fff
    style Phase5 fill:#2a1a3a,stroke:#6a2a9d,color:#fff

    style IC fill:#2d6a4f,stroke:#1b4332,color:#fff
    style SE fill:#e76f51,stroke:#f4a261,color:#fff
    style FIC fill:#e76f51,stroke:#f4a261,color:#fff
    style DB fill:#264653,stroke:#2a9d8f,color:#fff
    style MF fill:#7b2d8e,stroke:#a855f7,color:#fff
    style CP fill:#7b2d8e,stroke:#a855f7,color:#fff
    style SKE fill:#e76f51,stroke:#f4a261,color:#fff
    style ER fill:#e76f51,stroke:#f4a261,color:#fff
    style OB fill:#e76f51,stroke:#f4a261,color:#fff
    style VN fill:#264653,stroke:#2a9d8f,color:#fff

Phase Descriptions ​

Phase 1: Observe ​

The IntelCollector subscribes to FleetStateStore events and captures agent lifecycle data (spawned, completed, failed), token usage (input + output), errors, and skill activations. All data passes through PiiRedactor before being stored in the SQLite database (~/.fleet/intel/fleet-intel.db, WAL mode, prepared statements).

Phase 2: Analyze ​

Seven analysis commands query the database to surface patterns: overall summary, per-agent-type stats, failure analysis, token usage breakdown, top sessions, search, and skill usage tracking.

Phase 3: Suggest ​

The SuggestionEngine runs three analyzers against session history:

  • Classifier — flags agent types with <60% success rate (≥10 runs minimum)
  • Decomposition — correlates worker count with task completion rates
  • Resource — identifies expensive models with similar success to cheaper alternatives

Phase 4: Evolve ​

The evolution pipeline introduces safe, evidence-based skill improvements:

  • SkillEvolver proposes prompt patches via four channels (steering, error_pattern, success_replication, manual)
  • Shadow proposals accumulate A/B evaluation data before any live change
  • EvalRunner runs current vs shadow on identical tasks; VerifierNode provides deterministic verification; EvalJudge breaks ties via LLM
  • EvalScheduler runs periodic eval passes every 30 minutes
  • OutcomeBackfiller retroactively checks git history for merge/revert status, feeding effectiveStatus into dashboards

Phase 5: Assist ​

Suggestions, steering insights, and memory feed back into the coordinator:

  • Top 3 suggestions are injected into the coordinator prompt via formatIntelContext()
  • Auto-memory appends session summaries to .fleet/context/memory.md (loaded by ContextStore)
  • SteeringExtractor mines user messages for persistent preferences, deduplicates via SHA-256, and writes high-confidence insights to memory.md
  • LoopScheduler triggers periodic memory consolidation every 30 minutes