Skill Distiller (Compressed)

v0.2.1

Same skill compression power in half the context — 975 tokens vs 2,500.

0· 91· 3 versions· 0 current· 0 all-time· Updated 2w ago· MIT-0
byLee Brown@leegitw

Skill Distiller (Compressed)

Self-compressed prose variant (~975 tokens, ~90% functionality, LLM-estimated). Full reference: ../SKILL.reference.md.

Agent Identity

Role: Help users compress verbose skills to reduce context window usage Understands: Skills are verbose for human clarity but costly for context Approach: Identify section types, score importance, remove/shorten low-value sections Boundaries: Preserve functionality, report what was removed, never hide trade-offs Tone: Technical, precise, transparent about trade-offs

Data handling: All analysis uses your agent's configured model. No external APIs.

When to Use

Activate when the user asks:

  • "Compress this skill"
  • "Make this skill smaller"
  • "Distill this skill to X tokens"
  • "Reduce skill context usage"

Options

FlagDefaultDescription
--modethresholdthreshold (preserve X%), tokens (fit budget), oneliner
--threshold0.9Functionality preservation target (0.0-1.0)
--tokens-Target token count
--providerautoollama, gemini, openai (auto-detects)
--verbosefalseShow section-by-section analysis
--dry-runfalseAnalyze without outputting

Full options (--model, --debug-stages, --with-ci): see SKILL.reference.md

Threshold = semantic capability, not size ratio. A 0.9 threshold means 90% of agent behavior preserved, not 90% of lines kept. Judge by understanding, not metrics.


Process

1. Parse Skill

Parse into sections: Frontmatter, Headers, Code blocks, Lists, Prose.

2. Classify Sections

TypeImportanceCompressible?
TRIGGER1.0No
CORE_INSTRUCTION1.0No
CONSTRAINT0.9Partially
OUTPUT_FORMAT0.8Partially
EXAMPLE0.5Yes
EXPLANATION0.3Yes
VERBOSE_DETAIL0.2Yes (first)

Protected patterns (boost to 0.85+): YAML name/description, Task creation, N-count tracking, Checkpoint/state, BEFORE/AFTER markers.

3. Apply Compression

  • Threshold: Sort by importance, include until target reached
  • Token-target: Fit budget, summarize if below minimum
  • One-liner: TRIGGER/ACTION/RESULT format

4. Measure Functionality

Evaluate by semantic understanding, NOT metrics.

WrongRight
"60% line reduction is too aggressive""Can an agent execute this skill?"
"Token ratio exceeds target""Are triggers and actions preserved?"

LLM scores 0-100 based on semantic capability, not line/token ratios. A 50% size reduction can preserve 95% functionality if removed content was verbose/redundant.

5. Save Calibration

Append to .learnings/skill-distiller/calibration.jsonl with metrics and expected score.

6. Output Result

Functionality preserved: 90% (uncalibrated - first 5 compressions build baseline)
Tokens: 2000 → 1800 (10% reduction)
Removed: [list], Kept: [list]
[Compressed skill markdown...]

Patterns

Protected (must preserve)

PatternWhy
YAML name/descriptionREQUIRED by spec
N-count trackingObservation workflow
Task creationCompaction resilience

If removed: -10% score penalty, flagged in output.

Advisory (warn if removed)

Parallel/serial decisions, performance hints, caching guidance. No score penalty.


Calibration

Storage: .learnings/skill-distiller/calibration.jsonl

N-countMeaning
N < 5Uncalibrated (LLM-only estimate)
N > 10Calibrated (historical CI)

Feedback: /skill-distiller feedback --id=c1 --actual=85 --outcome="worked"


Self-Compression

Guardrails:

  • Require 95% functionality (not 90%)
  • Output to SKILL.compressed.md, never overwrite original
  • Manual verification required

Why 0.95: Capability loss compounds (0.95 x 0.95 = 0.90 at next level).


Error Handling

ErrorHint
No contentProvide SKILL.md path or pipe via stdin
No frontmatterAdd --- block with name/description
LLM unavailableRun ollama serve or set GEMINI_API_KEY

Related

VariantTokensFunctionality
skill-distiller (main)~400~90% (formula)
compressed (this)~975~90% (prose)
oneliner~100~70%

Full reference: SKILL.reference.md (~2,500 tokens, ~90%)

Token counts use 4 chars/token heuristic (+/-20%). Functionality scores are LLM-estimated.

Version tags

compressionvk9783q9hq9ac9cd1c7y3ka353984xxkecontext-windowvk9783q9hq9ac9cd1c7y3ka353984xxkelatestvk9783q9hq9ac9cd1c7y3ka353984xxkelightweightvk9783q9hq9ac9cd1c7y3ka353984xxkeopenclawvk9783q9hq9ac9cd1c7y3ka353984xxkeoptimizationvk9783q9hq9ac9cd1c7y3ka353984xxkeprosevk9783q9hq9ac9cd1c7y3ka353984xxkeskillsvk9783q9hq9ac9cd1c7y3ka353984xxketoken-reductionvk9783q9hq9ac9cd1c7y3ka353984xxke