Why your AI keeps forgetting what you told it
Models have a context window, a fixed budget of text they can consider at once. Everything competes for it: your instructions, the files you opened, the errors you pasted, and the whole conversation so far.
When a session runs long, the earliest things fall out of that budget first. That is why the rule you set at the top stops being followed an hour later.
What helps, in order of how much it helps:
Put durable rules in a file the tool reads every session, not in a message. A CLAUDE.md or equivalent survives a new session; a chat message does not.
Start a fresh session per task. A long session is not a memory, it is a liability.
Point at specific files rather than asking it to search. Every wasted read costs budget you wanted for the actual work.
TaggedCode generation