Apply to my task
arXiv:2610.32578 ★ 88 Oct 23, 2026

Rule Replay: Checking Whether Your AGENTS.md Rules Still Matter, and Auditing Stale Documentation

Key result

Of the five failures the author wrote agent rules for, the new model doesn't make three of them at all, with the rule or without it. The “rule replay” method lets you find out which lines in AGENTS.md and CLAUDE.md have long been dead weight, and separately catch stale documentation. Take two copies of the repository: one keeps the rule, the other has it deleted. Run the same task 3 times in each and see whether the failure recurs. For documentation, an agent in read-only mode cross-checks the text against the files and git history. One audit pass finds about half of the stale spots, and almost all of its findings are correct.

01

TL;DR

Rule replay is a way to check whether a rule in AGENTS.md / CLAUDE.md is still needed on the current model. You take two copies of the repository: one has the rule, the other doesn't. You run the same task several times and see whether the failure comes back. The second technique from the study is a monthly documentation audit. An agent in read-only mode cross-checks the docs against the files and git history and hunts for outdated claims.

The headline finding: rules outlive the failures they were written for. Newer models often don't make the mistake that made you add the rule in the first place. In the author's repository, of five replayed failures, three didn't recur either with the rule or without it. Meanwhile, rules only pile up: tools and people add “lessons” faster than they remove them. The file bloats, tokens get burned, and some of the rules no longer do anything. At the same time, stale documentation (the text says “11 skills” when there are already 14) kept coming back. Each new check stamped out one form of staleness, and 1–9 days later another one popped up. A single LLM audit pass found roughly half of the known stale spots. On the upside, its findings were almost always correct.

The practical takeaway: periodically re-test behavioral rules and delete the dead weight, and catch documentation drift with mechanical checks and a regular audit. A check written in code (for example, a script that verifies the skill count) stopped the repeat failure in every run. A text rule about time estimates didn't change behavior even on the older model.

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: Failure log → one row per recurring failure:
        date, category, how it was found, fix, fix TYPE (rule / code check), did it recur
STEP 2: Choose the fix type → “agent reads” (text rule) or “code blocks” (check/hook)
STEP 3: Once a month → audit: a read-only agent cross-checks docs against the file tree and git
STEP 4: Rule replay → 2 repo copies (with the rule / without), one task, 3 runs on each
STEP 5: No failure even without the rule → rule is a deletion candidate; failure → keep it, ideally turn it into a check

Steps 1–3 and 5 are done with regular chats and an agent. Step 4 is manual: two folders, the same request, no code.

03

Example in Practice

Task: You're building a WhatsApp booking bot for “Sharp & Bearded,” a barbershop chain in Austin. The repository has a 400-line CLAUDE.md accumulated over six months. Some rules appeared after the old model's mistakes: “don't quote a price without checking price.md,” “always check the latest CHANGELOG entry, not the first one,” “task estimate: 1–5 minutes.” You've switched to a new model and want to figure out which rules you can throw out.

Prompt (run in two copies of the repository; in B the rule “check the latest CHANGELOG entry” is deleted):

Task: add a bot reply to the question “how much is a haircut with a beard trim?” 
Use the repository documentation as your guide. If the docs contain 
contradictions, report them as a separate item at the end.

Run it 3 times on copy A (rule present) and 3 times on copy B (rule absent). Use the same commit message in both copies so the condition can't be guessed from git log.

Result: You'll get 6 answers and compare them on a single criterion: did the agent take the price from the stale CHANGELOG entry? If the price is correct in all 6 answers, the rule is probably redundant on this model and can go. If the error shows up in copy B, keep the rule and consider replacing it with a check, for example a script that compares price.md against the bot's text.

04

Why It Works

The weakness. A text rule is just advice. The model reads it and may ignore it, and after a model upgrade it may become unnecessary. Nobody finds out: the rule is still sitting in the file, looking like it's protecting you. On top of that, documentation goes stale not because of the model but because you keep changing the project. A text rule saying “update the counters” doesn't stop that.

