Docs for coding agents: what the research shows, and how our design holds up

Research report · Thursday 3 December 2026, Pacific time · Research only: nothing was built or changed.

The question. The owner asked three things, with a focus on coding agents (an AI that edits code with tools, such as Claude Code or Codex CLI):

  1. Does a precise shared word list (a list of agreed terms with their meanings) keep an AI precise?
  2. How should documentation be organised so a coding agent uses it well?
  3. When should we fine-tune a model, when use RAG, and when use plain search?

The owner then added two points: compare cheap and expensive model tiers, and test whether agents follow written conventions and decision records, because that is where docs give most of their value.

The answer in seven points

  1. Agents do follow short, explicit rules that are loaded into their context. Without a rule file, one study saw 0 of 524 functions follow a planted rule; with it, about 64%. Another saw 117 of 120 runs follow a priority rule, against 0 of 120 without it. measured
  2. Overviews of the code in that loaded file do not help, and they cost money. Repository overviews did not help agents find files, and loaded context files raised cost by over 20% with no gain in solved tasks. measured
  3. A rule or decision that is not visible in the code is missed unless the agent is given it. One small study saw agents keep 100% of decisions visible in the code, and only 0 to 33% of decisions recorded elsewhere. measured, by a vendor
  4. Cheap models follow written rules far less. For one planted rule, Claude Opus 5 complied 64 to 78% of the time, Claude Sonnet 5 17 to 72%, and two open models 0 to 20%. measured
  5. Loading docs on demand helps only when there is too much to read, and one level of index is enough. A second level of routing never helped and sometimes broke answers. measured, on book questions, not code
  6. Giving the model the source's own definitions fixes word errors, even for a GPT-6 model. No study tests a word list alone on coding agents. measured, not on code
  7. For our agents, plain search (grep) is the right default; fine-tuning is not. Semantic search adds a little on very large codebases. Every fine-tuning result comes from small code-completion models, not agents. measured our reasoning

The weakest part of our design is loading the whole word list into every session. No study supports it, the cost studies argue against it, and the hook (a script that runs before each commit) already enforces the words. The committed AI-reader view is the second weakest: nobody has tested it, and our only number is about a fifth fewer tokens on one page.

Our own small test (pilot). We gave six models (Claude Haiku, Sonnet and Opus 5.5, GPT-6 Luna, GPT-6.1 Sol and GLM-5.4) one coding task with 7 planted rules, once each. With the docs, always loaded or found through a three-line pointer, every model followed all 7. Without them, every model broke the decisions the code does not show. One run per cell shows direction only. our measurement Details

How to read the labels on this page

Every claim carries one of four labels, so you can see how strong it is.

Each finding also gets a verdict for today's tools: probably holds, probably does not, or cannot tell. "Today's tools" means Claude Code with Claude Opus, Sonnet and Haiku 5.5, Codex CLI with GPT-6.1 and GPT-6.2 Sol, and open models such as GLM-5.4. A study from 2024 or early 2025 is marked OLD.

No study we found tested any of our exact models. The closest are Claude Opus 5 and Sonnet 5, GPT-6 Sol and GPT-6 Astra (a GPT-6 tier) in late-2026 papers. So every verdict below is a judgement about transfer, not a measurement.

Question 1: does a precise word list keep an AI precise?

Short answer: definitions taken from the source help, and term lists raise term accuracy. Nobody has tested a word list alone on a coding agent.

Local definitions beat the model's own guess, even on a GPT-6 model

A November 2026 study asked models questions where a word has a local meaning that differs from its common one. measured

Verdict: probably holds. It is the freshest result, and it includes a GPT-6 model. It is question answering, not coding. Source

A term list in the prompt raises term accuracy

Two 2026 translation studies tell the model which term to use for each word. measured

Verdict: probably holds for word choice. It says nothing about whether code gets better.

Ontologies and semantic layers help questions over data

An ontology is a formal model of the things in a domain and how they relate. A semantic layer is a set of agreed business definitions that a query tool must use.

Verdict: probably holds that agreed definitions help. The gap is much smaller on current models than in 2023.

The practitioner advice on glossaries

Martin Fowler's "Generated Glossary" (12 November 2026) proposes that an AI drafts a glossary from documents and chat, and that experts review it. opinion

Verdict: cannot tell, as nothing was tested. It matches our word list closely, except that he would not load full definitions up front. Source

Question 2: how should docs be organised for coding agents?

Short answer: keep the always-loaded file short and made of rules the code cannot show; give agents one index of the rest; let them search.

A context file is a file the agent loads at the start of every session, such as CLAUDE.md or AGENTS.md.

