Beyond the Memory Loop: Why Every Project Needs a CLAUDE.md
By Soumya Ranjan Sahoo · · 8 min read
#Claude Code#AI Engineering#Context Engineering#LLM Workflows
Stop acting as a glorified onboarding manager for an amnesiac assistant. Here's how CLAUDE.md ends the re-explanation tax, what it actually costs to maintain, and the exact rule I use to keep mine lean.
Beyond the Memory Loop: Why Every Project Needs a CLAUDE.md The "Day 1" Groundhog Day It was 11:45 PM last Tuesday, and I was about two minutes away from throwing my mechanical keyboard across the room. I was deep into a refactor of a FastAPI backend at RITE Labs, transitioning a series of synchronous endpoints to a more robust asynchronous pattern. Over the previous two hours, I'd carefully established the architectural constraints with my AI agent. We weren't just "writing code" — we were building a specific system: Pydantic v2's patterns, a custom dependency injection layer for our database sessions, and a strict naming convention where every error schema had to be prefixed with to trigger a specific hook in our React frontend. Everything was clicking. The velocity was high. Then I hit a snag that required a fresh session to clear the context window and reset the model's attention. The moment I started the new session and asked the agent to help with the next endpoint, the re-explanation tax hit me like a wall. It reverted to generic Pydantic v1 syntax. It started hallucinating a standard SQLAlchemy setup we weren't even using. Worse, it forgot the prefix — meaning any code it generated would silently break our frontend error handling. I found myself typing the same three sentences about our dependency injection and naming conventions for the fifth time that day. It felt like Groundhog Day. I was an engineer spending 30% of my time building and 70% of my time acting as a glorified onboarding manager for an amnesiac assistant. This is the friction point where most "toy demos" fall apart. In real-world builds, you're not just fighting logic bugs — you're fighting the Memory Loop: the constant, exhausting need to re-teach the agent who you are and how you build. --- The Project Handbook The fix isn't "better prompting," and it isn't waiting for bigger context windows. It's a file. In plain terms, is persistent project memory that ends the re-explanation loop. It's not just documentation sitting next to your README — it's a specialized onboarding manual written specifically for the agent. Think of it like hiring a brilliant senior engineer and giving them no handbook, no documentation, no tribal knowledge. Every single morning, you'd have to sit them down and re-explain the entire company — the tools, the deployment rules, the tech stack — from scratch, because nothing was ever written down. That's exactly what working with an AI agent looks like without a persistent context file. gives the agent that handbook, so every session starts already briefed on your project's actual blueprint. --- The "It's Just a README" Fallacy There's a common assumption that is redundant if you already have a good , or if you've gotten decent at "vibe coding" your prompts. I fell for this myself during the early days of RITE Labs. I assumed that if my project had a with pnpm workspace configs, the agent would naturally use pnpm instead of npm. I assumed that if it saw a extension, it would infer my strict typing rules and linting requirements. I was wrong. Inference is expensive, error-prone, and quietly wasteful. When an agent has to guess your conventions from the file tree, it's making a high-stakes bet every time you send a message — and it often defaults to the most common generic pattern in its training data, not the specific, deliberate way you've actually designed your repo. I call the compounding version of this Inference Drift. On Day 1, the agent might guess right 90% of the time. By Day 5, those 10% errors — a missed type hint here, a slightly different directory structure there — have propagated into real technical debt. You end up spending your engineering time cleaning up hallucinated conventions that ten lines of explicit Markdown would have prevented outright. It also wastes your context window. If the model has to burn 500 tokens scanning your imports to guess whether you're using Axios or the native fetch API, that's 500 tokens it isn't spending on your actual business logic. A moves that cognitive load out of the model's working memory and into long-term storage, where it belongs. --- The Briefed Agent vs. the Amnesiac Agent The difference between these two states is the difference between velocity and friction, every single day. | Scenario | Without CLAUDE.md (The Amnesiac) | With CLAUDE.md (The Briefed) | |---|---|---| | Session start | Manual re-explanation of stack, rules, and "don'ts" | Persistent context auto-loads; ready to code immediately | | Coding standards | Inferred and inconsistent; constant manual linting | Explicit and strict; follows the handbook by default | | Command execution | Guessing between npm, pnpm, or yarn | Runs known, project-specific scripts without asking | | Tech stack awareness | Defaults to generic training-data patterns (e.g. Pydantic v1) | Adheres to your actual architecture (e.g. Pydantic v2 validators) | | Naming conventions | Hallucinates generic names; breaks frontend hooks | Maintains strict prefixing and folder hierarchy | | Overall effect | High friction; "vibe coding" quietly compounds into debt | Blueprint before code — structured, reliable output | --- The Maintenance Tax I want to be direct about this: is not a magic bullet. It introduces a specific overhead I've started calling the Maintenance Tax. If you're not prepared to pay it, the file becomes a liability instead of an asset. The biggest hurdle is the Sync Problem — your file drifting from the actual state of your code. I learned this one the expensive way. Midway through migrating one of RITE Labs' internal services off a REST-only pattern onto a mixed REST/WebSocket setup, I updated the code but forgot to touch the . The file still confidently described the old REST-only contract. For the next two sessions, the agent kept "fixing" my new WebSocket handlers back toward REST conventions — not randomly, but deliberately, because as far as it knew, that was still the source of truth. I didn't catch it until a teammate asked why a real-time endpoint was returning cached HTTP responses. The file hadn't just gone stale. It had actively steered the agent toward sabotaging the exact change I was making. Then there's the Over-Engineering Trap. In an attempt to be thorough, it's tempting to treat like a 5,000-word manifesto — every minor preference, every philosophical aside about code style. Remember: this file eats into the agent's context window on every single session. A bloated handbook leaves less room for the model to actually reason about your current task. The part most "AI hype" content conveniently skips is that a requires you to actually know your architecture before you write it. You cannot hand an agent a blueprint you haven't designed yourself. That's exactly why vibe coding is so addictive — it's easy to start with nothing. Building a persistent memory file is harder, because it forces you to be an engineer first and a prompter second. It takes real discipline to keep the file lean, accurate, and current. --- The Twice-Told Heuristic To manage the Maintenance Tax without losing my sanity, I use one simple rule for every build at RITE Labs: If you find yourself explaining a project rule, a library choice, or a workflow command to an agent more than twice in a single session, it belongs in the . No exceptions. This heuristic does two jobs at once. It keeps the file from becoming a dumping ground for minor, one-off preferences, while making sure the expensive re-explanations — the ones actually sapping your velocity — get codified and automated. If the agent keeps reaching for Axios when you've standardized on native fetch, that's a twice-told rule. If it keeps forgetting your pnpm flag, same thing. Write it down once, properly, and stop paying the tax on it forever. The mental load of vibe coding is a low-grade, constant anxiety — wondering if this session is the one where the agent quietly breaks the build. The mental load of working from a real blueprint is different. It's predictable. You know the agent has the handbook. You know the constraints are set. You've moved from babysitting to architecting. --- Still Engineering the Process We're in a genuine transition period right now. The move from generic chat interfaces to persistent, structured context files represents a real leap toward production-grade agentic workflows — this isn't just a trend. The broader standard, which follows the same core principle as , has now been adopted across more than 60,000 repositories and is stewarded by the Linux Foundation's Agentic AI Foundation — a sign this pattern has moved well past "best practice among enthusiasts" into genuine industry convention. But I don't want to pretend I've got this fully figured out, because I haven't. handles project-wide rules well, but it doesn't solve everything — there's still the open question of session-specific state: the "daily pages" of an engineering notebook that track what you're actually doing right now, inside a single session, not just the permanent rules of the repo. I'm still working out what that file should look like for my own projects, and I suspect the honest answer is that it'll look different depending on the project's stakes. Blueprint before code. Follow along — next up in the series: the session-state file, the one artifact that keeps you from losing your place mid-build, even when the project-wide rules are already solid.