%%{init: {'theme': 'base', 'themeVariables': { 'fontFamily': 'Space Mono', 'fontSize': '13px', 'primaryColor': '#34312d', 'primaryBorderColor': '#7e7f83', 'lineColor': '#d9c5b2', 'textColor': '#f3f3f4', 'background': '#14110f', 'edgeLabelBackground': '#34312d'}, 'flowchart': {'htmlLabels': true, 'useMaxWidth': false, 'nodeSpacing': 60, 'rankSpacing': 80, 'padding': 20}}}%%
graph TD
%% Input Node
IN([Task Schema v2.0]) --> GATE{Circuit Breaker
State Check}
%% Layer 1: The Circuit
GATE -- "backlog | todo | paused | done" --> BYPASS[Circuit Open
Weight 0 / Timer OFF]
GATE -- "in_progress" --> ACTIVE[Circuit Closed
Weight 1 / Timer ON]
%% Layer 2: The Control Plane Monitors (Parallel Symmetry)
ACTIVE --> M_GHOST[Ghost Filter
Value Audit]
ACTIVE --> M_EFF[Efficiency Monitor
Budget Audit]
ACTIVE --> M_HEART[Heartbeat Monitor
Stagnation Audit]
%% Layer 3: Penalty Triggers
M_GHOST -- "0 Commits & >0 Hrs" --> P_GHOST[Ghost Penalty: -40 pts]
M_EFF -- "Ratio > 2.5" --> P_EFF[Zombie Penalty: -20 pts]
M_HEART -- "Index > 3.0" --> P_HEART[Stagnation Penalty: -30 pts]
%% Layer 4: Convergence & Aggregation
BYPASS --> GCS{Confidence Engine
Base 100 - Σ Penalties}
P_GHOST --> GCS
P_EFF --> GCS
P_HEART --> GCS
%% Valid Pass-Throughs (Dotted lines)
M_GHOST -. "Valid Output" .-> GCS
M_EFF -. "Normal Ratio" .-> GCS
M_HEART -. "Active Pulse" .-> GCS
%% Layer 5: Final Execution
GCS --> EVAL{Is GCS < 50?}
EVAL -- Yes --> HALT[Trigger Hallucination Brake
Suppress AI Projections]
EVAL -- No --> PASS[Standard Output
AI Summary Generated]
%% Design System Classes
classDef default fill:#14110f,stroke:#7e7f83,stroke-width:1px,color:#f3f3f4;
classDef decision fill:#34312d,stroke:#d9c5b2,stroke-width:2px,color:#d9c5b2;
classDef trigger fill:#2a1b1a,stroke:#ff5f56,stroke-width:1px,color:#ff5f56;
classDef healthy fill:#18281e,stroke:#27c93f,stroke-width:1px,color:#27c93f;
classDef bypass fill:#14110f,stroke:#7e7f83,stroke-width:1px,stroke-dasharray: 4 4,color:#8b949e;
class GATE,GCS,EVAL decision;
class P_GHOST,P_EFF,P_HEART,HALT trigger;
class PASS healthy;
class BYPASS bypass;