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

@lpirito/pi-diffloop

v0.0.30

Published

Pair programming with Pi, be aware of every change made to the codebase.

Downloads

777

Readme

diffloop

diffloop is a Pi extension that slows down the agentic coding workflow on purpose by presenting each code change to the developer, with a reason attached to it.

diffloop review UI

What it does

This extension intercepts Pi edit and write tool calls and replaces the default fire-and-forget flow with an interactive review step.

For each proposed file change, diffloop:

  • can require a reason (captured through set_change_reason; optional via /diffloop-reason off)
  • shows a preview before execution
  • lets you:
    • approve the change
    • steer the change with an inline prompt
    • edit the proposal before execution
    • deny the change

Installation

pi install npm:@lpirito/pi-diffloop

Why use it

When working with coding agents, I kept running into two extremes:

  • I write a long markdown file full of rules, conventions, and constraints, hoping the agent will stay aligned.
  • I prompt for a bugfix or feature and wait for the result, only to receive a large batch of changes all at once.

Both approaches can work, but they often come with the same problem: context loss.

The agent may go further than expected, touch more files than intended, or make reasonable local decisions that drift away from what you had in mind. By the time it returns, you are no longer reviewing a small decision, you are reconstructing a chain of reasoning that is not your own.

That is the problem diffloop is "meant" to solve.

It intentionally slows the workflow down so you can stay close to the agents decisions, review changes as they are proposed, and understand both what is changing and why before the change is applied.

A note on usage

diffloop is still an experiment for me, and Im grateful to Pi for providing such solid tools to explore ideas like this.

That said, constant review can become its own kind of fatigue. If every step requires approval, there is always the risk of falling into the habit of pressing "Accept" without really reviewing the change.

Im still exploring whether this kind of intentional slowness has a real place in agentic coding workflows, especially for developers who want to stay close to the code without losing context.

Ideas, feedback, and criticism are all welcome 😁

Review flow

When the agent proposes an edit or write:

  1. diffloop intercepts the tool call
  2. it builds a preview of the change
  3. it opens a review UI
  4. you choose one of the available actions

Configuration (optional)

diffloop supports configuration via a global config file and a module-level fallback.

Config locations

| Location | Path | Purpose | |---|---|---| | Global | ~/.pi/agent/extensions/diffloop-config.json | User-wide defaults (applied first) | | Module | diffloop-config.json next to the installed package | Overrides global config |

Global config is loaded first, then module config is shallow-merged on top (module wins for any key it contains). The reviewScope key is replaced entirely if both files define it. If neither file exists, diffloop uses its built-in defaults.

Config keys

| Key | Type | Default | Description | |---|---|---|---| | enabled | boolean | true | Whether review is enabled | | requireReason | boolean | true | Whether the agent must call set_change_reason before each edit/write | | diffViewMode | "split" or "inline" | "split" | How the diff preview is rendered | | reviewScope | object | {} | Scope review to specific files/patterns |

reviewScope shape

When present, reviewScope controls which files are reviewed:

{
  "enabled": true,
  "requireReason": false,
  "diffViewMode": "inline",
  "reviewScope": {
    "includePatterns": ["*.ts", "*.tsx"],
    "excludePatterns": ["**/*.snap"],
    "includeExtensions": [".ts", ".tsx"],
    "excludeExtensions": [".lock"]
  }
}

Out-of-scope paths bypass diffloop review and run through Pi's normal tool execution.

Agent prompt behavior

This extension does not re-register the edit and write tools.

Instead, it registers a small helper tool called set_change_reason and prompts the agent to call it before each edit/write proposal.

It pushes the agent to provide reasons that are:

  • specific
  • grounded in existing code or repository patterns
  • explicit about behavior impact
  • not generic prose

Slash commands

/diffloop off
/diffloop on
/diffloop toggle
/diffloop status

/diffloop-reason off
/diffloop-reason on
/diffloop-reason toggle
/diffloop-reason status

/diffloop-reason controls whether the agent must call set_change_reason before each edit/write. It defaults to on. Turn it off when using local models that struggle with the extra tool step.

Development

npm install
npm run build
npm run typecheck