# deepgram/vibe_coder architecture

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

- Interactive diagram: https://gitdiagram.com/deepgram/vibe_coder
- Repository: https://github.com/deepgram/vibe_coder

## Overview

##### Project Type and Purpose
- Vibe-Coder is a VS Code extension that combines voice-controlled coding in “Vibe Mode” and “Code Mode” with integrations to external services (such as Deepgram and OpenAI) and native audio modules.
- Its goal is to let users navigate and code in VS Code via natural voice commands, incorporating both AI voice agent interactions and dictation functionalities.

##### File Structure
- Top-level directories and files:
- The src directory holds the main source code with the extension’s entry point (extension.ts) and multiple service modules. These services include:
– Agent Panel Service (managing voice-based UI interactions)
– Command Registry Service (for registering VS Code commands)
– Conversation Logger, Deepgram, Dictation, LLM, Mode Manager, Prompt Management, Spec Generator, and Voice Agent Services
– Web-Audio and Workspace Services
- The src/webview directory contains webview providers (for audio routing and microphone permissions), indicating a layered UI component that runs within VS Code.
- The prebuilds directory houses platform-specific pre-built native modules for handling microphone interactions, indicating active native bindings.
- Utility scripts (under src/utils) and helper scripts (in scripts) confirm the use of native module wrappers and custom prebuild preparation.
- Configuration files (package.json, tsconfig.json, esbuild.js) and CI/CD configurations (inside .github/workflows) reveal build and deployment processes.

##### Main Components
a. VS Code Extension Core
- Entry point (src/extension.ts) which loads the various services.
- Initialization of components as the extension activates.
b. Services Layer
- That these modules manage different aspects of voice interactions, API communication, command execution, and logging.
c. Webview Components
- Webview providers (audio-webview-provider and mic-permission-webview-provider) to illustrate the UI elements for user interaction with microphone settings and audio visualizations.
d. Native Modules and Prebuilds
- That these modules are platform-specific (macOS, Windows, Linux) and highlight their dependencies (SoX, ALSA utilities) as per the README.
e. External Services and APIs
f. Configuration & Build Tools
- A section for build scripts, CI/CD workflows (.github/workflows) and dependency management (package.json) to capture the development lifecycle.

- From the user initiating a voice command through VS Code command palette to the extension’s activation.
- From the extension core to the various services (indicate service dependencies if one service calls another).
- From services to external APIs (Deepgram, OpenAI) and to the native module interface for audio capture.
- Between the webview components and the extension core for UI event handling.

