Give your coding agent project memory without paying for it every message A developer proposes a tiered context strategy for coding agents to reduce token costs, suggesting a small always-on index file, path-scoped detail files, and on-demand injection. The approach caps the always-on cost and scales detail only when relevant, addressing the problem of bloated instructions files that are loaded on every message. If you use an agentic coding tool — Claude Code, or anything with a persistent instructions file — you've probably hit this. You start a CLAUDE.md or .cursorrules , or AGENTS.md with a few conventions. It's useful. So you add the architecture. Then the gotchas. Then the three things it keeps getting wrong. Six months later it's 800 lines, and you are paying for all 800 of them on every single message , in every session, forever. That's the part people miss. An instructions file isn't loaded once per session. It's part of the context for each turn. A file that doubles doesn't cost you twice once — it costs you twice per message, for the life of the project. Delete most of it. Now the agent doesn't know your conventions and you're correcting it by hand again. You traded token cost for your own time, which is usually a worse trade. Keep it and eat the cost. It grows monotonically, because nobody ever opens a working instructions file to prune it. There's no forcing function. Both fail for the same reason: they treat context as one undifferentiated blob that's either loaded or not. But the facts in that file don't have equal value on any given turn. "We use tabs" matters every time. "The payment reconciler retries with exponential backoff because the provider's 429 has no Retry-After" matters only when the agent opens that file. Split the context by when it's needed , and load each tier accordingly. The instructions file holds only what's true for every turn — and, critically, has a size ceiling that doesn't move as the codebase grows . Not a summary of everything. An index: what the modules are, one line each, and where to look for more. Project memory auto-maintained - api — HTTP layer, request validation, rate limiting modules: routes, middleware, schemas - worker — background jobs, retry policy, dead-letter handling modules: queue, handlers - lessons: 53 learned injected when relevant - detail on demand: recall "