Get Started
Home
Topics
Search
Library
Agents · RAG · Aug 6, 2026

SkillZip: Contract-Preserving Graph Compression for Scalable Agent Skill Libraries

Source: research paper via Hugging Face Daily Papers
SkillZip attacks agent-memory compression by treating skills as contract-bearing section subgraphs instead of atomic text: macros only replace recurring subgraphs when input/output ports and verifier paths are preserved. At 3.46× compression it holds 98.7% verifier reachability, where generic text compression collapses to 60%.
TL;DR
SkillZip compresses an agent’s skill library by rewriting recurring procedural subgraphs into reversible macros only when their input/output ports, dependencies, and verifier paths are preserved, achieving 3.46× compression while keeping 98.7% of verifier reachability intact.
Why It Matters
You’re building an agent that ships with a growing library of reusable procedures: “clean this CSV,” “pivot a table,” “file a support ticket.” Each procedure is a package of instructions, scripts, and validation checks. As the library grows past a few hundred entries, you can’t cram all relevant procedures into the context window, and worse, many procedures share overlapping steps (both “clean CSV” and “pivot table” start by inferring a delimiter and normalizing headers). The dominant approach, exemplified by SkillDAG, retrieves whole skill packages and stitches them together. This paper argues the retrieval unit itself is wrong: you should retrieve and reuse the shared sections across packages, not entire packages.
How It Works
The pipeline has four stages, each targeting a specific failure of package-level reuse.
First, Sec2Graph splits each skill package into typed section nodes. Each node carries an execution role (Intent, Input, Operation, Verifier, Output, etc.), its input/output signatures, and a pointer back to its source. Sections that behave identically across skills link to a shared canonical prototype, exposing reuse without erasing where each occurrence came from.
Second, MotifZip mines recurring subgraphs and rewrites them as macro nodes, but only when a contract check passes: the macro’s boundary ports must be stable across occurrences, all dependencies must either stay inside the macro or route through explicit ports, and every state-changing operation must still have a reachable verifier. Two sections that both say “load data” but feed different verifiers are not merged. The scoring function uses a description-length gain penalized by boundary cuts and verifier weakness.
for motif in candidates_by_signature(graph): occs = find_occurrences(motif, graph) if len(occs) < min_support: continue I, O, contract = build_contract(motif, occs) if not (boundary_clear(I,O) and deps_closed(motif) and verifier_reachable(motif)): continue if compression_gain(motif) > 0: replace_with_macro(graph, occs, motif)
Third, PathHydrate handles query time. It anchors the task to section-level seeds using both subgoal embeddings and the raw query, then fuses section hits with skill-level rankings via Reciprocal Rank Fusion. It builds a dependency-closed subgraph, and renders each macro at the lowest sufficient detail: name, contract, outline, or full source. Macros expand only when the contract doesn’t answer what execution needs.
Fourth, ReZip maintains the library incrementally. New skills reuse existing macros where contracts match; residual patterns get promoted to macros once they’ve repeated across enough skills with valid contracts. Execution traces feed a risk score: macros with high expansion, verifier-failure, or repair rates get their hydration level raised, split, or retired.
Core Insight
The prevailing approach treats a skill as an atomic retrieval unit and treats compression as a text-shortening problem. This paper shows the opposite. Compression that ignores execution contracts damages reliability faster than it saves tokens; the right unit is the contract-bearing section subgraph, and rewrites must be reversible back to source. The load-bearing evidence is not the headline task-reward number but the ablation showing text-based compression at the same 3.46× ratio drops verifier reachability to 60% and reward to 25.5, while contract-checked compression at the same ratio keeps verifier reachability at 98.7% and raises reward.
What They Found
The compression-fidelity ablation is the finding that makes the thesis true. At a matched 3.46× compression ratio, generic LLMLingua-2-style text compression collapses dependency preservation to 65.0% and verifier reachability to 60.0%, and 45% of queries need to fall back to original sections. SkillZip at the same ratio holds dependency preservation at 99.2% and verifier reachability at 98.7%, with fallback at only 14.8%. Removing SkillZip’s contract checks (keeping the same mining machinery) improves the ratio to 3.78× but tanks fidelity and drops reward from 33.3 to 27.8.
Secondary evidence:
•
On SkillsBench with MiniMax-M2.7, task reward improves from 27.3 (SkillDAG) to 33.3. On ALFWorld with the same backbone, episode success goes from 67.1 to 79.3, a +12.2 point gain.
•
Section-level retrieval scales better with library size: Ret@1 gap over SkillDAG widens from 6.2 points at 200 skills to 23.3 points at 100K skills, and similar-skill confusion stays at 12.4% versus SkillDAG’s 48.2%.
•
End-to-end trajectory cost drops: 47.0% fewer total prompt tokens and 21.7% fewer tool calls than SkillDAG on matched runs, because cleaner context reduces repair loops.
•
Gains hold across six backbones including Claude Sonnet 4.5, Gemini 3 Pro, and GPT-5.2-codex, with paired confidence intervals excluding zero.
What’s Useful
Reach for this when you’re building an agent with a growing library of procedural tools that share substeps, and you care about a deterministic verifier at the end of each procedure. Instead of retrieving whole tool descriptions, split them into sections carrying explicit input/output signatures and verifier hooks, then compress shared sections into macros only when their contracts are identical across skills. The reversibility matters: when execution fails, you can expand a macro back to its original text without having lost anything.
The paper reports experiments on two public benchmarks (SkillsBench and ALFWorld) but does not link a code release in the text provided. The evaluation protocol itself, particularly the paired downstream-inflation metric that compares compressed and raw executions on the same task and seed, is reusable for anyone measuring whether their context compression is genuinely helpful or just quietly moving work into repair loops.
Takeaway
Compression is only useful if what survives is executable, not just shorter. For procedural agent memory, the unit that must be preserved is the contract (ports, dependencies, verifier reachability), not the surface text. Anything that shortens text while blurring contracts will look good on token counts and fail during execution.
Caveats
•
The contract checks depend on an LLM extracting roles, signatures, and verifier hooks correctly. Extraction reaches 91.6 macro-F1 against human annotations, and at 40% synthetic contract corruption, reward drops from 33.3 to 24.1. In domains where operational contracts are implicit or hard to name, extraction quality becomes the bottleneck.
•
The compression ratio depends on how much procedural overlap actually exists. On the smaller ALFWorld library the ratio is only 1.62×, and in low-overlap domains SkillZip is closer to a well-organized graph than a real compressor.
•
The offline construction cost is provider-dependent LLM extraction and is reported separately from the deterministic graph work; the paper explicitly declines to extrapolate extraction wall-clock time to 100K skills, so end-to-end setup cost at scale is not fully characterized.
Topics
Don't miss new content
Log in to follow topics and personalize your feed.
By content type
Research Paper171 episodes
AI171 episodes