Project Conventions

The agency standards are canonical. This page maps them onto a TypeScript/pi-extension codebase and records what is different here and why. It is the project-owned complement to the (unedited, synced) standards pages — see ADR-002 for the downstream-in-spirit posture.

Language mapping (Rust standard → this repo)

Standard (Rust) Here (TypeScript) Notes

cargo xtask task runner

node tools/task.mjs

Same principle: one typed automation entrypoint, no loose scripts.

rustfmt + clippy -D warnings

Biome (format + lint), CI-blocking

One tool for both, matching the bundled ecosystem (gotgenes stack). It formats Markdown too (Biome 2.6, #396), the YAML header included. A file a program reads as raw text says the same thing in Markdown: the field-study scenarios write a seed path such as src/init.py as a code span, since Markdown reads a bare init as bold. Their code blocks are fixtures, a foreign project’s files, and are left as written (an overrides entry in biome.json).

cargo-nextest

vitest

fail-fast off in CI; results per package.

thiserror typed errors / no silent failure

Typed Error subclasses at public boundaries; never swallow — propagate or log with reason. // SILENT-OK: <reason> for deliberate no-ops.

Same judgment residue, TS idioms.

Newtypes over raw primitives

Branded types / dedicated interfaces for domain values (model refs, region ids, provider ids)

Compile-time arg-transposition safety where it pays.

unwrap/panic bans (clippy)

noNonNullAssertion (Biome error), strict + noUncheckedIndexedAccess tsc

The equivalent "prove it or handle it" posture.

SPDX header on .rs

SPDX header on .ts/.mjs (// SPDX-License-Identifier: AGPL-3.0-or-later)

Enforced by pre-commit (staged blobs) + task spdx.

Alpine/musl containers

CI images: Debian node:26 for lint, validate, validate-unprivileged, rehearse and pages; node:26-alpine for publish and publish-dry-run

Alpine wherever it works; Debian where a native module has no musl prebuild (the docs search embedder’s onnxruntime-node).

Conventions specific to this repo

  • Model invocation: always pi’s composed-provider path (ctx.modelRegistry.completeSimple / provider streamSimple). Never pi-ai/compat complete* — it cannot reach custom-api/ADC providers.

  • Config files: extensions ship a bundled default next to the code and read a per-user override from the agent dir ($PI_CODING_AGENT_DIR or ~/.pi/agent/…​). First-run bootstrap seeds external consumers' configs (e.g. the permission system’s config.json) only when absent.

  • peerDependencies: pi’s own packages (@earendil-works/pi-ai, @earendil-works/pi-coding-agent, pi-tui) are provided by pi at runtime, never bundled. The range says the oldest pi a package works with, and it is the same everywhere: >=1.5.0 for pi-coding-agent in every package and for pi-ai where a package names it ( in pi-remote), pi-tui (pi-modes only). One floor, at the pi the box runs, because that is the only pi the workspace tests against: the workspace installs exactly that pi (overrides in pnpm-workspace.yaml), the CI rehearsal installs the floor itself (a distribution test holds the two equal), and the current majors of the permission system and helper runtime that @gadhs/pi bundles require pi 1.0 or later. typebox is a * peer in pi, pi-modes and pi-remote and a direct dependency of pi-workflow; the workspace overrides it to the version pi-ai pins.

  • Commit attribution: AI-assisted commits carry Co-Authored-By: <Model Name> <noreply@dhs.ga.gov>, derived at commit time from $PI_MODEL (title-cased) — never a stale hardcoded value. The address is configurable as coAuthorEmail (Configuration Cookbook).

Plans use a canonical Status vocabulary, enforced by node tools/task.mjs plan-lint.

Stability from 1.0

From @gadhs/pi 1.0.0, SemVer binds the stable tier of The public surface: config files and keys, slash commands, tools, operator environment variables, stable bus channels, versioned wires, @gadhs/pi/bus-rules.json, and @gadhs/pi/package.json.

  • A breaking change to a stable item — removing or renaming it, changing the type of a parameter or payload field, a config loader refusing what it previously accepted, or a wire change where peers on adjacent versions refuse each other — requires a major version bump of @gadhs/pi and an entry under === Breaking in CHANGELOG.adoc that says what to change.

  • An addition to the stable tier (a new optional key, command, tool, event, or additive payload field) is a minor version bump.

  • Internal items (including every named export of a sibling package and every export of the @gadhs/pi-bash and @gadhs/pi-workspace libraries) and upstream items may change in any release.

  • The ten sibling @gadhs/pi-* packages are private to the workspace (private: true), move in lockstep with `@gadhs/pi’s version, and are not published standalone (#836).

This section is this repository’s concrete form of the agency standards' "API contract stability" rule; the synced standards pages are not edited (ADR-002).

Project Overrides (dated, per the override convention)

  • 2026-08-26 — Agent context lives in AGENTS.md, not .claude/CLAUDE.md. pi loads AGENTS.md natively and the whole point of this project is model-agnostic configuration. Supersedes the template’s .claude/ layout for this repo. The genericization is phase 2’s deliverable; this override is its first step.

  • 2026-08-26 — check-docs drift gating is stubbed. This is the template’s first non-Rust downstream; the sync engine and manifest are cargo-bound and the synced coding-conventions page is Rust-specific. Standards pages are byte-copied unedited (drift-checkable later); gating activates when upstream ships a language-profile manifest. A macro-feedback issue upstream is held until this repo’s auto-mode is operational (operator instruction).

  • 2026-08-26 — Work tracking uses a parent tracking issue, not an epic (same constraint and rationale as the template’s own override: project tokens cannot create group-level epics).

  • 2026-08-26 — Docs format: AsciiDoc/Antora canonical; published packages additionally carry a thin README.md stub because npm/pi.dev render only Markdown. The stub holds no content beyond install + a docs pointer.

  • 2026-09-07 — Plans authored before v2026.5 keep their per-step Status lines. The template froze plans at implementation start and reduced Status to one header value; the archived plans here were written under the earlier living-spec rule and are history. New plans follow the shipped rule. task plan-lint vocabulary-checks any line beginning Status: and requires none, so both shapes pass it; it does not distinguish a header from a step, and the bold Status: header form these plans use is not matched at all (the template’s plan-lint --done completion gate was not adopted).

Edit this page · latest