Papers
arxiv:2610.14216

Cortex: Measurement-Gated Evolution and Pruning of Coding-Agent Skills and Rules

Published on Oct 9
· Submitted by
Samuele Giampieri
on Oct 15

Abstract

Cortex validates agent harness updates by replaying developer corrections, retaining only rules and skills that consistently improve performance without degrading tasks.

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.

Community

Paper author Paper submitter

Author here. Cortex is a tool for Claude Code that treats every skill or rule in a coding agent's harness as a hypothesis to test, not a fix to trust. It saves fixes from real sessions as replayable tasks, writes one skill or rule at a time from the corrections that recur, 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.

What the evaluation found (4 independent runs, Claude Haiku 4.5, held-out tasks):

  • +55.0 points of pass rate over no harness on the four rule families (95% CI [+34.1, +74.1]); the control family unchanged (−0.8).
  • 16 of the 18 items kept were rules. Rules load automatically; skills must be chosen by the agent, and those offered on every turn were rarely opened.
  • The value depends on the model. The harness of one run gained +66.7 points under Haiku and +5.6 under Claude Sonnet 5, which already followed most of the conventions.

Code, the evaluation lab and all data: https://github.com/samugit83/cortex
Every number in the paper is a row of NUMBERS.csv in the repository, with the script that computes it.

Happy to answer questions.

Paper author Paper submitter

The problem. Coding agents like Claude Code follow text that developers write for them: a CLAUDE.md, skills the agent may choose to open, and rules that load automatically when it reads matching files. Developers add to this harness every time they have to correct the agent, and almost never check whether an addition actually helps. One success proves little: the same agent can pass a task once and fail it the next time.

What Cortex does. It is three commands for Claude Code plus a small CLI that does the measuring:

  • /harvest, at the end of a session, saves a fix the developer made as a replayable task (the broken commit, the request, a check that fails before the fix and passes after it), and each correction as a one-line lesson.
  • /evolve finds the correction that recurs most, writes one skill or rule for it, and runs the agent on the tasks with and without it: a cheap screen (each task twice per arm), then a stricter confirm (three times). The candidate is kept only if it actually entered the agent's context, shows a net gain, and makes no task noticeably worse.
  • /prune tests existing items the same way, by removing them. An item that never entered the context is UNMEASURED and stays: Cortex neither adds nor deletes text the agent never used.

The verdicts are computed by a script; no model judges them.

How it was tested. A purpose-built repository with four house rules a model tends to break: every user-visible change gets a line in CHANGELOG.md; money is integer cents, scaled only with the project's rate helpers; a new exporter needs a registry entry, a documentation row and a golden file; and code reads the time only through the project's clock. A fifth family of plain bugs has nothing to learn and serves as the control. A script plays the developer. Four independent runs with Claude Haiku 4.5 each started from no harness, and every harness was then measured on 30 held-out scenarios it had never seen (6,462 rollouts in the whole study).

What we found.

  • On the four rule families, the evolved harnesses raised the held-out pass rate from 21.5% to 76.5%: +55.0 points (95% CI [+34.1, +74.1]). The control family moved by −0.8. The same harness measured twice differed by −3.3 [−7.3, 0.0], which is the noise floor.
  • Rules did most of the work: 16 of the 18 items kept were rules. A rule enters the context whenever its files are read; a skill must be chosen. Candidate skills offered on every turn were opened in 0 of 198 rollouts; skills offered only with the files a task touched, in 28 of 66.
  • Cortex kept none of the 20 placebo and 5 harmful candidates planted in its path, and 2 of 4 known-good ones. The agent never opened the placebos or the harmful skills, though, and the harmful rules got no verdict, so this shows that Cortex keeps no unused text, not that it detects damage.
  • The value depends on the model: one run's harness gained +66.7 points under Haiku but +5.6 [−2.8, +13.9] under Claude Sonnet 5, which already followed most of the conventions. On a real open-source project (structlog), where the agent was rarely corrected, Cortex found nothing to learn.

Limits. One synthetic repository, conventions a machine can check, a scripted developer, and a gain that belongs mostly to a weaker model.

Everything is open. The tool, the lab and all the data are on GitHub. Every number in the paper is a row of NUMBERS.csv with the script that computes it, and the whole analysis rebuilds offline in about two minutes.

Happy to answer questions.

Sign up or log in to comment

Get this paper in your agent:

hf papers read 2610.14216
Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash

Models citing this paper 0

No model linking this paper

Cite arxiv.org/abs/2610.14216 in a model README.md to link it from this page.

Datasets citing this paper 0

No dataset linking this paper

Cite arxiv.org/abs/2610.14216 in a dataset README.md to link it from this page.

Spaces citing this paper 0

No Space linking this paper

Cite arxiv.org/abs/2610.14216 in a Space README.md to link it from this page.

Collections including this paper 0

No Collection including this paper

Add this paper to a collection to link it from this page.