@lnittman/pi-tools
Tool-pack contract for pi-mono SDK consumers — composable extension factories for code, HIL, orchestration, and annotation capabilities, consumable by any product that uses @mariozechner/pi-coding-agent
Package details
Install @lnittman/pi-tools from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@lnittman/pi-tools- Package
@lnittman/pi-tools- Version
0.3.0- Published
- Apr 19, 2026
- Downloads
- 146/mo · 5/wk
- Author
- lnittman
- License
- MIT
- Types
- extension
- Size
- 17.6 KB
- Dependencies
- 0 dependencies · 1 peer
Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@creative-int/pi-tools
Tool-pack contract for pi-mono SDK consumers.
What it is
@creative-int/pi-tools defines the factory shape that products built on @mariozechner/pi-coding-agent use to compose capabilities into a createAgentSession() without source-forking pi-coding-agent.
The package itself is thin on runtime code — it re-exports the pi-mono extension-runtime types under a stable import surface and provides composition helpers. Concrete packs (code, hil, orchestration, annotation) will land here as subpath exports. Existing pi packages (pi-steer, pi-pad, pi-outline) remain separately versioned and export their own factory creators.
Why it exists
Before pi-tools, products that wanted to consume pi extensions had two bad options:
- Source-fork pi-coding-agent — carries the whole upstream tree, version-locks to a specific release, duplicates maintenance burden.
- Register tools via
customTools— only gets you tool definitions; loses lifecycle hooks, commands, shortcuts, message renderers, state persistence.
pi-tools documents the third path: consume pi's public SDK + extension factory API, load extensions programmatically via DefaultResourceLoader({ extensionFactories: [...] }), and keep the product boundary clean.
Install
pnpm add @creative-int/pi-tools @mariozechner/pi-coding-agent
@mariozechner/pi-coding-agent is a peer dependency.
Usage
Compose factories from pi extensions
import { DefaultResourceLoader, createAgentSession } from "@mariozechner/pi-coding-agent";
import { composePackFactories } from "@creative-int/pi-tools";
import { createSteerFactory } from "@creative-int/pi-steer";
import { createPadFactory } from "@creative-int/pi-pad";
import { createOutlineFactory } from "@creative-int/pi-outline";
const resourceLoader = new DefaultResourceLoader({
// No filesystem extension discovery — products control their extension set.
additionalExtensionPaths: [],
extensionFactories: [
createSteerFactory(),
createPadFactory(),
createOutlineFactory(),
],
});
const { session } = await createAgentSession({
resourceLoader,
});
Conditional composition
import { composePackFactories, whenEnabled } from "@creative-int/pi-tools";
import { createSteerFactory } from "@creative-int/pi-steer";
const factory = composePackFactories(
createSteerFactory(),
whenEnabled(structuredMode, () => createHilFactory()),
);
Authoring a pack
import type { PiToolPackFactory } from "@creative-int/pi-tools";
export interface MyPackOptions {
enabled?: boolean;
label?: string;
// product-specific options...
}
export const createMyPackFactory: PiToolPackFactory<MyPackOptions> = (options = {}) => {
return (pi) => {
pi.registerTool({ /* ... */ });
pi.on("session_start", (_ev, ctx) => { /* ... */ });
};
};
Exports
| specifier | purpose |
|---|---|
"@creative-int/pi-tools" |
root — contract types + compose re-exports |
"@creative-int/pi-tools/contract" |
PiToolPackFactory, PiToolPackOptions, PiToolPackManifest, and re-exports of ExtensionFactory, ExtensionAPI, ExtensionContext, Extension, ToolDefinition, defineTool |
"@creative-int/pi-tools/compose" |
composePackFactories(), whenEnabled() |
Design
- Thin re-export layer. We do not redefine pi-mono types; we give them a stable home under
@creative-int/pi-tools/contractso factory authors have a consistent import surface. - Separate packaging from siblings.
pi-steer,pi-pad,pi-outlinestay separately versioned.pi-toolsis their composition substrate, not their umbrella. - Subpath-ready. Concrete packs (
./code,./hil,./orchestration,./annotation) will land as subpath exports as they're extracted from existing product code.
Related
@mariozechner/pi-coding-agent— the upstream pi SDK@creative-int/pi-steer— steering compiler (interviews + handoff synthesis)@creative-int/pi-pad— persistent execution memory@creative-int/pi-outline— AST-based code structure extension (private lane)
License
MIT