Skip to content
mentoor

Topic 4 of 5 · 4 min read

Auditing what is in the window

Goal: Produce a list of what a chat or agent session actually loaded and flag the items that are missing, stale or irrelevant to the task.

To audit context, list every item that was loaded into the session, then mark each one as needed, missing, stale or irrelevant. You cannot reason about the answer until you know what the model read.

Check yourself · 1 of 3

What is the first step of a context audit?

Choose one answer

Why it matters

Long sessions pick up clutter. A chat that started with a travel plan now holds a recipe, two drafts and a long tangent. An agent session may have loaded a whole folder when the task needs two files. Clutter costs money and room, and it can pull the answer off course. Missing items cost more: the model guesses.

How to audit

  1. Use the tool's own view. Some tools show what was loaded. Claude Code has a context view and memory commands. Cursor shows the files attached to a chat. ChatGPT has a memory and custom instructions page. Many tools show a token counter that tells you how full the window is. Start there.
  2. Ask the model to restate. Say: "List everything you currently know about this task: the instructions you were given, the files you can see, and the decisions we made. Do not add anything new." This is not perfect, since the model can miss or invent items, so treat it as a clue and verify against the tool's view.
  3. Build a table. One row per item. Columns: source, what it is, size, status.
  4. Mark the status. Needed and fresh: keep. Stale (an old plan, a replaced file, a dropped rule): remove or update. Irrelevant: remove. Missing (the spec, the error log, the style rule): add.
  5. Act. Start a new session with only what is needed, or trim and refresh the current one. Summarise long history into a short note and carry that forward.

Before and after

Before: The agent keeps using the old database name. You keep telling it to stop.

After: You list the session's context. Row 4: a notes file from last quarter says the database is "orders_v1". Status: stale. You fix the notes file and the problem ends. You never had to repeat the instruction.

What goes wrong

  • Trusting the restatement. The model's list of what it knows can be incomplete or invented. Cross-check with the tool.
  • Ignoring hidden sources. Memory and project files are easy to miss because they load silently.
  • Auditing only for size. A small window can still be wrong. Look at freshness and relevance, not only token counts.
  • Never cleaning up. Carrying a 200-message chat into new work brings old assumptions with it. A fresh session with a short summary is often better.

Examples

A small audit table for a coding session

Source Item Status
Memory file "Use npm" Stale: the project moved to pnpm
Open file checkout.ts Needed
Open file old-prototype.ts Irrelevant: remove
Chat history Plan from Monday, dropped on Tuesday Stale: summarise or drop
Missing The failing test's error output Add

Five rows, three actions. The agent now has less to wade through and the facts it was missing.

Restate check in a chat

Prompt: "Before we continue, list the instructions and facts you are working from for this task. Do not add anything."

The reply includes "the user wants a formal tone" and "the budget is 5,000". You did not mean either for this task. You find both in memory and an old message, remove them, and ask again.

Key points

  • An audit lists each loaded item with its source, size and status: needed, missing, stale or irrelevant.
  • Start with the tool's own context view, memory settings and token counter before asking the model.
  • A restate-what-you-know request is a useful clue, but the model's list can be wrong, so verify it.
  • Stale items such as old plans or replaced files cause errors that repeating instructions will not fix.
  • Fix the window by removing clutter, adding what is missing, or starting fresh with a short summary.

Common mistakes

  • Asking the model what it knows and accepting the list without checking the tool's own view.
  • Overlooking memory, project notes and system rules because they load without being shown in the chat.
  • Cleaning only for size and ignoring items that are stale or wrong.
  • Dragging a very long chat into a new task instead of starting fresh with a short summary.

Check yourself · 2 of 3

An audit table lists a notes file saying "deploy with Jenkins". The team moved to GitHub Actions last year, and people often ask the assistant how to release. How should the file be marked?

Choose one answer

Check yourself · 3 of 3

You ask the model to list what it knows about a task, and it names a deadline you never gave it. What is the best conclusion?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic