Skip to content

feat(cli): TUI block visual grammar, context statusline, and activity strip #1053

Closed

Description

@Astro-Han

Problem

The interactive TUI is hard to scan during agent work:

  • Tool cards are label-heavy and often two lines, so long turns waste vertical space.
  • Thinking chrome is mixed Chinese while structural labels elsewhere are English.
  • Message roles add noisy User / maka rows.
  • The status line only shows opaque remaining context when present (ctx 92k), not total window size or usage ratio — and remaining is often missing.
  • There is no bottom activity strip for the in-flight turn (Grok-style Working… + elapsed). Busy state today only affects the terminal title spinner.

Desired outcome

A locked, Grok-inspired but Maka-native transcript and chrome grammar that stays on the existing pi-tui terminal scrollback model (no alt-screen pager rewrite):

  1. Compact, single-line tool rows with status discs and English thinking chrome.
  2. Message chrome without speaker labels; spacing separates human-facing text from agent work.
  3. Status line shows ctx used/window pct% when facts exist.
  4. Activity strip above the editor shows per-turn progress: Working… 12s.

Locked visual contracts

Tools (collapsed always 1 line)

● Name  primary  ·  duration  ·  summary ›

Examples:

● Read  package.json  ·  0s  ·  3 lines ›
● Bash  $ npm test  ·  5s  ·  (31 lines) ok ›
● Bash  $ npm test  ·  running 12s ›
● Edit  src/cli.ts  ·  0s  ·  +12 −3 ›
  • Disc: muted ● = done (no done word); accent ● = running; red ● = error.
  • No diamond (◆) — not Grok brand language.
  • Duration: seconds only. Prefer integer seconds on the activity strip; tool-row duration also in s (no millisecond unit).
  • Live output and stop hints only when expanded (Ctrl+O). Collapse never adds a second live line (avoids height jitter).
  • Expanded header uses the same ● grammar; body indented.
  • Expand affordance: dim trailing › when expandable. Shortcuts taught in welcome/help only (not on every row).

Thinking

  • English only: Thinking… / Thinking › (no 思考, no per-row Ctrl+T teaching text).
  • No left glyph/prefix.
  • Body only when expanded (Ctrl+T).

Messages

  • User: ASCII > prefix + body — no User label.
  • Assistant: bare default text — no maka label.
  • Chosen for weak-terminal / native feel (no full-width user background block in v1).

Spacing

  • Thinking + tools: 0 blank lines between them (agent-work stack).
  • Vertical gap around user prompts and assistant prose (human-facing boundaries).

Statusline (session chrome)

Show context as used / window · percent, not remaining-only:

ctx 52k/200k 26%
  • Window from model metadata / connection override.
  • Used from latest usage: prefer window - contextRemaining when remaining exists; else last token_usage input/total.
  • Omit the whole ctx segment until enough facts exist.
  • Keep cost/cache/model/mode/cwd as today unless they must yield width.

Activity strip (per-turn chrome)

Sits between transcript and editor (not inside the statusline).

While a turn is running:

Working… 12s
  • English Working… (ellipsis character fine).
  • Elapsed in integer seconds only (12s, not 12.4s, not 1200ms).
  • No current-tool summary on this line (duplicates the tool stack above).
  • Idle: reserve one blank row so chrome height does not jump.
  • Cancel remains existing keys (Ctrl+C / Esc); no required [stop] chrome in v1.

Explicit non-goals

  • No ◆ diamond, no alt-screen / in-app pager rewrite, no multi-theme system.
  • No CLI i18n in this epic (desktop locale is feat(desktop): make UI language selection coherent and complete #1052; CLI is a separate concern).
  • No wholesale welcome / rewind Chinese → English cleanup required here (optional follow-up).
  • Activity strip does not re-list the current tool.

Delivery seams

  1. Semantic color slots in packages/cli tui-ansi (foundation; minimal behavior change).
  2. Tool + Thinking one-line grammar (compact + expanded headers).
  3. Message chrome + spacing (> user, bare assistant, gap policy).
  4. Statusline ctx used/window pct% wiring + render tests.
  5. Activity strip Working… Ns (integer seconds) + idle reserved row + layout chrome height.

Each seam should be independently reviewable and revertable.

Implementation notes (non-binding)

  • Primary surfaces: packages/cli/src/tui-ansi.ts, pi-transcript*.ts, pi-tui-layout.ts, pi-tui-runner.ts.
  • Layout today is transcript → editor → statusline; insert activity above the editor and include it in chromeRows.
  • busy / turnRunning already exist in the runner; title spinner can remain; activity strip is the in-viewport signal.
  • Prefer pure render helpers + unit tests for string contracts before broad runner tests.

Alternatives considered

  • Port Grok’s diamond + fullscreen pager — rejected (brand + architecture).
  • Remaining-only ctx — rejected (no total/ratio).
  • Always two-line tools for live tails — rejected (settle height jitter); expand for detail.
  • Activity line with tool summary / fractional seconds — rejected (duplicate + noise).

References

Activity

  1. Astro-Han commented on Jul 16, 2026

    @Astro-Han
    ContributorAuthor

    All five seams have landed on main:

    Seam PR Summary
    1 #1054 muted color slot + disc(tone) primitive
    2 #1056 One-line disc grammar for tool cards and thinking chrome
    3 #1058 > prefix for user messages, bare assistant text, stacked spacing
    4 #1059 Statusline ctx used/window pct%
    5 #1061 Activity strip Working… Ns + idle reserved row

    Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions