7,501 stars · MIT · v4.2.0 (2025-12-11, ungh) · Track this in Scout
Turns a folder of code into one templated prompt with a source tree and a token count, respecting the ignore rules already in the project.
▶Repo detailsthe review · specs · pros & cons · install
What it is
code2prompt is a Rust command-line tool that walks a directory, respects the ignore rules already in the project, and writes the result as a single templated prompt. Templates control the shape of the output, so the same codebase can be formatted differently for different questions.
What it is good for. Anyone who asks an assistant about their own code and keeps getting answers based on half the picture. It is also useful for writing documentation from a codebase, or for producing a review request that actually contains the files being reviewed.
- It obeys
.gitignore, so build output and dependency folders do not end up in the prompt by accident. - The token count is printed before you send anything, which is the difference between a question that fits and a question that is silently truncated.
- Filters by file type and by path, so you can send only the parts that matter.
- A big codebase produces a prompt too large for any model. The filters are not optional on a real project; they are the job.
- The newest release, v4.2.0, is dated 11 December 2025, while code landed on 29 June 2026 — three months ago.
- It prepares a prompt and stops. It does not talk to any model, so you still need something to paste it into.
- yamadashy/repomix
28,481 stars, the same job in Node.js with more output formats and a hosted web version.
Track this in Scout - cyclotruc/gitingest
15,341 stars; you change hub to ingest in a GitHub address and get the extract in a browser, with no install at all.
Track this in Scout - simonw/files-to-prompt
2,765 stars, the simplest version of the idea, but its last code landed 19 February 2025, nineteen months ago.
Track this in Scout
# with Rust installed cargo install code2prompt # or on macOS brew install code2prompt code2prompt . --exclude "node_modules,dist,*.lock"


