cd /news/ai-agents/ask-your-coding-agent-for-a-stack-of… · home › topics › ai-agents › article
[ARTICLE · art-182055] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Ask your coding agent for a stack of small PRs, not one big one

Greg Foster, founder of Graphite, argues that as AI coding agents accelerate code generation, human review has become the bottleneck, and recommends instructing agents to deliver work as a stack of small pull requests rather than one large change. Graphite's data shows longer diffs draw fewer review comments per line, so Foster advises having agents draft a markdown design doc first and then split work into small, sequentially stacked changes that each get reviewed, tested and merged in order.

recommendation

Have your coding agent write a markdown design doc first, then split work into stacked PRs under a line budget and run CI on every layer.

more in playbook: Working with AI coding agents
by read4 min views1 publishedDec 4, 2026

Tell your coding agent to deliver its work as a stack: a series of small pull requests, each building on the one below, instead of one 2,000-line change. Greg Foster's data says longer diffs get fewer review comments per line, and he argues that faster code generation has made review the growing bottleneck.

Greg Foster founded Graphite, which builds code review and stacking tools. In a September 2025 episode he laid out why the bottleneck moved and how stacking helps.

Because AI sped up the inner loop, writing code, while the outer loop stayed human: review, CI, merge queues, deploys and watching production. Foster said he thinks Facebook was quoted as doubling internal code changes per engineer over the past year, with another doubling expected soon, and that Graphite's own data shows code-change volume per engineer "strictly up into the right." A team that merged 20 changes a day might now merge 50, or 100 with bots in the mix, with more merge conflicts to match.

Trust dropped at the same time. Foster used to assume a teammate wrote the change he was reviewing:

Now it's like, okay, Conor, I'm not sure you wrote this. I, you might've written it. You might've just like held tab down while like staring at your iPhone.

Greg Foster, founder of Graphite, on Chain of Thought ep 40

The reviewer may be the first human to read the code at all.

Reviewers stop reading long diffs. Foster pointed to a study he thinks Google ran, and said Graphite's data shows the same pattern: the longer the change, the fewer comments per line.

You put up a 10 line PR, you're going get like five comments on it.

A giant PR gets an LGTM. So the goal is to keep each reviewable unit small even when the agent produces a lot of code. Stacking, a practice Foster attributes to Facebook's engineering culture, does that: each small change sits on top of the previous one, and each can be reviewed, tested and merged in order.

Ask for it, and give it a plan first. Foster's observation is that agents take to it well:

AI really likes it. It's actually, when you actually start getting these coding agents to stack their code changes and create many small ones, they start applying chain of thought to those stacks.

He described agents naturally splitting work into the function, then the unit test, then the endpoint on top. The engineers he sees getting the best results start with a markdown design doc worked out with the agent, then tell it to read that doc before writing code.

A prompt pattern that follows from this:

A minimal sketch to adapt. diff_stats is a hypothetical helper returning lines added and removed for a hunk.

def plan_stack(hunks, dependency_order, max_lines=200):
    """hunks: dicts with a 'file' key; dependency_order: files, lowest layer first."""
    by_file = {}
    for h in hunks:
        by_file.setdefault(h["file"], []).append(h)
    stack, current, size = [], [], 0
    for f in dependency_order:
        for h in by_file.pop(f, []):
            added, removed = diff_stats(h)
            if added + removed > max_lines:
                raise ValueError(f"hunk in {f} exceeds the budget; ask the agent to split it")
            if current and size + added + removed > max_lines:
                stack.append(current)
                current, size = [], 0
            current.append(h)
            size += added + removed
    if by_file:
        raise ValueError(f"files missing from dependency order: {sorted(by_file)}")
    if current:
        stack.append(current)
    return stack

This is a batching heuristic: it keeps each PR under a size budget, but it can't tell whether a layer compiles or passes CI on its own, so run CI on every layer. Foster's examples point smaller than 200 lines: the 10-line PR that gets real feedback, versus the 2,000- or 3,000-line PRs he doesn't want agents opening.

What are the three waves of AI coding Foster describes?

Tab-complete in the editor, a "director mode" where you send the model on small missions from a sidebar or terminal, and background agents you ping on Slack or GitHub that return a pull request later. He guessed background agents could handle maybe 10% of PRs, with that share inching up as models improve.

Is stacking only for big companies?

Foster said it's spreading, naming engineers at Datadog, Vercel, Notion and Figma. The reasoning carries to any team merging into a shared trunk: small diffs get better review and more granular CI. He saw open source as harder, since a maintainer reviewing a stranger's change wants the complete working solution.

Can AI review the stack instead of a person?

AI reviewers help catch issues, but the point of the episode is that human review got more important, not less, because nobody may have read the code before you.

The full conversation, with the transcript, is on Chain of Thought.

Subscribe to the Chain of Thought newsletter for new episodes and write-ups like this one.

Drafted with AI assistance from the episode transcripts.

── more in #ai-agents 4 stories · sorted by recency
── more on @greg foster 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/ask-your-coding-agen…] indexed:0 read:4min 2026-12-04 · —