Plan: one hub for what waits, runs and was decided - the pending screen first, then the inline surfaces trimmed
Closes: one issue per unit, filed at approval and named here by erratum before the first branch is cut: the pending screen and completion (U1), the hub (U2), the inline trim (U3). Relates to: #341 (the pending pane), #485 (the whole action), #346 (the pending widget), #353, #446 (monitors), #530 (monitor_list). Branches: feat/pending-screen, feat/session-hub, feat/inline-trim, in that order. Status: Done (2026-10-29) — the pending screen (#544), the hub (#545) and the inline trim (#546) shipped; the upstream widget setting waits on #548
Erratum (2026-10-29): the units close #544 (U1), #545 (U2) and #546 (U3).
Erratum (2026-10-29): in U1 the detail shows every step’s action, then its reason, since a row cuts both to the width; the screen’s title takes the widget header’s "reply in the prompt box" hint; the 10,000-line check counts wraps rather than timing them; the completion’s wiring is tested in act-on-queued.test.ts (command-wiring.test.ts tests the ask tool), through an exported registerPendingControls.
Erratum (2026-10-29): in U2 the helpers come from a history of their own (helper-runs.ts), since the subagent wiring’s maps drop a finished spawn, and a running helper’s spend from a read-only runningChildren on the ledger. The facts are asked when the hub opens (gadhs-hub:ask, answered synchronously) rather than pushed on change, because pi-remote has no single place its facts change; pi-ssh answers from extension.ts with its status line and forwards, pi-remote from index.ts. The decisions ring is decision-ring.ts, cleared at session start. A run’s end also clears the dialog guard. The layout and wiring are in hub-views.ts and hub-wiring.ts beside hub-pane.ts, and the tests define their own forbiddenRegistry (tool-surfaces.test.ts does not exist).
Erratum (2026-10-29): in U3 the status line already named the helpers working and their spend, so only the N monitors segment is new; the collapsed event is drawn by monitor-render.ts. The upstream request for a widget setting is drafted in #548, since posting it needs GitHub access.
Why
The operator’s observation (2026-10-29): each overlay is manageable alone, but they stack in the same few lines, and the detail that would help has nowhere to live. The inventory bears it out.
Above the editor today: pi’s footer; our status line (mode-controller.ts refreshStatus, status.ts renderStatus: mode, "N waiting on you", gate and spend segments); our pending widget (judge-wiring.ts showPending, one row per step, the command cut at 160 characters); pi-subagents' agents widget (agent-widget.ts, one animated row per background helper, no setting turns it off); and the permission system’s ask dialog while an ask is open. In the transcript: a trace entry per non-allow (trace-renderers.ts, one line, ctrl+o expands it), a monitor event per batch (monitor-tools.ts deliverEvent, a custom message), a helper’s result with its spend line, and about a hundred kinds of ui.notify.
What has a screen: /pending opens the pending pane (pending-pane.ts, #341, #485), full width, anchored at the bottom, the chosen step’s action wrapped under the list in a viewport of DETAIL_LINES (12) rows. Plan review has its pane. pi-subagents has /subagents:sessions for a transcript. Monitors have monitor_list, a tool whose text the model reads, and the human only through it. Decisions have the trace line and ctrl+o, one at a time. Nothing shows a helper’s progress, turns and spend together.
pi’s own guidance (docs/tui.md): keep the default view compact and reveal detail through expansion or a dedicated screen. Its API gives what a dedicated screen needs: ctx.ui.custom with overlayOptions (width, maxHeight, anchor, visible), ScrollView, registerShortcut, and registerCommand’s `getArgumentCompletions(prefix).
Design
U1 - the pending screen, and /pending completion (packages/pi-modes/pending-pane.ts, judge-wiring.ts, pending-queue.ts, pending-widget.ts)
The screen. The pending pane becomes a full screen: overlayOptions: { width: "100%", maxHeight: "100%", anchor: "top-left" }. The terminal height reaches the component through tui.terminal.rows (pi-tui’s Terminal getter, on the TUI instance the ctx.ui.custom factory receives), re-read on each render so a resize reflows. The list is on top (every step, one row each, the chosen one marked) and the chosen step’s WHOLE action below, wrapped, scrubbed as today (#485), in a viewport that takes every remaining row rather than DETAIL_LINES. Keys as today (up/down choose, a approves, d denies, c clears, escape closes), plus the viewport’s page up/down, j/k, home/end, and the legend. The mouse as today where pi routes it. The pane still only chooses; the choice still goes through pendingCommand as the typed text, so the audit record, the notice and the model’s message are those of the typed command (the #341 invariant, kept).
The widget. widgetLines() in pending-queue.ts becomes one line: N pending for you · /pending to open (U2 adds the hub’s key to it when one is configured). The per-step rows go. A click on the line opens the screen (as a row did, #346). The status line’s "N waiting on you" segment stays: it is the same fact where the footer is the only thing visible, as on a phone.
/pending with a space. registerCommand("pending", { getArgumentCompletions }): for an empty or partial prefix, one item per waiting step, value the step’s #id, label #id <the step’s shown line, cut to the width pi gives>, description its kind (judge, valve, rule, failure); plus approve `, `deny `, `always `, `clear as the verbs, and after a verb the step ids again. So /pending ` then tab cycles the steps, and `/pending #3 opens the screen ON step 3 (a new form of the command: an id alone chooses it in the screen). /pending approve #3 works as today.
Tests (contract, in packages/pi-modes/test/pending-pane.test.ts and command-wiring.test.ts): the pane’s render at a given height puts the whole action in the viewport and no DETAIL_LINES cut; a 400-line command scrolls to its end; the widget is one line with the count and the way in; getArgumentCompletions(""), ("#"), ("ap") and ("approve #") give the items named, in queue order; /pending #3 opens on step 3; the existing pane tests (keys, mouse hits, scrub) hold. The audit invariant: approving from the screen and typing /pending approve #3 produce the same pending trace record and the same model message (asserted equal in one test, as the #341 tests assert today). A mutation check on the completion and the widget line.
U2 - the hub (packages/pi-modes/hub-pane.ts new; judge-wiring.ts, monitor-registry.ts, subagent-wiring.ts, helper-cost.ts, status.ts, config.ts; packages/pi-ssh/extension.ts, packages/pi-remote/index.ts)
One screen, tabs. A shortcut and a command (/hub) open a full-screen overlay with tabs, switched by left/right or 1-5, each a region with the keys of its own content. The shortcut is shortcuts.hub in the modes overlay: config.ts’s `SHORTCUT_KEYS (["approvePending", "denyPending"], a closed list the validator checks unknown keys against) gains "hub", and a hubShortcutKey(config) beside pendingShortcutKeys applies the default alt+h, with null unbinding it, as the pending keys do.
-
Waiting: U1’s pending screen, embedded (the same component, so one implementation).
-
Helpers: one row per helper this session (running first), from what pi-modes itself holds, because pi-subagents' service is a separate module instance and its
listAgents()is empty from here (subagent-wiring.tspriceFromRecord’s comment; `helper_cost.no_servicein the diagnostics).SubagentStatekeeps a launch’s agent, start time and model (runningSpawns,backgroundAgents), each priced helper (pricedByCall: tokens, usd, exact) and each yielded result (yieldedByCall); the helper ledger (helper-ledger.tsLedgerEntry: model, usd, tokens, messages, endedAt) holds the live spend of a running helper’s own session. It does not keep the task:capSpawnreads the spawn’s input, and U2 has it record the input’sdescriptionandprompthead (the first 120 characters) on theLaunch. So a row is: agent, task head, model, started, state (running / yielded / done / released), spend so far (the ledger’s, exact) or at the end (as priced). Enter shows the yielded result’s data or error, whole. Turns and the last progress line are pi-subagents' and are not shown; the legend names/subagents:sessionsandget_subagent_resultfor them. -
Monitors: one row per monitor (running first): id, description, status, counts, and the last line (as
monitor_listshows them, #474, #530). Enter opens a live tail: the stdout file’s last N lines, re-read on a timer while the tab is open, and the actions log on a key. Stop ons, through the same path asmonitor_stop. -
Decisions: the session’s non-allow trace records (
TraceRecord), newest first: source, decision, target, the full reason (notsummarize`d), the queued-for text, latency. A ring of the last 200 kept in `judge-wiring’s state beside `appendTrace, so the tab needs no session read. The transcript’s trace entries stay; this is the same record, readable whole and together. -
Session: mode, judge (model, authority, enabled), the gate counts and spend (the status line’s facts, in full words), and what pi-ssh and pi-remote publish: the SSH destination and link state, the phones paired and present. They publish over
pi.eventson the existingSTATUS_EVENTpattern (gadhs-modes:status): agadhs-hub:factsevent with{ source: string, lines: string[] }, emitted whenever the facts change and once onsession_start; pi-modes keeps the latest per source. pi-ssh emits from where it sets its status (packages/pi-ssh/session.tsstatusText, besidectx.ui.setStatus(STATUS_KEY, …)); pi-remote from where it renders the roster (packages/pi-remote/member.ts, the phones it knows). The hub shows a source’s lines under its name.
Rules. The hub is a ctx.ui.custom overlay; it is one interaction, closed by escape; opening it again is a new instance. Only at a terminal (ctx.mode === "tui"); at a host, /hub prints the Session tab’s text. Nothing in the hub decides anything a command cannot: approve and deny go through pendingCommand, stop through the registry’s stop. No model call from the hub.
Tests (contract, packages/pi-modes/test/hub-pane.test.ts; wire-format for the facts event): each tab renders its rows from a given state (fixtures: a queue, launches with priced and yielded entries and ledger entries, monitor summaries, trace records, facts); tab switching and each tab’s keys; the live tail reads the file; gadhs-hub:facts from a fake emitter appears under its source, and the event’s shape is pinned on both ends (a pi-ssh and a pi-remote test each emit it through a fake pi.events and assert the payload). The hub at a host prints text. No model call: every hub test runs with the forbidden registry (test/tool-surfaces.test.ts’s `forbiddenRegistry, which throws on any model use). Mutation check per tab’s row formatting.
U3 - the inline trim (status.ts, judge-wiring.ts, monitor-tools.ts)
The status line gains two segments when non-zero: N helpers (M running) (from stats.runningAgents and helperRuns) and N monitors (from the registry), so the footer alone says what the hub holds. A monitor event message keeps its text (the agent reads it) but its display is one line with the count and the way to the tab (display: true stays; the renderer for MONITOR_MESSAGE_TYPE is registered to show the head line, ctrl+o the rest). The pi-subagents widget stays: an upstream issue asks for a setting to hide it (filed on approval, linked here), and until then it is the one widget we do not own.
Tests (contract, test/status.test.ts and test/monitor-tools.test.ts): the two segments appear and vanish with the counts; the monitor message renderer shows one line collapsed and all expanded.
Failure modes, named
| What could go wrong | What happens |
|---|---|
A long action renders slowly |
Fail-closed: render is cached by width and content (as the pane does today); a 10,000-line action is wrapped once and scrolled, and until it is wrapped the screen shows nothing approvable. A test times a 10k-line wrap. |
The hub opens over the permission dialog |
Fail-closed: the hub declines to open while a |
A helper’s record disappears (released) |
Fail-closed: its row says released, its detail is gone, nothing is thrown; no decision depends on it. |
The monitor tail file is gone |
Fail-closed: the tab says the file is gone; the registry’s counts stay; stop still works. |
|
Silent by design: the Session tab shows pi-modes' own facts and "no facts from pi-ssh/pi-remote yet"; no error, and the diagnostics record which sources have spoken. |
Regular (non-fullscreen) mode |
Fail-closed: no mouse; every action has a key; the legend omits the mouse words, as the panes do today. Nothing is reachable by mouse that is not by key. |
Decisions for the operator
-
Pending first, as a screen (asked for): done in U1, shippable alone.
-
The transcript keeps its trace lines; Decisions is beside them. The transcript is the record; the tab is a reading of it.
-
The pi-subagents widget stays until upstream adds a toggle. Push-back: hiding it ourselves would mean patching upstream’s UI, which #487 shows is a maintenance debt we are trying to shed.
-
Never leaves the inline view: the mode, "N waiting on you", a running review’s working message, and the permission dialog. Everything else may move to the hub.
Scope
Units, grouped into MRs
-
MR 1
feat/pending-screen: U1.Closes #543. Release after it: the operator’s ask stands alone. -
MR 2
feat/session-hub: U2.Closes #544. pi-ssh and pi-remote each gain theirgadhs-hub:factsemitter in the same MR (three packages, one feature). -
MR 3
feat/inline-trim: U3.Closes #545.
Each MR: tests named above, a mutation check, the CHANGELOG.adoc entry, modes.adoc’s pending and monitor sections and `tuning.adoc’s shortcuts section updated, `validate green.
Out of scope
-
Replacing pi’s footer (
setFooter) or editor. -
Hiding or patching pi-subagents' widget (upstream issue instead).
-
A phone (pi-remote) rendering of the hub: the phone keeps its own pages.
-
Editing the plan draft from a pane (#347), clickable links (#348), OSC notifications (#350).
Acceptance
-
/pendingshows the whole of a 400-line command, scrolled; the widget is one line;/pending ` completes the steps and verbs; `/pending #3opens on step 3. -
The hub opens on its key and
/hub, with five tabs whose rows match the fixtures; a monitor’s tail is live; approve, deny and stop go through the existing command paths (the audit records are identical to the typed forms'). -
The status line names helpers and monitors when there are any; a monitor event is one line collapsed.
-
No model call is made by any of it (the tests' forbidden registry).
Evidence
pi 1.4.0 docs/tui.md (custom screens and overlays; OverlayOptions: width, maxHeight, anchor, visible; ScrollView; keep the default view compact); dist/core/extensions/types.d.ts (registerCommand with getArgumentCompletions(prefix): AutocompleteItem[], registerShortcut, setWidget placement); pi-subagents 25.0.5 src/ui/subagents-settings.ts (no widget setting) and src/ui/agent-widget.ts; pi-permission-system 42.0.0 docs/cross-extension-api.md (permissions:ui_prompt).