Summary of SkillZip: Contract-Preserving Graph Compression for Scalable Agent Skill Libraries
Summary (Overview)
- SkillZip is a novel framework for compressing large-scale LLM agent skill libraries by operating at the section-level granularity rather than whole-skill packages, enabling more precise retrieval and context hydration within limited context budgets.
- The framework introduces contract-preserving compression through four key components: Sec2Graph (section-level graph construction), MotifZip (contract-preserving macro compression), PathHydrate (budgeted executable context hydration), and ReZip (incremental library maintenance).
- SkillZip achieves 3.46× compression ratio with 99.2% dependency preservation and 98.7% verifier reachability, while outperforming the strongest baseline (SkillDAG) by up to 12.2 points on ALFWorld.
- The system demonstrates scalability from 200 to 100K skills with robust retrieval performance, maintaining 65.1 Ret@1 at the largest scale with 248.3 ms online latency.
- SkillZip works as a plug-and-play procedural-memory layer across six LLM backbones without backbone-specific fine-tuning, showing consistent improvements on both technical (SkillsBench) and embodied (ALFWorld) benchmarks.
Introduction and Theoretical Foundation
Background and Motivation
LLMs increasingly act as agents whose procedural knowledge is stored in reusable skill packages loaded at inference time. As skill libraries grow, a central challenge emerges: how to expose the smallest sufficient executable context under a limited context budget. The paper identifies four critical challenges in existing systems:
-
Reuse-granularity mismatch: Existing systems use whole skills as retrieval units, but skills contain multiple functional sections (intents, operations, verifiers, outputs) that may be shared across skills.
-
Contract preservation under compression: Current compression methods optimize token budgets but preserve textual rather than procedural contracts—a compressed skill can obscure preconditions, guard branches, or verifier hooks.
-
Persistent executable compression: Execution graphs are built after retrieval over already-selected skills, so the library itself is not stored as a persistent compressed structure.
-
Execution-aware maintenance: Skill libraries evolve, and one-shot compression cannot recognize newly reusable routines or revise risky macros.
Core Insight
The paper identifies a unit mismatch: skills are retrieved as packages, compressed as text, and converted into execution graphs only after retrieval. The solution requires a contract-bearing procedural unit that survives retrieval, compression, and execution alike. A compression is contract-preserving if it shortens a routine while retaining its interface, execution, and verification aspects.
Key Definitions
Section node: A typed procedural unit:
where is the execution role, is section content, and are input/output signatures, records resources/tools, records guard/verifier conditions, and points to source.
The framework uses nine operational roles: Intent, Trigger, Input, Precondition, Operation, Resource, Failure, Verifier, and Output.
Procedural skill graph: with typed dependency edges (), skill membership edges, resource links, and equivalence edges linking compatible occurrences to canonical prototypes.
Macro node: compresses a connected section subgraph with boundary inputs , outputs , and expansion rule where is the procedural contract.
Methodology
1. Sec2Graph: Building Procedural Subgraphs
Converts whole skill packages into source-grounded procedural subgraphs:
- Section grounding: Segments packages using headings, lists, code blocks, warnings, and tool references as boundary cues
- Contract extraction: Extracts typed I/O and resources for interface; guards and verifier conditions in
- Procedural subgraph construction: Connects sections with typed edges (weak-order, dependency, verifier, repair edges)
- Cross-skill reuse: Links compatible sections to shared canonical prototypes while preserving occurrence identity
2. MotifZip: Contract-Preserving Compression
Mines recurring section-level motifs and promotes them to macro nodes only when contracts are preserved:
Typed candidate generation:
Graph grammar rule:
Compression gain scoring:
A motif is accepted only if: (1) interface is stable across occurrences, (2) execution is dependency-closed, (3) verification remains reachable.
Key theoretical guarantee (Proposition 1): Compositional structural lifting—if a raw procedural subgraph contains all or none of the internal nodes for each occurrence, then up to auxiliary prototype links, preserving typed external dependencies and operation-to-verifier reachability.
3. PathHydrate: Budgeted Executable Context
Builds compact, dependency-closed procedural subgraphs for queries:
Task anchoring: Converts queries into structured objects:
Dual-level seed fusion: Combines section-level and skill-level retrieval:
Skills are fused via reciprocal-rank fusion:
Constrained subgraph search:
subject to anchor coverage, dependency closure, verifier reachability, and budget .
Progressive hydration: Macros rendered at lowest sufficient level: name, contract, outline, or full source.
4. ReZip: Incremental Library Maintenance
Updates the compressed library as new skills and execution traces arrive:
Macro promotion condition:
Execution risk scoring:
Empirical Validation / Results
Main Results (RQ1)
| Backbone | Method | SkillsBench R↑ | ALFWorld R↑ |
|---|---|---|---|
| MiniMax-M2.7 | Vanilla Skills | 17.2 | 47.1 |
| MiniMax-M2.7 | Vector Skills | 10.4 | 50.7 |
| MiniMax-M2.7 | GoS | 18.7 | 54.3 |
| MiniMax-M2.7 | SkillDAG | 27.3 | 67.1 |
| MiniMax-M2.7 | SkillZip | 33.3 | 79.3 |
| gpt-5.2-codex | Vanilla Skills | 27.4 | 89.3 |
| gpt-5.2-codex | Vector Skills | 21.5 | 92.9 |
| gpt-5.2-codex | GoS | 34.4 | 93.6 |
| gpt-5.2-codex | SkillDAG | 36.8 | 93.6 |
| gpt-5.2-codex | SkillZip | 43.0 | 96.4 |
SkillZip improves over SkillDAG by 6.0–12.2 points on SkillsBench and 2.8–12.2 points on ALFWorld, with the largest gains on the weaker backbone where there is more room for improvement.
Compression and Structural Fidelity (RQ3)
| Representation | CR↑ | Tok↓ | DPR↑ | VR↑ | Recover.↓ | R↑ |
|---|---|---|---|---|---|---|
| Raw section graph | 1.00× | 6,716 | 100.0 | 100.0 | 0.0 | 31.0 |
| Exact-text dedup. | 1.43× | 4,697 | 98.6 | 98.1 | 5.2 | 31.2 |
| Text compression | 3.46× | 1,941 | 65.0 | 60.0 | 45.0 | 25.5 |
| Generic graph grammar | 2.91× | 2,308 | 93.4 | 90.8 | 22.7 | 29.4 |
| SkillZip w/o checks | 3.78× | 1,777 | 88.9 | 84.6 | 31.5 | 27.8 |
| SkillZip | 3.46× | 1,941 | 99.2 | 98.7 | 14.8 | 33.3 |
Key findings:
- Text compression achieves similar compression but destroys executable structure (DPR: 65.0, VR: 60.0)
- Removing contract checks makes compression more compact (3.78×) but harms execution safety
- SkillZip preserves near-complete structural fidelity (DPR: 99.2, VR: 98.7) while achieving 3.46× compression
Ablation Study (RQ4)
| Component | Variant | R↑ | Ret@1↑ | Tok↓ | DPR↑ | VR↑ |
|---|---|---|---|---|---|---|
| Full | SkillZip | 33.3 | 73.6 | 1,941 | 99.2 | 98.7 |
| Unit | w/o section-level nodes | 27.9 | 66.7 | 3,103 | - | - |
| Compression | w/o MotifZip | 31.0 | 71.8 | 2,967 | 100.0 | 100.0 |
| Compression | w/o dependency closure | 28.6 | 72.1 | 1,653 | 82.3 | 92.6 |
| Compression | w/o verifier constraint | 29.1 | 72.8 | 1,668 | 94.9 | 76.4 |
| Hydration | w/o global section rescue | 30.4 | 68.2 | 1,812 | 96.5 | 96.8 |
| Hydration | w/o adaptive hydration | 31.5 | 73.2 | 2,587 | 99.2 | 98.7 |
Key findings:
- Section-level nodes are critical: removing them causes the largest drop (Ret@1: -6.9, reward: -5.4, context: +59.9%)
- Contract checks matter: removing dependency closure drops DPR to 82.3; removing verifier constraints drops VR to 76.4
- Adaptive hydration saves 33.3% tokens without harming structural fidelity
Additional Results
- Scalability: Ret@1 advantage over SkillDAG widens from 6.2 (200 skills) to 23.3 (100K skills); at 100K skills, SkillZip retains 65.1 Ret@1 with 248.3 ms latency
- Contract extraction quality: 91.6 macro-F1 and 84.6 exact match against human annotations
- Efficiency gains: 47.0% reduction in cumulative prompt processing, 21.7% fewer tool calls, 21.1% faster end-to-end task time vs. SkillDAG
Theoretical and Practical Implications
Theoretical Contributions
-
Contract-preserving compression: Introduces a formal notion of compression that preserves procedural contracts (interface, execution, verification) rather than just textual similarity, with a proven compositional lifting property (Proposition 1) guaranteeing reversible macro expansion.
-
Section-level procedural memory: Establishes that skills are not atomic units but collections of typed, contract-bearing sections that can be independently reused across skills—a fundamental shift from whole-skill retrieval.
-
Unified representation: Shows that retrieval, compression, and execution should operate on the same unit (contract-bearing section subgraphs), resolving the unit mismatch in existing pipelines.
Practical Implications
-
Scalable skill libraries: Enables efficient skill reuse in libraries ranging from hundreds to hundreds of thousands of skills, with retrieval precision that improves relative to baselines as libraries grow.
-
Context efficiency: Reduces rendered context by 72.1% compared to top-5 whole-skill loading while maintaining or improving task performance, critical for LLM context budget constraints.
-
Safe compression: Provides a principled approach to compression that maintains executable structure—shorter context does not come at the cost of dropped verifiers or hidden dependencies.
-
Maintainable systems: The ReZip component enables continuous library evolution, promoting new reusable routines and retiring risky macros based on execution evidence.
Conclusion
SkillZip presents a comprehensive solution to the challenge of scalable agent skill libraries by fundamentally changing the unit of procedural reuse from whole skill packages to contract-bearing section-level graphs. The framework's four components work together: Sec2Graph exposes internal skill structure, MotifZip compresses only contract-valid recurring motifs, PathHydrate builds minimal executable contexts, and ReZip maintains the compressed library as skills evolve.
The empirical results demonstrate that execution-aware compression outperforms both whole-skill retrieval and text-only compression across multiple LLM backbones and task domains. The 3.46× compression ratio with near-perfect dependency preservation (99.2%) and verifier reachability (98.7%) shows that significant context savings are achievable without sacrificing executable structure.
Future directions suggested by this work include extending the framework to handle more complex procedural contracts (e.g., multi-agent coordination), investigating semantic rather than structural equivalence guarantees, and exploring how execution evidence can be more richly incorporated into macro revision decisions. The framework's plug-and-play nature across LLM backbones also opens possibilities for integration with other agent architectures and skill-acquisition systems.
Related papers
- Harness Continual Learning: Continual Adaptation Beyond Model Parameters
Harness Continual Learning enables frozen foundation models to accumulate capabilities by evolving prompts, memories, and tools around them, with guarded updates preventing harness-level forgetting.
- Dense Contexts Are Hard Contexts: Lexical Density Limits Effective Context in LLMs
Lexical density, not just length, causally degrades LLM retrieval, activating lost-in-the-middle effects at contexts far below advertised limits.
- HarnessOpt-Bench: Evaluating LLMs at Harness Optimization
HARNESSOPT-BENCH shows optimizer model choice matters 1.8x more than coding harness choice for agent improvement, with broader search driving gains and trace reading providing no benefit.