Apply to my task
arXiv:2610.11007 ★ 85 Oct 7, 2026

Curating AGENTS.md: an agent's instruction file needs a size ceiling, not just endless appending

Key result

The rule the agent skips most often is often the most important one. If you clean the file on the principle of "the agent doesn't follow this", it'll be the first to go. The method lets you trim a bloated CLAUDE.md or AGENTS.md down to 20–60 lines without throwing out what you need. The trick: score a rule by its value, not by whether it gets followed. Value = how often the rule is needed × benefit or harm when followed − cost in tokens and attention. The session log only shows followed or not. It doesn't show whether a rule helps or hurts. That's why harmful and outdated rules hit the chopping block first, while harmless "easy" ones stay.

01

TL;DR

The study treats a file like AGENTS.md or CLAUDE.md as limited shelf space. Every line costs tokens in every session. Every new line also steals attention from the others: the agent gets worse at following all the rules at once. So the file has a ceiling on useful size. It doesn't depend on how many ideas and notes you've piled up. Hence the rules: don't append everything, score rules by value, and stick to a limit.

The core pain: the file only grows. After every session the agent or a human adds "so this never happens again", and nobody cleans up. Six months later the file has 300 lines. The agent ignores some rules, and others get in the way (for example, "always use conda" in a repo that runs on uv). The authors showed with a model and an experiment that adding everything that is individually useful can be arbitrarily worse than picking the best subset. On top of that, deleting rules the agent ignores is dangerous. Transcripts show whether a rule was followed or not. They don't tell you whether it's helpful or harmful. An important rule the agent often skips gets deleted first. A harmless, easy-to-follow rule stays.

The practical curation method: candidates accumulate separately from the file, only rules confirmed by repeated cases get into the file, and each rule is scored by value (benefit minus the cost in tokens and attention). The file size is capped, and edits are made in small batches.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

STEP 1: New notes → into a separate candidate list, NOT into the file
STEP 2: Admission to the file → only after repeated independent cases (in theory the optimum is two)
STEP 3: Score each rule → how often it's needed × benefit/harm if followed − cost in tokens
STEP 4: Removal → by value, not by "the agent ignores it"; harmful rules go first
STEP 5: Size ceiling + small batches of edits → test on real tasks

Steps 1–4 can be done in a single chat: upload the file and transcripts, get a table of verdicts. Step 5 is your manual control.

03

Example in Practice

Task: A developer maintains the Python backend of an online store with payments through Stripe. For six months, after every Claude Code session, they appended notes to CLAUDE.md. Now the file has 280 lines. Among them: "always run pytest", "write NumPy-style docstrings", "use conda" (the project moved to uv long ago), "don't commit to main", "don't use the phrase "Dear valued customer" in customer emails" and dozens more style nitpicks. The agent keeps forgetting about pytest and "don't commit to main".

Prompt:

You are the editor of an instruction file for a coding agent. Below is my project's CLAUDE.md (a Python backend for an online store, payments through Stripe, environment: uv) and three transcript excerpts where the agent made mistakes.

<file>
[paste the 280 lines of CLAUDE.md]
</file>

<failures>
[paste 3 cases: what the agent did wrong]
</failures>

For EACH rule, fill in a table row:
rule | approximate tokens | how often it's relevant (often / rarely / almost never) | what happens if the agent follows it (benefit / neutral / harm) | verdict (keep / delete / merge with another / move out of the always-loaded file)

Editing rules:
1. Don't propose deleting a rule ONLY because the agent ignores it. First assess what breaking it costs.
2. Rules that cause harm when followed (outdated, contradicting the project) get deleted first.
3. Target size: no more than 60 lines. If there are more important rules, name which ones pushed out the rest and why.
4. Don't add new rules. If the failures reveal a gap, put it in a separate "candidates" list and note how many times the gap showed up.
5. At the end, give the final file and a list of 5 test tasks I can use to compare the old and new versions.

Result: The model will produce a table of verdicts for each rule and flag the harmful ones, such as the outdated "use conda". Next comes a compressed file within the limit and a separate candidate list with repeat counts. At the end you get the test tasks. The model can't decide for you what really matters in your project. Skim the table yourself.

