The silent loss
Measurement report, Joomla repository, 2026
My CLAUDE.md file weighed 217 KB. Cutting it by 76% cost me four behavioural rules, without a single error firing. Here is the counter that caught them, and the very precise condition under which it works.
52,392
bytes, down from 222,864The weight of the file after extraction. Loaded in full at the start of every conversation, it is the first cost of every session.
14,200
tokens per session, down from 60,200Estimate based on about 3.7 bytes per token, calibrated on accented French markdown. An order of magnitude to guide decisions, not an invoice.
4
rules recovered out of 4 lostFour behavioural rules had dropped out of the loading path. None produced an error. All were caught by the count.
How does a file reach 200 KB?
By accumulation, never by decision. And above all, by being right at every step.
A file such as CLAUDE.md, AGENTS.md or .cursorrules is loaded in full at the start of every conversation. Nobody wakes up one morning and decides to make it heavier. It grows through six mechanisms, each perfectly reasonable taken alone.
1. The incident that swells in three stages
This is the main mechanism, and the hardest to fight, because every addition is justified.
Day 1, you have just spent an afternoon on a bug. You write the rule. One line. Two weeks later, a colleague asks why, and you add the explanation. Three months later, someone proposes a rewrite that would break exactly that, and you add the options already ruled out so that the discussion does not start over.
Never read `request.POST` before verifying the webhook signature.
### Webhook signature verification
Never read `request.POST` before verifying
the signature.
The framework consumes the raw stream on the
first access to the parsed body, so the
signature no longer matches. It took an
afternoon to find, because the error came up
as a rejection on the provider side and not
as a call-order problem.
We considered buffering the request in a
global middleware. Rejected, because it made
every request heavier for a single endpoint.
None of the thirteen added lines is wrong. The person who wrote them was right every time. Except that the rule itself still fits on one line. The other thirteen are team memory, and team memory does not need to be reloaded in every conversation.
One line per incident, thirteen lines of team memory around it. Ten incidents, ten rules, one hundred and thirty lines of context. At two incidents a week, eighteen months produce about a hundred times more.
2. The catalogue that follows the project's growth
At the start you have three components, described in four lines each. Nobody will ever see a problem there. Eighteen months later you have twenty-two, and the ones with an eventful history have fifteen.
A catalogue grows with the project. A set of rules does not. The number of things you own grows without limit. The number of reflexes to have before acting stays roughly stable. If a section grows because the project grows, it has no place in a file that is loaded permanently.
3. The log stuck at the top
It starts with a date. Then a sentence, to say what changed. Then a second one, because the first was too vague. You regularly see a “Last updated” that has become a single line of several thousand characters, where two years of history have been concatenated in parentheses. Nobody decided it. Everyone added their parenthesis after the last one.
4. Defensive documentation
You write for an imaginary reader who knows nothing, so you explain what a migration is or what a job queue is for. The real reader is a model that already knows the framework better than you will ever document it. What it does not know is what is specific to your project.
Quick test on a paragraph: if it would be equally true on any other project with the same technical stack, it is surplus.
5. The duplication nobody sees
Past a certain size, nobody knows what the file already contains. So the rule gets added a second time, elsewhere, worded differently. It is not carelessness, it is mechanical: beyond a few hundred lines, reading before writing costs more than rewriting.
6. The raw output paste
A terminal excerpt, a full configuration file, a forty-line error trace. Very quick to paste, very heavy to carry.
Add to that a catalogue that follows growth, a log concatenated at the top, the defensive documentation of the early days, rules written twice and raw output pastes. You end up with a file of several hundred kilobytes without a single individual decision having been bad.
That is exactly why the problem goes unnoticed. There is nobody to blame and no moment when it went wrong.
How to tell where it hides in your file
Do not judge by weight alone. A large section can be perfectly legitimate. The useful signal is the ratio between a section's weight and the number of rules it contains.
Output of the measure command size rules B/rule
Components 80.8 KB 63 1313
Skills 39.9 KB 18 2268
Changelog 10.4 KB 2 5320 <-- a story
A section at a few hundred bytes per rule is dense, it earns its place. A section at several thousand is a story with a rule inside, and that is the one to take out first.
| Section | Before, bytes per rule | After, bytes per rule | Density |
|---|---|---|---|
| Components | 1,313 | 612 | 2.1 times denser |
| Skills | 2,268 | 461 | 4.9 times denser |
| MCP servers | 1,510 | 483 | 3.1 times denser |
| Changelog | 5,320 | 878 | 6.1 times denser |
The file did not just get thinner. Every remaining kilobyte carries three to five times more rules than before.
One honest remark to close this point. The tool still flags a section at 4,543 bytes per rule in my own file, and I left it. It is the repository's directory tree, which serves to navigate and not to decide. The ratio is an indicator, not a judge.
What exactly is the failure mode?
A deleted rule triggers no error. It simply stops applying.
Compare with code. If you delete a function that is used elsewhere, the application crashes, the test goes red, you fix it within a minute. The signal is immediate and loud.
A behavioural rule has none of these mechanisms. You remove it from the file, everything keeps working, the answers remain plausible. Three weeks later, the model makes a decision you would have rejected, and you never connect that decision to the line you moved on a Tuesday evening.
This is a silent failure with a delayed effect. The worst category there is, because it leaves no trace to follow back.
How do you turn a subjective sort into a test?
By choosing a criterion you can count.
A line stays in the context file if it carries a behavioural imperative. Otherwise it moves to a README.
The markers are lexical and deliberately simple: must, always, never, before you, in case of conflict, by default, required, do not, need to, plus their French equivalents.
This criterion is not accurate. It catches lines that could have left, and it misses some that should have stayed. That is not what it is asked to do.
It is asked to be countable. I count the imperative lines before an extraction, count again after, and if the number drops I know exactly what to go and re-read. An imperfect but measurable criterion beats a fine but unverifiable judgement, because the second cannot be checked at three in the morning after the fourth section.
The fingerprint calculation
A line, reduced to what lets you recognise itfingerprint = re.sub(r'[^a-z0-9]', '', line.lower())[:60]
Only the first sixty alphanumeric characters are kept. Punctuation, case and accents disappear. A line where you move a bold marker or add a comma is still recognised. A deleted line stands out. That is exactly the intended trade-off, because you are hunting for disappearances and not for edits.
The decision tree, applied section by section
Every line goes through two questions, in this order.
Two questions, three destinations. The second question is the one that costs the most if you get it wrong: a rule that cannot wait and is moved anyway goes mute at the very moment it should apply.
What is the complete procedure?
Five steps, one of which repeats.
- 1
Measure. Weight, lines, estimated tokens, and above all the weight of each section taken separately. Start with the heaviest.
python lm-context-diet.py measure CLAUDE.md
- 2
Set a baseline. The script records the fingerprint of every imperative line in a JSON file.
python lm-context-diet.py baseline CLAUDE.md -o .ctx-baseline.json
- 3
Extract one section. Just one. The history and details go to the README of the element concerned. An index line stays in the context file.
- 4
Recount straight away. The script lists the missing fingerprints by name and exits with return code 1. For each listed line, you must decide: history that left legitimately, or a rule to restore.
python lm-context-diet.py check CLAUDE.md .ctx-baseline.json
- 5
Loop. New baseline, next section. At the end, one last check on the links: a broken index link makes the README unreachable, so the rule goes mute.
The return point that matters is the one for a batch that is too big: it leads back to the baseline, not to the next section. A check that can no longer say what to re-read no longer checks anything.
At step 4, the number of disappearances decides what happens next.
| Lines missing | What it means | What you do |
|---|---|---|
| 0 | Clean extraction | Next section |
| 1 to 12 | Arbitration needed | Re-read each line, restore whatever is a rule |
| More than 12 | The batch is too big | That is not a result, it is a signal. Split it into smaller pieces. |
What did the counter actually catch?
A rule that still existed, and was no longer doing its job.
After extracting the block devoted to my MCP servers, the counter went from 81 to 78. Three lines were missing. Re-reading them, I found one that should never have left:
Always use the native Joomla classes (Table\Category, Table\Content, Table\Menu) through a CLI script. Never raw SQL to create menus, categories or articles.
This rule protects against one specific bug. Joomla's #__menu table is a nested set tree, with lft and rgt bounds that must be recalculated on every insertion. A direct INSERT does not recalculate them. The menu gets corrupted without any SQL error, and the symptom appears later, elsewhere, in an unrecognisable form.
The detail that gives the check all its value: that rule still existed in a file of pitfalls, at the other end of the repository. It was perfectly written. It was simply no longer on the automatic loading path, so it no longer fired at the right moment.
“Checking whether the text still exists somewhere proves nothing. The only question that matters is whether it is still reached.”
Three other rules were brought back after extracting the skills block, under the same conditions. Total: four rules recovered, none lost.
Why does comparing the start and the end not work?
Because the signal drowns in noise.
One section at a time
3 lines missing
Readable in a minute. The lost rule jumps out.
The whole trim in one go
120 lines missing, only one of which is a real rule
Nobody re-reads 120 lines. The rule stays hidden.
The red square is the same in both fields. Only the amount of noise around it changes, and it decides whether you see it or not.
| Scope of the check | Lines to arbitrate | Usable? |
|---|---|---|
| One section | 3 | Yes, in a minute. The lost rule jumps out. |
| A commit grouping two sections | 78 | No |
| The whole trim in one go | 120 | No. Nobody re-reads 120 lines, the rule stays hidden. |
This finding surprised me while I was preparing the article. I thought I had applied a global test. On checking, I found that I had measured at every step, and that this is the only reason it worked.
Even one commit is already too big. The script now emits a warning beyond twelve disappearances: when it fires, it is not a result, it is the signal that you need to cut more finely.
What do you keep, what do you move?
| Moves to a README | Stays in the context file | |
|---|---|---|
| Nature | History: why it was built, with what feedback | Orchestration rules: which tool, when, in what order |
| Nature | Catalogues: the list of what exists | Arbitrations: what takes precedence in case of conflict |
| Nature | Pitfalls specific to a single element | Hard technical constraints: what breaks if you move it |
| Nature | Dated logs, release notes | Defaults, applied without being asked |
| Nature | Implementation details, parameters | Security and privacy reflexes |
A very simple test tells you whether you are going about it the right way: look at the evolution section by section.
The last two lines grew, and that is the sign the operation went well. Absolute rules and Security had no catalogue to take out: on the contrary, they absorbed rules brought back from elsewhere.
A successful trim does not shrink everything uniformly. It empties the catalogues and leaves the rules intact or denser. The last two lines of the chart grew, and that is the sign the operation went well. If all your sections shrink at the same pace, you are losing rules.
Why can a well-written README stay a dead letter?
Because a README is not loaded automatically. It is reached because a link makes it visible at the right moment. And what triggers the reading is not the link. It is the text around the link.
See [`MCP/README.md`](MCP/README.md) for details.
**Mandatory call order, publication rule, routing pitfalls:** [`MCP/README.md`](MCP/README.md)
In the first case, nothing says when to open that file. It will only be opened by someone who is already looking for the details of the MCP server, so never at the moment the rule matters.
The index line must announce what the rule is about, not just where it lives. It plays the role of a table of contents that triggers reading, not a footnote.
The full circuit takes three steps. The context file is loaded in full at every conversation, and it contains the orchestration rules as well as the index lines. READMEs are only read if the current task touches the element announced. The model's decision rests on both.
The first block costs tokens at every session, the second only when it is used. What cannot wait must never move from the first block to the second.
A useful corollary: if a rule is too important to depend on that trigger, it does not move. It stays in the context file, in full, and never mind the tokens.
What these figures do not prove
- They come from a single repository, whose file had grown abnormally for more than a year. If yours is 15 KB and already clean, you will not get 76%. You may get 10%, and that will be very good.
- The token estimate rests on about 3.7 bytes per token, calibrated on accented French markdown. It is an order of magnitude to guide decisions, not an invoice.
- The sorting criterion remains a lexical filter, not an understanding of the text. A rule worded without a marker will slip through, and no count will protect it. That is one more reason to write your rules with explicit verbs of obligation, which also makes them clearer for a human.
Where to start
Measure first, without touching anything. The only figure that decides whether there is a problem is the weight of your heaviest section.
If it exceeds 20 KB, it almost certainly contains catalogue and history that do not need to be loaded in every conversation. Take it out, one section at a time, counting at each step.
The tool, lm-context-diet.py, and a ready-to-install skill for Claude Code are published on GitHub under the MIT licence, with example files that let you watch the check catch a lost rule: github.com/MandeTshinga/lm-context-diet.
Your goal is not a smaller file. It is a file where every remaining line is still working.
Frequently asked questions
How many tokens does a 200 KB CLAUDE.md really cost?
Around 55,000 to 60,000 tokens on accented French markdown, counted at every new conversation before your first question.
Does splitting your CLAUDE.md lose rules?
Yes, silently, if you do not count the imperative lines before and after each extraction. I lost four in a single operation.
How do you know a rule has disappeared from the context?
Count the lines containing an obligation marker before the extraction, count again afterwards, and re-read the missing lines by name.
Why extract only one section at a time?
Because a single extraction produces three lines to arbitrate, whereas a batch produces more than a hundred, and nobody re-reads a hundred lines.
Does a rule moved to a README still apply?
Only if the index line left in the main file announces the subject of the rule, otherwise the README will never be opened at the right moment.
What size should a context file aim for?
There is no universal threshold, but any section above 20 KB almost always contains catalogue that can move to a README.
Why does a CLAUDE.md grow without anyone deciding it?
Because every addition is justified on its own: a documented incident takes ten to fifteen lines, and two a week are enough to produce two thousand lines in eighteen months.
How do you spot the sections to extract first?
Divide each section's weight by the number of rules it contains: beyond a few thousand bytes per rule, it is a story with a rule inside.
What must you keep in the main file?
Orchestration rules, arbitration in case of conflict, hard technical constraints, defaults and security reflexes.
Does this method work for AGENTS.md or .cursorrules?
Yes, the mechanism does not depend on any particular tool, only on the file being loaded in full at every session.
All the measurements on this page come from a single working repository, between two commits, and can be reproduced with the tool described. Values per section are expressed in kilobytes of UTF-8 markdown.
Going further
This work belongs to the same discipline I apply to visibility: what counts is not what you wrote, it is what is actually reached at the moment of decision.
If you want to apply this method to your own digital ecosystem, this is the kind of mapping I carry out with clients: demander un accompagnement (page in French).