code2prompt
App Listed
A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting.
- Downloads
- 2,317
- Dependents
- Not applicable
- Stars
- 7,756
- Forks
- 458
- Contributors
- 36
- Commits
- 712
- Latest release
- 4.3.0 ·
About
Convert your codebase into a single LLM prompt.
Website • Documentation • Discord

Code2Prompt is a powerful context engineering tool designed to ingest codebases and format them for Large Language Models. Whether you are manually copying context for ChatGPT, building AI agents via Python, or running a MCP server, Code2Prompt streamlines the context preparation process.
⚡ Quick Install
Cargo
cargo install code2prompt
To enable optional Wayland support (e.g., for clipboard integration on Wayland-based systems), use the wayland feature flag:
cargo install --features wayland code2prompt
Homebrew
brew install code2prompt
SDK with pip 🐍
pip install code2prompt-rs
🚀 Quick Start
Once installed, generating a prompt from your codebase is as simple as pointing the tool to your directory.
Basic Usage: Generate a prompt from the current directory. Output goes to stdout by default; use -c to copy it to the clipboard.
code2prompt .
Save to file:
code2prompt path/to/project --output-file prompt.txt
🤖 Agent Skill
Teach your coding agent to install and use code2prompt for repository navigation and scoped context gathering with the Skills CLI:
npx skills add mufeedvh/code2prompt
Read the full README
The code2prompt skill helps agents reduce exploration
round trips: inspect a compact map of functions and classes using sem-core, then
read relevant source files and tests together. It includes a map template and
installation instructions for the optional entity-map feature, with a directory
map fallback for standard builds. The code2prompt CLI is installed separately.
The installer adds the skill folder and its template to your agent. It may clone the repository temporarily to retrieve them; the rest of the repository is not installed as part of the skill.
To install it globally for a specific agent, for example Codex:
npx skills add mufeedvh/code2prompt --skill code2prompt --agent codex --global
🌐 Ecosystem
Code2Prompt is more than just a CLI tool. It is a complete ecosystem for codebase context.
| 🧱 Core Library | 💻 CLI Tool | 🐍 Python SDK | 🤖 MCP Server |
|---|---|---|---|
The internal, high-speed library responsible for secure file traversal, respecting .gitignore rules, and structuring Git metadata. | Designed for humans, featuring both a minimal CLI and an interactive TUI. Generate formatted prompts, track token usage, and outputs the result to your clipboard or stdout. | Provides fast Python bindings to the Rust Core. Ideal for AI Agents, automation scripts, or deep integration into RAG pipelines. Available on PyPI. | Run Code2Prompt as a local service, enabling agentic applications to read your local codebase efficiently without bloating your context window. |
📚 Documentation
Check our online documentation for detailed instructions
✨ Features
Code2Prompt transforms your entire codebase into a well-structured prompt for large language models. Key features include:
- Terminal User Interface (TUI): Interactive terminal interface for configuring and generating prompts
- Smart Filtering: Include/exclude files using glob patterns and respect
.gitignorerules - Flexible Templating: Customize prompts with Handlebars templates for different use cases
- Automatic Code Processing: Convert codebases of any size into readable, formatted prompts
- Token Estimates: Estimate prompt size using parallel per-file token counts and estimated template overhead, including optional line numbers. The full rendered prompt is not re-tokenized, and the estimate excludes the JSON output envelope.
- Smart File Reading: Simplify reading various file formats for LLMs (CSV, Notebooks, JSONL, etc.)
- Git Integration: Include diffs, logs, and branch comparisons in your prompts
- Blazing Fast: Built in Rust for high performance and low resource usage
Stop manually copying files and formatting code for LLMs. Code2Prompt handles the tedious work so you can focus on getting insights and solutions from AI models.
Alternative Installation
Refer to the documentation for detailed installation instructions.
Binary releases
Download the latest binary for your OS from Releases.
Source build
Requires:
git clone https://github.com/mufeedvh/code2prompt.git
cd code2prompt/
cargo install --path crates/code2prompt
⭐ Star Gazing
📜 License
Licensed under the MIT License, see LICENSE for more information.
Liked the project?
If you liked the project and found it useful, please give it a :star: !
👥 Contribution
Ways to contribute:
- Suggest a feature
- Report a bug
- Fix something and open a pull request
- Help me document the code
- Spread the word
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- Required
- Binds native code: libgit2-sys, libz-sys
- Python bindings
- No Python binding crate found
- License
- MIT
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting. |
2,317 binary downloads per release | Not applicable | 7,756 | 4.3.0 | GPU support unknown | Binds native code: libgit2-sys, libz-sys | MIT |
|
Right-size LLM models to your system hardware. Interactive TUI and CLI to match models against available RAM, CPU, and GPU. |
3,821 binary downloads per release | Not applicable | 38,787 | 1.1.20 | Metal | No native code found | MIT |
|
Ship your code, on autopilot. An open source agent that lives on your machines 24/7 and keeps your apps running. 🦀 |
19,860 binary downloads per release | Not applicable | 1,859 | 0.3.88 | GPU support unknown | Binds native code: tree-sitter, tree-sitter-language, tikv-jemalloc-sys (feature jemalloc) | Apache-2.0 |
|
LSP-AI is an open-source language server that serves as a backend for AI-powered functionality, designed to assist and empower software engineers, not replace them. |
2,314 binary downloads per release | Not applicable | 3,210 | 0.7.0 | CUDA, Metal | Binds native code: tree-sitter, tree-sitter-language, llama-cpp-sys-2 (feature cuda). Build uses a native toolchain: cc | MIT |
|
An open protocol that gives AI agents a secure, sandboxed place to run code and use tools — with lean context usage. AXP works alongside MCP |
Not measured | Not applicable | 3 | Not measured | Not measured | Not measured | Apache-2.0 |
|
Rust Token Killer - High-performance CLI proxy to minimize LLM token consumption |
2,594 binary downloads per release | Not applicable | 85,939 | 0.42.4 | GPU support unknown | Binds native code: libsqlite3-sys | Apache-2.0 |
|
TensorZero is an open-source LLMOps platform that unifies an LLM gateway, observability, evaluation, optimization, and experimentation. |
35 downloads over 30 days | Not applicable | 11,705 | 0.0.0 | GPU support unknown | No native code found | Apache-2.0 |
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- The check holds no value for Homebrew installs on request over 365 days, Repology repository families, Docker pull growth over 90 days. A gate that lacks its signal does not pass.
What else the check found
- The last activity is on 3 Nov 2026, 6 days ago. The rules expect an update within 365 days. Dormancy rule
Not measured: Homebrew installs on request over 365 days, Repology repository families, Docker pull growth over 90 days.
Exact rules: Listed, Featured app. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: app: E = 365 daysdormancy: last activity 2026-11-03, 6 days ago, E = 365: activefeatured: not featured: unknown homebrew_on_request_365d, repology_families, docker_pull_growth_90dlisted: listed: no archive, new or featured rule applies
Crates2 crates
- code2prompt Primary
- code2prompt_core
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the GitHub repository description
- crates.io database dump, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub releases, fetched
- GitHub contributors, fetched
Adoption2,317 binary downloads per release4 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | Not measured | Yes | ||
| New dependents (365 days) | Not measured | Yes | ||
| Peak active dependents | Not measured | Yes | ||
| Active dependents as a share of the peak | Not measured | Yes | ||
| Binary downloads per release | 2317 | GitHub releases | Yes |
MaintenanceLatest human commit: 6 days ago4 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2026-11-03 | GitHub repository | Yes | |
| Latest release | 2026-06-13 | crates.io database dump | Yes | |
| First release | 2024-03-11 | crates.io database dump | Yes | |
| Latest version | 4.3.0 | crates.io database dump | No | |
| Days the oldest outside issue waits for a reply | 482 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 17 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | No | |
| Published docs | Not measured | Yes | ||
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityNot measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | Not measured | Yes | ||
| RustSec unmaintained advisory | Not measured | Yes | ||
| Deprecation notice | Not measured | Yes | ||
| Deprecated requirement | Not measured | Yes |
Distribution9 releases, 439 downloads over 30 days6 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 9 | crates.io database dump | No | |
| Downloads over 30 days | 439 | crates.io database dump | No | |
| Binary downloads over the last 3 releases | 6952 | GitHub releases | Yes | |
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | Not measured | Yes | ||
| Crate deleted from crates.io | Not measured | Yes |
Repository7,756 stars, 458 forks, 36 contributors, 712 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 7756 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 458 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 36 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 712 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | MIT | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | GPU support unknown | crates.io database dump | No | |
| What shows each backend | no dependency or feature matches a backend row | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | Binds native code: libgit2-sys, libz-sys | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | Not measured | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.
