ScriptsApr 2, 2026·2 min read

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.

TL;DR
Repomix packs your entire repository into one file optimized for LLM context windows with token counting and security scanning.
§01

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.

§02

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.

§03

How to use

  1. Run directly with npx: npx repomix@latest in your project directory.
  2. Or install globally: npm install -g repomix.
  3. For remote repos: npx repomix --remote https://github.com/user/repo.
  4. Choose output format: npx repomix --output repomix-output.md --style markdown.
§04

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'
§05

Related on TokRepo

§06

Common pitfalls

  • Large repositories may produce output that exceeds LLM context windows. Use --include filters 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

What output formats does Repomix support?+

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.

Can Repomix process remote repositories?+

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.

Does Repomix count tokens?+

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.

How does Repomix handle sensitive files?+

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.

Can I use Repomix with non-JavaScript projects?+

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)
🙏

Source & Thanks

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

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets