NonDev Apps

Bonus 02 of 07

The context window - why long AI sessions drift and how to reset safely

Goal: Learn to spot the warning signs of a drifting Codex session, stop before damage happens, write a handoff note, and restart cleanly.

What to do

01

Understand what the context window is — and why it fills up

Every Codex session has a memory limit called the context window. It holds everything from the current conversation: your prompts, Codex's replies, file contents it has read, and plans it has written. When the session is fresh, Codex has plenty of space and answers sharply. As the session grows longer — more messages, more files read, more back-and-forth — the window fills up. Codex does not crash or warn you. It just quietly starts dropping earlier parts of the conversation. That is when you get strange answers, repeated mistakes, or changes to files it should not touch.

02

Learn the five warning signs of a drifting session

These are the five signs that a session is drifting and needs to be reset: 1. Codex changes a file you did not mention in your last prompt. 2. Codex repeats a suggestion it already made earlier in the session. 3. Codex contradicts something it said 10 messages ago without explaining why. 4. Codex's answer is noticeably shorter, vaguer, or less specific than usual. 5. You are not sure if Codex still has your AGENTS.md rules in mind. When you see any one of these, stop the session. Do not push through. Pushing through a drifting session is how non-developers accidentally break working features.

03

Stop and write a handoff note before closing the session

Before you close a drifting session, capture the state so you can continue cleanly. Copy this handoff template into your notes app and fill it in: Goal: [WHAT WERE YOU TRYING TO BUILD OR FIX?] What worked: [WHAT DID CODEX COMPLETE SUCCESSFULLY?] What failed or drifted: [WHAT WENT WRONG OR GOT CONFUSING?] Files touched: [LIST ANY FILES CODEX CHANGED IN THIS SESSION] Current error or blocker: [IF THERE IS AN ERROR MESSAGE, PASTE IT HERE] Next safest step: [WHAT IS THE ONE SMALLEST THING THE NEW SESSION SHOULD DO FIRST?] Do not edit yet: [ANY FILES OR AREAS THAT SHOULD STAY UNTOUCHED UNTIL YOU REVIEW] The note does not need to be long. Six to eight lines is enough. The goal is to carry the essential facts into a new session without carrying the drift.

Goal: [WHAT WERE YOU TRYING TO BUILD OR FIX?] What worked: [WHAT DID CODEX COMPLETE SUCCESSFULLY?] What failed or drifted: [WHAT WENT WRONG OR GOT CONFUSING?] Files touched: [LIST ANY FILES CODEX CHANGED IN THIS SESSION] Current error or blocker: [PASTE ERROR MESSAGE IF THERE IS ONE] Next safest step: [THE ONE SMALLEST THING THE NEW SESSION SHOULD DO FIRST] Do not edit yet: [FILES OR AREAS THAT SHOULD STAY UNTOUCHED UNTIL YOU REVIEW]
04

Start a fresh session using the handoff note

Open a new Codex session — a completely fresh conversation, not a continuation. Paste your handoff note as the very first message. Then add: "Read this summary. Do not start any work yet. First, confirm you understand the goal and the next safest step. Ask me one clarifying question if anything is unclear." Wait for Codex to confirm before doing anything. This opening handshake ensures the new session starts focused, not drifting from message one.

05

Save the handoff template to a permanent file so you can reuse it

The handoff note template is only useful if you can find it quickly when a session is drifting and you are under pressure. Open a plain text file called "codex-handoff-template.txt" in your project folder or in a notes app you check daily. Paste the blank template into it, save it, and commit the file in GitHub Desktop if it is inside your project. Next time a session drifts, open the template, fill it in, and you are ready to reset in under two minutes.

CODEX HANDOFF NOTE — fill this in before closing a drifted session Goal: What worked: What failed or drifted: Files touched: Current error or blocker: Next safest step: Do not edit yet:

Expected result

You know the five warning signs of a drifting session, you wrote a filled-in handoff note using the template, you practiced starting a fresh session with the handoff note as the opening message, and you saved the blank template somewhere you can find it quickly.

Key takeaway

  • A drifting session does not get better if you keep going — it gets worse. When you see the signs, stop. Write the handoff note. Start fresh. Six lines of clear context in a new session outperforms thirty messages of accumulated drift.
Bonus 2 - The context window - why long AI... - NonDev Apps