Agent skill
pi-delegate
Delegate tasks to Pi subagents with preset roles (oracle, worker, reviewer, ui-engineer, librarian) or ad-hoc prompts. Use for fresh context, model specialization, second opinions, code review, isolated execution, or parallel task delegation.
Install this agent skill to your Project
npx add-skill https://github.com/vaayne/agent-kit/tree/main/skills/pi-delegate
SKILL.md
Pi Delegate
Use Pi as a separate non-interactive subagent when you want fresh context, a different model, or isolated task execution.
Use this skill when
- you want to delegate a bounded task to Pi
- you want a different model for the task
- you want an independent second pass or critique
- you want to isolate noisy work from the current conversation
Preset agents
Preset agent profiles live in agents/ relative to this skill. Read the agent file and pass its content via --append-system-prompt.
| Agent | Purpose | Model tier |
|---|---|---|
oracle |
Architecture advice, critique, second opinion | Best (opus/pro/codex) |
reviewer |
Code review with structured feedback | Best (opus/pro/codex) |
worker |
General-purpose subtask execution | Balanced (sonnet/codex) |
ui-engineer |
Visual/UI design and implementation | Best (pro/opus) |
librarian |
Code search, docs lookup, examples | Fast (flash) |
Using a preset agent
- Read the agent file (e.g.
agents/oracle.md) to get the system prompt. - Pass it via
--append-system-prompt "$(cat agents/oracle.md)". - Set
--modelper the table above.
cd "/path/to/project" && pi --offline --no-prompt-templates --no-themes --append-system-prompt "$(cat {skill_dir}/agents/oracle.md)" --model {model} -p "Your task" 2>&1
Ad-hoc delegation (no preset) still works — just omit --append-system-prompt.
Command rules
- Change to the target working directory first (quote paths with spaces).
- Default to
--offline --no-prompt-templates --no-themesfor reproducible, low-noise runs. - Choose a model with:
--model {model}when model choice matters. - Use
pi --helpif exact flags are unclear.
Fresh run vs continuation
- Fresh run (default): Start a new isolated session. Use this for independent delegation.
- Continuation (
-c): Resume the most recent delegated session. Only use when intentionally continuing the same thread — e.g., refining a previous result or adding follow-up instructions to the same task.
Pattern (ad-hoc):
cd "/path/to/project" && pi --offline --no-prompt-templates --no-themes [--model {model}] [-c] -p "Your task" 2>&1
Model selection
Discover available models dynamically — do not rely on memorized model IDs:
pi --list-models [search]
Without [search], lists all available models. With a search term, filters by keyword.
Examples: pi --list-models, pi --list-models gpt, pi --list-models claude, pi --list-models gemini.
Selection guide
Pick a model by matching the task to the right family and tier.
| Family | Best | Balanced / Fast | Notes |
|---|---|---|---|
| GPT | Highest version with codex (e.g. gpt-5.4-codex) |
Highest version without codex |
codex variants are optimized for coding. Non-codex are general purpose. Higher version number = better (5.4 > 5.3). |
| Claude | opus |
sonnet (balanced), haiku (fastest) |
Opus is most capable, sonnet is strong all-rounder, haiku is cheapest and fastest. |
| Gemini | pro |
flash |
Pro is most capable. Flash is fast and cheap. |
When to pick what
- Complex reasoning, planning, critique — pick the best tier (opus, pro, or highest codex).
- Coding tasks — prefer GPT codex variants or Claude opus/sonnet.
- General purpose / balanced — Claude sonnet or GPT without codex.
- Fast, cheap, high-volume — Claude haiku or Gemini flash.
- Vision / image understanding — Gemini flash is good enough and cost-effective; prefer it over heavier models.
Execution workflow
- Run Pi via
bashand capture stdout+stderr (always append2>&1). - Read the output — treat it as input for your judgment, not automatic truth.
- Summarize findings back into the main task context.
- Decide whether to act on, discard, or refine the delegated result.
Error handling
If Pi fails or returns unexpected results:
- Verify the working directory exists and is correct.
- Run
pi --list-modelsto confirm the model ID is valid. - Retry without
--modelto use the default model. - Run
pi --helpto check for flag changes.
Examples
# Oracle: architecture review (preset agent)
cd "/path/to/project" && pi --offline --no-prompt-templates --no-themes --append-system-prompt "$(cat {skill_dir}/agents/oracle.md)" --model {opus-model} -p "Review this architecture and recommend improvements" 2>&1
# Reviewer: code review (preset agent)
cd "/path/to/project" && pi --offline --no-prompt-templates --no-themes --append-system-prompt "$(cat {skill_dir}/agents/reviewer.md)" --model {opus-model} -p "Review the changes in src/auth/ for security issues" 2>&1
# Worker: general task (preset agent, full tools)
cd "/path/to/project" && pi --offline --no-prompt-templates --no-themes --append-system-prompt "$(cat {skill_dir}/agents/worker.md)" --model {sonnet-model} -p "Refactor the logger module to use structured logging" 2>&1
# Ad-hoc delegation (no preset)
cd "/path/to/project" && pi --offline --no-prompt-templates --no-themes --model {sonnet-model} -p "Think through this decision and recommend the best option" 2>&1
# Continue a previous delegated session
cd "/path/to/project" && pi --offline --no-prompt-templates --no-themes -c -p "Refine the recommendation from the previous run" 2>&1
Prompt guidance
Keep prompts direct. Ask Pi for the output you want back, such as:
- findings
- risks
- options
- recommendation
- next actions
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
mcp-jetbrains-ide
Control JetBrains IDE (IntelliJ, WebStorm, PyCharm) via MCP. Use when manipulating IDE files, running configurations, searching code, or performing refactoring. Triggers on "open in IDE", "run configuration", "refactor code", "IDE search", "JetBrains".
mcp-context7-docs
Query up-to-date documentation and code examples for any programming library or framework. Use when looking up API docs, finding code examples, or checking library usage. Triggers on "how to use [library]", "docs for [package]", "show me examples of [framework]", "Context7 lookup".
web-fetch
Fetch and extract clean content from URLs using Jina Reader API. Use when users need to read webpage content, extract article text, or fetch URL content for analysis. Triggers on "fetch this page", "read this URL", "extract content from", "get the content of", "what does this page say".
tmux
Control interactive terminal sessions via tmux. Use when tasks need persistent REPLs, parallel CLI agents, or any process requiring a TTY that simple shell execution cannot handle.
specs-dev
Plan-first development workflow with review gates. Use when implementing features, refactoring, or any task requiring structured planning, iterative implementation with reviews, and clean commits. Triggers on requests like "implement feature X", "plan and build", "spec-driven development", or when user wants disciplined, reviewed code changes.
mcp-grep-code
Search real-world code examples from over a million public GitHub repositories. Use when finding code patterns, implementation examples, or how libraries are used in practice. Triggers on "find code examples", "how is [library] used", "search GitHub code", "grep.app search", "code pattern".
Didn't find tool you were looking for?