DEV Community

Cover image for Your Agent's PR Description Is Thorough and Too Long. Fold It Under Two Lines of Yours
Gabriel Anhaia
Gabriel Anhaia

Posted on Edited on AI-assisted

Your Agent's PR Description Is Thorough and Too Long. Fold It Under Two Lines of Yours


Summary, Changes, Testing, Notes: four headings and forty lines, all written by the coding agent that opened the pull request. Every line is probably true, and you skim all of it looking for the one sentence that says what the PR is for.

On 9 November 2026, Simon Willison wrote that most changes to his projects now arrive as PRs opened for him by Claude Code or Codex, and that the agents are good at describing their work (his post). Too good. The descriptions cover the problem, the fix and how it was checked, and in his words, "That's a lot of information to absorb." He adds that the text isn't necessarily slop, but it reads like it.

His fix is small. The PR opens with a short paragraph a human chose, which says what the change is and whether it needs your attention. The agent's full text follows inside a <details><summary> block, collapsed, with the model name and often the effort level as the label, for example "Claude Opus 5.5 Medium". GitHub renders that as one line with an expand arrow (GitHub docs).

You can make that a routine for every branch: the agent writes its description to a file, you read the diff, you write two sentences, and one script assembles the body and opens the PR with GitHub CLI. Step 2 uses Hermes IDE, which I build, so weigh that part with that in mind. Every other step is plain git and gh.

Step 1: have the agent write its description to a file

Two file names do all the work: PR_AGENT.md holds the agent's text, PR_OPENER.md holds yours. Neither belongs in a commit, so ignore them in every repository at once. Git reads a global ignore file at ~/.config/git/ignore when $XDG_CONFIG_HOME is unset (gitignore docs):

mkdir -p ~/.config/git
printf 'PR_OPENER.md\nPR_AGENT.md\n' >> ~/.config/git/ignore
Enter fullscreen mode Exit fullscreen mode

If git config --global core.excludesFile prints a path, you already chose a different file. Append the two lines there instead.

Now tell the agent where its description goes. Put the rule in AGENTS.md, which Codex reads before it starts work. Claude Code v2.1.277 and later reads AGENTS.md too when the repository has no CLAUDE.md; if yours has one, add an @AGENTS.md import to it (Claude Code memory docs).

## Pull request descriptions

When asked for a PR description, write it to PR_AGENT.md
in the repository root: what changed, why, and how you
verified it. Do not stage or commit that file, and do not
open the pull request yourself.
Enter fullscreen mode Exit fullscreen mode

Then, at the end of a task, ask the session that did the work: "Write the PR description for this branch." That session knows why it made each choice, which a fresh one reading only the diff does not.

If the session is already closed, both CLIs can write the file without an interactive session. claude -c -p continues the most recent conversation in the current directory and prints the reply (CLI reference). codex exec -o writes the final message to a file (Codex CLI reference), and -s read-only lets the model inspect files but not edit them (sandboxing):

claude -c -p "Write the PR description for this branch. \
Do not write any file; reply with the description only." \
  > PR_AGENT.md

codex exec -s read-only -o PR_AGENT.md \
  "Write a PR description for this branch against main. \
Do not write any file; reply with the description only."
Enter fullscreen mode Exit fullscreen mode

Both prompts override the AGENTS.md rule on purpose: here the shell redirect or -o writes the file, so an agent that also tried to write it could clobber the reply or hit the read-only sandbox.

A long folded paper accordion tucked under a short handwritten note card on a desk
Two sentences on top, the agent's full write-up folded underneath.

Step 2: read the diff, not the description

The opener is your judgement, so it has to come from the change itself. The description tells you what the agent believes it did. The diff tells you what it did.

In plain git, three-dot diff shows only what the branch changed since it left main:

git log --oneline main..HEAD
git diff --stat main...HEAD
git diff main...HEAD
Enter fullscreen mode Exit fullscreen mode

In Hermes, press ⌘G (Ctrl+Shift+G on Windows and Linux) to open the Review Desk. Hermes saves every agent turn, so you read the change by turn or by file, with risk flags, and a line comment goes back to the agent that wrote that line (README). Reading by turn helps here: the first turn is usually the change, and the later ones are fixes and follow-ups, which is the shape your two sentences need to describe.

The Hermes Review Desk in By turn view with two turns listed, a diff of src/db.ts and a drafted commit message
The Review Desk (⌘G) in By turn view for a Claude Code task in orders-api: two turns (T1: 3 files +69 −1, T2: 1 file +1 −0), turn 1's diff of src/db.ts adding a refunded status, and a commit message drafted from the turns.

If a turn looks wrong, comment on the line and let the agent fix it before you write anything. An opener for a branch that still has a bug in it is wasted.

Step 3: write the two sentences

Simon's test for the opener is that it tells a reader what the PR is for and whether it deserves their attention. One sentence for what changed, in the reader's terms. One for where a reviewer should look, or why they can skip it.

For the task in the screenshot, an example PR_OPENER.md:

Adds `POST /orders/:id/refund` for paid orders and a new
`refunded` order status. Review `src/db.ts` first: the
status type changed there.
Enter fullscreen mode Exit fullscreen mode

You don't always have to write it from scratch. Simon says that sometimes the agent has already given him the sentence he needs, buried in the rest of its text. If you find it there, move it up and edit it.

Step 4: one script to build the body and open the PR

Save this as ~/bin/pr-fold.sh:

#!/bin/sh
# pr-fold.sh: your opener on top, the agent's text folded.
set -eu
label=${1:?'usage: git pr-fold LABEL [TITLE]'}
title=${2:-$(git log -1 --format=%s)}

for f in PR_OPENER.md PR_AGENT.md; do
  [ -s "$f" ] || { echo "missing or empty: $f" >&2; exit 1; }
done

body() {
  cat PR_OPENER.md
  printf '\n\n<details>\n<summary>%s</summary>\n\n' "$label"
  cat PR_AGENT.md
  printf '\n\n</details>\n'
}

if url=$(gh pr view --json url --jq .url 2>/dev/null); then
  body | gh pr edit "$url" --body-file -
  echo "updated $url"
else
  body | gh pr create --draft --title "$title" --body-file -
fi
Enter fullscreen mode Exit fullscreen mode

Then make it a git command:

git config --global alias.pr-fold '!sh ~/bin/pr-fold.sh'
git pr-fold "Claude Opus 5.5 Medium"
Enter fullscreen mode Exit fullscreen mode

Five details in the script matter:

  • An alias that starts with ! runs as a shell command from the top-level directory of the repository (git-config docs). In a worktree, that is the worktree's root, so the two relative file names resolve wherever you run git pr-fold from.
  • --body-file - reads the body from standard input, for both gh pr create and gh pr edit (create, edit). No temp file to clean up. Because stdin carries the body, the script always passes --title; it defaults to the last commit's subject, and a second argument overrides it.
  • The blank line after </summary> matters. GitHub Markdown treats <details> and <summary> as an HTML block that ends at the next blank line, and Markdown only gets parsed again after it (GFM spec). Without that blank line, the agent's headings and lists can show up as raw text inside the fold.
  • --draft gives you a chance to look at the rendered page before you mark it ready.
  • The label is whatever the session ran. In Hermes that is the model and effort you picked for the task; in a plain terminal, it's the model you started the session with.

The script rebuilds the body from the two files every time, so you can edit either file and rerun it. When a PR already exists for the branch, gh pr view finds it ("Without an argument, the pull request that belongs to the current branch is displayed", per the docs), and the script replaces its body instead of opening a second one.

That also covers the case where the agent already opened the PR itself. Pull its description into the file, write your opener, and fold it after the fact:

gh pr view --json body --jq .body > PR_AGENT.md
"${EDITOR:-vi}" PR_OPENER.md
git pr-fold "Claude Opus 5.5 Medium"
Enter fullscreen mode Exit fullscreen mode

What the fold does not fix

Folding hides text. It doesn't check it. Simon finds his agents good at describing their work, and yours may well be too, but a description can still say "all tests pass" for a run that never happened. The diff and your CI are the evidence. The description is the agent's account of them.

The label is the honest part of the pattern. Simon uses the model name "to make it abundantly clear what is going on." A reviewer who expands the block knows a model wrote what follows, and a reviewer who doesn't still got two sentences a human stood behind.

Hermes can also open the PR for you: Land commits, opens a pull request or merges locally in one step, into the branch the task started from, and can be undone. That is the quicker path when you don't need a custom body. When you want this exact layout, the script gives you control of every byte of the body.


If this was useful

The AGENTS.md rule in step 1 is a small prompt you reuse on every branch: it says where the output goes, what it must contain and what the agent must not do. My Prompt Engineering Pocket Guide is about writing instructions like that, ones an agent follows the same way on the fiftieth run as on the first.

Hermes IDE is free, source-available under BSL 1.1, and runs on macOS, Windows and Linux: download it or read the source on GitHub.

Prompt Engineering Pocket Guide: Techniques for Getting the Most from LLMs

Top comments (0)