SPEM: Structure-Aware Procedural Memory for Efficient Skill Use in LLM Agents

arXiv cs.AI Papers

Summary

The paper proposes SPEM, a structure-aware procedural memory framework for LLM agents that combines atomic skill memory with Skill-DAG templates and Skill-GNN retrieval, achieving 87.1% success on ALFWorld and 38.38% reward on SkillsBench while reducing token and runtime costs.

arXiv:2610.26995v1 Announce Type: new Abstract: LLM-based agents increasingly rely on reusable skills. However, scaling skill libraries makes efficient and accurate skill use difficult. Full skill loading incurs high token and runtime overhead. In contrast, flat semantic retrieval treats skills as independent text entries, ignoring dependencies, execution order, state transitions, and data flow constraints. We propose SPEM, a lightweight structure-aware procedural memory framework for efficient skill use in LLM-based agents. SPEM maintains Atomic Skill Memory for individual skills and Skill-DAG Memory for reusable compositions derived from successful executions. For a new task, SPEM reuses high-confidence Skill-DAG templates when available. Otherwise, it retrieves atomic skills and invokes Skill-GNN for state- and structure-aware skill selection. Successful executions are written back as new Skill-DAGs, allowing procedural memory to accumulate over time. Experiments on ALFWorld and SkillsBench show that SPEM achieves the best overall effectiveness--efficiency trade-off, reaching 87.1% ALFWorld success and 38.38% SkillsBench reward while reducing token and runtime costs against strong baselines.
Original Article
View Cached Full Text

Cached at: 10/21/26, 06:36 AM

