pi coding agent

Pi, extended

Ten small extensions that make your terminal agent faster to read, cheaper to run, and calmer to trust.

$ pi install npm:pi-<extension>

the tour

Ten extensions. Five themes.

seespeedcontextplan & delegateship
pi extension

pi-context-usage

Dot-grid view of your context window.

System PromptToolsMessagesEmptyBuffer
$ pi install npm:pi-context-usage
the problem

How full is your context window?

You're guessing.

tool result file read bash output long reply
context window??% used
????????????????????????????????????????????????????????????????????????????????????????

...until the agent starts forgetting.

why it exists

A number can't show what's eating it.

what you usually get
31.4k / 200.0k
tokens (16%)
...of what?
/context88 cells
System Prompt1%
Tools0%
Messages15%
Empty76%
Buffer8%

One glance: every slice of the window, by who owns it.

what it does

Two commands. Total clarity.

/context

A dot-grid summary of your window, with five categories.

/context details
▸ System Prompt
▾ Tools
▸ edit 142
▸ read 70
▸ Conversation

A keyboard-driven overlay: system prompt, tools, conversation.

◍ System Prompt⚙ Tools● Messages· Empty○ Buffer
how it works

Estimate, split, allocate.

system promptgetSystemPrompt() · chars ÷ 4
active toolsname + desc + params, chars ÷ 4
used tokensminus the two above = messages
model.maxTokensreserved for output = buffer

allocate

cells = tokens ÷ window × 88
empty = window − used − buffer
any non-zero bucket gets at least 1 cell
11 × 8 cells · each is 1/88 of your window
piclaude-sonnet-4-5
❯ /context
Context Usage

◍ ⚙ ● ● ● ● ● ● ● ● ●
● ● ● ● · · · · · · ·
· · · · · · · · · · ·
· · · · · · · · · · ·
· · · · · · · · · · ·
· · · · · · · · · · ·
· · · · · · · · · · ·
· · · · · · ○ ○ ○ ○ ○

claude-sonnet-4-5   31.4k / 200.0k tokens (16%)

◍ System Prompt:    1.7k (1%)
⚙ Tools:             275 (0%)
● Messages:        29.4k (15%)
· Empty:          152.2k (76%)
○ Buffer:          16.4k (8%)
using it

Type /context.

16%of 200.0k used

Run it any time, after at least one message.

using it · go deeper

/context details

Context Details
claude-sonnet-4-5 31.4k / 200.0k tokens (16%)
▸ System Prompt 6.2k tokens est. (24,800 chars)
▾ Tools (3) 273 tokens est.
▸ edit 142 567 chars
▸ read 70 279 chars
▸ bash 61 244 chars
▾ Conversation (3 turns) 194 tokens est.
▸ #1 10:00 U Can you inspect the repo… 55
▸ Σ 10:06 Σ Earlier discussion established… 38
▸ #3 10:10 U Add the system prompt and… 65
↑/↓ move Enter/→ expand ← collapse Tab jump sections PgUp/PgDn scroll Home/End Esc/q close
system prompt, split
IntroductionToolsRulesDocumentationProject ContextAvailable SkillsWorking Directory

Available Skills opens into one row per skill.

no UI?

You get a plain-text dump instead.

the advantage

Know before it's full.

88

cells

see your whole window at a glance

◍⚙●·○
5

buckets

each with its own symbol and colour

▾▾▾
3

sections

system prompt, tools, conversation

.ts
0

build steps

pi loads the TypeScript directly

stateless: reads live session stateestimates, chars ÷ 4
get it

See your context.

$ pi install npm:pi-context-usage

Then run /context.

github.com/championswimmer/pi-context-usage

pi extension

pi-gauge

Live tokens/sec and TTFT in your status bar.

42.1 t/s 412ms
the problem

Fast or slow? You're guessing.

model A
status: [ ? t/s  ? ms ]
vs
model B
status: [ ? t/s  ? ms ]

Streaming text feels the same until it doesn't. Nothing tells you why.

why this exists

