Lily
Posted on Jul 24
• Originally published at dev.to
This is the next installment in my "Claude Code environment" series. In the previous post on the self-audit frustration loop, I wrote about a "never-ending improvement loop." This time I want to dig into what sits at the root of it: detecting and self-correcting context injection bloat.
At the start of every session, Claude Code unconditionally injects the full contents of rules/*.md, ~/.claude/CLAUDE.md, ~/CLAUDE.md, and MEMORY.md. Every time you add a rule, this byte count silently grows. In an audit on 2026-07-11, I found that total injection had exceeded 40KB, and 99 agents I thought I had archived were still being loaded — the main cause of my performance degradation. Since then, I've kept a permanent loop running that measures this automatically every week and attempts self-correction when thresholds are exceeded.






