Procedural Distiller
Use this skill after a task has succeeded and the session contains enough signal to preserve.
The goal is to extract procedural knowledge, not to summarize the conversation.
Triggering Rules
Run the distillation flow when all of the following are true:
- 1. The task is finished successfully.
- The session contains at least 5 relevant tool calls across
exec, read, write, edit, or browser. - At least one of these applies:
- The user explicitly asks to remember the workflow.
- The task involved environment setup, debugging, or a multi-step repair.
- Compaction risk is high and the trace contains concrete parameters worth preserving.
Do not run while the task is still active. Skip trivial sessions dominated by a single read or a one-line answer.
Distillation Workflow
- 1. Read the recent trace and keep only relevant tool events.
- Separate successful steps from failed attempts.
- Preserve concrete commands, file paths, parameter values, and code snippets that materially contributed to the outcome.
- Convert the result into three sections:
-
Success Pattern
-
Failure Triggers
-
Snippets
- 5. Write a learned skill under
skills/learned/learned-<task-slug>/. - Persist a utility score and source metadata in
memory.json.
Read references/trace-format.md only if the incoming trace shape is unclear.
Execution Notes
- - Favor exact commands over abstract summaries.
- Keep failed steps only when they teach a future agent what to avoid.
- Collapse repetitive probes into one representative line.
- If a write or edit step changed the final behavior, include the smallest useful snippet.
- If a trace already contains a user rating, store it. Otherwise default to
3 and let a future caller update memory.json.
Local CLI
Run the bundled script directly:
CODEBLOCK0
Useful flags:
- - INLINECODE12
- INLINECODE13
- INLINECODE14
- INLINECODE15
- INLINECODE16
Output Contract
The generated learned skill must contain:
- -
SKILL.md with valid frontmatter (name, description) and procedural sections - INLINECODE20 for UI metadata
- INLINECODE21 with
utility_score, source task details, and generation metadata
Stop Conditions
Stop and do not emit a learned skill when:
- - the trace is marked unsuccessful
- there are too few relevant tool calls
- the trace lacks enough detail to reconstruct a reusable procedure
程序化蒸馏器
在任务成功完成且会话中包含足够可保留的信号后使用此技能。目标是提取程序性知识,而非总结对话内容。
触发规则
当以下所有条件均满足时,执行蒸馏流程:
- 1. 任务已成功完成。
- 会话中至少包含5次相关的工具调用,涉及exec、read、write、edit或browser操作。
- 至少满足以下条件之一:
- 用户明确要求记住工作流程。
- 任务涉及环境设置、调试或多步骤修复。
- 压缩风险较高,且跟踪记录中包含值得保留的具体参数。
任务仍在进行中时不要执行。跳过以单次读取或单行回答为主的琐碎会话。
蒸馏工作流程
- 1. 读取最近的跟踪记录,仅保留相关的工具事件。
- 将成功步骤与失败尝试分开。
- 保留对结果有实质性贡献的具体命令、文件路径、参数值和代码片段。
- 将结果转换为三个部分:
- 成功模式
- 失败触发条件
- 代码片段
- 5. 在skills/learned/learned-<任务标识>/目录下编写已学习的技能。
- 在memory.json中持久化存储效用评分和源元数据。
仅在传入的跟踪记录格式不清晰时,阅读references/trace-format.md。
执行说明
- - 优先使用精确命令而非抽象总结。
- 仅当失败步骤能教导未来的代理避免什么时才保留。
- 将重复的探测步骤压缩为一条代表性记录。
- 如果写入或编辑步骤改变了最终行为,包含最小有用的代码片段。
- 如果跟踪记录中已包含用户评分,则保留该评分。否则默认为3,让未来的调用者更新memory.json。
本地命令行界面
直接运行捆绑脚本:
bash
python distill_logic.py --trace /path/to/trace.json --task 修复构建缓存 --output-root /path/to/skills
有用的标志:
- - --utility-score 4
- --learned-root learned
- --min-tool-calls 5
- --max-events 20
- --force
输出约定
生成的已学习技能必须包含:
- - SKILL.md,包含有效的前置元数据(name、description)和程序化章节
- agents/openai.yaml,用于UI元数据
- memory.json,包含utility_score、源任务详情和生成元数据
停止条件
在以下情况下停止且不生成已学习技能:
- - 跟踪记录标记为未成功
- 相关工具调用次数过少
- 跟踪记录缺乏足够细节以重建可复用的流程