How prat011/free-cluely works
1. This is an Electron desktop app with a React-based renderer. The architecture is split into three main layers: the Electron main process, a preload bridge, and the UI renderer. The main process owns OS-level capabilities; the renderer owns the visible app UI and user interaction.
2. The Electron side is centered in electron/. main.ts boots the desktop app, WindowHelper.ts manages window creation/behavior, shortcuts.ts registers global hotkeys, and ipcHandlers.ts connects renderer requests to privileged operations. This is where always-on-top, hide/show, movement, and screenshot-related desktop integration live.
3. preload.ts is the security boundary between browser UI and Node/Electron APIs. It exposes a controlled API surface to the renderer instead of letting the React app call system APIs directly. src/types/electron.d.ts and related types indicate that the renderer talks to Electron through typed IPC contracts.
4. The app’s core product flow is “capture context, send to AI, show answer.” ScreenshotHelper.ts handles screen capture, ProcessingHelper.ts appears to manage downstream processing, and LLMHelper.ts is the abstraction for calling an AI model provider. The README confirms two provider modes: Gemini in the cloud or Ollama locally.
5. The UI in src/ is organized around three functional screens: Queue, Solutions, and Debug under src/_pages/. This suggests a workflow where screenshots or captured items are queued, then transformed into AI responses, with a separate debugging/diagnostics view for runtime state.
6. Feature components mirror those screens. src/components/Queue/ contains queue presentation and commands for screenshot items, while src/components/Solutions/ contains solution/action controls. src/components/ui/ provides reusable primitives like dialogs, cards, toast notifications, and a model selector.
7. The application likely keeps screenshot items and AI outputs in renderer state, then sends commands back to Electron via IPC. A typical flow is: hotkey or UI action in the renderer requests a capture, Electron captures the screen, the image is processed or queued, the LLM helper generates a response, and the renderer displays the result in the queue/solutions views.
8. There is an audio-related type model in src/types/audio.ts, which indicates support for audio file or recording processing alongside screenshots. That implies the app is not only visual-assistance oriented; it also has a path for speech or recording analysis, likely routed through the same AI/processing pipeline.
9. The repo also contains worker-script/node/index.js, which looks like a separate Node worker entrypoint for heavier background work. That points to an architectural boundary for offloading processing away from the UI thread, likely to keep the desktop app responsive during analysis.
10. The renderer stack is React with TypeScript and Vite-style entry points in src/main.tsx, src/App.tsx, and src/index.css. Tailwind/PostCSS tooling is present at the repo root, so the UI is styled with utility-first CSS plus a small set of custom components.
11. Environment configuration matters to the architecture because it determines the AI backend. The app can run against Gemini using GEMINI_API_KEY, or against a local Ollama instance with USE_OLLAMA, OLLAMA_MODEL, and OLLAMA_URL. This choice affects whether requests leave the machine or stay local.
12. One important repo-level nuance: there is also a separate renderer/ directory containing its own React app scaffold. The primary desktop architecture, however, appears to be the root electron/ + src/ combination; the extra renderer tree looks like an auxiliary or legacy frontend package rather than the core runtime path.
13. From an architecture diagram perspective, the key boundaries are: OS integration in Electron main, trust boundary in preload/IPC, presentation and state in the renderer, and AI/provider access in LLMHelper plus the optional worker script. The main external dependencies are the local filesystem/screen APIs, global keyboard hooks, and either Gemini or Ollama as the model backend.
Main entry points: main.ts Main process · App.tsx App shell · preload.ts Preload bridge · ipcHandlers.ts IPC handlers
Components 20
Electron runtime
Desktop shell, system integration, and IPC boundary.
- Main process · Bootstraps the desktop app and owns privileged runtime behavior.
electron/main.ts - Window helper · Creates and controls the app window and visibility behavior.
electron/WindowHelper.ts - Hotkeys · Registers global keyboard shortcuts for capture and control flows.
electron/shortcuts.ts - IPC handlers · Handles renderer requests for privileged desktop operations.
electron/ipcHandlers.ts - Screen capture · Captures screenshots and related screen context.
electron/ScreenshotHelper.ts - Processor · Coordinates downstream processing after capture.
electron/ProcessingHelper.ts - LLM helper · Abstracts calls to Gemini or local Ollama backends.
electron/LLMHelper.ts - Preload bridge · Exposes a controlled API surface from Electron to the renderer.
electron/preload.ts
Renderer app
React UI and in-app state flow.
- App shell · Top-level renderer composition and screen wiring.
src/App.tsx - Queue view · Shows captured items waiting to be processed or reviewed.
src/_pages/Queue.tsx - Solutions view · Presents generated answers and follow-up actions.
src/_pages/Solutions.tsx - Debug view · Exposes runtime diagnostics and state inspection.
src/_pages/Debug.tsx - Queue widgets · Queue item rendering and capture-related commands.
src/components/Queue/ScreenshotQueue.tsx - Solution widgets · Solution presentation and action controls.
src/components/Solutions/SolutionCommands.tsx - Model selector · Lets the user choose the active AI provider/model.
src/components/ui/ModelSelector.tsx - Electron types · Type definitions for the renderer's Electron-facing API.
src/types/electron.d.ts - Audio types · Models audio file and recording processing data.
src/types/audio.ts
Background worker
Separate Node entrypoint for heavier processing.
- Worker entry · Separate Node runtime for heavier background processing.
worker-script/node/index.js
External services
Model backends the app can talk to.
- Gemini · Cloud AI backend used when configured.
- Ollama · Local AI backend used for on-device model inference.
Connections 20
- Main process → Window helper: creates window · Main process delegates window lifecycle and behavior.
- Main process → Hotkeys: registers · Main process installs global hotkeys at startup.
- Main process → IPC handlers: wires IPC · Main process connects renderer calls to privileged handlers.
- IPC handlers → Screen capture: capture · IPC requests can trigger screen capture operations.
- IPC handlers → Processor: process · Captured data is forwarded into the processing pipeline.
- Processor → LLM helper: analyzes · Processing delegates model calls to the LLM adapter.
- LLM helper → Gemini: provider · Cloud model path when Gemini is selected.
- LLM helper → Ollama: provider · Local model path when Ollama is selected.
- Main process → Preload bridge: exposes bridge · Preload runs alongside the main app as the renderer boundary.
- Preload bridge → Electron types: types · Typed contracts describe the exposed IPC surface.
- App shell → Queue view: shows · Renderer shell includes the queue workflow screen.
- App shell → Solutions view: shows · Renderer shell includes the solutions workflow screen.
- App shell → Debug view: shows · Renderer shell includes diagnostics and debug tooling.
- Queue view → Queue widgets: uses · Queue screen is built from queue-specific UI components.
- Solutions view → Solution widgets: uses · Solutions screen is built from solution-specific UI components.
- App shell → Model selector: configures · Shared UI controls manage provider/model selection.
- Queue widgets → Preload bridge: requests capture · Queue interactions call back into the Electron bridge.
- Solution widgets → Preload bridge: requests actions · Solution actions are executed through the Electron bridge.
- Queue widgets → Audio types: shares model · Queue domain can include audio or recording items.
- Worker entry → Processor: offloads work · Background worker represents a separate processing boundary.