mufeedvh/code2prompt

★ 7,679⑂ 447

A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting.

About mufeedvh/code2prompt

mufeedvh/code2prompt is an open-source project on GitHub, mainly written in Rust. A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting. It currently holds 7,679 stars and 447 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).

Project Overview

AI Homed tracks it on the AI Prompt Engineering board.

GitHub Repository Details

Repository mufeedvh/code2prompt · default branch - · size 0 KB · watchers 0 · source: GitHub REST API and repository README

README

https://github.com/mufeedvh/code2prompt/blob/HEAD/Code2prompt

Convert your codebase into a single LLM prompt.

WebsiteDocumentationDiscord

License Crates.io PyPI CI Discord Docs.rs Crates.io Downloads GitHub Stars

---

https://github.com/mufeedvh/code2prompt/blob/HEAD/code2prompt demo

Flow Diagram

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

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
https://github.com/mufeedvh/code2prompt/blob/HEAD/Rust Core Badge | 💻 CLI Tool
https://github.com/mufeedvh/code2prompt/blob/HEAD/CLI Badge | 🐍 Python SDK
https://github.com/mufeedvh/code2prompt/blob/HEAD/Python SDK Badge | 🤖 MCP Server https://github.com/mufeedvh/code2prompt/blob/HEAD/MCP Server Badge | | :---: | :---: | :---: | :---: | | 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:

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

Star History Chart

📜 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:

GitHub Stars & Activity

7,679Stars
447Forks
0Open issues
RustLanguage

GitHub Popularity

GitHub stars7,679
Forks447
Open issues0
Primary languageRust
License-
Stars gained today0
Created-
Last pushed-

Trending History

Trending statusnot on today's boards

Related AI Projects

1

Open-Less / openless

Rust★ 3,604⑂ 332
2

f / prompts.chat

HTML★ 170,803⑂ 21,945
3

DietrichGebert / ponytail

JavaScript★ 142,816⑂ 7,659
4

microsoft / generative-ai-for-beginners

Jupyter Notebook★ 120,121⑂ 63,239
5

JuliusBrussee / caveman

Go★ 106,886⑂ 6,182
6

dair-ai / Prompt-Engineering-Guide

MDX★ 78,489⑂ 8,630
7

headroomlabs-ai / headroom

Python★ 73,186⑂ 5,631
8

asgeirtj / system_prompts_leaks

JavaScript★ 67,787⑂ 11,015

More AI Rankings