Skip to content

GUI Hooks

refact-planner edited this page Jun 7, 2026 · 1 revision

GUI Hooks

The GUI relies on many narrow custom hooks to isolate subscriptions, actions, messaging, and IDE integration concerns.

Key hooks

Hook Purpose
useChatActions Provides chat-related actions and mutation helpers.
useChatSubscription Subscribes to a single chat’s updates.
useAllChatsSubscription Subscribes to updates across all chats.
useEnsureSubscriptionConnected Ensures a subscription stays connected.
useEventBusForApp Connects app-level event bus events.
useEventBusForIDE Connects IDE-related event bus events.
usePostMessage Sends postMessage traffic across frame / window boundaries.
useCheckpoints Exposes checkpoint-related state and actions.

Hook conventions

The codebase uses 70+ custom hooks, so the convention is to keep each hook narrowly focused on one job. That keeps behavior easier to reason about, avoids oversized abstractions, and makes reuse predictable.

Subscription and event patterns

Hooks in this area commonly wrap one of three concerns:

  • data subscription and connection management
  • event bus wiring for app or IDE boundaries
  • explicit user actions or messages

That separation helps keep chat UI components thin and keeps side effects localized to the hook layer.

See also: GUI Chat Flow, Context Compression

Clone this wiki locally