Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
I need to understand how extensions work
└─► ARCHITECTURE.md
I need working code to copy
└─► PATTERNS.md
I need to know what NOT to do
└─► ANTI-PATTERNS.md
I need a step-by-step first tutorial
└─► guides/01-quickstart.md
I need deep narrative on tools/events/UI
└─► guides/02-paradigms.md
I need state persistence strategies
└─► guides/03-state.md
I need production architecture (workflows, memory)
└─► guides/04-production.md
I need RPC mode specifics
└─► guides/05-rpc-mode.md
I need pi internals (loader, runner, binding)
└─► guides/06-internals.md
I need startup optimization, speed up extension loading
└─► references/startup-optimization.md
I need provider plugins, OAuth, overrides
└─► guides/07-advanced-patterns.md
Which paradigm should I use?
Need LLM to perform action? ───────────────► Tool (PATTERNS P2–P5)
Need user to type /command? ───────────────► Command (PATTERNS P6–P7)
Need keyboard shortcut? ───────────────────► Shortcut (guides/02-paradigms.md)
Need to react to system events? ───────────► Event handler (PATTERNS P8–P11)
Need interactive TUI? ─────────────────────► Custom UI (PATTERNS P12–P14)
Need to inject a model provider? ──────────► registerProvider (PATTERNS P19–P20)
Need to override a built-in tool? ─────────► Tool override (PATTERNS P4)
Which state persistence mechanism?
State should go to LLM context? ───────────► sendMessage({ customType, ... })
State is extension-private? ───────────────► appendEntry("customType", data)
State is user preference (cross-project)? ─► File in ~/.pi/agent/
State is project-local? ───────────────────► File in .pi/
State is temporary cache? ─────────────────► Local variable (reconstructed on reload)
Prerequisite: This skill is installed (cloned to skills/pi-extensions).
Below creates a sample Extension, placed in ~/.pi/agent/extensions/ — separate from the skill directory.
# 1. Create the sample extension filemkdir -p ~/.pi/agent/extensions
cat > ~/.pi/agent/extensions/hello.ts << 'EOF'
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
export default function (pi: ExtensionAPI) {
pi.registerCommand("hello", {
description: "Say hello",
handler: async (_args, ctx) => {
ctx.ui.notify("Hello from Pi Extensions!", "success");
},
});
}
EOF
# 2. Test with -e flag (temporary load)
pi -e ~/.pi/agent/extensions/hello.ts
# Then type: /hello## Tip: Extensions in ~/.pi/agent/extensions/ are auto-discovered.# The -e flag is only needed for temporary testing.
Register a tool with the same name as a built-in (read, bash, edit, write) to wrap or replace it. See PATTERNS.md §P4.
Parallel Execution Safety
Custom tools that mutate files must use withFileMutationQueue() to avoid race conditions with built-in edit/write. See PATTERNS.md §P5 and ANTI-PATTERNS.md §A4.
RPC Safety
ctx.hasUI is true in RPC, but custom() returns undefined. Use select/confirm/input/editor for blocking dialogs that work in both modes. See ANTI-PATTERNS.md §A2 and guides/05-rpc-mode.md.