Community生产力与协作github.com

ATsikhanovich/ClaudeWorkflow

管理运行状态文件(workflow-state.json)的约定,用于协调器启动、恢复、重试或完成工作流步骤时的读写,以及审批脚本记录审批或拒绝操作。

ClaudeWorkflow 是什么?

该技能定义了运行工作流时单一事实来源——`workflow-state.json` 的格式和更新规则。它记录了运行 ID、需求哈希、执行计划步骤、工件状态、门控结果、重试计数器、审批状态和备注日志。技能强制要求通过后写入钩子和审批脚本进行原子更新,禁止手动编辑。它指定了状态转换规则(例如,pending → running → done|failed)、跳过步骤时如何记录备注、门控失败(最多 3 次尝试)如何终止相关步骤,以及审批仅通过特定脚本进行。对于恢复操作,该技能会重新哈希磁盘上的所有工件,标记不匹配项为过期,并仅重新执行未完成或已过期的步骤,而过期步骤及其下游依赖项也会重新执行。所有时间戳必须使用 UTC ISO-8601 格式。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ATsikhanovich/ClaudeWorkflow/tree/HEAD/.claude/skills/workflow-state

Installed? Explore more 生产力与协作 skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

工作流状态

workflow-state.json 是运行执行的单一事实来源。模式: templates/workflow-state.template.json。它由每次工件写入后的 post-write-state 钩子以及 scripts/approve_event.py / scripts/reject_event.py 更新。 代理不得手动编辑它。

键

键含义
run_id必须等于运行文件夹名称(runs/<run-id>)
requirements_hash工件的 artifacts/01-requirements.md 的 SHA-256 哈希(写入时设置)
execution_plan有序步骤:step、name、agents、depends_on、status(pending/running/done/failed)、attempts
artifacts相对于运行的路径映射 → {owner, status, sha256, updated_at}
gate_results映射 G1..G8 → {status: PASS/FAIL/PASS-N/A, attempts, findings, responsible_agent}
retry_counters映射 G1..G8 → 已消耗的重试轮数
approval{status: pending/approved/rejected, approved_at, plan_sha256, rejected_count, feedback[]}
notes仅追加的自由格式日志(决策、跳过的代理及原因)

更新规则

  1. 哈希是文件字节的 SHA-256(十六进制,小写)。当步骤由于工件状态为 done 且磁盘上的哈希匹配而被跳过时,不记录任何新内容。
  2. 状态转换:pending → running → done|failed。针对性重试仅重新运行负责代理的步骤及其下游依赖项;增加该步骤的 attempts 和 retry_counters[gate]。
  3. 跳过的代理记录在 notes 中(例如,"entertainment-planner skipped: no entertainment required"),其工件仍会写入,内容为 Not applicable — <reason>。
  4. 门控结果按门控记录,包含发现和 responsible_agent;状态为 FAIL 且 attempts 为 3 的门控停止相关执行——将下游步骤标记为 failed,并以清晰的报告结束运行。
  5. 审批:仅 scripts/approve_event.py 可以设置 approval.status = "approved" 和 approval.plan_sha256。scripts/reject_event.py 向 approval.feedback 追加内容并递增 rejected_count。对 06-event-plan.md 的修订会使 plan_sha256 失效,即使该字段已过时。
  6. 写入是原子的(临时文件 + 重命名)。保持 updated_at 为 UTC ISO-8601 格式(...Z)。

恢复合同(/plan-event --resume <run-id>)

  1. 加载状态;如果 workflow-state.json 缺失或无效 → 停止并报错。
  2. 重新哈希磁盘上 artifacts 中的每个路径;不匹配则将工件标记为 stale。
  3. 仅执行状态为 pending/running/failed 的步骤,以及工件为 stale 的步骤(及其下游依赖项)。
  4. 绝不重复执行工件为 done 且哈希匹配的步骤。
  5. 每个工件完成后,钩子自动更新状态——协调器仅更新 execution_plan、gate_results、retry_counters 和 notes。

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

相关技能