pi-adaptive-thinking is a Pi extension that lets the agent change Pi's thinking level through a tool named set_thinking_level.
It mirrors the user-facing behavior of opencode-adaptive-thinking while using Pi-native APIs: pi.getThinkingLevel(), pi.setThinkingLevel(), and thinking_level_select.
pi install npm:pi-adaptive-thinkingFor local development:
pnpm install
pnpm build
pi -e ./dist/index.jsThe extension registers a tool with these parameters:
level: one of the valid Pi thinking levels for the current model.persist: optional boolean, defaultfalse.
Temporary changes:
{ "level": "high", "persist": false }This changes thinking level for the current agent turn and restores the prior/baseline level when the turn ends.
Persistent changes:
{ "level": "low", "persist": true }This changes the session baseline until another persistent change is made or the user changes thinking level manually.
Configuration files are loaded in this order:
- Project:
.pi/adaptive-thinking.json - Global:
~/.pi/agent/adaptive-thinking.json - Built-in defaults
Project configuration takes precedence over global configuration.
{
"enabled": true,
"quiet": false,
"toolName": "set_thinking_level",
"toolDescription": "Set your thinking level",
"systemPrompt": "You MUST manage thinking level actively. Lower it before trivial or routine turns; raise it for ambiguity, debugging, risky changes, or multi-step synthesis. Reassess at turn start, after meaningful new evidence, and when the task shifts. NEVER leave the current level unchanged by inertia, and NEVER reply to a trivial turn before considering a downshift."
}pnpm install
pnpm format:check
pnpm lint
pnpm typecheck
pnpm test
pnpm buildRun all checks:
pnpm verify