pi-coding-agent-sdk
Pi Coding Agent SDK
Overview
Use this skill to explain the public @mariozechner/pi-coding-agent SDK, choose the right example or API surface, and build integrations that stay on exported APIs first.
Default to the public docs, examples, and packages/coding-agent/src/index.ts. Use source-level tracing only when the docs are ambiguous, incomplete, or the user explicitly asks where behavior lives in pi-mono.
If the task is about pi install, package manifests, distribution, or publishing a Pi package, use pi-package-creator instead of stretching this skill.
Task Routing
- Read
references/surface-and-examples.mdfor public exports, example selection, and “what should I import?” - Read
references/resource-loading-and-context.mdforDefaultResourceLoader, discovery rules,AGENTS.md, skills, prompts, and extension loading paths. - Read
references/tools-extensions-and-prompts.mdfor built-in tools, tool factories,customTools, extension-registered tools, prompt templates, slash-command behavior, and extension API boundaries. - Read
references/models-settings-sessions.mdforAuthStorage,ModelRegistry,SettingsManager,SessionManager, events, and run modes. - Read
references/source-crosswalk.mdonly when the docs/examples are not enough or the user asks where the SDK is implemented in pi-mono.
Default Workflow
- Start with the public surface:
packages/coding-agent/docs/sdk.md,packages/coding-agent/examples/sdk/README.md, the relevant example file, andpackages/coding-agent/src/index.ts. - Confirm the exported API before recommending imports or code shape. Do not suggest non-exported internals as a normal integration path.
- Use the closest example as the starting pattern before inventing a new structure.
- Distinguish clearly between:
documented behavior from docs/examples,
exported API confirmed from
src/index.ts, and inferences from lower-level source files. - Prefer public API code in implementations. Use lower-level source only for explanation, debugging, or repo navigation.
- If the question broadens into monorepo architecture, explain that
packages/coding-agentis the SDK surface and usereferences/source-crosswalk.mdto map deeper layers.
Gotchas
- Prebuilt tool instances such as
readToolandbashToolresolve paths fromprocess.cwd(). If a caller sets a customcwdand also passes explicittools, switch to the factory functions such ascreateReadTool(cwd)orcreateCodingTools(cwd). - Passing a custom
ResourceLoaderchanges resource discovery.cwdandagentDirstill matter for session naming and tool path resolution, but they no longer drive skills, prompts, themes, or extension discovery unless the loader does so. session.prompt()throws during streaming unless the caller suppliesstreamingBehavior. Usesteer()orfollowUp()directly when that is clearer.- The docs and examples use
prompt templatesandslash commandsfor the same user-facing surface. Treat file-based prompt templates as slash-command content expansion. - The example README names
08-slash-commands.ts, but the current file in the repo is08-prompt-templates.ts. Prefer the real file path over the README label. customToolsis still a public SDK option even thoughexamples/sdk/06-extensions.tsframes extensions as the main system for registering reusable tools. UsecustomToolsfor inline programmatic integrations and extensions for reusable, discovery-driven behavior.
Reference Map
references/surface-and-examples.mdUse first for public API questions and example routing.references/resource-loading-and-context.mdUse for discovery, loader overrides,AGENTS.md, and context assembly.references/tools-extensions-and-prompts.mdUse for tools, extensions, commands, prompt templates, and related API tradeoffs.references/models-settings-sessions.mdUse for auth, models, settings, session persistence, events, and run modes.references/source-crosswalk.mdUse for source tracing, adjacent pi-mono packages, and optional localpi-extensionsexamples.
More from mylesmcook/mcook-skills
adversarial-review
Use this skill when you need a serious code review, diff review, or implementation-plan review from independent reviewers. In Codex hosts, prefer a fresh Codex subagent for the Codex reviewer; otherwise use the Codex, Claude Code, and Gemini reviewer paths when available. Return a PASS, CONTESTED, or REJECT verdict.
13subagent-driven-development
Use after an implementation plan is approved to execute mostly independent tasks through fresh subagents with scoped context, harness-aware model routing, proportional review gates, and mandatory controller verification.
10brainerd
>
10simple-code
Reduce incidental complexity in code and design. Use when shaping APIs, module boundaries, refactors, tests, naming, and architecture tradeoffs with a bias toward concrete, local, reversible solutions.
7git-it-out
Use this skill when the user explicitly wants final end-of-session closeout and no more branch or PR limbo: proper verification, proper commits, main/mainline landing, push, repo-native merge/release/deploy/publish steps, tracker updates, Entire/checkpoint handling when configured, and a concise handoff. Reach for it on prompts like 'git it out', 'get it out', 'ship this', 'I'm done', 'I'm going to bed', 'take this off my plate', 'finish the session', or 'get this into production'. Do not use it for greenfield implementation, open-ended debugging, broad refactors, or inventing a release process from scratch.
7laws-of-taste
>-
6