agwab/pi-workflow/workflow-guide
Claude Code and agent skill by agwab/pi-workflow
- community
Checking that the SKILL.md file is still in the repository.
Create, modify, review, or validate pi-workflow workflow definitions. Use when the user asks to build/customize a /workflow workflow, validate a workflow spec, choose stage topology for a workflow being authored, adapt an existing workflow definition, or explain pi-workflow authoring rules.
Install
npx vskill@latest install agwab/pi-workflow/workflow-guideSKILL.md
Workflow Guide
Use this skill before creating, editing, or reviewing a pi-workflow workflow.
Required first step
Read the public usage guide and bundled workflow notes before giving workflow-authoring advice:
../../docs/usage.md../../workflows/README.md
Resolve paths relative to this skill directory. Treat those docs as the source of truth for command surface, workflow resolution, artifact-graph semantics, safety policy, and validation.
Then read at least one shipped bundled spec as a quality reference before authoring, not only the scaffolds. The scaffolds show correct JSON shape; the bundled specs show correct quality — prompt discipline, evidence gates, partial-failure handling, and control/analysis split proven on real runs. Prefer the closest match:
../../workflows/deep-research/spec.json— plan -> foreach research -> normalize/verify/audit -> synthesis; strong evidence and verification discipline, expensive/cheap stage separation.../../workflows/deep-review/spec.json— triage -> foreach reviewers -> support dedup -> foreach devil's-advocate -> support partition -> report; multi-pass challenge and deterministic verdict joins.../../workflows/spec-review/spec.jsonand../../workflows/impact-review/spec.json— mapping/synthesis shapes.
Copy their proven conventions (see "Quality design patterns"), not just their structure.
Core rules
- Prefer a bundled workflow before inventing a new topology.
- When authoring a new workflow and a scaffold topology fits, start from
./scaffolds/<name>/rather than inventing the JSON shape from scratch. - Public
schemaVersion: 1workflow specs useartifactGraph.stages. - Stage order controls scheduling only; it does not pass prior output into a later plain
singlestage. - If a model stage needs prior artifacts, use
single.fromorreduce.from; useforeach.fromfor array fan-out and supportfromfor deterministic helpers.afteris order-only. - For static data-driven fan-out, use
foreach.fromwith a simple dot path into upstreamcontrol.json. - Use
each.itemIdentityPathonly for non-streaming foreach items with a stable string identity, andeach.itemPayloadPathonly for a distinct object payload. The runtime rejects missing, duplicate, unsafe, or colliding identities rather than falling back silently. - Use
inputPolicy.terminalBarrier: "all-sources"for an intentional all-terminal fan-in,invalidateOnDependencyResume: trueonly for static graph consumers that must discard stale generated evidence on source resume, andmaxCompiledPromptCharswhen the final prompt needs a hard code-point ceiling. All three are opt-in; unsupported replay ownership fails closed. - Use
type: "dynamic"only for trusted adaptive orchestration that must create official child tasks at runtime withctx.agent(),ctx.helper(), orctx.workflow().maxNestedWorkflowDepthis actual ancestor-relative nonconsumable headroom: depth 1 allows sibling children, not grandchildren; child settings cannot widen ancestor allowances. Missing/ambiguous ancestry grants no new depth. Keep the other work/runtime/tool budgets; depth is not a sibling-work cap. Hotcounters.nestedWorkflowDepthis only a local 0/1 launch projection. Full retained historical depth requires explicitreadOrRebuildDynamicState(cwd, runId, { observeDescendants: true })runtime inspection, is not persisted into the hot cache, and is never launch authority. Do not import private runtime modules into reusable helpers. - For synthesis/fan-in, use
reduce.fromand require/encourageworkflow_artifactreads for detailed upstream artifacts. - For deterministic local post-processing, declare a
supportobject withsupport.usespointing to a bundle-local./*.mjshelper; support is trusted local code, not sandboxed subagent work and does not use a separatetypevalue. - Put already-known, caller-authorized inventory, canonical task binding, IDs, schemas, joins, counts, escaping, and rendering in static code instead of asking a model to restate or transform them. Keep models for requirements, topology, unknown discovery, domain semantics, and substantive judgment. Never substitute a fixed inventory when the workflow must discover the inventory.
- For iteration, use
loopwith fixed child stages,maxRounds, and deterministicuntil. A positivemaxRoundsbounds rounds; explicitmaxRounds: nullremoves the round cap. For unlimited loops, omitprogressPathto terminate only byuntil, blocking failure, or explicit stop; an explicitprogressPathopts into no-progress stopping. Model-task time limits are separate (maxRuntimeMs: 0disables them). Loop children aresingle/reduceonly, run serially, and must not declarefrom/after: each child implicitly sources the earlier children of its round (for example<loop>.r01.compare), and the first child of every later round sources the previous round plus a# Loop Carry-Forward Contextblock.untilmust target the final child ({ "stage": "<final-child>", "path": "$.field", "equals": true }, orall/anycombinators; predicatesequals,notEquals,lengthEquals,exists), and that path must exist in the final child's control schema and few-shot example. Loops cannot be resumed; start a fresh run after changing the spec. See "Loop behavior" indocs/usage.mdfor the exact contract. - Agent-declared tools are the authority ceiling; workflow
toolscan only narrow them. - To reuse agent knowledge across stages, declare top-level
roles(fromAgentextracts safe agent sections;promptappends literal text). Compiled role text is injected as a# Role Contextblock; check the result with/workflow roles <workflow>. See "Roles" indocs/usage.md. - Independently classify every model-backed stage with
profileRole:planning,research-execution,synthesis,verification, orfinal-judgment. This is required for Codex/Codex High/Claude/Mixed/Custom user profile coverage and must reflect the work's semantic purpose, never a stage-name guess. Put it onsingle/foreach/reduce/dynamicstages, nested DAG/loop children, and model-backedonExhausted; a dynamic stage's role classifies its generated-agent runtime defaults, and each present decision-loopplanner/workerDefaults/verifier/synthesisprofile object also needs its own role. Do not put it on support or DAG/loop containers.profileRoleis not the agent-contextrolefield. - Keep review/research workflows read-only unless the workflow explicitly documents managed-worktree mutation.
- Write-capable workflows need explicit worktree policy, validation/check stages, and protected-path awareness.
- In non-git workspaces with
worktreePolicy: "off", writes mutate the live directory. - Choose one of three user workflow scopes: project-private
.pi/workflows/<name>/spec.json, project-shared/trackedworkflows/<name>/spec.json, or user/global~/.pi/agent/workflows/<name>/spec.json. Flat<name>.jsonis fine only when no local schemas/helpers are needed. - Name priority is project-shared
workflows/, project-private.pi/workflows/, user/global, then the installed package bundle; higher roots shadow lower ones and ambiguity is fail-closed only within the winning priority. - If the user asks to create a workflow but does not specify storage scope, ask them to choose project-private, project-shared/tracked, or user/global before writing. Treat changes to pi-workflow's official package
workflows/as a separate promotion step requiring an explicit package-distribution request. - For natural-language execution of existing workflows, prefer
workflow_listandworkflow_runwhen those tools are available; use/workflow ...commands as the deterministic manual fallback. - Always run
/workflow validate <workflow-or-file>before handing off or running a reusable workflow. There is no validate tool, so from an agent/tool context run it non-interactively from the project directory:pi -p --no-session "/workflow validate <workflow-or-file>"; it prints the same summary andWarnings:list as the interactive command and exits non-zero on an invalid spec.
Authoring intake
When the workflow-definition request is vague, broad, or self-contradictory, do not write a spec yet. Clarify the authoring target first, then build collaboratively.
- Identify the requested workflow-definition action: create new, modify existing, review existing, validate existing, or explain authoring rules.
- Identify the workflow target path/name and storage scope. If not explicit, ask the user to choose project-private
.pi/workflows/, project-shared/trackedworkflows/, or user/global~/.pi/agent/workflows/before writing files. Modifying pi-workflow's official package bundle is a distinct, explicit package-distribution choice. - Ask only for decisions that determine the workflow graph and safety posture:
- What runtime task will the workflow handle, and what final artifact should it produce?
- What downstream decision depends on the output?
- Where should the workflow live: project-private, project-shared/tracked, or user/global? Treat official package distribution as a later explicit promotion decision.
- Is the workflow read-only, or write-capable with managed worktree expectations?
- Is the graph a fixed DAG, static fan-out (
foreach), synthesis (reduce), boundedloop, nesteddag, support-helper pipeline, or trusted adaptive dynamic stage? - Which agents must exist, and what tool ceiling do they allow?
- Which stage outputs are machine-read by later stages and therefore need control schemas?
- For storage scope, prefer Pi's
questiontool when available instead of free-text. Use descriptions so the user can choose without knowing workflow internals:
project-private: save under the current project's.pi/workflows/<name>/; best for local paths or experiments. Discoverable only from this project and usually ignored by git.project-shared: save underworkflows/<name>/; best for a repo-committed workflow shared with the team.global: save under~/.pi/agent/workflows/<name>/; best for personal workflows reused across projects. Avoid hard-coded project paths unless intentional.
Example question tool shape: question({questions:[{id:"workflow_storage_scope",label:"Storage",prompt:"Where should I save this workflow?",options:[{value:"project-private",label:"Project-private",description:"Use only in this project; save under .pi/workflows/<name>/."},{value:"project-shared",label:"Project-shared/tracked",description:"Commit with this repo under workflows/<name>/."},{value:"global",label:"Global/user",description:"Reuse from any project; save under ~/.pi/agent/workflows/<name>/."}],allowOther:true}]}).
- Survey existing workflows only when choosing a base template, adapting a known workflow, or checking whether a requested new workflow is unnecessary. Do not invent a new topology when an existing workflow definition already satisfies the authoring request.
- If the request is contradictory (for example "read-only" plus "edit and commit"), name the conflict and offer concrete alternatives rather than silently resolving it. Workflow workers do not commit; mutation goes through a managed worktree for human review with no auto-merge.
- Before writing a new or revised spec, briefly note the chosen stage graph (nodes,
from/foreach.from/reduce.from/support edges, read/write policy, schemas/helpers, and storage path) when it materially affects cost, safety, or output shape. Do not ask the user to approve internal graph details unless the choice changes user-visible behavior, cost, storage scope, or mutation risk.
Authoring workflow
When creating or changing a workflow:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 93 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/workflow-guide/SKILL.md
Popularity
- Repository stars
- 355
- Repository forks
- 12
- 7-day trend score
- 29
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/agwab/pi-workflow/workflow-guide)