pi-context-preview

extensionmaintained

Pi extension: visual context window utilization preview (/context command)

by · v0.1.3 · published 2mo ago

$ pi install npm:pi-context-preview
downloads/mo
78
stars
0
last push
2mo ago
open issues
0

Signals

license: MITtestspi manifest: missinginstall size: —deps: 0peer deps: 0

Download trend

817 downloads · last 12 weeks (weekly)

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.

pi-context-preview

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

SymbolMeaning
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