My vibe coded project hit 50K lines and Claude started hallucinating functions. Fixed it. Here's how.
Hit a wall that I think a lot of people here will recognise.
Started a project, Claude was flying. Added features for 3 weeks. Somewhere around 50,000 lines the whole thing started breaking down. Claude would suggest functions that didn't exist. Reference files it hadn't seen. Confidently import things from the wrong module.
I thought I was doing something wrong. Tried better prompts. Tried breaking the project into smaller files. Tried clearing context and starting fresh every session.
Nothing worked consistently.
Eventually figured out the real problem:
I was sending Claude 80,000 tokens of raw source code every session. The whole repo. Most of it completely irrelevant to what I was actually asking. Claude was getting lost in the noise.
The fix was obvious once I saw it.
Don't send the whole codebase. Send the map.
Function signatures. Import relationships. Type definitions. The skeleton of what exists and where — not the full implementation.
2,000 tokens instead of 80,000.
Results across my projects:
→ Hallucinated function references: basically stopped happening
→ Claude finds the right file: 13% → 78% of the time (measured this properly)
→ Number of prompts to complete a task: cut by 40%
The workflow now:
- Run a scan of the codebase → generates a compact signature map
- That map auto-injects before every Claude / Cursor session via MCP
- Claude orients on the map first, then reads full files only when needed
Claude Code specifically became way more reliable after this. It stops guessing where things are.
If your vibe-coded project is growing and Claude is starting to lose the plot — this is probably why. The context window isn't the problem. What you're putting in it is.
Built a small CLI that automates the scan/inject part if anyone wants it: github.com/manojmallick/sigmap
Genuinely curious if others hit this at the same project size or earlier. What was the breaking point for you?