Skip to content
This repository was archived by the owner on Jul 27, 2026. It is now read-only.

About

Pi Coding Agent Adaptive Thinking Plugin

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

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

Session effort command (fork addition)

This fork adds a user-facing command alongside the agent-facing adaptive tool:

/effort
/effort min
/effort max
/effort off|minimal|low|medium|high|xhigh

Bare /effort opens a model-filtered selector. min and max resolve against the active model's supported levels. A user selection becomes the session baseline; later temporary agent-selected levels still reset to that baseline.

/effort is the sole user-facing model-thinking owner in the proposed stack. pi-dynamic-workflows also registers an unrelated /effort command for workflow orchestration, so do not load both command owners in one Pi profile unless that workflow command is renamed (for example, /workflow-effort).

About

Pi Coding Agent Adaptive Thinking Plugin

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages