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

@mcuste/pi-graphite

v0.2.1

Published

Graphite stacked-branch operations as one safe, model-callable tool for the Pi and Oh My Pi coding agents

Readme

pi-graphite

CI npm

Graphite extension demo

An extension for the Pi and Oh My Pi terminal coding agents. It gives the model one graphite tool that runs a fixed set of Graphite stack operations, instead of letting it type gt commands into a shell.

If any of those names are new to you:

  • Graphite (gt) is a Git CLI for stacked branches: many small branches chained on top of each other, each becoming its own pull request.
  • Pi and Oh My Pi are terminal coding agents. An extension is an npm package they load at startup to add tools the model can call.

Why

An agent with shell access can already run gt, but a shell gives it a free-form command string: it can pass flags nobody intended, trigger interactive prompts that hang, publish branches to the remote, or leave the repository half-rebased after a failed command.

This extension replaces that with a closed set of operations. Each one accepts only its own typed fields, builds a fixed argument array, checks the repository before running, and verifies the result afterwards. There is no shell string anywhere, and remote and history-rewriting commands are simply not exposed.

Requirements

  • Node.js 22 or newer
  • Git
  • Graphite CLI (gt) 1.8.6 in repositories where the tool is used

The extension loads even without gt or outside a Graphite repository. A tool call then fails with an explanatory error rather than running an unsupported command.

Install

Pi:

pi install npm:@mcuste/pi-graphite

Oh My Pi:

omp plugin install @mcuste/pi-graphite

Or through the Oh My Pi marketplace:

/marketplace add mcuste/pi-graphite
/marketplace install pi-graphite@pi-graphite

From a local checkout:

pnpm install
pi install /absolute/path/to/pi-graphite
omp plugin link /absolute/path/to/pi-graphite

What the tool does

One tool named graphite, selected by an operation field:

| Operation | Runs | Purpose | | --- | --- | --- | | inspect | gt log, gt state, gt parent, gt children, gt trunk, gt info | Read the stack | | checkout | gt checkout <branch> | Switch to a named branch | | create | gt create | Start a new branch from staged changes | | modify_commit | gt modify --commit | Add staged changes as a new commit | | modify_amend | gt modify | Amend staged changes into the current commit | | squash | gt squash | Collapse a branch into one commit | | fold | gt fold | Merge a branch into its parent | | rename | gt rename <name> | Rename a branch | | move | gt move | Reparent a branch onto another | | restack | gt restack | Rebase a branch onto its parent | | delete | gt delete <branch> --force | Delete a branch | | continue | gt continue | Resume after resolving conflicts | | abort | gt abort --force | Cancel an in-progress rebase |

inspect is read-only. Everything else changes the repository, and Oh My Pi asks for execute approval; delete and abort always prompt. Full per-operation fields and guarantees are in docs/operations.md.

System prompt note

The tool loads on demand, so its description is not in the base prompt and the model can reach for git in a shell before it sees the tool. To close that gap, the extension appends one note to the system prompt at the start of each turn:

This repository uses Graphite so use the graphite tool for branch and stack operations instead of git or gt in bash. The tool does not cover remote or publish operations.

The note is added only in a repository where detection succeeds, only once per prompt, and only in a host that offers the before_agent_start event. A host without that event still gets the tool. Detection failures are remembered for five minutes, so a repository without Graphite does not spawn git and gt on every turn.

What is deliberately missing

  • Remote operations (gt get, gt sync, gt submit) depend on credentials, remote state, and publication intent. Pushing or opening pull requests stays a human decision.
  • Relative navigation (gt up, gt down, gt top, gt bottom) prompts when a branch has several children. The model must inspect the stack and ask for an exact branch instead.
  • History-choosing commands (gt absorb, gt split, gt reorder, gt undo) pick commits or hunks on the caller's behalf.

For these, the model works through the normal Graphite workflow with the user in the loop.

Safety

Every operation checks the repository before and after it runs: a clean worktree stays clean, the checked-out branch is preserved unless the operation is meant to change it, committed content is compared against what was staged, and deleted branches are confirmed gone. A failed check is reported as an uncertain result rather than retried.

Arguments are never concatenated into a shell command. Commit text travels as --message=<text>, so a body starting with - stays message content. See docs/safety.md.

Documentation

License

MIT