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-lean-edit

v0.3.6

Published

Safer, cheaper edits by verifying prior reads in the harness instead of the prompt. Lets the harness verify the model already read the latest text it wants to edit, avoiding old-text replay and hash-decorated reads.

Readme

pi-lean-edit

Safer, cheaper edits by verifying prior reads in the harness instead of the prompt.

Formerly pi-smart-edit.

pi-lean-edit lets the harness verify the model already read the latest text it wants to edit, reducing stale-edit failures without resending old text in edit requests and without the per-read overhead of hash-decorated output.

Install or test

Install permanently:

pi install npm:pi-lean-edit

Test without installing permanently:

pi --no-extensions -e npm:pi-lean-edit

To load it alongside your normal setup:

pi -e npm:pi-lean-edit

Tools

read

{ path: string; offset?: number; limit?: number; columnOffset?: number; columnLimit?: number }

Only path is required. For normal reads, use path alone or offset/limit for a line range. Use columnOffset with columnLimit only for a huge single-line window; omit limit or set limit=1. Shows numbered text lines and stores shown ranges as in-memory snapshots for that file. Adjacent line reads merge into wider covered ranges. Adjacent/overlapping huge-line column windows compose into wider column coverage.

edit

type LineRange = { startLine: number; endLine?: number; newText: string };
type ColumnRange = { startLine: number; startColumn: number; endColumn: number; newText: string };

LineRange & { path: string }
// or
ColumnRange & { path: string }
// or either range shape in a batch
{ path: string; edits: Array<LineRange | ColumnRange> }

edit applies one or more non-overlapping inclusive ranges only when the requested text matches text previously shown by read or a failed edit. Column ranges must stay within one source line, but their replacement text may contain newlines. If a range was not read or its text changed, the edit is not applied; for line-range edits, the error returns and snapshots the current target with up to five surrounding lines on each side so the same or a nearby corrected edit can be retried. Text beyond the configured automatic output limits still requires read. Normal-line column reads show the whole line; huge-line column reads can cover matching column ranges. After a successful edit, edited text must be read again before reuse. Line-count-preserving edits keep unaffected later reads valid; line-count-changing edits invalidate them.

Concurrency

Cooperating pi-lean-edit processes in one checkout serialize edit and write mutations per canonical file; different files can still proceed concurrently. Snapshots remain per process, so every subagent must perform its own read before edit. For substantial parallel work, isolated worktrees or disjoint files are still preferable. Shell commands and other tools that do not use this cooperative lock can still race with these operations.

Metrics

Successful edits record saved characters versus exact-text edit payloads. Failed edits increment failure rate. Global metrics persist at ~/.pi/agent/pi-lean-edit/metrics.json by default, or PI_LEAN_EDIT_METRICS_PATH if set.

Show stats:

/lean-edit-stats

Test

npm test

Configuration

Run /lean-edit-settings to configure both collapsed and expanded rendering for read, edit, and write. ctrl+o switches between those two configured views. Each setting accepts:

  • minimal: compact rendering
  • medium: detailed rendering capped at 20 rendered lines
  • full: fully detailed rendering

Collapsed defaults are all minimal. Expanded defaults are read=minimal, edit=full, and write=medium. Settings persist globally in ~/.pi/agent/pi-lean-edit/settings.json.

read output is capped by line and byte limits. Defaults: PI_LEAN_EDIT_MAX_READ_LINES=2000, PI_LEAN_EDIT_MAX_READ_BYTES=50000.