Two numbers decide how fast it feels.

Latency (TTFT)

Time to first token. How long you waited before anything appeared.

first token

Throughput

Tokens per second. How fast the reply flows once it starts.

Pi sees both in its own events. Now you do too.

what it does

A speedometer in your status bar.

pistreaming…
> refactor the parser
status: 42.1 t/s —
42.1 t/s how fast tokens arrive
412ms wait for the first token
Ticks live, then settles on the final numbers
how it works

Three pi events. One stopwatch.

before_provider_request first *_delta message_end TTFT e2e duration stream duration
84.2 tok / 2s = 42.1 t/s
updates throttled to ~4/sec re-anchors every LLM call exact tokens snap in at message_end
using it

One command. Five settings.

pi
$ /gauge
pi-gauge: tps=on ttft=on mode=e2e display=pill icons=emoji
$ /gauge ttft off
status:  [42.1 t/s]
$ /gauge display icon
status:  42.1 412ms
tps on|offthroughput
ttft on|offlatency
mode e2e|streamt/s denominator
display pill|iconbracketed or compact
icons emoji|nerdglyph set
graph [model]session history

Bare /gauge opens a settings dialog with a live preview. ctrl+s saves.

the advantage

Compare models by feel, in numbers.

Same prompt, two models

fast
142 t/s 210ms
slow
6.2 t/s 1.85s

Durations of 1s or more show as seconds.

Choose what counts

e2e
50.0
stream
63.0

e2e: how long did I wait overall?
stream: how fast once it starts?

same readout for every provider TTFT identical in both modes hide either metric
history

/gauge graph remembers every call.

gauge graphall models
t/s
TTFT
0 contextStored as hidden session entries. Nothing reaches the LLM.
ResumesHistory survives session resume.
Filters←→ cycles models. esc closes.
get started

See your model's speed. Today.

$ pi install npm:pi-gauge

Then just ask pi something. The pill appears.

pi extension

pi-faster

One /fast toggle for provider priority tiers

request payload
> /fast on
↯ fast
Anthropicspeed: "fast"
OpenAIservice_tier: "priority"
GeminiserviceTier: "priority"
the problem

You are waiting on every token

pistandard speed
> refactor the auth module and add tests
Reading src/auth/session.ts and its callers...
Planning the extraction into a token service
Writing the first test file
still generating...
elapsed
0:47

Output speed is the one thing you cannot type your way around.

why this exists

Four providers. Four different knobs.

Anthropicspeed: "fast"
OpenAIservice_tier: "priority"
Geminiconfig.serviceTier: "priority"
Vertex AIX-Vertex-AI-LLM-Shared-Request-Type
/fast
one command
what it does

Roughly 2x faster output

At a higher price. Off by default.

same response
standard
1x
/fast on
~2x
pi footer↯ fastshown when on and the model supports it
how it works

It edits the request on its way out

1Request leaves pibefore_provider_request
2Allowlisted?api, provider, model regex
3Inject the tierfirst matching rule wins
4Providerpriority service tier
payloadbefore
{
  "model": "claude-opus-5-5",
  "messages": [ ... ]
}
payloadafter
{
  "model": "claude-opus-5-5",
  "messages": [ ... ],
  "speed": "fast"
}
no match sent untouched
already set never overridden
using it

Type /fast. Done.

pi
>
Fast mode: off
>
Fast mode is on. Requests will cost more.
>
Fast mode: on
claude-opus-5-5↯ fast
/fasttoggle
/fast onturn on
/fast offturn off
/fast statuscheck

Saved to ~/.pi/agent/pi-faster.json

the advantage

Fast, and careful

gpt-ossxclaude-opus-5-5

Allowlist only

Models without fast mode are left alone.

speed: "fast"kept as you set it

Never overrides

Values already on a request stay put.

↯ fastfast: paused10 min

Backs off on errors

After a 402, 403, 429 or 529, retries run at normal speed.

above 10k tokenscache miss once

Cache heads-up

Toggling warns before it costs you a prompt-cache hit.

