pi-subagents-master
Skill2 starsChanged 8 months agoMITView on GitHub
Expert guide for creating, running, and managing pi subagent configurations and multi-agent pipelines. Provides templates, examples, and step-by-step instructions for defining agent specifications and workflows using the pi-subagents extension.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- julweber/ai_agent_skillsword for word, first seen Mar 20, 2026
Other versions1 project uses a version of this.
Word for word · 1
- julweber/ai_agent_skills★ 2100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository51 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ai-agent-skills-assistantSkill
- ansibleSkill
- artificial-analysisSkill
- cavemanSkill
- claude-cliSkill
- code-doctorSkill
- code-summarizerSkill
- codex-cliSkill
- concourse-ciSkill
- dev-brainstormingSkill
- docker-cliSkill
- file-organizerSkill
- frontend-web-developerSkill
- github-actions-cicdSkill
- github-cliSkill
- gitlab-ci-cdSkill
- grill-meSkill
- gtd-assistantSkill
- herdr-cliSkill
- hf-cliSkill
- karpathy-guidelinesSkill
- kestraSkill
- list-large-filesSkill
- list-most-intensive-processesSkill
- llama-cppSkill
- llm-wikiSkill
- mermaidSkill
- morning-ritualSkill
- obsidian-masterSkill
- obsidian-open-loops-collectorSkill
- opencode-agent-creatorSkill
- opencode-cliSkill
- pi-cliSkill
- planka-development-flowSkill
- plnk-cliSkill
- ponytailSkill
- product-prd-brainstormingSkill
- python-api-developerSkill
- ralph-prd-converterSkill
- ralph-prd-generatorSkill
- release-managementSkill
- rest-testsuite-skillSkill
- skill-loaderSkill
- design-taste-frontendSkill
- terraformSkill
- tmux-coderSkill
- tmux-specialistSkill
- trello-cliSkill
- tts-conversationSkill
- uvSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Create new agent definitions or chains
- Distinctive: line 14
Run subagents to perform tasks
- Very specific: line 172
Create a file at ~/.agents/code-analyzer.md:
- Very specific: line 559
Use tasks for independent work:
- Distinctive: line 577
Check agent name matches exactly (case-sensitive)
- Distinctive: line 578
Verify file is in correct location
- Very specific: line 584
Use clarify: false to skip TUI confirmation
- Very specific: line 585
Check chain artifacts at <tmpdir>/pi-chain-runs/
- Very specific: line 588
Verify output field is set (not false)
- Very specific: line 590
Check {sessionDir}/subagent-artifacts/ for debug files
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Pi-SubAgents Master
Expert instructions for creating, running, and managing pi subagent configurations and multi-agent pipelines.
When to Use This Skill
Activate when the user wants to:
- Create new agent definitions or chains
- Run subagents to perform tasks
- Design multi-step agent pipelines
- Edit existing agent configurations
- Execute parallel or sequential workflows
Quick Start: Running a Subagent
The simplest way to run a subagent task:
subagent({
agent: "agent-name",
task: "Your task description here"
})Single Agent Execution
// Basic usage
subagent({
agent: "scout",
task: "Analyze the codebase for authentication patterns"
})
// With output file
subagent({
agent: "scout",
task: "Analyze auth patterns",
output: "auth-analysis.md"
})
// With model override
subagent({
agent: "scout",
task: "Deep analysis of security",
model: "anthropic/claude-sonnet-4",
skill: "safe-bash"
})
// Forked context (branched session)
subagent({
agent: "reviewer",
task: "Review this diff",
context: "fork"
})Parallel Execution (Multiple Agents at Once)
subagent({
tasks: [
{ agent: "scout", task: "Audit frontend code" },
{ agent: "scout", task: "Audit backend code" },
{ agent: "reviewer", task: "Check security patterns" }
]
})Chain Execution (Sequential Pipeline)
subagent({
chain: [
{ agent: "scout", task: "Gather context for {task}" },
{ agent: "planner", task: "Create plan based on {previous}" },
{ agent: "worker", task: "Implement based on {previous}" }
]
})Async/Background Execution
// Non-blocking background execution
subagent({
agent: "scout",
task: "Full security audit",
async: true,
clarify: false
})
// Check status later
subagent_status({ id: "<runId>" })Agent Discovery
Agent Locations (Priority: Highest to Lowest)
| Scope | Path | Notes |
| Project | .pi/agents/{name}.md (searches up) | Highest priority |
| User | ~/.agents/{name}.md or ~/.pi/agent/agents/{name}.md | Medium |
| Builtin | ~/.pi/agent/extensions/subagent/agents/ | Lowest (can be overridden) |
List Available Agents
subagent({ action: "list" })
subagent({ action: "list", agentScope: "project" }) // Project scope only
subagent({ action: "list", agentScope: "user" }) // User scope onlyInspect an Agent
subagent({ action: "get", agent: "scout" })Builtin Agents
The extension ships with these ready-to-use agents:
- scout: Fast codebase reconnaissance
- planner: Creates implementation plans
- worker: Executes tasks
- reviewer: Code review and analysis
- context-builder: Gathers context
- researcher: Web research (requires pi-web-access)
- delegate: General delegation
Creating New Agents
Method 1: Using Management Action (Recommended)
subagent({
action: "create",
config: {
name: "code-analyzer",
description: "Analyzes code for patterns, bugs, and improvement opportunities",
scope: "user", // or "project"
systemPrompt: `You are a code analyst specialized in...
Your role is to:
1. Read and understand the code
2. Identify patterns and anti-patterns
3. Find potential bugs or issues
4. Suggest improvements
Be thorough but concise in your analysis.`,
model: "anthropic/claude-sonnet-4",
tools: "read, bash",
skills: "safe-bash",
thinking: "high"
}
})Method 2: Create Agent File Directly
Create a file at ~/.agents/code-analyzer.md:
---
name: code-analyzer
description: Analyzes code for patterns, bugs, and improvements
tools: read, bash
model: anthropic/claude-sonnet-4
skill: safe-bash
thinking: high
---
You are a code analyst specialized in...
Your role is to:
1. Read and understand the code
2. Identify patterns and anti-patterns
3. Find potential bugs or issues
4. Suggest improvements
Be thorough but concise in your analysis.Agent Frontmatter Reference
---
name: agent-name # Required: unique identifier
description: What it does # Required: clear description
tools: read, bash # Optional: comma-separated tools
# Use mcp:server/tool for MCP tools
extensions: /path/to/ext.ts # Optional: absent=all, empty=none
model: provider/model # Optional: override default model
thinking: high # Optional: off, minimal, low, medium, high, xhigh
skill: skill-name # Optional: skills to inject
output: results.md # Optional: write results to file
defaultReads: context.md # Optional: files to read before execution
defaultProgress: true # Optional: enable progress.md tracking
maxSubagentDepth: 1 # Optional: limit nested subagents
---
Your system prompt goes here.Creating Agent Chains (Workflows)
Method 1: Using Management Action (Recommended)
subagent({
action: "create",
config: {
name: "research-analyze-plan",
description: "Research topic, analyze findings, create action plan",
scope: "user",
steps: [
{ agent: "researcher", task: "Research {task}" },
{ agent: "planner", task: "Analyze {previous} and create plan" },
{ agent: "worker", task: "Execute first step from {previous}" }
]
}
})Method 2: Create Chain File Directly
Create a file at ~/.agents/research-analyze-plan.chain.md:
---
name: research-analyze-plan
description: Research topic, analyze findings, create action plan
---
## researcher
model: anthropic/claude-haiku-4-5
Research {task} thoroughly. Look for:
- Key concepts and definitions
- Best practices and common approaches
- Potential challenges and solutions
## planner
output: plan.md
progress: true
Based on the research ({previous}), create an actionable plan.
Format the plan with clear steps and priorities.
## worker
reads: plan.md
Execute the first step from the plan.Chain Variables
| Variable | Description |
{task} | Original task passed to the chain |
{previous} | Output from the previous step |
{chain_dir} | Path to chain artifacts directory |
Chain Step Configuration
Each ## agent-name section supports:
## agent-name
output: output-file.md # Write results to file
reads: input1.md,input2.md # Read files before executing
model: anthropic/claude-sonnet-4 # Override model
skills: skill1,skill2 # Add/override skills
progress: true # Enable progress trackingRunning Custom Workflows
Running a Custom Chain by Name
subagent({
chainName: "research-analyze-plan",
task: "How to implement authentication in React"
})Inline Custom Workflow
subagent({
chain: [
{ agent: "researcher", task: "Research {task}" },
{ agent: "planner", task: "Create plan based on {previous}" }
],
task: "Implementing JWT auth in Node.js"
})Parallel Fan-Out with Aggregation
subagent({
chain: [
{ agent: "scout", task: "Gather context" },
{
parallel: [
{ agent: "worker", task: "Implement feature A from {previous}" },
{ agent: "worker", task: "Implement feature B from {previous}" },
{ agent: "worker", task: "Implement feature C from {previous}" }
],
concurrency: 2, // Run 2 at a time
failFast: true // Stop if any fails
},
{ agent: "reviewer", task: "Review all changes" }
]
})Forked Context for Branch Analysis
subagent({
chain: [
{ agent: "scout", task: "Analyze main branch" },
{ agent: "scout", task: "Analyze feature branch" },
{ agent: "diff-analyzer", task: "Compare {previous}" }
],
context: "fork"
})Managing Agents and Chains
List All Agents and Chains
subagent({ action: "list" })Get Agent/Chain Details
subagent({ action: "get", agent: "scout" })
subagent({ action: "get", chainName: "research-pipeline" })Update an Agent
subagent({
action: "update",
agent: "scout",
config: {
model: "anthropic/claude-sonnet-4",
thinking: "high"
}
})Update a Chain
subagent({
action: "update",
chainName: "research-pipeline",
config: {
description: "Updated description",
steps: [
{ agent: "researcher", task: "New task for researcher" },
{ agent: "planner", task: "Updated planner task" }
]
}
})Delete an Agent or Chain
subagent({ action: "delete", agent: "my-agent" })
subagent({ action: "delete", chainName: "my-chain" })Practical Examples
Example 1: Code Review Pipeline
// Run a code review workflow
subagent({
chain: [
{ agent: "scout", task: "Scan codebase for {task}", output: "issues.md" },
{ agent: "reviewer", reads: ["issues.md"], task: "Review and prioritize issues from {previous}" },
{ agent: "worker", reads: ["issues.md"], task: "Fix the top 3 issues identified in {previous}" }
],
task: "authentication module"
})Example 2: Parallel Security Audit
// Run multiple security checks in parallel
subagent({
tasks: [
{ agent: "scout", task: "Check for SQL injection vulnerabilities", output: "sql-audit.md" },
{ agent: "scout", task: "Check for XSS vulnerabilities", output: "xss-audit.md" },
{ agent: "scout", task: "Check for authentication issues", output: "auth-audit.md" },
{ agent: "scout", task: "Check for authorization issues", output: "authz-audit.md" }
]
})Example 3: Research and Document
// Research a topic and create documentation
subagent({
action: "create",
config: {
name: "research-doc",
description: "Research a topic and create documentation",
scope: "user",
steps: [
{ agent: "researcher", task: "Research {task} comprehensively" },
{ agent: "worker", task: "Create documentation from {previous}", output: "docs.md" }
]
}
})
// Run it
subagent({
chainName: "research-doc",
task: "microservices architecture patterns"
})Example 4: Background Long-Running Task
// Start a long audit in background
subagent({
agent: "scout",
task: "Complete security audit of entire codebase",
async: true,
clarify: false
})
// Later check status
subagent_status({ id: "abc123" })Execution Modes Reference
Mode Selection
| Mode | Trigger | Description |
| single | agent + task | Run one agent with task |
| parallel | tasks array | Run multiple agents concurrently |
| chain | chain array | Sequential pipeline with {previous} |
| chainName | Name reference | Run saved chain definition |
Key Parameters
| Parameter | Type | Description |
agent | string | Agent name to execute |
task | string | Task description |
tasks | array | Parallel task configurations |
chain | array | Chain step configurations |
chainName | string | Name of saved chain to run |
output | string/false | Output file path |
model | string | Model override |
skill | string/array | Skills to inject |
context | "fork"/"fresh" | Execution context mode |
async | boolean | Background execution |
clarify | boolean | Show TUI before execution |
share | boolean | Share session via Gist |
sessionDir | string | Custom session directory |
maxOutput | object | {bytes, lines} limits |
artifacts | boolean | Enable artifact capture |
MCP Tools Integration
# All tools from an MCP server
tools: read, bash, mcp:chrome-devtools
# Specific tools from an MCP server
tools: read, bash, mcp:github/search_repositories, mcp:github/get_file_contentsNote: MCP integration requires pi-mcp-adapter extension. Restart pi after first connection to cache tool metadata.
Extension Sandboxing
# Absent: all extensions load (default behavior)
extensions:
# Empty string: no extensions load
extensions:
# Explicit list: only these extensions
extensions: /abs/path/to/ext-a.ts, /path/to/ext-b.tsBest Practices
1. Keep Agent Prompts Focused
Include only context the agent doesn't already have.
2. Use Output Files for Chain Steps
Enable {previous} chaining by writing outputs:
{ agent: "scout", output: "context.md" }
{ agent: "planner", reads: ["context.md"] }3. Design Reusable Chains
Identify common patterns and extract them into .chain.md files.
4. Use Thinking Levels Appropriately
thinking: low # Quick analysis
thinking: high # Deep exploration
thinking: xhigh # Maximum deliberation5. Leverage Parallel Execution
Use tasks for independent work:
tasks: [
{ agent: "scout", task: "Audit frontend" },
{ agent: "scout", task: "Audit backend" }
]6. Use Async for Long Tasks
{ agent: "scout", task: "Full audit", async: true, clarify: false }Troubleshooting
Agent Not Found
- Check agent name matches exactly (case-sensitive)
- Verify file is in correct location
- Confirm YAML frontmatter has
namefield - Restart pi if newly created agent doesn't appear
Chain Execution Issues
- First step must have explicit task (no {previous} reference)
- Use
clarify: falseto skip TUI confirmation - Check chain artifacts at
<tmpdir>/pi-chain-runs/
Output File Not Written
- Verify
outputfield is set (notfalse) - For chains, ensure step has explicit
output:config - Check
{sessionDir}/subagent-artifacts/for debug files
Quick Reference
Run Single Agent:
subagent({ agent: "scout", task: "Your task" })Run Parallel Tasks:
subagent({ tasks: [{ agent: "a", task: "t1" }, { agent: "b", task: "t2" }] })Run Chain:
subagent({ chain: [{ agent: "a", task: "t1" }, { agent: "b" }] })Create Agent:
subagent({ action: "create", config: { name: "...", description: "...", scope: "user", systemPrompt: "..." } })Create Chain:
subagent({ action: "create", config: { name: "...", description: "...", scope: "user", steps: [{ agent: "a", task: "t1" }] } })List Agents:
subagent({ action: "list" })Get Agent Details:
subagent({ action: "get", agent: "agent-name" })Update Agent:
subagent({ action: "update", agent: "agent-name", config: { model: "new-model" } })Delete Agent:
subagent({ action: "delete", agent: "agent-name" })Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

