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

@adamjen/pi-agent-turn-limiter

v3.0.1

Published

Warns the pi orchestrator to delegate after 3 turns — prevents getting stuck in endless work loops

Readme

@adamjen/pi-agent-turn-limiter

Warns the pi orchestrator to delegate after 3 turns — prevents getting stuck in endless work loops.

The Problem

You give pi a big task. The orchestrator starts working directly — reading files, grepping code, writing content itself instead of spawning specialist subagents. After 20+ turns of the orchestrator doing grunt work, you realize it never delegated anything. It got "in the weeds" and lost sight of its role as an orchestrator.

This is especially bad with local models that have weaker instruction following — they forget their system prompt rules about delegation and just start doing everything themselves.

The Solution

A tiny extension (~80 lines) that counts orchestrator turns. After 3 grace turns (for setup), then 3 working turns without delegating, it injects a warning prompt into the system context. No hard block — just a reminder.

Install

pi install npm:@adamjen/pi-agent-turn-limiter

How It Works

  1. Session starts → detects orchestrator (via subagent tool), status bar shows 🟢 orch: 0/3 grace
  2. Grace turns (1-3) → free turns for setup, reading context, planning
  3. Countdown starts (turn 4+) → shows 🔄 orch: 1/3, 🔄 orch: 2/3...
  4. Orchestrator spawns subagent → counter resets to 0, shows 🔄 orch: 0/3 ✓ delegated
  5. Counter hits limit (turn 6) → status turns yellow: ⚠️ orch: 3/3 — delegate now
  6. Warning injected → system prompt gets: ⚠️ DELEGATION REMINDER: You have used 3 of 3 allowed turns without delegating...

Status Bar

Shows real-time turn count in the pi TUI footer:

🔄 orch: 2/3          # Normal — under limit
🔄 orch: 0/3 ✓ delegated  # Reset after subagent spawn
⚠️ orch: 3/3 — delegate now  # Warning injected (soft nudge)
🔵 turn-limiter: not orchestrator  # Specialist agent (ignored)

Design Decisions

Why no hard block? The orchestrator sometimes needs extra turns for complex coordination. A warning is sufficient — if it ignores the warning, context will run out naturally.

Why orchestrator-only? Specialist agents (researcher, coder, etc.) have their own max_turns from frontmatter. They don't need this limiter — they just run until context runs out.

Why 3 grace + 3 effective? 3 turns lets the orchestrator read context and plan. Then 3 more turns for actual work before nudging delegation. Total: 6 turns before warning.

Pair With

Browse all my pi packages: pi.dev/packages/@adamjen/pi-agent-turn-limiter?name=adamjen

Why This Exists

Built because my local Qwen3.6-27B orchestrator would spend 30+ turns reading files and writing content directly instead of spawning the researcher or coder subagents. After the 5th time I had to manually interrupt it, I wrote this extension. Now it delegates on the first try every time.

License

MIT