Packages

What each package offers across the install boundary (its config files, commands, tools, environment variables, bus channels, wires and exports), with each item’s tier, is the public surface page.

Ours (developed here)

Only @gadhs/pi is published (#836). The ten sibling packages below are private workspace packages (private: true) that move in lockstep with `@gadhs/pi’s version and are bundled into it at pack time.

Package Purpose

@gadhs/pi

The distribution. pi install npm:@gadhs/pi gives a developer everything below with agency defaults. Ships each extension below as a generated shim beside one bundle holding everything it runs, the third-party extensions and their dependencies included (#801; architecture says what each is and why). It has no dependencies of its own: three packages loaded as files are copied into it, and everything is built in from the lockfile’s versions. Load order is the explicit list of shims in the package’s pi.extensions. Two places are load-bearing. Modes goes first: it seeds the permission config before that system reads it. Agents goes before subagents: it seeds the agent files before pi-subagents builds the subagent tool’s list of them, once, in its factory (#438). pi loads a listed file in list order, but would enumerate a listed directory in whatever order the filesystem returns (#441). The third-party extensions are built from a file inside each package (extensions.json names it; their exports maps expose service APIs, not factories): an update that moves the file fails the build.

@gadhs/pi-vertex

Every publisher on Google Cloud Vertex AI — Claude through the Anthropic SDK, Gemini through pi’s own Vertex adapter, the Model-as-a-Service models Vertex serves through its OpenAI-compatible endpoint (Grok, gpt-oss, and the open models Google hosts) — as three provider ids from one config file (ADR-005). Per-model region routing (quota and availability are granted per (model, region) — no single region serves every model), static JSON catalog, ADC auth throughout with no login. Ships probe.mjs so each team discovers which (model, region) pairs return a real HTTP 200 for their project, kind by kind. Published as @gadhs/pi-vertex-anthropic through 0.6.0.

@gadhs/pi-modes

The policy layer: four modes with per-mode models and rules, the deterministic permission stages, the safety-only judge, subagent contracts, the status line and inline traces. Depends on @gadhs/pi-guidance for prompt composition and publishes the observability bridge the workflow guards render through. Reference · cookbook.

@gadhs/pi-workflow

Delivery-workflow enforcement, mode-independent by design (yolo included): commit format and mechanical attribution, --no-verify refusal, stage/commit separation, glab’s stored login kept out of reach, SPDX-at-write, debt markers, setup-drift warnings, and the independent cold-reader review of every commit and every plan — a reviewer that reads the candidate snapshot within a budget and whose flagged findings the author answers in the commit message. Decisions are standalone; rendering flows through pi-modes' bridge when present and no-ops when not. One bridge member runs the other way: planReviewed tells pi-modes the outcome of each plan review so the approval pane can show it beside the plan it reviewed. Every read of the checkout goes through @gadhs/pi-workspace (#491), so a remote session’s commits are guarded on the SSH host. The decisions are pure functions over facts that one async shell per module gathers.

@gadhs/pi-guidance

Agency standards as content: the working-agreements digest, four language profiles (Rust, TypeScript, Python, Java), the composition seam that injects them each session, and the /gadhs-init AGENTS.md skeleton. Split from pi-modes under ADR-004 so a wording change gets prose review and ships without version-bumping the judge. The session handler stays in pi-modes (composition interleaves the mode addendum and memory in one idempotent pass); the dependency points policy→content as a version range, never the reverse.

@gadhs/pi-agents

Agency-standard subagent definitions (Explore on Gemini 4 Hydrogen, argued on the model-battery page; Research on Sonnet 5.5; and general-purpose, on the session’s model under the parent’s prompt, packaged so that it carries count and codemode — only an agent file’s tools: admits a capability tool, and pi-subagents' built-in named neither, #736 — and returns a checked result, #895), seeded as managed files into the global agents directory — pi packages cannot ship agent definitions and the subagents extension has no registration seam (upstream request #35), so seeding is the delivery. Absent files are written; files carrying the gadhs_managed marker update with the package; files without the marker are never touched (delete the marker line to own a file forever). Every write is announced at session start. Each prompt states the helper’s role first and its result’s shape last; the paragraphs all three end with (batch reads in one codemode script, finish through yield, the error form, what to do when the turn budget runs low) live once, in agents/shared/finish.md, and are spliced in where a file marks them, when it is seeded — a seeded file holds the whole prompt (#896). One operator file: ~/.pi/agent/gadhs-pi-agents.json names a different model or turn cap per helper, applied when the seed is rendered so the file stays managed (recipes: model, turn cap).

@gadhs/pi-remote

pivot’s box side: /remote-control hands the running session to a paired phone through a DHS relay — the phone follows it live, sends prompts, stops turns, and answers the asks the distribution owns through pi-modes' ask broker. End-to-end encrypted with @gadhs/pivot-wire (published from pivot’s own project); no daemon. Several pi sessions on one box share one link through a local hub. Working remotely.

@gadhs/pi-bash

The bash parser the enforcement packages read commands with: tree-sitter-bash through web-tree-sitter, at the permission engine’s own ranges. It offers three views over one parse: pi-workflow’s guards use the structure (argv, wrappers, redirects, inert heredocs); pi-modes' rules use the line (every command and pipeline, and whether the line is one command) and plain-line commands. Each view caches recent results in a bounded LRU scoped to the active parser generation, returning isolated clones so repeated calls for the same bash command reuse one WASM parse (#964). One wrapper table serves them all. A library, not an extension: no loader, reached through pi-modes, pi-shellcheck and pi-workflow as a regular dependency (ADR-004, amended for #206).

@gadhs/pi-workspace

The workspace seam (#489, ADR-006). One Workspace interface for the files and processes of the directory pi works in, a local implementation, and the globalThis slot a remote implementation (pi over SSH, #488) publishes itself in. The slot holds one workspace per anchor (#492): workspaceFor(cwd) is the call, and the longest anchor or root holding cwd wins, so a helper’s worktree, published under an anchor inside its parent’s, is the helper’s. Workspace.at(root, anchor) gives a view on the same host over the same connection. An optional Workspace.clientPath(path) gives back a path as this machine’s tools spell it in the host’s terms: the SSH workspace on a Windows client maps its tool letter, so count reads Z:/srv/app/x as read does (#543). appendFile appends, and with at only when the file is that many bytes long, refusing with ECONFLICT otherwise; readRange reads part of a file, digest hashes part of one and utimes sets its modification time, so a file kept in step on two hosts moves by its tail and keeps the time of its last use (#915). An optional Workspace.hostPi() names pi’s agent directory and the host’s name on a remote host. The allowlist of what of this machine’s environment reaches a remote command (sessionMarkers) lives here too, as does the one copy of the pinned-binary download that checks a release asset’s SHA-256 before anything runs it, and checks a kept copy against the SHA-256 recorded beside it before each use (pinned-binary.ts: rg and fd on a remote, shellcheck; #690). @gadhs/pi-workspace/contract is the suite every implementation must pass. Its programs are node -e scripts (#542), so the exec and spawn cases (exit codes, streams, stdin, cwd, env, timeouts, aborts, the output cap, the #497 tree kill) run on Windows too; only what is POSIX itself (permission bits, a FIFO, a TERM-ignoring child, a kill’s signal name, a link loop’s ELOOP) and what needs links (CAN_SYMLINK) skip, each by name. A path through a file is ENOTDIR on a POSIX host and missing on Windows, as each reports it (#552). A library: no loader. pi-ssh publishes the SSH workspace on its slot. pi-workflow’s whole commit path reads it (#491), and so does all of pi-modes that touches the workspace: containment (#498), the judge’s facts, language detection, count, generate_image, monitors and helper worktrees (#492).

@gadhs/pi-ssh

pi over SSH (#488, ADR-006). It contains:

* helper.mjs, a single-file Node helper uploaded over the same ssh connection and named by its hash. The remote needs Node 22. * A newline-JSON protocol on the helper’s stdin and stdout. * connect, which refuses with the reason: ssh, host key, no node, an old node, another protocol. * sshWorkspace, the SSH implementation of Workspace, held to the local one by the same contract suite.

* @gadhs/pi-ssh/extension, pi’s seven tools and ! on the workspace’s host (#490). It switches per call: a remote workspace runs pi’s own read, write, edit, ls and bash with operations over it, and re-runs pi’s grep and find invocations of rg and fd on the remote. Each is held to pi’s local tool by parity tests. rg and fd come from the remote’s PATH, or are downloaded here at pinned versions, checked against their SHA-256, and uploaded. Only pi’s PI_* session markers of the local environment reach a remote command.

* The session half (#498): /ssh <destination>:<path> probes the remote, writes the local anchor and its mirror (AGENTS.md and the project guidance), and switches into a session there. Session start in an anchor publishes the workspace, and a helper reuses its parent’s. The system prompt’s working directory becomes the remote root, and the status line names the host. /ssh status and /ssh reconnect report on the connection.

The meta package loads it as 11-ssh.ts, after modes; GADHS_PI_SSH=off turns it off. How to use it: pi over SSH.

@gadhs/pi-shellcheck

The shell guard (#751). Every bash tool call is read before it runs: two delete rules of its own on @gadhs/pi-bash’s parser, and a pinned shellcheck fetched from its publisher and checked against its SHA-256. What loses data is refused with the fix named, probable bugs ride on the result as a note, the rest is dropped, and `~/.pi/agent/gadhs-pi-shellcheck.json moves any check between the three. It imports the two libraries and no extension. The meta package loads it as 13-shellcheck.ts, ahead of the permission system, so a refused command never reaches the judge. What it reads, the default table and its limits: The shell guard.

The meta package also ships the four Orchard TUI themes (themes/, generated from the agency palette data — node tools/task.mjs themes regenerates, and a drift check runs in validate).

Vendored upstream (pinned, unmodified)

Package License Role

@gotgenes/pi-permission-system

MIT

Deterministic permission gates: bash decomposition, symlink-resolved path denies, fail-closed posture, subagent ask-forwarding, the authorizerChain seam our judge plugs into.

@gotgenes/pi-subagents

MIT

Subagent delegation. Chosen over alternatives for its native permission-system integration (<active_agent> tag → per-agent allow/ask/deny frontmatter) and typed service API.

pi-web-access

MIT

Web search, URL fetch, repo cloning, PDF/video extraction. Already routes model calls through pi’s registry-complete path, so it works with Vertex ADC models out of the box.

Upstream updates are normal dependency management: get notified → bump the pin → CI → publish a new @gadhs/pi. No local patches, ever (see Architecture).

Import resolution inside extensions

pi resolves an extension’s imports of upstream code through an alias map that covers only the @earendil-works/* package roots plus three subpaths: /compat, /oauth, and /providers/all. Any deeper subpath import resolves in this workspace (where node_modules has the real tree) and then breaks in a consumer install — which is exactly the kind of gap task consumer-sim exists to catch.

Updating without restarting: pi update, then /reload

/reload loads the updated packages in the same pi process (#459, seen live locally and over SSH). pi loads extensions through jiti with its module cache off, so every TypeScript file of ours is read fresh. pivot-wire, which Node itself requires for pi-remote and whose cache survives a reload, is dropped from that cache each time pi-remote loads, so it is fresh too (#579). The diagnostics stream, shared on globalThis by every copy of pi-modes in the process, records which version made it. After an update it is replaced once, keeping any records it still held unwritten, so secret scrubbing is the new release’s at once.

What a reload does not keep is the work in flight. Monitors end, and the next session offers their list back. Jobs (#577) are the exception: they run on, and the next session watches them again. Commands running on an SSH remote end, and the phone link pauses and returns.

Two pieces of pi-modes live in the process rather than in its code: the ask broker’s registry, and the terminal’s lone-ESC patch on pi-tui, which pi never reloads. When an update changes either one’s contract version, the earlier copy keeps running, and the session start says so once: "pi was updated, but this process still runs the earlier …; restart pi to load the new one". Restart then. Otherwise the reload is enough.

A session that has not reloaded says so (#900). At the start of each turn of a main session, pi-modes reads the installed @gadhs/pi manifest’s version, and when it is newer than the release this process loaded, the human is told once per installed release: "@gadhs/pi 0.173.0 is installed, and this session still runs 0.172.0, the release it loaded when it started. Run /reload to load the new one, or restart pi." A helper says nothing. The loaded release is read once, when pi-modes is first imported, so it is the release whose code runs. Pins: test/stale-release.test.ts, and consumer-sim’s row, which bumps the installed manifest on a real session after it has started and before its first turn.

Registry

Packages publish to the GitLab npm registry under the @gadhs scope (internal; not published to npmjs.com). Consumers resolve the scope from the GROUP endpoint, which serves reads publicly — no token to install:

npm config set @gadhs:registry https://gitlab.com/api/v4/groups/55134190/-/packages/npm/

Why the group endpoint

npm permits exactly one registry per scope, so the @gadhs → registry mapping on a developer’s box covers the whole namespace — and the agency publishes @gadhs packages from more than one project: this repo’s @gadhs/pi, pivot’s wire (vendored inside @gadhs/pi), and the shared docs theme and its search extensions. A project-endpoint mapping would serve this repo’s packages and send every other name to GitLab’s forwarding, which answers it from registry.npmjs.org (#380).

npm 12

npm 12 refuses dependencies fetched from a URL by default (allow-remote=none), and it counts a registry’s tarball as one unless the tarball’s path starts with the registry’s path (npm/cli#9796, open). The group endpoint serves each package’s tarball from its project’s path, so on npm 12 every @gadhs package is refused with EALLOWREMOTE (#379). On npm 12 or newer, the fix is scoped to pi’s own package directory:

npm config set allow-remote=all --location=project --prefix ~/.pi/agent/npm

That writes ~/.pi/agent/npm/.npmrc, which npm reads only for installs into that prefix — which is where pi installs packages. Every other npm use on the box keeps npm 12’s protection. Inside pi’s package tree a dependency declared as a URL installs, as it did on npm 11. Older npm needs nothing: npm 11 already defaults to all, and npm 10 does not know the setting and refuses the command ("`allow-remote` is not a valid npm option", #383) - npm 10 is what pi’s installer brings with the Node 22 it downloads. With PI_CODING_AGENT_DIR set, use its npm directory instead. The CI rehearsal installs with npm 12 and this line, so a consumer’s install is covered. Drop the line once npm accepts GitLab’s tarball paths.

The tree-sitter-bash install-script warning

Since npm 11.18, every install into pi’s package directory ends with tree-sitter-bash@0.25.1 (install: node-gyp-build) listed as an install script "not yet covered by allowScripts" (#549). It is expected and harmless. pi uses only the grammar file the package ships, tree-sitter-bash.wasm, loaded through web-tree-sitter. The script builds a native addon that nothing loads. Both pi-bash and the bundled permission system depend on the package, so it stays.

Do not approve the script: that compiles native code for no use. npm 12 blocks it by default, and npm 11 still runs it. pi records the denial itself (#654): each session start adds "allowScripts": { "tree-sitter-bash": false } to package.json in pi’s npm directory (~/.pi/agent/npm, or the npm directory under PI_CODING_AGENT_DIR). That is what npm deny-scripts tree-sitter-bash writes, and it silences the warning. So only the very first install still lists the script; every pi update after a session is quiet. pi creates that file only when it is missing, so pi update keeps the entry.

The denial is written only into a file that exists, and only when nothing there decides the package yet. An entry of your own is kept, by name or pinned (tree-sitter-bash@0.25.1), true or false. So is a file that does not parse.

The accepted residual

The group endpoint’s namespace is every project in gadhs, so an accidental name collision — a fork that keeps package names and publishes from its own project — would enter consumers' resolution. Under the agency threat model that is an accident class, not an adversary class; if it ever occurs, GitLab package-protection rules and the fork’s own cleanup are the remedy.

How provenance is checked

task consumer-sim --registry installs through the group endpoint exactly as a consumer does, then asserts provenance from what npm recorded: every package of ours must have resolved from this project’s endpoint and pivot’s wire from pivot’s. A same-named package from any other project in the group installs, and the check fails naming it.

Publishing

Only @gadhs/pi is published, targeting the per-project endpoint (#836); auth comes from the environment, never from a committed token (see .npmrc). The ten sibling packages are private workspace packages bundled into @gadhs/pi.

One packaging rule learned the hard way: the files allowlists use globs pinned by tests that read npm pack --json — every package’s import closure is checked against its real tarball (packages/pi/test/shipped-imports.test.ts, since #241 no longer a hand expansion of the globs) — because a hand-maintained file list rots invisibly in a workspace, where the files are always present locally.

Edit this page · latest