Repository navigation
Description
Motivation
Pi (https://pi.dev, @earendil-works/pi-coding-agent, CLI pi) is a fast-moving, extension-first coding agent with subscription logins for Claude, ChatGPT/Codex, Copilot and others. Users should be able to run it in Agent Code the way OpenCode Terminal runs OpenCode: Pi's own native TUI in a pane, while the rest of Agent Code (status badges, Dispatch, orchestration, MCP transcript reads, Reader Mode, conversation catalog, provider switch) sees it as a real agent rather than a dumb shell.
Pi has no permission system, no MCP and no server mode that coexists with its TUI. Its only integration surface that keeps the TUI is its extension API (pi -e <file.ts>), and its durable transcript is a JSONL tree (branches from /tree live in the same file). Both facts shape the design.
Intended behavior
- New provider kind
pi, terminal-only: every Pi pane is the native TUI, from every spawn path, resolved at read time by oneeffectiveProviderRuntimehelper instead of relying on each spawn site to setproviderRuntime: 'terminal'. - New public package
pi-terminal-headless(submodule), mirroringopencode-terminal-headless:- durable channel: tails the session JSONL and projects it onto the active branch;
- live channel: a bridge extension that Agent Code ships and Pi loads with
-e. It connects to a host-owned Unix socket and reports activity, turns, session switches and blocking dialogs. It also handles prompt delivery and abort; - isolated
reconcile/sequencer between the two; - the app owns the PTY.
- Honest prompt delivery through the bridge: delivered / refused / unknown, never a silent paste (bug(opencode): prompts sent to a just-started OpenCode Terminal pane are silently lost #877 lesson).
- History, Reader Mode, View Prompts, Copy Last Response,
agent_transcript_*and orchestration reads return the active branch. - In-TUI
/new,/resume,/forkand/treeare followed. - Pi sessions appear in the Conversations picker and support a verified resume command.
- agent-transcript-parser gains a Pi decoder and projector, so Pi can switch to and from every other provider and be duplicated.
- The built-in MCP (TLDR, Goal, orchestration) is exposed inside Pi through the bridge's tool proxy.
- Degradation: without the bridge the pane still works, the transcript still arrives, status is "unknown" rather than wrong, and prompt delivery refuses with a visible diagnostic.
Spec: docs/decomposition/pi-terminal.md. Plan: docs/superpowers/plans/2026-09-22-pi-terminal-harness.md (branch feat/pi-terminal-harness).
Acceptance criteria
- "New Pi" is offered when
piis on PATH; Setup shows the install hint otherwise - Pi panes are always the TUI surface (picker, split, catalog resume, MCP create_agent, control API, duplicate, switch target, restart restore)
- Busy/idle follows Pi's own
agent_start/agent_settled, with no idle flicker between tool steps - Committed transcript and history cover the active branch only; abandoned branches never appear
- Orchestration / Dispatch prompt delivery works with truthful outcomes
- Blocking Pi dialogs raise attention and clear when answered in the TUI
-
/new,/resume,/forkand/treeare followed with a history reset boundary - Conversations catalog lists and resumes Pi sessions; "Copy Resume Command" is verified
- Switch Pi ↔ Claude/Codex/OpenCode/Grok and Duplicate work
- Built-in MCP tools are callable from inside Pi
- Bridge failure degrades visibly and never crashes
pi - Tests are built from recorded real Pi runs (sandboxed faux provider); package, parser and app gates are green
Activity
test(transcript): record the Pi evidence corpus
docs(pi): record the package scaffold in the harness plan
docs(pi): apply the Stage 0 evidence to the Pi harness spec
feat(transcript): read Pi sessions as their active branch
feat(bridge): observe the Pi TUI through a bridge extension
feat(terminal): compose the Pi terminal headless runtime
docs(pi): record the package runtime in the harness plan
build(pi): wire the pi-terminal-headless submodule into the app build
feat(transcript): report the active branch length with each history page
feat(pi): register Pi as a terminal-only provider kind
feat(pi): follow in-TUI session switches and pin the adapter to recor…
feat(pi): read Pi sessions as their active branch everywhere
test(pi): type the mapper test against the Entry union
feat(transcript): list every Pi session across per-cwd and flat sessi…
13 remaining items
fix(pi): honor v1 kept ranges and Pi's edit scope when decoding
fix(pi): keep pi's restored state on Pi targets and summaries on ever…
fix(transcript): detect Pi's in-place migration rewrite
fix(bridge): survive /reload and answer every refused prompt
fix(bridge): follow a /tree move to the root and never leak MCP crede…
build(pi): bump the Pi runtime and parser to their reviewed fixes
fix(pi): close the review findings on the Pi app integration
docs(pi): record verification and the review round
test(probe): let the faux model call a named tool with JSON arguments
test(pi): run Pi panes through the whole app stack, replayed and live
docs(pi): record the integration tiers
docs(pi): record the green, unmerged done state
fix(pi): apply the Astra review's four app findings
Merge origin/main into feat/pi-terminal-harness; point at merged Pi p…