npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@narumitw/pi-auto-thinking

v0.1.15

Published

Pi extension that automatically adjusts thinking level from model capability and task difficulty.

Readme

🧠 pi-auto-thinking — Automatic Thinking Level for Pi

npm Pi extension License: MIT

@narumitw/pi-auto-thinking is a native Pi coding agent extension that selects Pi's thinking level for each user task from the active model capability and a deterministic task-difficulty score.

Use it when you want simple prompts to stay cheap and fast, while design, debugging, migration, security, or refactor tasks automatically get more reasoning budget.

✨ Features

  • Automatically selects minimal, low, medium, high, or xhigh before each agent turn.
  • Turns thinking off for models that do not advertise reasoning support.
  • Respects model thinkingLevelMap entries that mark levels unsupported.
  • Uses conservative defaults: enabled, minLevel: "minimal", maxLevel: "high".
  • Avoids extra LLM calls; task difficulty is scored with local deterministic heuristics.
  • Detects likely manual thinking-level changes and pauses automation for a few turns.
  • Adds /auto-thinking commands for status, enable/disable, and explaining the last decision.
  • Shows a compact statusline item after decisions without notifying every turn.

📦 Install

pi install npm:@narumitw/pi-auto-thinking

Try without installing permanently:

pi -e npm:@narumitw/pi-auto-thinking

Try this package locally from the repository root:

pi -e ./extensions/pi-auto-thinking

🚀 Usage

/auto-thinking status
/auto-thinking on
/auto-thinking off
/auto-thinking explain
  • status shows whether automation is enabled, the loaded config path, bounds, and warnings.
  • on enables automatic thinking selection for subsequent user prompts.
  • off disables automation and clears the extension statusline item.
  • explain shows the score, selected level, and matched signals from the last decision.

🧮 How scoring works

The extension scores each prompt locally before Pi starts the agent loop. The base level mapping is:

| Score | Base thinking level | | ---: | --- | | <= 0 | minimal | | 1..2 | low | | 3..5 | medium | | 6..8 | high | | >= 9 | xhigh |

Default weights:

| Signal | Weight | | --- | ---: | | Quick, brief, concise, simple, or equivalent Chinese wording | -2 | | Simple explanation, translation, or summary | -1 | | Implementation, editing, or code-change request | +2 | | Debugging, exception, stack trace, failure, or broken behavior | +2 | | Tests, lint, typecheck, TypeScript, CI, or similar | +1 | | Design, architecture, plan, proposal, or tradeoff work | +3 | | Migration, refactor, compatibility, or breaking-change work | +3 | | Security, auth, secrets, concurrency, transaction, rollback, or data-loss topic | +3 | | Explicit deep reasoning request such as “think hard”, “carefully”, “深入”, or “仔細” | +3 | | Code block included | +1 | | One file path mentioned | +1 | | Three or more file paths mentioned | +2 | | Long prompt | +1 | | Image input attached | +1 |

After scoring, config bounds and model support are applied. For example, with the default maxLevel: "high", a score that maps to xhigh is capped at high.

⚙️ Configuration

Optional config file:

$PI_CODING_AGENT_DIR/pi-auto-thinking.json

When PI_CODING_AGENT_DIR is unset, the extension reads:

~/.pi/agent/pi-auto-thinking.json

Example:

{
  "enabled": true,
  "minLevel": "minimal",
  "maxLevel": "high",
  "respectManualTurns": 3,
  "modelOverrides": {
    "anthropic/claude-haiku-4-5": {
      "maxLevel": "medium"
    },
    "anthropic/claude-opus-4-5": {
      "maxLevel": "xhigh"
    },
    "local/small-fast-model": {
      "enabled": false
    }
  }
}

Supported levels are:

off, minimal, low, medium, high, xhigh

respectManualTurns must be an integer from 0 to 20. When a thinking level changes outside this extension, automation pauses for that many future user prompts. Pi's event does not expose the change source, so this detection is intentionally conservative.

🤖 Model capability behavior

  • If ctx.model is unavailable, the extension selects off.
  • If ctx.model.reasoning is false, the extension selects off.
  • If ctx.model.thinkingLevelMap marks a level as null, the extension skips that level.
  • Pi still performs its own final clamp when pi.setThinkingLevel() is called.

💸 Cost and latency caveats

Higher thinking levels can increase latency and token usage depending on the provider. The default maximum is high, not xhigh, to avoid unexpectedly expensive turns. Use /auto-thinking explain to inspect why a level was selected, or /auto-thinking off to disable automation for the session.

🗂️ Package layout

extensions/pi-auto-thinking/
├── src/
│   └── auto-thinking.ts
├── README.md
├── LICENSE
├── tsconfig.json
└── package.json

The package exposes its Pi extension through package.json:

{
  "pi": {
    "extensions": ["./src/auto-thinking.ts"]
  }
}

🔎 Keywords

Pi extension, Pi coding agent, automatic thinking, reasoning level, task difficulty, TypeScript Pi package, npm Pi extension.

📄 License

MIT. See LICENSE.