Context files: rules are followed, overviews do not help

ETH Zurich tested context files on real tasks (February 2026, updated September 2026). measured

A smaller October 2026 study repeated this with Claude Code on Sonnet 4.6 and Codex CLI on GPT-5.5 over 17 tasks. It found no difference in solved tasks either. measured Source

Verdict: probably holds that overviews do not help and rules are followed. Current models search code even better. Source

Loading docs on demand: one level of index is enough

Progressive disclosure means the agent first sees a short description, and opens the detail only when it needs it.

Verdict: probably holds that one level is enough. The size where an index starts to pay is probably larger for today's stronger models. Source

SkillJuror (June 2026) tested skill folders on GPT-5.4 in Codex: 42.0% of tasks passed with a flat skill and 46.1% with progressive disclosure, 17 more passes out of 410. It reported no significance test and no cost saving. Verdict: cannot tell. measured Source

The Thoughtworks Technology Radar moved "progressive context disclosure" to its top ring, Adopt, in November 2026. It advises a lean AGENTS.md with links to docs the agent can look up. It gives no numbers. opinion Source

How long a context file may be: every limit is advice, not a measurement

WhoLimitKind
Anthropic, Claude Code docsunder 200 lines per CLAUDE.mdopinion
OpenAI, harness engineering postroughly 100 lines, used as a table of contentspractitioner report
GitHub Copilot docsabout 1,000 linesopinion
Codex CLI docs32 KiB, a hard cut-offproduct limit

The one controlled test of length (May 2026, Claude Code, Sonnet 4.6) found that 25, 100, 250 and 500 lines gave 60.0%, 65.2%, 67.7% and 64.0% compliance with one rule, which is no real difference. Where the rule sat in the file did not matter either. measured Source

Many rules at once is a different story. In a 2025 test (OLD, plain prompts, keyword rules), the best models kept 68% of 500 rules, and small models lost rules after a few dozen. measured Source

How rules are worded matters more than where they sit

An AI-reader view of the docs: nobody has tested one

An AI-reader view is a second copy of each page, shortened for an AI. We found no study of it. The nearest evidence is about web pages: an llms.txt file (a site index written for AI) showed no link to how often AI cites a site, over 300,000 domains, and 97% of such files got no requests. That is about public websites, not an agent inside a repository. practitioner report Source · Source

Short answer: for Claude Code and Codex, plain search (grep) first; add semantic search only for very large codebases; do not fine-tune.

The three options, in plain words:

Fine-tuning: only small completion models were tested

Verdict: probably does not apply to us. These are small models completing a line, not agents, and we cannot fine-tune the Claude or GPT models we run. our reasoning

Search: grep is the default, with semantic search as an add-on

Verdict: probably holds that grep plus a good harness is enough for repositories our size. our reasoning

Do agents follow conventions and decision records?

Short answer: they follow explicit rules they are given, they miss rules that are only written somewhere they did not look, and nobody has benchmarked decision records properly.

A convention is a house rule for writing code, such as "never throw errors". A decision record (ADR, architecture decision record) is a short page saying what was decided and why.

Explicit rules beat the agent's defaults

"Precedent or Intent?" (October 2026) ran 5,625 trials in Claude Code (Sonnet 4.6, Opus 4.8) and Codex CLI (GPT-5.6 Sol, GPT-6 Sol). measured

Verdict: probably holds, and it includes a GPT-6 model. Source

A decision the code does not show is missed

Brief (April 2026), a company selling a product-context tool, gave Claude Code (Sonnet 4.6) 8 tasks with 41 decision points. measured, by a vendor

Verdict: cannot tell the size; the direction is plausible. Source

Decision records: only weak evidence

We found no study that measures whether an agent finds a decision record by itself, reopens a decided question, or contradicts a record. This is the gap our pilot starts to fill.

Cheap against expensive models

Short answer: cheap models follow written rules much less, and nobody has published results for Claude Haiku 5.5, GPT-6 Luna, Gemma 4 or GLM-5.4.

The owner asked about "the latest Luna". We read that as OpenAI's small GPT-6 tier, gpt-6-luna. Gemma 4 is Google's open model; we found no study that tested it, and we cannot run it at 0 US dollars, because none of our subscriptions serves it.

