04. Terminal UI and Session State

This Is Why the Tree Looks Large

The big size is not only because of tool logic. There is a large amount of UI and session infrastructure: components/, ink/, screens/, history.ts, dialogLaunchers.tsx, interactiveHelpers.tsx, plus memory, compact, and notification services.

Terminal UI as Product Surface

Ink and the custom ink/ support files suggest the team treated the terminal like a full UI runtime. That gives the product progressive rendering, focused input handling, selection behavior, layout utilities, notifications, highlighted diffs, and structured message presentation.

Session Design

The presence of history, compacting, session memory, team memory sync, away summary, and task flows suggests a long-session product that expects real work, not single-turn chat. The engineering problem becomes: how do you keep a long-running CLI usable, recoverable, and cheap enough to operate?

Main Skill Gain

  • How to build a terminal-native UI with product-grade feel.
  • How to separate interaction helpers, dialogs, state, and rendering primitives.
  • How to treat long-running session management as a first-class concern.

Source Navigation

Recommended Source Files

  • source/components/PromptInput
  • source/components/messages
  • source/state/AppStateStore.ts
  • source/history.ts
  • source/ink/components/App.tsx

Next Files to Read

  • source/components/TrustDialog/TrustDialog.tsx
  • source/services/SessionMemory/sessionMemory.ts
  • source/services/compact/autoCompact.ts