pi-repeat-tool-guard

Pi extension that appends system reminders to repeated tool call results.

Packages

Package details

extension

Install pi-repeat-tool-guard from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-repeat-tool-guard
Package
pi-repeat-tool-guard
Version
0.1.0
Published
Jun 9, 2026
Downloads
not available
Author
kingwl
License
MIT
Types
extension
Size
29.5 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-repeat-tool-guard

Reduce repeated tool calls in Pi.

pi-repeat-tool-guard is a Pi package for people who see the model repeatedly calling the same tool with the same arguments. It keeps your normal Pi workflow unchanged, but gives the model a clear reminder when it appears to be stuck in that loop.

Use it when you want Pi to:

  • notice repeated read/search/shell-style calls,
  • reconsider the latest tool output before trying again,
  • choose a different approach instead of burning turns on the same call.

Install

Install it globally for your Pi user:

pi install npm:pi-repeat-tool-guard

Install it only for the current project:

pi install npm:pi-repeat-tool-guard -l

If you are installing from the GitHub repository instead of npm:

pi install git:git@github.com:Kingwl/pi-repeat-tool-guard

Use

After installation, start Pi normally:

pi

Pi loads installed packages automatically. You can confirm the package is active from Pi's startup header or by running:

pi list

Configuration

The default behavior works without configuration. By default, the package starts reminding the model after repeated identical calls at counts 3, 5, and 8.

You can adjust the repeat counts:

PI_REPEAT_TOOL_GUARD_THRESHOLDS=3,5,8 pi

Track only selected tools:

PI_REPEAT_TOOL_GUARD_INCLUDE=read,grep,glob pi

Ignore selected tools:

PI_REPEAT_TOOL_GUARD_EXCLUDE=bash,write,edit pi

* can be used as a wildcard in include/exclude values:

PI_REPEAT_TOOL_GUARD_INCLUDE='mcp__*,read,grep' pi

Managing The Package

Update installed Pi packages:

pi update --extensions

Disable, enable, or inspect installed extensions:

pi config

Remove the package:

pi remove npm:pi-repeat-tool-guard

Notes

This package does not reject tool calls and does not ask for extra user confirmation. The tool still runs normally; the model simply receives an extra reminder when it repeats itself.

It is designed as a lightweight Pi extension that you can install, keep enabled, and forget about until a repeated-tool loop shows up.

Reference

This package is inspired by Kimi Code's repeated tool-call protection: