Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
camacho avatar

Distill

  • 300 installs
  • 1 repo stars
  • Updated May 26, 2026
  • camacho/ai-skills

distill is a Claude Code skill that runs a three-stage pipeline to extract imperatives from AGENTS.md and rules/, compose policy algebra, and render Mermaid diagrams for developers who need to audit and restructure agent

About

distill is a Claude Code skill from camacho/ai-skills that orchestrates a three-stage pipeline on AGENTS.md and rules/ directories when agent instruction files grow past readable size. Stage one /imperatives extracts structured imperatives into JSONL artifacts. Stage two /policy-algebra composes them with policy algebra into Starlark. Stage three /visualize renders decision trees as Mermaid diagrams. Artifacts land in ai-workspace/research with date-stamped outputs, and each stage can run independently via /distill --stage flags. The forced pause between extraction and composition lets developers review what rules actually exist before restructuring policies. Developers reach for distill before major agent-governance refactors, when onboarding new agent runtimes, or when rules need trimming, deduplication, and visual documentation of decision logic.

  • Full pipeline: extract imperatives → compose with policy algebra → visualize as Mermaid
  • Stage flags run imperatives-only, compose-only, or visualize-only when prior artifacts exist
  • Defaults target ai-workspace/rules/*.md and AGENTS.md with JSONL and Starlark outputs
  • Human checkpoint asks you to review extraction before composition
  • Summaries report imperative counts with level and scope breakdowns

Distill by the numbers

  • 300 all-time installs (skills.sh)
  • Ranked #2,296 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/camacho/ai-skills --skill distill

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs300
repo stars1
Security audit3 / 3 scanners passed
Last updatedMay 26, 2026
Repositorycamacho/ai-skills

How do you analyze and visualize AGENTS.md rules?

Run a three-stage pipeline to extract imperatives from AGENTS.md and rules/, compose them with policy algebra, and render Mermaid diagrams of your agent rule system.

Who is it for?

Developers governing large AGENTS.md and rules/ trees who need extraction, policy composition, and Mermaid visualization before refactoring agent instructions.

Skip if: Repos with a handful of cursor rules and no AGENTS.md, or teams wanting one-off lint fixes without a multi-stage policy pipeline.

When should I use this skill?

AGENTS.md or rules/ directories are bloated, need audit before refactor, or a developer asks to visualize agent policy as Mermaid diagrams.

What you get

JSONL imperatives file, Starlark policy composition, Mermaid decision-tree diagrams, and date-stamped artifacts under ai-workspace/research.

  • JSONL imperatives extract
  • Starlark policy file
  • Mermaid rule-system diagram

By the numbers

  • Orchestrates a three-stage pipeline: imperatives extraction, policy algebra composition, and Mermaid visualization

Files

SKILL.mdMarkdownGitHub ↗

/distill

Distill agent instruction files into structured imperatives, compose with policy algebra, and visualize the rule system. Three-stage pipeline.

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)

Pipeline

  ┌─────────────┐     ┌──────────────┐     ┌─────────────┐
  │ /imperatives │────▶│/policy-algebra│────▶│ /visualize  │
  │  extract     │     │  compose     │     │  render     │
  └─────────────┘     └──────────────┘     └─────────────┘
        │                    │                    │
    JSONL file         Starlark block      Mermaid diagrams

Stage 1 — Extract (/imperatives)

1. Invoke /imperatives with the target files (or defaults: ai-workspace/rules/*.md + AGENTS.md). 2. Save output to ai-workspace/research/<name>-imperatives.jsonl. 3. 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.

Stage 2 — Compose (/policy-algebra)

1. Project the JSONL to natural-language bullets: <level>[ NOT] <subject> <predicate>[ when <when>] — one bullet per imperative. 2. Invoke /policy-algebra with the projected bullets. 3. Save the Starlark composition to ai-workspace/research/<name>-policy.md. 4. Present the surfaced structure (decision functions, branching points).

Stage 3 — Visualize (/visualize)

1. For each major decision function in the Starlark output, invoke /visualize. 2. Content shape is typically graph (decision trees) → Mermaid flowcharts. 3. Append diagrams to the policy doc.

Naming

The <name> slug defaults to the current date + "distill" (e.g., 2026-05-04-distill). Override with --name <slug>.

Output

All artifacts land in ai-workspace/research/:

  • <name>-imperatives.jsonl — structured extraction
  • <name>-policy.md — Starlark composition + diagrams

Failure modes

ConditionBehavior
/imperatives finds zero imperativesReport and stop. No point composing empty input.
/policy-algebra unavailableSkip Stage 2, warn. Stage 3 can still visualize the JSONL directly.
User interrupts between stagesArtifacts from completed stages are preserved. Resume with --stage.

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

Related skills

How it compares

Pick distill when AGENTS.md and rules/ need multi-stage extraction, policy composition, and diagrams—not a single-pass summary of cursor rules.

FAQ

What are the three stages of distill?

distill runs /imperatives to extract JSONL imperatives from AGENTS.md and rules/, /policy-algebra to compose Starlark policy, and /visualize to render Mermaid decision-tree diagrams. Each stage can run independently with --stage flags.

Where does distill save output?

distill saves date-stamped artifacts under ai-workspace/research, including JSONL imperatives, composed Starlark policy, and Mermaid diagrams. The pause between extraction and composition supports manual review before restructuring rules.

Is Distill safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

AI & Agent Buildingagentsautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.