Managing Context in Claude Code
How Claude Code finds its own context, when to add files manually, how to use images as input, and keeping your context window clean.
How context works in Claude Code
Most AI coding tools wait for you to hand them everything. You tag files, highlight code blocks, and manually build the picture before the model can help. Claude Code works differently.
Claude Code is an agent. When you give it a task, it reads files, searches your codebase, and pulls in whatever it needs on its own. You don't have to point it at every relevant file. It goes looking.
Here is what that means for your workflow as an operator. Say you're prepping a client deliverable and you ask Claude Code to update a pricing table across your project. In a tool like Cursor, you'd need to tag each file that contains pricing references. In Claude Code, you describe the task in plain English and the agent searches your codebase, finds every file that references pricing, and makes the changes.
The context window is where everything lives. Every file Claude Code reads, every search result it finds, and every message you send fills up a shared memory space called the context window. Think of it as a whiteboard with limited room. The more you add, the closer you get to filling it up.
The practical takeaway: Claude Code does most of the context gathering for you. Your job is to give clear instructions and let the agent handle the searching. When the whiteboard gets full, you have tools to manage it.
Adding context manually
There are times when you want to point Claude Code at something specific. A file it hasn't read yet. A folder full of templates. A reference document your client sent over.
The @ symbol is your shortcut. Type @ in the prompt and Claude Code opens a search interface. Start typing a filename or folder name and results appear. Use the arrow keys to navigate, then press Enter to tag it into your context.
You: Look at @client-brief.md and rewrite the
executive summary to match our tone guide
in @templates/voice-standards.md
Tag files when you know exactly what's needed. If you're working on a specific deliverable and the relevant files aren't in the current directory, tagging them saves Claude Code the search time. It also guarantees the right files get read, not similar ones.
Tag folders for broader context. Working across a client engagement with dozens of documents? Tag the entire folder. Claude Code will read what's relevant from it.
> When to tag vs. when to let Claude Code search: Tag when you have a specific file in mind. Let Claude Code search when you want it to find patterns or references across a larger codebase. For most operator workflows, describing what you need in plain English is enough.
Deploying images as input
Claude Code reads images. The underlying Claude 4 models are multimodal, which means you can feed in screenshots alongside text and get responses that account for what's on screen.
Drag and drop with Shift held down. To add an image, hold Shift on your keyboard and drag the file into the Claude Code terminal. You'll be asked to approve the model reading the image. Confirm it and the screenshot becomes part of your context.
Here is where this gets practical for operators:
- UI feedback. Screenshot a client's dashboard, drop it into Claude Code, and ask it to identify layout problems or suggest copy improvements. No need to describe what you're looking at in words.
- Error debugging. Hit an error message in a browser? Screenshot it, drop it in, and ask Claude Code what went wrong. Faster than copying and pasting stack traces.
- Design review. Pull a screenshot from a staging environment and ask Claude Code to compare it against your brand guidelines document already in context.
You: [dropped screenshot of client landing page]
Compare this layout against @brand-guide.md
and list what doesn't match our standards
The model reads the visual content and cross-references it with whatever documents you've tagged. This cuts back-and-forth between tools when you're managing client-facing deliverables.
Keeping your context clean
As you work, the context window fills up. Every file read, every response generated, every image dropped in takes up space. When the window gets too full, Claude Code's responses start losing quality because older context gets pushed out.
Two commands handle this.
/compact shrinks your session with a summary. Type /compact and Claude Code condenses everything in your current context into a shorter version. Key decisions, file states, and task progress get preserved. The filler gets removed. You keep working without starting over.
/clear resets everything. Type /clear and the session wipes clean. No memory of what came before. This is a fresh start.
Here is the pattern that works for most operator workflows:
| Situation | Command | What happens |
|---|---|---|
| Context is getting large, same task continues | /compact | Session shrinks, key info preserved |
| Switching to a different client engagement | /clear | Full reset, clean slate |
| Claude Code responses feel off or repetitive | /compact | Frees space, often fixes quality |
| Starting your workday | /clear | Begin fresh with no leftover state |
Use /compact often. Most operators don't realize they should run it proactively, before quality drops. If you've been working for 20+ messages on the same task, compact. It costs nothing and keeps responses sharp.
The right amount of context
There's a temptation to front-load everything. Tag every file, paste every document, add every screenshot before typing your first instruction. That approach fills your context window with information Claude Code may never need and leaves less room for the actual work.
Give Claude Code the task, not the library. Start with a clear instruction and the minimum context needed. If Claude Code needs more, it will go find it. If it can't find something, it will ask you.
A practical example: you're building a weekly client report. Instead of tagging all 15 data files upfront, try this:
You: Create a weekly performance report for
Acme Corp using the data files in
/reports/acme/week-12/
Claude Code reads the folder, identifies the relevant files, and builds the report. You tagged one folder instead of 15 files. The agent did the sorting.
Three rules for context management as an operator:
- Start lean. Give the instruction and one or two key files. Let Claude Code search for the rest.
- Compact regularly. Every 15-20 messages or when you notice response quality dipping.
- Clear between clients. Each client engagement gets a fresh session so context from one doesn't bleed into another.
The operators who get the most from Claude Code aren't the ones who manually tag everything. They're the ones who write clear instructions and trust the agent to do what agents do best: find what's relevant and get to work.