# greatscottymac/roo-code-memory-bank architecture

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

- Interactive diagram: https://gitdiagram.com/greatscottymac/roo-code-memory-bank
- Repository: https://github.com/greatscottymac/roo-code-memory-bank

## Overview

##### Project Type and Purpose
Roo Code Memory Bank is a **VS Code Extension** designed to enhance **AI-assisted development** by maintaining persistent project context across development sessions. Its primary purpose is to ensure that AI assistants have a deep and continuous understanding of the project, facilitating tasks such as system design, coding, debugging, testing, and information retrieval.

##### File Structure Analysis
- **Top-Level Directories and Files:**
- `.clinerules-architect`, `.clinerules-code`, `.clinerules-ask`, `.clinerules-debug`, `.clinerules-test`: Configuration files defining rules for different operational modes.
- `.roomodes`: Configuration file for custom mode settings.
- `memory-bank/`: Directory containing markdown files (`activeContext.md`, `productContext.md`, `progress.md`, `decisionLog.md`) that store persistent context information.
- `projectBrief.md`, `developer-primer.md`, `updates.md`, `README.md`, `LICENSE`, `.gitignore`: Documentation and configuration files.

- **Architectural Patterns:**
- **Modular Design:** Separate `.clinerules-*` files indicate a modular approach, allowing distinct configurations for different modes (Architect, Code, Ask, Debug, Test).
- **Centralized Memory Bank:** The `memory-bank/` directory serves as the core repository for project context, decisions, and progress, suggesting a central hub for information storage and retrieval.
- **Integration with VS Code:** Presence of VS Code extension badges and integration files implies tight coupling with the VS Code environment.

##### README Insights
- **Key Components Identified:**
- **Memory Bank:** Central storage for project context.
- **Mode Rules:** YAML-based configurations dictating behavior in different modes.
- **VS Code Integration:** Ensures seamless user experience within the editor.
- **Real-time Updates:** Continuous synchronization of context to keep information up-to-date.

- **Architectural Overview:**
- Detailed sections on each mode (Architect, Code, Ask, Debug, Test) with their specific capabilities and interactions with the Memory Bank.

##### a. Identify Main Components
- **VS Code Extension Interface**
- **Memory Bank Module**
- `activeContext.md`
- `productContext.md`
- `progress.md`
- `decisionLog.md`
- **Mode Configuration Modules**
- Architect Mode
- Code Mode
- Ask Mode
- Debug Mode
- Test Mode
- **Real-time Update System**
- Event Monitor
- Continuous Sync
- Auto-save Mechanism
- Event Tracking

##### b. Determine Relationships and Interactions
- **VS Code Extension Interface** interacts directly with all mode modules and the Memory Bank.
- **Mode Configuration Modules** (Architect, Code, Ask, Debug, Test) communicate with the **Memory Bank Module** to read/write context, decisions, and progress.
- **Real-time Update System** ensures continuous synchronization between the Memory Bank and the active modes, handling events and auto-saving states.

##### c. Highlight Architectural Patterns and Design Principles
- **Centralized Repository Pattern:** Memory Bank acts as a single source of truth for project context.
- **Modular Architecture:** Separation of concerns through distinct mode configurations allows for scalability and maintainability.
- **Real-time Synchronization:** Ensures that all components remain up-to-date, enhancing reliability and user experience.

##### d. Include Relevant Technologies and Frameworks
- **VS Code Extension APIs:** For integration with the editor.
- **YAML:** Used in mode rule configuration files (`.clinerules-*`, `.roomodes`).
- **Markdown:** Utilized for documenting context and project details within the Memory Bank.

##### Detailed Architectural Elements
- **All Mode Configurations:** Each mode (Architect, Code, Ask, Debug, Test) should be a separate component with its specific interactions.
- **Memory Bank Sub-components:** Display individual markdown files as part of the Memory Bank to show detailed context storage.
- **Real-time Synchronization Processes:** Illustrate how event monitoring and continuous sync interact with the Memory Bank and mode modules.
- **Integration Points:** Clearly show how the VS Code extension interacts with other system components.

##### Final Recommendations
- **Include Interaction Flows:** Represent how user actions in VS Code trigger mode-specific operations and how these operations interact with the Memory Bank.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Global entities
    VSCode["VS Code Extension Interface"]:::extension
    MemoryBank["Memory Bank Module"]:::data_store
    RealTimeUpdate["Real-time Update System"]:::process

    %% Mode Configuration Modules
    Architect["Architect Mode"]:::module
    Code["Code Mode"]:::module
    Ask["Ask Mode"]:::module
    Debug["Debug Mode"]:::module
    Test["Test Mode"]:::module
    CustomMode["Custom Mode Settings"]:::module

    %% Memory Bank sub-components
    subgraph "Memory Bank"
        ActiveContext["activeContext.md"]:::data_file
        ProductContext["productContext.md"]:::data_file
        Progress["progress.md"]:::data_file
        DecisionLog["decisionLog.md"]:::data_file
    end

    %% Real-time Update sub-components
    subgraph "Real-time Update System"
        EventMonitor["Event Monitor"]:::process_component
        ContinuousSync["Continuous Sync"]:::process_component
        AutoSave["Auto-save Mechanism"]:::process_component
        EventTracking["Event Tracking"]:::process_component
    end

    %% Connections
    VSCode --> Architect
    VSCode --> Code
    VSCode --> Ask
    VSCode --> Debug
    VSCode --> Test
    VSCode --> CustomMode
    VSCode --> MemoryBank

    Architect --> MemoryBank
    Code --> MemoryBank
    Ask --> MemoryBank
    Debug --> MemoryBank
    Test --> MemoryBank

    RealTimeUpdate --> MemoryBank
    RealTimeUpdate --> Architect
    RealTimeUpdate --> Code
    RealTimeUpdate --> Ask
    RealTimeUpdate --> Debug
    RealTimeUpdate --> Test

    %% Click Events
    click MemoryBank "https://github.com/greatscottymac/roo-code-memory-bank/tree/main/memory-bank/"
    click Architect "https://github.com/greatscottymac/roo-code-memory-bank/blob/main/.clinerules-architect"
    click Code "https://github.com/greatscottymac/roo-code-memory-bank/blob/main/.clinerules-code"
    click Ask "https://github.com/greatscottymac/roo-code-memory-bank/blob/main/.clinerules-ask"
    click Debug "https://github.com/greatscottymac/roo-code-memory-bank/blob/main/.clinerules-debug"
    click Test "https://github.com/greatscottymac/roo-code-memory-bank/blob/main/.clinerules-test"
    click CustomMode "https://github.com/greatscottymac/roo-code-memory-bank/blob/main/.roomodes"

    %% Styles
    classDef extension fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef data_store fill:#90EE90,stroke:#000,stroke-width:1px
    classDef module fill:#FFD700,stroke:#000,stroke-width:1px
    classDef process fill:#FFA500,stroke:#000,stroke-width:1px
    classDef data_file fill:#F0E68C,stroke:#000,stroke-width:1px
    classDef process_component fill:#FFB6C1,stroke:#000,stroke-width:1px
```
