Loading...
Loading...
Building & extending Pi — authoring TypeScript extensions (ExtensionAPI, registerTool, registerProvider, /commands, UI hooks), publishing as npm/git packages (pi-package), embedding via JSON-RPC mode (--mode rpc/json, JSONL framing, AgentSession SDK), and developing inside the pi_agent_rust repo. Use for any "how do I build a Pi extension/package/SDK client" question.
npx skill4agent add arthrod/conejo-skills pi-extending| Concern | Section |
|---|---|
| Authoring TypeScript extensions (tools, commands, hooks, providers) | Extension authoring |
| Distributing extensions/skills via npm or git | Package authoring |
| Embedding pi or speaking the JSON-RPC protocol | RPC + SDK |
| Working inside the pi_agent_rust repo | pi_agent_rust internals |
pi-mono/pi-mono/packages/coding-agent/docs/extensions.mdpi-mono/packages/coding-agent/examples/extensions/README.mdpi-mono/packages/coding-agent/src/core/resource-loader.tsextendResources()mergePathslastSkillPathspi-mono/packages/coding-agent/src/core/agent-session.tspi-mono/packages/coding-agent/docs/tui.md@mariozechner/pi-tuiComponentpi-mono/packages/coding-agent/docs/custom-provider.mdregisterProvider()docs/extensions.mdpi-mono/packages/coding-agent/examples/extensions/dynamic-resources/docs/extensions.mdexamples/extensions/AGENTS.mdpi-monoextendResourcesmergePathsresource-loader.tsdocs/tui.mdComponentpi-tuipi-mono/packages/coding-agent/docs/custom-provider.mdregisterProvider()pi-cli-workspacepi-mono/packages/coding-agent/docs/packages.mdpi-mono/packages/coding-agent/README.mdpi installpackage.jsonpipi-mono/packages/coding-agent/src/core/package-manager.tsresourcePrecedenceRankresourcePrecedenceRankpi-mono/packages/coding-agent/src/core/package-manager.tsdocs/packages.mdpackage.jsondocs/packages.mdskills/extensions/loadSkillspi-mono/packages/coding-agent/src/core/skills.tsdocs/packages.mdpi-mono/packages/coding-agent/docs/rpc.mdreadlinepi-mono/packages/coding-agent/docs/sdk.mdcreateAgentSessionAgentSessioncreateAgentSessionRuntimeModelRegistry.create()AuthStorage.create()SessionManager.inMemory()pi-mono/packages/coding-agent/docs/json.md--mode jsonagent_*turn_*message_*tool_execution_*jqpi-mono/packages/coding-agent/src/modes/rpc/rpc-client.tsrpc.mdpi-mono/packages/coding-agent/src/core/agent-session.tsrpc.mdpi-mono/packages/coding-agent/docs/rpc.mdrpc.mdprompt--mode json--mode rpccreateAgentSession()sessionManagerauthStoragemodelRegistrycreateAgentSessionRuntime()AgentSessionRuntimeagentsessionManagersettingsManagermodelRegistryextensionsbashExecutorresourceLoaderpi-mono/packages/coding-agent/docs/sdk.mdrpc.mdAgentSessionjson.md--mode jsonrpc.md--mode rpccreateAgentSession()--mode rpc@mariozechner/pi-coding-agentpi-mono/packages/coding-agent/docs/sdk.mdpi-mono/packages/coding-agent/examples/sdk/rpc.md\n\rpi_agent_rustexport CARGO_TARGET_DIR="/data/tmp/pi_agent_rust/${USER:-agent}"
export TMPDIR="/data/tmp/pi_agent_rust/${USER:-agent}/tmp"
mkdir -p "$TMPDIR"
rch exec -- cargo check --all-targets
rch exec -- cargo clippy --all-targets -- -D warnings
cargo fmt --check
bash tests/installer_regression.sh| Symptom | First 3 Commands |
|---|---|
| Provider stream/tool-call regression | |
| Session replay/index drift | |
| Extension policy/runtime failure | |
| Installer/uninstaller/skill issue | |
| Interactive vs RPC divergence | |
references/DEBUGGING-PLAYBOOKS.mdAGENTS.mdmainmasterrgast-greprch exec -- <cargo ...>README.md| Changed Files (examples) | Minimum Required Tests |
|---|---|
| |
| |
| |
| |
| |
| |
cargo test# Fast recon
git status --short
rg -n "install|uninstall|skill|checksum|sigstore|completion|provider|session|extension" \
install.sh uninstall.sh README.md tests/installer_regression.sh src/
# Installer + skill safety gates
bash -n install.sh uninstall.sh tests/installer_regression.sh
shellcheck -x install.sh uninstall.sh tests/installer_regression.sh
bash tests/installer_regression.sh
bash scripts/skill-smoke.sh
# Rust gates
rch exec -- cargo check --all-targets
rch exec -- cargo clippy --all-targets -- -D warnings
cargo fmt --checkreferences/COMMANDS.mdreferences/DEBUGGING-PLAYBOOKS.mdsrc/main.rssrc/agent.rssrc/provider.rssrc/providers/src/tools.rsreadwriteeditbashgrepfindlssrc/session.rssrc/session_index.rssrc/extensions.rssrc/extensions_js.rssrc/interactive.rssrc/rpc.rsinstall.shuninstall.shtests/installer_regression.shscripts/skill-smoke.sh# BEFORE: everything collapsed into "skipped custom"
if [ "$skipped_custom" -ge 1 ]; then
AGENT_SKILL_STATUS="skipped (existing custom skill)"
fi
# AFTER: distinguish custom-skip from write failure
if [ "$skipped_custom" -ge 1 ] && [ "$failed_writes" -ge 1 ]; then
AGENT_SKILL_STATUS="partial (custom skill kept; other install failed)"
elif [ "$skipped_custom" -ge 1 ]; then
AGENT_SKILL_STATUS="skipped (existing custom skill)"
fi# BEFORE: remove destination before validating copy result
rm -rf "$destination"
cp "$source" "$destination/SKILL.md"
# AFTER: stage then atomically move into place
staged="$(mktemp -d ...)"
cp "$source" "$staged/SKILL.md"
mv "$staged" "$destination"AGENT_SKILL_STATUSCHECKSUM_STATUSCOMPLETIONS_STATUSinstall.shreferences/DEBUGGING-PLAYBOOKS.mdREADME.mdtests/installer_regression.shscripts/skill-smoke.shpi-using