技能 编程开发 工作流生命周期管理

工作流生命周期管理

v20260707
workflow-run
用于执行和管理复杂工作流的完整生命周期。它可以控制预定义的MCP工作流状态(执行、暂停、恢复、取消),并运行基于JavaScript的原生工作流。适用于需要多步骤编排、状态监控和流程控制的业务场景。
获取技能
145 次下载
概览

Workflow Run

Run and manage a workflow on either surface.

A — MCP workflow lifecycle

When you need to run a persisted definition and control its lifecycle (pause/resume/cancel):

  1. Execute — call mcp__claude-flow__workflow_execute or mcp__claude-flow__workflow_run with the workflow ID
  2. Monitor — call mcp__claude-flow__workflow_status to check progress and step outcomes
  3. Pause — call mcp__claude-flow__workflow_pause to halt at the current step
  4. Resume — call mcp__claude-flow__workflow_resume to continue from where paused
  5. Cancel — call mcp__claude-flow__workflow_cancel to abort the workflow

Execution modes: sequential, parallel (independent steps), conditional (branch on outcome), manual gate (pause for human approval).

B — Native .claude/workflows/*.js

When you need a deterministic subagent fan-out, run a named native workflow with the Workflow tool. The named workflows are the meta.name of each .claude/workflows/*.js file (list them with /workflow or ls .claude/workflows/).

Workflow({ name: 'plugin-contract-audit' })                    // run a named workflow
Workflow({ name: 'plugin-contract-audit', args: 'ruflo-agentdb' })  // pass args → the script's `args` global
Workflow({ scriptPath: '.claude/workflows/foo.js' })           // run a script by path
Workflow({ scriptPath, resumeFromRunId: 'wf_…' })              // resume — unchanged agent() calls return cached

Notes:

  • A native workflow runs in the background; you are notified on completion (don't poll). Watch live progress with /workflows.
  • Pause/resume here is journal-based (resumeFromRunId), not the MCP state machine. Stop a run first, then resume from its runId.
  • To author a new native workflow, use the workflow-create skill.

See ADR-0002.

信息
Category 编程开发
Name workflow-run
版本 v20260707
大小 2.34KB
更新时间 2026-07-09
语言