skill-optimizer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill Optimizer
Skill 优化器
Train an existing SKILL.md the way a deep-learning optimizer trains weights: via rollouts, gradient-like reflections, validation-gated acceptance. No model retraining; only the skill markdown changes.
像深度学习优化器训练权重一样训练现有 SKILL.md:通过 rollout、类梯度反思和验证门控接受机制。不进行模型重训练;只会修改 skill Markdown。
When to use
使用场景
Use this skill when:
- A pro-workflow skill has accumulated 8+ learn-rule rows for it
- The user reports the skill is "getting bloated" or "rules keep being repeated"
- The user wants offline, budget-capped improvement over multiple sessions
Do not use when:
- Skill has fewer than 8 trajectories (nothing to learn from)
- The user wants real-time edits (this is offline, single-shot)
- No key has been explicitly configured for the selected provider
在以下情况下使用此 skill:
- pro-workflow skill 已累积 8 条以上 learn-rule 记录
- 用户反馈该 skill 正在“变得臃肿”或“规则不断重复”
- 用户希望跨多个会话进行离线且受预算限制的改进
以下情况下不要使用:
- Skill 的训练轨迹少于 8 条(没有足够的数据可供学习)
- 用户希望进行实时编辑(这是离线、单次执行的流程)
- 尚未为所选 provider 明确配置密钥
Architecture (mirrors SkillOpt's six-stage loop)
架构(对应 SkillOpt 的六阶段循环)
text
rollout pull recent learnings from SQLite (existing learn-rule rows)
reflect optimizer LLM analyzes a minibatch, proposes add/delete/replace patches
aggregate vote-merge patches across minibatches
select clip by LR budget (default: 3 adds, 2 deletes, 3 replaces per step)
update apply selected patches to a candidate skill content
evaluate evaluator LLM scores candidate against held-out validation items
gate accept candidate only if weighted score >= current + acceptThreshold
slow update at epoch boundary, consolidate accepted edits into a coherent rewriteFailed candidates are stored in a rejection buffer and fed back to the next reflect step so the optimizer doesn't propose the same patch twice.
text
rollout pull recent learnings from SQLite (existing learn-rule rows)
reflect optimizer LLM analyzes a minibatch, proposes add/delete/replace patches
aggregate vote-merge patches across minibatches
select clip by LR budget (default: 3 adds, 2 deletes, 3 replaces per step)
update apply selected patches to a candidate skill content
evaluate evaluator LLM scores candidate against held-out validation items
gate accept candidate only if weighted score >= current + acceptThreshold
slow update at epoch boundary, consolidate accepted edits into a coherent rewrite失败的候选项会存储在 rejection buffer 中,并反馈给下一次 reflect 步骤,避免优化器重复提出相同的补丁。
Run it
运行
In a plugin session, use the MCP server's tool with and . Keys come from the plugin configuration dialog. Standalone CLI installations use explicit variables. See provider configuration; never request keys in chat or retrieve existing machine credentials.
providersrun_provider_tasktask: "optimizer"args: ["--slug", "<slug>", "--budget-usd", "0.50"]PRO_WORKFLOW_*_API_KEYbash
/skill-optimize <slug> [options]Options (all optional; sensible defaults shown):
| Flag | Default | Notes |
|---|---|---|
| 3 | Outer loop count |
| 8 | Trajectories per minibatch |
| 2 | Minibatches per epoch |
| 6 | Validation items reserved (max ~25% of trajectories) |
| 0.50 | Hard cap; loop aborts when spent |
| | Reflect + slow-update model |
| | Gate model (cheaper) |
| 3 | LR budget per step |
| 2 | |
| 3 | |
| 0.0 | Minimum score delta to accept candidate |
| 2000 | Hard cap on candidate length |
| 2 | Epochs between consolidation passes |
| off | Machine-readable output |
Kill switch: aborts the loop between steps.
touch ~/.pro-workflow/STOP在插件会话中,使用 MCP server 的 工具,并设置 和 。密钥来自插件配置对话框。独立 CLI 安装需要显式设置 环境变量。请参阅 provider 配置;绝不要在聊天中索取密钥,也不要读取机器上已有的凭据。
providersrun_provider_tasktask: "optimizer"args: ["--slug", "<slug>", "--budget-usd", "0.50"]PRO_WORKFLOW_*_API_KEYbash
/skill-optimize <slug> [options]所有选项均为可选;下表列出了合理的默认值:
| 标志 | 默认值 | 说明 |
|---|---|---|
| 3 | 外层循环次数 |
| 8 | 每个 minibatch 的训练轨迹数 |
| 2 | 每个 epoch 的 minibatch 数 |
| 6 | 预留的验证项数量(最多约占训练轨迹的 25%) |
| 0.50 | 硬性上限;达到预算后中止循环 |
| | 用于 reflect + slow update 的模型 |
| | 门控模型(成本更低) |
| 3 | 每步的 LR 预算 |
| 2 | |
| 3 | |
| 0.0 | 接受候选项所需的最低分数增量 |
| 2000 | 候选项长度的硬性上限 |
| 2 | 执行 consolidation 之间的 epoch 间隔 |
| off | 机器可读输出 |
紧急停止开关:执行 可在步骤之间中止循环。
touch ~/.pro-workflow/STOPOutput
输出
- Candidate accepted → SKILL.md overwritten, hash stamp appended in HTML comment
- Run details persist in ,
optimization_runs,optimization_candidates,optimization_patchesoptimization_rejections - Validation set persists in (reusable across runs)
optimization_validation
Inspect after:
bash
sqlite3 ~/.pro-workflow/data.db "SELECT id, skill_slug, initial_score, best_score, accepted_steps, rejected_steps, spent_usd FROM optimization_runs ORDER BY id DESC LIMIT 5"- 候选项被接受 → 覆盖 SKILL.md,并以 HTML 注释形式追加哈希标记
- 运行详情持久化到 、
optimization_runs、optimization_candidates、optimization_patchesoptimization_rejections - 验证集持久化到 (可跨运行复用)
optimization_validation
运行后检查:
bash
sqlite3 ~/.pro-workflow/data.db "SELECT id, skill_slug, initial_score, best_score, accepted_steps, rejected_steps, spent_usd FROM optimization_runs ORDER BY id DESC LIMIT 5"Rules
规则
- Validation set is frozen at run start. Never re-derive from new corrections mid-run.
- One candidate per step. No parallel branches.
- Slow-update output is itself a candidate; it must pass the gate to replace the best.
- The optimizer LLM and evaluator LLM may be different models. Mixing a strong optimizer with a cheap evaluator is the SkillOpt-recommended config.
- If at any step boundary, the loop ends with
spent_usd >= budget_usd.stopped_reason="budget exhausted" - Patches whose anchor is no longer present in the skill (because a prior patch in the same step removed it) are recorded as rejected with reason .
anchor_missing
- 验证集在运行开始时冻结。运行期间绝不能根据新的修正重新推导验证集。
- 每步仅生成一个候选项。不使用并行分支。
- slow update 的输出本身也是候选项;必须通过门控才能替换当前最佳版本。
- 优化器 LLM 与评估器 LLM 可以使用不同模型。将强大的优化器与低成本评估器结合,是 SkillOpt 推荐的配置。
- 如果在任意步骤边界处出现 ,循环将以
spent_usd >= budget_usd结束。stopped_reason="budget exhausted" - 如果同一步骤中的先前补丁已移除某个补丁所依赖的锚点(anchor),该补丁会记录为 rejected,原因 为 。
anchor_missing
Provenance
来源说明
Inspired by Microsoft SkillOpt (arXiv:2605.23904). The six-stage rollout/reflect/aggregate/select/update/evaluate pipeline, LR budget, rejection buffer, and slow / meta update mechanics are adapted to pro-workflow's existing SQLite + learn-rule data plane. No SkillOpt code is reused. "ReflACT" is not a SkillOpt term and is not used here; the loop is referred to by stage names only.
灵感来自 Microsoft SkillOpt(arXiv:2605.23904)。六阶段 rollout/reflect/aggregate/select/update/evaluate 流水线、LR 预算、rejection buffer,以及 slow / meta update 机制均适配到了 pro-workflow 现有的 SQLite + learn-rule 数据平面。未复用任何 SkillOpt 代码。“ReflACT”不是 SkillOpt 术语,此处也不使用;该循环仅以阶段名称称呼。