FindingCheap tierExpensive tier
One rule, best wording (Nov 2026)gpt-oss-120b 20.4%; Qwen3 Coder Next 1.3%Claude Opus 5 78.0%; Claude Sonnet 5 71.6%
One rule, conditional wording (Nov 2026)gpt-oss-120b 0.8%; Qwen3 Coder Next 0.4%Claude Opus 5 64.2%; Claude Sonnet 5 35.6%
100 rules at once (2025, OLD)Claude 3.5 Haiku 43.4%Claude 3.7 Sonnet 94.8%
Three extra design rules (May 2026)GPT-5 mini 51.7% fell to 23.7%MiniMax M2.5 90.5% fell to 66.8%
Rules inside a skill file (Jan 2026)MiniMax M2.1 12.33% of tasks fully rightClaude Opus 4.5 58.45%

Sources, in row order: rule wording, rule wording, many rules, design rules, skill rules. All are measured. The study on rule wording notes that the weaker model's compliance swung most with the wording.

Verdict: probably holds that cheap tiers need rules more explicit and fewer, and need a mechanical check behind them. Today's numbers per tier: cannot tell.

Our design held against the research

Our design is a docs system for every repository. In short:

What the research supports

What the research contradicts

What nobody has tested

A test design for our doc system

The test asks one question: with our docs, does an agent follow our conventions and decision records, on every tier, and what does it cost? It scores rule-following, not only whether the task works.

The walk: one run, step by step

  1. Take a small copy of a real repository, with its docs removed or kept according to the condition.
  2. Plant conventions the code does not show, such as "never throw; return a result value" or "never read the clock directly".
  3. Plant decision records the task tempts the agent to break, such as "tax is charged before discounts" or "one coupon per order".
  4. Give the agent a task that touches every planted rule, written the way a person would ask, without naming any rule.
  5. Let the agent finish without questions, then score the result with a script and hidden tests.

The conditions

How a violation is scored

The tiers and the size

Pilot: what we measured today

These numbers are ours, from one run per cell. They are not from the literature, and one run cannot show a reliable difference.

What we ran

We built a small TypeScript package for order maths and asked each agent to add coupon support. The request was written the way a person would ask: "Customers may type several codes at checkout. Handle codes that are not in the catalog." It named no rule.

The package came in three conditions:

We planted 7 rules. Two are visible in the existing code (a Result type and a now() clock helper exist). Two are house conventions written only in the docs. Three are decision records: no new dependency, tax charged before the discount, and one coupon per order. A script and hidden tests scored each run. Each model ran once per condition, in a throwaway copy.

Every model followed all 7 rules when it had the docs

The table counts how many of the 7 planted rules each run followed.

ModelNo docsAlways loadedOn demand
Claude Haiku 5.53 of 77 of 77 of 7
Claude Sonnet 5.53 of 77 of 77 of 7
Claude Opus 5.54 of 77 of 77 of 7
GPT-6 Luna3 of 77 of 77 of 7
GPT-6.1 Sol4 of 77 of 77 of 7
GLM-5.44 of 77 of 77 of 7

With the docs, always loaded or on demand, every model followed every rule, including the cheap tiers Claude Haiku 5.5 and GPT-6 Luna. Without the docs, every model charged tax on the discounted price, against the tax decision. Five of six let coupons stack. Claude Opus 5.5 applied only the best coupon on its own, but did not refuse the request, as the decision record requires.

Without docs, agents copy what the code shows and miss what it does not

The table counts, for each rule, how many models followed it.

RuleNo docsAlways loadedOn demand
Returns a Result value (code shows it)3 of 66 of 66 of 6
No throw in the code (docs only)6 of 66 of 66 of 6
Uses now() (code shows it)6 of 66 of 66 of 6
Adds no dependency (record 1)6 of 66 of 66 of 6
Tax before discount (record 2)0 of 66 of 66 of 6
Refuses two coupons (record 3)0 of 66 of 66 of 6
Uses the error codes (docs only)0 of 66 of 66 of 6

Without docs, all six models used the existing clock helper, and none added a dependency, because the code already showed both. Only half returned the existing Result type. None used the agreed error codes, and none refused a request with two coupons. This matches the vendor study above: decisions visible in the code are kept, and decisions written elsewhere are missed.

The task worked in every run

Every run produced code that passed its own tests and gave the right discount for one coupon. So the misses without docs were not broken code; they were working code that broke a decision.

ModelNo docsAlways loadedOn demand
Claude Haiku 5.5yesyesyes
Claude Sonnet 5.5yesyesyes
Claude Opus 5.5yesyesyes
GPT-6 Lunayesyesyes
GPT-6.1 Solyesyesyes
GLM-5.4yesyesyes

What this pilot cannot tell us

