pi-context-preview
Pi extension: visual context window utilization preview (/context command)
Package details
Install pi-context-preview from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-context-preview- Package
pi-context-preview- Version
0.1.1- Published
- Jun 2, 2026
- Downloads
- not available
- Author
- offbynan
- License
- MIT
- Types
- extension
- Size
- 28.5 KB
- Dependencies
- 0 dependencies · 4 peers
Pi manifest JSON
{
"extensions": [
"./extensions"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
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-preview
Or add to ~/.pi/agent/settings.json:
{
"packages": ["npm:pi-context-preview@latest"]
}
For development:
pi -e ./extensions/index.ts
Usage
/context # default: grid + legend + message breakdown
/context verbose # expand tool calls and results per tool name
How 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-preview
License
MIT