# Refine your agent

Ask Zhanla to refine your agent. A refinement tries fixes in a separate git worktree, measures each against your unchanged code and recommends the best.

**Diagram: One refinement**

```text
Baseline → Propose a patch → Run tests and linters → Measure it → Go again or stop
```

You approve one card: goal, target score, iteration cap (default 10), base commit, the files it may change, and the tests and linters it runs.

Each iteration is a hypothesis, a patch, your checks and a measured run. If the repository has no tests or linters, a trial run of one dataset item stands in for the checks. Later iterations see earlier ones, regressions included, and a repeated patch is refused.

A refinement stops at the cap and pauses after two iterations in a row that couldn't complete. Otherwise the model decides when to stop, guided by your target and by three iterations without a 0.02 gain.

![A change Zhanla proposed to a demo agent's system prompt.](https://zhanla.vercel.app/docs-media/demo/overview-diff.png)

![What that change moved against the baseline.](https://zhanla.vercel.app/docs-media/demo/overview-measured.png)

Nothing is applied. Ask Zhanla to open the iteration you want as a draft PR.

> Multi-turn scores can move by more than 0.02 between identical runs. Rerun before trusting a small gain.

---

Source: https://zhanla.vercel.app/docs/test/improve
Updated 2026-11-24. Checked against release candidate b60cdc94.
