Pack repositories with Repomix for whole-codebase, cross-file analysis...
Use Repomix to pack a repository into a single AI-friendly file (usually XML), then ask the user to run the analysis in a large-context model (Gemini) and paste back the result.
Default behavior: broad strokes first. Do a quick whole-repo measurement pass, then re-pack with obvious non-code/unrelated noise excluded. If that filtered whole-repo pack fits within ~1,000,000 tokens, do not over-optimize—hand it off to Gemini.
--no-security-check only if the user explicitly requests it and confirms the output is safe to share externally.--top-files-len, --token-count-tree). Treat this pack as measurement-only; you usually won’t upload it to Gemini. Delete it after you’ve captured token stats (keep only final Gemini pack(s)).--include-full-directory-structure so Gemini still sees the full tree.Prefer the system-installed repomix binary when available:
repomix --version
If repomix is not on PATH, replace repomix below with pnpm dlx repomix@latest (or npx repomix@latest).
repomix source_directory --style xml -o repomix-output.your-file-name.xml --top-files-len 100 --token-count-tree
Start with a small “obvious noise” ignore list and adjust it based on the first pass token stats.
repomix source_directory --style xml -o repomix-output.filtered.xml --top-files-len 100 --token-count-tree \
--ignore "**/dist/**,**/build/**,**/target/**,**/coverage/**,**/node_modules/**,**/*.svg,**/*.png,**/*.jpg,**/*.jpeg,**/*.gif,**/*.pdf,**/*.zip" \
--remove-empty-lines --truncate-base64
repomix source_directory --style xml -o engine.xml --top-files-len 100 --token-count-tree \
--include "src/engine/**,src/shared/**,README.md" \
--ignore "**/*.svg,**/*.png,**/*.jpg,**/*.min.js,**/*.map,**/dist/**,**/build/**,**/node_modules/**" \
--include-full-directory-structure
repomix source_directory --style xml -o repomix-output.your-file-name.xml --remove-empty-lines --truncate-base64
repomix source_directory --style xml -o repomix-output.your-file-name.xml --compress
repomix source_directory --style xml -o repomix-output.your-file-name.xml --split-output 1mb
Note: --split-output groups by top-level directory; a single file/directory will never be split across multiple output files. Prefer semantic splitting for analysis quality.
repomix --remote user/repo --remote-branch main --style xml -o repomix-output.your-file-name.xml --top-files-len 100 --token-count-tree
repomix source_directory --style xml -o repomix-output.your-file-name.xml --include-diffs --include-logs --include-logs-count 25
src/), configuration, schemas/migrations, key docs (README, SPEC, ADRs), and tests that define behavior.dist/, build/, target/), caches, coverage, vendored deps, large assets, huge fixtures/dumps, generated code blobs, and large repo-meta (e.g. changelogs/release notes) unless directly relevant..repomixignore for repeated iterations; use --ignore for one-offs.--include-full-directory-structure when you pack only a subset but still want the model to see the full repo tree.--include/--ignore patterns (and a few key docs/config files) over curating individual files.--include is a positive filter (pick candidates). --ignore is a negative filter (remove candidates). If a file matches both, it is excluded (ignore wins).--ignore / ignore.customPatterns) → ignore files (.repomixignore, .ignore, .gitignore, .git/info/exclude) → default patterns (e.g. node_modules/**, dist/**). If --include “doesn’t work”, it’s usually because one of these ignore sources is still excluding the file.--no-gitignore, --no-dot-ignore, and/or --no-default-patterns.--include-full-directory-structure only affects the Directory Structure section; it does not override ignore filtering.When the pack(s) are ready, ask the user to upload the file(s) to Gemini and run a prompt like this:
You are analyzing a repository packed by Repomix (attached).
Use the attached Repomix file(s): <filenames>.
Task:
<the exact question and objective>
Constraints:
- Cite file paths for every non-trivial claim.
- When reasoning about behavior, trace cross-file call paths and data flow.
- Avoid speculation. If information is missing or ambiguous, state what’s missing and what additional pack/file would resolve it.
Output format:
- Summary (3–7 bullets)
- Key files/modules (path → responsibility)
- Detailed analysis
- Actionable next steps / follow-up questions (only if needed)
If you created multiple semantic packs (e.g., engine.xml then plugins.xml), provide one prompt per pack, specify the order, so user can carry forward a short summary between runs.