arXiv(opens in a new tab)cs.CLAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2608.22339

When Not to Imitate: Boundary-Aware Skill Memory for Reliable Tool-Use LLM Agents

Zihan Lin, Zhenyu Chen, Jiawen Wei, Xiaohan Wang, Jie Cao, Jiajun Chai, Wei Lin, Guojun Yin, Ran He

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Extracting skills from past successes is critical for the efficient evolution of Large Language Model (LLM) agents. Prevailing agent self-evolution paradigms typically rely on a core assumption: equipping LLMs with skill memories derived from successful trajectories will monotonically improve their problem-solving capabilities. However, probe analyses reveal that extracting skills solely from successful trajectories traps the model in a Skill Imitation Trap. For tasks that resemble past successes but require different tools, retrieving more skills paradoxically increases the model's confidence in wrong tool calls—procedure skills raise the wrong-tool margin by 47% over a memory-free baseline. To overcome this limitation, we propose Boundary-Aware Skill Memory (BASM), which augments each skill with explicit boundary fields—applicability conditions, risk cues, avoidance rules, and recovery notes. These fields transform each retrieved skill from an unconditional action template into state-conditioned guidance: the agent applies the skill when its conditions hold, suppresses inapplicable tool calls when they do not, and issues targeted repairs when execution fails. Across three agent benchmarks and four model scales, BASM consistently outperforms success-distilled skill-memory baselines: it improves task success rate by up to 23.8% on AppWorld, accuracy by up to 5.0% on BFCL, and reduces attack success rate by 4.6% on Agent-Dojo, while simultaneously reducing average AppWorld steps by up to 6.6% relative to the memory-free baseline.

1 Introduction

Large language model (LLM) agents are increasingly deployed in complex, interactive environments that demand multi-step tool use, API orchestration, and long-horizon planning (Yao et al., 2022; Lin et al., 2026a; Xi et al., 2025; Lin et al., 2026b; Lu et al., 2026a; Chen et al., 2025). A central challenge in building such agents is enabling them to improve over time without constant human supervision. Skill acquisition, which enables agents to extract, store, and reuse procedural knowledge from past experience, has emerged as a critical mechanism for agent self-evolution (Wang et al., 2023; Zhu et al., 2023; Zhao et al., 2024; Lin et al., 2025). By distilling successful trajectories into reusable skill memories, agents can avoid redundant exploration and transfer solutions across structurally similar tasks (Wang et al., 2026c; Mi et al., 2026).

Existing approaches have explored how skills are represented, acquired, retrieved, and evolved across a range of settings. Early agents such as Voyager and ExpeL compressed successful trajectories into reusable programs or verbal lessons (Wang et al., 2023; Zhao et al., 2024); recent work has extended this to online skill induction, RL-driven distillation, and cross-agent library transfer (Wang et al., 2025; Tang et al., 2025; Lu et al., 2026b; Wang et al., 2026a,b). Despite their varied perspectives, these approaches largely treat success-distilled skills as positive transfer: once retrieved as relevant, a skill is presumed useful, while its validity boundary remains implicit.

This omission matters when semantic relevance diverges from decision validity: a retrieved skill appears relevant but lacks boundary cues for whether its action pattern still applies. By probing model behavior at varying retrieval depths, we identify a failure mode we term the Skill Imitation Trap

(Figure 2): the model’s preference for a semantically similar but inapplicable tool increases as more success-distilled skills are retrieved, causing skill memory to underperform a memory-free baseline in inapplicable states. Mechanistically, attention analysis pinpoints the cause: when a retrieved skill matches the current query, success-distilled memory shifts the model’s attention toward procedural content rather than boundary cues, treating the retrieved skill as an unconditional action template. This teaches the model to focus on how a past task was solved, with no mechanism to assess whether the present state actually meets the conditions for that solution.

To overcome the Skill Imitation Trap, we propose Boundary-Aware Skill Memory (BASM), a skill-memory method that augments procedural knowledge with explicit boundary conditions. Figure 1 illustrates how BASM transports boundary evidence from offline extraction to online retrieval and decision-time checking. Unlike success-distilled skill memory, BASM treats a retrieved skill as state-contingent evidence rather than an unconditional action template, enabling the agent to apply the skill when its assumptions hold, suppress risky tool calls when they do not, and repair local failures when execution deviates. Probe analyses confirm that boundary fields function as a state-conditioned attention modulator: the model consults boundary content more in risky and repair states than in safe ones. Moreover, same-prompt knockout shows that blocking boundary-span attention recovers 69.4% of the imitation-trap effect, confirming that boundary fields are a causal anti-imitation channel. Across BFCL, AppWorld, and AgentDojo on four model scales, BASM consistently outperforms success-distilled skill memory baselines: it improves task success rate by up to 23.8% on AppWorld and accuracy by up to 5.0% on BFCL; it reduces attack success rate by 4.6% on AgentDojo while reducing average AppWorld steps by up to 6.6% relative to the memory-free baseline; and it achieves Pareto improvements in both task utility and safety on Qwen3-14B.

Our contributions are as follows:

  1. Skill Imitation Trap probe analyses. We identify and characterize the Skill Imitation Trap through mechanism-level probe analyses. Using wrong-tool margin measurements, attention attribution, and same-prompt knockout, we show that success-distilled skill memory amplifies wrong-tool confidence in risky states (wrong-tool margin increases by 47% relative to memory-free baseline) and routes its imitation effect through procedural attention at decision tokens. Critically, ablating boundary-span attention recovers 69.4% of the imitation effect, confirming that boundary fields serve as a causal anti-imitation channel.

  2. Boundary-Aware Skill Memory design. We propose BASM, a seven-slot boundary-aware skill schema—goal, procedure, tools, applicability conditions, risk cues, avoidance rules, and recovery notes—together with a budgeted retrieval-and-formatting pipeline, a boundary checker for prompt-side enforcement, and a runtime repair module for stateful environments. This design transforms retrieved skills from unconditional action templates into boundary-aware records that guide when a skill should be applied, suppressed, or locally repaired.

  3. Broad experimental validation. We evaluate BASM across three complementary benchmarks (BFCL, AppWorld, AgentDojo) and four model scales spanning 8B to 397B parameters. BASM consistently improves over success-distilled skill-memory baselines: AppWorld success rate improves by up to 23.8%; BFCL accuracy improves by up to 5.0%; AgentDojo attack success rate drops by 4.6%; average AppWorld steps fall by up to 6.6% relative to the memory-free baseline; and Qwen3-14B achieves Pareto improvements in both utility and safety. Attention, logit, and knockout probes provide a coherent mechanistic account of these gains.

References (22)