Since each request stands alone, everything the model is going to use has to fit into that one request.
Context window
The most tokens one request can involve: instructions, the conversation so far, files read, and the reply. What is outside it can't affect the output, any more than a program can use a file it never opened.
Agents fill windows quickly by reading files and logs. What happens next is decided by the program running the model, and the first thing to go may be the rule you set at the start.
Say it to your agent
“Don't read the whole log. Run grep -n "FAIL" test.log | head -50 and read only around those lines, so the window stays free for the code.”