# rinadelph/cursorplus architecture

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

- Interactive diagram: https://gitdiagram.com/rinadelph/cursorplus
- Repository: https://github.com/rinadelph/cursorplus

## Overview

##### Main components
- Documentation & Guides – Multiple markdown files (README.md, SCRIPT_README.md, claude_complete_modification_guide.md, claude_hacked_instructions.md, claude_token_limits.md, context.md) provide instructions and context for modifications.
- Python Automation Tool – The hack_claude.py script automates the process of locating the appropriate Cursor client files (e.g., workbench.desktop.main.js) and applying the modifications.
- JavaScript Customization – The workbench-pretty.js file (and referenced modifications within the README, like changes to getEffectiveTokenLimit, getModeThinkingLevel, and UI styling functions) contains the custom code used to patch the client application.
- Cursor Client Files – Although not directly in the file tree, the README instructs users to modify files like workbench.desktop.main.js present in the Cursor application. These represent the target files where modifications will be applied.

##### Relationships and interactions
- The Python script (hack_claude.py) acts as an orchestrator, automating the backup of original files, locating the target JavaScript files, applying the changes, and potentially displaying a diff before changes are written.
- The custom JavaScript (workbench-pretty.js) contains modified functions intended to override default behaviors in the client's main JavaScript file (e.g., to set a 200K token limit, always set thinking level to “high”, and adjust UI styling).
- The documentation (README and additional markdown guides) provides detailed instruction and context for using both the Python tool and understanding the JavaScript modifications.

##### Architectural patterns/principles
- Client-Side Patching – The approach here shows a pattern where a “hack” or patch layer is introduced to modify the behavior of an existing application without server-side changes.
- Backup and Rollback – The Python automation tool creates backups before modifying files, highlighting a safety principle often used in patch management.
- Layered Customization – There is a separation between documentation, automation logic (Python), and UI/control logic (JavaScript). This distinction helps in maintaining clarity during modifications.

##### Essential elements
- From Documentation to Automation Tool (indicating “instructions for modification”).
- From Automation Tool to Client Files (indicating “backup, locate, and patch”).

##### Detailed step-by-step advice
c. Optionally, add a “User Verification” step showing command line output or diff verification.
d. Use annotations to mention important architectural choices such as “client-side patching”, “ensured backup pre-modification”, and “inline changes to critical functions”.
e. Patching of three target functionality areas:
- getEffectiveTokenLimit (token handling)
- getModeThinkingLevel (thinking level control)
- UI Styling modifications (model display adjustments)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Documentation & Guides"
        doc1["README.md"]:::doc_color
        doc2["SCRIPT_README.md"]:::doc_color
        doc3["claude_complete_modification_guide.md"]:::doc_color
        doc4["claude_hacked_instructions.md"]:::doc_color
        doc5["claude_token_limits.md"]:::doc_color
        doc6["context.md"]:::doc_color
    end

    auto["Automation Tool (hack_claude.py)"]:::auto_color

    subgraph "Cursor Client Application"
        cli1["Target JS File: workbench.desktop.main.js"]:::client_color
        cli2["Custom Patch: workbench-pretty.js"]:::client_color
    end

    doc6 -->|"Provides_modification_instructions"| auto
    auto -->|"Backs_up,locates,and_patches_target_JS_files"| cli1
    auto -->|"Applies_custom_patches"| cli2

    click doc1 "https://github.com/rinadelph/cursorplus/blob/main/README.md"
    click doc2 "https://github.com/rinadelph/cursorplus/blob/main/SCRIPT_README.md"
    click doc3 "https://github.com/rinadelph/cursorplus/blob/main/claude_complete_modification_guide.md"
    click doc4 "https://github.com/rinadelph/cursorplus/blob/main/claude_hacked_instructions.md"
    click doc5 "https://github.com/rinadelph/cursorplus/blob/main/claude_token_limits.md"
    click doc6 "https://github.com/rinadelph/cursorplus/blob/main/context.md"
    click auto "https://github.com/rinadelph/cursorplus/blob/main/hack_claude.py"
    click cli2 "https://github.com/rinadelph/cursorplus/blob/main/workbench-pretty.js"

    classDef doc_color fill:#a1c9f4,stroke:#333,stroke-width:2px;
    classDef auto_color fill:#b8e0a4,stroke:#333,stroke-width:2px;
    classDef client_color fill:#fff3a0,stroke:#333,stroke-width:2px;
```
