Remote OpenClaw Blog
Repomix: Pack Your Entire Repo Into One AI-Friendly File
7 min read ·
Repomix is an open source CLI tool that packs your entire repository into a single AI-friendly file you can paste into Claude, ChatGPT, or any LLM. One command, npx repomix@latest, walks your codebase, respects .gitignore, scans for secrets, counts tokens, and writes everything to one structured file. As of July 2026 the project has 26,900 GitHub stars, and v1.16.0 shipped June 29, 2026.
What Is Repomix?
Repomix is a Node.js command-line tool, created by Kazuki Yamada, that consolidates an entire codebase into a single structured file designed for large language model consumption. The output includes a directory tree, every file's contents with clear separators, and metadata that helps a model navigate the project, which is why the format works so well for whole-repo questions like "explain this architecture" or "find the bug across these modules."
The project is MIT licensed, lives at github.com/yamadashy/repomix with 26,900 stars as of July 2026, and also offers a web version at repomix.com, browser extensions for Chrome and Firefox, a community VS Code extension (Repomix Runner), and a GitHub Action. Two features separate it from naive file concatenation: a built-in Secretlint scan that flags API keys and passwords before they end up in your paste buffer, and token counting (o200k_base by default) so you know whether the output fits your model's context window.
Install and Basic Usage
Repomix needs no installation: npx repomix@latest runs it in any directory. Global installs via npm, yarn, bun, and Homebrew are also supported.
# pack the current directory into repomix-output.xml
npx repomix@latest
# pack a specific folder
npx repomix@latest path/to/directory
# pack a remote GitHub repo without cloning
npx repomix@latest --remote yamadashy/repomix
# create repomix.config.json for persistent settings
npx repomix@latest --init
After a run, Repomix prints a summary with the file count, total tokens, and any security findings, then writes the packed file to repomix-output.xml. Configuration lives in repomix.config.json (TypeScript and JavaScript configs are also supported), where you can persist include and ignore globs, output style, and header text.
Output Formats
Repomix supports four output styles via the --style flag: xml (default), markdown, json, and plain. XML is the default because explicit tags give models unambiguous file boundaries; Markdown is the most human-readable; JSON suits programmatic pipelines; plain text is the simplest fallback.
| Style | Flag | Best for |
|---|---|---|
| XML (default) | --style xml | Claude and most LLMs; clearest file boundaries |
| Markdown | --style markdown | Human review, docs, sharing in chat tools |
| JSON | --style json | Scripts and automated pipelines |
| Plain text | --style plain | Minimal formatting, maximum compatibility |
Key Flags: compress, remote, include
Four flags do most of the heavy lifting in real Repomix workflows, all documented in the official usage guide:
--compress: uses Tree-sitter parsing to keep function signatures, class definitions, and interfaces while stripping implementation bodies. The docs cite a token reduction of roughly 70 percent, which turns a repo that will not fit in context into one that will.--remote user/repo: packs any public GitHub repository directly, with--remote-branchto pick a branch. Useful for reviewing a dependency before adopting it.--include "src/**/*.ts,**/*.md"and--ignore "**/*.log,tmp/": glob-based selection on top of the automatic .gitignore handling.--token-count-tree: prints a per-directory token breakdown so you can see exactly which folders are eating your context budget before you trim.
There is also --split-output 1mb for chunking very large outputs into numbered files.
Repomix as an MCP Server
Repomix ships with a built-in MCP server mode: running repomix --mcp exposes packing as Model Context Protocol tools that AI assistants can call directly, including packing local directories, packing remote repositories, and searching or reading the packed output. Register it with Claude Code like any stdio server:
claude mcp add repomix -- npx -y repomix --mcp
In MCP mode the agent decides when to pack, which turns Repomix from a manual preprocessing step into an on-demand capability. If the connection misbehaves, debug it the same way you would any server, with the workflow from our MCP Inspector guide.
Using Repomix with Claude Code and Agents
The core use case for Repomix with agents is fitting an entire repository into a model's context window in one shot instead of letting the agent read files piecemeal. Common patterns:
- Whole-repo review: pack with
--compress, paste the output into a fresh session, and ask for an architecture review. Signatures-only output keeps even mid-sized repos under typical context limits. - Dependency due diligence:
npx repomix@latest --remote user/repo --compresslets an agent audit a library you are about to adopt without cloning anything. - Onboarding context: generate a Markdown pack of your core modules and reference it from your project's CLAUDE.md so every session starts oriented; our Claude Code memory guide covers where that context should live.
- Cross-file bug hunts: a single packed file lets the model see call sites and definitions together, which piecemeal file reads often miss.
For the broader toolkit around these workflows, see our everything Claude Code guide.
Repomix vs Gitingest and Alternatives
Gitingest is the main alternative to Repomix: a 15,000-star Python tool that converts Git repositories into prompt-friendly text, best known for its URL trick where you swap github.com for gitingest.com in any repo URL. The Gitingest README itself points JavaScript users to Repomix, so the projects acknowledge each other as ecosystem counterparts.
| Repomix | Gitingest | |
|---|---|---|
| GitHub stars (July 2026) | 26,900 | 15,000 |
| Ecosystem | Node.js (npx repomix) | Python (pip install gitingest) |
| Output formats | XML, Markdown, JSON, plain text | Text digest (summary, tree, content) |
| Code compression | Yes, Tree-sitter --compress | No |
| Secret scanning | Yes, Secretlint | No |
| MCP server mode | Yes, repomix --mcp | No |
| Web version | repomix.com | gitingest.com (URL swap) |
| License | MIT | MIT |
Choose Gitingest when you want the fastest zero-tool web flow or you live in a Python stack; choose Repomix when you need compression, secret scanning, format control, or MCP integration. Note that MCP servers like Context7 solve a different problem: they inject library documentation, while Repomix injects your own code.
Limitations
Repomix has honest limits. Packing a large monorepo can exceed any context window even with --compress, so you still need include globs and judgment about scope. Compressed output drops implementation bodies, which is wrong for debugging tasks where the bug lives inside a function body. The Secretlint scan catches common credential patterns but is not a guarantee, so treat packed files as sensitive artifacts. And for iterative work inside a repo, an agent like Claude Code reading files on demand is often cheaper than re-packing after every change; Repomix shines at snapshot-style analysis, not live editing loops.
Related Guides
- Everything Claude Code: The Complete Guide
- Claude Code Memory: How CLAUDE.md and Context Work
- Claude Code MCP: How to Add and Manage MCP Servers
- Context7 MCP Server: Live Docs for Your Agent
Go deeper
The operator playbooks
Production-ready PDF guides for OpenClaw and Hermes Agent — $19.99 each.
Skills for this topic
Browse all skills →Frequently Asked Questions
What does Repomix do?
Repomix packs an entire code repository into a single structured file (XML by default) that AI models can read in one pass. It respects .gitignore, scans for secrets with Secretlint, counts tokens, and outputs a directory tree plus every file's contents with clear separators.
What is the Repomix compress option?
The --compress flag uses Tree-sitter to extract function signatures, class definitions, and interfaces while removing implementation details, reducing token count by roughly 70 percent according to the official docs. It is the main lever for fitting large repos into a model's context window.