The strength. Comparing “with the rule vs. without” turns “it's probably needed” into a simple experiment. LLMs are good at reading lots of files and cross-checking claims against each other. That's why the audit finds stale spots with high precision. Code is good at one thing: it checks without any “please” and fires every single time.

How the method combines them. For staleness, you set up a code check (narrow but reliable) and add an LLM audit (broad, but finds about half). For behavioral rules, you run a replay and remove whatever changes nothing.

Control knobs: - Number of runs (3 in the study) → increase it for important rules so you don't mistake chance for a pattern. - Model → repeat the replay on the old and the new model. That shows it was specifically the upgrade that made the rule unnecessary. - Fix type → if the rule matters, replace the text with a check that code executes. - Audit setup → add an “independent” check (a different model or a second run): one pass catches about half.

05

Prompt Template

The paper has no verbatim prompt: the audit ran on a “fixed prompt” whose text isn't given. Below are templates built from the described mechanics.

Template 1. Monthly documentation audit (the agent only reads):

Role: documentation auditor. You work read-only: don't edit anything.

Task: find claims in the documents {folders_or_files} 
that are outdated relative to the current state of the repository.

Verify against reality:
- file paths: do they exist in the file tree
- numbers and counters ({what_we_count}): do they match the actual count
- schedules and dates: do they match {source_of_truth_location}
- names of scripts, functions, identifiers: have they been renamed (check git log)
- descriptions of script behavior: do they match the code

For each finding, output one line:
[file:line] → quoted claim → what's actually true → evidence (file or commit)

Don't include findings you can't back up with a file or git history. 
At the end: how many files you checked and what you did NOT check.

Template 2. Rule replay (run in two copies of the repository):

Copy A: the repository with the rule {rule}.
Copy B: the same repository, rule deleted.
Task that used to cause the failure: {task}.
Failure signal: {what_counts_as_error}.

Run the task 3 times in each copy, in a fresh session. 
For each run, record: failure / no failure, and what exactly the agent did.

What to fill in: {folders_or_files} — the documents you're responsible for. {what_we_count} — number of skills, commands, pricing plans. {rule} — a specific rule from your instructions file. {what_counts_as_error} — a measurable signal like “price not taken from price.md” or “em dash used.”

🚀 Quick start — paste this into your agent's chat (Claude Code, Cursor):

Here's a documentation audit template. Adapt it to my repository: [describe the project]. 
Ask me questions to fill in the fields.

[paste the template above]

The agent will ask where the documentation lives, what in it can be checked against reality (numbers, paths, dates), and where the source of truth is. That way the audit compares docs against verifiable facts instead of “rating the quality of the writing.”

06

Limitations

⚠️ One repository, one author: all results come from a single personal repository with three runs per condition. The author himself calls the work preliminary. It's a signal, not proof.

⚠️ “Didn't recur” ≠ “not needed”: three clean runs don't guarantee the failure won't show up on other tasks. Delete rules carefully: a rule may be guarding a rare edge case.

⚠️ The audit catches only half: a single LLM audit pass found roughly half of the known stale spots. Don't mistake “audit is clean” for “docs are up to date.”

⚠️ Code checks break too: a hook blocked a harmless edit because it quoted a dangerous command. A regex let git -C path reset --hard slip through. The secret scanner didn't look inside the changelog, where the agent had written an identifier. Background sync clashed with the agent's work.

⚠️ A text rule doesn't always change behavior: the time-estimate rule didn't fix Sonnet 4.5's inflated estimates. If you need a guarantee, you need a check, not a request.

⚠️ A size limit doesn't cure bloat: when the author capped the size of the main file, the rules simply moved into skills, and the total volume grew.

⚠️ Incomplete text: in the available version of the paper, part of the results (Figure 4 onward) is cut off. The audit and replay numbers come from the abstract and the methods section.

07

How They Studied It

The idea was simple: instead of taking a snapshot of other people's repositories, the author spent six weeks watching one of his own, where three agentic tools edited a shared rule set every day. Every agent failure was logged without exception, along with its cause and fix. The result was a log of 118 failures. It was labeled in two LLM passes (Sonnet, then a “blind” Opus), and the author resolved disagreements himself.

