code2prompt is a command-line tool that turns a code repository into a single prompt for a large language model. It writes out the directory tree and the source files in one text block, so the model can read the project in one pass. It is aimed at developers who want to ask an AI assistant questions about their code without copying files by hand.
The tool supports prompt templates, so the output can be wrapped in custom instructions. It also counts tokens, which helps when checking whether a project fits within a model's context limit. It runs from the terminal and is released under the MIT license, with the source code public on GitHub.
Alternatives to code2prompt
Products that do a similar job in AI Tools.
aider
terminal-based AI pair programmer that edits code in your git repo
OpenHands
AI software agent that writes and runs code from natural language requests
oh-my-pi
Command-line coding agent with editor integration built in
openclaude
command-line coding agent that works with many model providers
Nasiko
Open-source runtime for hosting and coordinating AI agents from a command line
openscience
Command-line AI workbench for scientific research work
gemini-cli
Terminal agent for working with Google's Gemini models
last30days-skill
Agent skill that researches a topic across Reddit, X, YouTube and more