@fradser/pi-btw
Side questions for Pi — /btw answers in a read-only overlay, never entering the session history. Unlike Claude Code's /btw, it can actually call read-only tools (read, grep, find, ls) to verify facts in the codebase.
Package details
Install @fradser/pi-btw from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@fradser/pi-btw- Package
@fradser/pi-btw- Version
0.2.8- Published
- Sep 2, 2026
- Downloads
- 1,587/mo · 41/wk
- Author
- fradser
- License
- MIT
- Types
- extension
- Size
- 37.1 KB
- Dependencies
- 1 dependency · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@fradser/pi-btw
Side questions for Pi — /btw <question> answers a quick side question in a full-width
overlay directly covering the main session input area, without interrupting the current task and without ever
entering the session history.
Why btw
Claude Code's /btw answers from conversation context only — it cannot call tools, so
"what does function X do?" gets answered from what the model happens to remember. btw
fixes that:
- Tool-capable. The side question runs in a fresh child Pi process that CAN call
read-only tools (
read,grep,find,ls) to verify facts in the actual codebase. - Strictly read-only. Only
read,grep,find,lsare allowed.bash,edit, andwriteare always excluded — a side question can look, but can never touch. - Zero history pollution. The child runs with
--no-sessionand the/btwcommand is consumed by the extension (never recorded as a session message). The exchange is gone the moment the display clears.
Install
pi install npm:@fradser/pi-btw
Restart pi, then use /btw <question> in interactive mode.
Usage
/btw what does the --force flag do on git push?
/btw where is the retry logic for the API client?
/btw how do we handle pagination in this repo?
The answer appears in a full-width popup anchored to the bottom of the terminal (directly covering the main session input area), with height adapting to the content:
- Spinner while the read-only child answers (same model as your session; override with
the
BTW_MODELenv var, e.g.BTW_MODEL=anthropic/claude-sonnet-4-5). - Multi-turn conversation. Type follow-up questions directly in the overlay input prompt and press
enterto continue the side thread. esccloses (or cancels while loading).↑/↓scroll,pgup/pgdnpage,home/endjump.- Short answers shrink the panel; long answers cap at ~40% of the terminal height and remain scrollable without adding a hidden-line count to the answer.
- The footer shows aggregated token usage and cost for the side conversation.
Mouse-wheel scrolling is not available: in pi's fullscreen TUI the wheel is owned by the chat viewport (pi consumes all mouse events before extensions can see them). If you want the wheel to scroll extension panels, that needs a pi core feature — the package uses keyboard scrolling instead.
The question is answered with the last ~4 user/assistant messages of the current session as compact read-only context (capped at 4000 characters), so it can answer about what you are working on right now — and then verify it against the actual files. Answers are kept concise: the child is instructed to stay within 150 words or 600 characters, use at most five short bullets, and avoid report-style summaries.
Design
| Piece | What it does |
|---|---|
src/spawner.ts |
Spawns pi --print --mode json --no-session with --tools read,grep,find,ls --exclude-tools bash,edit,write; parses the JSONL stream into the final answer + usage. |
src/context.ts |
Builds a compact most-recent-first excerpt of session user/assistant messages (4 messages, capped at 4000 chars). |
src/overlay.ts |
The interactive popup: loading spinner → answer, esc closes, arrows/pgup/pgdn/home/end scroll, height adapts to content (capped at ~40% of the terminal). |
index.ts |
Package-root entry point that loads the extension. |
src/index.ts |
Registers the /btw command and wires context → child process → overlay. |
Requirements
- pi interactive (TUI) mode — the display needs a terminal.
- The same provider credentials as your main session (the child reuses your env).
License
MIT