# SPEM: Structure-Aware Procedural Memory for Efficient Skill Use in LLM Agents
Source: [https://arxiv.org/html/2610.26995](https://arxiv.org/html/2610.26995)
###### Abstract

LLM\-based agents increasingly rely on reusable skills\. However, scaling skill libraries makes efficient and accurate skill use difficult\. Full skill loading incurs high token and runtime overhead\. In contrast, flat semantic retrieval treats skills as independent text entries, ignoring dependencies, execution order, state transitions, and data\-flow constraints\. We proposeSPEM, a lightweight structure\-aware procedural memory framework for efficient skill use in LLM\-based agents\.SPEMmaintains Atomic Skill Memory for individual skills and Skill\-DAG Memory for reusable compositions derived from successful executions\. For a new task,SPEMreuses high\-confidence Skill\-DAG templates when available\. Otherwise, it retrieves atomic skills and invokes Skill\-GNN for state\- and structure\-aware skill selection\. Successful executions are written back as new Skill\-DAGs, allowing procedural memory to accumulate over time\. Experiments on ALFWorld and SkillsBench show thatSPEMachieves the best overall effectiveness–efficiency trade\-off, reaching 87\.1% ALFWorld success and 38\.38% SkillsBench reward while reducing token and runtime costs against strong baselines\.

School of Intelligence Science and Technology, Nanjing University

Correspondence: renyuxiang@nju\.edu\.cn

## Introduction

Large language model \(LLM\) agents are increasingly used as executable systems\. They call tools, reuse skills, and interact with complex environments\. In software engineering, data analysis, web automation, and embodied tasks, agents rely on reusable skills, such as file parsing, preprocessing, and API calling\([Schick et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib24);[Mialon et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib18);[Yao et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib30)\)\. As skill libraries scale to hundreds or thousands of candidates, the central challenge changes\. It shifts from whether useful skills exist to how an agent can retrieve, organize, and reuse the required skills efficiently\([Patil et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib22);[Qin et al\. 2024](https://arxiv.org/html/2610.26995#bib.bib23);[Shi et al\. 2025](https://arxiv.org/html/2610.26995#bib.bib25)\)\.

Existing approaches face four limitations under large\-scale skill libraries\. First, loading all skill descriptions is infeasible due to high token cost, context bloat, and runtime overhead, with important details often lost in long contexts\([Liu et al\. 2024a](https://arxiv.org/html/2610.26995#bib.bib15)\)\. Second, flat retrieval optimizes semantic relevance but ignores structural dependencies like prerequisites, order, state transitions, and data flow across skills\([Lewis et al\. 2020](https://arxiv.org/html/2610.26995#bib.bib9);[Karpukhin et al\. 2020](https://arxiv.org/html/2610.26995#bib.bib8)\)\. Third, successful compositions are not stored as reusable procedural memory\. Even when dependency\-aware plans are built, they are discarded after execution\. This forces agents to re\-derive similar workflows\([Yao et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib30);[Shinn et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib26)\)\. Finally, as agent systems are deployed more frequently and model capabilities continue to improve, efficiency becomes a primary concern\. Repeated model invocations for retrieval, planning, and reorganization incur unnecessary token consumption, latency, and computational overhead\. These limitations call for a framework that can retrieve skills compactly, organize them structurally, and accumulate reusable procedural memory over time\.

We therefore study efficient skill use under large\-scale skill libraries\. Our goal is to improve task success while reducing token cost, runtime overhead, and repeated skill organization\. To this end, we proposeSPEM, a lightweight structure\-aware procedural memory framework\.SPEMmaintains two complementary memory layers\. Atomic Skill Memory represents individual executable skills with their semantic, interface, and feedback signals\. Skill\-DAG Memory stores reusable skill compositions distilled from successful executions\. Given a new task,SPEMfirst retrieves relevant procedural memory and reuses a high\-confidence Skill\-DAG template when available\. Otherwise, or when the current guidance becomes insufficient, Skill\-GNN constructs a task\-conditioned candidate graph\. It then performs state\-aware skill selection over retrieved atomic skills\. After execution, successful trajectories are compressed into Skill\-DAGs and written back to memory for future reuse\.

We evaluateSPEMon SkillsBench and ALFWorld\([Li et al\. 2026b](https://arxiv.org/html/2610.26995#bib.bib12);[Shridhar et al\. 2021](https://arxiv.org/html/2610.26995#bib.bib27)\)\. SkillsBench tests large\-scale skill retrieval and technical task execution\. ALFWorld evaluates long\-horizon dependencies, structured skill use, and cross\-task reuse in interactive environments\. We compareSPEMwith full skill loading, flat vector retrieval, and graph\-based skill selection baselines\.

Our contributions are fourfold:

- •We proposeSPEM, a dual\-layer procedural memory framework that combines Atomic Skill Memory for fine\-grained skill access with Skill\-DAG Memory for reusable procedural structures\.
- •We design a Skill\-GNN module for state\-aware skill selection over task\-conditioned candidate graphs\.
- •We introduce trajectory\-DAG extraction to distill successful executions into reusable Skill\-DAG templates and update procedural memory through execution feedback\.
- •We evaluateSPEMon ALFWorld and SkillsBench, achieving 87\.1% ALFWorld success and 38\.38% SkillsBench reward while reducing token and runtime costs over strong structure\-aware baselines\.

## Related Work

#### From Tool Calling to Large\-Scale Skill Retrieval\.

Early tool\-augmented language models focused on tool invocation, argument generation, and reasoning with returned results\. Pioneering works like ReAct, Toolformer, and surveys established the paradigm via reasoning\-action interleaving, self\-supervised learning, and systematic analysis\([Yao et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib30);[Schick et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib24);[Mialon et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib18)\)\. As external capabilities grow from a few tools to large API or skill libraries, retrieval becomes essential\. Gorilla, API\-Bank, ToolBench, ToolLLM, and related methods reduce context overhead and calling errors through documentation retrieval, embedding, hierarchical search, task\-specific construction, or query rewriting\([Patil et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib22);[Li et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib11);[Xu et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib29);[Qin et al\. 2024](https://arxiv.org/html/2610.26995#bib.bib23);[Hao et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib7);[Du, Wei, and Zhang 2024](https://arxiv.org/html/2610.26995#bib.bib4);[Yuan et al\. 2023](https://arxiv.org/html/2610.26995#bib.bib31);[Chen et al\. 2024](https://arxiv.org/html/2610.26995#bib.bib3)\)\. However, most retrieval methods still treat capabilities as independent textual entries\. They mainly optimize semantic relevance\. Skill retrieval is harder due to procedural knowledge, execution conditions, input\-output constraints, and task experience\. Benchmarks like SkillsBench and SWE\-Skills\-Bench show that excessive or mismatched skills increase context cost and can hurt performance\([Li et al\. 2026b](https://arxiv.org/html/2610.26995#bib.bib12);[Han et al\. 2026](https://arxiv.org/html/2610.26995#bib.bib6)\)\. Thus, large\-scale skill use demands compact, relevant, and executable selection, not just semantic similarity\.

#### From Structured Skills to Evolving Procedural Memory\.

As skills become reusable assets, recent work organizes them with explicit structures\. SkillNet represents skills through a unified ontology and relation network\. AgentSkillOS manages skills through classification, retrieval, capability trees, and dynamic skill management\([Liang et al\. 2026](https://arxiv.org/html/2610.26995#bib.bib13);[Li et al\. 2026a](https://arxiv.org/html/2610.26995#bib.bib10)\)\. Graph\-based methods further model relations among tools or skills\. ToolNet supports graph navigation over large tool collections; Graph of Skills retrieves dependency\-aware skill bundles from a skill dependency graph; and GraSP constructs DAG\-style skill structures with precondition and effect relations for long\-horizon tasks\([Liu et al\. 2024b](https://arxiv.org/html/2610.26995#bib.bib16);[Liu et al\. 2026](https://arxiv.org/html/2610.26995#bib.bib14);[Xia et al\. 2026](https://arxiv.org/html/2610.26995#bib.bib28)\)\. These methods show that explicit structures help recover dependencies and execution relations\. However, many of them use structure mainly for the current task or as a static organization layer\. They give limited attention to how successful executions should be distilled, updated, and reused as evolving procedural memory\.SPEMinstead converts successful trajectories into reusable Skill\-DAG templates and updates their reliability through execution feedback\.

![Refer to caption](https://arxiv.org/html/2610.26995v1/skill-gnn.png)Figure 1:Overview ofSPEM\. The system retrieves atomic skills or matched Skill\-DAG templates from dual\-layer procedural memory, constructs a task\-conditioned candidate skill graph, and uses Skill\-GNN to produce compact guidance for the LLM executor\. Successful trajectories are distilled back into reusable Skill\-DAG memory\.
#### Lightweight Skill Retrieval and Selection\.

Large\-scale skill use imposes constraints on context, latency, and computation\. Recent work explores lightweight skill routing, representation, and reuse\. SkillRouter uses compact models for recall\-then\-rerank selection over large skill sets\. Formal Skill replaces verbose Markdown descriptions with executable skill structures\. CUA\-Skill encapsulates GUI operation knowledge into reusable skills for dynamic retrieval and parameter instantiation\([Zheng et al\. 2026](https://arxiv.org/html/2610.26995#bib.bib33);[Zhang et al\. 2026](https://arxiv.org/html/2610.26995#bib.bib32);[Chen et al\. 2026](https://arxiv.org/html/2610.26995#bib.bib2)\)\. Other methods emphasize reusable experience\. ProcMEM converts interaction experience into procedural memories\. SkillDAG maintains typed relations among skills and evolves across episodes\. Compositional Skill Routing retrieves skills for decomposed subtasks and composes them with a dependency\-aware DAG planner\([Mi et al\. 2026](https://arxiv.org/html/2610.26995#bib.bib17);[Bai et al\. 2026](https://arxiv.org/html/2610.26995#bib.bib1);[Gao 2026](https://arxiv.org/html/2610.26995#bib.bib5)\)\. These studies show that lightweight skill use is not merely reducing retrieved skills, but jointly concerns compact representation, efficient selection, execution constraints, and experience reuse\.SPEMaddresses this gap through a unified procedural memory framework that combines bounded atomic retrieval, reusable Skill\-DAG Memory, and Skill\-GNN organization\.

![Refer to caption](https://arxiv.org/html/2610.26995v1/DAG.png)Figure 2:Overview of trajectory\-DAG extraction\. Successful trajectories are converted into execution graphs, from which necessary steps are identified through backward slicing, pruning, and dependency repair\. The resulting backbones are stored as reusable Skill\-DAG templates for future tasks\.

## Method

Given a task request and a large\-scale skill library,SPEMprovides compact, executable skill guidance through two memory layers: Atomic Skill Memory for individual skills and Skill\-DAG Memory for reusable compositions distilled from successful executions\. As shown in Figure[1](https://arxiv.org/html/2610.26995#Sx2.F1),SPEMreuses a matched Skill\-DAG template when available\. Otherwise it retrieves atomic skills and invokes Skill\-GNN for state\-aware reranking when needed\. Successful executions are written back as new Skill\-DAGs\. This enables procedural memory to accumulate over time\. The full protocol is provided in Section A\.1 of the supplementary material\.

### Dual\-Layer Procedural Memory

SPEMseparates procedural knowledge into two complementary memory layers\. Atomic Skill Memory supports fine\-grained access to individual skills, while Skill\-DAG Memory supports direct reuse of successful skill compositions\. The supplementary material provides the full schema and update rules in Section A\.2\.

#### Atomic Skill Memory\.

Atomic Skill Memory represents each skill as a reusable executable unit rather than an isolated text snippet\. We denote it as

ℳa=\{si\}i=1N,\\mathcal\{M\}\_\{a\}=\\\{s\_\{i\}\\\}\_\{i=1\}^\{N\},\(1\)where each skill is represented as

si=\(di,ei,σi\)\.s\_\{i\}=\(d\_\{i\},e\_\{i\},\\sigma\_\{i\}\)\.\(2\)Here,did\_\{i\}denotes skill metadata,eie\_\{i\}denotes the semantic embedding\.σi\\sigma\_\{i\}denotes lightweight execution feedback, such as usage frequency, success rate, and execution cost\. This allows retrieval to consider both semantic relevance and historical execution evidence without loading the full skill library into the LLM context\.

#### Skill\-DAG Memory\.

Skill\-DAG Memory stores reusable procedural templates extracted from successful executions\. We denote it as

ℳd=\{Gj\}j=1M,\\mathcal\{M\}\_\{d\}=\\\{G\_\{j\}\\\}\_\{j=1\}^\{M\},\(3\)where each Skill\-DAG is represented as

Gj=\(Vj,Ej,ej,mj\)\.G\_\{j\}=\(V\_\{j\},E\_\{j\},e\_\{j\},m\_\{j\}\)\.\(4\)Here,VjV\_\{j\}contains procedural nodes,EjE\_\{j\}contains directed dependency edges,eje\_\{j\}is the task embedding associated with the template, andmjm\_\{j\}stores compact execution metadata\. A Skill\-DAG captures a reusable execution structure\. It allows the agent to reuse previously successful procedures instead of reconstructing them from scratch\.

#### Procedural Memory Retrieval\.

Given a task requestqq,SPEMfirst searches Skill\-DAG Memory for reusable templates:

𝒞d​\(q\)=\{Gj∈ℳd∣sim⁡\(eq,ej\)≥τ\},\\mathcal\{C\}\_\{d\}\(q\)=\\\{G\_\{j\}\\in\\mathcal\{M\}\_\{d\}\\mid\\operatorname\{sim\}\(e\_\{q\},e\_\{j\}\)\\geq\\tau\\\},\(5\)whereeqe\_\{q\}is the task embedding andτ\\tauis the template matching threshold\. If𝒞d​\(q\)\\mathcal\{C\}\_\{d\}\(q\)is non\-empty, the highest\-scoring Skill\-DAG is injected as structured procedural guidance\. If no template satisfies the threshold,SPEMretrieves a bounded set of atomic candidates:

𝒞a​\(q\)=TopKsi∈ℳa⁡sim⁡\(eq,ei\)\.\\mathcal\{C\}\_\{a\}\(q\)=\\operatorname\{TopK\}\_\{s\_\{i\}\\in\\mathcal\{M\}\_\{a\}\}\\operatorname\{sim\}\(e\_\{q\},e\_\{i\}\)\.\(6\)The retrieved template or atomic candidates are then passed to the subsequent Skill\-GNN orchestration stage when structure\-aware organization is needed\. This retrieval strategy avoids full\-library loading while preserving two complementary modes of reuse: direct reuse of successful Skill\-DAG templates and flexible organization of atomic skills for novel task states\.

### Structure\-Aware Skill Selection with Skill\-GNN

When reusable templates are unavailable or insufficient for the current execution context,SPEMuses Skill\-GNN to perform structure\-aware ranking and selection over retrieved atomic candidates\. The goal is to identify semantically relevant skills\. It also aims to select skills that are compatible with the task state and dependency relations among candidates\.

#### Candidate Skill Graph Construction\.

Given a task requestqq, retrieved atomic candidates𝒞a​\(q\)\\mathcal\{C\}\_\{a\}\(q\), and the current execution context,SPEMconstructs a task\-conditioned candidate graph

𝒢q=\(𝒱q,ℰq,ℛ\),\\mathcal\{G\}\_\{q\}=\(\\mathcal\{V\}\_\{q\},\\mathcal\{E\}\_\{q\},\\mathcal\{R\}\),\(7\)where𝒱q\\mathcal\{V\}\_\{q\}contains task, context, and candidate skill nodes\.ℰq\\mathcal\{E\}\_\{q\}contains typed edges, andℛ\\mathcal\{R\}denotes relation types\. Skill\-node features combine semantic embeddings with lightweight execution feedback\. Task and context nodes encode the request, current state, and execution history\. Edges connect task–skill, context–skill, and skill–skill pairs, capturing relevance, state compatibility, semantic relatedness, and available dependency cues\. Additional construction details are provided in Section A\.5 of the supplementary material\.

#### Skill\-GNN Scoring\.

Given𝒢q\\mathcal\{G\}\_\{q\}, Skill\-GNN first performs node encoding and relation\-aware reasoning through message passing, as summarized in Figure[1](https://arxiv.org/html/2610.26995#Sx2.F1)\. Lethi\(0\)h\_\{i\}^\{\(0\)\}be the initial representation of nodeii\. At layerℓ\\ell, the node representation is updated by aggregating messages from relation\-specific neighbors:

hi\(ℓ\+1\)=ϕℓ​\(hi\(ℓ\),∑r∈ℛ∑j∈𝒩r​\(i\)αi​jr​Wr\(ℓ\)​hj\(ℓ\)\),h\_\{i\}^\{\(\\ell\+1\)\}=\\phi\_\{\\ell\}\\left\(h\_\{i\}^\{\(\\ell\)\},\\sum\_\{r\\in\\mathcal\{R\}\}\\sum\_\{j\\in\\mathcal\{N\}\_\{r\}\(i\)\}\\alpha\_\{ij\}^\{r\}W\_\{r\}^\{\(\\ell\)\}h\_\{j\}^\{\(\\ell\)\}\\right\),\(8\)where𝒩r​\(i\)\\mathcal\{N\}\_\{r\}\(i\)denotes neighbors of nodeiiunder relation typerr,Wr\(ℓ\)W\_\{r\}^\{\(\\ell\)\}is a relation\-specific transformation\.αi​jr\\alpha\_\{ij\}^\{r\}is the message weight, andϕℓ\\phi\_\{\\ell\}is the layer update function\.

AfterLLmessage\-passing layers, Skill\-GNN performs skill scoring\. It assigns each candidate skillsi∈𝒞a​\(q\)s\_\{i\}\\in\\mathcal\{C\}\_\{a\}\(q\)a context\-dependent utility score:

pi=fθ​\(hi\(L\)\)\.p\_\{i\}=f\_\{\\theta\}\\left\(h\_\{i\}^\{\(L\)\}\\right\)\.\(9\)The top\-ranked skills, together with compact dependency cues when available, are injected as structured guidance for the LLM agent\. This graph\-based scoring incorporates task relevance, runtime state, and inter\-skill dependencies into the skill selection process\.

#### Cold\-Start Deployment\.

SPEMsupports both trajectory\-rich and trajectory\-scarce deployment settings\. When target\-domain trajectories are available, Skill\-GNN is trained with trajectory\-prefix supervision, where each prefix defines the current procedural state and the next executed skill is used as the target\. When trajectories are scarce or unavailable,SPEMuses a library\-level warm start constructed only from the skill library:

𝒟~0\\displaystyle\\widetilde\{\\mathcal\{D\}\}\_\{0\}=\{\(q~i,si\)\}si∈ℳa,\\displaystyle=\\\{\(\\tilde\{q\}\_\{i\},s\_\{i\}\)\\\}\_\{s\_\{i\}\\in\\mathcal\{M\}\_\{a\}\},\(10\)ℰ~0\\displaystyle\\widetilde\{\\mathcal\{E\}\}\_\{0\}=\{\(si,r,sj\)∣κr​\(si,sj\)≥ηr\},\\displaystyle=\\\{\(s\_\{i\},r,s\_\{j\}\)\\mid\\kappa\_\{r\}\(s\_\{i\},s\_\{j\}\)\\geq\\eta\_\{r\}\\\},\(11\)whereq~i\\tilde\{q\}\_\{i\}is a pseudo query generated from the metadata of skillsis\_\{i\}, andℰ~0\\widetilde\{\\mathcal\{E\}\}\_\{0\}contains weak skill–skill relations induced by semantic similarity, shared tools, tags, or schema compatibility\. This initialization uses no task outcomes, verifier rewards, or evaluation trajectories\. During early deployment, Atomic Skill Memory retrieval and available Skill\-DAG templates provide the primary guidance, while the warm\-started Skill\-GNN is used only for bounded reranking\. As successful executions accumulate, trajectory\-DAG extraction converts them into new Skill\-DAG templates and trajectory\-prefix training samples, gradually adapting the system from retrieval\-only guidance to state\-aware graph selection\. Since Skill\-GNN is inductive over dynamically constructed candidate graphs, it can generalize to unseen tasks, unseen skill combinations, and newly extracted Skill\-DAG variants\. Additional protocol and leakage\-prevention details are provided in Section A\.4 of the supplementary material\.

### Trajectory\-DAG Extraction

As shown in Figure[2](https://arxiv.org/html/2610.26995#Sx2.F2),SPEMconverts successful interaction trajectories into reusable Skill\-DAG templates after execution\. Instead of storing complete trajectories, which may contain failed attempts, redundant exploration, or environment\-specific details, the system extracts a compact execution backbone\. This backbone preserves the necessary steps for reaching the success condition\. Given an execution trajectoryτ\\tau, the system first constructs an execution graph

Gτ=\(Vτ,Eτ\),G\_\{\\tau\}=\(V\_\{\\tau\},E\_\{\\tau\}\),\(12\)where nodes represent executed steps and task\-relevant states\. Edges encode temporal order, entity dependencies, state transitions, and terminal reachability\.

Starting from the successful terminal nodevsuccv\_\{\\mathrm\{succ\}\}, the system performs backward slicing to identify success\-relevant nodes:

Vτ∗=\{v∈Vτ∣v→∗vsucc\},V^\{\*\}\_\{\\tau\}=\\\{v\\in V\_\{\\tau\}\\mid v\\to^\{\*\}v\_\{\\mathrm\{succ\}\}\\\},\(13\)wherev→∗vsuccv\\to^\{\*\}v\_\{\\mathrm\{succ\}\}indicates thatvvreaches the successful terminal state through temporal or dependency paths\. Failed branches, redundant exploration, and operations that do not contribute to the final outcome are removed\. The remaining nodes and their induced dependency edges are ordered and repaired according to temporal and dependency constraints, forming a compact Skill\-DAG:

Gτ∗=\(Vτ∗,Eτ∗\)\.G^\{\*\}\_\{\\tau\}=\(V^\{\*\}\_\{\\tau\},E^\{\*\}\_\{\\tau\}\)\.\(14\)Finally,Gτ∗G^\{\*\}\_\{\\tau\}is written back to Skill\-DAG Memory for future reuse\. Successful non\-template executions introduce new templates; successful template\-guided executions reinforce or refine existing templates\. Failed template executions only update reliability statistics\. Detailed extraction rules, scoring signals, and update policies are provided in Section A\.3 of the supplementary material\.

## Experiments

Table 1:Main results on SkillsBench and ALFWorld under different backbone models\. For SkillsBench, R denotes the verifier reward, T denotes average input tokens, and S denotes agent\-only runtime in seconds\. For ALFWorld, Success denotes task success rate, while Steps, Tokens, and Runtime denote average environment steps, average token consumption, and agent\-only runtime, respectively\.↑\\uparrowindicates higher is better, and↓\\downarrowindicates lower is better\. Bold numbers indicate the best result within each backbone group and benchmark, and underlined numbers indicate the second\-best result\.### Experimental Setup

#### Benchmarks\.

We evaluateSPEMon two complementary skill\-use benchmarks\.ALFWorld\([Shridhar et al\. 2021](https://arxiv.org/html/2610.26995#bib.bib27)\)is an interactive text\-based embodied environment\. It requires multi\-step household task completion, testing long\-horizon dependencies, state transitions, and procedural reuse\.SkillsBench\([Li et al\. 2026b](https://arxiv.org/html/2610.26995#bib.bib12)\)evaluates technical agent tasks with large skill libraries\. It tests whether agents can retrieve and apply task\-relevant skills under limited context budgets\.

#### Metrics\.

For ALFWorld, we report Success, Steps, Tokens, and Runtime\. Success \(↑\\uparrow\) is the task success rate within the maximum step budget\. Steps \(↓\\downarrow\) is the average number of environment interactions\. Tokens \(↓\\downarrow\) is the average token consumption during agent execution, and Runtime \(↓\\downarrow\) is the average agent\-only execution time\.

For SkillsBench, we report verifier rewardRR\(↑\\uparrow\), average input tokensTT\(↓\\downarrow\), and agent\-only runtimeSS\(↓\\downarrow\)\. Following the benchmark protocol,RRis determined by the official verifier\. For fair accounting,SSmeasures the agent execution phase and excludes environment setup, dependency installation, Docker build time, and verifier runtime\. ForSPEM, online skill retrieval or reranking invoked during execution is included in the measured agent phase\.

#### Baselines\.

We compareSPEMwith four baselines that form a controlled progression in skill access and structure awareness\.Vanilla Skillsloads the full skill library, testing whether exhaustive context alone is sufficient\.Vector Skillsretrieves top\-kkskills by embedding similarity, isolating the effect of flat semantic retrieval\.GoSserves as a representative static graph\-retrieval method, using a prebuilt skill graph to retrieve structurally related skills\.SkillDAGserves as a recent sota baseline for dependency\-aware skill selection with a self\-evolving graph structure\.SPEM\(Ours\)further introduces dual\-layer procedural memory, trajectory\-DAG extraction, and on\-demand Skill\-GNN reranking\. These baselines allow us to distinguish gains from more context, semantic retrieval, static graph structure, typed graph selection, and reusable procedural memory\.

#### Implementation Details\.

For fair comparison, all methods use the same benchmark splits, skill libraries, agent interface, execution environment, and verification protocol\. We evaluate with two backbone LLMs, MiniMax\-M2\.7\([MiniMax 2026](https://arxiv.org/html/2610.26995#bib.bib19)\)and GPT\-5\.2\-Codex\([OpenAI 2025](https://arxiv.org/html/2610.26995#bib.bib20)\), representing weaker and stronger model settings\.

OnALFWorld, we use the dev split with 140 episodes and set the maximum number of environment steps to 30\. All skill\-based methods use the same library of 37alfworld\-\*skills\.SPEMbuilds Atomic Skill Memory from this library, constructs Skill\-DAG Memory only from successful non\-evaluation trajectories, and trains Skill\-GNN with trajectory\-prefix supervision under disjoint training and evaluation instances\.

OnSkillsBench, we follow the GoS execution setting with Docker\-based environments, Harbor agent execution, verifier\-based evaluation, at most two attempts per task, and two concurrent trials\. Following the benchmark convention, tasks that remain unresolved due to infrastructure failures after the allowed retries are excluded rather than counted as model failures, leaving the same 67 valid model tasks for all methods\. All methods use the sameskills\_200skill library\.SPEMbuilds Atomic Skill Memory from the same library and applies library\-level warm start plus Skill\-GNN reranking\. Detailed hyperparameters, leakage\-prevention rules, retry handling, and additional inference details are provided in Section B of the supplementary material\.

Figure 3:Effectiveness and scalability analysis\. \(a\) Trajectory\-DAG extraction compresses successful trajectories into compact DAG backbones\. \(b\) Exact\-DAG template reuse reduces normalized execution cost\. \(c\) Hit@K under different skill library sizes\. \(d\) Recall@K and MRR under different skill library sizes\. Solid lines denote GNN\-based reranking, while dashed lines denote retrieval\-only selection\.

### Main Results

#### Overall effectiveness–efficiency trade\-off\.

Table[1](https://arxiv.org/html/2610.26995#Sx4.T1)shows thatSPEMachieves the best overall trade\-off across both benchmarks and backbone models\. On ALFWorld,SPEMobtains the highest success rate under both MiniMax\-M2\.7 and GPT\-5\.2\-Codex, improving over GoS by 2\.1 and 1\.8 percentage points, respectively, while also achieving the lowest runtime\. On SkillsBench,SPEMachieves the best reward with GPT\-5\.2\-Codex and the second\-best reward with MiniMax\-M2\.7, where SkillDAG obtains a higher reward but requires substantially more tokens and runtime\. In particular, compared with SkillDAG under MiniMax\-M2\.7,SPEMreduces input tokens by 26\.3% and runtime by 24\.3%, while remaining competitive in reward\.

#### Efficiency becomes more important with stronger models\.

As the backbone model becomes stronger, structure\-aware baselines such as GoS and SkillDAG also obtain competitive rewards, especially on SkillsBench\. This makes efficiency a critical differentiator rather than a secondary metric\. Under GPT\-5\.2\-Codex,SPEMimproves SkillsBench reward over GoS from 37\.50% to 38\.38%, while reducing input tokens by 15\.7% and runtime by 12\.3%\. On ALFWorld, SkillDAG achieves fewer steps, but it incurs much higher token and runtime costs\. In contrast,SPEMmaintains the highest success rate with much lower execution overhead, suggesting that reusable procedural memory is most useful when it provides compact guidance rather than longer plans or larger context\.

#### Why structure matters\.

The comparison among Vector Skills, GoS, SkillDAG, andSPEMclarifies the role of structure\. Vector Skills often reduce context size but can lose important procedural dependencies, leading to weaker reward or success\. GoS and SkillDAG show that explicit skill structures improve task performance, but they mainly rely on static or pre\-constructed structures and may introduce extra context or execution overhead\.SPEMfurther combines Atomic Skill Memory, reusable Skill\-DAG Memory, and state\-aware Skill\-GNN reranking, allowing the agent to reuse successful procedural structures while keeping injected guidance compact\. These results indicate that the main advantage ofSPEMis not simply retrieving more skills, but selecting and reusing structured procedural guidance under limited token and runtime budgets\.

Detailed case analyzes ofSPEMare provided in Section D of the supplementary material\.

Table 2:Template\-availability analysis on ALFWorld\. All values are percentages\.

### Analysis of DAG\-Template Effectiveness

We analyze whether the extracted Skill\-DAGs are both compact and useful\. As shown in Figure[3](https://arxiv.org/html/2610.26995#Sx4.F3)\(a\), trajectory\-DAG extraction compresses successful trajectories from 13\.4 average steps to 6\.0 backbone steps, pruning 54\.9% of operations while preserving the executable core\. This preliminarily demonstrates the compression effect of DAG templates\. We then evaluate the availability and effectiveness of DAG templates\. As shown in Table[2](https://arxiv.org/html/2610.26995#Sx4.T2), on ALFWorld,SPEMachieves template hit rates of 56\.43% and 60\.71% under MiniMax\-M2\.7 and GPT\-5\.2\-Codex, respectively\. Among template\-hit tasks, the success rates are 74\.68% and 85\.88%, respectively\. These results indicate that DAG templates can accumulate reusable procedural structures for later tasks\. Unlike ALFWorld, SkillsBench contains highly heterogeneous technical tasks, where exact procedural\-template reuse is naturally limited\. Therefore, we mainly use SkillsBench to evaluate large\-scale atomic\-skill retrieval and structure\-aware reranking, and use ALFWorld to analyze Skill\-DAG template reuse\. Finally, we conduct an exact\-template analysis on ALFWorld\. This isolates the effect of a correct DAG skeleton itself\. For each successfully completed task, we extract its trajectory and directly provide the DAG when re\-executing that task\. This setting tests whether DAG templates can improve execution efficiency\. As shown in Figure[3](https://arxiv.org/html/2610.26995#Sx4.F3)\(b\), exact\-DAG guidance preserves success on all evaluated tasks while reducing average steps from 11\.42 to 6\.26, token consumption from 23\.77K to 11\.93K, and runtime from 28\.01s to 20\.88s, corresponding to reductions of 45\.2%, 49\.8%, and 25\.5%, respectively\. This suggests that templates provide effective procedural guidance for improving task efficiency\.

Table 3:Component ablation ofSPEMon ALFWorld\. Succ\., Steps, Time, and Tokens denote task success rate, average completion steps, average runtime, and average token consumption\.†removes graph\-based Skill\-GNN and uses retrieved procedural memory\.
### Ablation Study\.

#### SPEMComponent Analysis

Table[3](https://arxiv.org/html/2610.26995#Sx4.T3)evaluates the contribution of each component ofSPEMon ALFWorld\.

- •Skill\-DAG templatesprovide reusable procedural guidance\. Removing them reduces success to 56\.8% and increases average steps to 23\.0, indicating more redundant exploration\.
- •Skill\-GNNsupports state\-aware skill selection: without graph\-based scoring, success drops to 58\.3%, showing that retrieved memory alone is not sufficient for stable execution under changing task states\.
- •DAG extractionmakes procedural memory compact\. Replacing extracted Skill\-DAG backbones with complete execution traces lowers success to 63\.0%\. It also increases token and runtime cost, because full traces contain redundant exploration and environment\-specific details\.
- •The fullSPEMachieves the best results across all metrics\. This demonstrates that reusable Skill\-DAG templates, structure\-aware skill selection, and compact trajectory extraction are complementary\.

#### Scalability to Larger Skill Libraries\.

Figures[3](https://arxiv.org/html/2610.26995#Sx4.F3)\(c\) and \(d\) further examine whether structure\-aware skill selection remains effective as the skill library grows\. Retrieval\-only selection degrades rapidly when the library size increases, especially at 1000 and 2000 skills, where semantic similarity alone struggles to rank the required skills near the top\. In contrast, Skill\-GNN consistently achieves higher Hit@K, Recall@K, and MRR across all library sizes\. For example, at 2000 skills, Skill\-GNN improves Hit@1 from 0\.0 to 0\.51 and MRR from 0\.112 to 0\.573 over retrieval\-only selection\. Although both methods become harder to rank as the candidate pool expands, the gap remains substantial, showing that graph\-based contextualization helps preserve reliable skill selection under large\-scale skill libraries\.

Additional backbone comparisons and hyperparameter sensitivity analyses can be found in Section C of the supplementary material\.

## Conclusion

We presentedSPEM, a reusable and structure\-aware skill memory framework for LLM\-based agents\. Instead of treating skills as a flat prompt collection,SPEMorganizes them into Atomic Skill Memory for individual capabilities and Skill\-DAG Memory for reusable procedural structures\. Skill\-GNN further enables state\-conditioned skill selection over dynamically constructed candidate graphs, allowing the agent to adapt its guidance during execution while remaining inductive to new tasks and skill combinations\. Experiments on ALFWorld and SkillsBench show thatSPEMimproves both task effectiveness and execution efficiency across weaker and stronger backbone models\. The results suggest that effective skill use requires more than semantic retrieval\. Agents benefit from compact procedural guidance that captures both which skills are relevant and how they should be composed\. Although current performance still depends on retrieval quality and the agent’s ability to execute retrieved guidance,SPEMprovides a practical step toward scalable, adaptive, and reusable skill memory for LLM\-based agents\.

## References

- Bai et al\. \(2026\)Bai, T\.; Wan, Z\.; Zhou, P\.; Yu, X\.; You, Y\.; and Tsang, I\. W\. 2026\.SkillDAG: Self\-Evolving Typed Skill Graphs for LLM Skill Selection at Scale\.*arXiv preprint arXiv:2606\.03056*\.
- Chen et al\. \(2026\)Chen, T\.; Li, Y\.; Solodko, M\.; Wang, S\.; Jiang, N\.; Cui, T\.; Hao, J\.; Ko, J\.; Abdali, S\.; Xu, L\.; Zheng, S\.; Fan, H\.; Cameron, P\.; Wagle, J\.; and Koishida, K\. 2026\.CUA\-Skill: Develop Skills for Computer Using Agent\.*arXiv preprint arXiv:2601\.21123*\.
- Chen et al\. \(2024\)Chen, Y\.; Yoon, J\.; Sachan, D\. S\.; Wang, Q\.; Cohen\-Addad, V\.; Bateni, M\.; Lee, C\.\-Y\.; and Pfister, T\. 2024\.Re\-Invoke: Tool Invocation Rewriting for Zero\-Shot Tool Retrieval\.In*Findings of the Association for Computational Linguistics: EMNLP 2024*, 4705–4726\.
- Du, Wei, and Zhang \(2024\)Du, Y\.; Wei, F\.; and Zhang, H\. 2024\.AnyTool: Self\-Reflective, Hierarchical Agents for Large\-Scale API Calls\.*arXiv preprint arXiv:2402\.04253*\.
- Gao \(2026\)Gao, X\. 2026\.Compositional Skill Routing for LLM Agents: Decompose, Retrieve, and Compose\.*arXiv preprint arXiv:2606\.18051*\.
- Han et al\. \(2026\)Han, T\.; Zhang, Y\.; Song, W\.; Fang, C\.; Chen, Z\.; Sun, Y\.; and Hu, L\. 2026\.SWE\-Skills\-Bench: Do Agent Skills Actually Help in Real\-World Software Engineering?*arXiv preprint arXiv:2603\.15401*\.
- Hao et al\. \(2023\)Hao, S\.; Liu, T\.; Wang, Z\.; and Hu, Z\. 2023\.ToolkenGPT: Augmenting Frozen Language Models with Massive Tools via Tool Embeddings\.In*Advances in Neural Information Processing Systems*, volume 36, 45870–45894\.
- Karpukhin et al\. \(2020\)Karpukhin, V\.; Oguz, B\.; Min, S\.; Lewis, P\.; Wu, L\.; Edunov, S\.; Chen, D\.; and Yih, W\.\-t\. 2020\.Dense Passage Retrieval for Open\-Domain Question Answering\.In*Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing*, 6769–6781\.
- Lewis et al\. \(2020\)Lewis, P\.; Perez, E\.; Piktus, A\.; Petroni, F\.; Karpukhin, V\.; Goyal, N\.; Küttler, H\.; Lewis, M\.; Yih, W\.\-t\.; Rocktäschel, T\.; Riedel, S\.; and Kiela, D\. 2020\.Retrieval\-Augmented Generation for Knowledge\-Intensive NLP Tasks\.In*Advances in Neural Information Processing Systems*, volume 33, 9459–9474\.
- Li et al\. \(2026a\)Li, H\.; Mu, C\.; Chen, J\.; Ren, S\.; Cui, Z\.; Zhang, Y\.; Bai, L\.; and Hu, S\. 2026a\.Organizing, Orchestrating, and Benchmarking Agent Skills at Ecosystem Scale\.*arXiv preprint arXiv:2603\.02176*\.
- Li et al\. \(2023\)Li, M\.; Zhao, Y\.; Yu, B\.; Song, F\.; Li, H\.; Yu, H\.; Li, Z\.; Huang, F\.; and Li, Y\. 2023\.API\-Bank: A Comprehensive Benchmark for Tool\-Augmented LLMs\.In*Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing*, 3102–3116\.
- Li et al\. \(2026b\)Li, X\.; Chen, W\.; Liu, Y\.; Zheng, S\.; Chen, X\.; He, Y\.; Li, Y\.; You, B\.; Shen, H\.; Sun, J\.; et al\. 2026b\.SkillsBench: Benchmarking How Well Agent Skills Work Across Diverse Tasks\.*arXiv preprint arXiv:2602\.12670*\.
- Liang et al\. \(2026\)Liang, Y\.; Zhong, R\.; Xu, H\.; Jiang, C\.; Zhong, Y\.; Fang, R\.; Gu, J\.\-C\.; Deng, S\.; Yao, Y\.; Wang, M\.; et al\. 2026\.SkillNet: Create, Evaluate, and Connect AI Skills\.*arXiv preprint arXiv:2603\.04448*\.
- Liu et al\. \(2026\)Liu, D\.; Li, Z\.; Du, H\.; Wu, X\.; Gui, S\.; Kuang, Y\.; and Sun, L\. 2026\.Graph\-of\-Skills: Dependency\-Aware Structural Retrieval for Massive Agent Skills\.*arXiv preprint arXiv:2604\.05333*\.
- Liu et al\. \(2024a\)Liu, N\. F\.; Lin, K\.; Hewitt, J\.; Paranjape, A\.; Bevilacqua, M\.; Petroni, F\.; and Liang, P\. 2024a\.Lost in the Middle: How Language Models Use Long Contexts\.*Transactions of the Association for Computational Linguistics*, 12: 157–173\.
- Liu et al\. \(2024b\)Liu, X\.; Peng, Z\.; Yi, X\.; Xie, X\.; Xiang, L\.; Liu, Y\.; and Xu, D\. 2024b\.ToolNet: Connecting Large Language Models with Massive Tools via Tool Graph\.*arXiv preprint arXiv:2403\.00839*\.
- Mi et al\. \(2026\)Mi, Q\.; Ma, Z\.; Yang, M\.; Li, H\.; Wang, Y\.; Zhang, H\.; and Wang, J\. 2026\.ProcMEM: Learning Reusable Procedural Memory from Experience via Non\-Parametric PPO for LLM Agents\.*arXiv preprint arXiv:2602\.01869v1*\.
- Mialon et al\. \(2023\)Mialon, G\.; Dessì, R\.; Lomeli, M\.; Nalmpantis, C\.; Pasunuru, R\.; Raileanu, R\.; Rozière, B\.; Schick, T\.; Dwivedi\-Yu, J\.; Celikyilmaz, A\.; et al\. 2023\.Augmented Language Models: A Survey\.*Transactions on Machine Learning Research*\.
- MiniMax \(2026\)MiniMax\. 2026\.MiniMax M2\.7: Enabling Model Self\-Evolution\.https://www\.minimaxi\.com/blog/minimax\-m27\.Accessed: 2026\-07\-25\.
- OpenAI \(2025\)OpenAI\. 2025\.Introducing GPT\-5\.2\-Codex\.https://openai\.com/index/introducing\-gpt\-5\-2\-codex/\.Accessed: 2026\-07\-25\.
- Patel et al\. \(2026\)Patel, B\.; Belli, D\.; Jalalirad, A\.; Arnold, M\.; Ermolov, A\.; and Major, B\. 2026\.Dynamic Tool Dependency Retrieval for Lightweight Function Calling\.In*Findings of the Association for Computational Linguistics: ACL 2026*, 33649–33672\. San Diego, California, United States: Association for Computational Linguistics\.
- Patil et al\. \(2023\)Patil, S\. G\.; Zhang, T\.; Wang, X\.; and Gonzalez, J\. E\. 2023\.Gorilla: Large Language Model Connected with Massive APIs\.*arXiv preprint arXiv:2305\.15334*\.
- Qin et al\. \(2024\)Qin, Y\.; Liang, S\.; Ye, Y\.; Zhu, K\.; Yan, L\.; Lu, Y\.; Lin, Y\.; Cong, X\.; Tang, X\.; Qian, B\.; Zhao, S\.; Hong, L\.; Tian, R\.; Xie, R\.; Zhou, J\.; Gerstein, M\.; Li, D\.; Liu, Z\.; and Sun, M\. 2024\.ToolLLM: Facilitating Large Language Models to Master 16000\+ Real\-world APIs\.In*International Conference on Learning Representations*\.
- Schick et al\. \(2023\)Schick, T\.; Dwivedi\-Yu, J\.; Dessì, R\.; Raileanu, R\.; Lomeli, M\.; Zettlemoyer, L\.; Cancedda, N\.; and Scialom, T\. 2023\.Toolformer: Language Models Can Teach Themselves to Use Tools\.In*Advances in Neural Information Processing Systems*, volume 36\.
- Shi et al\. \(2025\)Shi, Z\.; Wang, Y\.; Yan, L\.; Ren, P\.; Wang, S\.; Yin, D\.; and Ren, Z\. 2025\.Retrieval Models Aren’t Tool\-Savvy: Benchmarking Tool Retrieval for Large Language Models\.In*Findings of the Association for Computational Linguistics: ACL 2025*, 24497–24524\. Vienna, Austria: Association for Computational Linguistics\.
- Shinn et al\. \(2023\)Shinn, N\.; Cassano, F\.; Gopinath, A\.; Narasimhan, K\.; and Yao, S\. 2023\.Reflexion: Language Agents with Verbal Reinforcement Learning\.In*Advances in Neural Information Processing Systems*, volume 36\.
- Shridhar et al\. \(2021\)Shridhar, M\.; Yuan, X\.; Côté, M\.\-A\.; Bisk, Y\.; Trischler, A\.; and Hausknecht, M\. 2021\.ALFWorld: Aligning Text and Embodied Environments for Interactive Learning\.In*International Conference on Learning Representations*\.
- Xia et al\. \(2026\)Xia, T\.; Hu, L\.; Sun, Y\.; Xu, M\.; Xu, L\.; Wang, S\.; Xu, W\.; and Jiang, J\. 2026\.GraSP: Graph\-Structured Skill Compositions for LLM Agents\.*arXiv preprint arXiv:2604\.17870*\.
- Xu et al\. \(2023\)Xu, Q\.; Hong, F\.; Li, B\.; Hu, C\.; Chen, Z\.; and Zhang, J\. 2023\.On the Tool Manipulation Capability of Open\-source Large Language Models\.*arXiv preprint arXiv:2305\.16504*\.
- Yao et al\. \(2023\)Yao, S\.; Zhao, J\.; Yu, D\.; Du, N\.; Shafran, I\.; Narasimhan, K\.; and Cao, Y\. 2023\.ReAct: Synergizing Reasoning and Acting in Language Models\.In*International Conference on Learning Representations*\.
- Yuan et al\. \(2023\)Yuan, L\.; Chen, Y\.; Wang, X\.; Fung, Y\. R\.; Peng, H\.; and Ji, H\. 2023\.CRAFT: Customizing LLMs by Creating and Retrieving from Specialized Toolsets\.*arXiv preprint arXiv:2309\.17428*\.
- Zhang et al\. \(2026\)Zhang, X\.; Gao, M\.; Zhao, Y\.; Tan, X\.; Yao, Y\.; Wang, F\.; Wang, Y\.; Dingsiyi; and Yang, T\. 2026\.Formal Skill: Programmable Runtime Skills for Efficient and Accurate LLM Agents\.*arXiv preprint arXiv:2605\.19604*\.
- Zheng et al\. \(2026\)Zheng, Y\.; Zhang, Z\.; Ma, C\.; Yu, Y\.; Zhu, J\.; Wu, Y\.; Xu, T\.; Dong, B\.; Zhu, H\.; Huang, R\.; and Yu, G\. 2026\.SkillRouter: Skill Routing for LLM Agents at Scale\.*arXiv preprint arXiv:2603\.22455*\.

Similar Articles

AdMem: Advanced Memory for Task-solving Agents

arXiv cs.AI

This paper introduces AdMem, a unified memory framework for LLM-based agents that integrates semantic, episodic, and procedural memory with a bi-level short-term and long-term store, using a multi-agent architecture for automatic memory generation and adaptive retrieval. Experiments show improved robustness and success on long multi-turn tasks.