04

Why It Works

The weakness. The model has limited "attention": the more rules in the prompt, the worse each one gets followed. The file's tokens are paid for in every session. That's why the rule "add every note that seems reasonable on its own to the file" breaks down. While the file is small, you don't see it. When there are many rules, some crowd out others.

The strength. The model is good at classifying and comparing: "needed often or rarely", "harmful or not", "does it duplicate another rule". The prompt above leans on exactly that. It forces rules to be scored by value, not by whether they get followed.

The workaround. The session log only shows what was loaded: whether a rule was followed and whether it caused harm. What was missing only shows up once the absence of a rule has already caused a failure. That's why you need to separate "the agent ignores it" from "the rule is useless", and only adopt new rules after repeated cases.

Control knobs: - Line limit → the lower the limit, the tougher the selection. For a small project, 20–60 lines is plenty. - Admission threshold → the number of repeated cases before a rule gets added. Under their assumptions, the authors got minimal losses with two observations. For critical rules (security, money) you can use one. - Verdict criterion → add "cost of an error" so rare but expensive rules don't get crowded out by frequent trivia. - Edit batches → change 5–10 rules at a time and test. That way you can see which edit helped.

05

Prompt Template

This is my own assembly based on the paper's principles. The paper has no ready-made prompt.

You are the editor of an instruction file for an agent ({agent_name}). Below are the file and examples of failures.

<file>
{file_contents}
</file>

<failures>
{failure_cases_from_transcripts}
</failures>

Project context: {project_and_environment_description}

For EACH rule, fill in a table row:
rule | tokens | relevance (often / rarely / almost never) | effect when followed (benefit / neutral / harm) | verdict (keep / delete / merge / move out)

Editing rules:
1. Don't delete a rule just because the agent ignores it. First assess the cost of breaking it.
2. Delete harmful and outdated rules first.
3. Target size: no more than {line_limit} lines. If it doesn't fit, explain what got pushed out and why.
4. Don't add new rules. Put gaps revealed by failures into a "candidates" list with repeat counts.
5. A rule is admitted to the file only if the problem showed up at least {repeat_threshold} times.
6. At the end, give the final file and {number} test tasks for comparing the old and new versions.

Fill in: the whole file, 3–10 failure cases from real transcripts, a short project description, the line limit and the repeat threshold (2 by default).

06

Limitations

⚠️ The experiment is far from real files: The optimum and the quality drop were measured on pools of 200 to 3,200 instructions. Real AGENTS.md files have dozens of lines. For small files, the authors themselves cite studies where no drop in rule compliance is seen.

⚠️ Artificial instructions: The rules were taken from real files, but a model rewrote them into checkable rules about words in the answer. The tasks are texts in various formats, not a coding agent working in a repository.

⚠️ Narrow testing: Only 60 tasks and two models from the same family. Don't carry the specific optimum numbers over to your own case.

⚠️ The theory rests on assumptions: The main assumption is that each added instruction doesn't increase compliance with the others. The "two repeats before adding" number holds within the model and wasn't tested on live agents.

⚠️ Some conclusions require engineering: The algorithm of trial-and-error over batches of rules and value scoring assumes code and manual review. By hand you can apply the principles, but not the full algorithm.

⚠️ Effect size in the realistic range isn't shown: The multi-fold drop was observed when the entire pool of thousands of instructions was loaded.

07

How They Studied It

The researchers first framed the instruction file as an assortment-selection problem: each rule has a cost in tokens, a chance of being needed and a benefit when followed (sometimes negative). The model's attention is shared and gets "diluted" as the file grows. From this they mathematically derived that the useful file size is bounded and doesn't grow along with the number of accumulated ideas. They also showed that "adding everything that's useful on its own" can be arbitrarily worse than the optimum. Separately, they analyzed what can be learned from logs: you can see rule compliance and harm, but not the size of the benefit. So deletion based on non-compliance can't tell the valuable from the useless.

