/distill
One-time snapshot extracting patterns from work history and accumulated lessons, distills into concrete improvements — new agent/skill suggestions, memory pruning, consolidating lessons into rules/agent updates, or performing bin/ extraction from /audit --efficiency candidates.
Claude Code
$ npx -y skills add Borda/AI-Rig --skill distill --agent claude-code
Codex
$ npx skills add Borda/AI-Rig --skill distill -a codex -y
Cursor
$ npx skills add Borda/AI-Rig --skill distill -a cursor -y
Gemini CLI
$ npx skills add Borda/AI-Rig --skill distill -a gemini-cli -y
GitHub Copilot
$ npx skills add Borda/AI-Rig --skill distill -a github-copilot -y
OpenCode
$ npx skills add Borda/AI-Rig --skill distill -a opencode -y
Windsurf
$ npx skills add Borda/AI-Rig --skill distill -a windsurf -y
SKILL.md
distill.SKILL.mdname: distill
description: One-time snapshot extracting patterns from work history and accumulated lessons, distills into concrete improvements — new agent/skill suggestions, memory pruning, consolidating lessons into rules/agent updates, or performing bin/ extraction from /foundry:audit --efficiency candidates. Roster boundary analysis → /foundry:audit agents (Check 46).
argument-hint: '[prune | memory | executables [<run-dir-or-report-path>] | "external <url-or-path>" | "<recurring task description>"] [--project] [--eager] [--keep "<items>"]'
disable-model-invocation: true
allowed-tools: Read, Edit, Bash, Glob, Grep, Write, AskUserQuestion, Agent, WebFetch, TaskCreate, TaskUpdate, TaskList
effort: low
<objective>
Analyze how Claude Code is used, surface concrete improvements — new agents/skills to reduce repetition, or consolidate lessons into governance files (rules, agent instructions, skill updates) — without duplicating what exists.
NOT for single-file edits or quality checks — use `/foundry:audit` for config quality checks. NOT for audit-only scan for extraction candidates (use `/foundry:audit --efficiency` instead of `distill executables` for detection-only).
</objective>
<inputs>
- **$ARGUMENTS**: optional. Modes:
- Omitted: analyze existing patterns and agents; generate suggestions proactively.
- `prune [--eager]` — evaluate project memory file for stale, redundant, or verbose entries. Default: advisory diff + apply prompt. `--eager`: score every entry (Usage likelihood × Impact → Tier P0/P1/P2), print full scored table with `#` column, let user select by tier or item numbers, delegate edits to `foundry:curator`.
- `memory [--eager]` — read `.notes/lessons.md` and memory feedback files, distill recurring patterns into proposed rule files, agent instruction updates, skill workflow changes. `--eager`: include Pattern count, Strength, Tier columns in proposal table; let user select clusters to promote by tier or item numbers; delegate writes to `foundry:curator`.
- `external <source> [--eager]` — analyse external plugin, skill, or agentic resource, produce structured adoption proposal. `<source>` is URL, file path, or local directory. `--eager`: lower adoption bar — recommend partial adoption even for single useful components.
- `executables [--eager] [<run-dir-or-report-path>]` — perform bin/ extraction from `/foundry:audit --efficiency` Check 33 candidates. Auto-detects latest run dir under `.reports/audit/`; pass optional path to target specific run dir or report file. Runs inline Check 33 scan when no report exists. Default gates on HIGH/MEDIUM verdict. `--eager`: also surface LOW verdict clusters as extraction candidates. Spawns `foundry:sw-engineer` per cluster. Skip to **Mode: Executables Extraction** below.
- `[--eager] <recurring task description>` — use description as context when generating suggestions. `--eager`: lower frequency threshold from 3+ to 2+ occurrences; single high-effort occurrence also qualifies.
- `--project` — in `prune` and `memory` modes, show interactive project picker: enumerate all slugs under `~/.claude/projects/*/memory/` with MEMORY.md size in tokens, let user select which project(s) to operate on. Omit to operate on the **current project's** memory only (the working directory's memory dir, resolved by `resolve_memory_dir.py`) — other projects are never touched without the picker. No effect on other modes.
</inputs>
<compaction>
- Key boundary 1: end of Step 2 frequency heuristics (default mode only — prune/memory/external/executables exit early), before Step 3 gap analysis.
- Preserve at boundary 1: EAGER flag, ARGUMENTS_FINAL (stripped), no run-dir (default mode is stateless).
- Terminal paths: end of Step 5 report (default mode); end of Memory Pruning mode (both eager and standard branches).
</compaction>
<workflow>
**Task hygiene** — task tools may be deferred; load before first use: `ToolSearch(query="select:TaskList,TaskCreate,TaskUpdate,TaskGet", max_results=4)`. Call `TaskList` first and triage each task it returns: `completed` if work clearly done, `deleted` if orphaned, keep `in_progress` only if genuinely continuing. Never spend a turn on bookkeeping alone — every `TaskCreate`/`TaskUpdate` ships in the same response as the next substantive tool call; one exception, `TaskUpdate(completed)` immediately before a long output block (`rules/task-lifecycle.md`).
PLUGIN_ROOT=$(python "${CLAUDE_PLUGIN_ROOT}/bin/resolve_plugin_root.py" --plugin-name foundry) || exit $?; export PLUGIN_ROOT
export CSID="${CLAUDE_CODE_SESSION_ID:-$PPID}"
python "$PLUGIN_ROOT/bin/parse-skill-flags.py" --flags eager,project --keep-state distill-state --out-file "${TMPDIR:-/tmp}/distill-state-${CSID}/keep-items" -- "$ARGUMENTS" >/dev/null # timeout: 5000 — no eval; distill-state-<flag>-${CSID} sentinels, keep-items into the state dir it makes, clears stale contract
IFS= read -r EAGER < "${TMPDIR:-/tmp}/distill-state-eager-${CSID}" 2>/dev/null || EAGER=false
IFS= read -r PROJECT_FLAG < "${TMPDIR:-/tmp}/distill-state-project-${CSID}" 2>/dev/null || PROJECT_FLAG=false
IFS= read -r CLEAN_ARGS < "${TMPDIR:-/tmp}/distill-state-clean-args-${CSID}" 2>/dev/null || CLEAN_ARGS=""
echo "EAGER=$EAGER" # shell vars don't persist across Bash calls — read from stdout
echo "PROJECT_FLAG=$PROJECT_FLAG"
echo "ARGUMENTS_FINAL=$CLEAN_ARGS"> **Note**: `EAGER`, `PROJECT_FLAG` and stripped `CLEAN_ARGS` are set by this Bash block, but shell variable state does **not** persist across separate Bash() tool calls. After this block runs, read its stdout (`EAGER=true/false`, `PROJECT_FLAG=true/false`, `ARGUMENTS_FINAL=...`), carry those values as model-context references for all subsequent mode dispatch and threshold decisions. Do not rely on `$EAGER`/`$PROJECT_FLAG` as live shell variables in later steps — substitute the literal value read from stdout. `PROJECT_FLAG=true`: mode must run interactive picker before operating.
<!-- ../../assets/images
Read more
name: distill description: One-time snapshot extracting patterns from work history and accumulated lessons, distills into concrete improvements — new agent/skill suggestions, memory pruning, consolidating lessons into rules/agent updates, or performing bin/ extraction from /foundry:audit --efficiency candidates. Roster boundary analysis → /foundry:audit agents (Check 46). argument-hint: '[prune | memory | executables [<run-dir-or-report-path>] | "external <url-or-path>" | "<recurring task description>"] [--project] [--eager] [--keep "<items>"]' disable-model-invocation: true allowed-tools: Read, Edit, Bash, Glob, Grep, Write, AskUserQuestion, Agent, WebFetch, TaskCreate, TaskUpdate, TaskList effort: low
<objective>
Analyze how Claude Code is used, surface concrete improvements — new agents/skills to reduce repetition, or consolidate lessons into governance files (rules, agent instructions, skill updates) — without duplicating what exists.
NOT for single-file edits or quality checks — use `/foundry:audit` for config quality checks. NOT for audit-only scan for extraction candidates (use `/foundry:audit --efficiency` instead of `distill executables` for detection-only).
</objective>
<inputs>
- **$ARGUMENTS**: optional. Modes:
- Omitted: analyze existing patterns and agents; generate suggestions proactively.
- `prune [--eager]` — evaluate project memory file for stale, redundant, or verbose entries. Default: advisory diff + apply prompt. `--eager`: score every entry (Usage likelihood × Impact → Tier P0/P1/P2), print full scored table with `#` column, let user select by tier or item numbers, delegate edits to `foundry:curator`.
- `memory [--eager]` — read `.notes/lessons.md` and memory feedback files, distill recurring patterns into proposed rule files, agent instruction updates, skill workflow changes. `--eager`: include Pattern count, Strength, Tier columns in proposal table; let user select clusters to promote by tier or item numbers; delegate writes to `foundry:curator`.
- `external <source> [--eager]` — analyse external plugin, skill, or agentic resource, produce structured adoption proposal. `<source>` is URL, file path, or local directory. `--eager`: lower adoption bar — recommend partial adoption even for single useful components.
- `executables [--eager] [<run-dir-or-report-path>]` — perform bin/ extraction from `/foundry:audit --efficiency` Check 33 candidates. Auto-detects latest run dir under `.reports/audit/`; pass optional path to target specific run dir or report file. Runs inline Check 33 scan when no report exists. Default gates on HIGH/MEDIUM verdict. `--eager`: also surface LOW verdict clusters as extraction candidates. Spawns `foundry:sw-engineer` per cluster. Skip to **Mode: Executables Extraction** below.
- `[--eager] <recurring task description>` — use description as context when generating suggestions. `--eager`: lower frequency threshold from 3+ to 2+ occurrences; single high-effort occurrence also qualifies.
- `--project` — in `prune` and `memory` modes, show interactive project picker: enumerate all slugs under `~/.claude/projects/*/memory/` with MEMORY.md size in tokens, let user select which project(s) to operate on. Omit to operate on the **current project's** memory only (the working directory's memory dir, resolved by `resolve_memory_dir.py`) — other projects are never touched without the picker. No effect on other modes.
</inputs>
<compaction>
- Key boundary 1: end of Step 2 frequency heuristics (default mode only — prune/memory/external/executables exit early), before Step 3 gap analysis.
- Preserve at boundary 1: EAGER flag, ARGUMENTS_FINAL (stripped), no run-dir (default mode is stateless).
- Terminal paths: end of Step 5 report (default mode); end of Memory Pruning mode (both eager and standard branches).
</compaction>
<workflow>
**Task hygiene** — task tools may be deferred; load before first use: `ToolSearch(query="select:TaskList,TaskCreate,TaskUpdate,TaskGet", max_results=4)`. Call `TaskList` first and triage each task it returns: `completed` if work clearly done, `deleted` if orphaned, keep `in_progress` only if genuinely continuing. Never spend a turn on bookkeeping alone — every `TaskCreate`/`TaskUpdate` ships in the same response as the next substantive tool call; one exception, `TaskUpdate(completed)` immediately before a long output block (`rules/task-lifecycle.md`).
PLUGIN_ROOT=$(python "${CLAUDE_PLUGIN_ROOT}/bin/resolve_plugin_root.py" --plugin-name foundry) || exit $?; export PLUGIN_ROOT
export CSID="${CLAUDE_CODE_SESSION_ID:-$PPID}"
python "$PLUGIN_ROOT/bin/parse-skill-flags.py" --flags eager,project --keep-state distill-state --out-file "${TMPDIR:-/tmp}/distill-state-${CSID}/keep-items" -- "$ARGUMENTS" >/dev/null # timeout: 5000 — no eval; distill-state-<flag>-${CSID} sentinels, keep-items into the state dir it makes, clears stale contract
IFS= read -r EAGER < "${TMPDIR:-/tmp}/distill-state-eager-${CSID}" 2>/dev/null || EAGER=false
IFS= read -r PROJECT_FLAG < "${TMPDIR:-/tmp}/distill-state-project-${CSID}" 2>/dev/null || PROJECT_FLAG=false
IFS= read -r CLEAN_ARGS < "${TMPDIR:-/tmp}/distill-state-clean-args-${CSID}" 2>/dev/null || CLEAN_ARGS=""
echo "EAGER=$EAGER" # shell vars don't persist across Bash calls — read from stdout
echo "PROJECT_FLAG=$PROJECT_FLAG"
echo "ARGUMENTS_FINAL=$CLEAN_ARGS"> **Note**: `EAGER`, `PROJECT_FLAG` and stripped `CLEAN_ARGS` are set by this Bash block, but shell variable state does **not** persist across separate Bash() tool calls. After this block runs, read its stdout (`EAGER=true/false`, `PROJECT_FLAG=true/false`, `ARGUMENTS_FINAL=...`), carry those values as model-context references for all subsequent mode dispatch and threshold decisions. Do not rely on `$EAGER`/`$PROJECT_FLAG` as live shell variables in later steps — substitute the literal value read from stdout. `PROJECT_FLAG=true`: mode must run interactive picker before operating.
<!-- ../../assets/images
Practical agent workflows for Python, ML, and open-source maintenance. AI-Rig turns recurring work—scoping a change, reproducing a bug, reviewing a pull request, running an experiment, or checking release readiness—into explicit workflows with specialist
More skills from other plugins.
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
ask-matt
Ask which skill or flow fits your situation. A router over the skills in this repo.
Questions about distill.
- Which coding agents can use distill?
- distill installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.