##### Architectural Patterns and Design Principles
- Modular design—each service is a discrete component responsible for distinct functionality.
- Multi-platform support achieved via prebuilt binaries and native module wrappers.
- How the extension decouples the UI (webview) from backend logic.
- Integration points for external APIs (Deepgram, OpenAI) and how configuration (via VS Code settings for microphone, etc.) alters behavior.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User("User(VoiceCommand)"):::start
    ExtensionCore("VS Code Extension Core"):::core

    subgraph "Services Layer"
        AgentPanel("Agent Panel Service"):::service
        CommandRegistry("Command Registry Service"):::service
        ConversationLogger("Conversation Logger Service"):::service
        DeepgramService("Deepgram Service"):::service
        DictationService("Dictation Service"):::service
        LLMService("LLM Service"):::service
        ModeManager("Mode Manager Service"):::service
        PromptManagement("Prompt Management Service"):::service
        SpecGenerator("Spec Generator Service"):::service
        VoiceAgent("Voice Agent Service"):::service
        WebAudio("Web-Audio Service"):::service
        Workspace("Workspace Service"):::service
    end

    subgraph "Webview Components"
        AudioWebview("Audio Visualization Provider"):::webview
        MicPermission("Mic Permissions Provider"):::webview
    end

    subgraph "Native Module Interface"
        BinaryLoader("Binary Loader"):::native
        NativeWrapper("Native Module Wrapper"):::native
        PlatformNative("Platform-Specific Native Modules"):::native
    end

    subgraph "External Services/APIs"
        DeepgramAPI("Deepgram API"):::external
        OpenAIAPI("OpenAI API"):::external
        SoX_ALSA("SoX/ALSA Utilities"):::external
    end

    subgraph "Build & Configuration"
        PackageJSON("Package Configurations"):::build
        CICD("CI/CD Workflows"):::build
        PrebuildScripts("Native Module Prep Scripts"):::build
    end

    %% Relationships
    User -->|"initiates"| ExtensionCore

    %% Extension core to services
    ExtensionCore -->|"loads"| AgentPanel
    ExtensionCore -->|"loads"| CommandRegistry
    ExtensionCore -->|"loads"| ConversationLogger
    ExtensionCore -->|"loads"| DeepgramService
    ExtensionCore -->|"loads"| DictationService
    ExtensionCore -->|"loads"| LLMService
    ExtensionCore -->|"loads"| ModeManager
    ExtensionCore -->|"loads"| PromptManagement
    ExtensionCore -->|"loads"| SpecGenerator
    ExtensionCore -->|"loads"| VoiceAgent
    ExtensionCore -->|"loads"| WebAudio
    ExtensionCore -->|"loads"| Workspace

    %% Extension core to webview components
    ExtensionCore -->|"triggers UI"| AudioWebview
    ExtensionCore -->|"triggers UI"| MicPermission

    %% Services utilizing native modules (audio capture)
    VoiceAgent -->|"captures audio"| BinaryLoader
    WebAudio -->|"processes audio"| BinaryLoader

    %% Native module interface chain
    BinaryLoader -->|"loads"| NativeWrapper
    NativeWrapper -->|"interfaces with"| PlatformNative
    PlatformNative -->|"depends on"| SoX_ALSA

    %% Services to External APIs
    DeepgramService -->|"transcribes"| DeepgramAPI
    DictationService -->|"sends audio"| DeepgramAPI
    LLMService -->|"queries"| OpenAIAPI

    %% Build & Configuration relation (development time)
    ExtensionCore ---|"built with"| PackageJSON
    PackageJSON --- CICD
    PackageJSON --- PrebuildScripts

    %% Click Events
    click ExtensionCore "https://github.com/deepgram/vibe_coder/blob/main/src/extension.ts"
    click AgentPanel "https://github.com/deepgram/vibe_coder/blob/main/src/services/agent-panel.ts"
    click CommandRegistry "https://github.com/deepgram/vibe_coder/blob/main/src/services/command-registry-service.ts"
    click ConversationLogger "https://github.com/deepgram/vibe_coder/blob/main/src/services/conversation-logger-service.ts"
    click DeepgramService "https://github.com/deepgram/vibe_coder/blob/main/src/services/deepgram-service.ts"
    click DictationService "https://github.com/deepgram/vibe_coder/blob/main/src/services/dictation-service.ts"
    click LLMService "https://github.com/deepgram/vibe_coder/blob/main/src/services/llm-service.ts"
    click ModeManager "https://github.com/deepgram/vibe_coder/blob/main/src/services/mode-manager-service.ts"
    click PromptManagement "https://github.com/deepgram/vibe_coder/blob/main/src/services/prompt-management-service.ts"
    click SpecGenerator "https://github.com/deepgram/vibe_coder/blob/main/src/services/spec-generator-service.ts"
    click VoiceAgent "https://github.com/deepgram/vibe_coder/blob/main/src/services/voice-agent-service.ts"
    click WebAudio "https://github.com/deepgram/vibe_coder/blob/main/src/services/web-audio-service.ts"
    click Workspace "https://github.com/deepgram/vibe_coder/blob/main/src/services/workspace-service.ts"
    click AudioWebview "https://github.com/deepgram/vibe_coder/blob/main/src/webview/audio-webview-provider.ts"
    click MicPermission "https://github.com/deepgram/vibe_coder/blob/main/src/webview/mic-permission-webview-provider.ts"
    click BinaryLoader "https://github.com/deepgram/vibe_coder/blob/main/src/utils/binary-loader.ts"
    click NativeWrapper "https://github.com/deepgram/vibe_coder/blob/main/src/utils/native-module-wrapper.ts"
    click PlatformNative "https://github.com/deepgram/vibe_coder/tree/main/prebuilds/darwin-arm64"
    click PackageJSON "https://github.com/deepgram/vibe_coder/blob/main/package.json"
    click CICD "https://github.com/deepgram/vibe_coder/tree/main/.github/workflows"
    click PrebuildScripts "https://github.com/deepgram/vibe_coder/blob/main/scripts/create-prebuild.js"

    %% Styles
    classDef core fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef service fill:#AED6F1,stroke:#2E86C1,stroke-width:2px;
    classDef webview fill:#A9DFBF,stroke:#28B463,stroke-width:2px;
    classDef native fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef external fill:#F9E79F,stroke:#D4AC0D,stroke-width:2px;
    classDef build fill:#D7BDE2,stroke:#8E44AD,stroke-width:2px;
    classDef start fill:#D5DBDB,stroke:#5D6D7E,stroke-width:2px;
```
