Repomix — Pack Any Repo into One AI-Ready File
Packs your entire codebase into a single AI-friendly file with token counting, security scanning, and multiple output formats. Perfect for LLM context.
What it is
Repomix is a developer tool that packs an entire repository into a single, AI-optimized file. When you need to feed a codebase to an LLM for analysis, code review, or documentation generation, Repomix creates a structured output containing all relevant files with token counts, file metadata, and security scanning.
Repomix is designed for developers working with AI coding assistants who need to provide full project context. It supports Markdown, XML, and plain text output formats, and can process both local repositories and remote GitHub repos.
How it saves time or tokens
Manually copying files into an LLM prompt is tedious and error-prone. Repomix automates this by intelligently selecting files, respecting .gitignore patterns, counting tokens, and scanning for secrets before output. The structured format maximizes LLM comprehension while minimizing wasted tokens on irrelevant files. You can also filter by file type or directory to focus the context on what matters.
How to use
- Run directly with npx:
npx repomix@latestin your project directory. - Or install globally:
npm install -g repomix. - For remote repos:
npx repomix --remote https://github.com/user/repo. - Choose output format:
npx repomix --output repomix-output.md --style markdown.
Example
# Pack current directory
npx repomix@latest
# Pack a remote GitHub repo
npx repomix --remote https://github.com/user/repo
# Output as Markdown with token count
npx repomix --output repomix-output.md --style markdown
# Filter specific directories
npx repomix --include 'src/**' --output context.md
# Exclude test files
npx repomix --ignore 'test/**,*.test.ts'
Related on TokRepo
- AI tools for coding -- explore tools that enhance AI-assisted development workflows.
- Automation tools -- discover CLI tools for developer productivity.
Common pitfalls
- Large repositories may produce output that exceeds LLM context windows. Use
--includefilters to focus on relevant directories. - Repomix scans for secrets but is not a replacement for dedicated secret scanning tools. Always review output before sharing with external LLM services.
- Binary files (images, compiled assets) are skipped by default. If you need to reference them, mention them in your prompt separately.
Frequently Asked Questions
Repomix supports Markdown, XML, and plain text output formats. Markdown is the most common choice for LLM consumption. Each format includes file paths, content, and metadata in a structured layout.
Yes. Use the --remote flag with a GitHub URL: `npx repomix --remote https://github.com/user/repo`. Repomix clones the repository temporarily, processes it, and outputs the result without leaving files on disk.
Yes. Repomix includes token counting in its output, showing the total token count for the packed file. This helps you verify that the output fits within your target LLM context window before pasting.
Repomix includes a security scanner that detects potential secrets (API keys, tokens, passwords) in files. It warns you about detected secrets and can be configured to exclude sensitive files automatically.
Yes. Repomix is language-agnostic. It packs any files in a repository regardless of programming language. The tool is written in Node.js but processes Python, Go, Rust, and any other project type.
Citations (3)
- Repomix GitHub— Repomix packs repositories into AI-friendly files
- Anthropic Claude Documentation— Token counting for LLM context window management
- OpenAI Cookbook— Best practices for providing code context to LLMs
Related on TokRepo
Source & Thanks
- GitHub: yamadashy/repomix
- License: MIT
- Stars: 22,000+
- Maintainer: @yamadashy
Thanks to @yamadashy for creating the most popular repo-to-LLM tool, solving the "how do I give my AI the full codebase" problem elegantly.
Discussion
Related Assets
NAPI-RS — Build Node.js Native Addons in Rust
Write high-performance Node.js native modules in Rust with automatic TypeScript type generation and cross-platform prebuilt binaries.
Mamba — Fast Cross-Platform Package Manager
A drop-in conda replacement written in C++ that resolves environments in seconds instead of minutes.
Plasmo — The Browser Extension Framework
Build, test, and publish browser extensions for Chrome, Firefox, and Edge using React or Vue with hot-reload and automatic manifest generation.