distill
Skill9 starsChanged 42 days agoMITView on GitHub
Unified distillation pipeline: process inbox sources (journal, meetings, tweets, web-clips, think-outputs) into knowledge notes, task candidates, and entity updates, then refresh queued note metadata. Use when the user asks to distill, process the inbox, or extract knowledge and tasks from recent inputs.
77 other projects use a version of this.
Adopted by
Most recently taken up by
- kuni29/claude-skillstheir own version, first seen Nov 29, 2026
- veschin/skilliosistheir own version, first seen Nov 29, 2026
- Integralist/agent-skillstheir own version, first seen Nov 26, 2026
- theexperiencecompany/gaiatheir own version, first seen Nov 26, 2026
- decebal/decebal-claude-skillstheir own version, first seen Nov 22, 2026
- DeepExtrema/Tesseracttheir own version, first seen Nov 16, 2026
Used with
Projects with it also use layout, shape and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
owshq-mecSkilllayout
Improve layout, spacing, and visual rhythm. Fixes monotonous grids, inconsistent spacing, and weak visual hierarchy. Use when the user mentions layout feeling off, spacing issues, visual hierarchy, crowded UI, alignment problems, or wanting better composition.
Also in 8 projects that use this
HAR5HA-7663Skillshape
Plan the UX and UI for a feature before writing code. Runs a structured discovery interview, then produces a design brief that guides implementation. Use during the planning phase to establish design direction, constraints, and strategy before any code is written.
Also in 11 projects that use this
klauswgSkillckm:design-system
Token architecture, component specifications, and slide generation. Three-layer tokens (primitive→semantic→component), CSS variables, spacing/typography scales, component specs, strategic slide creation. Use for design tokens, systematic design, brand-compliant presentations.
Also in 3 projects that use this
iovisorSkillevolve
Evolve uBPF through a gated spec-first workflow that propagates approved changes through requirements, design, validation, implementation, and RFC alignment artifacts.
Also in 3 projects that use this
termdockSkillrecall
Retrieves cross-session memories about past decisions, lessons, and patterns. Use when user asks about prior work, past decisions, or mentions a feature. Triggers include check memory, what did we decide, how did we solve.
Also in 6 projects that use this
bidodevSkilldevils-advocate
Challenges decisions, plans, and code by systematically arguing the opposing side. Surfaces risks, pokes holes in assumptions, and stress-tests thinking before committing. Supports intensity levels (gentle, balanced, ruthless, linus) and works with conversation context or a specific file reference. Trigger on requests like "challenge this", "poke holes", "what could go wrong", "play devil's advocate", "linus mode", or "/devils-advocate".
Also in 3 projects that use this
Other versions77 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 77
- juxt/allium★ 548same name
- educlopez/ui-craft★ 490same name
- nexmoe/DayBee★ 424same name
- nexmoe/eve★ 424same name
- Southclaws/storyden★ 350same name
- 10xChengTu/Mux0★ 337same name
- theexperiencecompany/gaia★ 336same name
- AkaraChen/aghub★ 271same name
- zacharyfmarion/openscad-studio★ 252same name
- jagrat7/linux-wallpaper-engine★ 232same name
67 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository27 other files it gives its agents.
- AGENTS.mdAGENTS.md
- templates/AGENTS.mdAGENTS.md
- inbox/CLAUDE.mdCLAUDE.md
- pages/CLAUDE.mdCLAUDE.md
- projects/CLAUDE.mdCLAUDE.md
- tasks/CLAUDE.mdCLAUDE.md
- workspace/CLAUDE.mdCLAUDE.md
- briefingSkill
- clip-tweetSkill
- closeSkill
- evalSkill
- focusSkill
- inspectSkill
- maintainSkill
- morningSkill
- newsletterSkill
- onboardingSkill
- pageSkill
- pluginSkill
- projectSkill
- pulseSkill
- refresh-decisionsSkill
- refresh-projectSkill
- repairSkill
- retrospectiveSkill
- solveSkill
- syncSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
34 rules. 0 are common, 14 are distinctive, and 20 are very specific to this project.
0
Common
Most of the 73 edited versions we read keep these.
14
Distinctive
This author's own choices. Worth a look.
20
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
File path: Run single-file distillation on the specified file (e.g., reports/newsletter/2026-03-20.md)
- Distinctive: line 28
Directory path: Run single-file distillation on all .md files in the directory
- Distinctive: line 34
When the argument is a file or directory, execute the following:
- Very specific: line 37
Target determination: Check if the argument is a workspace/*/ directory
- Distinctive: line 43
When a file or non-workspace directory is specified.
- Very specific: line 45
Resolve target files: If directory, target all .md files inside (exclude _workspace.md, _summary.md, _distill.md, _organized/).
- Very specific: line 47
Entity detection: If newly created knowledge/notes/ mentions reference entities not in knowledge/people/ or knowledge/orgs/, auto-create …
- Very specific: line 49
Post-processing: Run rill strip-entity-tags on created knowledge/notes/, append new tags to taxonomy.md
- Very specific: line 59
Read the "Topic Tags" table from taxonomy.md and generate YAML list format (name + desc) (exclude deprecated tags).
- Very specific: line 68
Read .claude/commands/_distill/task-extraction.md and store contents in {task_extraction_rules} variable (single definition of task …
- Distinctive: line 83
After the Tier dict, check whether monthly Tier 1 curation review should fire this run (artifact 013 §4 + 015 §4):
- Very specific: line 110
If TIER1_CURATION_DUE=1, Step 7.5 (below) will fire after Group 2 completes.
- Very specific: line 205
Refresh queue check: Read knowledge/.refresh-queue.
- Very specific: line 216
Read plugins/.enabled to get the list of enabled plugins.
- Distinctive: line 265
After all agents complete:
- Very specific: line 266
Update .processed via rill processed set (do not record files that errored.
- Very specific: line 271
Entity ID stripping (deterministic post-processing): Run rill strip-entity-tags <file-paths ...> on created/updated knowledge/notes/ …
- Very specific: line 273
If new tags are reported, append to taxonomy.md (verify no conflict with deprecated tags)
- Very specific: line 280
Read participants: and tags: from inbox/*/_organized/ files processed in Group 1
- Very specific: line 282
Only Grep knowledge/people/ for participants not found in mapping
- Distinctive: line 286
If corresponding people/ company field is a string, update to orgs/ id
- Distinctive: line 287
Keep created entity IDs consistent with taxonomy.md tags
- Distinctive: line 292
If no candidates, display "No knowledge extraction candidates" and skip
- Very specific: line 298
Run rill strip-entity-tags on knowledge/notes/ created in Phase 3
- Distinctive: line 351
After the review file is written (or the iteration completes with zero flagged entities), update the state file:
- Very specific: line 388
When inject_args (from Step 1.6) is non-empty, append it to the agent's prompt alongside the processing-results summary.
- Very specific: line 390
Phase 5: Read plugins/.enabled. For each enabled plugin, check if plugins/{name}/hooks/post-distill.md exists.
- Distinctive: line 399
After all Phases complete, before the final summary:
- Distinctive: line 406
If the aggregated list is empty, skip this step
- Distinctive: line 407
Write the aggregated paths to a temporary sources file (one per line, absolute or repo-relative paths both accepted by the CLI), then …
- Very specific: line 415
Do NOT pass
--forceblindly: If the CLI prints ⚠ bulk update detected, the aggregated list is likely contaminated with Evergreen updates … - Distinctive: line 421
After all Phases complete, display the following summary:
- Very specific: line 432
After Step 10 (Summary) completes, invoke /pulse via the harness's Skill tool to refresh knowledge/self/current-state.md.
- Distinctive: line 442
If the /pulse invocation fails for any reason, log a 1-line warning to stdout and continue — /pulse refresh failure is not fatal to …
“Common” is measured: kept by at least 6 in 10 of the 73 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/distill — Unified Distillation Command
Conduct all conversation with the user — and write all generated output — in the language defined by .claude/rules/personal-language.md (or the user's input language if that file is absent). Follow the language rules in full — exceptions and translation quality are defined in the Language Rules of .claude/rules/rill-core.md and the vault's personal-*.md overrides, never restated per skill. The English instructions below are for skill clarity, not for output style.
Tool references in this skill (
Read,Grep,Glob, theAgenttool,model: "sonnet",run_in_background) describe intent, not Claude-specific tool calls. Each harness should map them to its native equivalent. On Codex CLI: sub-agent fan-out (the parallelAgentlaunches below) maps to Codex's own sub-agent mechanism where one is available, or runs sequentially in the current session when it isn't;run_in_backgroundlikewise degrades to sequential execution when no background/async primitive exists; a namedmodelis a preference for an equivalent lighter/faster model, falling back to the session default. If a step asks the user a question, treat it as a plain free-text question in an interactive session; in an unattended run it must not block — write a[DECISION-QUEUE]entry instead, per the decision-loop contract (ADR-084,.claude/rules/rill-autonomous-execution.md§9).
Batch-processes unprocessed inbox/journal/ and inbox/*/ files. Uses flat orchestrator pattern with external templates + parallel agent spawning (D48). Workspace distillation is handled by /close in the parent context (ADR-072).
Arguments
$ARGUMENTS — one of the following:
- Omitted: Auto-detect unprocessed files and run the full pipeline
- File path: Run single-file distillation on the specified file (e.g.,
reports/newsletter/2026-03-20.md) - Directory path: Run single-file distillation on all .md files in the directory
Procedure
Single-File Mode (with arguments)
When the argument is a file or directory, execute the following:
- Shared context preparation (same as Step 1 of batch mode)
- Target determination: Check if the argument is a
workspace/*/directory- If workspace directory → Display "Workspace distillation is handled by /close. Use
/close {workspace-id}" and exit (ADR-072) - Otherwise → Normal distillation mode (below)
- If workspace directory → Display "Workspace distillation is handled by /close. Use
Normal Distillation Mode
When a file or non-workspace directory is specified.
- Resolve target files: If directory, target all .md files inside (exclude
_workspace.md,_summary.md,_distill.md,_organized/). If_organized/has a file with the same name, prefer that one - Knowledge extraction: Launch an Agent per target file (
_distill/knowledge-agent.mdtemplate + shared context injection; launch the whole set in the background and let the harness cap effective concurrency — no fixed-size pool). Wheninject_args(from Step 1.6) is non-empty, append it to each agent's prompt - Entity detection: If newly created knowledge/notes/ mentions reference entities not in knowledge/people/ or knowledge/orgs/, auto-create them (Phase 2.5 equivalent)
- Task extraction: For each target file, launch
_task/create-agent.mdas a sub-agent inmode=extract(launched in the background, harness-capped concurrency) withmodel: "sonnet"(Tier 2 LLM-as-judge eval, 2026-04-19: 3/3 decision agreement with Opus baseline including correct ENRICH-vs-CREATE judgment on a thin-duplicate case and correct skip discipline on a 4-item committed/speculative mix; 0/3 DEGRADED-MAJOR; cost reduced ~24% vs Opus on this workload, larger savings expected in production where cache effects are smaller). Passsource_path= the target file, the shared context (taxonomy + entity mappings), and the list of knowledge/notes/ paths created in step 2 as hints. The sub-agent owns duplicate checking, substance writing, and file creation per.claude/rules/rill-tasks.md. It setsstatus=draftviarill mkfile --field(ADR-069) - Post-processing: Run
rill strip-entity-tagson created knowledge/notes/, append new tags to taxonomy.md - Summary display: List of created knowledge, entity creation count, added tasks
※ Organized version creation (Phase 2) is not executed (target files are assumed already structured) ※ Profile update (Phase 4) and Plugin hooks (Phase 5) are not executed
Batch Pipeline Mode (no arguments)
Step 1: Shared Context Preparation (once in parent context)
- Read the "Topic Tags" table from
taxonomy.mdand generate YAML list format (name + desc) (exclude deprecated tags). Example:- name: api-design\n desc: API, interface, and protocol designImportant: Tag vocabulary must always be passed in YAML list format. Inline format liketag(description)is prohibited (ADR-046 D46-3) - Run
rill context-maponce and capture its output (deterministic, 0 LLM tokens, sub-second — it reads only frontmatter, never file bodies). It emits five sections that supply the rest of the shared context without any parent-context file reads:### People mapping→{people_mapping}(extended one-line formatpeople/jane-smith: Jane Smith | aliases: Jane,J. Smith | company: acme-corp, type prefix per ADR-053)### Orgs mapping→{orgs_mapping}(orgs/acme-corp: Acme Corporation (Acme,Acme Inc))### Projects mapping→{projects_mapping}(projects/phoenix: Project Phoenix (active, tags: infrastructure); ADR-080 per-directory layout)### Entity IDs→ the entity-ID list used for entity stripping in post-processing### Tier dict→ thetier_assignmentblock injected into Group 2 (knowledge-agent) for Tier-aware processing (see the Tier dict note below)- Do not re-read
knowledge/{people,orgs}/*.mdorprojects/*/_project.mdin the parent —rill context-mapreplaces the old per-run ~620 KB compression pass (container filesCLAUDE.md/AGENTS.mdand files without top-of-file frontmatter are ignored)
- Read
.claude/commands/_distill/task-extraction.mdand store contents in{task_extraction_rules}variable (single definition of task extraction rules) - ※ Do not generate knowledge/notes/ filename list (each agent explores via Glob/Grep, D48-2)
- ※ Task duplicate checking is done by parent context in batch (scan existing tickets in
tasks/) - Important: Do not read target file contents in parent context. Pass only file paths to agents, let agents Read internally
Tier dict (from rill context-map)
The ### Tier dict section emitted by rill context-map (Step 1 above) is the entity Tier dict — per-entity mention counts across the vault, bucketed tier1 (≥8) / tier2 (≥3) / tier3, with a tier_assignment block. It is computed deterministically in a single awk pass (0 LLM tokens, sub-second) and replaces the former inline Bash that spawned a subprocess per file (artifact 013 §5.3). The CLI owns the scope (inbox/*/_organized + inbox/think-outputs + workspace + tasks + knowledge/notes + reports/{daily,newsletter}; entity self-reference dirs excluded), the thresholds, and the mentions: parse (both inline [a, b] and block-list forms; files without top-of-file frontmatter are ignored, so fenced examples in CLAUDE.md never leak phantom counts).
Inject the tier_assignment block into the shared context passed to Group 2 (_distill/knowledge-agent.md) for Tier-aware processing (artifact 013 §6.1).
Ordering tradeoff: the dict reflects vault state at Step 1 (before inbox files are organized in Step 4). An entity that crosses a tier boundary via this run's newly-organized files is captured on the next /distill invocation — an accepted Phase 1 limitation (the Step 1.5 curation cadence only fires monthly).
Step 1.5: Tier 1 monthly curation cadence judgment (NEW)
After the Tier dict, check whether monthly Tier 1 curation review should fire this run (artifact 013 §4 + 015 §4):
STATE_FILE=".claude/state/distill-tier1-curation.json"
if [[ -f "$STATE_FILE" ]]; then
# Allow optional whitespace after the JSON key colon (Step 7.5 writes pretty-printed JSON with one space)
last_ts=$(grep -oE '"last_curation_at":[[:space:]]*"[^"]+"' "$STATE_FILE" | grep -oE '"20[0-9T:+\-]+"' | tr -d '"' || echo "")
else
last_ts=""
fi
if [[ -z "$last_ts" ]]; then
TIER1_CURATION_DUE=1 # never run before → due
else
# Step 7.5 writes last_curation_at via `date -Iseconds` which on macOS emits +09:00 (colon-separated TZ).
# Normalize +09:00 → +0900 before parsing so the %z format actually matches; fall back to 999 days on parse failure.
norm_ts=$(echo "${last_ts}" | sed -E 's/([+-][0-9]{2}):([0-9]{2})$/\1\2/')
parsed=$(date -j -f "%Y-%m-%dT%H:%M:%S%z" "${norm_ts}" +%s 2>/dev/null || echo 0)
if [[ "${parsed}" == "0" ]]; then
days_since=999 # parse failure → treat as overdue (safe default)
else
days_since=$(( ($(date +%s) - parsed) / 86400 ))
fi
if (( days_since >= 30 )); then TIER1_CURATION_DUE=1; else TIER1_CURATION_DUE=0; fi
fiIf TIER1_CURATION_DUE=1, Step 7.5 (below) will fire after Group 2 completes. Otherwise Step 7.5 is silently skipped.
Day-of-week guard: To avoid same-session collision with /retrospective (which fires on Thursdays per 012 §0.2), if today is Thursday and the Plan or prior session-state indicates /retrospective is queued, defer TIER1_CURATION_DUE by 1 day (set to 0 for this run, will fire on the next /distill invocation). Standalone Thursday /distill runs without retrospective context proceed normally.
Step 1.6: Build language args
Before launching any sub-agent (single-file mode step 2, Step 4 Group 1, Step 6 Group 2 Phase 3, or Step 8 Group 3 Phase 4), call build_language_args() to decide whether to inject narrative-language args into each sub-agent invocation. The function is intentionally trivial — distribution default is English (sub-agent prompts are written in English), so absence of a personal override means no args are injected and the sub-agent's English default takes over naturally. No fallback logic needed on either side.
The top-of-file "Conduct ALL conversation with the user in the language defined by .claude/rules/personal-language.md" instruction governs the orchestrator's (main session's) user-facing utterances; this prologue governs argument injection into sub-agent invocations. They share a trigger file but operate on different surfaces — the user-facing rule has no effect on sub-agent output, which is exactly what this prologue closes.
# build_language_args()
# Returns: inject_args string (or empty if no non-English target is detected).
# Called once per skill invocation, before agent fanout.
#
# Locale detection: presence of personal-language.md is NOT a signal — the
# onboarding skill creates the file for English vaults too, and `rill init
# --lang en` likewise. We pattern-match for any Unicode codepoint in the
# range U+3040-U+30FF, which spans the Hiragana block (U+3040-U+309F) and
# the Katakana block (U+30A0-U+30FF). Both scripts are exclusive to
# Japanese — Chinese and Korean writing systems use Han / Hangul
# respectively and contain neither Hiragana nor Katakana — so a hit here is
# a near-certain ja signal. The stock-ja personal-language.md template
# contains both Hiragana (particles, verb endings) and Katakana (loanwords)
# in its body bullets, so any user-edited derivative that retains even one
# Hiragana or Katakana glyph is detected. Pure-Kanji-only Japanese content
# is the one remaining miss case (Kanji is shared with Chinese, so we cannot
# distinguish), but that style is uncommon for personal-language.md.
# Stock-en and other Latin-script vaults have no such codepoints and fall
# through to the no-injection branch.
#
# Implementation: We use `perl -CSD` (UTF-8 decode on STDIN) with the
# codepoint range above. The earlier `LC_ALL=C grep -qE $'\xe3\x81|...'`
# form relied on bash ANSI-C byte literals, which the default zsh harness
# Claude Code launches via the Bash tool does not interpret as raw bytes —
# detection silently failed under zsh and `output_language` came back empty.
# perl is in PATH on every macOS / Linux distribution that ships Claude
# Code, and Unicode codepoint regexes carry no shell-quoting ambiguity.
#
# Multi-locale detection (mapping all 9 onboarding-supported locales correctly)
# is out of scope for this task and deferred to a separate task. Doing it right
# requires a structured marker (frontmatter or sentinel comment) that bin/rill
# would have to write — and migration of existing personal-language.md files.
# Until that lands, vaults in zh / ko / fr / de / es / pt / it / en receive
# English narrative output (the same behavior as before this skill landed).
output_language=""
if [[ -f .claude/rules/personal-language.md ]] && \
perl -CSD -e 'while(<>){if(/[\x{3040}-\x{30ff}]/){exit 0}} exit 1' .claude/rules/personal-language.md; then
output_language="ja"
fi
if [[ -n "$output_language" ]]; then
# style_guide is hardcoded English. Protocol sentinels listed below MUST stay
# English literal in sub-agent output — the coordinator string-matches them
# later (see journal-agent.md / knowledge-agent.md / think-output-agent.md /
# profile-agent.md / task-extraction.md Language sections, and Step 9's
# `### Created knowledge files` aggregation). Translating them would break
# pipeline aggregation, .processed status tracking, and Tier-aware processing.
style_guide='Write narrative output fields (knowledge note bodies, _organized/ restructured prose, key fact entries, task candidate Title and hint, and Interest Profile additions / updates) in the language specified by output_language. English exceptions (only): (1) tokens inside backticks, (2) proper nouns, (3) ASCII acronyms, (4) any literal sentinel string or fixed enum value documented in this sub-agent prompt'\''s Language section or Output schema — including the section heading `### Created knowledge files`, the sentinels `No tasks` and `No changes to Interest Profile`, status labels (`organized`/`extracted`/`skipped`/`success`/`failed`), Tier enum (`tier1`/`tier2`/`tier3`), type enum (`record`/`insight`/`reference`), all kebab-case slugs, paths, mentions entity IDs, frontmatter field names and values, and task pipe field names (`slug:`/`mentions:`/`source:`/`hint:`/`depends-on:`/`blocks:`) — which must remain verbatim English regardless of output_language because the coordinator string-matches them. Translate all other English (common nouns, adjectives, verb metaphors). When translating, prefer the established target-language term (a word actually used in documents written by native speakers); if none exists, prefer a loanword form in common use; otherwise keep the English term inside backticks with a short parenthetical gloss on first use. Never invent literal calques that do not exist in the target language, and keep one consistent rendering per concept within a document.'
inject_args="output_language: ${output_language}
style_guide: |
${style_guide}"
else
# No detected non-English target. Sub-agent prompt is in English, so absence
# of args naturally yields English output — no fallback logic needed here.
# The top-of-file "use the user's input language if personal-language.md is
# absent" rule governs the orchestrator's user-facing utterances only (the
# disambiguation paragraph above states this explicitly). Sub-agent narrative
# output uses the prompt-language default (English) until the user expresses
# a persistent preference by running onboarding or `rill init --lang`.
inject_args=""
fiWhen inject_args is non-empty, append it as additional YAML lines to each sub-agent invocation's prompt, alongside the existing shared context block. The style_guide string is hardcoded in English on purpose: the public rillmd/rill repo stays ASCII-only, and the string is itself an English instruction. Broader-locale support (ko, zh, fr, de, es, pt, it) extends the detection branch above without touching the sub-agent prompts or the style_guide content.
Append targets (5 spawn sites in this skill):
- Single-File Mode step 2 (
_distill/knowledge-agent.md) - Step 4 Group 1 Phase 1a (
_distill/journal-agent.md) - Step 4 Group 1 Phase 1b (
_distill/think-output-agent.md) - Step 6 Group 2 Phase 3 (
_distill/knowledge-agent.md) - Step 8 Group 3 Phase 4 (
_distill/profile-agent.md)
Do NOT append to (receivers do not implement language args; out of this task's scope, tracked as follow-up work):
- Single-File Mode step 4 and Step 5 step 3 (
_task/create-agent.mdinvocations) - Step 4 Group 1 Phase 2 (
plugins/*/distill.mdinvocations)
Step 2: Collect Processing Targets
Collect unprocessed files in 2 categories:
- Root drop zone relocation (runs first): Glob
inbox/*.md(root-level Markdown files only, not inside subdirectories). For each match, excludinginbox/CLAUDE.md, move it toinbox/sources/{filename}usinggit mvwhen the file is tracked, otherwisemv. This enables users to drop arbitrary Markdown files directly intoinbox/as a generic drop zone; relocated files are then picked up by the Phase 2sources/glob below. If no root-level matches exist, skip silently. - Refresh queue check: Read
knowledge/.refresh-queue. If not empty, display "knowledge/.refresh-queue has N pending refreshes. Use /repair to process them" (not processed by /distill itself) - Phase 1a (journal): Glob
inbox/journal/*.md→ compare withinbox/journal/.processed→ unprocessed journals (exclude_organized/files and.gitkeep) - Phase 1b (think-outputs): Glob
inbox/think-outputs/*.md→ compare withinbox/think-outputs/.processed→ unprocessed think-outputs (AI-extracted microfiles structured at write time; exclude.gitkeep. No_organized/is generated for this category) - Phase 2: Glob
inbox/{meetings,web-clips,tweets,sources}/*.md→ compare with each subdirectory's.processed→ unprocessed inbox files (exclude_organized/,.gitkeep,.processed)
※ Workspace distillation is handled by /close in the parent context (ADR-072). Not processed in batch pipeline
Display target counts for all categories. Also display the organized-backlog per Phase 2 subdirectory — files organized in a prior run but not yet knowledge-extracted — via rill processed count inbox/{subdir}/.processed organized (last-wins). This surfaces silent carry-over that the old append-style .processed hid. If the unprocessed counts and the organized-backlog are all 0, display "No unprocessed files" and exit; otherwise proceed (Step 6 Phase 3 consumes the backlog).
Step 3: Plugin Discovery
- Read
plugins/.enabledto get the list of enabled plugins. If the file does not exist or is empty, skip to Step 4 usingplugins/_default-distill.mdfor all files - For each enabled plugin name, Read
plugins/{name}/plugin.mdfrontmatter. Buildsource-type→ plugin directory name mapping (e.g.,meeting → google-meet,tweet → twitter,web-clip → web-clipper) - Resolve prompt path for each Phase 2 file:
- source-type determination: Infer from inbox subdirectory name (
inbox/tweets/→tweet,inbox/web-clips/→web-clip,inbox/meetings/→meeting). If subdirectory name doesn't match mapping, Read the original file's frontmattersource-type - Mapping match →
plugins/{name}/distill.md - No match →
plugins/_default-distill.md
- source-type determination: Infer from inbox subdirectory name (
Step 4: Group 1 — Parallel Agent Launch
Phase 1/2 are mutually independent. Record all target files as an explicit queue up front (list them, so nothing is silently dropped), then launch one Agent per file in the background (run_in_background: true) — launch the whole queue; do not hand-maintain a fixed-size pool or wait at round boundaries. The harness caps effective concurrency and re-invokes on each completion, so a slow agent no longer blocks a round or gets skipped. Collect results as completions arrive (Step 5).
Phase 2 Pre-processing: Frontmatter Check
For each Phase 2 file, check frontmatter presence before Agent launch. If no frontmatter, auto-infer created and source-type from file creation date and directory name.
Agent Launch
Each agent's prompt composition (template files are Read by the agent itself. Do not Read in parent):
Follow the instructions in .claude/commands/_distill/{template-name}.md to process the following file.
First Read that template file to review instructions, then Read the target file.
Target: {file_path}
Shared context:
### Tag vocabulary (YAML list format. Refer to desc when selecting tags)
{taxonomy_yaml}
### People mapping
{people_mapping}
### Orgs mapping
{orgs_mapping}
### Projects mapping
{projects_mapping}
### Task extraction rules
{task_extraction_rules}- Phase 1a (journal):
_distill/journal-agent.md(1 file/Agent). Launch via Agent tool withmodel: "sonnet"— this task is journal organization + atomic knowledge extraction with task-candidate inference, and Sonnet has been validated as production-equivalent to Opus on this workload (Tier 2 LLM-as-judge eval, 2026-04-19: 0/3 DEGRADED-MAJOR, 1/3 EQUIVALENT, 1/3 DIFFERENT-OK, 1/3 DEGRADED-MINOR — the minor case missed one inferred task and one cross-reference, neither blocking; cost reduced ~50% vs Opus). Monitor /distill output 1–2 weeks for task-extraction completeness; revert to Opus if regressions appear. Wheninject_args(from Step 1.6) is non-empty, append it to each agent's prompt - Phase 1b (think-outputs):
_distill/think-output-agent.md(1 file/Agent). Launch via Agent tool withmodel: "sonnet"— same routing rationale as Phase 1a (atomic microfile + Evergreen extraction; no organize step is performed because AI structures the file at write time). Inherit Sonnet eval until think-outputs accumulate enough volume for a separate evaluation. Wheninject_args(from Step 1.6) is non-empty, append it to each agent's prompt - Phase 2: Resolved plugin
distill.md(1 file/Agent). Read the plugin's distill.md, extract the ``` block template from## Agent Promptsection → expand template variables ({file_path},{taxonomy_yaml},{people_mapping},{orgs_mapping},{projects_mapping},{task_extraction_rules}) → pass expanded prompt directly to Agent's prompt
Error handling: If an agent reports an error, skip that file and proceed to the next; it is not recorded in .processed, so the next run retries it. The one exception is an agent that reports the exact line Result: skipped (source-unavailable) — its source is permanently gone (e.g. a deleted or private tweet) and a retry cannot succeed, so Step 5 records it as skipped. Agents never write .processed themselves; they run in parallel and the parent owns that file.
Step 5: Group 1 Result Collection
After all agents complete:
- Update
.processedviarill processed set(do not record files that errored; the CLI enforces one line per file, last-wins — no duplicate rows):- journal:
rill processed set inbox/journal/.processed <filename>(bare, no status) - think-outputs:
rill processed set inbox/think-outputs/.processed <filename>(bare; AI structures at write time so no organize step occurs) - inbox/* (meetings/web-clips/tweets/sources):
rill processed set inbox/{subdir}/.processed <filename> organized - inbox/* whose agent reported
Result: skipped (source-unavailable):rill processed set inbox/{subdir}/.processed <filename> skipped— no_organized/file exists and Phase 3 never selects it. Without this the file would be re-queued and fail on every run
- journal:
- Entity ID stripping (deterministic post-processing): Run
rill strip-entity-tags <file-paths ...>on created/updated knowledge/notes/ (ADR-046 D46-2) - Aggregate task candidates from all Phase 1 + Phase 2 agents. For each candidate, launch
_task/create-agent.mdas a sub-agent inmode=extract(launch all in the background,run_in_background: true, harness-capped concurrency,model: "sonnet"— see the Sonnet-routing rationale on the single-file-mode invocation above; same eval applies). Pass the candidate pipe line, thesource_pathalready recorded in it, and the shared context (taxonomy_yaml, people/orgs/projects mappings). The sub-agent handles duplicate checking, substance-rule-compliant body writing, and file creation viarill mkfile tasks --field 'status=draft' ...(ADR-069). Legacy parent-side parsing of| background:/| context:fields andTitle::pathconversion is no longer performed here — substance writing is owned by the sub-agent per.claude/rules/rill-tasks.md - If new tags are reported, append to
taxonomy.md(verify no conflict with deprecated tags)
Step 6: Group 2 — Parallel Agent Launch
Phase 2.5 and Phase 3 are mutually independent, so execute in parallel.
- Phase 2.5: Entity Auto-extraction (execute directly in parent context):
- Read
participants:andtags:frominbox/*/_organized/files processed in Group 1 - String-match each participant name against People mapping name/aliases (mapping is already loaded in context from Step 1. No Grep needed for known entities)
- Only Grep
knowledge/people/for participants not found in mapping - Participants not found → Auto-create new Person entity (minimal frontmatter + short description)
- String-match organizations from body/participants against Orgs mapping name/aliases (no Grep needed for known orgs)
- Orgs not found in mapping → Grep knowledge/orgs/ → if not found, auto-create new Org entity (id: kebab-case, aliases: name variants, relationship: context-inferred)
- If corresponding people/ company field is a string, update to orgs/ id
- Keep created entity IDs consistent with taxonomy.md tags
- Report creation results in summary
- Read
- Phase 3: Knowledge Extraction (
_distill/knowledge-agent.md, launch Agent per organized file):- Identify candidate files with
rill processed list inbox/{subdir}/.processed --status organized(last-wins: only files whose latest.processedline is:organized; a file alreadyextractedis never re-selected even if a stale:organizedline lingers from the old append bug) - If no candidates, display "No knowledge extraction candidates" and skip
- Launch Agent per file with
model: "sonnet"(launch all in the background,run_in_background: true, harness-capped concurrency) — knowledge extraction's defining behavior is the Evergreen check (merge/skip/create-new judgment), and Sonnet has been validated as production-equivalent on this dimension (Tier 2 LLM-as-judge eval, 2026-04-19: 3/3 Evergreen judgments agreed with Opus baseline; 0/3 DEGRADED-MAJOR; 1/3 EQUIVALENT, 1/3 DIFFERENT-OK, 1/3 DEGRADED-MINOR — the minor case had thinner body prose but correct Evergreen call; cost reduced ~49% vs Opus). Monitor /distill output 1–2 weeks for note-body richness and speculative content; revert to Opus if regressions appear. - Inject shared context (taxonomy_yaml, people/orgs/projects mappings, tier_assignment dict from Step 1). The tier_assignment dict is required for
_distill/knowledge-agent.mdTier-Aware Processing (artifact 013 §6.1). Wheninject_args(from Step 1.6) is non-empty, append it to each agent's prompt alongside the shared context
- Identify candidate files with
Step 7: Group 2 Result Collection
- Run
rill strip-entity-tagson knowledge/notes/ created in Phase 3 - Mark each extracted file via
rill processed set inbox/{subdir}/.processed <filename> extracted— this rewrites the line in place, so theorganized→extractedtransition stays one line per file (no duplicate row). Leave errored files as-is (stillorganized, so the next run retries extraction), and never touch askippedline - Append new tags to
taxonomy.md
Step 7.5: Tier 1 curation review (NEW, conditional)
This step runs only when TIER1_CURATION_DUE=1 from Step 1.5 (artifact 013 §4 + 015 §4). Otherwise, skip silently and proceed to Step 8.
For each entity in the Tier dict with tier_assignment == tier1:
- Resolve the entity file path from the dict key. Keys are already typed (
{type}/{slug}e.g.people/jane-smith,projects/phoenix), so the file path isknowledge/{type}/{slug}.mdfor people/orgs andprojects/{slug}/_project.mdfor projects (ADR-080). Read that file and count## Key Factsentries - Skip the entity unless both trigger conditions hold:
- Key Facts count ≥ 30 (artifact 013 §4.1 condition b — deliberately set higher than the ~20 guideline in
knowledge/{people,projects}/CLAUDE.mdbecause that guideline is not actively enforced; 30 catches the empirically-observed overfilled cases likeprojects/rill.mdwith 50+ facts. Revising the 20 guideline itself is out of scope for this phase per 013 §4.1) - At least 5 new fact entries added in the past 4 weeks (detect via
(YYYY-MM)date prefixes in fact lines, orgit log --since=4.weeks --follow {path}line additions if blame is preferred)
- Key Facts count ≥ 30 (artifact 013 §4.1 condition b — deliberately set higher than the ~20 guideline in
- For each entity that passes both conditions, emit a curation review block.
Generate reports/distill/tier1-curation-{YYYY-MM-DD}.md with one section per flagged entity. rill mkfile reports/distill ignores --slug and always writes reports/distill/{YYYY-MM-DD}.md (bin/rill cmd_mkfile's generic reports/* branch), so get the correct created frontmatter that way (LLMs must never write created by hand — ADR-060) and rename to the slugged filename, the same pattern /retrospective uses for reports/retrospective/{period_id}.md:
mkfile_out="$(rill mkfile reports/distill --type distill-curation --field "period={YYYY-MM-DD}")"
mv "$mkfile_out" "reports/distill/tier1-curation-{YYYY-MM-DD}.md"Then Edit the body into this format:
# Tier 1 Key Fact Curation Review
## {type}/{id} — current {N} facts, guideline 20
### Deletion candidates (old / duplicate / low-importance)
- [ ] **{date prefix} {fact text}** — reason: {old | duplicate of #M | low-importance single incident}
### Merge candidates
- [ ] {fact #X} + {fact #Y} = "{merged interpretation}" — combinable into one entry
(repeat per entity)
## How to apply
- Mark checkboxes `[x]` for the deletions/merges you approve
- Run `/distill --apply-curation reports/distill/tier1-curation-{date}.md` (Phase 2 future flag; for now, manually edit the entity file)
- Unchecked items will be re-proposed at the next monthly cadenceThe LLM picks deletion / merge candidates per artifact 013 §4.3 heuristics:
- Old: has
(YYYY-MM)prefix, ≥ 6 months ago, and a later fact on the same theme supersedes it - Duplicate: two existing facts express semantically near-identical content (LLM judgment, not embedding)
- Low-importance: external references / single incidents with no downstream impact on workspaces or decisions
After the review file is written (or the iteration completes with zero flagged entities), update the state file:
mkdir -p .claude/state
cat > .claude/state/distill-tier1-curation.json <<EOF
{
"skill": "distill-tier1-curation",
"last_curation_at": "$(date -Iseconds)",
"last_curation_file": "reports/distill/tier1-curation-$(date -I).md",
"entities_flagged_last_run": [...]
}
EOFImportant: this step writes a review file only — no auto-delete, no auto-merge (artifact 013 §4.2 / §1.1 design principle 4). The --apply-curation flag is a Phase 2 deliverable.
Step 8: Group 3
- Phase 4: Update Interest Profile with
_distill/profile-agent.md. Launch via Agent tool withmodel: "haiku"— this task is conservative metadata maintenance (add/skip judgments against an existing profile) and Haiku has been validated as quality-equivalent to Opus on this workload (3/3 PASS in Tier 1 routing eval, 2026-04-19). Inject the following summary into prompt:
WhenFollow the instructions in .claude/commands/_distill/profile-agent.md to update the Interest Profile. First Read that template file to review instructions. ## Current /distill Processing Results Summary ### Newly created knowledge/notes/ {list of filenames and tags from Phase 1-3} ### Newly created/updated projects/ {updated projects/ filenames and change content} ### Extracted tasks {list of approved tasks} ### Newly created entities (people/, orgs/) {list of entities created in Phase 2.5}inject_args(from Step 1.6) is non-empty, append it to the agent's prompt alongside the processing-results summary. Skip if 0 files were processed in Phase 1-3. - Phase 5: Read
plugins/.enabled. For each enabled plugin, check ifplugins/{name}/hooks/post-distill.mdexists. If.enableddoes not exist or is empty, skip Phase 5. For each found hook, launch Agent. Pass the following context:- Created file list: File paths of _organized/, knowledge/notes/, knowledge/people/, knowledge/orgs/ created in Phase 1-3
- mentions mapping: person-id / org-id list extracted from mentions in created knowledge/notes/
- Added tasks: List of approved new tasks
- Plugin path:
plugins/{plugin-name}/ - Failures are non-fatal: Log and skip errors during hook execution
Step 9: Pages Pending Update (the "new candidates" push)
After all Phases complete, before the final summary:
- Aggregate newly created knowledge/notes/ paths from:
- Phase 1 journal-agent outputs →
### Created knowledge filessection - Phase 3 knowledge-agent outputs →
### Created knowledge filessection - Plugin distill.md agent outputs (if the plugin follows the same
### Created knowledge filesconvention)
- Phase 1 journal-agent outputs →
- Exclude refresh-agent output (refresh-agent is not part of /distill, but this guard exists so future integrations don't accidentally feed Evergreen updates into pending)
- If the aggregated list is empty, skip this step
- Write the aggregated paths to a temporary sources file (one per line, absolute or repo-relative paths both accepted by the CLI), then invoke:
tmp=$(mktemp) printf '%s\n' "${created_files[@]}" > "$tmp" rill pages-pending-update --sources-file "$tmp" --origin distill rm -f "$tmp" - The CLI matches each new file's
mentions(Layer 2) ortags(Layer 3 fallback, only for pages without mentions) against allpages/*.mdand upserts entries intopages/.pending - Do NOT pass
--forceblindly. If the CLI prints⚠ bulk update detected, the aggregated list is likely contaminated with Evergreen updates or a migration slipped in — investigate rather than override
Design essence: pages carried no mentions at all when matching was first designed, so the matcher is layered — mentions intersection first, tags fallback only for pages without mentions — and a bulk-update threshold keeps migrations / mass refreshes from flooding pages/.pending with noise a human would have to ack away.
Step 10: Summary + Task Approval
After all Phases complete, display the following summary:
- Phase 1: Processed / skipped count, created file list
- Phase 2: Organized / skipped count, created file list. List each file recorded as
skipped(source unavailable) by name with its reason, separately from files that errored and will be retried — the user needs to know a source was written off - Phase 2.5: Entity creation / skip count
- Phase 3: Extraction / skip count, created knowledge list
- Phase 4: Interest Profile update content (only if changes occurred)
- Phase 5: Hook execution results (plugin name, result summary)
- Task candidate list (Phase 1-2 total) — created as ticket files (/briefing will highlight new tasks)
Step 11: /pulse refresh (NEW)
After Step 10 (Summary) completes, invoke /pulse via the harness's Skill tool to refresh knowledge/self/current-state.md. This Auto-chain keeps the snapshot fresh after each distillation cycle (015 §2.1):
Skill(name: "pulse", args: "")The invocation is synchronous. /pulse handles its own 12h cooldown — if recently run it no-ops silently. Do not parse, display, or summarize /pulse's output in /distill's summary — discard the return value.
Non-recursion guarantee (009 §1.5): /distill's path scoping already excludes knowledge/self/, and /pulse never invokes /distill, so this chain is structurally one-way.
If the /pulse invocation fails for any reason, log a 1-line warning to stdout and continue — /pulse refresh failure is not fatal to /distill.
Rules
- Never modify inbox/ original files (read-only. Exception: auto-adding frontmatter is allowed)
.processedis written and read viarill processed(never hand-appended):setrewrites one line per file (last-wins),count/list --statusread last-wins,normalizecollapses any legacy duplicate rows. This keeps theorganized→extractedtransition to a single line and prevents an already-extracted file from being re-selected by a stale:organizedlineinbox/journal/.processedrecords filenames only (no path prefix. e.g.,2026-02-13-1921.md);setwith no status preserves this bare forminbox/{subdir}/.processedusesfilename:statusformat (e.g.,2026-02-16-meeting.md:organized)- Agent prompt templates (
.claude/commands/_distill/) are Read by agents themselves (do not Read in parent context). Exception:task-extraction.mdis Read by parent and injected as shared context data for child agents so they can return task candidates; actual ticket writing is delegated to the_task/create-agent.mdsub-agent invoked by the orchestrator - Plugin distill.md is Read by parent, template variables expanded, and injected inline into prompt
- Template variable names are unified:
{taxonomy_yaml},{people_mapping},{orgs_mapping},{projects_mapping},{task_extraction_rules},{file_path} - Error handling: If an agent returns an error, skip that file and do not record it in
.processed(norill processed setcall for it), so the next run retries it. Exception: an agent reportingResult: skipped (source-unavailable)is recorded asskippedin Step 5, because its source is permanently gone and retrying can never succeed. Include both counts in the summary - zsh compatibility: Refer to CLAUDE.md rule 26
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

