# abanteai/rawdog architecture

> Architecture diagram of the GitHub repository abanteai/rawdog, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abanteai/rawdog
- Repository: https://github.com/abanteai/rawdog

## Overview

##### Main Components

a) User Interface Layer:
- CLI Interface (entry point through __main__.py)
- Configuration Handler (config.py)

b) Core Processing Layer:
- Script Execution Engine (execute_script.py)
- LLM Integration Service (llm_client.py)
- Prompt Management System (prompts.py)
- Parser Component (parsing.py)

c) External Services:
- LLM Providers (OpenAI, Anthropic, Ollama, etc.)
- File System Interface
- System Resources Interface

##### User Input Flow
- CLI Interface → Parser → LLM Integration → Script Generation → Execution Engine

##### Configuration Flow
- Config Files (.rawdog/config.yaml) → Configuration Handler → All Components

##### Execution Flow
- Execution Engine → File System/System Resources → Output → LLM Integration (for recursive operations)

##### Specific Design Elements

Use these visual elements:
- Hexagons for external services
- Rounded rectangles for configuration elements

##### Detailed Component Breakdown

**User Interface Layer (Blue)**
- CLI Interface
- Command Processing
- Configuration Interface
- YAML Config Parser

**Core Processing Layer (Green)**
- LLM Integration Service
- Provider Selection
- API Communication
- Script Execution Engine
- Python Script Generator
- Safety Checks
- Prompt Management
- Template Storage
- Context Management
- Parser Component
- Input/Output Processing

**External Services Layer (Yellow)**
- LLM Providers
- File System
- System Resources

##### Additional Notes

- Keep the main flow clear and centered
- Related components together
- Clear boundaries between system and external components
- Example flows for common operations

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI
        CLI["CLI Interface"]
        Config["Configuration Handler"]
    end

    subgraph Core
        Parser["Parser Component"]
        LLM["LLM Integration Service"]
        ScriptExec["Script Execution Engine"]
        Prompt["Prompt Management System"]
        Utils["Utility Functions"]
        Logger["Logging System"]
    end

    subgraph External
        LLMProviders{{"LLM Providers<br>(OpenAI/Anthropic/Ollama)"}}
        FileSystem{{"File System"}}
        SysResources{{"System Resources"}}
    end

    subgraph Examples
        direction TB
        SysEx["System Examples"]
        WebEx["Web Examples"]
        FileEx["File Examples"]
        RepoEx["Repo Examples"]
        DataEx["Data Examples"]
        VisEx["Visualization Examples"]
    end

    %% Main Flow
    CLI --> Parser
    Parser --> LLM
    LLM --> ScriptExec
    ScriptExec --> FileSystem
    ScriptExec --> SysResources
    
    %% Configuration Flow
    Config --> CLI
    Config --> LLM
    Config --> ScriptExec
    Config --> Parser
    
    %% Support Systems
    Utils --> ScriptExec
    Utils --> Parser
    Logger --> ScriptExec
    Logger --> LLM
    Prompt --> LLM
    
    %% External Connections
    LLM <--> LLMProviders
    ScriptExec --> |Recursive Call| CLI
    
    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef external fill:#FFE5CC,stroke:#FF9933
    classDef core fill:#E6FFE6,stroke:#33CC33
    classDef ui fill:#E6F3FF,stroke:#3399FF
    classDef examples fill:#F0E6FF,stroke:#9933CC
    
    class LLMProviders,FileSystem,SysResources external
    class Parser,LLM,ScriptExec,Prompt,Utils,Logger core
    class CLI,Config ui
    class SysEx,WebEx,FileEx,RepoEx,DataEx,VisEx examples
    
    %% Click Events
    click CLI "https://github.com/AbanteAI/rawdog/blob/main/src/rawdog/__main__.py"
    click Config "https://github.com/AbanteAI/rawdog/blob/main/src/rawdog/config.py"
    click ScriptExec "https://github.com/AbanteAI/rawdog/blob/main/src/rawdog/execute_script.py"
    click LLM "https://github.com/AbanteAI/rawdog/blob/main/src/rawdog/llm_client.py"
    click Prompt "https://github.com/AbanteAI/rawdog/blob/main/src/rawdog/prompts.py"
    click Parser "https://github.com/AbanteAI/rawdog/blob/main/src/rawdog/parsing.py"
    click Logger "https://github.com/AbanteAI/rawdog/blob/main/src/rawdog/logging.py"
    click Utils "https://github.com/AbanteAI/rawdog/blob/main/src/rawdog/utils.py"
    click SysEx "https://github.com/AbanteAI/rawdog/tree/main/examples/system"
    click WebEx "https://github.com/AbanteAI/rawdog/tree/main/examples/web"
    click FileEx "https://github.com/AbanteAI/rawdog/tree/main/examples/simple"
    click RepoEx "https://github.com/AbanteAI/rawdog/tree/main/examples/repo"
    click DataEx "https://github.com/AbanteAI/rawdog/tree/main/examples/csv"
    click VisEx "https://github.com/AbanteAI/rawdog/tree/main/examples/graphs"
```
