SkillSpec:面向智能体技能正确性的意图掩码规范推理

·

研究论文 · 2026/09/23

自主智能体系统日益依赖可复用技能抽象来整合经验知识与领域专长,这些技能通常将自由形式指令与异构资源捆绑。然而确保其正确性仍具挑战,失败模式超越传统代码缺陷,包括意图冲突等被底层模型掩盖的静默失败。我们提出 SkillSpec,一个 Hoare 风格框架,将技能正确性形式化为规范推理问题。它将异构技能库转化为统一图表示,对齐描述、指令与代码工件。对每个节点,SkillSpec 从周围声明意图推导 ExpectSpec,并在部分披露意图下从编码行为推断 FactSpecs。意图掩码调节对整体、谱系、邻域和局部视图的访问,以平衡过度上下文引入的偏差与上下文不足导致的无依据推断。SkillSpec 联合推理这些视图以标记候选缺陷,并在隔离沙箱中自动验证。在来自 SkillsBench 和广泛下载仓库的 515 个真实技能上,SkillSpec 在 239 个技能中识别出 763 个经人工确认的缺陷,精确率达 61.2%。跨多个模型家族的节点级分析表明,规范推理对代码节点始终可靠,而纯文本节点仍是主要瓶颈。大多数缺陷出现在声明意图与实现之间的边界,表明显式规范为真实智能体生态系统中的技能质量保证提供了实用基础。

该工作针对智能体技能正确性这一关键问题,提出了可落地的规范推理框架,并在真实技能库上验证了有效性,为技能质量保证提供了新思路。

Autonomous agent systems increasingly depend on reusable skill abstractions for consolidating experiential knowledge and domain expertise. These artifacts typically bundle free-form instructions with heterogeneous resources. However, ensuring their correctness remains challenging. Their failure modes transcend conventional code defects to subtle semantic inconsistencies such as intent conflicts, which manifest as silent failures masked by the underlying model. Moreover, skill correctness must be grounded in intended task boundaries and generalizability. We propose SkillSpec, a Hoare-style framework that formulates skill correctness as a specification reasoning problem. It transforms a heterogeneous skill repository into a unified graph representation that aligns descriptions, instructions and code artifacts. For each node, SkillSpec derives an ExpectSpec from the surrounding declared intent, and infers FactSpecs from encoded behavior under partially disclosed intent. An intent mask regulates access to holistic, lineage, neighborhood, and local views to balance the bias introduced by excessive context against unsupported inference caused by insufficient context. SkillSpec jointly reasons over these views to flag candidate defects, and automatically validates them in an isolated sandbox. On 515 real-world skills from SkillsBench and widely downloaded repositories, SkillSpec identified 763 manually confirmed defects across 239 skills, achieving 61.2% precision. The node-level analysis across multiple model families shows that specification reasoning is consistently reliable for code nodes, whereas plain-text nodes remain a major bottleneck. Most defects arise at the boundaries between declared intent and implementation, demonstrating that explicit specifications provide a practical foundation for skill quality assurance in real-world agent ecosystems.

阅读原文

参与讨论