I dumped my entire codebase into Claude as context, which was about 150,000 tokens that fit comfortably in the 200k token context window. Then I asked “Help me find the bug in our authentication flow.”
What I got back was completely generic advice that didn’t address anything specific about my actual code. Totally useless.
So I tried again with a completely different approach. I included only the authentication-related files, which came to just 3,000 tokens total. Claude immediately spotted the issue: our token refresh was failing because we were checking token expiration before actually setting the new refresh token. I fixed it in two minutes.
Same AI model. Same exact bug. Different context size. Completely different quality of response.
Stop maxing out your context window. You’re actively making your results worse.
Table of contents
Open Table of contents
What Context Windows Actually Are
The context window is the maximum amount of text that an AI can “see” and process at once. GPT-4 has a 128k token context window, Claude has 200k, and Gemini has a massive 1 million token window. As a rough approximation, tokens are about 4 characters each, which means a 200k token context can hold roughly 150,000 words or an entire novel.
Everyone assumes that bigger is automatically better, so they dump absolutely everything they have into the context. This is completely wrong.
The Lost in the Middle Problem
When you provide huge contexts, the AI pays very close attention to the beginning and the end but glosses over everything in the middle. This is exactly like asking a human to read a 500-page document to answer one specific question - they’ll remember the introduction and conclusion clearly, but details from page 247 are going to be pretty foggy.
When you dump your entire codebase into the context, the AI sees the file structure at the start and your specific question at the end. But that critically important function that’s buried in file 47 somewhere in the middle? The AI completely missed it during processing. You gave it 150,000 tokens to work with but it only effectively used maybe 20,000. The rest was just noise that diluted its attention.
Performance Degrades With Size
Bigger contexts make everything slower and noticeably worse in quality. Processing 200,000 tokens takes dramatically longer than processing just 5,000 tokens. More text in the context means more noise for the AI to filter through, and it has to guess what information actually matters, which it sometimes gets completely wrong. When you dump everything into the context, you’re diluting the AI’s attention across a massive amount of irrelevant information.
I see people paste entire documentation sites, complete codebases, or full Slack channel histories. The answer they needed was hiding in a 10-line function.
What Actually Works
Be ruthlessly specific about what you include: Don’t dump your entire codebase when you only need the files directly related to the problem you’re debugging. Don’t paste an entire hour-long meeting transcript when you only need the key decisions that were made. Don’t include your complete database schema when you’re only asking about three specific tables.
Front-load the most important information: Always put your most relevant information right at the beginning of the context where the AI pays the most attention. Structure your prompts in this specific order: first the most important context, then supporting details that add nuance, and finally your actual question at the end. Never reverse this order.
Real Examples
Bad approach to debugging: You paste your entire 50-file React application and ask “Why is login broken?” The result is completely generic form validation advice that doesn’t address your actual problem.
Good approach to debugging: You include only LoginForm.tsx (100 lines), useAuth.ts (50 lines), and the specific error message you’re seeing. The result is that the AI immediately identifies the actual bug and you fix it in 2 minutes.
Bad approach to documentation: You paste the entire AWS documentation covering Lambda, API Gateway, S3, DynamoDB, CloudWatch, and IAM, then ask “How do I set up an API?” The result is an overwhelming wall of text with nothing actually actionable.
Good approach to documentation: You say “I want to build a REST API that stores and returns data” and paste only the Lambda and API Gateway quickstart guide (about 2k tokens), then ask “Walk me through this step by step.” The result is clear, immediately buildable steps.
When Big Context Helps
There are definitely legitimate use cases where bigger context genuinely helps. When you’re summarizing a comprehensive 100-page report, you probably do need to include the entire document. Finding patterns across multiple files requires having those files available for comparison. Comparing different versions of code or performing diffs benefits from having both versions in context simultaneously.
But even in these cases, you probably don’t need to max out the entire context window.
How to Trim Context Intelligently
For code debugging: Include only the specific files that are directly related to your question, plus any relevant dependencies they import. Skip test files, configuration files, and build scripts entirely unless you’re specifically debugging those particular components.
For documentation and long-form content: Extract just the key sections that matter instead of including everything. Provide a brief 30-token summary of background context rather than pasting 3,000 tokens of full detail. Reference other sections by name if the AI needs to know they exist.
For conversations and discussions: Provide a concise summary of the previous context rather than including the entire thread. Include specific relevant quotes where they matter, but don’t paste the complete conversation history.
The RAG Alternative
If you’re constantly working with large knowledge bases that would overwhelm your context window, you should seriously consider using RAG (Retrieval-Augmented Generation). The approach is to store your documents in a searchable vector database, search for only the relevant chunks for each specific question, and put only those relevant chunks into the context. This way you never max out your context window and the AI always gets the most relevant information. I wrote a detailed guide on RAG here.
My Rule
Before adding anything to your context, ask yourself this simple question: “Would a knowledgeable human actually need to read this entire thing to answer my specific question?” If the answer is no, then don’t include it.
A human developer debugging a login issue doesn’t sit down and read through the entire codebase line by line. They look specifically at the login form component and the authentication logic that powers it. A human answering a question about AWS Lambda doesn’t read all of AWS documentation from start to finish. They look at the Lambda docs and maybe the API Gateway docs if those are relevant.
Give the AI the same courtesy you’d give a human expert.
The Real Takeaway
Context windows are getting bigger and bigger, from 200k to 1 million to probably 10 million tokens someday. This is genuinely great progress. But bigger context windows don’t mean you should actually use all that space for every single query.
Think of a 200k token context window like a warehouse. You can store a huge amount of stuff in there. But you wouldn’t bring the entire warehouse with you to every meeting. You’d bring only what you actually need for that specific conversation.
Be selective and intentional about what you include. Give the AI exactly what it needs to answer your specific question, not absolutely everything you have available. Your results will be noticeably better, your responses will come back faster, and your answers will be significantly more accurate.
Stop maxing out your context. Start using it intelligently.