Code2Prompt CLI

A Rust CLI that packs a codebase into one prompt with a file tree, templates and token estimates

  • 7,743 ★ on the repository
  • Last commit
  • MIT
CLI

Extended access

Why this level

  • Reads every file in the chosen directory, so secrets may end up in the prompt
All reasons and checks

mufeedvh/code2prompt

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/code2prompt

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • Reads every file in the chosen directory, so secrets may end up in the prompt

This is third-party code. Review the repository files before installing.

What it does

Code2Prompt walks a project directory, honoring .gitignore and glob filters, and assembles file contents into a single LLM prompt. Output format comes from Handlebars templates, and the prompt can include git diffs, logs and branch comparisons. The tool estimates the result size in tokens and writes it to stdout, a file or the clipboard. Besides the CLI there is an interactive TUI, a Python SDK and an agent skill for scoped context gathering.

Who it is for. For developers who paste code into model chats or build their own agent pipelines.

Good fit when

  • You need to hand a model part of a project in one piece
  • You want to know upfront how many tokens the context takes
  • You need a diff or commit history in the prompt

Not a fit when

  • The agent already reads project files and a separate bundle is unnecessary
  • The project is too large for the context window even after filtering

Example request

Bundle the src folder without tests into a prompt and tell me the token count

Limitations

Token counts are estimates: the full rendered prompt is not re-tokenized. The skill requires installing the CLI separately. The tool itself is local; you pick the model.

How to disable. Remove the binary with cargo uninstall code2prompt or brew uninstall code2prompt, and delete the skill from the agent's skills folder.

FAQ

Does it respect .gitignore?

Yes, and you can add your own include and exclude patterns.

Can I call it from Python?

Yes, the code2prompt-rs package binds to the Rust core.

Discussion

No questions or reviews yet.

CLI tools
Official

An MCP server and CLI for code research: search and understand your project and all of GitHub with fewer tokens

MCP serverExtended access956Repository stars
Official

An open macOS app for code context engineering: an MCP server and agent orchestrator that helps agents understand a project before editing

MCP serverExtended access972Repository stars

A Rust CLI for TypeScript and JavaScript: dead code, duplicates, cycles, complexity and architecture boundaries from one graph, plus MCP and skills

CLIExtended access5.3KRepository stars

A local MCP server that indexes your code so the agent pulls the functions it needs instead of rereading whole files

MCP serverExtended access440Repository stars

CodeGraph (Rust)

codegraph-rust

A Rust code graph for agents: four MCP tools show what an edit will touch, how the architecture fits together and where the fragile spots are

MCP serverExtended access908Repository stars

A code-review CLI and plugin for agents: reads a git diff and writes line-level comments with context

CLIExtended access48.8KRepository stars

Comparison with similar tools

Entries that share the main search query, and how they differ.

EntryOfficialAuthenticationRepository starsMain difference
Code2Prompt (this entry)no7,743
CTXnonot required341an MCP server in one binary
llm-context: rule-based context packing for agentsno307a CLI and MCP server that use set rules to pack only the project

README in short

The README shows install via Cargo, Homebrew and pip, basic usage and saving to a file. A separate section covers the agent skill installed through the Skills CLI. It outlines the ecosystem: Rust core, CLI with TUI, Python SDK and MCP mode. It lists filtering, templates, git integration and token estimates. MIT licensed.

README badge

Report a problem

Foxx AICode2Prompt
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.