Cluely Documentation

repository·master·Indexed 20 days ago

https://github.com/prat011/free-cluely

An invisible desktop assistant for real-time insights during meetings and interviews. Cluely uses an Electron-based transparent overlay and AI providers like Google Gemini or local Ollama models to analyze screenshots and audio. Features include global hotkeys for window control and screenshot capture, an Electron bridge API for window and audio management, and a React-based renderer.

Tokens
3.1K
Snippets
10
Records
21
Agent score
81%

What's inside Cluely

  1. How Cluely's technical architecture works

    master

    The Cluely architecture relies on three main technical pillars to provide real-time AI assistance:

    1. Overlay UI: An Electron-based transparent window that stays on top of all other applications.
    2. Data Capture:
      • Clipboard Monitoring: Continuously listening for clipboard changes to trigger AI processing.
      • Screen Capture & OCR: Using native modules (like node-ffi or robotjs) to capture screen areas and libraries like Tesseract.js to perform Optical Character Recognition (OCR) on the captured images.
    3. Backend Communication: Sending captured data (text, screenshots, or clipboard content) to an AI backend (such as OpenAI) via WebSockets or HTTP requests to receive processed suggestions.
  2. Build the renderer for production

    master
    Use npm run build to create a production-ready version of the app in the build folder. This command bundles React in production mode and optimizes the build for performance by minifying files and adding hashes to filenames for deployment.
    npm run build
  3. Eject from Create React App configuration

    master

    If you need full control over the build toolchain (webpack, Babel, ESLint, etc.), you can run npm run eject.

    Warning: This is a one-way operation. Once you eject, you cannot go back.

    Ejecting removes the single build dependency and copies all configuration files and transitive dependencies directly into your project. While all other commands will still work, they will point to the newly copied scripts, and you will be responsible for managing the configuration.

    npm run eject
  4. Install and run Cluely

    master

    Follow these steps to set up Cluely on your local machine.

    1. Prerequisites

    2. Installation

    Clone the repository and install dependencies:

    git clone [repository-url]
    cd free-cluely
    
    # For normal installation:
    npm install

    Note on Sharp/Python errors: If you encounter build errors related to sharp or Python, use this specific command instead:

    SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --ignore-scripts
    npm rebuild sharp

    3. Configuration

    Create a .env file in the root directory and configure your chosen provider.

    For Gemini (Cloud AI):

    GEMINI_API_KEY=your_api_key_here

    For Ollama (Local/Private AI):

    USE_OLLAMA=true
    OLLAMA_MODEL=llama3.2
    OLLAMA_URL=http://localhost:11434

    4. Running the App

    Development Mode (Recommended): Starts the Vite dev server on port 5180 and launches the Electron app.

    npm start

    Production Build: Creates a built app in the release folder.

    npm run dist
    git clone [repository-url]
    cd free-cluely
    npm install
    npm start
  5. Create a transparent, always-on-top Electron overlay

    master

    To build an invisible or overlay-style application similar to Cluely, use Electron's BrowserWindow configuration. Setting transparent: true allows the window background to be invisible, showing only the rendered content. Setting alwaysOnTop: true ensures the window remains visible above all other applications. Other useful flags for this pattern include frame: false to remove window decorations, skipTaskbar: true to hide the app from the taskbar, and resizable: false to prevent user resizing.

    const { BrowserWindow } = require('electron');
    
    const win = new BrowserWindow({
      width: 800,
      height: 600,
      transparent: true,
      frame: false,
      alwaysOnTop: true,
      skipTaskbar: true,
      resizable: false,
      fullscreen: false,
      webPreferences: {
        nodeIntegration: true,
        contextIsolation: false,
      }
    });
    win.loadURL('file://' + __dirname + '/index.html');
  6. Configure AI Providers: Gemini vs Ollama

    master

    Cluely supports two primary AI provider modes via environment variables in a .env file.

    Google Gemini (Cloud-based)

    Best for speed and accuracy for complex tasks. Requires an internet connection and an API key.

    • Key: GEMINI_API_KEY

    Ollama (Local/Private)

    Recommended for privacy. Data never leaves your computer and it works offline. Requires Ollama to be installed and running (ollama serve).

    • USE_OLLAMA: Set to true.
    • OLLAMA_MODEL: The model name to use (e.g., llama3.2, codellama, mistral).
    • OLLAMA_URL: The local endpoint (default: http://localhost:11434).
    # Gemini Configuration
    GEMINI_API_KEY=your_api_key_here
    
    # Ollama Configuration
    USE_OLLAMA=true
    OLLAMA_MODEL=llama3.2
    OLLAMA_URL=http://localhost:11434
  7. How to quit Cluely

    master

    The 'X' button on the window currently does not work. To close the application, use:

    • Cmd + Q (macOS)
    • Ctrl + Q (Windows/Linux)
    • Or terminate the Interview Coder process via Activity Monitor (macOS) or Task Manager (Windows).
  8. Troubleshoot Cluely startup and build issues

    master

    Port 5180 Conflicts

    If the app fails to start, ensure port 5180 is not in use:

    # Find processes using port 5180
    lsof -i :5180
    
    # Kill the process (replace [PID] with the actual ID)
    kill [PID]

    Sharp/Python Build Errors

    If you see gyp ERR! find Python or Sharp errors, use prebuilt binaries:

    rm -rf node_modules package-lock.json
    SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --ignore-scripts
    npm rebuild sharp

    Alternatively, install Python via brew install python3 (macOS).

    General Reset

    If installation fails, try a clean slate:

    1. Delete node_modules folder.
    2. Delete package-lock.json.
    3. Run npm install.
    4. Run npm start.
  9. Cluely Keyboard Shortcuts

    master

    Use these global hotkeys to control the Cluely interface:

    • Cmd/Ctrl + B: Toggle window visibility (hide/show).
    • Cmd/Ctrl + H: Take a screenshot for AI analysis.
    • Cmd/Enter: Get a solution from the AI.
    • Cmd/Ctrl + Arrow Keys: Move the window position.
  10. Use the Electron bridge API via window.electronAPI

    master

    The ElectronAPI interface is exposed to the renderer process via window.electronAPI. It provides methods for controlling the application window, managing screenshots, handling audio analysis, and subscribing to application lifecycle and processing events.

    Screenshot Management

    • takeScreenshot(): Triggers a new screenshot capture.
    • getScreenshots(): Returns an array of objects containing the path and a preview string for existing screenshots.
    • deleteScreenshot(path: string): Deletes a screenshot at the specified path. Returns { success: boolean; error?: string }.

    Window Control

    • updateContentDimensions({ width: number, height: number }): Updates the dimensions of the content area.
    • moveWindowLeft(), moveWindowRight(), moveWindowUp(), moveWindowDown(): Moves the application window in the specified direction.
    • quitApp(): Closes the application.

    Audio Analysis

    • analyzeAudioFromBase64(data: string, mimeType: string): Processes audio data provided as a Base64 string. Returns { text: string; timestamp: number }.
    • analyzeAudioFile(path: string): Processes an audio file at the given path. Returns { text: string; timestamp: number }.

    Event Subscriptions

    Most event listeners follow the pattern on[EventName](callback): () => void, where the returned function is used to unsubscribe from the event.

    Common events include:

    • onScreenshotTaken: Fired when a new screenshot is captured.
    • onSolutionsReady: Fired when AI solutions are ready.
    • onSolutionStart, onSolutionSuccess, onSolutionError: Lifecycle events for the solution generation process.
    • onDebugStart, onDebugSuccess, onDebugError: Lifecycle events for the debugging process.
    • onProblemExtracted: Fired when a problem has been successfully extracted from the context.
    • onUnauthorized: Fired when an authentication or authorization error occurs.