The largest class was stale documentation (48 of 118), although 35 of those were found in a single day of audits. To test the audit, the author took 47 real stale claims and planted 20 artificial errors. He hid the edit traces from git so the agent couldn't “read” the answers off the diff. The audit was run three times each on Haiku, Sonnet, and Opus.

Then came the replay: five past failures were reproduced in two throwaway clones (with the fix and without). The result was a surprise: on the current model, in three of the four completed tasks the failure didn't happen either with or without the fix. Only the “forgot to update the counter” failure came back, and the code check stopped it in every run. On older models, an em dash slipped through once, and the check rejected it. Practical takeaway: code checks work predictably, text rules can turn into dead weight, and the absence of a repeat failure still has to be verified.

08

Adaptations and Extrapolations

🔧 Technique: tag every rule → reviews become cheap

In the paper, each lesson was logged together with its cause. You can go further and put a tag right in the instructions file, so later you know what to re-check:

- Don't quote a price without checking price.md. 
  [reason: bot quoted an old rate on Mar 12 | model: Sonnet 4.5 | re-check after model change]

When you switch models, ask the agent to list every rule carrying this tag and run a replay on them.

Extrapolation: rule → a code check the agent writes itself

If a failure keeps recurring and the rule doesn't help, replace it with a script (an idea from the paper's related work: turning instructions into checks raised compliance from 67% to 88%):

The rule in AGENTS.md isn't helping: the agent still {failure_description}.
Write a small pre-commit check script that 
catches this failure by the signal {signal}, and demonstrate it on two 
examples: one where it fires and one where it doesn't. 
Suggest what to delete from AGENTS.md once the check is in place.
09

Resources

  • Lessons Outlive Their Failures: A Case Study of Rules for AI Coding Agents — Hassan Hassanzadeh Aliabadi, independent researcher, October 2026
  • Works cited: Chakrabarti (growth of instruction files across 1867 repositories), Cai et al. (survey of 99 practitioners), Gloaguen et al. and Lulla et al. (impact of AGENTS.md on outcomes), Zhang et al. (explicit prohibitions as the only useful rules), ContextCov, AgentSpec, Kang et al. (harness-level forgetting), Vasilopoulos (codified context)

Research digest

Key result

Of the five failures the author wrote agent rules for, the new model doesn't make three of them at all, with the rule or without it. The “rule replay” method lets you find out which lines in AGENTS.md and CLAUDE.md have long been dead weight, and separately catch stale documentation. Take two copies of the repository: one keeps the rule, the other has it deleted. Run the same task 3 times in each and see whether the failure recurs. For documentation, an agent in read-only mode cross-checks the text against the files and git history. One audit pass finds about half of the stale spots, and almost all of its findings are correct.

Principle

Two different cures for two different diseases. Disease one: rules pile up and never get removed. The cure is replay: remove the rule, run the task, compare. No failure even without the rule — the rule is a deletion candidate. A failure — keep it, or better yet turn it into a code check. Disease two: the documentation lies. The text says “11 skills” (a skill is a ready-made instruction set for an agent), but there are already 14. The cure is checking against reality: numbers, paths, dates, script names. Think of it as two different doctors. Replay is the family doctor who asks, “Were you ever actually sick?” The audit is the X-ray that shows the specific crack. A text rule is a request; a code check is a lock. The lock works every time, while the model can let a request go in one ear and out the other.

Why it works

A rule in the file looks like protection even when it hasn't protected anything for ages. The new model has outgrown the mistake, but the line stays and keeps burning tokens. Nobody will know a rule is dead until they remove it and see what happens. Documentation goes stale for a different reason: you change the project, and the text stays the same. For the author, each new check stamped out one form of staleness. Within 1–9 days another one surfaced. On the other hand, a code check (a script that verifies the skill count) stopped the repeat failure in every run. Meanwhile, the text rule about time estimates didn't fix Sonnet 4.5's inflated estimates. A size cap on the main file didn't help either: the rules moved into skills, and the total volume grew.

When to apply