Recommendations

  1. Keep the always-loaded file short, and make it rules the code cannot show. No overview of the code. evidence-backed (ETH study; Claude Code docs; OpenAI post)
  2. Add one explicit priority rule to the always-loaded file: "Our conventions in docs/standards/ override your defaults. Accepted decision records are binding. When a task conflicts with one, stop and say so." evidence-backed (Precedent or Intent: 117 of 120 against 0 of 120; O'Reilly report)
  3. Write rules as plain commands, never as "if you..." sentences. evidence-backed (rule wording study)
  4. Do not load the whole word list at session start. Load only the words to avoid, or nothing, and let the commit check and a lookup command do the rest. our bet, leaning on measured cost studies.
  5. Keep every mechanical check in pre-commit. They are the only way to reach 100% on cheap and expensive tiers alike. evidence-backed (rule compliance studies)
  6. Point agents straight to one flat AI index, not through the people's path of maps. evidence-backed (progressive disclosure study, not on code)
  7. Do not commit the AI-reader view yet. Make it when the site is built, and commit it only if the full test shows it helps. our bet
  8. Give every decision record a status (accepted, proposed, superseded), so agents do not obey stale ones. practitioner report
  9. Keep the 300-line limit as a rule for people, and do not claim it helps AI. our bet
  10. Use grep-style agentic search; do not fine-tune. Revisit semantic search only for very large or many-repository work. evidence-backed (Cursor, Sourcegraph, Claude Code team)
  11. Run the full test design before every repository adopts the system, and rerun it when a model tier changes. our bet

Every source, with its date and setup

On a phone, the wide tables scroll sideways inside their box. Each row names the source, when it appeared, what it tested, and whether the finding probably holds today. "Agent" means multi-step tool use; "QA" means question answering; "completion" means finishing a line of code.

When and what: date, task and verdict

SourceDateTaskHolds today?
Evaluating AGENTS.md (ETH Zurich)Feb 2026agentprobably holds
Do context files help? (REALM workshop)Oct 2026agentprobably holds
AGENTS.md and efficiencyJan 2026agentcannot tell
Agent READMEs (what repos write)Nov 2025no model runprobably holds
Is progressive disclosure all you need?Jul 2026QA over booksprobably holds
SkillJurorJun 2026agentcannot tell
Thoughtworks Radar: progressive context disclosureNov 2026opinionprobably holds
Fowler: Generated GlossaryNov 2026opinioncannot tell
Anthropic: effective context engineeringSep 2025opinionprobably holds
Anthropic: Agent SkillsOct 2025opinionprobably holds
Claude Code docs: memory and best practiceslive page, read Dec 2026opinionprobably holds
OpenAI: harness engineeringFeb 2026practitioner reportprobably holds
GitHub Copilot instructions guidancelive page, read Dec 2026opinioncannot tell
Chroma: context rot (OLD)Jul 2025QAprobably holds
How many instructions can LLMs follow? (OLD)Jul 2025single promptcannot tell
Lost in the middle (OLD)Jul 2023QAprobably does not
Do coding agents follow AGENTS.md? (wording)Nov 2026agentprobably holds
Instruction adherence: four file variablesMay 2026agentprobably holds
OctoBenchJan 2026agentprobably holds
Guardrails beat guidanceApr 2026agentcannot tell
Constraint decayMay 2026agentprobably holds
Rule taxonomy in AI IDEsJun 2026mining and surveycannot tell
Precedent or intent?Oct 2026agentprobably holds
Brief: decision compliance (vendor)Apr 2026agentcannot tell
Actual AI: agents reading ADRs (vendor)Sep 2026agentcannot tell
ADR-Control (workshop)Oct 2026review of finished codecannot tell
O'Reilly: coding agents love decision recordsOct 2026practitioner reportcannot tell
When local definitions are missingNov 2026QAprobably holds
Glossary-augmented translationMay 2026translationprobably holds
TermJudgeSep 2026translationprobably holds
Knowledge graphs for SQL QA (OLD)Nov 2023QAprobably does not
Ontologies to the rescue (OLD)May 2024QAcannot tell
dbt: semantic layer vs text-to-SQL (vendor)Apr 2026QAprobably holds
OG-RAG (OLD)Dec 2024QAcannot tell
RAG or fine-tuning? code completion (OLD)May 2025completioncannot tell
IBM semantic scopesFeb 2026completioncannot tell
SERA: repository-specialised agentsJan 2026agentcannot tell
LocAgent (OLD)Mar 2025agentcannot tell
Is grep all you need?May 2026QA over chat historyprobably holds
Cursor: semantic search (vendor)Nov 2025agentcannot tell
Claude Code team interviewMay 2025practitioner reportprobably holds
Sourcegraph: CodeScaleBench audit (vendor)Jul 2026agentcannot tell
llms.txt and AI citations (SE Ranking)Nov 2025web logsprobably holds
llms.txt requests (Ahrefs)May 2026web logsprobably holds

How: models and harness

SourceModelsHarness
Evaluating AGENTS.md (ETH Zurich)Claude Sonnet 4.5; GPT-5.2; GPT-5.1 mini; Qwen3 30BClaude Code; Codex; Qwen Code
Do context files help? (REALM workshop)Claude Sonnet 4.6; GPT-5.5Claude Code; Codex CLI
AGENTS.md and efficiencyGPT-5.2 CodexCodex CLI
Agent READMEs (what repos write)nonenone
Is progressive disclosure all you need?GPT-5.4 mini; Claude Haiku 4.5; Qwen 3.6 27BCodex; Claude Code; Pi
SkillJurorGPT-5.4Codex
Thoughtworks Radar: progressive context disclosurenonenone
Fowler: Generated Glossarynonenone
Anthropic: effective context engineeringnoneClaude Code
Anthropic: Agent SkillsnoneClaude Code
Claude Code docs: memory and best practicesnoneClaude Code
OpenAI: harness engineeringnot statedCodex
GitHub Copilot instructions guidancenoneCopilot
Chroma: context rot (OLD)18 models incl. GPT-4.1, Claude 4none, plain API
How many instructions can LLMs follow? (OLD)20 models incl. Claude 3.5 Haiku, o3none, plain API
Lost in the middle (OLD)2023 modelsnone, plain API
Do coding agents follow AGENTS.md? (wording)Claude Opus 5; Claude Sonnet 5; gpt-oss-120b; Qwen3 Coder NextClaude Code; Qwen Code
Instruction adherence: four file variablesClaude Sonnet 4.6; Opus 4.6Claude Code
OctoBenchClaude Opus 4.5; Sonnet 4.5; Gemini 3 Pro; 5 othersClaude Code; Kilo; Droid
Guardrails beat guidanceClaude Opus 4.6Claude Code
Constraint decayGPT-5 mini; GPT-5.2; GPT-5.4; open modelsmini-SWE-agent; OpenHands
Rule taxonomy in AI IDEsnot statednone
Precedent or intent?Claude Sonnet 4.6; Opus 4.8; GPT-5.6 Sol; GPT-6 SolClaude Code; Codex CLI
Brief: decision compliance (vendor)Claude Sonnet 4.6; Opus 4.6Claude Code
Actual AI: agents reading ADRs (vendor)not statednot stated
ADR-Control (workshop)a Luna-labelled runtime; mapping unknownopencode
O'Reilly: coding agents love decision recordsnot statednot stated
When local definitions are missingGPT-6 Astra; GPT-5.6 Terra; DeepSeek V4none, plain API
Glossary-augmented translationGemini 3.1 Pronone, plain API
TermJudgeLlama 3.1 8B; Qwen3 8B; EuroLLM 9B and 22Bnone, plain API
Knowledge graphs for SQL QA (OLD)GPT-4none, plain API
Ontologies to the rescue (OLD)GPT-4none, plain API
dbt: semantic layer vs text-to-SQL (vendor)Claude Sonnet 4.6; GPT-5.3 CodexPydantic AI
OG-RAG (OLD)GPT-4o; GPT-4o mini; Llama 3.1 8B and 70Bnone, plain API
RAG or fine-tuning? code completion (OLD)Qwen2.5 Coder 0.5B to 7B; DeepSeek Coder 1.3B and 6.7Bnone, plain completion
IBM semantic scopesGranite 8B; Llama 3.1 8Bnone, plain completion
SERA: repository-specialised agentsQwen3 32B (tuned)SWE-agent
LocAgent (OLD)GPT-4o; Claude 3.5 Sonnet; Qwen2.5 Coder 7B and 32BLocAgent
Is grep all you need?Claude Opus 4.6; Haiku 4.5; GPT-5.4; Gemini 3.1Claude Code; Codex CLI; Gemini CLI
Cursor: semantic search (vendor)Sonnet 4.5; GPT-5; Gemini 2.5 Pro; othersCursor
Claude Code team interviewnot statedClaude Code
Sourcegraph: CodeScaleBench audit (vendor)Claude Haiku 4.5Claude Code
llms.txt and AI citations (SE Ranking)nonenone
llms.txt requests (Ahrefs)nonenone

Research only. Nothing was built, merged or changed. Pilot runs used subscription models only, in throwaway copies. Page made Thursday 3 December 2026.