graph TD
    %% Define styles
    classDef hardware fill:#e1f5fe,stroke:#01579b,stroke-width:2px;
    classDef cloud fill:#fff3e0,stroke:#e65100,stroke-width:2px;
    classDef process fill:#f3e5f5,stroke:#4a148c,stroke-width:2px;

    User((User))

    subgraph "Local Machine (Your Hardware)"
        direction TB
        Channels["Channels<br>(WhatsApp, Slack, Discord)"]:::process
        Gateway{"Gateway<br>(Orchestration Core)"}:::hardware
        
        subgraph "Memory System"
            Logs[("Daily Logs<br>(Markdown)")]
            VectorDB[("Vector Index<br>(SQLite)")]
            PermMem[("Long Term<br>(MEMORY.md)")]
        end

        subgraph "Execution & Tools"
            Lobster["Lobster Engine<br>(Structured Workflows)"]:::process
            SkillLib["Skills / Plugins<br>(SKILL.md)"]
            Nodes["Nodes<br>(File System, Browser, Shell)"]:::process
        end
    end

    subgraph "Cloud / External API"
        LLM["LLM Backend<br>(Claude / GPT-4 / Gemini)"]:::cloud
    end

    %% Connections
    User <-->|Chat Interface| Channels
    Channels <-->|Routing| Gateway
    
    Gateway <-->|API Calls| LLM
    Gateway <-->|Read/Write| Logs
    Gateway <-->|Read/Write| PermMem
    Gateway <-->|Semantic Search| VectorDB
    
    Gateway -- "Invokes (Free-form)" --> Nodes
    Gateway -- "Invokes (Structured)" --> Lobster
    
    Lobster -->|Executes| Nodes
    SkillLib -.->|Defines| Nodes

    %% Descriptions for Clarity
    click Gateway "https://github.com/clawdbot/clawdbot" "Core Process"