# Codex AGENTS.md tuning: gains failed the holdout

Stet publishes a public search API over its indexed pages; the guide is at https://www.stet.sh/agents/agent-access.

Source: https://www.stet.sh/blog/how-i-used-codex-to-improve-its-own-agents-md
Source observed: 2026-11-15T21:02:54.253Z
Last checked: 2026-11-19T11:08:33.825+00:00
Indexed: 2026-11-15T21:07:15.904+00:00

---

# I had Codex iterate on its own `AGENTS.md` 8 times and measured each version against real PRs

**May 27, 2026 · 9 min read** · [Ben, Founder, Stet](https://www.stet.sh/about)

We asked Codex to improve our `AGENTS.md` using Stet benchmarks rather than intuition. The experiment ran **8 candidate iterations** on an **n=5 training slice**, followed by a clean **n=10 holdout**. The best-looking candidate on the training tasks improved some local quality measures but regressed on the holdout, so we did not promote it as safe to ship.

## Why `AGENTS.md` matters

`AGENTS.md`, `CLAUDE.md`, and shared skills are part of a coding system’s runtime behavior, not ordinary documentation. Treating `AGENTS.md` as a tunable harness component means holding other variables constant and measuring how agent behavior changes when the file changes.

## Results

On the five-task training slice, one candidate fixed the task the baseline missed, improved footprint risk, and raised several craft scores. On the ten-task holdout, tests stayed even while footprint widened, token and tool use increased, and code-review correctness fell.

For this experiment:

- **Equivalent:** the patch matched the intent of the merged human PR.
- **Code-review pass:** an AI reviewer judged the patch acceptable.
- **Craft/discipline:** a 0–4 maintainability/style rubric.
- **Footprint risk:** extra code touched relative to the human patch.

### Candidate minus baseline

| Signal | Iteration 7, n=5 training slice | Clean holdout, n=10 final check |
|---|---:|---:|
| Tests | +20pp | flat |
| Equivalence | 0 wins, 1 loss | 1 win, 0 losses |
| Review overall | +0.10 | +0.05 |
| Correctness | flat | -0.20 |
| Scope discipline | -0.28 | -0.49 |
| Footprint risk | -0.10 | +0.039 |
| Token use | input -10.4M, output -24.6K | input +17.8M, output +23.6K |
| Captured tool calls | partial -33.6 average | +12.8 average |

The setup used Codex with `gpt-5.5`, medium reasoning, on historical Stet tasks. Stet scored tests, strict publishability, equivalence, code review, footprint, tokens, duration, and craft/discipline rubrics. The grader was `gpt-5.4`.

## Process

Codex first tried a broad router rule: identify work type, state a hypothesis before editing, read relevant documentation, and treat scope as part of correctness. This exposed a failure mode: “small scope” could be interpreted as permission to omit named obligations.

The next candidate introduced an **obligation ledger**. Before editing, the agent identified named behavior, compatibility constraints, documentation, tests, and non-goals; before reporting, it marked each item met, missed, or unchecked.

That candidate improved same-sample code review by **+0.75**, correctness by **+0.60**, maintainability by **+1.00**, simplicity by **+0.64**, coherence by **+0.60**, and scope discipline by **+0.36**. Tests stayed at **5/5**, but footprint risk worsened slightly and the evidence was still same-sample.

A rule to prefer existing helpers, schemas, reporting paths, and public contracts sounded sensible but reduced simplicity, coherence, robustness, clarity, instruction adherence, scope discipline, intentionality, and diff minimality. A narrower rule to extend the owning surface instead of adjacent machinery also worsened review, correctness, scope discipline, duration, footprint, and token use.

The strongest candidate required: identify the obligation, identify the owner of the change, identify the validation path, then edit. On the five-task slice it recovered tests and strict publishability from **4/5 to 5/5**, improved footprint risk from **0.41 to 0.31**, and improved simplicity by **+0.40**, coherence by **+0.44**, diff minimality by **+0.30**, and review overall by **+0.10**. However, instruction adherence fell **-0.56** and scope discipline fell **-0.28**, so it was not promotion-grade.

On that run, input tokens fell from **33.9M to 23.5M** and output tokens from **85.3K to 60.7K**. Token savings did not determine the shipping decision; the quality tradeoffs did.

A further candidate requiring an exact owner file/function and validation command left tests green but reduced review overall by **-0.30**, correctness by **-0.40**, coherence by **-0.38**, and simplicity by **-0.10**. More process was not automatically more discipline.

## Holdout behavior

On the clean ten-task holdout:

- Tests tied at **10/10**.
- Strict publishability tied.
- Equivalence favored the candidate directionally: **1 win, 0 losses, 9 ties**.
- Code-review fail/pass tied.
- Maintainability improved **+0.30**.
- Edge-case handling improved **+0.10**.
- Review overall improved **+0.05**.
- Correctness fell **-0.20**.

The candidate improved coherent local implementation: clearer names, structured logs, explicit status/report fields, and targeted tests. It regressed in boundary judgment by narrowing broad requests to understood subcommands, documenting behavior more broadly than it implemented, or adding parallel metadata/reporting contracts instead of extending existing ones.

Examples included a durable-operator-record task narrowed from evaluation and replay flows to rules only, and grader-configuration provenance work expanded into runtime artifact plumbing. A manifest-resolution task was a counterexample: the candidate used fewer steps, tighter scope, and better craft when the correct boundary was obvious.

## Where we landed

Our trusted pattern for self-improving agents is a bounded loop:

1. Write a hypothesis.
2. Test it on real work.
3. Inspect failures.
4. Revise the rule.
5. Run a clean holdout.
6. Validate the claim before shipping.

The most useful candidate told agents to keep named obligations, ownership, and validation visible before editing. The next refinement should require agents to prove that broader documentation, new contracts, or adjacent-flow changes are required by the task before making them.

This resembles a production rollout: a change can pass CI and end-to-end tests while still causing downstream regressions. On a shared codebase, the engineer who commits an `AGENTS.md` change may see improvement while other task types quietly worsen.

## Takeaway

For a shared `AGENTS.md`, `CLAUDE.md`, or internal skill, ask:

1. What behavior should this rule change?
2. Which real tasks should expose that behavior?
3. Does it improve behavior or only intuition?
4. What did it make worse?
5. Did the holdout agree?

We are building [Stet.sh](https://www.stet.sh/private), a local evaluation tool that lets coding agents improve their own setup—`AGENTS.md`, skills, harness configuration, and reasoning settings—while measuring candidate changes against historical repository tasks. Stet runs locally using your LLM subscriptions; paid pilots and CI setup are also available.

## Experiment details

Eight candidate runs used an n=5 sample set, followed by a clean n=10 holdout. The model was Codex `gpt-5.5` with medium reasoning; `gpt-5.4` graded the results. Each candidate was compared with the baseline.

[Run Stet](https://www.stet.sh/private) · [Methodology](https://www.stet.sh/methodology)

---

[Read this page’s summary](https://www.stet.sh/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.stet.sh%2Fblog%2Fhow-i-used-codex-to-improve-its-own-agents-md&trace=t_5da45423e484)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Stet’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.stet.sh/agents/agent/faq?q={question}&trace=t_5da45423e484`

[Tool guide and examples](https://www.stet.sh/agents/agent-access) · [OpenAPI](https://www.stet.sh/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.stet.sh/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.stet.sh%2Fblog%2Fhow-i-used-codex-to-improve-its-own-agents-md). Opening a form does not execute a tool.