@yusukeshib/pi-agent-controls0.2.0
Give pi agents tools to switch between user-defined model presets, compact context, and resume work safely.
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
@yusukeshib/pi-agent-controls
A pi extension that lets the agent switch between user-defined model presets and manage its context.
The agent can only select presets you configure. Each preset fixes both the model and the thinking level, so the agent cannot pick an arbitrary model or thinking level on its own. Manual /model and Ctrl+P selection are not restricted.
Configure presets
Add presets to ~/.pi/agent/settings.json (or a project .pi/settings.json):
{
"agentControls": {
"presets": {
"orchestrator": { "model": "anthropic/claude-opus-4-8", "thinking": "high", "description": "Planning, design, and review" },
"worker": { "model": "openai-codex/gpt-6.2-sol", "thinking": "low", "description": "Routine implementation" },
"hard-worker": { "model": "anthropic/claude-opus-4-8", "thinking": "low", "description": "Difficult implementation" }
}
}
}
modelmust be an exactprovider/model-idknown to pi.thinkingis one ofoff,minimal,low,medium,high,xhigh,max.descriptionis optional and is shown to the agent.
Invalid presets are ignored and reported with a warning. Presets are read when a session starts; run /reload after editing them.
Tools
get_preset
Returns the current model, effective thinking level, the matching preset (or custom), and the configured presets.
set_preset
Switches the model and then the thinking level to a configured preset for subsequent model calls. The preset name is a closed enum of configured presets. The tool reports the effective thinking level if pi clamps it, and warns when the current context exceeds the new model's context window. It is hidden when no presets are configured.
compact_context
Starts context compaction, optionally activates a preset (preset_after) afterward, and resumes the session with an explicit continuation prompt. If compaction fails, the continuation is still sent with the error so work can continue without retrying compaction.
The agent is instructed to call this tool by itself because compaction terminates the originating turn, and to persist any exact state that must survive lossy compaction first.
Install
pi install npm:@yusukeshib/pi-agent-controls
# or from git
pi install git:github.com/yusukeshib/pi-agent-controls
Reload pi after installation if it is already running:
/reload
Migrating from 0.1
get_thinking_level, set_thinking_level, and compact_context's thinking_level_after were removed. Configure presets and use get_preset, set_preset, and preset_after instead.
License
MIT