面向智能体智能的大规模代码基础技能合成
研究论文 · 2026/09/21
可复用技能为智能体提供可迁移的过程性知识,因此可扩展的获取方式对扩展智能体经验至关重要。现有方法存在两个局限:基于轨迹的合成需要与特定环境交互,而文档衍生的技能可能缺乏可执行证据和验证。源代码提供了一条互补路径:它无需智能体先验经验,却能为抽象提供可执行证据。我们提出 Code2Skill,一个全自动流水线,将选定的代码单元转化为实现锚定的原子操作、复合工作流和重复模式记录,然后通过源体盲重建和源感知比较验证每条记录。应用于 19,769 个流行且活跃维护的 GitHub 仓库,Code2Skill 生成了 CodeSkillBank,一个包含 1,006,822 条接受记录的有依据技能库,带有工作流、边界、来源和源证据元数据。在覆盖九种模型设置和八个基准的 72 项协议匹配评估中,使用检索到的 CodeSkillBank 技能增强的模型平均比匹配基线提升 11.7%,并在 57 个案例中优于基线。在统一下游接口下,Code2Skill 在全部七个共享基准上也优于轨迹衍生的技能库,表明仓库衍生技能可在智能体积累足够交互经验前提供有用的过程性知识。从经过测试的 AI 生成代码合成的技能通过率为 93.50%,而人类编写代码为 93.00%,初步表明该流水线可随 AI 生成软件量的增长而扩展。总体而言,Code2Skill 将仓库中嵌入的过程性知识转化为有依据、可验证且可迁移的智能体技能。
该工作提出了一种从源代码大规模合成可验证智能体技能的新方法,解决了现有技能获取依赖环境交互或缺乏可执行证据的局限,并通过大规模实验证明了其有效性和可扩展性,对智能体技能库的构建具有重要参考价值。
Reusable skills give agents transferable procedural knowledge, making scalable acquisition essential for extending agents beyond prior experience. Existing methods face two limitations: trajectory-based synthesis requires interactions with specific environments, while document-derived skills may lack executable evidence and verification. Source code offers a complementary path: it requires no prior agent experience yet provides executable evidence for grounding abstractions. We present Code2Skill, a fully automated pipeline that transforms selected code units into implementation-anchored records of atomic operations, composite workflows, and recurring patterns, then verifies each record through source-body-blind reconstruction and source-aware comparison. Applied to 19,769 popular, actively maintained GitHub repositories, Code2Skill produces CodeSkillBank, a grounded bank of 1,006,822 accepted records with workflow, boundary, provenance, and source-evidence metadata. Across 72 protocol-matched evaluations covering nine model settings and eight benchmarks, models augmented with retrieved CodeSkillBank skills improve by 11.7% on average over matched baselines and outperform them in 57 cases. Under a unified downstream interface, Code2Skill also outperforms trajectory-derived skill banks on all seven shared benchmarks, showing that repository-derived skills can provide useful procedural knowledge before agents accumulate sufficient interaction experience. Skills synthesized from tested AI-generated code achieve a 93.50% pass rate, compared with 93.00% for human-written code, providing initial evidence that the pipeline can expand with the growing volume of AI-generated software. Overall, Code2Skill transforms procedural knowledge embedded in repositories into grounded, verifiable, and transferable agent skills.