ScriptsApr 6, 2026·2 min read

Repomix — Pack Any Repo into LLM-Ready Context

CLI tool that packs an entire repository into a single AI-friendly text file optimized for LLM context windows. Supports token counting, .gitignore, and custom filtering. 8,000+ stars.

SC
Script Depot · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

# Install
npm install -g repomix

# Pack current directory
repomix

# Pack with options
repomix --output context.txt --include "src/**/*.ts" --style xml

Output is a single file ready to paste into any LLM chat.


Intro

Repomix is a CLI tool that packs an entire code repository into a single, AI-friendly text file optimized for LLM context windows with 8,000+ GitHub stars. It respects .gitignore, counts tokens, supports multiple output formats (plain text, XML, Markdown), and lets you filter by file patterns. Instead of manually copying files one by one into ChatGPT or Claude, run repomix once and get a perfectly formatted context dump. Best for developers who need to give LLMs full project context for code review, refactoring, or architecture discussions. Works with: any LLM (Claude, GPT-4, Gemini). Setup time: under 1 minute.


Output Formats

Plain Text (default)

repomix --style plain

XML (best for Claude)

repomix --style xml

Output:

<file path="src/auth/handler.ts">
export function login(credentials: Credentials) {
  // ...
}
</file>
<file path="src/db/connection.ts">
// ...
</file>

Markdown

repomix --style markdown

Advanced Usage

Filter Files

# Only TypeScript files in src/
repomix --include "src/**/*.ts"

# Exclude tests
repomix --exclude "**/*.test.ts,**/*.spec.ts"

# Only specific directories
repomix --include "src/auth/**,src/api/**"

Token Counting

repomix --token-count
# Output: Total tokens: 45,231 (cl100k_base)

Remote Repos

# Pack a GitHub repo directly
repomix --remote https://github.com/user/repo

Configuration File

Create repomix.config.json:

{
  "output": {
    "filePath": "context.txt",
    "style": "xml"
  },
  "include": ["src/**/*.ts", "src/**/*.tsx"],
  "ignore": {
    "customPatterns": ["*.test.ts", "*.spec.ts", "dist/**"]
  }
}

Key Stats

  • 8,000+ GitHub stars
  • 3 output formats (plain, XML, markdown)
  • Token counting built-in
  • .gitignore aware
  • Remote repo support

FAQ

Q: What is Repomix? A: Repomix is a CLI tool that packs a code repository into a single text file optimized for LLM context windows, with token counting and customizable filtering.

Q: Is Repomix free? A: Yes, fully open-source under MIT license.

Q: Which output format is best for Claude? A: XML format works best with Claude, as it uses XML tags to clearly delineate file boundaries.


🙏

Source & Thanks

Created by Yamadashy. Licensed under MIT.

repomix — ⭐ 8,000+

Thanks for solving the "how do I give the LLM my whole project" problem.

Discussion

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

Related Assets