@fractaal/pi-context-window

Portable per-session and per-model context-window budgets for Pi

Packages

Package details

extension

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

$ pi install npm:@fractaal/pi-context-window
Package
@fractaal/pi-context-window
Version
0.1.1
Published
Sep 15, 2026
Downloads
374/mo · 190/wk
Author
fractaal
License
MIT
Types
extension
Size
60.5 KB
Dependencies
1 dependency · 2 peers
Pi manifest JSON
{
  "extensions": [
    "extensions/context-window.ts"
  ]
}

Security note

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

README

@fractaal/pi-context-window

A portable Pi extension that caps the active model's resolved context window. Pi still owns reserve tokens, compaction, overflow recovery, and continuation.

Commands:

  • /context-window shows the current model budget.
  • /context-window 128k sets the current session override.
  • /context-window default clears the session override.
  • /context-window-default 128k sets the current model's global default.
  • /context-window-default default clears that global default.

The session override is persisted in the Pi JSONL. Global defaults are stored in the same profile directory as models.json, using an atomic local JSON file.

Install and embed

pi install npm:@fractaal/pi-context-window

The package root exports the compiled extension factory; /contracts exports the public contracts. Pi discovers the shipped TypeScript entry through pi.extensions. These entrypoints and persisted state formats are unchanged by the repository move.

Development and releases

Run npm run typecheck, npm run lint, npm test, npm run build, and npm run test:installed from the monorepo root. The shared Node tests and isolated installed-package acceptance live in packages/goal-x/tests and are included in those commands.

Use the shared release guide and tag context-window-v<version>. This package has its own version and npm Trusted Publisher, even when released in a batch with its siblings.

Version 0.1.1 imports the unchanged runtime of 0.1.0 from fractaal/pi-goal-x@f74698d6a0eb9f78ff80e7adb01c6a9070010804, without private Git history. The original MIT license is retained.