← 返回 Skills 市场
lanyasheng

Improvement Executor

作者 _silhouette · GitHub ↗ · v1.1.1 · MIT-0
cross-platform ✓ 安全检测通过
137
总下载
0
收藏
1
当前安装
3
版本数
在 OpenClaw 中安装
/install improvement-executor
功能描述
当需要把已批准的改进候选应用到目标文件、回滚之前的变更、或预览变更效果时使用。支持 4 种 action(append/replace/insert_before/update_yaml),每次变更前自动备份。不用于打分(用 improvement-discriminator)或门禁验证(用 improvemen...
使用说明 (SKILL.md)

Improvement Executor

Applies accepted candidates with automatic backup and rollback.

When to Use

  • 把已批准的改进候选应用到目标文件(自动创建备份,支持一键回滚)
  • 回滚之前的变更(通过 receipt 中的 rollback_pointer 精确恢复)
  • --dry-run 预览变更效果,确认无误后再真正执行
  • 在 orchestrator pipeline 第 4 阶段自动调用
  • 需要对 YAML frontmatter 做字段级合并更新时(update_yaml 模式)
  • 需要在指定 heading 前插入新内容时(insert_before 模式)
  • 批量执行 ranking 中多个候选的变更
  • 验证变更是否可逆——每次执行都会产出 receipt,receipt 包含完整的原始内容

When NOT to Use

  • 给候选打分 → use improvement-discriminator(executor 不做质量判断)
  • 门禁验证 → use improvement-gate(executor 只执行,gate 才验证结果)
  • 全流程编排 → use improvement-orchestrator(orchestrator 统一调度各阶段)
  • 评估 skill 结构 → use improvement-learner
  • 候选尚未通过 discriminator 评分时,不应直接调用 executor
  • 不要用 executor 做批量文件重命名或目录结构变更——它只处理单文件内容修改
  • 不要在没有 ranking.json 的情况下调用——输入必须是 discriminator 产出的标准格式
  • 不要手动编辑 receipt.json——receipt 包含哈希校验,手动修改会导致 rollback 失败

4 Action Types

Action Description
append_markdown_section Append a new section to the end of the file
replace_markdown_section Replace an existing section by heading match (exact heading text)
insert_before_section Insert content before a matched heading
update_yaml_frontmatter Merge fields into YAML frontmatter (deep merge, preserves existing keys)

每种 action 的适用场景:

  • append — 新增全新 section(如添加 "## Caveats"),不影响已有内容
  • replace — 重写已有 section 的全部内容,按 heading 精确匹配(大小写敏感)
  • insert_before — 在指定 section 前插入内容,适合在 "## CLI" 前加 "## Design Notes"
  • update_yaml — 合并 frontmatter 字段,已有字段会被覆盖,新字段会被添加

Why Automatic Backup Matters

Tradeoff: disk space for safety — every apply creates a full copy of the original file.

之所以每次变更前都做自动备份,原因是:

  1. One bad apply can corrupt the entire skill — replace_markdown_section 如果匹配到错误的 heading,会覆盖关键内容。没有备份就无法恢复。
  2. Backup 是 rollback 的基础 — receipt 中的 rollback_pointer 指向备份文件的绝对路径和原始内容哈希。回滚时先校验哈希,确保备份未被篡改,再恢复。
  3. 备份成本极低 — SKILL.md 通常不超过 10KB,备份文件存储在 .state/backups/ 下,按时间戳命名,不会干扰版本控制。
  4. 审计需求 — 备份链构成了完整的变更历史,可以追溯任意时间点的文件状态。

问题: 为什么不用 git 替代备份?Because executor 可能在没有 git repo 的环境中运行(例如临时目录中的 skill 测试),且 git commit 粒度太粗——一次 orchestrator run 可能执行多个候选,每个都需要独立的回滚点。

\x3Cexample> 正确: 先 dry-run 预览,确认无误再执行 $ python3 scripts/rollback.py --receipt receipt.json --dry-run → 查看回滚内容,确认后去掉 --dry-run 执行 \x3C/example>

\x3Canti-example> 错误: 跳过 discriminator 直接执行 → executor 只应处理已通过评分的候选,未评分的直接执行可能破坏目标文件 \x3C/anti-example>

CLI

execute.py 是核心入口,接收 ranking artifact 和 candidate ID,输出 result.json。 rollback.py 负责回滚,接收 receipt.json 还原到变更前的状态。 两个命令都支持 --dry-run 预览变更而不实际修改文件。 execute.py 会在执行前自动创建备份,备份路径记录在 result.json 的 backup_path 字段中。 建议对高风险变更(replace/update_yaml)始终先跑 --dry-run 确认。 rollback.py 在恢复前会校验备份文件的 SHA256 哈希,防止备份被篡改。

# Apply a single candidate (requires ranking artifact + candidate ID)
python3 scripts/execute.py --input ranking.json --candidate-id CANDIDATE_ID --output result.json

# Rollback a previous change using its receipt
python3 scripts/rollback.py --receipt receipt.json

# Dry-run: preview what rollback would do without modifying files
python3 scripts/rollback.py --receipt receipt.json --dry-run

Each action type maps to a different candidate structure. Examples:

# append_markdown_section: add a new "## Caveats" section at the end
python3 scripts/execute.py --input ranking.json --candidate-id C001 --output result.json
# candidate C001's action = "append_markdown_section", content = "## Caveats\
..."

# replace_markdown_section: overwrite the "## When to Use" section
python3 scripts/execute.py --input ranking.json --candidate-id C002 --output result.json
# candidate C002's action = "replace_markdown_section", heading = "When to Use"

# insert_before_section: insert content before "## CLI"
python3 scripts/execute.py --input ranking.json --candidate-id C003 --output result.json
# candidate C003's action = "insert_before_section", before_heading = "CLI"

# update_yaml_frontmatter: merge {version: "0.2.0"} into frontmatter
python3 scripts/execute.py --input ranking.json --candidate-id C004 --output result.json
# candidate C004's action = "update_yaml_frontmatter", fields = {version: "0.2.0"}

Always preview with --dry-run before executing irreversible changes:

# Dry-run for execute (not just rollback)
python3 scripts/execute.py \
  --input ranking.json \
  --candidate-id CANDIDATE_ID \
  --dry-run \
  --output preview.json
# preview.json shows the diff without modifying the target file

Output Artifacts

Request Deliverable
Execute JSON with rollback_pointer (original content hash, backup absolute path, timestamp)
Rollback Restored file + confirmation JSON with restore status and hash verification result
Dry-run (execute) JSON diff preview: before/after content, action type, target heading
Dry-run (rollback) JSON showing what would be restored without modifying files

result.json 的核心字段:

  • status: success / failure / dry_run
  • action: 执行的 action 类型(append/replace/insert_before/update_yaml)
  • target_file: 被修改的文件绝对路径
  • backup_path: 备份文件路径(用于 rollback)
  • content_hash_before / content_hash_after: 变更前后的 SHA256 哈希
  • rollback_pointer: 包含恢复所需的全部信息,传给 rollback.py 即可一键恢复

Related Skills

  • improvement-discriminator: Scores candidates before execution — executor 的输入是 discriminator 排序后的 ranking
  • improvement-gate: Validates results after execution — gate 验证 executor 产出的 result.json
  • improvement-orchestrator: Calls executor as stage 4 — 全流程中 executor 在 evaluator 之后、gate 之前
  • improvement-generator: Produces the candidates — generator 的输出经 discriminator 评分后成为 executor 的输入
  • improvement-evaluator: Task-based evaluation — evaluator 在 executor 之前验证候选的可行性
  • improvement-learner: 6-dim structural scoring — executor 应用变更后,learner 可重新评分验证质量提升
  • benchmark-store: Pareto front data — executor 变更后 gate 会用 benchmark 数据做回归检测

Pipeline 中的数据流: generator → discriminator → evaluator → executor → gate

安全使用建议
This skill appears to do exactly what it says: edit single files (markdown/YAML frontmatter), create backups, and support rollbacks. Before installing or running it: 1) Inspect the ranking.json / receipt you pass in so the target_path and candidate action are what you expect (a candidate can point at any file path). 2) Always run --dry-run for both execute and rollback to verify diffs before changing files. 3) Note rollback.py will look under a default shared root (~/.openclaw/...) and respect OPENCLAW_ROOT if set — review that location for receipts/executions if you rely on automated rollbacks. 4) Because this skill writes files, avoid running it with elevated privileges or against system-critical paths. If you want additional assurance, review the remaining (truncated) parts of execute.py to confirm backups are created before writes (the SKILL.md claims they are).
功能分析
Type: OpenClaw Skill Name: improvement-executor Version: 1.1.1 The improvement-executor skill is designed to apply approved modifications to Markdown and YAML files with built-in safety mechanisms like automatic backups and rollback capabilities. The Python scripts (execute.py and rollback.py) use safe file-handling practices, such as yaml.safe_load and shutil.copy2, and lack any evidence of network activity, shell execution, or unauthorized data access. The SKILL.md instructions are strictly aligned with the stated purpose of managing a document improvement pipeline and do not contain any prompt-injection attempts or malicious directives.
能力评估
Purpose & Capability
Name/description (apply improvements, backup, rollback) matches the provided scripts and tests. The action handlers (append/replace/insert/update_yaml) and receipt/rollback semantics are implemented in scripts/execute.py and scripts/rollback.py.
Instruction Scope
SKILL.md and the code restrict behavior to single-file content edits, dry-run previews, and producing receipts/backups. One notable detail: rollback.py searches a default shared path (~/.openclaw/shared-context/...) using OPENCLAW_ROOT if set — this means the script can read receipts/execution artifacts from that shared area if present. That is plausible for this skill but is not declared in requires.config; users should be aware the scripts operate on arbitrary filesystem paths supplied by the ranking/receipt artifacts.
Install Mechanism
No install spec; this is a code-and-instructions bundle and relies on standard Python. No downloads or external installers are present. The code imports local repo helpers (lib.common, lib.state_machine) which is expected for in-repo skills.
Credentials
The skill declares no required env vars or credentials, which aligns with its purpose. rollback.py does read OPENCLAW_ROOT (optional) to compute a default receipts root; this env var is not declared in metadata. No network endpoints, tokens, or unrelated credentials are requested.
Persistence & Privilege
always is false and the skill does not request elevated platform privileges. It writes backups and may create pre-rollback copies in the target file's directory or under the skill state root; that is appropriate for its function.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install improvement-executor
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /improvement-executor 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.1
v2.0: 9-dim evaluation, category modifiers, per-dim Pareto tolerances, enriched docs
v1.1.0
v1.1.0: Fix 4 critical pipeline bugs (Ralph Wiggum/Autoloop/Evaluator verdict), scoring overhaul (base 4->2, LLM weight 50%, semantic relevance), generator LLM-first, learner/gate/executor fixes
v1.0.0
- Initial release of **improvement-executor**. - Supports four action types: append, replace, insert_before, and update_yaml (with detailed functions for markdown and YAML frontmatter). - Automatically creates a backup before each change; allows rollback to a previous state using a receipt. - Provides a CLI for applying, rolling back, and dry-running changes. - Clear separation of responsibilities: not for scoring (use improvement-discriminator), gatekeeping (use improvement-gate), or orchestration (use improvement-orchestrator).
元数据
Slug improvement-executor
版本 1.1.1
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 3
常见问题

Improvement Executor 是什么?

当需要把已批准的改进候选应用到目标文件、回滚之前的变更、或预览变更效果时使用。支持 4 种 action(append/replace/insert_before/update_yaml),每次变更前自动备份。不用于打分(用 improvement-discriminator)或门禁验证(用 improvemen... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 137 次。

如何安装 Improvement Executor?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install improvement-executor」即可一键安装,无需额外配置。

Improvement Executor 是免费的吗?

是的,Improvement Executor 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Improvement Executor 支持哪些平台?

Improvement Executor 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Improvement Executor?

由 _silhouette(@lanyasheng)开发并维护,当前版本 v1.1.1。

💬 留言讨论