Yar Malik

Module 2 · The Core Toolkit

2.3 Reviewing Diffs & Managing Context

Two separate skills live in this lesson, and they compound: reviewing what changed, and managing what Codex is still carrying around in its head while it works.

On review: /diff is your primary tool, and the discipline is using it continuously as changes land rather than once at the very end of a long task, when there's a wall of changes to review at once and your attention is already fading. Get in the habit of checking in after each meaningful chunk of work — a new function, a file touched, a test added — instead of letting five files of changes pile up before you look at any of them. This isn't about distrust, it's the same reason a senior engineer reviews a PR in logical chunks instead of scrolling the whole diff once and hoping nothing slipped past.

On context: every file Codex reads, every command's output, every back-and-forth message in a session sits in its working context for the rest of that conversation, whether it's still useful or not. Left unmanaged over a long session, that either hits a hard limit or does something quieter and worse — Codex stays technically within budget but gets noticeably less sharp, because it's now reasoning over a pile of stale detail instead of the parts of the conversation that actually still matter.

/compact summarizes everything so far, keeping what's load-bearing and dropping the rest — OpenAI's "context compaction" work specifically targets long-horizon sessions so a multi-hour task doesn't degrade partway through. /recap gives you a quick summary without collapsing anything, useful when you just need to reorient yourself rather than actually free up space. The right moment to compact deliberately is a natural breakpoint — finished a feature, about to switch to an unrelated part of the task — rather than waiting until you're already feeling the session get sluggish.

Do this before moving on

in your next session that runs long, compact deliberately at a natural breakpoint instead of waiting for the session to start feeling slow. Notice the difference in how sharp the following responses feel.