For testing, they assembled a pool of 3,200 rules from real repository files. Claude Sonnet rewrote 2,560 of them into automatically checkable rules about words in the answer. The remaining 640 were left as is and contributed nothing to the scoring. The pool and files were scaled up in steps (files from 5 rules to the whole pool), on 60 ManyIFEval tasks in six formats. Rules went into the system prompt, the task into the user prompt, for 2,880 runs each for Claude Haiku 4.5 and Sonnet.

The result: with a pool of 3,200, both models worked best with a file of 200 rules. Haiku followed about 5 relevant rules, Sonnet about 24. When the whole pool was loaded, these numbers fell to 0.6 and 4.0. Surprisingly, as the pool grew, the best file size stayed small. The practical takeaway: a growing list of ideas doesn't justify a growing file.

08

Adaptations and Extrapolations

Below are my own ideas, not from the paper.

🔧 Technique: a rule for an agent that writes its own memory → admission by repetition

If your agent appends lessons to a memory file, add this to its instructions:

Write new end-of-session notes to candidates.md, not to AGENTS.md. 
For each one, note how many different sessions the problem showed up in.
Move a note into AGENTS.md only when it has come up at least twice in different sessions 
and you can name exactly what will break without it.
When moving it, name an existing rule that can be deleted so the file doesn't grow.

This follows directly from the findings about two signals and the size limit. The "delete one when adding one" part is my own addition.

Extrapolation: test before deleting. Before removing an "ignored" rule, run 3–5 tasks where it matters, with and without it. If the agent starts making mistakes without it, the rule needs to be strengthened or moved higher, not deleted.

09

Resources

  • Curating Always-Loaded Context for LLM Agents: A Capacitated Assortment Model with Censored Feedback — Zexuan Liu (University of Illinois at Urbana-Champaign), Yuning Yang (Georgia Institute of Technology), Tiancheng Zhao (Saint Louis University)
  • ManyIFEval (Harada et al., 2025) — tasks with many instructions
  • Gloaguen et al. (2026) — context files and rising request costs
  • Chakrabarti (2026) — file growth across 1,867 repositories
  • McMillan (2026), Zhang et al. (2026a) — studies showing no compliance drop in small ranges

Research digest

Key result

The rule the agent skips most often is often the most important one. If you clean the file on the principle of "the agent doesn't follow this", it'll be the first to go. The method lets you trim a bloated CLAUDE.md or AGENTS.md down to 20–60 lines without throwing out what you need. The trick: score a rule by its value, not by whether it gets followed. Value = how often the rule is needed × benefit or harm when followed − cost in tokens and attention. The session log only shows followed or not. It doesn't show whether a rule helps or hurts. That's why harmful and outdated rules hit the chopping block first, while harmless "easy" ones stay.

Principle

A rules file is limited shelf space, not a trash can. Every line pays in tokens in every session. Every line also distracts the agent from the other rules. The process: 1. A new note goes into a separate candidate list, not into the file. 2. It gets into the file after repeated independent cases. In the authors' theory, the optimum is two. 3. Every rule gets a value score. Harmful ones are deleted first. 4. The file size has a ceiling. Edits go in batches of 5–10. A rules file is like a desk: the more papers on it, the harder it is to see what matters. Appending "so this never happens again" after every session is the fastest route to a desk buried in clutter.

Why it works

The model has limited attention. The more rules in the prompt, the worse each one is followed. While the file is small, you don't see it. When there are hundreds of rules, some crowd out others. The authors modeled this on pools of 200 to 3,200 instructions. When the whole pool of thousands of instructions was loaded, rule compliance dropped several-fold. Another trap: the log only shows what was loaded. What was missing only shows up after a failure. An ignored rule can be important, and a followed one can be useless or harmful. The outdated "always use conda" in a uv project is exactly the kind the agent does follow, and that hurts. The model is good at classifying and comparing. It can easily say how often a rule is needed, whether it causes harm and whether it duplicates another. The prompt relies on exactly that. Being honest about the limits. The experiment used artificial rules about words in the answer, with 60 tasks and two models from the same family. Real files have dozens of lines, and the authors didn't show a drop there. The "two repeats" figure has only been checked within the theory.

When to apply

Always-loaded instruction files for coding agents (AGENTS.md, CLAUDE.md) → cleanup after months of appending, especially when the agent has started forgetting basics like tests or the ban on committing to main. Also a good fit for projects where the environment changed but the old rules stayed. NOT a fit for a 20-line file where everything already works. There's nothing to clean, and the authors have no evidence of benefit there. Also: the model won't decide for you what matters in your project. Skim the verdict table yourself.

Mini recipe

1. Set up a dump for candidates: a separate file. Every new "so this never happens again" goes there, not into the main file. 2. Gather evidence: 3–10 cases where the agent made a mistake. Take excerpts from session logs. 3. Call in an editor model: give it the file, the cases and a project description. Ask for a table: rule, tokens, how often it's needed, effect when followed, verdict. 4. Block the easy way out: write explicitly "don't delete a rule just because the agent ignores it". Otherwise the model will take the obvious route. 5. Set a ceiling: 60 lines or fewer. Have it explain what got pushed out and why. 6. Watch the dial: for security and money, the admission threshold can drop to one case. Add "cost of an error" to the criteria so a rare but expensive rule doesn't get kicked out. 7. Check by hand: give it 5 test tasks, compare the old and new versions. Change things in batches of 5–10 rules so you can see what helped.

Examples

[BAD]: `Here's my 280-line CLAUDE.md. Shorten it, remove whatever the agent doesn't follow anyway.` [GOOD]: `You are the editor of an instruction file for a coding agent. Below is CLAUDE.md (a Python backend for an online store, payments through Stripe, environment: uv) and three failure cases. For EACH rule, fill in a row: rule | tokens | how often it's relevant (often / rarely / almost never) | effect when followed (benefit / neutral / harm) | verdict (keep / delete / merge / move out). Don't delete a rule just because the agent ignores it. First assess the cost of breaking it. Delete harmful and outdated rules first. Target size: no more than 60 lines. Don't add new rules; put gaps into a candidate list with repeat counts. At the end, give the final file and 5 test tasks.` What you'll get: "use conda" in a uv project gets the verdict "harm, delete". The agent often skips "don't commit to main" and "run pytest", but breaking them is expensive, so they stay. The rule about the phrase "Dear valued customer" in emails goes to the candidates or gets moved out of the always-loaded file.

In plain words

Most people think config files like CLAUDE.md or AGENTS.md are a bottomless dumpster for fixes. But language models have a hard attention limit: every extra token in the always-loaded context doesn't just burn money on every request, it blurs the focus. The longer the wall of rules, the worse the agent follows each one. There comes a tipping point where yet another small line doesn't help the agent, it just switches off critical instructions.

It's like a micromanaging boss who fires off a hundred tiny orders in five minutes. At first you keep up, but by the two-hundredth note about comment formatting, the most important thing flies right out of your head: never push to main. On paper, everything is documented, but in practice the person doing the work has mush for brains and skips basic pytest.

The rescue is a mathematical approach: the limited-assortment model (Capacitated Assortment Model). Treat the file like a store shelf with a pay-to-enter policy. Toss stale stuff like old conda if the project moved to uv long ago. Keep only the top 10 critical rules by value: a ban on breaking the production database beats a ban on the phrase "Dear valued customer". Set a hard file-size limit and hold it at any cost.

The research looked at coding files, but the principle is universal. It works for any system prompts, support bots and company knowledge bases. The moment you stuff the always-loaded context with procedures for every rare situation in life, the model starts screwing up even on basic tasks. Wherever there's an always-loaded context, an iron law applies: fewer instructions, better execution.

Bottom line: stop using instructions as a dumping ground for your momentary grudges against the AI. Every new rule should push out an old one, or the context turns into useless noise. Ruthlessly clean out whatever's no longer relevant and keep a 50–70 line limit. Cut half the junk right now, and your agent will suddenly get smarter out of nowhere.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on Curating AGENTS.md: an agent's instruction file needs a size ceiling, not just endless appending arXiv:2610.11007

Sign in to apply this study New accounts get 50 free credits.