22. Context Window Management
Context limits are real. Learn to work within them or expand them creatively.
(Spoiler: "Just paste the entire codebase" doesn't work. Context limits are the AI equivalent of "too many tabs open". We've all been there. 🗂️)
Context Window Sizes
- GPT-4 Turbo: 128K tokens (~96K words)
- Claude 3.5: 200K tokens
- Gemini Pro: 1M tokens (largest!)
- GitHub Copilot: ~8K tokens (IDE context)
Strategies When Context is Too Small
- 1. Chunking: Break large files into sections, process separately
- 2. Summarization: Summarize early conversation, keep summary as context
- 3. RAG (Retrieval): Use vector DB to fetch only relevant parts
- 4. Switch Models: Use Claude/Gemini for large context needs
Best Practices
- ✓ Include only relevant files in prompts
- ✓ Use @-mentions (Cursor) to control context explicitly
- ✓ Summarize previous conversation when approaching limit
- ✓ For multi-file edits: focus AI on one file at a time