# mins317x/roo-code architecture

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

- Interactive diagram: https://gitdiagram.com/mins317x/roo-code
- Repository: https://github.com/mins317x/roo-code

## Overview

##### Main Components

- VS Code Extension Core – This is primarily in the “src” directory. It includes the activation logic (src/activate), API layer (src/api), core modules (src/core: diffing, prompts, modes, configuration, assistant message handling), integrations (editor, terminal, workspace, themes), and shared utilities (src/shared, src/utils).
- Webview UI – Found in the “webview-ui” directory, this is a React/Vite-based frontend that powers the interactive UI (chat interface, settings, history, etc.).
- Supporting Evaluators and Apps – The “evals” folder contains CLI and web apps that may run separate evaluations and test various aspects of Roo Code via its API.
- Packages & Libraries – Under “evals/packages” (like db, ipc, lib, types), these libraries provide shared functionality (database drivers, inter-process communication, schema definitions) that the extension core and other apps rely on.
- Integration with External APIs – The “api/providers” in src/api/providers include connectors to OpenAI, Gemini, Bedrock, and several custom providers. They expose a uniform interface to the rest of the system.
- Custom Modes and Tools – Modules that support configurable “modes” and “tools” (see src/core/prompts, src/core/tools) which allow the extension to adapt and extend its behavior.

##### Relationships and Interactions

- The VS Code extension backend (activation, API, core processing) interacts with the user’s workspace (reading/writing files, executing terminal processes) as well as external services (via API providers and MCP).
- The webview UI (in webview-ui) gets launched as a panel within VS Code, communicating with the core through IPC (inter-process communication channels provided by packages/ipc) and shared services.
- The custom modes and tools configuration (src/core/config, src/core/prompts) directs the assistant’s behavior and delegates tasks to specialized modules.
- Supporting libraries (in evals/packages) provide functionality to both the extension and complementary CLI/web applications.
- Testing and development – The presence of both “src/__tests__” and “e2e” directories indicates automated testing for both unit and integration levels.

##### Architectural Patterns and Design Principles

- Modular Design – The project is broken into clear modules (activation, API providers, configurations, integrations, a separate webview app) which allows for easy extension and customization.
- Separation of Concerns – UI (webview) is isolated from the extension’s backend logic. Core functionality is further divided between configuration, tool execution, and external API communication.
- Configuration and Extensibility – Custom Modes, Custom Instructions, and MCP provide designated extension points so that developers can easily add or modify behavior.
- Testability – The file tree shows a robust testing setup with both unit tests (in “__tests__” directories) and end-to-end tests (in e2e).

- The structure of the VS Code extension (activation, API, core logic, integrations, custom modes)
- The separate webview UI that communicates with the core extension
- Supporting modules (CLI tools, test suites, shared packages)
- External dependencies (AI APIs and custom models via MCP)
- The flow of data from user input, through processing in the extension, through execution of commands, and back to output in the UI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% VS Code Extension Core Subgraph
    subgraph "VS Code Extension Core"
        A["Activation Module"]:::backend
        B["API Layer"]:::backend
        C["Core Modules"]:::backend
        D["Shared Utilities"]:::backend
        E["Utilities"]:::backend
    end

    %% API Providers Subgraph
    subgraph "API Providers"
        F["API Providers (OpenAI, Gemini, Bedrock, etc.)"]:::integration
    end

    %% Custom Modes & Tools Subgraph
    subgraph "Custom Modes & Tools"
        G["Prompts Configuration"]:::custom
        H["Tool Integrations"]:::custom
    end

    %% Webview UI Layer Subgraph
    subgraph "Webview UI Layer"
        I["Webview UI (React/Vite)"]:::frontend
    end

    %% Supporting Evaluators & Apps Subgraph
    subgraph "Supporting Evaluators & Apps"
        J["CLI App"]:::evaluator
        K["Web Evaluator"]:::evaluator
    end

    %% Shared Packages & Libraries Subgraph
    subgraph "Shared Packages & Libraries"
        L["Packages & Libraries"]:::shared
    end

    %% External Services Node
    M["External AI Services"]:::external

    %% Connections
    I -->|"IPC"| A
    A -->|"triggers"| B
    B -->|"calls"| F
    F -->|"responds"| B
    B -->|"influences"| C
    C -->|"uses"| G
    C -->|"uses"| H
    C -->|"utilizes"| D
    C -->|"utilizes"| E
    C -->|"executes"| M
    D -->|"sharedWith"| L
    E -->|"sharedWith"| L
    I -->|"sendsDataTo"| J
    I -->|"sendsDataTo"| K
    J -->|"evaluatesWith"| L
    K -->|"evaluatesWith"| L

    %% Click Events
    click A "https://github.com/mins317x/roo-code/tree/main/src/activate"
    click B "https://github.com/mins317x/roo-code/tree/main/src/api"
    click C "https://github.com/mins317x/roo-code/tree/main/src/core"
    click D "https://github.com/mins317x/roo-code/tree/main/src/shared"
    click E "https://github.com/mins317x/roo-code/tree/main/src/utils"
    click F "https://github.com/mins317x/roo-code/tree/main/src/api/providers"
    click G "https://github.com/mins317x/roo-code/tree/main/src/core/prompts"
    click H "https://github.com/mins317x/roo-code/tree/main/src/core/tools"
    click I "https://github.com/mins317x/roo-code/tree/main/webview-ui"
    click J "https://github.com/mins317x/roo-code/tree/main/evals/apps/cli"
    click K "https://github.com/mins317x/roo-code/tree/main/evals/apps/web"
    click L "https://github.com/mins317x/roo-code/tree/main/evals/packages"

    %% Styles
    classDef backend fill:#fdd,stroke:#d33,stroke-width:2px;
    classDef integration fill:#dff,stroke:#3a3,stroke-width:2px;
    classDef custom fill:#ffd,stroke:#aa3,stroke-width:2px,stroke-dasharray: 5, 5;
    classDef frontend fill:#ddf,stroke:#339,stroke-width:2px;
    classDef evaluator fill:#dfd,stroke:#393,stroke-width:2px;
    classDef shared fill:#efe,stroke:#6a6,stroke-width:2px;
    classDef external fill:#eee,stroke:#666,stroke-width:2px,stroke-dasharray: 2,2;
```
