Cortex:编码智能体技能与规则的测量门控演化与剪枝
研究论文 · 2026/10/16
Coding agents like Claude Code follow text files written by developers: a project file, skills the agent may open, and rules that load automatically when matching files are read. These files form the agent's harness. Developers add to it when correcting the agent, but one success proves little because the same agent can pass a task once and fail it next time. Cortex tests changes to the harness instead of trusting them. It saves fixes from developer sessions as replayable tasks, finds recurring corrections, 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 deletion, and Cortex neither adds nor deletes text the agent never used. Cortex was tested with Claude Haiku 4.5 on a purpose-built repository 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 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 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 Cortex keeps no unused text, not that it detects damage. Under 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. The tool, lab, and data are released.
Cortex 提出了一种基于测量的方法,用于验证编码代理的 harness 变更,避免盲目信任单次成功,并提供了在特定模型和场景下的实证结果,对代理配置管理有参考价值。
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.