Repomix: LLM codebase packaging for AI
Repomix is a command-line tool that flattens an entire repository into one XML, Markdown, JSON, or plain-text file so you can paste a whole codebase into an LLM's context window instead of file by file. The core workflow is one command with no config needed, and --compress shrinks large repos with Tree-sitter rather than hand-picked files. Worth it once repo-wide AI reviews become a habit; for one file, copy-paste is still faster.
What Repomix does
Repomix is a Node.js CLI, also available as Docker, that walks a local folder or remote GitHub repo and merges every matching file into one AI-formatted output. It writes an AI header and directory tree, then each file's contents, wrapped in XML tags, Markdown headers, JSON keys, or plain-text separators depending on --style. It counts tokens per file so you know how much context window the packed output will use.
Core features that make codebases AI-ready
- ✓Git-aware filtering: honors .gitignore, .ignore, and a repo-specific .repomixignore file automatically, so build output and node_modules never make it into the packed file.
- ✓Secretlint integration: scans every file against known credential formats before packing and drops matches, catching API keys and tokens that would otherwise leak into a prompt.
- ✓Tree-sitter compression: the --compress flag extracts function and class signatures instead of full bodies, cutting token count while keeping the code's structure legible.
- ✓Per-file and total token counts reported on every run, so you can tell before you paste whether the output fits the model's context window.
- ✓Four output styles chosen with --style: XML (default), Markdown, JSON, and plain text, each with a file summary, directory tree, and file contents section.
- ✓Remote repo packing: point --remote at a GitHub URL, an owner/repo shorthand, or a specific branch or commit hash and Repomix clones and packs it without you cloning it yourself first.
Installing Repomix
The fastest way to try Repomix is without installing anything: run `npx repomix@latest` inside a project directory and it packs the current folder into repomix-output.xml. For repeated use, install it globally with `npm install -g repomix`, or swap in yarn (`yarn global add repomix`), bun (`bun add -g repomix`), or Homebrew (`brew install repomix`) on macOS/Linux, then just type `repomix`. If you'd rather skip a Node toolchain, the Docker image works the same way: `docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix` mounts your current directory and packs it inside the container. There's also a hosted version at repomix.com for pasting a repo URL and downloading the output, plus Chrome and Firefox browser extensions that add a Repomix button to GitHub repo pages, and a community-maintained VS Code extension called Repomix Runner.
Packing local and remote repositories
Running `repomix` with no arguments packs the whole current directory; `repomix path/to/directory` narrows it to one folder, and `--include "src/**/*.ts,**/*.md"` or `--ignore "**/*.log,tmp/"` narrow it further with glob patterns. To pack someone else's project without cloning it, `--remote` takes a full GitHub URL or the owner/repo shorthand, and `--remote-branch` pins a branch name, tag, or commit hash. `--stdin` reads a list of file paths from standard input, so you can pipe the output of `git ls-files`, `rg --files`, or an `fzf` selection straight into Repomix instead of writing include patterns by hand. `--include-logs` adds git commit history (50 commits by default, or a custom count via `--include-logs-count`) for context on how the code evolved, and `--compress` runs the Tree-sitter pass to shrink large repos. `repomix --init` writes a repomix.config.json so you don't retype flags on every run.
Strengths
- ✓One command with no required configuration gets you from a repo to a packed file — `npx repomix@latest` needs nothing installed first.
- ✓Git-aware by default: .gitignore, .ignore, and .repomixignore are respected automatically instead of you hand-picking files to exclude.
- ✓Four interchangeable output formats (XML, Markdown, JSON, plain text) mean the packed file slots into whatever the target LLM or downstream script expects.
- ✓Secretlint scanning and the --compress Tree-sitter pass both run as part of the normal flow, not as an extra step you have to remember.
Security: what Repomix protects and what it does not
- △Secretlint catches known credential patterns, not arbitrary sensitive data — a hardcoded password in an unusual format or a sensitive comment can still slip through, so review the output before sending it anywhere.
- △Packing is local file selection, not an access-control layer: if you can read a private repo's files, Repomix will include them, so anyone who gets the packed file gets everything in it.
- △The --compress flag preserves structure, not full logic, so a compressed pack suits architecture questions but not a security review that needs every line of a function body.
- △The browser extension and the VS Code extension (Repomix Runner) are separate projects from the core CLI, and the VS Code one is explicitly community-maintained rather than built by the core team.
Gitingest and other comparable tools
Frequently asked questions
Yes, Repomix is free and open source, released under the MIT license, so you can use, modify, and redistribute it without paying anything.
Repomix runs Secretlint against every file before packing and leaves out any file that matches a known credential format, so common API keys and tokens don't end up in the AI-ready output.
Not clearly documented — the README shows --remote packing public GitHub URLs and shorthand names but doesn't describe authenticating against private repositories, so treat private-repo support as unconfirmed.
Repomix supports four output formats selected with the --style flag: XML (the default), Markdown, JSON, and plain text, each organized into a file summary, directory structure, and file contents section.
Repomix reports a token count for every file and for the whole packed output, and its --compress flag uses Tree-sitter to strip large codebases down to function and class signatures so they fit an LLM's context window.
Yes, Repomix ships a Docker image at ghcr.io/yamadashy/repomix; running `docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix` mounts your current directory and packs it without installing Node.js locally.
The problem it solves
Feeding a codebase to an LLM usually means opening files one at a time and pasting them into a chat window, which breaks down the moment a question spans more than a couple of files and wastes context on formatting the model has to reconcile itself. Repomix targets that specific friction: it turns a whole repo, or a `--remote` GitHub repo you haven't even cloned, into one consistently structured file with a directory tree and a token count attached, so the model gets the full picture in a single paste.
Best use cases
- •Getting a first-pass architecture review of a repo you just inherited, by packing it whole and asking an LLM to summarize structure and flag risky areas.
- •Generating a README or onboarding doc for an existing project from its actual code instead of writing one from memory.
- •Reviewing a remote open-source repo before depending on it, using --remote to pack a GitHub URL without cloning it locally.
- •Feeding --include-logs commit history alongside the code so an LLM can reason about how a bug or pattern evolved, not just its current state.
- •Packing a large repo with --compress when the raw file set would blow past a model's context window.
Who should try it — and who should skip
Try Repomix if you regularly ask an LLM to reason about a whole project — refactors, architecture reviews, onboarding docs — and you're tired of manually assembling context from individual files; the CLI, the Docker image, and the repomix.com web version all do the same packing job, so pick whichever fits your workflow. Skip it if you only ever paste one or two files at a time, since the setup and flags add nothing over copying a file directly; Python-heavy data-science repos are also better served by Gitingest, per Repomix's own README.
Related repositories
Is repomix worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of repomix.
