The Great AGENT rule Refactor

Jeff Liu··4 min read·AI Agents
The Great AGENT rule Refactor

Key Takeaways

  1. 1Loading 170KB (~25,000 tokens) of rule context per session caused measurable quality degradation in AI agent output.
  2. 2Reducing from 45 to 30 rule files and 170KB to 72KB immediately improved output quality — not by adding rules, but by removing redundancy.
  3. 3Context overload mirrors human cognition: Miller's Law states working memory holds 4-7 items before performance drops.

I've been building with AI agents for months. Custom rules, workspace knowledge, skill files — honestly, probably too much stuff. I had 45 rule files telling my AI how to behave. Naming conventions. Code patterns. Anti-patterns. Deployment checklists. Security gates.

Forty-five files.

And the AI was getting worse.

It wasn't broken, but the output was getting sloppy in ways I couldn't pin down. It would confidently reference a file path that didn't exist anymore. It would apply a pattern from one rule while ignoring a contradicting rule three files later. Code that technically followed the instructions but missed the point entirely.

I kept adding more rules to fix the problems the other rules were causing. Classic.

The measurement

Then I actually measured it. Each session was loading roughly 170KB of rule context — about 25,000 tokens — before I even said anything.

That's like handing someone a 50-page employee handbook and then asking them to fix a bug. They skim. They miss stuff. And whatever they don't see, they guess.

Our brains actually work the same way — there's a well-known psychology concept called Miller's Law that says working memory can only hold about four to seven things at once before it starts dropping stuff. Context overload isn't just an AI problem. It's a human one.

I think that's what hallucination actually is a lot of the time. Not the AI being dumb — just the AI drowning in your instructions and filling in the gaps.

Honestly, people do the same thing. When we don't know something, we don't always say "I don't know." We compensate. We fill in the gaps with something that sounds right. Imposter syndrome is basically the human version of hallucination — you're pattern-matching confidence because admitting uncertainty feels worse.

What I actually cut

So I made myself delete half of them.

Not randomly. I went through every rule file and asked: is this contradicting another rule? Is there fragmentation — two files saying similar things slightly differently? Is this actually reducing hallucination risk, or just making me feel like I covered my bases?

If it was redundant, it got cut. If two rules overlapped, I merged them. If a file was longer than 5KB, it got split into smaller pieces that only load when relevant.

45 files became 30. 170KB became 72KB. ~25,000 tokens saved per session.

The output quality improved immediately. Not because the rules were bad — because fewer rules meant the AI could actually follow the ones that mattered.

Same problem, different file

I'm building this platform, but I'm also navigating the job market like everyone else. And the resume problem is the same problem.

An eye-tracking study by The Ladders found that recruiters spend about six seconds on a resume. Six seconds on something most people spend hours writing. Twenty bullet points of skills, every project you've ever touched — and the recruiter scans past all of it. Too much information, not enough signal.

I've been stripping mine down. Fewer bullet points. Fewer buzzwords. Just the work that actually shows how I think and what I can build. It feels wrong, but that's the point — less is what makes the rest land.

I'm starting to think about interview prep the same way. Most career coaches recommend the STAR method — prepping three to five real stories you can adapt to any behavioral question instead of memorizing thirty different answers. I haven't tried it yet, but it makes sense — the more answers you memorize, the more scripted you sound. I'd rather have a real conversation than a recital.

At some point more prep just becomes more noise. Whether it's AI rules, resume bullet points, or interview answers — I keep learning the same lesson.

Anyway, the rule cleanup saved me about three days of accumulated drift. Not bad for deleting files.

What This Means For You

1

Audit your AI context budget

Measure total token load from rules, skills, and knowledge before the first user message. If it exceeds 10-15KB, you are likely degrading output quality. Merge overlapping rules, split files by domain, and use conditional loading.

2

Apply the same principle to resumes

Recruiters spend ~6 seconds on a resume. Fewer bullet points with higher signal density outperform exhaustive lists. Strip filler, keep only work that shows how you think.

FAQ

When an AI agent loads excessive context (e.g., 170KB / 25,000 tokens of rules), it becomes overwhelmed and starts filling in gaps rather than admitting uncertainty. This mirrors Miller's Law in human cognition — working memory can only hold 4-7 items before performance degrades.

The author reduced from 45 files (170KB) to 30 files (72KB), saving ~25,000 tokens per session. The key is not a magic number but eliminating redundancy, merging overlapping rules, and keeping individual files under 5KB so they only load when relevant.

Context overload occurs when an AI model receives more instructional context than it can effectively process. The model begins skimming, missing contradictions between rules, and confidently generating incorrect outputs — often called hallucination.

Related Articles

More insights on trending topics and technology

Newsletter

We read 100+ sources so you don't have to.

One email. Delivered weekly. The AI and tech stories actually worth your time.