Comma Agents
@comma-agents/tui

TUI

Terminal-based user interface built with Ink (React for terminals) that connects to the daemon over WebSocket.

The @comma-agents/tui package provides a terminal-based user interface built with Ink (React for the terminal). It connects to the daemon over WebSocket to run and observe agent strategies.

Quick Start

# Start the daemon if needed and open the TUI
comma

# Auto-start with a strategy and initial input
comma --input "Build a calculator" --strategy build

# Custom daemon URL
comma --daemon-url ws://my-host:7422/ws

# Enable development tab
comma --dev

How It Works

  1. The TUI opens a WebSocket to the daemon at ws://localhost:7422/ws
  2. You select a strategy and enter a prompt
  3. The TUI sends prepare_run, then start_run, and receives streaming agent output, tool calls, thinking blocks, and status updates
  4. When the agent needs input or sandbox permission, the TUI prompts you inline
  5. You can cycle between Chat and Logs tabs, open the command palette with Ctrl+P, or load persisted sessions

Key Areas

SectionDescription
ArchitectureProvider tree, routing, data flow, keyboard shortcuts
WebSocketDaemon communication -- message types, typed helpers, commands and subscriptions
PagesRoute-level pages -- IntroPage, ChatPage, LogsPage
ComponentsInk component inventory -- input, chat, scrolling, overlays, layout
HooksCustom React hooks -- daemon, chat, logging, modal, mouse, breakpoint
ThemeTheming system -- tokens, defineTheme builder, built-in presets

Provider Tree

The app renders a nested tree of context providers:

MemoryRouter
  └─ UserConfigContextProvider   (persisted user config)
      └─ ThemeContextProvider     (active theme injection)
          └─ DaemonContextProvider   (WebSocket to daemon)
              └─ ChatSessionsContextProvider  (chat session state)
                  └─ ModalContextProvider     (modal stack)
                      └─ App

Each layer depends on the providers above it. Components consume state through hooks -- see the Hooks section for the full API.

Keyboard Shortcuts

KeyAction
Ctrl+CExit the application
Ctrl+RReset the current chat session
Ctrl+POpen the command palette
Alt+1Switch to Chat tab
Alt+2Switch to Logs tab
Meta+EnterSubmit input in the chat text area

On this page