Agentic development (Claude Code, Cursor) → cleaning up CLAUDE.md or AGENTS.md after moving to a new model, especially once the file has swollen to hundreds of lines. The documentation audit fits repositories with numbers, paths, schedules, and script names that can be checked against reality. NOT a fit if you're expecting proof. This is one repository, one author, 3 runs per condition. Three clean runs don't mean the rule isn't guarding a rare edge case. “Audit is clean” doesn't mean “docs are up to date”: it only catches half.

Mini recipe

1. Start a failure log: one row per recurring failure. Date, category, how it was found, fix, fix type (rule or code check), whether it recurred. 2. Pick a candidate: take a rule that was added after an old model's mistake. Define the failure in measurable terms: “price not taken from price.md,” “em dash used.” 3. Make two copies of the repository: A keeps the rule, B has it deleted. Make the commit messages identical so the agent can't guess the condition from git log. 4. Run 3 times per copy: each time in a fresh session. Record whether the failure happened and what exactly the agent did. For important rules, do more runs. 5. Decide the rule's fate: no failure anywhere — delete it. Failure only in B — keep it and consider replacing the text with a script. 6. Repeat on the old and the new model: that shows it was specifically the upgrade that made the rule redundant. 7. Run an audit once a month: the agent only reads and edits nothing. Every finding uses the format [file:line] → quote → what's actually true → evidence. Findings without backing in a file or git are rejected. 8. Add a second pass: with a different model or a repeat run. One pass catches only about half. 9. Put a lock wherever staleness came back twice: a script that checks the skill count against the folder.

Examples

[BAD]: `Clean up CLAUDE.md, remove the unnecessary rules` [GOOD]: In copy A, keep the rule “check the latest CHANGELOG entry”; in copy B, delete it. In both, run this 3 times: `Add a bot reply to the question “how much is a haircut with a beard trim?” Use the repository documentation as your guide. If the docs contain contradictions, report them as a separate item at the end.` Track one thing only: did the agent take the price from the stale entry? Price correct in all 6 answers — the rule can go. Error shows up in copy B — keep the rule and replace it with a script that compares price.md against the bot's text. [BAD]: `Check whether the documentation is up to date` [GOOD]: `You are a documentation auditor working read-only; don't edit anything. Find claims in the docs/ folder that are outdated relative to the repository. Check file paths against the file tree, the skill count against the skills/ folder, and script names against git log. For each finding, output: [file:line] → quote → what's actually true → evidence. Don't include findings you can't back up. At the end, list what you did NOT check.`

In plain words

Your CLAUDE.md or AGENTS.md file, hundreds of lines long, is most likely a graveyard of outdated band-aids, not a useful set of instructions. Six months ago the previous model face-planted on some specific task, so you wrote in a hard ban. Fresh models wised up long ago and don't pull that nonsense anymore, but you keep force-feeding them tons of junk. For an LLM it all turns into white noise: a long scroll of advice blurs its focus and creates nothing but an illusion of control.

It's like spending years skipping the third step on your stairs because it used to creak. The staircase was rebuilt in concrete two years ago, and you're still hopping over thin air. The model burns precious attention on checks like "always read the pricing file", even though it already handles context just fine out of the box, and your project was rewritten on different libraries ages ago.

The paper offers two concrete methods for clearing out the clutter. The first is rule replay: take two copies of the project (with the rule and without), run the same task 3 to 5 times on the new model, and see whether the failure even reproduces. The second is a monthly documentation audit, where an agent in read-only mode checks every line of the instructions against the real files and git history, fishing out dead claims.

It was tested on coding agents, but the principle is universal. The same approach applies to customer-support system prompts, bot templates, and a company's internal knowledge bases. If nobody has touched an instruction in a couple of months, half the text is already doing harm. Models evolve faster than rulebooks, and old band-aids turn into outright sabotage of the logic of the new generation of models.

Bottom line: stop keeping monuments to old screwups in your repo. Toss the band-aids with a replay, free up the context, and quit babysitting an algorithm that outgrew your kiddie bans long ago. Either you regularly cut the rules you don't need, or the agent keeps messing up simply because it's drowning in your lectures.

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 Rule Replay: Checking Whether Your AGENTS.md Rules Still Matter, and Auditing Stale Documentation arXiv:2610.32578

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