graph TB
    subgraph "Agent Runtime Layer (Any LLM Agent System)"
        AGENT["<b>Agentic AI Runtime</b><br/>LangChain • AutoGPT • CrewAI<br/>Claude Code • Custom Agents<br/>Multi-Agent Systems<br/><i>Tool Use • Planning • Execution</i>"]
    end

    subgraph "Tractatus Governance Layer (External Enforcement)"
        BE["<b>BoundaryEnforcer</b><br/>Blocks values decisions<br/>• Privacy policies<br/>• Ethical trade-offs<br/>• Strategic direction<br/>• User agency violations<br/><b style='color:#ef4444'>⚠ Cannot be bypassed by prompting</b>"]
        IPC["<b>InstructionPersistenceClassifier</b><br/>Classifies & stores instructions<br/>• Quadrant (STR/OPS/TAC/SYS)<br/>• Persistence (HIGH/MED/LOW)<br/>• Temporal scope<br/><b style='color:#ef4444'>⚠ External to AI memory</b>"]
        CRV["<b>CrossReferenceValidator</b><br/>Prevents pattern bias override<br/>• Checks instruction history<br/>• Detects conflicts (27027)<br/>• Blocks contradictions<br/><b style='color:#ef4444'>⚠ Independent verification</b>"]
        CPM["<b>ContextPressureMonitor</b><br/>Detects degraded conditions<br/>• Token budget tracking<br/>• Error accumulation<br/>• Checkpoint reporting<br/><b style='color:#ef4444'>⚠ Objective metrics, not self-reported</b>"]
        MV["<b>MetacognitiveVerifier</b><br/>Validates complex operations<br/>• >3 files or >5 steps<br/>• Architecture changes<br/>• Confidence scoring<br/><b style='color:#ef4444'>⚠ Structural pause-and-verify</b>"]
        PDO["<b>PluralisticDeliberationOrchestrator</b><br/>Facilitates values deliberation<br/>• Multi-stakeholder engagement<br/>• Moral framework mapping<br/>• Precedent documentation<br/><b style='color:#ef4444'>⚠ Human judgment required</b>"]
    end

    subgraph "Persistent Storage Layer (Immutable Audit Trail)"
        GR["<b>governance_rules</b><br/>• rule_id (STR-001...)<br/>• quadrant<br/>• persistence level<br/>• enforced_by<br/>• violation_action<br/>• active status"]
        AL["<b>audit_logs</b><br/>• timestamp<br/>• service (which enforcer)<br/>• action (BLOCK/WARN)<br/>• instruction<br/>• rule_violated<br/>• session_id"]
        SS["<b>session_state</b><br/>• session_id<br/>• token_count<br/>• message_count<br/>• pressure_level<br/>• last_checkpoint<br/>• framework_active"]
        IH["<b>instruction_history</b><br/>• instruction_id<br/>• content<br/>• classification<br/>• persistence<br/>• created_at<br/>• active status"]
    end

    subgraph "Human Approval Workflows"
        HA["<b>Human Oversight</b><br/>Values Decisions<br/>Strategic Changes<br/>Boundary Violations<br/><i>Final authority on incommensurable values</i>"]
    end

    %% Data Flow - Agent to Governance
    AGENT -->|"All actions pass through governance checks"| BE
    AGENT --> IPC
    AGENT --> CRV
    AGENT --> CPM
    AGENT --> MV
    AGENT --> PDO

    %% Governance to Storage
    BE --> GR
    BE --> AL
    IPC --> GR
    IPC --> IH
    CRV --> IH
    CRV --> AL
    CPM --> SS
    CPM --> AL
    MV --> AL
    PDO --> AL

    %% Human Approval Flow
    BE -->|"Boundary violation"| HA
    PDO -->|"Values conflict"| HA
    HA -->|"Approval/Rejection"| BE

    %% Styling
    classDef agent fill:#dbeafe,stroke:#3b82f6,stroke-width:3px
    classDef governance fill:#f0fdf4,stroke:#10b981,stroke-width:3px
    classDef persistence fill:#fef9c3,stroke:#eab308,stroke-width:2px
    classDef human fill:#fce7f3,stroke:#ec4899,stroke-width:3px

    class AGENT agent
    class BE,IPC,CRV,CPM,MV,PDO governance
    class GR,AL,SS,IH persistence
    class HA human

    %% Key Insight Box
    NOTE["<b style='color:#dc2626; font-size:14px'>🔒 KEY JAILBREAK DEFENSE</b><br/><span style='font-size:12px'>Governance layer operates OUTSIDE agent runtime<br/>Cannot be overridden by adversarial prompts<br/>Structural boundaries, not behavioral training<br/>Immutable audit trail independent of AI</span>"]

    class NOTE governance
