btw — Ephemeral Side Questions, Not Remembered
TL;DR
/btw lets you ask a side question with full context; the Q&A never enters the session — like whispering to your neighbor mid-meeting.
Overview
The classic dilemma: you want to ask something related to the current task but not have it "taken seriously". E.g. while debugging you ask "what's this project's Docker base image?" — sending it directly makes the agent treat it as task context, weighing "the user asked about Docker" on every later turn. @piex-dev/btw's answer: the question never goes to the agent. The extension takes a session snapshot, makes a side model call, and shows the answer. Nothing is left in the session.
How it works
Core mechanism: side call. The extension bypasses the agent loop and uses pi-ai's completeSimple for a one-shot request. Since the Q&A never enters the session, "anti-pollution" shifts from runtime filtering to an architectural guarantee: there's nothing to filter.
/btw cmd → resolve model & creds → build snapshot (≤40K chars)
→ completeSimple(model, { systemPrompt, messages })
→ render answer into a Markdown pager (scrollable, interruptible)
→ no write to the sessionThe snapshot is a compressed summary (only user/assistant messages, toolCall kept as name(args), truncated from the head past 40K chars). A dedicated model can be configured (~/.pi/piex-dev/btw/btw.json) — side questions rarely need a flagship model. Waiting shows a BorderedLoader (Esc aborts), the answer a homegrown Markdown pager (j/k scroll, PgUp/PgDn, Home/End, progress %).
Usage
Install
pi install npm:@piex-dev/btwSource: extensions/btw
Usage
/btw what's this project's Docker base image?The answer shows in the pager; after closing, the session is untouched.
Configuration
~/.pi/piex-dev/btw/btw.json:
{ "model": "anthropic/claude-haiku-4-5", "thinkingLevel": "low" }Falls back to the current session model if unset. Config is re-read each question, no /reload needed.
Verify
pi -e ./extensions/btw/src/btw.ts -p "what is 1+1" --no-sessionImplementation
~700 lines, single file. Core modules: /btw command, loadCompleteSimple (compatible with pi-ai 0.79 root export and 0.80 /compat subpath), resolveBtwModel (config→current-model fallback + cred check), buildConversationContext (compressed snapshot), completeSideQuestion (AbortSignal), BtwAnswerPager (Markdown scroll reader).
| omp btw | btw (piex) |
|---|---|
| engine-level side call | completeSimple side call |
| never writes to session | same (architectural guarantee) |
| Bun runtime | Node.js (pi) |
Design notes
| Project | Mechanism | piex choice |
|---|---|---|
| pi-extensions pi-btw | completeSimple side call + session snapshot + settings file + loader/pager UI | Adopted the overall architecture, keeping piex's arg-less interactive input; pi-ai 0.79/0.80 compat loading reused directly |
Changelog
Roadmap
| Direction | Plan |
|---|---|
| Snapshot lacks system prompt & full tool results | selectively carry by relevance (e.g. always keep the last toolResult full text) |
| No multi-turn follow-up | add an input line in the pager; follow-up carries the prior turn (still no session write) |
| Model config hot-update | add a /btw model quick config command |
Version history
| Version | Date | Changes |
|---|---|---|
| 0.1.0 | 2026-07-19 | inject + filter architecture: [BTW] question injected into the main agent loop, tools disabled by prompt, later filtered via a context hook guessing "skip next assistant" |
| 0.2.0 | 2026-07-21 | side-call architecture: completeSimple one-shot request + ≤40K session snapshot, Q&A never writes to session; adds btw.json dedicated model/thinking level, interruptible loader, Markdown pager |
0.1.0 lesson: "pollute first, clean later" is hard to do strictly in an async message stream — when an assistant reply carries a toolCall sequence the filter guess misaligns and leaks; when the agent is busy, queued messages let the btw marker land on the wrong turn. 0.2.0 switches to "don't produce pollution", and the whole class of boundary issues vanishes.
Source Markdown: docs/packages/btw.md