pi-tva-toolbox — Tree · Versions · Alternatives. Session-tree tools for pi, the terminal coding agent.

pi keeps every session as a tree of branches (/tree). These tools rewind, fan out, forget, and move those branches: rewinding a session to its first message, forking one point into several labeled branches, forgetting selected turns on the active branch, and forking a branch into a different working directory.

Requires pi 1.x and Node >= 22.19. The extensions collect no telemetry. Parallel questions in /fork-off use your configured model provider.

Vocabulary: a session tree is the whole history of a session; a branch is one path through it; the active branch is the one the model sees; a turn is one user message and the reply to it; rewind moves the active branch back to an earlier point; fork starts a new branch from a point.

| Extension | Trigger | What it does | |---|---|---| | pi-time-heist | fork, then /heist | Fork a session from any point in its tree into a different working directory | | pi-fork-off | /fork-off | Ask several questions in parallel and continue each answer as a labeled branch | | pi-pluck | /pluck | Forget every turn matching a regex on the active branch (one note appended, nothing cloned or deleted); /unpluck restores | | pi-fresh | /fresh ,/clear | Start a fresh branch at the root of the session, optionally with a label and branch summary |

The whole toolbox, one package:

pi install npm:pi-tva-toolbox

Or any extension on its own — each is published separately on npm:

pi install npm:pi-time-heist
pi install npm:pi-fork-off
pi install npm:pi-pluck
pi install npm:pi-fresh

Or straight from git (the toolbox):

pi install git:github.com/asakin/pi-tva-toolbox

To load only some of the toolbox's extensions, use the object form in your settings:

{
  "packages": [
    {
      "source": "npm:pi-tva-toolbox",
      "extensions": ["node_modules/pi-time-heist/src/index.ts"]
    }
  ]
}

This repo contains four extensions, the umbrella package, and a shared library. Every tool under extensions/ is its own npm workspace and npm package (pi-*), and the root pi-tva-toolbox is an umbrella that depends on all of them, bundles them (bundleDependencies), and points pi.extensions at node_modules/<tool>/src/index.ts. Shared internals live in lib/ (@arielsakin/pi-tva-lib, TypeScript source, a plain runtime dependency of pi-time-heist).

Why an umbrella rather than one package: each tool stays installable and versionable on its own, while pi install npm:pi-tva-toolbox gives the whole set in one step. The pack test (scripts/pack.test.mjs) keeps the two in agreement by checking that every pi.extensions path and every bundled package is inside the umbrella tarball.

In the checkout, npm install symlinks every workspace into node_modules/, so the root's node_modules/... paths resolve to the live sources. Run it before the path-install below.

Do not symlink into ~/.pi/agent/extensions/. Path-install the checkout so pi loads it as a package (no copy; edits are live):

# from the repo root
pi install "$(pwd)"
pi list

pi stores the path relative to ~/.pi/agent/settings.json, so pi list shows a ../../... line followed by the resolved absolute path. That is normal.

Then /reload in pi (or restart) so the listed extensions load.

To reset and redo:

pi remove "$(pwd)"
pi install "$(pwd)"
npm install
npm run check      # typecheck lib/ and every workspace
npm test           # node --test in every workspace, plus the pack test

Extensions are plain TypeScript, loaded by pi through jiti. There is no build step.

To ship a new tool: add the workspace under extensions/, add it to the root dependencies + bundleDependencies, and append its entry path to the root pi.extensions array.

All packages move in lockstep:

npm run version:set 0.1.0   # root, lib, every extension, and every internal pin

Commit, push main, and push tag v0.1.0. .github/workflows/publish.yml checks the tag against the version, runs check + test, then publishes the lib, each extension, and the umbrella via trusted publishing (skipping any package whose version is already on the registry). No tokens, no approvals. Then create the GitHub release.

The first bootstrap publish of every package (0.0.0) is manual, because each package's trusted publisher is configured in its own npmjs.com settings, which exist only once the package does:

  1. npm run version:set 0.0.0 , thennpm ci --ignore-scripts && npm run check && npm test .
  2. npm publish -w lib , thennpm publish -w extensions/<tool> for each extension,

thennpm publish at the root for the umbrella.

  1. On npmjs.com, add the GitHub Actions trusted publisher (this repo, publish.yml ,Allow npm publish ticked) to each package's settings.
  2. Bump to 0.1.0 (npm run version:set 0.1.0 ), updateCHANGELOG.md , commit,

pushmain and tagv0.1.0 , and unpublish the0.0.0 placeholders.

原文来源:github.com