What Is Repomix and What Does It Do?

Updated

Repomix is a tool that packs a local or remote repository into a single AI-friendly file, so you can hand an entire codebase to tools like Claude, ChatGPT, Gemini, or an MCP workflow without manually gathering files. It is most useful when you want an AI assistant or a reviewer to see project-wide context — directory layout, file contents, and structure — rather than a handful of pasted snippets.

What problem it solves

AI chat tools work best with context, but codebases are spread across many files. Copying them by hand is slow and easy to get wrong. Repomix takes a repository as input and produces one consolidated output that preserves the relationships between files, which makes the result easier for a model to reason about.

Output formats

Repomix can emit the packed repository in several formats:

Format Typical use
XML Structured input for AI tools that parse tagged content
Markdown Readable context for chat-based assistants
JSON Programmatic processing or downstream tooling
Plain text Simple, model-agnostic input

You choose the format that matches the tool or workflow you are feeding.

Core capabilities

  • AI-optimized output — the packed file is structured for model consumption rather than human browsing.
  • Git-aware packing — it respects repository state instead of blindly copying everything.
  • Security-focused — designed with the risks of sending code to external services in mind.
  • Token counting — helps you judge whether the packed output fits a model's context window before you send it.
  • Include and ignore patterns — glob patterns let you select which files enter the pack and which stay out.
  • File summary and directory structure — optional sections that give the model a map of the project.
  • Line numbers — optional, useful when you need to reference specific locations.
  • Parsable format and escaping — controls whether output is escaped according to the chosen style schema; note that this can increase token count.
  • Compress code — uses Tree-sitter to extract essential code signatures and structure while removing implementation details, significantly reducing token usage.
  • Remove comments and remove empty lines — further trimming for smaller, denser output.

When to use it

Reach for Repomix when you need to:

  • Ask an AI assistant a question that depends on how multiple files interact.
  • Run an AI-assisted code review over a whole repository or a large subdirectory.
  • Feed a codebase into an MCP-based workflow.
  • Estimate context size before committing to a particular model.

It is less relevant when your question concerns a single file, or when the repository is small enough to paste directly.

How to think about the trade-offs

The options that shrink output — compression, comment removal, empty-line removal — reduce token usage but also remove detail a model might need. Escaping improves parsability but can raise token count. Include and ignore patterns are the main lever for keeping sensitive or irrelevant files out of the pack. Which combination is right depends on whether your priority is fitting inside a context window or preserving full fidelity.