Code Walkthroughs
Have Droid write a walkthrough of every GitHub pull request and keep it current on each new commit, at a low cost per pull request.
The Code Walkthrough automation has Droid write a walkthrough for every pull request in a GitHub repository and update it on each new commit. You read it in the Walkthrough view of Code Review in the Factory App. The workflow only reads the repository, so nothing is posted to the pull request.
What a walkthrough is
A walkthrough explains a pull request the way its author would to a teammate. Instead of listing files in alphabetical order, it splits the change into sections in reading order, core logic first and tests last, and each section shows only the diff lines it explains. Around those sections it adds:
- Overview: what the pull request does.
- Product changes: behavior that users or callers can see, with before and after.
- Under the hood: changes that matter without being visible, such as compatibility, contracts, rollout, safety, and performance.
- Architecture: a diagram of how the touched code fits together.
Changed lines that no section explains appear under Unassigned changes, so nothing in the diff is hidden.
Why use walkthroughs
- Start a review oriented. You know what the change is for and where to begin before you read a line of the diff.
- Read large pull requests one piece at a time. Each section is a self-contained slice of the diff with its own explanation.
- Review what's there now. Every push updates the walkthrough, so it describes the current code, not the first draft.
Set up
- 1Create the automation
In Automations, select New automation, choose Code Walkthrough, and pick a repository. You can also select Set up walkthroughs from the Walkthrough view in Code Review.
- 2Merge the workflow
Select Create. Factory opens a pull request that adds
.github/workflows/droid-code-walkthrough.yml. Merge it. - 3Add the API key
Create a key in the Factory API keys settings and add it to the repository as an Actions secret named
FACTORY_API_KEY.
Walkthroughs run in GitHub Actions, so GitLab merge requests don't get them yet. Pull requests from forks are skipped because GitHub doesn't pass secrets to them. To see a walkthrough before you set this up, select Try it out in the Walkthrough view, and Droid writes one for that pull request in the chat.
Options
Include draft PRsOff by default: Droid skips drafts and writes the walkthrough when the pull request is marked ready for review. Turn it on to also cover drafts, which starts a run on every push to a draft.
ModelBalanced (the default) balances low cost with accuracy. Lite costs even less but sometimes misses details. Factory manages both, so they move to newer models without a workflow change. If your organization's model policy blocks the model, the run uses your organization's default model instead.
How walkthroughs stay low cost
A walkthrough runs on every push, so it's built to cost a small fraction of an agent session:
| Technique | What it does |
|---|---|
| One model call | Droid collects the pull request's file list and numbered patches up front, then writes the walkthrough in a single model call instead of an agent exploring the repository with tools. An agent takes over only when that call can't produce a usable walkthrough. |
| Incremental updates | On a new push, Droid sends the previous walkthrough plus only what changed since it, and keeps the sections and items whose code didn't change. |
| Bounded input | Source files get full patches first, then config, tests, docs, and generated files. Files that don't fit appear as outlines, and very long lines are shortened. The total stays under the size that triggers context compaction, which would multiply the tokens a call uses. |
| One run at a time | A new push cancels the run in progress for that pull request, drafts are skipped by default, and each run stops within 15 minutes. |
Related resources