pi-focus
v1.0.1
Published
Pi Coding Agent extension: /focus command for distraction-free TUI mode. Hides tool calls, thinking blocks, and shows a compact widget overlay.
Downloads
285
Maintainers
Readme
pi-focus
Pi Coding Agent extension that adds /focus command for a distraction-free TUI mode.
Features
| Feature | Focus ON | Focus OFF | |---------|:--:|:--:| | Tool call rows | Completely hidden | Normal display | | Thinking blocks | Stripped from scrollback | Normal display | | Widget overlay | ⚡ N thinking · M tools | Hidden | | Status indicator | ● Focus | Hidden | | State persistence | Remembers across sessions | - |
Install
pi install npm:pi-focusOr manually:
cp index.ts ~/.pi/agent/extensions/focus.tsUsage
/focus Toggle focus mode ON/OFFPi will auto-enable focus on startup if it was ON when you last quit.
How It Works
- Tool hiding: Overrides
ToolExecutionComponent.render = () => []viaprocess.nextTickbefore pi's render loop - Thinking hiding: Strips thinking blocks from stored messages via
message_endevent; restored on toggle OFF or for LLM context - State persistence:
~/.pi/agent/focus-state.json - Pi core patch: Automatically adds
globalThis.__pi_ui__torunner.jsfor full auto-enable UI setup (one-time, requires restart)
Requirements
- Pi Coding Agent >= 0.78.0
- Node.js >= 18
License
MIT
