Skip to content
Skills Library
AI & agents · Building & coding

dynamic-workflows

/dynamic-workflows

Use when authoring, resuming, or debugging a durable workflow script with workflow_run. Covers choosing subagent topology, fan-out, holes, replay-safe node keys, and result reporting.

Licence
MIT
Last repository change
03.11.2026

Assessment and security

98/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene13 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
1
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 03.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • SKILL.md zawiera komentarze HTML (1). Nie widać ich w podglądzie Markdown, a model je czyta.

What it does and when to use it

Use when authoring, resuming, or debugging a durable workflow script with workflow_run. Covers choosing subagent topology, fan-out, holes, replay-safe node keys, and result reporting.

Original author description

Use when authoring, resuming, or debugging a durable workflow script with workflow_run. Covers choosing subagent topology, fan-out, holes, replay-safe node keys, and result reporting.

How it works

  1. Script shape
  2. Replay rules
  3. Topology choices
  4. Operating a run
Original SKILL.md headings · 99 lines, 683 words
SKILL.md preview
---
name: dynamic-workflows
description: >-
  Use when authoring, resuming, or debugging a durable workflow script with workflow_run. Covers choosing subagent topology, fan-out, holes, replay-safe node keys, and result reporting.
---

<!-- Rewritten for dsh from the ZCode dynamic-workflows skill (Apache-2.0):
     apps/zcode-cli/packages/zcode-cli/skills/dynamic-workflows (CreateWorkflow
     family). dsh replaces the tool facade with one script tool, workflow_run,
     and the sandbox API in docs/04-durable-workflow.md. -->

# Durable workflows

`workflow_run` executes a JavaScript body on the host. Every `agent(prompt)`
call becomes a durable node: if the run resumes, completed nodes return their
stored output instead of calling the model again. Use a workflow when work has
several independent subagent calls, an obvious phase boundary, or a question
that may need a human answer in the middle.

`workflow_run` is visible. The other workflow tools are deferred: load the one
you need with `tool_search` (`workflow_get_run`, `workflow_list_runs`,
`workflow_resume`, `workflow_cancel`, `workflow_amend`,
`workflow_answer_hole`).

## Script shape

```js
phase('collect')
const files = args.files

const summaries = await parallel(files, async (file) => {
  return await agent(`Summarize ${file} in three bullets.`, { key: `summary:${file}` })
}, { concurrency: 4 })

phase('synthesize')
const answer = await agent(
  `Combine these summaries into one brief:\n\n${summaries.join('\n\n')}`,
  { key: 'synthesis' },
)
report({ answer })
return answer
```

Sandbox:

| Name | Contract |
|---|---|
| `args` | JSON object passed to `workflow_run` |
| `agent(prompt, { key? })` | Run one subagent and return its final text. Without a key, identity is the call ordinal; with a key, identity is the key. |
| `parallel(items, fn, { concurrency? })` | Run `fn(item, index)` concurrently; default 4, max 16. |
| `pipeline(items, ...stages)` | Run each item through stages sequentially; returns one result per item. |
| `phase(name)` | Append a phase marker to the journal. |
| `log(message)` | Append a progress line. |
| `report(value)` | Append a structured report to the journal. |
| `hole(prompt)` | Pause and ask the user; after `workflow_answer_hole`, replay returns the answer. |
| `console.log` | Alias of `log`. |

Return a JSON-serializable value; it becomes the run result.

## Replay rules

- A node is identified by `(scriptHash, ordinal-or-key, prompt)`. Keep prompts
  deterministic from `args` and prior node outputs. Never build a prompt from
  the current time, randomness, or iteration order that can change.
- Use an explicit `{ key }` for every branch of `parallel`, or a resumed run
  can allocate ordinals in a different order and re-call the model.
- `log`, `phase`, and `report` are journal events, not cached values. A replay
  appends them again; keep them idempotent and cheap.
- Do not do filesystem or network side effects directly: the script sandbox has
  no `fs`, `fetch`, or `require`. Ask a subagent to do that work, and make the
  subagent prompt say whether it may write.
- A completed run is not re-executed by `workflow_resume`; amend the script with
  `workflow_amend` to create a successor run.

## Topology choices

| Task | Shape |
|---|---|
| One inspection, then one answer | Two sequential `agent()` calls |
| Same operation over independent files | `parallel(items, fn)` with per-item keys |
| Each item needs several ordered stages | `pipeline(items, stage1, stage2)` |
| Unknown scope discovered mid-run | `agent()` to plan, then `parallel()` over the plan |
| Missing human decision | `hole('Which environment should I deploy to?')` |

Keep fan-out justified: every node is a model call with cost and latency. Do
not create a workflow for a single subagent call; call `subagent` directly.

## Operating a run

- `workflow_run({ script, name?, args? })` returns a run id immediately; the
  run continues in the background and notifies the parent session when it
  settles or pauses at a hole.
- `workflow_get_run(id)` returns status, result, error, holes, and node count.
- `workflow_list_runs` lists recent runs; the right sidebar shows the same runs
  with node state and journal events.
- `workflow_cancel(id)` stops a queued/running run. Completed nodes stay cached.
- `workflow_resume(id)` replays from the store; no completed node is re-called.
- `workflow_amend(id, { script, name? })` creates a successor run and cancels
  the old one.
- `workflow_answer_hole({ run_id, hole_id, answer })` fills a hole and resumes.

Limits: at most 100 `agent()` calls per run (bundle default) and 30 minutes per
node. Split a larger job into several runs instead of raising the cap blindly.

Versions

RepositoryScoreLicence
This page · liyunxuanyu/dsh-zcode-port98MIT
posthog/posthog100MIT
TheBeardedBearSAS/claude-craft100MIT
TheBeardedBearSAS/claude-craft100MIT
Habitat-Thinking/ai-literacy-superpowers100Apache-2.0
zircote/workflows-plugin100MIT
asgeirtj/system_prompts_leaks89CC0-1.0
HaizhuAI/Zkali89Apache-2.0

Database snapshot: 13.11.2026 · package version bbe3d130afc1 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 98dynamic-workflow
    Create, review, run, inspect, pause, resume, and cancel durable JavaScript workflows that coordinate multiple headless Codex agents. Use for dynamic fan-out and fan-in, per-item analysis, multi-stage agent pipelines, loops or branches driven by worker results, long background…
  • 100workflow-creator
    Create or update reusable Dynamic Workflow JavaScript files under .qwen/workflows. Use when the user asks to create, save, edit, or reuse a Dynamic Workflow, including requests started from the Web Shell Workflows page.
  • 100run-workflow
    How to write and run a dynamic workflow script with the `run_workflow` tool: a Python script that orchestrates many agents with `agent`, `parallel`, `pipeline`, and `phase`. Use when a task splits into many independent or staged pieces of agent work (fan out over files, modules,…
  • 100dynamic-workflow
    Design and orchestrate Claude Code dynamic workflows — the new multi-agent system that fans out 10-100 subagents in parallel with verification. Teaches when to use workflows vs single-agent, how to structure fan-out/fan-in patterns, and how to build verification gates. Use when…
  • 100claude-workflows
    Guide for Claude Code dynamic workflows — JavaScript scripts that orchestrate many subagents in one background run. Use when a task needs more agents than one conversation can coordinate, codifying repeatable orchestration, running codebase-wide sweeps or large migrations,…
  • 100codex-dynamic-workflows
    Design a multi-agent workflow for a complex task when the user requests dynamic orchestration.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.