mcpField
E
executing-plans

executing-plans

github.com/itallstartedwithaideaAgent 工作流4482 次安装29 周前更新
代码仓库

关于 executing-plans

供 Agent 按步骤执行已批准计划的技能,包含逐步验证、人工检查点、进度跟踪,以及失败时回滚。

主要功能

  1. 01按顺序执行计划
  2. 02逐步验证结果
  3. 03人工审核检查点
  4. 04跟踪进度与耗时
  5. 05回滚到先前状态

适用场景

  1. 01按序应用多文件更改
  2. 02在执行高风险操作前审核
  3. 03跟踪跨会话或 Agent 的工作

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/itallstartedwithaidea/agent-skills --skill executing-plans

安装后在 Claude Code 中输入/executing-plans确认已加载。

详细介绍

执行计划

Agent Skills™ 的一部分,由 googleadsagent.ai™ 提供

描述

执行计划会接收一份书面计划,并通过批量执行来推进计划,同时提供人工检查点、进度跟踪和回滚能力。Agent 会逐步执行计划,在继续之前验证每一步是否成功,在指定检查点暂停以等待人工确认,并保留撤销任何失败步骤的能力。

缺乏规范执行的计划会沦为空想。这项技能会严格落实执行约定:每一步都按顺序运行,每条验证命令都必须通过,任何失败都会暂停后续执行,直到问题解决。Agent 会跟踪完成百分比、已用时间和剩余时间估算,让人工操作员清楚了解进度。

回滚能力已内置于执行模型中。在应用每一步之前,Agent 会记录更改前的状态。如果某一步未通过验证,Agent 可以自动恢复到上一个已知正常的检查点,或者向人工操作员提供选项:重试、跳过、修改或中止。

使用场景

  • 已有书面计划,并已获准执行
  • 必须按特定顺序应用涉及多个文件的更改
  • 用户希望在执行过程中的关键决策点进行监督
  • 更改具有风险,需要回滚能力
  • 执行跨越多个会话或 Agent
  • 需要跟踪进度以确保透明度

工作原理

graph TD
    A[Load Plan] --> B[Step N]
    B --> C[Record Pre-Change State]
    C --> D[Apply Change]
    D --> E[Run Verification]
    E --> F{Verification Passes?}
    F -->|Yes| G{Checkpoint Step?}
    G -->|Yes| H[Pause for Human Review]
    G -->|No| I[Update Progress]
    H --> I
    I --> J{More Steps?}
    J -->|Yes| B
    J -->|No| K[Execution Complete]
    F -->|No| L{Rollback?}
    L -->|Auto| M[Revert to Last Checkpoint]
    L -->|Manual| N[Present Options to Human]
    M --> B

执行引擎会为每一步维护一个状态机:待处理、进行中、已验证、失败、已回滚。人工检查点可配置,默认每 3 步设置一次,并在任何破坏性操作前设置。

实现

class PlanExecutor:
    def __init__(self, plan, checkpoint_interval=3):
        self.plan = plan
        self.checkpoint_interval = checkpoint_interval
        self.snapshots = {}
        self.progress = []

    def execute(self):
        for i, step in enumerate(self.plan.steps):
            self.snapshots[i] = self.capture_state(step.affected_files)
            self.update_status(step, "in_progress")

            try:
                self.apply_change(step)
                result = self.run_verification(step.verify_command)

                if not result.success:
                    raise VerificationError(step, result.output)

                self.update_status(step, "verified")
                self.report_progress(i + 1, len(self.plan.steps))

                if self.is_checkpoint(i):
                    self.pause_for_human_review(step)

            except (ApplyError, VerificationError) as e:
                self.update_status(step, "failed")
                self.handle_failure(i, e)

    def handle_failure(self, step_index, error):
        self.rollback_to(step_index)
        options = [
            "retry: Re-attempt this step",
            "modify: Edit the step and retry",
            "skip: Mark as skipped and continue",
            "abort: Stop execution entirely",
        ]
        return self.prompt_human(error, options)

    def rollback_to(self, step_index):
        for path, content in self.snapshots[step_index].items():
            self.restore_file(path, content)

    def report_progress(self, completed, total):
        pct = (completed / total) * 100
        print(f"Progress: {completed}/{total} ({pct:.0f}%) | "
              f"Elapsed: {self.elapsed()} | "
              f"Remaining: ~{self.estimate_remaining(completed, total)}")

最佳实践

  • 开始执行前,务必确认计划已获批准
  • 每次修改前都保存文件状态,以确保可以安全回滚
  • 在破坏性操作(删除、迁移、部署)前设置检查点
  • 每完成一步后都报告进度,而不只是最后报告
  • 如果某一步连续失败两次,应升级给人工处理,而不是无限重试
  • 每完成并验证一步后都提交,以在版本控制中创建还原点

平台兼容性

平台支持情况备注
Cursor完整使用 Shell + TodoWrite 跟踪进度
VS Code完整基于终端执行
Windsurf完整Cascade 步骤执行
Claude Code完整使用 Shell + 检查点提示词
Cline完整任务运行器集成
aider部分不支持原生检查点

相关技能

  • 编写计划 - 编写计划并生成本技能执行所需的分步规范
  • 子 Agent 驱动的开发 - 并行分派任务,将计划步骤交由彼此隔离的子 Agent 执行
  • Git Worktrees - 隔离的工作区,可为验证每个执行步骤提供干净的基线

关键词

plan-execution batch-execution human-checkpoints rollback progress-tracking verification state-machine step-by-step-execution


© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License

评论

支持 Markdown