What Claude Code has in mind, and how to manage it
As a session grows longer, Claude Code loses track, repeats its mistakes and costs more. This lesson helps you understand what occupies the agent's working memory and decide, at each stage of a project, whether to keep going, lighten the load or move to a fresh session, so the agent stays precise without wasting your budget.
Lesson objective
By the end of this lesson, you will be able to explain what fills Claude Code's context window (instructions, CLAUDE.md, files read, command output, conversation), measure it with /context and choose between continuing, compacting, starting fresh or resuming a named session, taking cost into account.
Topics covered
- context window
- Claude Code
- session management
- token cost
- AI coding agent
In the glossary
Where it fits
Master context and CLAUDE.md
What does the agent know about my project at any moment, and how do I give it the right information without drowning it?
Lessons in this module
- What Claude Code has in mind, and how to manage it (this lesson)
- Write a CLAUDE.md that actually helps
What you will learn in this module
This lesson is part of the course Work with Claude Code on a real project: context, planning, review
- Explain what fills Claude Code's context window and manage it (/context, /clear, /compact, resuming and naming sessions), taking cost into account.
- Write a short, useful CLAUDE.md placed at the right level of the hierarchy (user, project, local, subdirectory, path-scoped rules), with imports if needed.
Related courses
- AI & DevelopmentJuniorSome basics are useful: introductory knowledge of the topic.
Build and ship a web app with an AI coding agent
2 hr 45 min
- AI & DevelopmentAdvancedRegular practice: you already use the tools or work on this topic.
Add a database, authentication and payments to your app
4 hr
- Product ManagementAdvancedRegular practice: you already use the tools or work on this topic.
Git for PMs: ship as a team without putting production at risk
3 hr 30 min