Rules live in an editable fast-config.json.

install

Make it faster

$ pi install npm:pi-faster

github.com/championswimmer/pi-faster

/fast onAnthropicOpenAIGeminiVertex AI
pi extension

pi-context-prune

Prune old tool output, keep the summary.

context
read
bash
grep
summary3 calls, raw output pruned
originals kept, recover via context_tree_query
the problem

Every tool call leaves its output behind.

6,760

tokens of raw tool output in one small coding session

illustrative example

contextgrowing
read_file App.tsx45
read_file package.json120
web_search react table3,400
read_file200
edit_file15
bash npm run build2,800
read_file180
why this exists

The model reads output once.

Then every request after it carries the whole thing again.

used here
dead weight from here on

Keep the conclusion. Drop the bulk.

what it does

Summaries in. Bulk out.

Summarize

Finished tool-call batches become one short summary.

Prune

Raw outputs leave future context. Your session history is never rewritten.

Recover

context_tree_query brings back any original output on demand.

Your model

Summarize with a cheap, fast model, separate from your coding model.

how it works

Capture, summarize, prune.

1 capture2 queue3 summarize4 inject read bash grep pending batches summarizer model of your choice summary compact, hidden refs t1 t2 t3 index originals kept saved in session on trigger 5 prune · the next LLM request user assistant calls raw tool results summary
using it

One command to start.

pi
>/pruner on
Context pruning enabled.
>/pruner prune-on agent-message
… agent reads, runs, greps … then replies
[pruner] Turn 3 summary (3 tools)
Summarized tool refs: t1, t2, t3
agent → context_tree_query t1
✂ ON (On agent message) │ ↑1.2k ↓340 $0.003
/pruner statusstate, model, trigger
/pruner model <id>pick the summarizer
/pruner nowflush pending calls
/pruner treebrowse what was pruned
/pruner statssummarizer tokens, cost
/pruner settingstabbed settings overlay
you pick when

Five triggers, one setting.

every-turn
after every tool turndebugging
on-context-tag
when context_checkpoint is called
on-demand
only on /pruner now
agent-message
on the final text replysafest
agentic-auto
model calls context_prunedefault
the advantage

A fraction of the tokens.

stale tool output in context6,760 tokens
~6,760 raw~200 summarized

illustrative example session

Lean long sessionsCompact summaries replace verbose outputs.
Nothing lostEvery original stays recoverable by ref.
Cache-friendlyBatch many turns, prune once.
Cheap summarizerA small model does the summarizing.
get it

Keep the summary.

$ pi install npm:pi-context-prune
then, in Pi> /pruner on
or just try it$ pi -e npm:pi-context-prune
pi extension

pi-cache-graph

Prompt-cache hit rates and token stats.

/cache graph · per-turn (%)
100%0%
hit% = cacheRead / (input+cacheRead+cacheWrite)
the problem

The cache is working.
Or is it?

#1
?
#2
?
#3
?
#4
?
#5
?
#6
?
#7
?
#8
?

Every turn re-sends your whole prompt. Pi never shows you how much of it came from cache.

why this exists

Pruning shrinks context.
Does it hurt the cache?

pi-context-prune

Compacts the session context to keep token usage down.

pi-cache-graph

Built first to add observability: see how pruning moves your hit rate, turn by turn.

Cache hits change what every turn costs. Now you can watch them.

what it does

Three commands.
Every token, in view.

/cache graph

Hit % over time for every assistant turn, in three switchable views.

/cache stats

Per-message token and cache table, with branch and whole-tree totals.

/cache export

Writes the same data to a CSV you can chart in Excel.

active branchwhole treeper subagentsession-name.csv
how it works

One turn. One ratio.

prompt sent this turn (example)
input
write
cacheRead
input fresh tokens 1,200 cacheWrite newly cached 800 cacheRead served from cache 38,000
hit% = 38,000 / 1,200 + 38,000 + 800 = 95.0%

Read from every assistant message's usage: input output cacheRead cacheWrite. Providers that report cacheWrite = 0 work the same.

