pi-context-preview
v0.1.3
Published
Pi extension: visual context window utilization preview (/context command)
Downloads
675
Maintainers
Readme
pi-context-preview
A Pi extension that gives a visual preview of how the context window is utilized, inspired by Claude Code's /context command. Model-agnostic, works with any provider Pi supports.

Install
pi install npm:pi-context-previewOr add to ~/.pi/agent/settings.json:
{
"packages": ["npm:pi-context-preview@latest"]
}For development:
pi -e ./extensions/index.tsUsage
/context # default: grid + legend + message breakdown
/context verbose # expand tool calls and results per tool nameHow it works
Token counts are estimated using a character-ratio heuristic (chars / 4) applied to each part of the last provider request payload. The total token count is always sourced from Pi's own API-accurate tracking; the per-category breakdown is then scaled proportionally to match that total.
Categories
| Symbol | Meaning |
|--------|---------|
| ⛁ | Used — segment ≥ 70% of its grid allocation |
| ⛀ | Used — segment < 70% of its grid allocation |
| ⛝ | Autocompact buffer reserve |
| ⛶ | Free space |
Grid dimensions: 10 × 10 for ≤ 200k models · 20 × 10 for 1M+ models.
Update
pi update npm:pi-context-previewLicense
MIT
