Pack only the changed code in a Git repository into an LLM-ready review file.
diffpack is a tiny local CLI for AI-assisted code review. It collects your Git diff, the current contents of changed files, basic repository status, estimated token usage, and best-effort secret redaction into one Markdown file you can paste into ChatGPT, Claude, Gemini, Codex, Cursor, Aider, or another coding tool.
It does not call any API. Your code stays on your machine.
Full-repo context is useful, but most day-to-day AI coding tasks are about the current change:
- review this PR;
- explain this diff;
- find the bug in my staged changes;
- write a commit message;
- suggest tests for files I touched.
diffpack gives you one command:
diffpack . -o REVIEW.mdThen paste REVIEW.md into your AI coding tool.
- Diff-focused: includes Git status, patch diff, and changed file contents.
- Local-first: no network calls, no account, no telemetry.
- Token-aware: estimates token usage and stops before your budget.
- Secret redaction: masks likely API keys, private keys, passwords, and tokens.
- Untracked files: includes new files by default.
- Branch review: compare against
main,origin/main, or any ref. - Zero runtime dependencies: standard-library Python only.
From source:
git clone https://github.com/Colors9527/diffpack.git
cd diffpack
python -m pip install -e .After publishing to PyPI:
pip install diffpackdiffpack . -o REVIEW.mddiffpack . --base main -o REVIEW.mddiffpack . --max-tokens 40000 -o REVIEW.mddiffpack . --no-untracked -o REVIEW.mddiffpack . --dry-runPaste the generated file into your AI tool with this instruction:
You are reviewing the following Git diff and changed file context. Identify correctness bugs, security risks, missing tests, and unclear code. Be specific and cite file paths.
usage: diffpack [path] [-o OUTPUT] [--base BASE] [--max-tokens N]
[--max-file-size BYTES] [--max-diff-chars CHARS]
[--no-untracked] [--no-redact] [--dry-run]
Important options:
--base REF: compare committed changes against a Git ref. Default:HEAD.--max-tokens N: approximate context budget. Default:80000.--max-file-size BYTES: skip changed files larger than this. Default:250000.--max-diff-chars CHARS: truncate very large patch text. Default:200000.--no-untracked: skip untracked files.--no-redact: disable best-effort secret redaction.
diffpack makes a best effort to redact secrets, but it is not a formal security scanner. Always skim the generated file before pasting it into a third-party service.
ctxpack: pack a whole repository into an LLM-ready context file.
MIT