Recursive Self Improvement for Coding Agents
Sign in<br>Subscribe
Preface<br>Recursive self-improvement is the idea that models can iterate and improve on themselves to unlock singularity. We have achieved a version of that at Cline.<br>In the past few days, the response to Kimi K3 has been incredible. Building on that momentum, we optimized its performance with Cline and achieved SOTA results on Terminal-Bench 2.1 using one-shot recursive self-improvement.<br>We got an 88.8% score with the run costing $49.8. That surpasses Fable 5 at less than a tenth of the price: Fable spent $552, and even GPT 5.6 Terra spent $400 on Tbench2.1.<br>Aside from the system prompt + a few nudges, this was entirely self-contained. A single prompt kicked off 17 hours of continuous coding agent run with GPT-5.6-Sol as the leader model. One billion tokens total: 400 million spent by the coding agent, 600 million by repeated eval runs. See the prompt used here.<br>We could have done the normal hill climbing we always do. Instead, the model made a PR on its own, a first-of-its-kind hill climb that turned a good score into a SOTA score. Note: We tried this experiment with Fable 5 too but its AI safety filter kept downgrading the model to Opus-4.8, and we simply gave up.<br>Cline’s hill climbing experiences<br>Hill climbing isn't new to us as we've been doing evals and hill climbing at Cline for a while now. Back in January, we took Opus 4.5 from 47% to 57% on Terminal-Bench. That took a couple weeks of human work reading model traces, forming hypotheses, testing fixes, staring at failure logs until your eyes bled. In February we published the playbook. It was a joint effort from 4 people on our engineering team.<br>Six months later, the harness and the models have both improved so much that this run was done by a single prompt from one engineer. Weeks of human work got converted into 17 hours of long running agent work. The trace-reading, the hypothesis-forming, the fix-testing all of it, covered by agents with a fixed goal and adaptable context window. At this point it's very clear to us that the bottleneck isn't models but the humans using them.<br>And our score isn't a consolation prize as Moonshot's own vendor-reported SOTA on Terminal-Bench 2.1 is 88.3%. We matched it with a general-purpose harness, on the first recursive campaign. The cost math and proof traces are attached here.<br>First, we'll walk you through the step-by-step procedure of how the recursive run worked:<br>The actual hill climb<br>Everything below ran off one prompt.<br>We started with a baseline. One full Terminal-Bench 2.1 run on stock Cline harness, Kimi K3 through OpenRouter and it costed 69/89 (77.5%) for $79.<br>Instead of hill climbing by hand, we asked GPT-5.6 to write the prompt for us. We described how we normally climb this hill, and it turned that into a recursive self-improvement brief. The first draft was already comprehensive. We tightened it to cover the edge cases and pinned down a well-defined end state. The goal was modest: let it run for a while and see what happens. We had no expectation it would perform this well, yet here we are at a SOTA score. You can read the full prompt in this github gist.<br>The agent worked in different experiments and tried them one by one, maintaining a record of what it had accomplished in a massive file so that it wouldn't run in circles:<br>Experiment 0: max reasoning. First finding: Cline didn’t represent K3's max reasoning effort as the harness silently collapsed it to high. The model fixed the abstraction. Not a score change, but a correctness fix that unblocked everything downstream. Commit d1bc440.<br>Experiment 1: retry the 429s. Five baseline failures were the same story: OpenRouter returned a 429 and Cline just gave up. Healthy sessions, killed by a single rate limit, since at the time there was a single provider serving Kimi K3 and capacity was tight. This was a boring fix of raising the number of retries with exponential backoff. On the diagnostic slice, all five losses flipped to passes. Commit cabfa9e.<br>Experiment 2: smarter loop detection. Two tasks died because Cline's loop detector killed agents that were legitimately polling long-running background work. Same command, but the output was changing so that's actual progress, not a loop. The model made the detector output-aware. Both tasks flipped. Commit dbcdba8.<br>Experiment 3: the 7.6-second ghost failure. One task exited in 7.6 seconds with zero tokens and no session. The model reduced it to a wild root cause: any prompt containing @a-style tokens triggered a file-mention lookup on an unreferenced async worker, and the process legally exited before the model was ever called. This was a one-line liveness fix leading to a deterministic flip. Commit 289cb82.<br>Experiment 4: stopping task suicides. Two tasks failed because the agent ran pkill -f with a pattern that matched its own harness command line, so it terminated itself mid-task. The fix: tool guidance to track PIDs instead of broad...