Skip to main content

Advanced composition

Choose component families, project host data, and combine them into resilient terminal workflows.

Composition starts with projection, not layout. Decide what the host owns, project the smallest stable view model, then choose the component that expresses the user's job. Application patterns are proof of composition, not runtimes or domain frameworks.

Project before composing

  1. Keep provider objects, secrets, process handles, and persistence in the host.
  2. Project stable IDs, bounded labels, semantic status, and display-safe detail.
  3. Let components own local focus, selection, scrolling, and expansion.
  4. Translate typed outcomes into host policy and effects.

If a component needs a full domain object to paint one row, the boundary is too wide. If the host duplicates row focus or hit geometry, the boundary is too narrow.

Compose an agent conversation

User jobStart with
Browse a long conversationMessageThread
Paint incrementally arriving proseStreamingMarkdown
Cite one source in contextSourceCitation
Review a source collectionCitationList
Inspect or control a tool runToolCallCard
Assemble the complete workspaceAgent Workbench

The host owns provider messages, tool execution, permission policy, cancellation, and retry semantics. TermRock owns presentation state and returns requests. Do not encode one vendor's protocol in reusable thread or tool-card state.

Build a prompt composer

Choose tokens by editing behavior, not by visual resemblance.

ContentComponent
File, image, URL, or code attachmentAttachmentChip
Collapsed large pastePasteChip
Atomic inline file, symbol, agent, or tool referenceInlineMention
Filtered command completionSlashCommandMenu
Model choice with bounded metadataModelSelector
Safety or autonomy choiceAgentModeSelector
Context or token budgetContextMeter

Keep attachment and paste bodies in host storage. Project a safe label, kind, size, and status. Mentions behave as atomic draft tokens; completion replaces only its active trigger range so unrelated draft text survives.

Choose a data view by question

QuestionComponent family
Trend over ordered numeric samplesChart or Sparkline
One value against a rangeGauge
Distribution across bucketsHistogram
General hierarchyTree
Filesystem navigation and file actionsFileTree
Moderate dependency DAGDependencyGraph
Nested operation latencyTraceWaterfall
Structured issue listDiagnosticView
One issue anchored in sourceCodeFrame

Visualizations need a narrow-terminal fallback: summary values, a table, or a scrollable hierarchy. Dense or very large dependency graphs need a host-chosen filtered view rather than unreadable compression. Encode series, severity, and span status with labels or glyphs as well as color.

Promote to an application pattern deliberately

Use a pattern when several component families repeat as one workflow with shared responsive behavior. Keep the pattern host-neutral: it may coordinate component state and typed requests, but not fetch, execute, authorize, or persist.

Browse Application patterns for composition proofs. Read Interaction architecture before combining focus scopes or floating layers, and Customization before overriding individual component appearance.

On this page