These rules apply to every package under extensions/*.
The workspace automation and execution rules in the root AGENTS.md also apply.
New extension checklist
Create:
extensions/<name>/package.json
extensions/<name>/index.ts
extensions/<name>/README.md
extensions/<name>/__tests__/harness.test.ts
extensions/<name>/mise.toml
Then run mise run //:lock and the extension-local lint, test, and check tasks.
Do not run npm install directly.
Package manifest contract
Every extension package must declare:
name @bugabinga/pi-ext-<name>
private: true
type: "module"
main: "index.ts"
license: "MIT"
development dependencies on @marcfargas/pi-test-harness and Vitest
Do not declare a per-extension version.
The root package owns the repository version.
Do not declare package scripts.
Extension automation belongs in mise.toml.
Declare only packages imported by the extension, including development and test code.
Put Pi packages under peerDependencies with range "*".
Never depend on another @bugabinga/pi-ext-* package.
scripts/extensions.mjs enforces this contract.
Mandatory harness test
Every extension must include a pi-test-harness test that loads index.ts through the real Pi extension runtime.
Mocks around helper functions do not replace this test.
Run it through mise run //extensions/<name>:test.
Mandatory local tasks
Every extension must expose lint, test, and check in its local mise.toml.
Root tools and environment are inherited, so do not redeclare them locally.
Use this baseline, replacing angel with the package directory name:
Keep optional package automation, such as bench, e2e, or dev, in the same local mise.toml.
Do not replace structured task references with command strings that spawn mise run.
Independence
Extensions must remain standalone packages.
Never import from another @bugabinga/pi-ext-* package or another extension directory.
Optional integration must use capabilities or events and degrade cleanly.
Important behavior needs a native fallback; decorative integration may no-op.
Imports
Package
Provides
Placement
@earendil-works/pi-coding-agent
Extension API, context, and coding-agent types
peer dependency when imported
@earendil-works/pi-ai
model and message APIs
peer dependency when imported
@earendil-works/pi-tui
terminal UI components and rendering helpers
peer dependency when imported
typebox
tool parameter schemas
peer dependency when imported
@bugabinga/pi-ext-*
sibling extension implementation
never
Startup
session_start must be fast.
Do not await network access, Git, filesystem scans, or subprocesses during startup.
Publish minimal UI immediately, then defer slow work with a background task and generation or stale-result guard.
Never block other extensions for telemetry, recovery, decoration, or cache warming.
Commands
Commands with subcommands must provide argument autocomplete.
Documentation
Keep READMEs terse.
Do not duplicate source-of-truth configuration, API details, or implementation documentation.
Link to canonical source files, commands, settings, or upstream documentation.
A package README should explain purpose, installation or loading, commands and tools, settings, and optional integrations.
Publishing
Use the root //:publish task.
Publishing is Git-only; there is no npm registry flow.
# Extension PackagesThese rules apply to every package under `extensions/*`.
The workspace automation and execution rules in the root `AGENTS.md` also apply.
## New extension checklistCreate:
1. `extensions/<name>/package.json`
2. `extensions/<name>/index.ts`
3. `extensions/<name>/README.md`
4. `extensions/<name>/__tests__/harness.test.ts`
5. `extensions/<name>/mise.toml`
Then run `mise run //:lock` and the extension-local `lint`, `test`, and `check` tasks.
Do not run `npm install` directly.
## Package manifest contractEvery extension package must declare:
- name `@bugabinga/pi-ext-<name>`
- `private: true`
- `type: "module"`
- `main: "index.ts"`
- `license: "MIT"`
- development dependencies on `@marcfargas/pi-test-harness` and Vitest
Do not declare a per-extension version.
The root package owns the repository version.
Do not declare package scripts.
Extension automation belongs in `mise.toml`.
Declare only packages imported by the extension, including development and test code.
Put Pi packages under `peerDependencies` with range `"*"`.
Never depend on another `@bugabinga/pi-ext-*` package.
`scripts/extensions.mjs` enforces this contract.
## Mandatory harness testEvery extension must include a pi-test-harness test that loads `index.ts` through the real Pi extension runtime.
Mocks around helper functions do not replace this test.
Run it through `mise run //extensions/<name>:test`.
## Mandatory local tasksEvery extension must expose `lint`, `test`, and `check` in its local `mise.toml`.
Root tools and environment are inherited, so do not redeclare them locally.
Use this baseline, replacing `angel` with the package directory name:
```toml[tasks.lint]
description = "Lint angel extension"
depends = ["//:install"]
run = [
"biome ci --config-path ../.. .",
"rumdl check --config ../../.rumdl.toml .",
"taplo format --check --config ../../.taplo.toml mise.toml",
]
[tasks.test]
description = "Test angel extension"
depends = ["//:install"]
run = [
{ task = "//:test", args = ["extensions/angel"] },
]
[tasks.check]
description = "Check angel extension"
depends = ["//:install"]
run = [
{ task = "//:build", args = ["angel"] },
]
```
Keep optional package automation, such as `bench`, `e2e`, or `dev`, in the same local `mise.toml`.
Do not replace structured task references with command strings that spawn `mise run`.
## IndependenceExtensions must remain standalone packages.
Never import from another `@bugabinga/pi-ext-*` package or another extension directory.
Optional integration must use capabilities or events and degrade cleanly.
Important behavior needs a native fallback; decorative integration may no-op.
## Imports| Package | Provides | Placement |
| --- | --- | --- |
| `@earendil-works/pi-coding-agent` | Extension API, context, and coding-agent types | peer dependency when imported |
| `@earendil-works/pi-ai` | model and message APIs | peer dependency when imported |
| `@earendil-works/pi-tui` | terminal UI components and rendering helpers | peer dependency when imported |
| `typebox` | tool parameter schemas | peer dependency when imported |
| `@bugabinga/pi-ext-*` | sibling extension implementation | never |
## Startup`session_start` must be fast.
Do not await network access, Git, filesystem scans, or subprocesses during startup.
Publish minimal UI immediately, then defer slow work with a background task and generation or stale-result guard.
Never block other extensions for telemetry, recovery, decoration, or cache warming.
## CommandsCommands with subcommands must provide argument autocomplete.
## DocumentationKeep READMEs terse.
Do not duplicate source-of-truth configuration, API details, or implementation documentation.
Link to canonical source files, commands, settings, or upstream documentation.
A package README should explain purpose, installation or loading, commands and tools, settings, and optional integrations.
## PublishingUse the root `//:publish` task.
Publishing is Git-only; there is no npm registry flow.