CC - Context Management
Once we have some code, we can make targeted changes by giving Claude more specific context. Here's some examples of how to do that in the terminal:
Describe what you see: Claude has already read your codebase during this session, so for many edits you can just describe the target naturally: "the welcome heading in the Home page" or "the Bitovi logo in the section we just added."
Provide file paths and line numbers: If there is a particular file or section of code you don’t like, you can paste in relative paths to reference those files in your conversation. You can also use line numbers or function names.
Provide screenshots: Let Claude see what you are seeing. Claude Code will let you paste images into the terminal.
The more targeted and specific the context you give Claude, the more precise its edits will be.
What is context?
LLMs take text in and return text back. That’s it. They don’t have any memory of previous requests. Since an LLM has no memory, the agent you use to interact with it, Claude Code for us, has to send a lot of information with every request, including:
List of tools available (read, write, fetch)
Special context documents (instructions, plans)
Every message both sent and received this session
Context is the word we use to describe all of this information an LLM uses to create a response.
Technically, LLMs can have a processing cache, which is a type of memory, but it's just an optimization that doesn’t change the core of how this works. The entire history still has to be sent with every request.
Context for AI isn’t all that different from context for a human. If I asked you, “Who do you want to win?” you currently don’t have enough context to answer the question. What am I talking about? You would be confused. Unless of course we were standing ringside at a World Robot Boxing match, in which case you would have sufficient context to understand the question, and the answer would obviously be “Atom”.
If you start a fresh conversation and ask your AI to “make a red one,” who knows what you’ll get back as there is no context. If you’ve had been working with your AI to make little UI badges, that history will be included in the request and you will most likely get a red UI badge.
Meta documents
There are several different documents that can be created to provide context, and I encourage you to learn more. For now, the most bang for the buck is using Claude Code’s /init command. This will review your codebase and create summary files for future sessions.
When this process is done, you will have a CLAUDE.md file that contains a summary of your code base. This is a special file that is loaded into context automatically, for every session within this codebase.
✏️ Run this command
/initBuilding context for best results
Context engineering is a complex topic, but here’s the really short version. Managing your context properly will:
Give you AI enough information to provide better answers
Limit information to keep your AI focused on the topic
Send less data to process so you answers will be quicker
Use less tokens, letting you do more with the same usage limit
To check the context, use the /context command:
✏️ Run this command
/contextUnique sessions
Every message you send and receive during each session is included with every request, so when you change topics or tasks, use /clear to start a new session with an empty context.
✏️ Run this command
/clearOnce you’ve started a new chat session, check your context again. You might notice its a bit smaller. We didn’t built up that big of a context today, but in real-world work the difference will be significant.
Remember that CLAUDE.md file created earlier is automatically loaded. We did clear our previous chat history, but the current chat will have details about our code because of that file.
✏️ Run this command
/contextClaude Code will store your previous sessions, so it is possible to return to a session with the /resume command. We will talk about it more in the next section.
Next Steps