using it
piPer-turn (%)
> /cache graph
Latest: 99.8% • Min: 0.0% • Max: 99.8% • Turns: 40
Recent 8 turns
#33* 88.1% in 1 cache 40,741
#34* 99.6% in 1 cache 46,251
▒ cache read (hit)░ cache write▇ input
1 per-turn %
2 cumulative %
3 cumulative total
vV cycle views
←→ pick subagent
r refresh q close
the advantage

Measure it, then tune it.

3
graph views
3
commands
1
formula
  • Compare your active branch with the whole session tree.
  • See each pi-subagent-manager agent in its own graph.
  • Spot the turn where the cache went cold.
  • Export to CSV and build your own charts.
get it

See your cache

$ pi install npm:pi-cache-graph

Then run /cache graph in any pi session.

github.com/championswimmer/pi-cache-graph
pi extension

pi-context-decisions

Advertise only the skills each prompt needs.

> Review these validation changes code-review test-edge-cases release-notes ui-polish
the problem

Every skill.
Every prompt.

Pi lists all of them in the model's system prompt, relevant or not.

40skills
advertised
> Review these validation changes
system promptskills
deployrelease-notesui-polishchangelogdockersql-tunek8scode-reviewapi-docsi18na11yperfseolint-fixgit-flowmigraterollbackcronloggingtracingoauthtest-edge-casesstripesentryfigmatailwindgraphqlrust-fmtpy-typesbenche2emock-genreadmelicensesemverci-fixsecretscachequeues3-sync
You needed 2.
your task advertised skipped
why this exists

Your prompt already says what matters.

Read the task

The latest thing you asked.

Advertise the few

Only skills that fit this task.

Skip the rest

Until a later prompt needs them.

what it does

Only what the prompt needs.

pi/decisions status
>
Review these validation changes
decision
model
code-review
test-edge-cases
release-notes
ui-polish
4 candidates -> 2 advertised

Additive

Picks only add. Nothing is dropped.

Always allowed

Pin essentials, global or project.

Tools too

MCP and tool filtering. Off by default.

how it works

A small model only ranks.

before_agent_startyour prompt
names + descriptionsdecision model
score 0 to 2example
0.75
code-review 1.9
test-edge-cases 1.6
changelog 0.5
release-notes 0.2
ui-polish 0.1
qualifies at 2 x threshold (0.375)
systemPromptOptions.skills
code-reviewtest-edge-cases
it only grows

Switch tasks. Keep what you had.

prompt 1

Review these validation changes

code-reviewtest-edge-cases
prompt 2

Prepare a release

code-reviewtest-edge-cases+release-notes
per branch forks inherit failed round adds nothing
using it

Pick a model. Start fresh.

  1. 1Run /decisions
  2. 2Decision -> Decision model
  3. 3Skill filtering stays on
  4. 4Open a fresh session
Tab tabs Enter select Space toggle Esc back
piterminal
> /decisions
SkillsToolsDecisionLab
Skill filteringon
Skills · Max added per round12
Skills · Minimum inventory8
> Review these validation changes for missing edge cases.
Deciding Context
Added 2 of 4 candidates
the advantage

Small prompt. Big collection.

12

new skills per round, at most

0.375

default relevance threshold

8

skills before filtering starts

0

decision calls until you pick a model

Skill bodies never leave Pi Changes advertising, not permissions Tool and MCP filtering, opt-in Decision calls add latency and may incur provider charges
install

Show the model
only what it needs.

$ pi install npm:pi-context-decisions

github.com/championswimmer/pi-context-decisions

Node 22.18+load it earlythen /decisions
pi extension

pi-checklist

Session task checklist with dependencies.

/checklist1/4
k7qDesign schemadone
m2xWire up storeongoing
p9zAdd testsblocked by m2x
r4dUpdate docsplanned
the problem

The plan scrolls away.

A long task is a long scroll. Ten tool calls later, step one is out of sight.

Which task was next?

