pi-mono/packages/coding-agent/examples
Mario Zechner e9c0ff4d84 feat(chord): Chord v2 is the package's root
src/next is src (the main export), src/next-node is src/node with short subpaths (/http, /workers, /plugins,
/plugins/runtime, /app, /surfaces, /web, /react, /tui, /tui/launcher); the foundations get /json and /watch;
Chord v1 moves to src/old (/old, /old/node) until p2 runs on v2; tests and docs move likewise (test/, docs/,
test/old, docs/old). Durable and env import the foundations from their subpaths.
2026-11-02 22:36:55 +00:00
..
extensions Release v1.5.0 2026-11-02 11:38:21 +01:00
sdk feat(coding-agent): list MCP servers instead of their tools in codemode 2026-09-30 13:54:02 +02:00
README.md feat(coding-agent): remove the experimental server stack and the client, protocol, and server packages 2026-10-12 10:41:59 +00:00
rpc-client.ts feat: build with TypeScript 7 and run sources with plain node 2026-09-25 13:14:33 +02:00
rpc-extension-ui.ts feat: build with TypeScript 7 and run sources with plain node 2026-09-25 13:14:33 +02:00
tsconfig.json feat(chord): Chord v2 is the package's root 2026-11-02 22:36:55 +00:00

Examples

Example code for the pi-coding-agent SDK, process integration, and extensions.

CLI integration

rpc-client.ts uses the typed RpcClient to run Pi in a child process, stream events, and wait for the run to settle.

Build the coding-agent package before running it from a repository checkout:

node examples/rpc-client.ts "Explain this repository"

Directories

sdk/

Programmatic usage via createAgentSession(). Shows how to customize models, prompts, tools, extensions, and session management.

extensions/

Example extensions demonstrating:

  • Lifecycle event handlers (tool interception, safety gates, context modifications)
  • Custom tools (todo lists, questions, subagents, output truncation)
  • Commands and keyboard shortcuts
  • Custom UI (footers, headers, editors, overlays)
  • Git integration (checkpoints, auto-commit)
  • System prompt modifications and custom compaction
  • External integrations (SSH, file watchers, system theme sync)
  • Custom providers (Anthropic with custom streaming, GitLab Duo)

Documentation