sim-one-alpha

Orchestrator Flow

This document is the concise execution map for a SIM-ONE Alpha turn. The Execution Workflows reference owns the detailed conversational, research, coding, schedule, capability, and authentication flows. The ownership invariants are also enforced by the generated development lifecycle graph, especially its architecture decision and architecture/security review nodes.

The diagram below is the release governance contract. Current source attaches protocol lookup and approval services, but complete critic scoring and trusted fail-closed enforcement across every path remain release gates.

Release Contract Turn

flowchart TD
    Ingress["TUI / Telegram / Web API / Schedule"]
    Gateway["Gateway authentication and validation"]
    Event["Trusted normalized event"]
    Session["Owned durable Flue session"]
    Orchestrator["SIM-ONE orchestrator and critic"]
    ProtocolTool["load_protocols"]
    ProtocolDB[("SQLite protocol database")]
    Bundle["Applicable protocol bundle"]
    Route{"Governed route"}
    Memory["Memory and document retrieval"]
    LocalTools["Orchestrator-owned tools and MCP"]
    Researcher["Researcher worker"]
    Research["Research workflows and web providers"]
    Coding["Coding Worker lead"]
    Internal["Worker-local tools and internal subagents"]
    Result["Structured result and evidence"]
    Critic{"Protocol and result validation"}
    Approval["Approval path"]
    ApprovedAction["Approved action execution"]
    Revision["Revision or redelegation"]
    Rejection["Rejection"]
    Response["Final root response"]

    Ingress --> Gateway
    Gateway --> Event
    Event --> Session
    Session --> Orchestrator
    Orchestrator --> ProtocolTool
    ProtocolTool --> ProtocolDB
    ProtocolDB --> Bundle
    Bundle --> Orchestrator
    Orchestrator --> Route
    Route --> Memory
    Route --> LocalTools
    Route --> Researcher
    Researcher --> Research
    Route --> Coding
    Coding --> Internal
    Memory --> Result
    LocalTools --> Result
    Research --> Researcher
    Researcher --> Result
    Internal --> Coding
    Coding --> Result
    Result --> Critic
    Critic -->|approval required| Approval
    Critic --> Revision
    Revision --> Route
    Critic --> Rejection
    Critic -->|accepted| Response
    Approval -->|approved| ApprovedAction
    ApprovedAction --> Result
    Approval -->|denied| Rejection
    Response --> Gateway

Equivalent text flow:

connector or schedule
-> authenticated application ingress
-> trusted normalized event
-> owned durable Flue session
-> orchestrator
-> load_protocols from SQLite
-> governed selection of memory, tools, MCP, workflows, or workers
-> structured result returned to the orchestrator
-> protocol and result validation
-> approval, revision, rejection, or final root response

Ownership Rules

Durable Execution Boundaries

Normal chat uses the app-owned /api/chat/events route, which persists trusted event context and prompts the durable Flue orchestrator agent. Scheduled work uses Flue dispatch(...) and is admitted to the same orchestrator boundary.

Finite workflows remain available for bounded operations. Workflow invocation creates a Flue run and returns a run pointer; direct agent prompts and dispatched agent input use the durable agent submission lifecycle instead.

Source Map

Responsibility Source
Application shell and route mount src/app.ts
Chat ingress and trusted event persistence src/api/routes/chat-events.ts
Durable session routing src/engine/session/
Orchestrator agent src/agents/orchestrator.ts
Protocol lookup src/engine/tools/protocol-tool.ts
Protocol matching and storage src/core/protocols/
Researcher worker src/engine/workers/researcher/
Research workflows src/workflows/research.ts, src/workflows/web-research.ts
Coding Worker src/engine/workers/coding-worker/
Schedule dispatch src/engine/schedules/schedule-dispatch.ts