Compress agent skill libraries 3.46x without breaking execution contracts: SkillZip

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

Xingyu Tan, Xiaoyang Wang, Qing Liu, Xiwei Xu, Xin Yuan, Liming Zhu, Wenjie Zhang

cs.CL, cs.AI

2026-08-06

SkillZip compresses agent skills into reversible graph macros, keeping 99% of execution contracts at 3.46x compression and beating the best baseline by 12.2 points on ALFWorld.

What problem this solves

When an LLM acts as an agent, much of what it knows how to do lives in external skill packages loaded at inference time. As the library grows, you hit a fork: load whole packages and blow the context budget, or compress them as text and break the skill.

The authors frame this as a unit mismatch. Skills are retrieved as packages, compressed as text, and turned into execution graphs only after retrieval, three different granularities, none of which is the unit that supports safe reuse. That unit is a contract-bearing procedural fragment. The mismatch produces four concrete failures: you cannot reuse a routine below the whole-skill level, compression hides preconditions and verifier hooks, nothing persists a compressed executable structure, and the library cannot update as new skills arrive. Everyone compresses text; no one guarantees the result still runs.

Method

SkillZip's move is to lift a skill from text to a contract-bearing graph, then compress on that graph in a way that preserves the contract. Three components plus a maintenance module.

Sec2Graph parses each skill package into typed section nodes. Every node carries its execution role (Intent, Precondition, Operation, Verifier, Output, and so on), input/output signatures, the resources it depends on, guard conditions, and a pointer back to source. Nodes connect through typed edges: dependency, same-skill, resource, equivalence. This makes the role each passage plays in execution explicit, and every later step reasons over those roles.

MotifZip does the compression. It mines recurring, contract-valid subgraphs and folds each into a reversible macro, but only when three conditions hold together: boundary signatures stay stable, dependencies close (every internal dependency is either inside the macro or exposed through a port), and verifiers stay reachable (each state-changing operation keeps its verifier accessible). A subgraph becomes a macro node Ig-Og with an expansion rule that can rebuild the original. The scoring function weighs compression gain (frequency times length saved) and reuse value against penalties for cutting dependencies and for risk. It does not compress everything that repeats; it compresses only what survives without losing the contract.

PathHydrate handles inference. It scores sections using both the query and discussion anchors (dual-level fusion, taking the max of the two embeddings), then searches for a compact, dependency-closed subgraph. Macros expand progressively: name first, then contract, then outline, then full source, only as execution demands. On average it hydrates 1,941 tokens per task, 72.1% less than loading the top-5 whole skills.

ReZip lets the library grow. It promotes new reusable motifs from incoming skills and execution traces, and revises or demotes risky macros using execution evidence such as failure rate and repair cost.

Results

Two benchmarks, two backbones. SkillsBench covers technical, procedural tasks; ALFWorld is a text-based embodied agent setting.

Main table (MiniMax-M2.7):

MethodSkillsBench rewardALFWorld success
Whole-package load17.247.1
Vector retrieval10.450.7
GoS18.754.3
SkillDAG (strongest baseline)27.367.1
SkillZip33.3 (+6.0)79.3 (+12.2)

With gpt-5.2-codex, SkillZip reaches 43.0 on SkillsBench and 96.4 on ALFWorld, ahead of SkillDAG by 6.2 and 2.8 points.

The most telling table is not the end scores but the compression-fidelity comparison. Plain text compression reaches the same 3.46x ratio, yet dependency preservation collapses from 99.2 to 65.0 and verifier reachability from 98.7 to 60.0, dropping reward to 25.5. SkillZip holds both contract metrics at 99.2 and 98.7 at the same ratio and posts the highest reward. The contribution is not compressing harder; it is compressing without breaking what runs.

On system cost, versus SkillDAG: cumulative prompt processing down 47.0%, average tool calls down 21.7%, end-to-end time down 21.1%. In the scaling sweep, as the library grows from 200 to 100K skills, the Ret@1 lead over SkillDAG widens from +6.2 to +23.3, online retrieval plus hydration stays under 248.3 ms, and the 100K-skill graph (4.77M section nodes) builds offline in 178 seconds.

Why it matters

For anyone shipping agents, this hits a real engineering pain: a big skill or tool library either overflows the context or breaks under compression. The answer here is to treat procedural knowledge as contract-bearing structure, not as text you can summarize freely. That idea transfers. Any setting where compression would destroy execution semantics (tool-call chains, workflows, SOPs) fits the same contract-preserving frame.

The progressive hydration is the immediately practical part. It expands on demand, section by section, instead of dumping full source up front. That lines up with where agent frameworks are already heading on tool-spec loading, only finer-grained.

Be honest about scope. This is a structured, benchmark-driven systems paper. It proves gains on two fairly tidy testbeds, some distance from a messy production library of ten thousand skills.

Limitations

The paper has no dedicated limitations section. These are the points worth questioning.

Only two benchmarks. SkillsBench is a fairly new procedural set and ALFWorld a classic text-embodied environment; both are structured. There is no evaluation on noisy real-world production agent tasks.

Gains shrink as the backbone gets stronger. On ALFWorld with gpt-5.2-codex, GoS and SkillDAG already reach 93.6%; SkillZip adds only 2.8 more, and the authors concede the room for improvement is limited. Compression and structured retrieval buy less when the model is strong and the task is easy.

Compression payoff depends on overlap. When procedural overlap between skills is low, the compression ratio falls to 1.18x. The method assumes the library actually contains many reusable routines; with little repetition it helps little.

What is preserved is structural contract, not semantic equivalence. It guarantees verifiers are reachable and dependencies close, but Recovery still falls back to source in 14.8% of cases. The paper gives no semantic equivalence proof that a compressed macro is meaning-by-meaning identical to the original; it relies on end-task reward as indirect evidence.

The 100K-scale numbers cover retrieval metrics only (Ret@1, latency), not end-task reward at that scale.

Terms

Source

Related papers

All paper explainers