distill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/distill
/distill
Distill agent instruction files into structured imperatives, compose with policy algebra, and visualize the rule system. Three-stage pipeline.
将Agent指令文件提炼为结构化指令,结合策略代数(policy algebra)并可视化规则系统。这是一个三阶段流程。
Usage
使用方法
/distill # full pipeline on default files
/distill ai-workspace/rules/*.md # specific targets
/distill --stage imperatives # run only extraction
/distill --stage compose # run only policy algebra (requires prior extraction)
/distill --stage visualize # run only visualization (requires prior composition)/distill # 对默认文件执行完整流程
/distill ai-workspace/rules/*.md # 指定目标文件
/distill --stage imperatives # 仅运行提取阶段
/distill --stage compose # 仅运行策略代数阶段(需先完成提取)
/distill --stage visualize # 仅运行可视化阶段(需先完成组合)Pipeline
流程
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ /imperatives │────▶│/policy-algebra│────▶│ /visualize │
│ extract │ │ compose │ │ render │
└─────────────┘ └──────────────┘ └─────────────┘
│ │ │
JSONL file Starlark block Mermaid diagrams ┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ /imperatives │────▶│/policy-algebra│────▶│ /visualize │
│ extract │ │ compose │ │ render │
└─────────────┘ └──────────────┘ └─────────────┘
│ │ │
JSONL file Starlark block Mermaid diagramsStage 1 — Extract (/imperatives
)
/imperatives阶段1 — 提取(/imperatives
)
/imperatives- Invoke with the target files (or defaults:
/imperatives+ai-workspace/rules/*.md).AGENTS.md - Save output to .
ai-workspace/research/<name>-imperatives.jsonl - Present the summary (count, level breakdown, scope breakdown).
Ask the user: "Review the extraction before composing? (y/continue)"
- If yes: present the JSONL for review, wait for feedback, re-extract if needed.
- If continue: proceed to Stage 2.
- 调用处理目标文件(或默认文件:
/imperatives+ai-workspace/rules/*.md)。AGENTS.md - 将输出保存至。
ai-workspace/research/<name>-imperatives.jsonl - 展示提取摘要(数量、级别划分、范围划分)。
询问用户:“在组合前是否要审核提取结果?(y/继续)”
- 如果选择“是”:展示JSONL文件供审核,等待反馈,必要时重新提取。
- 如果选择“继续”:进入阶段2。
Stage 2 — Compose (/policy-algebra
)
/policy-algebra阶段2 — 组合(/policy-algebra
)
/policy-algebra- Project the JSONL to natural-language bullets: — one bullet per imperative.
<level>[ NOT] <subject> <predicate>[ when <when>] - Invoke with the projected bullets.
/policy-algebra - Save the Starlark composition to .
ai-workspace/research/<name>-policy.md - Present the surfaced structure (decision functions, branching points).
- 将JSONL转换为自然语言项目符号:— 每条指令对应一个项目符号。
<level>[ NOT] <subject> <predicate>[ when <when>] - 调用处理转换后的项目符号。
/policy-algebra - 将Starlark组合结果保存至。
ai-workspace/research/<name>-policy.md - 展示提炼出的结构(决策函数、分支点)。
Stage 3 — Visualize (/visualize
)
/visualize阶段3 — 可视化(/visualize
)
/visualize- For each major decision function in the Starlark output, invoke .
/visualize - Content shape is typically graph (decision trees) → Mermaid flowcharts.
- Append diagrams to the policy doc.
- 针对Starlark输出中的每个主要决策函数,调用。
/visualize - 内容形态通常为图形(决策树)→ Mermaid流程图。
- 将图表追加到策略文档中。
Naming
命名规则
The slug defaults to the current date + "distill" (e.g., ). Override with .
<name>2026-05-04-distill--name <slug><name>2026-05-04-distill--name <slug>Output
输出
All artifacts land in :
ai-workspace/research/- — structured extraction
<name>-imperatives.jsonl - — Starlark composition + diagrams
<name>-policy.md
所有产物均保存在目录下:
ai-workspace/research/- — 结构化提取结果
<name>-imperatives.jsonl - — Starlark组合结果 + 图表
<name>-policy.md
Failure modes
故障模式
| Condition | Behavior |
|---|---|
| /imperatives finds zero imperatives | Report and stop. No point composing empty input. |
| /policy-algebra unavailable | Skip Stage 2, warn. Stage 3 can still visualize the JSONL directly. |
| User interrupts between stages | Artifacts from completed stages are preserved. Resume with |
| 条件 | 行为 |
|---|---|
| /imperatives未找到任何指令 | 报告并终止流程。空输入无需进行组合。 |
| /policy-algebra不可用 | 跳过阶段2并发出警告。阶段3仍可直接可视化JSONL文件。 |
| 用户在阶段间中断流程 | 已完成阶段的产物会被保留。可通过 |
When to use
使用场景
- AGENTS.md or rules/ grew past a size threshold and needs trimming
- Before a major restructuring of agent instruction files
- To audit what rules actually exist vs what you think exists
- As input to a plan that modifies the rule system
- AGENTS.md或rules/目录规模超出阈值,需要精简
- 对Agent指令文件进行重大重构之前
- 审核实际存在的规则与预期规则是否一致
- 作为修改规则系统的计划输入