Skip to content

ian-pascoe/pi-adaptive-thinking

Repository files navigation

pi-adaptive-thinking

Bring adaptive reasoning-effort control to Pi agents.

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.

Installation

pi install npm:pi-adaptive-thinking

For local development:

pnpm install
pnpm build
pi -e ./dist/index.js

Behavior

The extension registers a tool with these parameters:

  • level: one of the valid Pi thinking levels for the current model.
  • persist: optional boolean, default false.

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

Configuration files are loaded in this order:

  1. Project: .pi/adaptive-thinking.json
  2. Global: ~/.pi/agent/adaptive-thinking.json
  3. 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."
}

Development

pnpm install
pnpm format:check
pnpm lint
pnpm typecheck
pnpm test
pnpm build

Run all checks:

pnpm verify

About

Pi Coding Agent Adaptive Thinking Plugin

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors