agentleFS
cs50victorcs50victor/dynamic_workflows_mcp/skills/dynamic-workflows/SKILL.md

dynamic-workflows

Skill0 starsChanged 5 months agoMITView on GitHub

Orchestrate many Codex subagents deterministically from one JavaScript script. Use when a task splits into independent units that should run in parallel or through staged pipelines (reviewing/enriching/migrating a list, multi-angle research, fan-out then merge) and you want loops/concurrency/merging handled in code rather than by hand.

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Call the run_workflow tool (from the dynamic-workflows MCP server) with either a script (plain JavaScript) or a script_file, plus optional …

    line 8
  2. Very specific:

    If you can produce the answer yourself - a single lookup, a calculation, formatting data you already have - do it directly.

    line 58

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Dynamic Workflows

Call the run_workflow tool (from the dynamic-workflows MCP server) with either a script (plain JavaScript) or a script_file, plus optional args. Inline scripts are archived as <workflows_dir>/scripts/<run_id>.js and returned as scriptFile; script_file accepts a .js path or a bare name under workflows_dir. The script runs in an async context and orchestrates subagents. run_workflow runs in the background; use the returned runId with get_workflow_result until it returns status: "completed" or status: "failed".

The whole point of this tool is the agent() fan-out. Each agent() call spawns a fresh Codex subagent (via @openai/codex-sdk) that shares no context with other agents or with you, so pass everything an agent needs in its prompt. If your script would call agent() zero times, do not use this tool - answer or compute the result directly.

Helpers in scope

  • agent(prompt, opts?) -> result. opts: { schema, model, label, phase, cd, agentType, isolation, resumeThread }. With schema (a JSON Schema) the agent must return matching JSON and you get the parsed object; without it you get the agent's final text. Throws if that agent fails.
  • parallel(thunks) -> any[]. Runs thunks concurrently under a global cap; a throwing thunk becomes null (use .filter(Boolean)).
  • pipeline(items, ...stages) -> any[]. Each item flows through all stages independently (no barrier). Stages receive (prev, originalItem, index). A throwing stage drops that item to null.
  • phase(title) / log(msg) for progress. args is the tool's args input.

Shape

export const meta = { name: 'review', description: 'review each changed file' }

const SCHEMA = {
  type: 'object',
  properties: { file: { type: 'string' }, issues: { type: 'array', items: { type: 'string' } } },
  required: ['file', 'issues'],
}

phase('review')
const results = await parallel(
  args.files.map((f) => () =>
    agent(`Review ${f} for correctness bugs. Return JSON.`, { schema: SCHEMA, label: f })
  )
)
return results.filter(Boolean)

End the script with return <value>; that value is the workflow output returned by get_workflow_result. Default to parallel for independent work and pipeline when each item has multiple dependent stages.

When NOT to use

If you can produce the answer yourself - a single lookup, a calculation, formatting data you already have - do it directly; do not call run_workflow. A workflow that finishes with agentCount: 0 (no agent() calls) added nothing and is a misuse. Reach for run_workflow only when real subagent fan-out - parallel agent() calls, staged pipelines, or loops over many units - is worth expressing as code.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.