-
Notifications
You must be signed in to change notification settings - Fork 108
Description
When files are read or edited, Claude injects line number information. These line numbers take up context, and they can confuse the model because in most operations the line number information isn't even useful. In fact, having line information encourages the model to read the file again at line offsets when the information is already in the context:
1→content of line 1
2→content of line 2
3→content of line 3
...If you have a 1,000-line file, then on average you have three characters plus the Unicode arrow in addition to each line, or about 2-3 extra tokens. That means we add about 2,000 or 3,000 tokens to the context for a 1,000-line file, and then that content sits there forever, bloating the token overhead for every single future request.
Notably, Cline does not use line numbers, and I have experimented in the past with Roo Code, and it does not need line numbers either. The brief testing I've done with Claude code indicates that it works just fine without them also:
patch
This patch (near 3595,993) removes line numbers, and would be a useful option in the miscellaneous section:
- old:
if(J.length>=6)return`${J}→${G}`;return`${J.padStart(6," ")}→${G}`
- new:
return G