Decompose large PRs into a DAG of small, reviewable stacked PRs
Vibe coding with AI assistants can produce massive PRs that no one wants to review. A 2,000 line PR with changes across dozens of files is a review bottleneck: teammates skim it, rubber stamp it, or just ignore it. pr-split turns that monolith into a stack of focused, bite-sized PRs your team can actually review with confidence. Each sub-PR has a clear purpose, minimal scope, and explicit dependencies, so reviewers know exactly what changed and why.
pr-split takes a large pull request (local branch, fork PR number, or user:branch), sends the diff to an LLM for analysis, and produces a split plan: a set of smaller, focused PRs arranged in a dependency DAG. Each sub-PR gets its own branch, commit, and GitHub PR targeting the correct base.
# With uv (recommended)
uv tool install pr-split
# With pip
pip install pr-split- Python 3.12+
- GitHub CLI (
gh) authenticated viagh auth login ANTHROPIC_API_KEYorOPENAI_API_KEYenvironment variable set
pr-split split feature-branch --base mainpr-split split '#42' --base mainpr-split split someuser:feature-branch --base main| Flag | Default | Description |
|---|---|---|
--base |
main |
Base branch for the diff |
--max-loc |
400 |
Soft limit on diff lines per sub-PR |
--priority |
orthogonal |
Grouping priority (orthogonal or logical) |
# Show status of an existing split
pr-split status
# Clean up all pr-split branches and close PRs
pr-split cleanSettings can be set via environment variables with the PR_SPLIT_ prefix:
| Variable | Default | Description |
|---|---|---|
PR_SPLIT_PROVIDER |
anthropic |
LLM provider (anthropic or openai) |
ANTHROPIC_API_KEY |
(required for Anthropic) | Anthropic API key |
OPENAI_API_KEY |
(required for OpenAI) | OpenAI API key |
PR_SPLIT_MODEL |
auto per provider | Model name (defaults to best available model for the chosen provider) |
PR_SPLIT_MAX_LOC |
400 |
Default soft limit on diff lines |
PR_SPLIT_PRIORITY |
orthogonal |
Default grouping priority |
- Extracts the merge-base diff between your branch and the base (same view as GitHub's PR page)
- Sends the diff to the configured LLM, which groups hunks into logical sub-PRs with dependency ordering
- Validates the plan: full coverage (every hunk assigned exactly once), no cycles, no merge conflicts between independent groups
- Shows you the plan (table + dependency tree) and asks for confirmation
- Creates branches, commits, pushes, and opens GitHub PRs in topological order
- For diffs exceeding the model's context window, automatically chunks the diff and processes sequentially, carrying forward the group catalog across chunks