agent sessioncontext
plan
1 design schema
2 wire up store
3 add tests
4 update docs
read src/store.ts
edit src/store.ts
bash npm run build
read src/tools.ts
edit src/tools.ts
bash npm test
read README.md
edit src/render.ts
bash npm run build
read src/index.ts
edit src/index.ts
bash npm test
read src/commands.ts
edit src/commands.ts
why this exists

The plan lives in the session.

Every change is saved as a snapshot in the session file. Rebuild the list from the branch, last snapshot wins.

session file
user
toolchecklist_createsnapshot
assistant
toolchecklist_updatesnapshot
custom/checklist addsnapshot
toolchecklist_updatelast wins
list rebuilt on
/resume
/branch
/undo
compaction
what it does

Three tools. One live list.

checklist_create

Create, replace or append the session task list.

checklist_read

Read tasks, statuses and what is blocked.

checklist_update

Move tasks: planned, ongoing, done, cancelled.

what you see, below the input box
1/41111
k7qDesign schema
m2xWire up store
p9zAdd tests← m2x
r4dUpdate docs
footer 1/4
how it works

Blocked work stays blocked.

k7qDesign schemadone
dependsOn
m2xWire up storeongoing
dependsOn
p9zAdd testsblocked
agent tool calls
> checklist_update p9z ongoing
task p9z is blocked by [m2x]: cannot move planned → ongoing until every dependency is done
> checklist_update m2x done
checklist (2/3 done)
> checklist_update p9z ongoing
checklist (2/3 done)
plannedongoingdone orcancelled done is terminal
using it

Ask once. Steer anytime.

pi
>/checklist
# every task, in a dialog
>/checklist add Update docs
# add one by hand
>/checklist settings end-of-turn
# quick-set the display
>/checklist clear
# start fresh
display modes
statusbarwidget + footerdefault
widget-onlyno footer
status-minimalfooter only
end-of-turnwidget when a turn settles
hiddenopen /checklist on demand
the advantage

A plan you can both read.

10
tasks per list
5
rows in the live widget
k7q
3
character task ids
4
statuses, one machine
Blocked tasks can't start until dependencies are done.
Survives /resume, /branch, /undo and compaction.
Steer the agent: moderate or aggressive usage.
install

Give your agent
a plan

$ pi install npm:pi-checklist

or from git

pi install git:github.com/championswimmer/pi-checklist

github.com/championswimmer/pi-checklist

/checklist3/3
i01pi install npm:pi-checklist
a02Ask for multi-step work
w03Watch the list fill up
pi extension

pi-subagent-manager

Parallel subagents you can watch and steer.

/agents tree
main  delegating to 3 agents
coderrunningsteer: add tests
researcherdone
revieweridle
the problem

One agent. One thing at a time.

mainsingle queue
Review my last commitqueueddone
Research how retries workqueueddone
Fix the failing auth testqueueddone
Update the docsqueueddone
elapsed 00:00
What is it doing?
Can I nudge it?
Did it finish?

Everything waits its turn, and you can't see inside.

why this exists

Parallel isn't enough.

Handing work off is the easy part. Staying in the loop is what makes it useful.

Watch

See any agent live in a nested tree.

Steer

Give a running agent more direction.

Resume

Pick up a finished agent's conversation.

what it does

Just ask pi to delegate.

pi
> Have a reviewer check my last commit while a researcher looks up how this repo handles retries.
reviewerrunning
researcherrunning

fork:

Shares your current conversation.

fresh:

Starts clean, no history.

Agents run detached. You keep working.

how it works

Spawn, run in parallel, report back.

mainagent_spawn ×3 coderrunning researcherrunning architectdelegating taskerrunning Only architect delegatesamong bundled roles. wait: false, then agent_wait
agent_spawnagent_waitagent_steeragent_statusagent_stopagent_output
using it

Start one. Watch it. Steer it.

pi
$/agents tree
$/agents fork:coder fix the failing auth test
↑↓ select
Enter watch
i steer, stop, output
Esc back
Ctrl+Q main
watching coder
editing tests/auth.test.ts ...
running tests ...
Steeradd tests
Enter sends it. A finished agent resumes.
six bundled roles

