Skill-based LLM agents increasingly rely on long procedural documents, but full-document prompting wastes tokens and dilutes information critical to execution. We study this setting as intra-skill retrieval, where the goal is to select a minimal, execution-sufficient context from a known skill document given a query. We present SkillPager, a two-stage framework that parses each Markdown skill into typed semantic nodes offline and leverages Maximal Marginal Relevance (MMR) to perform global, query-conditioned node selection online. On a benchmark of 395 skills and 1,975 queries, SkillPager achieves 78.89% LLM-judged context sufficiency, compared to 82.23% for the exhaustive full-document baseline, while reducing prompt tokens by 47.04%. A granularity ablation shows that applying the same retrieval algorithm to raw fixed-length chunks reaches a comparable 81.77% sufficiency but increases token cost by 28.81%, demonstrating that efficiency gains are driven by typed semantic granularity rather than the retrieval algorithm alone. Among graph-based baselines, SkillPager outperforms the strongest baseline by a margin of 12.16%. Further ablations show that supporting content is most effective when retained in the candidate pool and selected adaptively rather than removed by static heuristics. These results identify typed intra-document retrieval as a distinct access problem for skill-based agents.
翻译:基于技能的LLM代理日益依赖长篇程序化文档,但全文档提示会浪费令牌并稀释执行所需的关键信息。我们将其研究为技能内检索场景,目标是针对给定查询从已知技能文档中选取最小且足以执行的上下文。本文提出SkillPager——一种两阶段框架,离线将每个Markdown技能解析为类型化语义节点,并在线利用最大边缘相关性(MMR)进行全局查询条件化的节点选择。在包含395个技能与1975个查询的基准测试中,SkillPager达到了78.89%的LLM评判上下文充分性(相较全文档穷举基线的82.23%),同时减少47.04%的提示令牌。粒度消融实验表明,对原始固定长度分块应用相同检索算法可达到81.77%的可比充分性,但令牌成本增加28.81%,这证明效率提升源于类型化语义粒度而非检索算法本身。在基于图的基线方法中,SkillPager以12.16%的绝对优势超越最强基线。进一步消融实验显示,支持性内容在保留于候选池中并按需自适应选取时最为有效,而非通过静态启发式规则移除。这些结果将类型化文档内检索确立为基于技能的代理面临的一项独特访问问题。