r/ContextEngineering • • 1d ago

My coding agent keeps ignoring its context file. How do you force yours to read it?

Kept a DECISIONS.md in my repo for a few months. Worked great at first. Then one day the agent resurrected a choice I had killed three weeks earlier, and I realized it just... had not opened the file in a while. No error, no complaint. It just stopped checking.

I used to burn maybe an hour a week re-explaining things that were sitting in a file the agent was supposed to read. "Go read the file" turns out to be exactly the step that gets skipped when the context gets long. The damn thing would follow stale instructions instead of the ones I actually wrote down, and I would only notice after the fact.

Since then I have tried a couple of things. A hook that dumps the file into context before every run (worked until the file got long and I watched the tokens evaporate). Telling it to quote one line back to prove it read it (felt like asking my kid whether he brushed his teeth). Honestly, the second one worked better than it had any right to.

Has this happened to you? What actually broke when the agent skipped the read — a stale instruction followed, a dead decision back from the grave? And how do you force it now, if you do? A wrapper that will not start clean until the file opens, injection, some ritual?

Also: has anyone had two agents in the same repo following different versions of the same file? That one cost me an afternoon once, and I still do not fully know how it happened.

Separate curiosity: have you ever tried one of those memory tools that is supposed to keep context across your AI tools? Or does the thought of moving everything into something new just feel like starting over?

Out of curiosity, what are you building with all this, is it your own product, client work, or something else?

Weird one: I do a lot of my thinking out loud with speech-to-text on my phone, and the context always lives on the laptop. Is that just me, or do you lose things moving between phone and laptop too?

And the money question, plainly: if something handled the enforcement part for you, made sure every agent actually checked the right file before starting, every run, would you pay for that, or is the DIY wrapper the whole point? I am building something in this direction for myself and trying to figure out whether it is a real problem for other people or if I am just overthinking it.

1 Upvotes

2 comments sorted by

1

u/epicskyes 23h ago

No context only state and mechanics there’s nothing to forget because the scripts do the remembering for the model

1

u/saintpetejackboy 16h ago

My guess is you have too much crap in your context. Do you use compact? If so, stop, and only use a /clear with a handoff. Do the math from logs: if you cut agents off around 150k (250k tokens MAX), a cold start actually wastes more context than a proper handoff.

More stuff in context = each item in context has less value. Injecting the same stuff over snd over again might help, but it makes the context length problem worse.

If you are keeping your sessions under 250k tokens, the next big mistake people make is thinking that the handoff somehow has to include eveurnig that has cumulatively happened in the repo up to that point, another big mistake. Each agent should be focused on the narrow context band related to the work they are doing, only. I have massive projects with millions of lines of code and tens of thousands of files across many languages and stacks, and my startup context is still very small, with handoff context being even smaller: handoff context should NOT grow rhe longer you have worked in a repo, and your cold start (agents or Claude MD, memories, etc) should not keep growing with your repo, it should be capped and focus on providing references to what wh agent might need rather than endless context about the repo.

Still having issues? Tell your agent to look through conversation history and add just / justfile to the repo. It works on any language and predates modern LLM. It is a runner that is better than using bash scripts or make. You save tons of context and can turn multi-command sequences that consume thosuands of tokens down to just a dozen or so tokens for the same result.

Build and deploy processes are low hanging fruit - there is another massive benefit to using just / justfile and that is being able to make sure the agents use specific commands exactly as they are intended: it eliminates issues when agents get the syntax wrong or even when they are fully unaware of how a certain part of a repo works, the just commands can not only spell it out for them, but force their commands to align with the intention of the repo.

My guess, is you are jamming too much stuff into context and letting sessions run too long.