{{placeholder}} parameters. When you execute a playbook, Polpo substitutes your parameters, saves the result as a standard Mission, and runs it.
Quick Start
-
Create the playbook directory
-
Create
playbook.json -
Validate it
-
Run it
Anatomy of a Playbook
A playbook lives in a directory with aplaybook.json file:
playbook.json has three required fields and one optional:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Playbook identifier (kebab-case, must match directory name) |
description | string | Yes | Human-readable summary |
parameters | array | No | Declared parameters (see below) |
mission | object | Yes | Mission body — same shape as a MissionDocument, with {{placeholders}} |
Parameters
Each parameter declares a name, type, and constraints:| Field | Type | Default | Description |
|---|---|---|---|
name | string | — | Parameter name, used as {{name}} in the mission |
description | string | — | Human-readable explanation |
type | "string" | "number" | "boolean" | "string" | Value type — booleans accept true/false/yes/no/1/0 |
required | boolean | false | Whether the parameter must be provided |
default | string | number | boolean | — | Default value when not provided |
enum | array | — | Allowed values (enum constraint) |
Enum Parameters
Constrain a parameter to specific values:Parameter Design Tips
- Make the minimum required. Only mark parameters
requiredif the playbook literally cannot function without them. Everything else should have a sensibledefault. - Use enums for constrained choices. If a parameter only makes sense with specific values, declare them.
- Use descriptive names. The parameter
nameappears in CLI output, TUI pickers, and error messages.test_commandis better thantc. - Document defaults in
description. Mention what happens when the parameter isn’t provided:
Writing the Mission Playbook
Themission field is a standard Mission structure — teams, tasks, dependencies, expectations, quality gates — with {{placeholder}} tokens wherever you want parameter substitution.
Teams
Define volatile agents specific to this playbook:Tasks with Placeholders
Placeholders work in any string value within the mission:dependsOn references. During instantiation, Polpo serializes the mission to a string, replaces all {{param}} tokens, and parses it back.
Every placeholder in the mission must correspond to a declared parameter (or have a default). Polpo will throw an error if any
{{placeholder}} remains unreplaced after substitution.Dependencies
Task dependencies work the same as in regular Missions — reference tasks by title:Expectations
Add assessment criteria to ensure quality:Quality Gates
Block progression until quality thresholds are met:Discovery
Polpo discovers playbooks from three locations, in priority order (first match wins by name):| Priority | Location | Scope |
|---|---|---|
| 1 | <polpoDir>/playbooks/ | Project-level |
| 2 | <cwd>/.polpo/playbooks/ | Fallback (if polpoDir differs) |
| 3 | ~/.polpo/playbooks/ | User-level (shared across projects) |
playbook.json file. Directories without a valid playbook.json are silently skipped.
If two playbooks share the same name, the higher-priority location wins. This lets you override a user-level playbook with a project-specific version.
Execution Flow
When you run a playbook, four things happen:- Load — the playbook definition is loaded from disk
- Validate — parameters are checked against declared types, enums, and required flags. Defaults are applied.
- Instantiate — all
{{placeholder}}tokens are replaced with resolved values. The result is validated as legal JSON. - Execute — the instantiated mission is saved via
saveMission()and executed viaexecuteMission()— from here on it’s a standard Mission
Running Playbooks
- CLI
- TUI
- HTTP API
Validation
Always validate before running:- Required fields (
name,description,mission) are present and valid - Name is kebab-case (e.g.
bug-fix,code-review) - All
{{placeholders}}in the mission have matching parameter declarations - Optional parameters without a
defaultvalue are not used as{{placeholders}}in the mission (would fail at runtime if omitted) - Parameter definitions have valid
name,description, andtypefields
Example: Full Playbook
Here’s a complete playbook that performs a focused code review:Built-in Playbooks
Polpo ships with 8 ready-to-use playbooks:| Playbook | Description | Key Parameters |
|---|---|---|
code-review | Deep code review with analysis, fixes, and verification | module (required), focus, test_command |
bug-fix | Structured bug fix: reproduce, fix, test, verify | issue (required), scope, test_command |
refactoring | Safe refactoring with analysis and test validation | module (required), goal (required), test_command |
test-coverage | Improve test coverage for a module | module (required), target_coverage, test_command |
documentation | Generate or improve documentation | module (required), style, scope |
security-audit | Security audit with vulnerability assessment | module (required), severity, test_command |
migration | Database or API migration playbook | from (required), to (required), test_command |
onboarding | Generate onboarding docs for a codebase | module (required), audience |
Sharing Playbooks
Project-level
Put playbooks in.polpo/playbooks/ — they’re committed to version control and shared with your team.
User-level
Put playbooks in~/.polpo/playbooks/ — they’re available across all your projects. Good for personal productivity playbooks.
Override precedence
If a project and user-level playbook share the same name, the project-level one wins. This lets teams override a personal playbook with a standardized version.Playbooks vs Skills vs Missions
| Dimension | Skills | Playbooks | Missions |
|---|---|---|---|
| Layer | Prompt | Orchestration | Execution |
| Format | Markdown (SKILL.md) | JSON (playbook.json) | JSON (.polpo/missions/) |
| What it does | Injects instructions into agent’s system prompt | Generates a Mission from a parameterized playbook | Defines tasks, agents, and dependencies to execute |
| Reusability | Assigned to agents across tasks | Instantiated with different parameters | Single-use (one execution) |
| Runtime impact | Affects how the agent thinks | None — becomes a standard Mission | Drives task execution |
Tips
- Start simple. A playbook with one task and one parameter is still useful. You can add complexity later.
- Use quality gates for multi-step playbooks. They prevent wasted work when an early step produces poor results.
- Write detailed task descriptions. The agent only sees the resolved description — make it clear what “success” looks like.
- Test with
--dry-run. The CLI’s--dry-runflag shows the fully instantiated mission without executing, so you can verify placeholders resolve correctly. - Validate after editing. Run
polpo playbook validate <name>to catch placeholder/parameter mismatches early.