iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
😎

Investigating the Number of Lines AI Coding Tools Like Cursor and Claude Code Can Read at Once

に公開

Motivation

I wanted to identify the cause of issues such as functions being regenerated in tools like Cursor or Roo Code.

Information by Provider

  • Information as of April 26, 2025
    Each provider differs in the number of lines they read from a file at a time.
  • Cline: Defined by file size (300KB)

https://github.com/cline/cline/blob/main/src/integrations/misc/extract-text.ts

  • Roo Code: Cline+; the default is 500 lines, and the number of lines is variable.

https://github.com/RooVetGit/Roo-Code/blob/main/src/integrations/misc/read-lines.ts

  • (Unofficial) Claude Code: 2000 lines
    There is no official source, but it seems that several investigations have been conducted by volunteers.
    I will omit the source for certain reasons.

  • Cursor: 500 lines => 250 lines

https://forum.cursor.com/t/read-files-in-chunks-of-up-to-250-lines/52597

  • Codex: The maximum number of lines is undefined, but in practice, an error occurs and a split request is issued when the context length is exceeded.

https://github.com/openai/codex/blob/main/codex-cli/src/utils/agent/agent-loop.ts

  • (Unofficial) Windsurf: 200 lines (however, it understands the overview through symbols)

Reddit
https://www.reddit.com/r/Codeium/comments/1jnvdzx/the_deal_breaker_for_me_right_now_all_llms/

  • GitHub Copilot Agent: Summarization is triggered at 500 lines or more.

https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode

Reddit
https://www.reddit.com/r/GithubCopilot/comments/1jo6ate/gemini_25_in_gh/

  • Devin: The number of lines for splitting is unknown, but it understands the context in a RAG format.

https://docs.devin.ai/work-with-devin/interactive-planning

What Does This Mean?

Even when using Gemini 1.5 Pro or Claude 3.7 Sonnet, the context is chopped up into the line counts mentioned above, which means that for files with a large number of lines, the long context isn't being fully utilized.

However, this is reasonable from a development perspective. Making it variable depending on the model is somewhat troublesome, and it could lead to negative perceptions if costs were to increase.

Also, when using Vector Indexing like Cursor does, small chunks can improve the accuracy of the search.

https://harshadsuryawanshi.medium.com/evaluating-the-optimal-document-chunk-size-for-a-rag-application-9cb482365bbf

While this approach might allow the system to grasp the overall structure, details like type information might be lost. It's a trade-off in that case.

Ultimately, it's possible that not making the retrieval of long code the default results in faster responses from the LLM, leading to a better user experience.

Evidence That Fragmented Context Hinders Performance

https://arxiv.org/pdf/2306.14893

By only keeping the last 512 tokens as code context (w/o out-of-window context), we can see that the performance is nearly the same as UniXcoder … which shows the importance of modeling long code context.

By only keeping the last 512 tokens as code context (without out-of-window context), we can see that the performance is nearly the same as UniXcoder... which shows the importance of modeling long code context.

Our experimental results demonstrate that code completion can benefit from taking longer context into consideration, and our LongCoder achieves superior performance

Our experimental results demonstrate that code completion can benefit from taking longer context into consideration, and our LongCoder achieves superior performance.

This essentially suggests that being able to maintain a longer context leads to better performance compared to fixed-length contexts.

Why Claude Code is Expensive

From the above, Claude Code reads a significantly higher number of lines than the others.
This is likely why the token consumption becomes astronomical.

There is also speculation that the prompt itself might be very heavily constructed...

Conclusion

From the above, we can draw the following conclusions:

How to Choose an Editor

If you want to write code with a large number of lines, or if you want to do "vibe coding" without worrying too much about the details:
=> Cline, Codex, Roo Code (with limits already modified), Claude Code

(It seems likely that one of the reasons OpenAI and Claude released their own CLI editors is related to this.)

Vibe coding is also recommended here:
https://zenn.dev/schroneko/articles/lets-play-with-vibe-coding

If you want to scan the entire folder and handle minor inconsistencies by fixing them yourself:
=> Cursor, Windsurf, etc.

Bonus

If you found this interesting, I would appreciate it if you could follow me 🙇
https://x.com/tesla0225

Past Articles

About what can currently be done with local LLMs:
https://zenn.dev/tesla/articles/df51e31d54f834
https://zenn.dev/tesla/articles/e3ec9fe5e15c9a

What is needed to use each editor, etc.:
https://zenn.dev/tesla/articles/33d196d17bf3bb
https://zenn.dev/tesla/articles/ade9883b2f62c9

Discussion