Live observability, disciplined context control, and parallel agent orchestration — inside your terminal.
Click any card to jump straight to its 5-slide chapter — or press M anywhere to return here.
/fast toggle for priority tiersBefore you optimize an agent session, make its hidden state visible — how full the context window is, how fast tokens stream, and how to shift into priority gear.
pi extension
Dot-grid view of your context window.
why it exists · the problem
Base instructions, <rules>, <project_context>, and <skills> eat context before turn one.
Every active tool ships its description and JSON parameter schema on every request.
Verbose tool outputs and replies compound silently until compaction interrupts your flow.
how it works · live simulation
In Pi, /context renders a proportional 11 × 8 (88-cell) dot grid.
how to use
/context in any Pi session.Proportional 11 × 8 grid separating System Prompt, Tools, Messages, Empty, and Output Buffer.
Inspect prompt tags (<skills>, <rules>), active tool schemas, and per-turn estimateTokens().
the advantage
Separate System Prompt, Tools, Messages, Empty space, and Output Buffer with distinct symbols.
An 11 × 8 proportional grid captures the entire 200k+ window without leaving your terminal.
Keyboard-driven /context details overlay in interactive sessions, plain-text dump without UI.
One opaque token total. Bloated tool schemas or giant <skills> go unnoticed until sudden auto-compaction wipes your working context.
Run /context or /context details anytime to pinpoint prompt sections, active tools, and heavy turns using live chars ÷ 4 estimates.
Live tokens/sec and TTFT in your status bar.
Two opposite bottlenecks feel identical when your status bar is silent.
Resets cleanly on every before_provider_request across multi-step tool loops.
Writes throttled at 250ms (~4/sec) with a 500ms floor to suppress burst noise.
Estimates chars/4 mid-stream if needed, then snaps to exact usage.output.
[⚡ 42.1 t/s ⏱ 412ms]
⚡ 42.1 ⏱ 412ms
[⏱ 412ms]
[⚡ 42.1 t/s]
[U+F0E4 42.1 t/s U+F017 412ms]
[⏱ —]
/gauge tps
/gauge ttft
/gauge mode
/gauge display
/gauge icons
[⚡ 50.0 t/s ⏱ 412ms]
100 tok ÷ 2.00s total
[⚡ 63.0 t/s ⏱ 412ms]
100 tok ÷ 1.59s stream
/gauge opens a bordered TUI dialog with live preview
pi-gauge
[⏱ —] flags stalled TTFT on the spot; live t/s separates queue lag from throttled streaming.
Compare Anthropic, OpenAI, Google, or /fast tiers on one scale — plus session trends via /gauge graph.
Stays in Pi’s status bar. Records append as pi-gauge-sample entries with 0 tokens of LLM context cost.
pi extension
One /fast toggle for provider priority tiers
why it exists · the problem
speed: "fast"
+ betas: ["fast-mode-2026-02-01"] on opus-5
service_tier: "priority"
excluded on gpt-oss-* & gpt-image-*
config.serviceTier: "priority"
camelCase nested under config object
X-Vertex-AI-LLM-Shared-Request-Type: priority
HTTP header instead of body field
Body field vs nested config vs beta array vs HTTP header.
No quick switch when you want a burst of speed or want to save cost.
Sending unknown fields to Bedrock or unsupported models triggers errors.
how it works · interactive router
speed: "fast"
+ beta on claude-opus-5
service_tier: "priority"
GPT, o-series, codex
config.serviceTier: "priority"
Vertex: X-Vertex-AI-LLM-Shared-Request-Type
payload left untouched
no fast rule matched
how to use
/fast
toggle on / off
/fast on
enable priority tier
/fast off
return to standard
/fast status
print current state
speed: "fast"+ beta on opus-5
opus-5 / 5-5, fable-5-2, mythos-5-2
service_tier: "priority"
GPT, o-series, codex
config.serviceTier: "priority"
gemini-*
X-Vertex-AI-LLM-Shared-Request-Type
gemini-*
the advantage
Only modifies allowlisted models. Existing fields & headers are never overwritten.
HTTP 402, 403, 429 or 529 pauses fast mode so retries run normally.
Warns on cache miss above 10k tokens. Edit rules anytime in fast-config.json.
Remember speed vs service_tier vs serviceTier vs Vertex headers; manually revert on rate limits.
One /fast toggle saved across sessions, automatic provider routing, and built-in 10m error cooldown.
Long sessions rot when stale tool output, broken prompt-cache prefixes, and irrelevant skill lists crowd out the task at hand. Keep context lean, cached, and sharp.
pi extension
Prune old tool output, keep the summary.
3 calls, raw output pruned
context_tree_query
why it exists · the problem
carried forward verbatim on turn 15, even after the bug moved on
Longer prompts stretch prefill and time-to-first-token.
Every subsequent prompt re-bills old logs the model already read.
Stale stack traces and grep dumps compete with the live task.
how it works · interactive simulation
src/auth.ts — JWT middleware & refresh flownpm test — 2 fails in token.test.ts:42sessionId — 14 matches across 4 filest1, t2, t3
Use context_tree_query to retrieve
## toolRef: t2 · Tool: bash · Status: ERROR FAIL src/token.test.ts:42 Expected status 200, received 401 (expired refresh token)
context-prune-index maps short refs back to full ToolResultMessage entries. Originals are never rewritten or deleted.
how to use
agentic-auto
calls context_prune
default
agent-message
on final text reply
cache-safe
on-context-tag
on context_checkpoint
pi-context
on-demand
manual /pruner now
manual
every-turn
after every tool turn
debug
context_tree_query({ toolCallIds: ["t1", "t2"] })
Returns full original output + args + turn index whenever the agent needs exact details back.
the advantage
Completed tool results are filtered from the context event and replaced by tight summaries—and oversized summaries auto-skip.
Session JSONL entries are never rewritten or deleted. Inspect anytime in /pruner tree or recover via context_tree_query.
Batch turns with agent-message or agentic-auto to protect prefix caches, using a fast model like gpt-4.1-mini or haiku.
Prompt-cache hit rates and token stats inside pi.
Every turn re-sends your prompt. When context edits or pruning shift earlier tokens, prefix caching breaks without warning.
Cached prefix skips re-tokenization: low token cost, fast prefill latency.
Everything after the edit misses cache: full prompt re-written, higher latency, zero error in chat.
OpenAI-style providers report cacheWrite = 0; Anthropic-style report it separately.
/cache graph3 viewsTUI overlay across turns: 1 Per-turn %, 2 Cumulative %, 3 Cumulative tokens (▇ in, ░ write, ▒ read). Switch subagents via ← →.
/cache statsbranch vs treePer-message prompt, received, cache hit, cache write, and hit% table with Active branch vs Whole tree delta.
/cache exportCSVWrites session-name.csv to project root with summary + per-message rows for charting.
100│············██···· 80│········██████·███ 60│·····█████████████ 40│···███████████████ 20│·█████████████████ 0│────────────────── 1 18
Inspect per-turn %, cumulative %, or stacked token volumes (input, cacheWrite, cacheRead) right in the TUI.
Separate active branch totals from abandoned branches, and switch to pi-subagent-manager subagent graphs.
Validate pi-context-prune strategies in real time or dump session-name.csv via /cache export.
cacheRead high cuts fresh input & cacheWrite re-tokenization on every turn — reducing API spend and time-to-first-token while catching regressions before they compound.
pi extension
Advertise only the skills each prompt needs.
the problem
Sending dozens of skills, external tools, and MCP servers on every prompt burns tokens and blurs tool choice.
how it works
how to use
/decisionsFloating 4-tab TUI (Skills · Tools · Decision · Lab)/decisions statusCredentials, last round & allowlist counts/decisions historyCommitted branch additions per turn/decisions tools listNames-only external tool availability/decisions mcp listMCP servers & ext__ groups (no scoring)/decisions testExplicit synthetic check against modelclassify()TYPESAFE_API_KEYOPENAI_API_KEY (API key)GEMINI_API_KEYOPENROUTER_API_KEYResolves Pi credentials first, then env vars. Zero calls until you pick a model.
Enable under /decisions → Tools. Pick individual tools or whole mcp / ext__ groups. Pin essentials globally or in .pi/pi-context-decisions.json (Ctrl+S).
◇ ≡ 12/40 ⚙ 18/120
or
⚙ 3/15g
the advantage
Advertises only relevant names, descriptions & paths — never bloated skill bodies or unrelated tools.
50-candidate parallel shards with an 8s deadline. Top deciders hit 100% accuracy in ~314ms.
Additive across turns as tasks shift. Leaves <8 automatic skills unfiltered; fail-closed by default.
Keep your entire skill library and MCP stack installed — Pi only sees what fits the task at hand, including inside pi-subagent-manager children.
Scale beyond a single serial loop: enforce task dependencies, steer parallel subagents, watch background tmux builds quietly, and keep PR checks live in your footer.
pi extension
Session task checklist with dependencies.
the problem
When subtasks live only in scrolling chat history, agents forget steps, skip prerequisites, or declare victory too early.
store.ts... (half wired)npm test before store is finishedMulti-step plans disappear behind compaction, /branch, or dozens of tool calls.
Nothing stops an agent from running tests or migrations before foundational code lands.
Turns wrap up with half-verified changes because remaining work isn't pinned in the UI.
how it works
Blocked tasks (blockedBy.length > 0) cannot move to ongoing or done until every dependency is done. Cycles rejected.
how to use
/checklist
Open centered TUI dialog with all tasks
/checklist add [text]
Add a task with 3-char ID & dependsOn picker
/checklist settings
Display mode, status style, icons, prompt steering
/checklist clear | hide
Reset list or hide widget while keeping state
Creates up to 10 tasks with deterministic 3-char FNV-1a IDs (k7q) and dependsOn DAG links.
Returns tasks, computed ready / blockedBy views, and notes after compaction or mid-turn.
Moves tasks through planned → ongoing → done / cancelled with dependency & cycle guards.
the advantage
Dependencies aren't advisory notes — checklist_update blocks starting any task whose blockers aren't done.
Persists in the session JSONL branch across /resume, /branch, /undo, and context compaction.
Top-5 prioritized widget, n/m footer summary, and centered /checklist overlay keep you in sync.
Deterministic 3-char IDs, atomic updates, and visible blockers ensure the agent finishes every step — not just the first thing that compiles.
Parallel subagents you can watch and steer.
One agent stalls independent tasks in line — and opaque workers hide what they're doing until it's too late.
Unrelated research, coding, and review wait behind one turn loop.
No live tree to inspect progress, redirect wrong turns, or resume work.
/agents fork:<agent> <task>
share current conversation
/agents fresh:<agent> <task>
start clean, zero history
/agents tree
watch live tree & steer
/agents types
edit model, tools & prompts
/agents
delegation limits & settings
Plans, tradeoffs, coordinating helpers
Implementation and debugging
Codebase and web research
Correctness and security issues
Small jobs and quick lookups
Drafting and editing prose
/agents types or .md / .yml files.
Launch independent siblings with wait: false and keep typing in your main session while helpers work.
Inspect any branch in /agents tree, send mid-flight steering, or resume completed and paused sessions.
Share a frozen parent snapshot via fork:, or spawn clean independent roots via fresh:.
/agents fork:coder fix the failing auth testLong-running tmux jobs, logs and selective alerts
/error|failed/
delivery: wake
5-minute builds, test suites, and servers stall your session—or wake the model on noisy output.
One slow build holds the entire conversation hostage.
Every check burns context tokens on routine chatter.
tmux server and wake Pi only on a matching line or exit.
npm run build
running
npm test
done
tail -f app.log
watching
/error|failed/i · delivery: wake/error|failed/i…
bgmon_start → bgmon_watch → bgmon_inspect
interactive simulation
npm run build in the background. Wake up if the output matches error|failed, and check the log later.”bgmon_start + bgmon_watch (regex, from: retained, delivery: wake)
unhealthy.”bgmon_watch (contains: "unhealthy")
bgmon_inspect pages retained history via after cursor (16 KiB / 200 lines).
/bgmon or /bgmon listSelect a live or retained job and open the read-only log viewer overlay.
/bgmon settingsAdjust shared limits (1–64) across Global, Project, and Session scopes.
/bgmon stop-serverStop your session’s private tmux server while retaining journal logs.
attach & logRefReturned on start for manual tmux attach or read-only historical inspection.
tmux first, then reload Pi after installing
background-monitor
Filter completed lines with any, contains, regex, or exit. Deliver via ui, nextTurn, or wake with metadata only.
Jobs run in private tmux servers and normally survive Pi shutdown. Subagents share the group budget with isolated watches.
Ring-rotated journals bound disk and context. Rotation, capture faults, or slow-reader gaps are surfaced explicitly.
bgmon_inspect
Compact PR number and check counts, in-footer
$ gh pr checks
polling GitHub...
0 failed disappears.#41208 is hyperlinked; one click opens GitHub.\x1b]8;;https://github.com/.../pull/41208\x1b\\#41208\x1b]8;;\x1b\\
git symbolic-ref branch PR firstPR URL fallback from promptgh pr view polls every 30sCurrent branch PR wins; else a PR URL from your prompt updates every 30s.
externalStatusKey: "pr-status"Complete summary via ctx.ui.setStatus. Use fg: "default", no extra icon.
Set any widgetId in /footer; missing PRs & zeros emit value: null.
gh-prfull summarygh-pr-numberOSC 8 #41208gh-pr-state-iconcolored icongh-pr-stateopen/merged/closedgh-pr-checksicons + countsgh-pr-repoowner/repogh-pr-passednonzero countgh-pr-runningnonzero countgh-pr-failednonzero countgh-pr-titlePR titlePolls gh pr view every 30 seconds for your branch PR or pinned URL—zero manual checks.
Wraps only #41208 in an OSC 8 terminal link—jump straight to GitHub without URL clutter.
Only nonzero counts appear. Use pr-status as-is or arrange 10 composable widgets in /footer.
Keep coding in Pi while CI turns green right in your peripheral vision.
/context maps every token bucket, pi-gauge tracks live t/s & TTFT, and /fast flips priority inference across providers.
pi-context-prune shrinks stale tool dumps, /cache proves prefix hits hold, and /decisions keeps unused skills out of the prompt.
/checklist keeps multi-step plans honest while /agents, /bgmon, and pi-gh-footer run builds, subagents, and CI checks side by side.
$ pi install npm:pi-context-usage
$ pi install npm:pi-gauge
$ pi install npm:pi-faster
$ pi install npm:pi-context-prune
$ pi install npm:pi-cache-graph
$ pi install npm:pi-context-decisions
$ pi install npm:pi-checklist
$ pi install npm:pi-subagent-manager
$ pi install npm:pi-background-monitor
$ pi install npm:pi-footer npm:pi-gh-footer