Back to Homepage

Product Documentation

CodePulse Documentation

Intelligent Discord Rich Presence Stand-alone Electron utility AI-powered activity classification

CodePulse is a standalone Windows desktop utility designed to keep a user's Discord Rich Presence aligned with their current coding activity. Unlike standard editor-specific plugins, CodePulse operates as a local desktop process that watches local workspace activity and resolves those signals into intelligent, human-readable status updates without requiring direct editor integration.

Electron-based shell, tray persistence, frameless UI status window, and Discord IPC communication are core parts of the implementation.

01

Overview

The application operates on a three-layer mental model: Detection, Decision, and Delivery. It monitors file activity across configured workspace roots, resolves these signals to identify the active project and current work phase, and publishes the resulting state to both Discord and a dedicated local desktop interface.

This decoupled approach allows CodePulse to stay editor-agnostic. Whether you are working in VS Code, JetBrains, or a simple text editor, the utility provides a consistent presence layer based on the actual file system and git state of your project.

  • Detection layer: Gathers local signals by watching file activity and runtime contexts.
  • Decision layer: Resolves signals to pick the active project and derive an activity label.
  • Delivery layer: Updates Discord Rich Presence and the local desktop UI with current state.
  • Editor-agnostic: Operates independently of specific IDE or code editor plugins.
02

Watcher Core

The Watcher Core is the orchestration engine responsible for monitoring workspace roots and recording file activity. It uses recursive filesystem watchers to capture events and processes them through an absolute path resolution layer.

To ensure efficiency and prevent UI flickering, the watcher utilizes a debounced refresh cycle. Bursts of file events—common during builds or multi-file edits—are collapsed into single updates, reducing system overhead and ensuring the published presence remains stable and accurate.

  • Recursive filesystem watching for configured workspace roots.
  • 750ms debounced refresh cycle to handle high-frequency file events.
  • Automatic noise filtering for common build and internal directories.
  • Tracks ProjectActivity models with git root and branch awareness.
03

Phase Derivation

CodePulse derives human-readable activity labels, or "phases," using a layered heuristic approach. It first checks for git branch rules, mapping prefixes like `bugfix` or `feature` to specific work types. If no branch matches, it analyzes recent file paths to categorize the work.

This system allows the application to automatically distinguish between UI design (detecting .css or .tsx files), backend development (detecting API or service routes), and project documentation (detecting .md files), providing deep context to Discord friends and teammates.

  • Branch Rules: Maps git branch names to phases (e.g., bugfix, refactor, testing).
  • Path Rules: Maps directory and file extensions to categories (e.g., UI work, Backend).
  • Fallback Logic: Defaults to "Editing [filename]" or a general "In Progress" label.
  • Configurable templates for dynamic presence strings.
04

AI Labeling

For users wanting more precise activity descriptions, CodePulse includes an optional AI labeling layer. This integration uses a privacy-aware context summary rather than raw file contents to generate refined activity labels that reflect the actual intent of the work.

The AI layer captures the project name, branch, and changed file groups, hashing this context to reuse cached labels and minimize API calls. A normalization step ensures returned labels are concise and adhere to safety rules before being published to Discord.

  • Optional OpenAI integration (defaulting to gpt-5.4-mini).
  • Privacy-aware: Sends sanitized context summaries, not raw code.
  • Intelligent Caching: Uses SHA-1 context hashing to minimize throttled requests.
  • Safety filtering to discard repetitive or invalid generated labels.
05

Codex Integration

CodePulse features a unique native integration for the local Codex runtime. It can infer project context and user intent by parsing local process data and session artifacts stored in the `~/.codex` directory, such as recent prompts and session indexes.

This allows the application to capture the specific goals the user has discussed with their local AI assistant, providing even deeper insight into the current coding session. It bridges the gap between file system activity and the conceptual tasks being performed.

  • Bespoke support for local Codex runtime process detection.
  • Parses session artifacts from ~/.codex/sessions for context.
  • Extracts recent prompt text and session titles for presence detail.
  • Provides a unified view of development and local AI-assisted work.
06

Desktop UI & Tray

Instead of a headless service, CodePulse provides a compact desktop UI built with Electron. The main window features a frameless design with a live status view, displaying the active project, derived phase, session timer, and the connection status for both Discord and the AI service.

The utility is designed to stay out of the way, minimizing to the system tray for background operation. Users can access a tray menu to quickly check status, open the main window, or access settings for workspace and presence configuration.

  • Frameless status window with live data updates.
  • System tray integration for lightweight background operation.
  • Persistent session timer showing elapsed time per project.
  • Settings modal for workspace paths, templates, and AI configuration.
07

Control Flow

The runtime lifecycle is managed by an Electron shell that ensures a single-instance lock and handles configuration loading across multiple sources, including JSON settings and environment variables. On startup, the shell initializes the PresenceWatcherApp and begins publishing snapshots.

Discord communication is handled via Windows named pipes, allowing direct IPC with the local Discord client. The application manages the handshake, suppresses duplicate payloads, and includes automatic reconnection logic to ensure a stable presence throughout long coding sessions.

  • Single-instance locking and unified configuration management.
  • Direct Discord IPC via Windows named pipes (\\\\?\\pipe\\discord-ipc-0).
  • Automatic session resetting based on project or Codex context shifts.
  • Builds and publishes WatcherSnapshot payloads for UI and Presence layers.
08

Technical Stack

CodePulse is built on a modern JavaScript stack, utilizing Electron for the desktop environment and TypeScript for type-safe logic across the watcher and UI layers. The project uses Vite for development and is packaged as a portable Windows executable.

The architecture splits logic between a main process (watcher orchestration and Discord IPC) and a renderer process (UI display), ensuring that the background watching activity remains isolated from the frontend interface for maximum performance.

  • Framework: Electron with Node.js and TypeScript.
  • Frontend: HTML/CSS/JS with Vite and a dedicated renderer shell.
  • Communication: Discord IPC (Named Pipes) and Electron contextBridge.
  • Packaging: Electron Builder for Windows portable executables.