The Problem
Working with large files (15K+ lines) in Claude Code causes context overflow → 503 → permanent session death. I lost 20+ sessions trying to migrate a 15K-line Python app from SimpleGUI to WebView.
The Solution
A 6-principle methodology that finally made it work:
- Protect the Main Agent — delegate all heavy reading/writing to subagents (Agent tool). If a subagent 503s, your session survives.
- Save Early, Save Often — commit after every unit of work. Assume the session can die anytime.
- Minimize Context Consumption — only read what you need, use line ranges, keep output concise.
- Break Big Tasks into Small Pieces — decompose until each piece fits in one subagent call.
- Reserve Context Buffer — don't push to the limit.
- Design for Session Continuity — progress files + descriptive commits so new sessions resume seamlessly.
Core idea
Treat the main agent as a project manager, not a developer. It never reads the big file directly. It delegates focused tasks to disposable subagent workers.
Full guide + templates
I published a complete guide with a copy-paste CLAUDE.md snippet and progress tracker template:
GitHub: https://github.com/leeluling/large-codebase-survival
Hope this helps others dealing with the same pain!
The Problem
Working with large files (15K+ lines) in Claude Code causes context overflow → 503 → permanent session death. I lost 20+ sessions trying to migrate a 15K-line Python app from SimpleGUI to WebView.
The Solution
A 6-principle methodology that finally made it work:
Core idea
Treat the main agent as a project manager, not a developer. It never reads the big file directly. It delegates focused tasks to disposable subagent workers.
Full guide + templates
I published a complete guide with a copy-paste CLAUDE.md snippet and progress tracker template:
GitHub: https://github.com/leeluling/large-codebase-survival
Hope this helps others dealing with the same pain!