#16

Cortex — AI Coding Tool

April 17, 2026

ElectronReactNode.jsClaudeGemini CLIOpenAI Codex

Windows desktop GUI (Electron + React) that runs Claude, Gemini CLI, and OpenAI Codex side-by-side in one window. No API keys needed — uses official CLIs directly. Live token streaming, real-time git diff, persistent chat history per project, one-click open in VS Code or Cursor.

What is it?

A Windows desktop app (Electron + React) that runs Claude, Gemini CLI, and OpenAI Codex side-by-side in one window. No API key configuration — it uses the official CLI tools already installed on your machine. Live token streaming, real-time git diff as the AI edits your files, persistent chat history per project.

How it works

Electron main process spawns Claude CLI, Gemini CLI, and Codex CLI as child processes via Node.js child_process.spawn(). Stdout is piped through readline — each line emitted over IPC to the React renderer. The renderer appends tokens to the chat UI in real time. A git diff watcher monitors the working directory and sends file diffs over IPC as the AI makes changes.

Under the hood: Electron IPC

Electron has two worlds: the main process (full Node.js, OS access) and the renderer process (sandboxed browser JS, React). They communicate via IPC.

ipcMain.handle('chat:send', handler) registers a named channel in main. ipcRenderer.invoke('chat:send', message) calls it from the renderer and awaits the result as a promise.

For streaming tokens: main emits ipcMain.emit('token', data) as each readline line arrives from the CLI's stdout. The renderer listens with ipcRenderer.on('token', ...) and appends each token to the active chat bubble without waiting for the full response.

Spawning multiple AI CLIs

Each AI provider has a different streaming format. Claude outputs raw text lines. Gemini may output JSON events. Codex has its own format. Cortex normalizes all three into the same internal token stream before sending over IPC.

spawn('claude', ['--print'], { stdio: ['pipe', 'pipe', 'pipe'] }) — write user message to stdin, read response from stdout via readline. Multiple simultaneous conversations each have their own spawned process.

Real-time git diff

chokidar watches the working directory for file changes. On change: spawn git diff --unified=3, capture stdout, parse the unified diff format (lines starting with + are additions, - are deletions, @@ marks hunk boundaries). The parsed diff is sent over IPC to a diff pane in the React UI, updating in real time as the AI writes code.

This lets you watch the AI's edits as they happen — useful for reviewing changes before they accumulate and for catching unwanted modifications early.

Key takeaways

  • Electron IPC: main vs renderer process boundary, handle/invoke for request-response, on/emit for streams
  • child_process.spawn with piped stdio: readline streaming from CLI stdout
  • Unified diff format: parsing hunk headers, additions, deletions, context lines
  • Normalizing multiple CLI streaming formats into a single internal event stream
  • Electron packaging with electron-builder: NSIS installer for Windows, auto-update config
Try it live →Watch on YouTube →← all projects