OSOP Workflow Optimizer
Improve a workflow based on its execution history.
Target workflow
$ARGUMENTS
What to do
- 1. Read the .osop file specified in the argument
- 2. Find execution logs — look for matching
.osoplog.yaml files in sessions/ or the same directory
- 3. Aggregate stats from all matching logs:
- Per-node: average duration, failure rate, timeout rate, common errors
- Overall: success rate, average total duration, run count
- 4. Identify issues:
-
Slow steps: nodes with avg_duration > 5s
-
Failure hotspots: nodes with failure_rate > 10%
-
Bottlenecks: nodes that are both slow AND unreliable
-
Missing retries: external call nodes (api, cli, agent, infra, mcp) without retry_policy
-
Missing timeouts: external call nodes without timeout_sec
-
Parallelization: sequential chains of 3+ independent nodes
-
Missing error handling: high-risk nodes without fallback/error edges
- 5. Generate suggestions and present as a table:
CODEBLOCK0
- 6. If user approves, apply changes to the .osop file
- 7. Show diff of changes before writing
Self-optimization loop
This skill enables the feedback loop:
CODEBLOCK1
Each iteration makes the workflow more resilient and efficient.
OSOP工作流优化器
基于执行历史记录改进工作流。
目标工作流
$ARGUMENTS
操作步骤
- 1. 读取.osop文件 — 读取参数中指定的文件
- 2. 查找执行日志 — 在sessions/目录或同一目录下查找匹配的.osoplog.yaml文件
- 3. 汇总统计信息 — 从所有匹配的日志中汇总:
- 每个节点:平均耗时、失败率、超时率、常见错误
- 整体:成功率、平均总耗时、运行次数
- 4. 识别问题:
-
慢速步骤:平均耗时 > 5秒的节点
-
故障热点:失败率 > 10%的节点
-
瓶颈:既慢又不可靠的节点
-
缺少重试:未配置retry_policy的外部调用节点(api、cli、agent、infra、mcp)
-
缺少超时:未配置timeout_sec的外部调用节点
-
并行化:3个以上独立节点的顺序链
-
缺少错误处理:未配置fallback/error边的高风险节点
- 5. 生成建议并以表格形式呈现:
| 类型 | 目标节点 | 描述 | 优先级 |
|------|----------|------|--------|
| 添加重试 | fetch-data | 失败率35%,添加带退避的重试 | 高 |
| 并行化 | scan, test, lint | 独立步骤,并行执行 | 中 |
- 6. 如果用户批准,将更改应用到.osop文件
- 7. 显示更改差异 — 在写入前显示差异
自我优化循环
本技能实现反馈循环:
执行 → 记录(.osoplog) → 分析(本技能) → 改进(.osop) → 重新执行 → 更优结果
每次迭代都使工作流更具弹性和效率。