Tech Update / Adventures with Claude Code #27

The context is full – /context, /compact and /clear

After two hours of work Claude suddenly gets forgetful, repeats itself or misses things it knew earlier. That's rarely a model problem. Usually the session's memory is simply full.

The context is everything Claude currently "has in mind": your messages, files it read, command output, tools. It's limited, and the fuller it gets, the worse the results.

🔍 /context: Where did the space go?

The command shows how full the context is and what's using it. The culprits are often surprising: huge log output, too many MCP servers (part 5) or a bloated CLAUDE.md (part 4).

🧹 /clear: New task, new session

Switching topics? Clean up. /clear empties the context completely. Anything that should apply permanently is in your CLAUDE.md anyway.

🗜️ /compact: Summarise instead of throwing away

In the middle of a long task, /compact helps. Claude summarises the history so far and continues with the short version. You can tell it what matters:

/compact Keep the changed files and the open login bug

🧭 Also: sub-agents as outsourcing

A broad investigation ("Where is the invoice number used?") can be handled by a sub-agent (part 1) in its own context. Only the result comes back, not the hundred files it read.

A word of caution:

After /compact, details are condensed. Exact line numbers or wording should be re-read from the file. And even with automatic compaction, it pays to pick the moment yourself instead of being surprised mid-change.

My rule of thumb:

  • New task? /clear.
  • Same task, but long? /compact with a note on what must stay.
  • Claude getting erratic? Look at /context first, then decide.

← Back to overview