@arcanemachine/pi-context-available

Show the current Pi context usage and capacity to the agent

Packages

Package details

extension

Install @arcanemachine/pi-context-available from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@arcanemachine/pi-context-available
Package
@arcanemachine/pi-context-available
Version
0.1.1
Published
Sep 4, 2026
Downloads
278/mo · 23/wk
Author
arcanemachine
License
MIT
Types
extension
Size
56.4 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ],
  "image": "https://raw.githubusercontent.com/arcanemachine/pi-context-available/main/logo.jpg"
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

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-available

From GitHub:

pi install git:github.com/arcanemachine/pi-context-available

For local development:

pi -e ./src/index.ts

Tool

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 | unknown

There 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-run

Pi loads src/index.ts directly; no compiled runtime artifact is required.

License

MIT. See LICENSE.md.