The right helper for the job.

architect

Plans, tradeoffs, coordinating helpers

coder

Implementation and debugging

researcher

Codebase and web research

reviewer

Finding correctness and security issues

tasker

Small jobs and quick lookups

writer

Drafting and editing prose

Open /agents types to change a role's model, tools or instructions. Or add your own.

the advantage

Delegate more. Lose nothing.

16
agents running at once
3
levels of nested delegation
64
retained threads

Default limits, shared across the whole tree. Change them in /agents.

off

Plain pi. No uninstall.

opportunistic

Delegates only big or parallel work.

orchestration

Main agent coordinates, workers execute.

get started

Put a team behind your prompt

$ pi install npm:pi-subagent-manager

github.com/championswimmer/pi-subagent-manager

Requires pi 0.99.2+. MIT license.

pi extension

pi-background-monitor

Long-running tmux jobs, logs and selective alerts

/bgmon list
buildnpm run buildrunning
testsnpm testdone
logstail -f app.logfailed
watch/error|failed/
wake-up
the problem

Long commands stall your agent.

Pi waits for the build to finish, or keeps asking "done yet?" while the error scrolls by.

meanwhile, in your terminal00:00
buildnpm run build
failed
piblocked / polling
tailtailtailtailtailtailtaillate
why this exists

Don't poll.
Get called.

Keep builds, tests, servers and tail -f running while Pi keeps working. Hear back only when output matches, or the job exits.

run watch wake
what it does

Five tools. One slash command.

bgmon_start

Run a build, test suite, server or tail -f in the background.

bgmon_inspect

List jobs, read output, page through retained history.

bgmon_watch

Get called on contains, regex, exit or any.

bgmon_control

Stop a job, forget it, or free its logs.

bgmon_events

Review or clear this session's alert history.

/bgmon

Pick a job and read its log, read-only.

how it works

A watch on every line of output.

Pikeeps working tmux jobprivate server journal8 x 1 MiB, bounded watch/error|failed/ deliveryui, nextTurn, wake bgmon_startbgmon_inspectbgmon_watchbgmon_events alert carries metadata only. Pi reads the log to see why.
using it

Just ask.

pi
youRun npm run build in the background. Wake me if the output matches error|failed.
pibgmon_start command="npm run build" id="build"
pibgmon_watch action="add" monitorId="build" kind="regex" pattern="error|failed" flags="i" from="retained" delivery="wake"
piRunning in the background. I'll keep working.
wakewatch fired on build
pibgmon_inspect id="build" after={sequence:0, offset:0}
piFound the error in the log. Fixing it now.
or drive it yourself
/bgmon

Select a job, view its read-only log. Same as /bgmon list.

/bgmon settings

Tune group limits.

/bgmon stop-server

Stop your session's private server.

you choose how loud

Delivery, dialled to your taste.

uidefault

Shows in your UI. Never enters model context.

nextTurn

Waits for the next run, then tells Pi.

wakebest effort

Can start a turn when Pi is idle.

/bgmon settings
GlobalProjectSession
Maximum running monitors8
Maximum retained monitors16
Ctrl+S saves to Global or Project. Range 1-64.
the advantage

Walk away. Stay in control.

8
journal segments of 1 MiB kept per job
200
lines per inspect page, 16 KiB max
8/16
running / retained jobs by default
Survives Pi shutdown. Jobs normally keep running.
Private tmux server. Your default one is never targeted.
Honest logs. Gaps are made visible, never hidden.
get it

Run it in the background.
Hear back when it matters.

$pi install npm:pi-background-monitor

github.com/championswimmer/pi-background-monitor

Pi 1.5.0+Node 22+Bashtmux 3.2+Linux / macOS

Reload Pi after installing.

your move

pick one.
install it.

terminal
$ pi install npm:pi-gauge
$ pi install npm:pi-context-prune
$ pi install npm:pi-checklist

github.com/championswimmer/pi-<extension>