@npm-ken/pi-context0.1.0
Pi extension that lets the agent manage its own context window.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-context
A pi extension that lets the agent manage its own context window. After each turn, pi writes the context to an editable YAML file. The agent can prune, rewrite or annotate items, and pi sends the edited version on the next request.
Install
pi install npm:@npm-ken/pi-context
Usage
It works on its own once installed. The agent is told where its context file is (~/.pi/agent/pi-context/<sessionId>/context.yaml) and gets a context tool with these actions: list, omit, replace, note.
Commands:
/context: edit the context in$EDITOR/context view: read-only view of what the model sees next/context stats: token usage by role and the largest items/context on//context off: turn it on or off for this session
Config
Optional. Put this in ~/.pi/agent/pi-context/config.toml:
enabled = true
compaction = "off" # off | pi (off cancels threshold compaction)
meter = "persist" # persist | latest | off
path = "" # override the context file directory
tool = true # register the context tool
License
MIT