5.7 KiB
pi Skills
This directory contains custom skills for pi, a coding agent harness. Each skill adds specialized capabilities that extend what pi can do.
Installed Skills
| Skill | Description |
|---|---|
| phased-execution | Runs phased build pipelines in isolated subprocesses |
| find-skills | Discovers and installs new skills |
| gog | Google Workspace CLI (Gmail, Calendar, Drive, Contacts, Sheets, Docs) |
How Skills Work
A skill is a directory containing at minimum a SKILL.md file. When pi loads, it reads all SKILL.md files in this directory and makes their instructions available to the agent. The description field in each skill's front matter tells pi when to activate that skill.
Skills can include:
- Scripts — shell scripts, Node modules, or any executable code
- Assets — templates, prompts, validation gates, etc.
- Additional docs — referenced via relative paths from
SKILL.md
Adding a New Skill
- Create a directory under
~/.pi/agent/skills/<name>/ - Add a
SKILL.mdwith front matter and instructions - Optionally add scripts, assets, or subdirectories
- Restart pi (or the skill will be picked up on next load)
SKILL.md Format
---
name: my-skill
description: What this skill does — when pi should activate it
---
# My Skill
Instructions for the agent go here.
Cloning Skills from Other Sources
To install a skill from a git repo or another location, you can clone it directly into this directory:
git clone https://github.com/user/my-skill ~/.pi/agent/skills/my-skill
Or symlink for development:
ln -s /path/to/my-skill ~/.pi/agent/skills/my-skill
phased-execution
Runs phased build pipelines in isolated subprocesses. Ported from opencode's next-phase / auto-phase commands.
Overview
This skill orchestrates a project's development as a sequence of phases, each executed by the LLM in its own fresh pi process. Phases are managed via files — not chat context — so even very long-running pipelines don't bloat your session history.
Each phase:
- Reads the master plan (
.agent/PLAN.md) and any already-completed phases - Implements all tasks from its phase file
- Runs tests, linting, and coverage checks via
.agent/validate.sh - Retries up to
MAX_FIX_ATTEMPTStimes on failure (resuming the same session) - Moves to
complete/only when everything passes
Directory Structure
<project>/
├── .agent/
│ ├── PLAN.md # Master plan; LOCKED DECISIONS are binding
│ ├── validate.sh # Quality gate (created from skill template on first run)
│ ├── phases/
│ │ ├── todo/ # Pending phases: 01_name.md, 02_name.md, …
│ │ └── complete/ # Finished phases
│ ├── reports/ # Per-phase executor reports, stderr, validation logs
│ └── phase-sessions/ # Resumable child pi sessions
Usage
From within a project that has .agent/phases/todo/:
Run the next pending phase:
cd /path/to/project
bash ~/.pi/agent/skills/phased-execution/scripts/run-phase.sh
Run a specific phase:
bash ~/.pi/agent/skills/phased-execution/scripts/run-phase.sh 03_api.md
Run the entire pipeline (all pending phases, in order, stopping at first failure):
bash ~/.pi/agent/skills/phased-execution/scripts/auto-phase.sh
Re-running auto-phase.sh after a failure continues where it stopped.
Configuration
Environment variables passed to the scripts control behavior:
| Variable | Default | Meaning |
|---|---|---|
MAX_FIX_ATTEMPTS |
3 |
Fixer retries per phase |
PHASE_MODEL |
session default | Model for child executors (e.g. anthropic/claude-sonnet-4-5) |
PHASE_THINKING |
session default | Thinking level for child executors |
PHASE_COMMIT |
0 |
1 = auto-git-commit after each passing phase |
PI_TRUST |
0 |
1 = pass --approve to children (load project .pi/ settings) |
FRESH_FIX |
0 |
1 = fixer retries start fresh instead of resuming the failed session |
QUIET |
0 |
1 = suppress live progress display (reports still written) |
Example:
PHASE_MODEL=anthropic/claude-sonnet-4-5 PHASE_COMMIT=1 bash ~/.pi/agent/skills/phased-execution/scripts/auto-phase.sh
How It Works
run-phase.sh/auto-phase.shfinds the project root (walks up fromPWDfor.agent/phases/todo/)- For each phase, it spawns a separate pi subprocess with
--mode jsonto capture structured output progress.mjsstreams live progress (tool calls, assistant text) to the terminal and writes the final report to.agent/reports/- After the child exits,
.agent/validate.shis run as the quality gate - On success: phase moves to
complete/, report is printed - On failure: up to
MAX_FIX_ATTEMPTSfixer retries (resuming the same session), then the phase stays intodo/
After a Run
- Success: The executor report is printed at the end of the script output. Phases in
.agent/phases/complete/are already done. - Failure: Point to
.agent/reports/<phase>.a*.{md,err,validate}for logs. Resume with:Or re-run the script to retry automatically.pi --session-dir .agent/phase-sessions -c
Creating Phases
Phase files are typically created by prompt templates like /to-phase, /audit-create, /new-project, and /new-python-*. Each phase file in todo/ should list concrete tasks the executor must complete, including testing & quality criteria.