@kvidzibo/pi-extension-manager
Inspect Pi extension context and estimated tokens; enable or disable extensions.
Package details
Install @kvidzibo/pi-extension-manager from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@kvidzibo/pi-extension-manager- Package
@kvidzibo/pi-extension-manager- Version
1.4.0- Published
- Nov 27, 2026
- Downloads
- 1,029/mo · 213/wk
- Author
- kvidzibo
- License
- MIT
- Types
- extension
- Size
- 50.7 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
Pi Extension Manager
See which Pi extensions contribute context, inspect their content and estimated
tokens, and enable or disable extensions with /pi-extensions. A compact
table of tool-definition and prompt estimates appears at startup.
npm · GitHub · Pi package gallery
Install
Requires Pi 1.4.0 or newer and Node 22.19 or newer.
Install from npm:
pi install npm:@kvidzibo/pi-extension-manager
Restart Pi to see the table, or /reload to load the command in an existing
session. The table prints once at interactive startup, not on /new or /reload.
Both views are interactive-only; print/JSON/RPC modes remain quiet.
Inspect context
Run /pi-extensions, type to search by extension, tool, or source path, and
select a source to see its contributions. Select a contribution to inspect the
exposed text or JSON. Arrow keys scroll; Home/End jump within content. Escape
returns one level, preserving the search and selection. Page Up/Down page through
content in regular mode; Pi reserves them for the transcript in fullscreen.
Fullscreen also supports clicking list items and scrolling with the mouse.
Navigation follows Pi's configured keybindings.
- After a model request, the inspector shows the last observed request at this
extension's
context_with_systemhook: declarations after loadout rewrites, instructions, tool calls/results, and conversation messages. Later hooks and provider conversion may still change that snapshot. - Before a request is observed, it shows registered definitions before loadout, the current system prompt, and resolved branch messages, respecting compaction and context edits. Session starts, tree navigation and compaction reset the observed snapshot. Run another model turn to observe a fresh request.
- Tool content is grouped by its current registered source/name, not historical ownership. Nested tool results are visible only in the outer result's content.
- Unattributed / shared context contains the combined system instructions, custom messages and ordinary conversation. Pi exposes no reliable ownership for arbitrary prompt injections. Sources with tools or commands can be listed; instruction-only extensions without either may be absent. Absence or “none observed” does not mean zero context.
Context by tool
The first entry, Context by tool, regroups the same snapshot per tool name: definition, calls and results, with a bar, the share of the known total and the number of calls still in context. Use it to spot a tool that keeps adding content.
- Custom messages follow, grouped by
customTypewith their message count. Pi does not expose which extension injected them. - System instructions and ordinary conversation are listed last.
- Select a row to list its contributions. Only the inspected snapshot is counted, not content already compacted away.
Inspection adds no model-facing tools or messages. Request snapshots stay in memory only; they are not saved by this package. Content may be sensitive. Terminal controls are shown as escapes and image data is omitted explicitly.
Enable or disable extensions
In the source list, move to and press Space on a [x] / [ ] entry to disable or enable
that extension. The change is saved to your user settings.json immediately and
applies after /reload or a restart. Disabled extensions stay listed so they can
be re-enabled.
- Entries are the same
+path/-pathfilters thatpi configwrites, so both tools can be used interchangeably. Re-enabling removes the-pathfilter, or adds+pathwhen a broader exclusion still applies. - Each change is checked against Pi's resolver. If it would not take effect or
would change another resource (for example a single-file package, or one
extension of a package filtered with
[]), it is undone and reported. - Only extensions from user settings have a checkbox. Use
pi configfor built-in extensions, project settings, skills, prompts and themes. - This extension has no checkbox: disabling it would remove the menu. Use
pi configorpi removeinstead. - Space toggles in this list, so searches there cannot contain spaces.
What the numbers mean
All token counts are estimates: serialized characters / 4, rounded up per contribution—not a model tokenizer, actual context usage, or billing. They count exposed text/JSON, not provider framing. Image token costs are unavailable. Known subtotals exclude unavailable costs and are not complete per-extension or request totals. Repeated instruction/tool updates may be represented differently by different providers.
The startup table is a historical snapshot with two blocks:
- Extension tools: active extension tool definitions, including registered
prompt guidelines, before loadout rewrites. Catalog-only codemode costs are
n/abecause Pi does not expose its inline catalog budget. - Prompt context: the system prompt at startup, split into each loaded context
file (
Globalfor files in Pi's agent directory,Projectotherwise), the skills list, and the remaining base prompt and rules, plus active core tool definitions. Rules already counted with a tool definition are not counted again.
Startup context adds both blocks. It excludes what is only known later: skills contributed by extensions, prompt sections and messages that extensions inject per turn, and the conversation. Each block shows up to eight rows; totals cover all rows, and unknown sources are counted separately. The inspector has no source cap.
The startup table is a native custom session entry, outside model context.
Development
npm ci --ignore-scripts
npm test
npm pack --dry-run --ignore-scripts
pi -e ./index.ts
Tests cover attribution boundaries, estimates, safe content inspection, toggling, native
menu navigation/layout, and manifest loading through Pi's real extension loader.
Validate the running table and inspector against Pi's built-in menus in regular
and fullscreen modes, including search, drill-down/back, scrolling, narrow
terminals, resizing, and /reload.
Publishing
Merges to main trigger .github/workflows/publish.yml. It runs the tests, then
publishes a new package version publicly with provenance using npm trusted
publishing (OIDC). Already-published versions are skipped; registry/auth failures
stop the job. Bump package.json and the lockfile together for each new release.
One-time setup
The package must exist on npm before a trusted publisher can be configured:
- From an authenticated checkout, run
npm ci --ignore-scriptsandnpm publish --access publiconce to create the package. - In npm package settings → Trusted publishing, add GitHub Actions:
- Organization/user:
kvidzibo - Repository:
pi-extension-manager - Workflow filename:
publish.yml - Allow direct
npm publish; leave environment unset.
- Organization/user:
- Merge a version bump to
mainto validate the trust relationship within npm's two-day window. Later new-version merges publish without an npm token.
See npm trusted publishing.
The pi-package keyword enables Pi gallery discovery after npm publication;
no separate Pi registry upload is required.