@specode/pi-last-model-effort
Remember the last thinking effort used by each model in Pi.
Package details
Install @specode/pi-last-model-effort from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@specode/pi-last-model-effort- Package
@specode/pi-last-model-effort- Version
1.0.1- Published
- Sep 4, 2026
- Downloads
- 681/mo · 22/wk
- Author
- specode
- License
- MIT
- Types
- extension
- Size
- 30.9 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-last-model-effort
A small Pi extension that remembers the most recently used thinking/reasoning effort for each model and restores it when you switch back.
Why
Different models often work best at different reasoning levels. Pi can configure defaults, but switching among several models still means repeatedly adjusting the thinking level. This extension turns the last effective level used by each model into a lightweight, cross-session preference.
Features
- Remembers thinking effort independently for each
provider/modelpair. - Restores the remembered effort when returning to a model.
- Restores the most recently selected model in a fresh Pi session.
- Preserves the target session's model and effort for
pi -c,/resume, fork, clone, and reload flows. - Respects explicit
--model,--provider, and--thinkingCLI options. - Respects
enabledModels,--models, and effort values pinned by scoped model entries. - Uses Pi's native
setThinkingLevel()behavior, so unsupported levels are safely clamped to the model's capabilities. - Supports concurrent Pi processes with locked, merged, and atomic state updates.
- Works in TUI, RPC, JSON, and print modes.
- Ignores Pi processes marked with
PI_SUBAGENT_CHILD=1, preventing fixed subagent effort levels from changing the main-session preference.
Installation
Install from npm:
pi install npm:@specode/pi-last-model-effort
Try it for one run without installing:
pi -e npm:@specode/pi-last-model-effort
You can also install directly from GitHub:
pi install git:github.com/specode/pi-last-model-effort
Restart Pi after installation. No configuration is required.
Behavior
| Situation | Behavior |
|---|---|
Fresh pi session or /new |
Restores the most recently selected model and its remembered effort |
| Switch or cycle models | Restores the target model's remembered effort |
pi -c, /resume, fork, clone, reload |
Keeps the session's own model and effort |
| Explicit CLI model or effort | CLI selection takes precedence |
| Scoped model with a pinned effort | Scoped effort takes precedence |
| Model unavailable or authentication missing | Keeps Pi's current selection and reports a warning |
The effective level after Pi clamps it to the model's capabilities becomes the new remembered value.
State
State is stored outside your settings and session files:
~/.pi/agent/state/last-model-effort.json
The location follows Pi's configured agent directory. Set PI_LAST_MODEL_EFFORT_STATE to override the exact file path, mainly for testing or isolated environments.
The extension does not modify Pi's modelThinkingLevels setting and does not make network requests.
Compatibility
The extension uses Pi's public extension APIs and has been verified with Pi 0.84.3. It declares @earendil-works/pi-coding-agent as a peer dependency, as recommended for Pi packages.
Development
Run the tests:
npm test
Verify that Pi can load the extension:
npm run smoke