NonDev Apps

Bonus 02 of 07

The context window - why Claude goes weird after a long session and exactly how to fix it

Goal: Claude Code has a memory limit per session. When it fills up, Claude starts making strange decisions. Today you learn to spot the warning signs and fix it in seconds.

What to do

01

Check your current context level

Do not ask Claude to guess a percentage from memory. Use the built-in context tools. In Claude Code, run `/context` and read what is currently taking up space.

02

Make 10 small prompts to fill the context

Type 10 separate prompts, each making a small change or asking a small question. This fills up the context window so you can see the effect. The goal is not to build something important here. The goal is to feel what a longer session looks like.

03

Use /compact with specific instructions

Type a focused compact request instead of a vague one. For example:

/compact focus on the current goal, the file names we changed, and the design choices I still need to preserve
04

Check context again - before and after comparison

Run `/context` again and compare it to what you saw before the compact. The exact numbers matter less than the shape of the session and whether Claude still has the right priorities in view.

05

Practice /clear in a safe context

Understanding `/clear`: this clears the conversation history completely. Your CLAUDE.md still loads fresh, and your files stay exactly where they are. Try it now in this safe practice session.

/clear

Expected result

You checked context with the real tools, used /compact with a focused instruction, compared before and after, and practiced /clear in a safe session.

Key takeaway

  • Use /context to inspect session pressure, /compact to keep the important bits, and /clear when the session is no longer worth salvaging. Persistent rules belong in CLAUDE.md, not in your hope that Claude remembers everything.
The context window - why Claude goes weird... — NonDev Apps