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

pi-turn-limit

v0.1.0

Published

Pi coding agent extension to limit number of turns taken by a model

Readme

pi-turn-limit

Pi coding agent extension to limit the number of turns taken by a model in a session.

Why

Pi agents can run indefinitely, consuming tokens and time, and taking focus. This extension gives you a circuit breaker: when the agent reaches a configurable turn limit, you decide whether to continue or abort.

This is useful for:

  • Interaction — Shorter Time To Next Interaction (TTNI) keeps you in the loop. Focus, clarity, single-tasking mode.
  • Cost control — prevent runaway sessions from burning through API credits
  • Quality control — if an agent needs more turns than expected, something may be wrong with the prompt or task

How it works

The extension tracks turns (agent round-trips) per session. Each new user prompt resets the counter.

| Event | Behavior | |-----------------------|---------------------------------------------------| | agent_start | Counter resets to 0 | | turn_start | Counter increments; widget updates | | Counter reaches limit | User prompted: continue (counter resets) or abort | | No UI available | Silent abort at limit |

When the limit is reached and the user confirms continuation, the counter resets to 0, allowing another round of turns. This repeats — there's no maximum number of continuations.

Configuration

Environment variable

Set PI_MAX_TURNS before starting pi:

# 50 turns
PI_MAX_TURNS=50 pi

# Unlimited — no boundary check fires
PI_MAX_TURNS=unlimited pi

# Default (25 turns)
pi

Runtime command

Adjust the limit during a session with the turn-limit command:

/turn-limit 50        # Set to 50 turns
/turn-limit unlimited # Disable the limit
/turn-limit 25        # Re-enable with 25 turns (counter resets from 0)

Unlimited mode

Setting the limit to unlimited disables the boundary check entirely. The turn counter still increments and the widget still displays , so you retain observability without enforcement.

Switching from unlimited back to a number triggers the LimitReEnabled rule: the counter resets to 0 so the new limit applies from a clean starting point.

Widget

When a UI is available, the extension displays a widget showing Turns: N/M (or Turns: N/∞ in unlimited mode).

Spec

This extension was developed using Allium, a formal language for specifying software behavior. The Allium spec captures the turn counting, limit enforcement, unlimited mode, and re-enable rules:

📄 turn-limit.allium

Contributing

This is an experimental extension. To contribute:

  1. Fork the repository
  2. Make your changes
  3. Contact Willem through qwan.co.uk to discuss your contribution

License

MIT