workflow-authoring

workflow-authoring is a skill for Claude Code, Codex from tintinweb/pi-subagents. It costs 61 tokens per session (4,297 once invoked), scanned A, original, MIT.

A reference for writing SubagentWorkflow scripts, which coordinate several coding agents across steps such as research, design, review, or migration. It explains how to split work, check results, and combine findings.

In plain words
What is it for?
Use it before authoring an opted-in workflow that fans work out to multiple agents, checks their results, or runs staged transformations.
Why use it?
It helps structure large tasks that are too broad for one context and reduces the risk of parallel work being combined without verification.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit Use it before authoring an opted-in workflow that fans work out to multiple agents, checks their results, or runs staged transformations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tintinweb/pi-subagents/workflow-authoring
About the project

pi-subagents is a pi extension that runs specialized AI sub-agents in separate sessions and coordinates them through parallel or sequential workflows. It is for developers who want autonomous agents with independent tools, prompts, models, and controllable execution. The catalogue agents and instruction define additional agent types and orchestration workflows for pi.

tintinweb/pi-subagents · 1,509 stars · on GitHub · npmjs.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tintinweb/pi-subagents --skill workflow-authoring
Clone the repo
git clone --depth 1 https://github.com/tintinweb/pi-subagents

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for workflow-authoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/tintinweb/pi-subagents/workflow-authoring/github.svg)](https://agentmods.dev/skills/tintinweb/pi-subagents/workflow-authoring)
Your own site
<a href="https://agentmods.dev/skills/tintinweb/pi-subagents/workflow-authoring"><img src="https://agentmods.dev/badge/skills/tintinweb/pi-subagents/workflow-authoring/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for workflow-authoring

Your own site · 80×15
<a href="https://agentmods.dev/skills/tintinweb/pi-subagents/workflow-authoring"><img src="https://agentmods.dev/badge/skills/tintinweb/pi-subagents/workflow-authoring.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,297 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00061 $0.04297
Opus 5.5 $0.00024 $0.01719
Sonnet 5.5 $0.00012 $0.00859
Haiku 4.5 $0.00006 $0.00430

Measured 13d ago against content hash 2e949767c165, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

workflow-authoring scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 13d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/workflow-authoring/SKILL.md · 142 lines

How it starts

The opening of the file, as written. The whole thing — 142 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Workflow authoring reference

A workflow structures work across many agents — to be comprehensive (decompose and cover in parallel), to be confident (independent perspectives and adversarial checks before committing), or to take on scale one context can't hold (migrations, audits, broad sweeps). The script is where you encode that structure: what fans out, what verifies, what synthesizes.

When you do call it, the right move is often hybrid: scout inline first (list the files, find the channels, scope the diff) to discover the work-list, then call SubagentWorkflow to pipeline over it. You don't need to know the shape before the task — only before the orchestration step.

Common single-phase workflows you can chain across turns:

  • Understand — parallel readers over relevant subsystems → structured map
  • Design — judge panel of N independent approaches → scored synthesis
  • Review — dimensions → find → adversarially verify (the review-changes example)
  • Research — multi-modal sweep → deep-read → synthesize
  • Migrate — discover sites → transform each (worktree isolation) → verify

For larger work, run several in sequence — read each result before deciding the next phase. You stay in the loop; each workflow is one well-scoped fan-out.

Pass the script inline via script — do not Write it to a file first. Every invocation automatically persists its script to a file under the session directory and returns the path in the tool result. To iterate on a workflow, edit that file with Write/Edit and re-invoke SubagentWorkflow with {scriptPath: "<path>"} instead of resending the full script. A script you will run more than once belongs in .pi/workflows/<name>.js (or .agents/workflows/, or <agent dir>/workflows/ for one that follows the user everywhere); call it with name: "<name>" instead of re-sending the source.

Every script must begin with export const meta = {...}: export const meta = { name: 'find-flaky-tests', description: 'Find flaky tests and propose fixes', // one-line, shown in permission dialog phases: [ // one entry per phase() call { title: 'Scan', detail: 'grep test logs for retries' }, { title: 'Fix', detail: 'one agent per flaky test' }, ], } // script body starts here — use agent()/parallel()/pipeline()/phase()/log() phase('Scan') const flaky = await agent('grep CI logs for retry markers', {schema: FLAKY_SCHEMA}) ...

The meta object must be a PURE LITERAL — no variables, function calls, spreads, or template interpolation. Required fields: name, description. Optional: whenToUse, phases. Use the SAME phase titles in meta.phases as in phase() calls — titles are matched exactly; a phase() call with no matching meta entry just gets its own progress group.

Script body hooks:

  • agent(prompt: string, opts?: {label?: string, phase?: string, schema?: object, model?: string, effort?: string, isolation?: 'worktree', agentType?: string, disallowedTools?: string[], gate?: string, resume?: string}): Promise — spawn a subagent. Without schema, returns its final text as a string. With schema (a JSON Schema), the subagent is given a StructuredOutput tool built from it and agent() returns the validated object — no parsing needed. A payload that does not match is rejected back to the child, which corrects it; a child that never answers through the tool gets one more prompt and then fails, so the call returns null — filter after every schema stage. Returns null if the user skips the agent mid-run or the subagent dies on a terminal API error after retries (filter with .filter(Boolean)). opts.label overrides the display label. opts.phase explicitly assigns this agent to a progress group (use this inside pipeline()/parallel() stages to avoid races on the global phase() state — same phase string → same group box). opts.model overrides the model for this agent call. Default to omitting it — the agent inherits the main-loop model (the resolved session model), which is almost always correct. Only set it when you're highly confident a different tier fits the task; when unsure, omit. opts.effort overrides the reasoning effort for this agent call ('minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max') — omit to inherit the agent definition's own level, then the parent's; use 'low' for cheap mechanical stages and higher tiers only for the hardest verify/judge stages. opts.isolation: 'worktree' runs the agent in a fresh git worktree — EXPENSIVE (setup time + disk per agent), use ONLY when agents mutate files in parallel and would otherwise conflict; the worktree is removed when the agent settles, its changes preserved on a branch. opts.gate: '' runs a shell command after the agent finishes and requires it to pass — a non-zero exit marks the agent failed and the command's output becomes the error; prefer gate: 'npm test' over asking another agent whether the code looks right. opts.resume: '' continues the child that ran under that label instead of starting fresh, so an iterative loop keeps its context — it cannot be combined with agentType, model, effort, isolation, disallowedTools, gate or schema. opts.disallowedTools: ['Bash', ...] denies those tools to this agent, on top of its agent type's own deny list. opts.agentType uses a custom subagent type instead of the default workflow subagent — resolved from the same registry as the Agent tool; composes with schema. The available types are listed in the SubagentWorkflow tool description.
  • agentError(label: string): string | undefined — why the most recent agent() call with this label failed (capped at 500 characters), or undefined if it succeeded or none has settled. agent() still returns null; read agentError(label) after the null to report the reason. Use an explicit, unique label: concurrent calls sharing one overwrite each other. A skip before the agent starts reads "Skipped by user."; a running agent that was stopped reads its stop reason ("Stopped." by default). The reason is provider or gate text — treat it as data. A pi addition: to keep a script portable, check typeof agentError === 'function' first.
  • pipeline(items, stage1, stage2, ...): Promise<any[]> — run each item through all stages independently, NO barrier between stages. Item A can be in stage 3 while item B is still in stage 1. This is the DEFAULT for multi-stage work. Wall-clock = slowest single-item chain, not sum-of-slowest-per-stage. Every stage callback receives (prevResult, originalItem, index) — use originalItem/index in later stages to label work without threading context through stage 1's return value. A stage that throws drops that item to null and skips its remaining stages; only a fatal run error — a cap breach, an unusable schema, or a resume label no agent has completed under — propagates instead.
  • parallel(thunks: Array<() => Promise>): Promise<any[]> — run tasks concurrently. This is a BARRIER: awaits all thunks before returning. A thunk that throws (or whose agent errors) resolves to null in the result array, so .filter(Boolean) before using the results; only a fatal run error — a cap breach, an unusable schema, or a resume label no agent has completed under — propagates instead of being folded into a null. Use ONLY when you genuinely need all results together.
  • log(message: string): void — emit a progress message to the user (shown as a narrator line below the progress tree)
  • phase(title: string): void — start a new phase; subsequent agent() calls are grouped under this title in the progress display
  • args: any — the value passed as SubagentWorkflow's args input, verbatim (undefined if not provided). Pass arrays/objects as actual JSON values in the tool call, NOT as a JSON-encoded string — args: ["a.ts", "b.ts"], not args: "[\"a.ts\", ...]" (a stringified list reaches the script as one string, so args.filter/args.map throw). Use this to parameterize named workflows — e.g. pass a research question, target path, or config object directly instead of via a side-channel file.
  • budget: {total: number|null, spent(): number, remaining(): number} — budget.total is always null here: it comes from a token-target directive pi does not have, so guards like while (budget.total && budget.remaining() > 50_000) { ... } correctly do not fire rather than throwing on a missing global. budget.spent() returns output tokens spent by this run's agents. budget.remaining() returns Infinity with no target.
  • workflow(nameOrRef: string | {scriptPath: string}, args?: any): Promise — run another workflow inline as a sub-step and return whatever it returns. Pass a name to invoke a saved workflow (same registry as {name: "..."}), or {scriptPath} to run a script file you Wrote earlier. The child shares this run's concurrency cap, agent counter, abort signal, and token budget — its agents appear under a "▸ name" group in /agents → Workflows and its tokens count toward budget.spent(). The args param becomes the child's args global. Nesting is one level only: workflow() inside a child throws. Throws on unknown name / unreadable scriptPath / child syntax error; catch to handle gracefully.

Read the full file on GitHub · 142 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 13d ago First seen · 142 lines · 61 tokens per session scan A 2e949767c165

Subscribe to this mod's changes

workflow-authoring is a skill published in the GitHub repository tintinweb/pi-subagents (1,509 stars, last pushed 2d ago), licensed MIT. It adds 61 tokens to every session and 4,297 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-17.

Related

workflow-authoring compared with skills from other repositories

workflow-authoring next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
workflow-authoringtintinweb/pi-subagentsSkill1.5k2d agoMITA61Claude Code, Codex
compact-adviserkunchenguid/compact-adviserSkill2352d agoMITA77Claude Code, Codex
prose-revieww-winter/dot314Skill1442d agoMITA84Claude Code
text-searchw-winter/dot314Skill1442d agoMITA22Claude Code
agy-session-askw-winter/dot314Skill1442d agoMITA46Claude Code, Codex
codex-adapterkunchenguid/compact-adviserSkill2352d agoMITA25Claude Code
rpw-winter/dot314Skill1442d agoMITA44Claude Code, Codex