Cortex:编码智能体技能与规则的测量门控演化与剪枝
Cortex: Measurement-Gated Evolution and Pruning of Coding-Agent Skills and Rules
AI总结:
Cortex是一款测试编码智能体管控文件变更的工具,通过测量门控演化与剪枝技能规则,在实验中提升了智能体遵循约定的频率,且未保留无用或有害内容,已发布工具与相关数据。
摘要:
Claude Code等编码智能体遵循开发者为其编写的文本文件:项目文件、智能体可选择启用的技能,以及智能体读取匹配文件时自动加载的规则,我们将这些文件称为智能体的“harness(管控文件)”。开发者在修正智能体时会向管控文件添加内容,但单次成功的参考价值有限:同一智能体可能某次通过任务,下次却失败。我们提出Cortex这一工具,它会测试管控文件的变更而非直接信任这些变更。Cortex会将开发者会话中的修复保存为可复现的任务,识别重复出现的修正,每次仅写入一项技能或规则,且仅当对该技能或规则进行带、不带它的重复运行后,显示出净增益且无任务明显恶化时才保留它;现有文本在删除前也会以相同方式测试,且Cortex不会添加或删除智能体从未使用过的文本。我们在一个专门构建的代码仓库上,使用Claude Haiku 4.5测试了Cortex,该仓库包含模型易违反的约定、一个无内容可学习的区域,以及模拟开发者的脚本。在保留的任务上,Cortex生成的管控文件使智能体遵循约定的频率远高于无技能或规则的情况,未改变无学习区域,且未添加每轮都读取的文本。自动加载的规则承担了大部分工作;技能仅在与任务涉及的文件一同提供时才有帮助,而每轮都提供的技能很少被启用。Cortex未保留我们植入的任何无用或有害建议,不过智能体从未启用无用建议或有害技能,且对有害规则未作出判定,因此该测试仅表明Cortex保留了未使用的文本,而非它能检测损害。在更强的Claude Sonnet 5上,单次运行的管控文件增益很小;在智能体很少被修正的真实开源项目上,Cortex未发现可学习的内容。我们发布该工具、实验环境及其数据。
英文摘要:
Coding agents such as Claude Code also follow text files that developers write for them: a project file, skills the agent may choose to open, and rules that load automatically when the agent reads matching files. We call these files the agent's harness. Developers add to it whenever they correct the agent, but one success proves little: the same agent can pass a task once and fail it the next time. We present Cortex, a tool that tests changes to the harness instead of trusting them. It saves fixes from the developer's sessions as replayable tasks, finds the corrections that recur, writes one skill or rule at a time, and keeps it only if repeated runs with and without it show a net gain and no task made noticeably worse. Existing text is tested the same way before it is deleted, and Cortex neither adds nor deletes text the agent never used. We tested Cortex with Claude Haiku 4.5 on a repository built for the purpose, with conventions the model tends to break, one area with nothing to learn, and a script playing the developer. On held-out tasks, the harnesses it built made the agent follow the conventions far more often than no skills or rules did, left the comparison area unchanged, and added no text read on every turn. Rules, which load automatically, did most of the work; skills helped only when offered with the files a task touches, and those offered on every turn were rarely opened. Cortex kept none of the useless or harmful suggestions we planted, but the agent never opened the useless ones or the harmful skills, and it reached no verdict on the harmful rules, so the test shows that Cortex keeps no unused text, not that it detects damage. Under the stronger Claude Sonnet 5 a single run's harness added little, and on a real open-source project, where the agent was rarely corrected, Cortex found nothing to learn. We release the tool, the lab and its data.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。