@arcanemachine/pi-context-available
v0.1.1
Published
Show the current Pi context usage and capacity to the agent
Maintainers
Readme
pi-context-available
pi-context-available is a Pi extension that gives the agent
a compact, readable view of the current context usage and capacity.
Like this extension? See my other Pi extensions.
Requirements
- Pi 0.84.1 or later
- Node.js 22.19.0 or later for package development
Installation
From npm:
pi install npm:@arcanemachine/pi-context-availableFrom GitHub:
pi install git:github.com/arcanemachine/pi-context-availableFor local development:
pi -e ./src/index.tsTool
The extension registers one read-only tool:
context_available_show
The agent can call this tool without arguments. It reports the active model, thinking level, used context tokens, total context capacity, and usage percentage:
Model: provider/model (thinkingLevel)
Context: 123,456 / 234,000 | 52.8%The slash is used / total capacity; numbers use comma separators. Immediately
after compaction, Pi may not know the current used-token count. In that case,
the tool preserves the known capacity and reports:
Context: unknown / 234,000 | unknownThere is no user-facing slash command because Pi already displays context statistics to the user.
Development
npm install --ignore-scripts --workspaces=false
npm run format:check
npm run typecheck
npm run test
npm run build
npm pack --dry-runPi loads src/index.ts directly; no compiled runtime artifact is required.
License
MIT. See LICENSE.md.
