Short-Lived Branches with AI+Human Review
Branch for a day, review, then merge to main.
Branch for a day, review, then merge to main. The empirical hazard the DORA research has measured for a decade is parallel divergence, not the branch itself. Pair short-lived branches with AI-first-pass review and mandatory human approval, and AI4 Verifiable Specs is one of the things human reviewers specifically check.
Opinion
The current canonical row reads as “no long-lived branches” and gets misread as “no branches.” That isn't what the literature says. Forsgren et al. measured branch lifetime, not branch absence;1 Hammant's “Scaled TBD” explicitly permits PR branches under two days;2 Driessen's 2020 update to GitFlow recommends GitHub Flow for any continuous-delivery team. The empirical hazard is parallel divergence. A four-hour branch with a PR review has all of the integration cadence of pure TBD plus the structured review surface, and zero of the merge-hell tax.
The bit I want to plant a flag on is the AI+human pairing. The 2024-2026 generation of AI reviewers has shifted the cost-benefit calculation Fowler weighed for pre-integration review.3 CodeRabbit has reviewed 13 million PRs across two million repos, and Cursor's Bugbot reviews two million PRs per month with 76% bug-resolution. Greptile puts its own bug-catch rate at 82% against CodeRabbit's 44% and Copilot's 54%, which is a vendor scoring its competitors and is read here as a claim rather than a measurement. The pattern is the same across all five tools: the AI catches the high-volume class of issues (boundaries, validation, dead code, naming, test gaps). Humans retain authority on architectural, business-logic, and convention questions the model can't ground. Net effect: the per-PR cost of “good” review is falling, which strengthens (not weakens) the case for the PR-into-main flow.
Human reviewers check one thing the AI review cannot reach: whether AI4 Verifiable Specs was satisfied. The agent will write passing tests against an AC it interpreted loosely. The human reads the AC against the test against the code. Bacchelli & Bird's 2013 finding that review's primary benefit is knowledge transfer holds in the AI loop too, but it is sharpened: the human is the verifier of the spec-test-code chain the agent walked alone.4
Copy a note and link
Grab this short comment and drop it into a PR comment or an LLM chat to prompt the right change.
Branch for a day, review, then merge to main. Long-lived branches are debt. Parallel divergence is the hazard, not branch existence. AI does the first review pass. Humans approve. /tenet/short-branches/P7
AI eyes only
Rule: branch for a day, review, then merge to main. The author and reviewer are not the same agent.
Reject: branches older than a few days. Reject: self-approving a PR. Reject: the same agent session writing and reviewing the change.
Generate: short branches with one behaviour change. Open the PR. A separate AI reviewer (or session) reads it and surfaces issues. A human approves before merge.
Diagnostic: count the days the branch has been open and the agents involved. More than two days, or fewer than two distinct reviewers (one human), reject.
Why?
- DORA / Accelerate measured branch lifetime as a predictor of delivery performance for a decade. Elite performers run with three or fewer active branches and merge daily.
- Short branches keep PRs small. Reviewer effectiveness collapses past 400 lines (Bacchelli & Bird). Small PRs review in five minutes and merge cleanly.
- AI reviewers hold the high-volume class of issues. Copilot, Claude Code Review, Bugbot, CodeRabbit, Greptile all come with mandatory human approval. The cost of “good” review is falling.
- Human reviewers verify the AC chain. The AI catches the obvious. The human checks that AI4 Verifiable Specs was satisfied: the spec was machine-checkable, the test verified it, the code passed both.
- Code review's measured second-largest output is knowledge spread across the team. Authors learn from feedback. Reviewers learn the codebase by reading it.
- Branch lifetime under a day means no merge-hell tax. The conflicts that pile up across long-lived branches don't accumulate.
mainstays shippable. The team that pairs short branches with PR review can cut a release frommainat any time. The team that doesn't cuts releases from a release branch and discovers the gap at deploy time.
Origins
The intellectual root is empirical. The DORA / Forsgren research programme has measured branch lifetime as a predictor of delivery performance since 2014. Accelerate (IT Revolution, 2018) names three concrete predictors at the team scale: ≤3 active branches in the repo, branches merged to trunk at least daily, no integration phases or code freezes.1 Elite performers who hit reliability targets are 2.3× more likely to use TBD. Low performers correlate with long-lived branches.
Paul Hammant's trunkbaseddevelopment.com is the canonical site for the branching literature. Hammant's “Scaled TBD” explicitly permits PR branches under two days for teams larger than ~15 engineers;2 his stricter pure-TBD reading is realistic only for very small, very high-trust teams. Vincent Driessen's 2020 update to his own GitFlow article makes the same point from the opposite direction: for continuous-delivery teams, GitFlow is too heavy; GitHub Flow is the fit.7 Martin Fowler's “Patterns for Managing Source Code Branches” ( 2020) presents the trade-off as integration frequency and integration friction. High-trust teams can drop pre-integration review entirely.8
The code-review tradition is the team-cognitive half. Bacchelli and Bird's “Expectations, Outcomes, and Challenges of Modern Code Review” (Microsoft Research, ICSE 2013) is the canonical source.4 873 programmers, 165 managers, 17 deep interviews, 570 manually-classified review comments. Headline finding: developers expect review to be primarily about defect-finding, but in practice review is more about knowledge transfer, alternative solutions, and team awareness. Sadowski et al.'s Google study (ICSE-SEIP 2018) replicates the finding at the nine-million-review scale.9
The AI-review layer is the recent extension. GitHub Copilot code review went GA in April 2025 after a million-developer preview. Anthropic's Claude Code Review (2026) comes with multiple specialised agents per diff and reports 84% finding rate on PRs over 1,000 lines.10 Cursor's Bugbot reviews ~2 million PRs per month for customers including Discord and Airtable, with 76% bug-resolution and ~35% of Bugbot Autofix patches merged directly.3 CodeRabbit has reviewed 13 million PRs across 2 million repositories. Greptile publishes an 82% bug-catch rate for itself, on its own benchmark. The pattern is the same across all five tools: AI catches the high-volume class of issues. Humans retain authority on architectural, business-logic and convention questions.
The AI4 cross-link is load-bearing. Whatever the AI catches, the human still has to verify that the AC was satisfied. The agent will write passing tests against an AC it interpreted loosely. AI4 Verifiable Specs is the row the human reviewer specifically checks during the PR review: the spec was machine-checkable, the test verified it, the code passed both. Without that check, the agent loop closes on itself and repeats its priors.
Quotes
High performers have the shortest integration times and branch lifetimes, with branch life and integration typically lasting hours.
The branch should only last a couple of days. Any longer than two days, and there is a risk of the branch becoming a long-lived feature branch.
Our study reveals that while finding defects remains the main motivation for review, reviews are less about defects than expected and instead provide additional benefits such as knowledge transfer, increased team awareness, and creation of alternative solutions to problems.
But the smaller the integrations, the less likely they are to turn into an epic merge of misery and despair. With feature branching, this argues for smaller features: days not weeks (and months are right out).
Evidence
25 external sources, ranked by author authority. The first five are the canon; expand to see the rest, including the qualifiers and the named opposers. Each links out to its primary source.
- 01Three concrete predictors of delivery performance: ≤3 active branches, branches merged daily, no integration phases. The empirical backstop for short-lived branches.
- 02Continues to list TBD as one of the technical capabilities that drive software-delivery performance. Documentation quality is a 12.8× multiplier on its effect.
- 03Trunk Based DevelopmentSupportsThe canonical site for the branching literature. The strict pure-TBD reading at one end; “Scaled TBD” with PR branches under two days at the other.
- 04Short-Lived Feature BranchesSupportsHammant's explicit endorsement of PR branches for one developer or one pair, over a day or two.
- 05GitFlow with the 2020 update: for continuous-delivery teams, adopt GitHub Flow instead. The author of the most-popular branching model qualifying its own use.
- 06GitHub Flow (official docs)SupportsThe PR-into-main pattern as the default for most modern SaaS teams. The toolchain that operationalises Hammant's Scaled TBD without naming it.
- 07Frames branching as a spectrum ordered by integration frequency. PR-into-main is the right default for most teams. High-trust teams may drop pre-integration review.
- 08The canonical source for what code review delivers: knowledge transfer first, defect-finding second. Reviewer effectiveness collapses past 200-400 LOC.
- 099M changes, ~25k developers; 70% of changes commit within 24 hours of being mailed for review. Replicates Bacchelli/Bird at Google scale.
- 10Quantified knowledge-spread effect: peer review increases the number of distinct files a developer is familiar with by 66-150% depending on project.
- 11Identifies knowledge dissemination and team awareness as documented secondary benefits alongside the primary defect-finding goal.
- 12The 200-400 LOC effectiveness ceiling for review. The empirical basis for the small-PR discipline that keeps the row workable.
- 13Went GA in April 2025 after a million-developer preview. Late 2025 added deterministic tool-calling (ESLint, CodeQL) on top of the LLM.
- 14Code Review for Claude CodeSupportsMultiple specialised agents per diff with verification pass to filter false positives. 84% finding rate on PRs over 1,000 lines; 7.5 issues per review on average.
- 15Bugbot: Building a better BugbotSupportsReviews ~2 million PRs per month for customers including Discord and Airtable, with 76% bug-resolution and ~35% of Bugbot Autofix patches merged directly.
- 16CodeRabbit: DocumentationSupportsHas reviewed 13 million PRs across 2 million repositories. Combines LLM reasoning with 40+ static analysis tools for the second-layer signals.
- 17Indexes the entire codebase for cross-repo semantic context. Publishes an 82% bug-catch rate for itself against CodeRabbit's 44% and Copilot's 54%, on its own benchmark against its own competitors.
- 18Building Effective AgentsSupportsNames the evaluator-optimizer pattern. The agent that writes the code is not the same agent that reviews it. The human is the final gate.
- 19CHI 2024 paper. AI catches 30%+ of defects on first pass but humans are required for context-specific issues: domain rules, security, business logic.
- 20The vendor-neutral overview that frames Hammant's discipline for an industrial audience. Useful as the practitioner-friendly entry point.
- 21The strict reading of TBD: any branch is debt. Direct commits to trunk only. The steelman the row has to address. The case file argues this is realistic only for very small high-trust teams.
- 22“Don't Push Your Pull Requests”QualifiesOperational discipline for the PR step. The merge button is the gate. The gate doesn't flex.
- 23Deep WorkOpposesThe cognitive-cost steelman. The PR loop fragments attention and the merge cadence is the lower bound on context-switch frequency.
- 24OpenAI's cookbook entry. Names AI-as-first-pass + human approval as the recommended pattern for AI-assisted code review.
- 25Industry summary: elite performers who meet their reliability targets are 2.3× more likely to use TBD. Companion read for the Accelerate finding.
Twenty-five sources, three stances. The supporters are Forsgren's DORA programme and Hammant's Trunk-Based Development primers: short branches with PR review measured as the productivity sweet spot. The 2024-2026 AI-reviewer literature sits further down, extending the row. The qualifiers (led by Driessen) push the line that branching is a spectrum rather than a binary. The opposers (the strict-Hammant pure-TBD reading) argue PR branches are debt. The steelman the case has to address.
Enforcement
Apply these rules in eslint.config.mjs. The full enforcement across every tenet lives on the implementation page.
| Rule | Tool | Catches |
|---|---|---|
| Required reviews (≥1 human) | GitHub required reviews | merges without a human approval. The non-negotiable second pass after the AI review. |
| Branch protection (require PR) | GitHub branch protection | direct pushes to main. Every change goes through the PR review chain. |
| Claude Code Review | Claude Code Review (Anthropic) | the AI first pass. Multiple specialised agents per diff with verification pass; 84% finding rate on PRs over 1,000 lines. |
| GitHub Copilot code review | GitHub Copilot code review | second AI reviewer. Deterministic tool-calling on top of the LLM (ESLint, CodeQL). |
| PR-size action | GitHub Actions | PRs over 400 lines. Reviewer effectiveness collapses past this threshold (Bacchelli & Bird, Cohen). |
| max-lines / max-lines-per-function | ESLint (max-lines, max-lines-per-function) | files and functions that grew past the team's caps. Keeps the per-file diff small enough to read. |
| Required status checks | GitHub required status checks | merges where the quality script (P3) hasn't passed. The DoD becomes the merge gate. |
eslint.config.mjsconfiguration snippet
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';
export default defineConfig({
files: ['**/*.{ts,tsx}'],
rules: {
'max-lines': ['error', { max: 150, skipBlankLines: true, skipComments: true }],
'max-lines-per-function': ['error', { max: 15, skipBlankLines: true, skipComments: true }],
}
});Apply these rules in eslint.config.mjs. The full enforcement across every tenet lives on the implementation page.
| Rule | Tool | Catches |
|---|---|---|
| Required reviews (≥1 human) | GitHub required reviews | merges without a human approval. The non-negotiable second pass after the AI review. |
| Branch protection (require PR) | GitHub branch protection | direct pushes to main. Every change goes through the PR review chain. |
| Claude Code Review | Claude Code Review (Anthropic) | the AI first pass. Multiple specialised agents per diff with verification pass; 84% finding rate on PRs over 1,000 lines. |
| GitHub Copilot code review | GitHub Copilot code review | second AI reviewer. Deterministic tool-calling on top of the LLM (ESLint, CodeQL). |
| PR-size action | GitHub Actions | PRs over 400 lines. Reviewer effectiveness collapses past this threshold (Bacchelli & Bird, Cohen). |
| max-lines / max-lines-per-function | ESLint (max-lines, max-lines-per-function) | files and functions that grew past the team's caps. Keeps the per-file diff small enough to read. |
| Required status checks | GitHub required status checks | merges where the quality script (P3) hasn't passed. The DoD becomes the merge gate. |
eslint.config.mjsconfiguration snippet
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';
export default defineConfig({
files: ['**/*.{ts,tsx}'],
rules: {
'max-lines': ['error', { max: 150, skipBlankLines: true, skipComments: true }],
'max-lines-per-function': ['error', { max: 15, skipBlankLines: true, skipComments: true }],
}
});Apply these rules in .github/workflows/pr-review.yml. The full enforcement across every tenet lives on the implementation page.
| Rule | Tool | Catches |
|---|---|---|
| Required reviews (≥1 human) | GitHub required reviews | merges without a human approval. |
| Branch protection (require PR) | GitHub branch protection | direct pushes to main. |
| Danger JS | Danger JS | PR-policy violations: missing changelog entry, unlinked AC, oversized diff. Programmable bot in the PR. |
| CodeRabbit | CodeRabbit | AI first pass. 13 million PRs reviewed; combines LLM reasoning with 40+ static analysis tools. |
| Greptile | Greptile | AI first pass with cross-repo semantic context. 82% bug-catch rate on benchmark suite. |
| max-lines | ESLint (max-lines, max-lines-per-function) | files that grew past the team's cap. Keeps the per-file diff small. |
.github/workflows/pr-review.ymlconfiguration snippet
name: PR review chain
on:
pull_request:
types: [opened, synchronize]
jobs:
ai-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with: { fetch-depth: 0 }
- uses: anthropics/claude-code-review-action@v1
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
- uses: github/copilot-code-review-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
pr-size:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Block PRs over 400 lines
run: |
ADDED=$(git diff --shortstat origin/main...HEAD | awk '{print $4}')
[ "${ADDED:-0}" -lt 400 ] || exit 1Apply these rules in pyproject.toml. The full enforcement across every tenet lives on the implementation page.
| Rule | Tool | Catches |
|---|---|---|
| Required reviews (≥1 human) | GitHub required reviews | merges without a human approval. |
| Branch protection (require PR) | GitHub branch protection | direct pushes to main. |
| PLR0915 (too-many-statements) | Ruff (PLR0915: too-many-statements) | functions over 10 statements. The Python equivalent of the function-size cap; keeps per-PR review tractable. |
| Claude Code Review | Claude Code Review (Anthropic) | the AI first pass for Python projects. |
| GitHub Copilot code review | GitHub Copilot code review | second AI reviewer for Python projects. |
| danger-python | danger-python | PR-policy violations in Python repos. |
pyproject.tomlconfiguration snippet
[tool.ruff.lint]
select = ["PLR0915"]
[tool.ruff.lint.pylint]
max-statements = 10Apply these rules in checkstyle.xml. The full enforcement across every tenet lives on the implementation page.
| Rule | Tool | Catches |
|---|---|---|
| Required reviews (≥1 human) | GitHub required reviews | merges without a human approval. |
| Branch protection (require PR) | GitHub branch protection | direct pushes to main. |
| MethodLength | Checkstyle (MethodLength, FileLength) | methods over 15 lines. The Java cap that keeps per-PR review tractable. |
| FileLength | Checkstyle (MethodLength, FileLength) | files over the team's cap. Caps the per-file diff size. |
| SonarQube quality gate | SonarQube | the umbrella PR check. Quality-gate failure stops the merge; one umbrella over coverage, complexity, smells, security. |
| Required status checks | GitHub required status checks | merges where Maven verify or the Sonar gate hasn't passed. |
checkstyle.xmlconfiguration snippet
<?xml version="1.0"?>
<module name="Checker">
<module name="TreeWalker">
<module name="MethodLength">
<property name="max" value="15"/>
<property name="countEmpty" value="false"/>
</module>
<module name="FileLength">
<property name="max" value="150"/>
</module>
</module>
</module>Apply these rules in phpcs.xml. The full enforcement across every tenet lives on the implementation page.
| Rule | Tool | Catches |
|---|---|---|
| Required reviews (≥1 human) | GitHub required reviews | merges without a human approval. |
| Branch protection (require PR) | GitHub branch protection | direct pushes to main. |
| Generic.Files.LineLength | PHP_CodeSniffer (Generic.Files.LineLength) | lines and files over the team's cap. Keeps per-PR review tractable. |
| PHPStan level max | PHPStan | the umbrella PR check. The static-analysis row that stops the merge until clean. |
| Claude Code Review | Claude Code Review (Anthropic) | the AI first pass for PHP projects. |
| Required status checks | GitHub required status checks | merges where Composer test or the PHPStan gate hasn't passed. |
phpcs.xmlconfiguration snippet
<?xml version="1.0"?>
<ruleset name="Prickles P7">
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="100"/>
<property name="absoluteLineLimit" value="120"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.FunctionSpacing"/>
</ruleset>AI rules
.cursor/rules/p7-short-branches.mdc--- alwaysApply: true --- ## Prickles P7: Short-Lived Branches with AI+Human Review Keep `main` always shippable. Cut a branch for a single piece of work and keep it under a day where you can. Open a PR. Request the AI review first. Address what it flags. Ask a human reviewer for the second pass. Human reviewers verify two things the AI can't: the architecture the AI couldn't see, and whether AI4 Verifiable Specs was satisfied, the AC was machine-checkable, the test verified it, the code passed both. Use feature flags or branch-by-abstraction whenever the work is bigger than a branch can carry. Never use a branch as a substitute for releasing.
Repo layout, CI, and ESLint wiring for these paths live on /implementation, not repeated on every tenet.
Counter-argument
The strongest steelman is the strict-Hammant pure-TBD reading: any branch is debt, the only safe pattern is direct commits to trunk with refinement review afterward.6 The high-trust pair-programming teams Hammant cites operate this way and release cleanly. The implication is that PR branches are a crutch the discipline doesn't need. Newport's deep-work argument extends the point at the cognitive scale: the PR loop fragments attention and the merge cadence is the lower bound on context-switch frequency.
Counter-argument retort
The strict-Hammant pure-TBD reading is right for a team small and high-trust enough to treat pair-programming as continuous review. For everyone else, the median industrial team, the empirical record is unambiguous: PR branches under two days with mandatory review land in the same elite-performer cluster as pure TBD without giving up the structured review surface.1 The fix is not to abandon PRs. It is to keep the branch short.
Newport's context-switch argument is real for the team that runs many small PRs in parallel without batching. The reply is to tune the cadence: reviewers batch their PR reading into morning and afternoon windows. The AI reviewer fires immediately so the agent can iterate. The human runs the second pass when the diff is stable.5 The discipline survives. The cognitive cost is paid in batches, not in interruptions.
The genuine residue is reviewer fatigue and rubber-stamping. Bacchelli and Bird's data shows reviewer effectiveness collapses above ~200-400 lines per review.4 The fix is the small-PR discipline: split the change-set, put structural tidies in a separate PR per P6 Leave it Better, keep the behavioural diff small enough to read in five minutes. The AI reviewer extends the effectiveness curve to the right (it doesn't fatigue), but the human pass still comes before the merge button.
In production work, the row that pairs short branches with AI-first-pass and mandatory human approval is the row whose PR queue moves through review in hours rather than days. The empirical record across five years of DORA reports has not moved against the pattern. The AI-reviewer additions of 2024-2026 strengthen the case rather than weaken it. Pair this with P3 Definition of Done and the merge button reads the same checklist the human reviewer signed off on.
Notes
- [1]Forsgren, Humble & Kim: Accelerate: The Science of Lean Software and DevOps (IT Revolution, 2018), ch.4. Three concrete predictors of delivery performance: ≤3 active branches in the repo, branches merged to trunk at least daily, no integration phases. Elite performers who hit reliability targets are 2.3× more likely to use TBD.
- [2]Paul Hammant: Short-Lived Feature Branches (trunkbaseddevelopment.com). The branch should only last a couple of days. Any longer than two days, and there is a risk of the branch becoming a long-lived feature branch. Hammant's “Scaled TBD” explicitly permits PR branches at this cadence.
- [3]Cursor: Bugbot product documentation (cursor.com/bugbot, 2026). Reviews ~2 million PRs per month for customers including Discord and Airtable, with 76% bug-resolution and ~35% of Bugbot Autofix patches merged directly.
- [4]Bacchelli & Bird: “Expectations, Outcomes, and Challenges of Modern Code Review” (Microsoft Research, ICSE 2013). 873 programmers, 165 managers, 17 deep interviews, 570 review comments. Review's primary delivered benefit is knowledge transfer. Reviewer effectiveness collapses past ~200-400 LOC.
- [5]Anthropic: Building Effective Agents (December 2024). Names the evaluator-optimizer pattern: one agent generates, another (or an external check) evaluates. The agent that writes the code is not the same agent that reviews it. The human is the final gate.
- [6]Paul Hammant: trunkbaseddevelopment.com (canonical site). The strict pure-TBD reading: direct commits to trunk, refinement review after merge or pair-programmed before push. Realistic only for very small, very high-trust teams.
- [7]Vincent Driessen: “A successful Git branching model” (2010, with 2020 addendum, nvie.com). Driessen's GitFlow with the explicit 2020 update: “If your team is doing continuous delivery, adopt a much simpler workflow (like GitHub flow) instead.”
- [8]Martin Fowler: “Patterns for Managing Source Code Branches” (martinfowler.com, 2020). Presents the trade-off as integration frequency and integration friction. High-trust teams can drop pre-integration review entirely, but PR-into-main is the right default for most teams.
- [9]Sadowski et al.: “Modern Code Review: A Case Study at Google” (ICSE-SEIP 2018). 9M reviewed changes, ~25k developers; 70% of changes commit within 24 hours of being mailed for review. Education ranks as a first-class motivation alongside maintaining norms, guarding the trunk and preventing accidents.
- [10]Anthropic: Code Review for Claude Code (2026). Multiple specialised agents per diff (boundary checks, API misuse, cross-file consistency) with a verification pass to filter false positives. 84% finding rate on PRs over 1,000 lines; 7.5 issues per review on average.