Dev tools

PR Story Mode

An LLM-powered CLI and Chrome extension that turns a GitHub pull request into a narrated, step-by-step code walkthrough.

PR Story Mode turning a GitHub pull request into an ordered, step-by-step walkthrough with an outline and explained code

Why I built it

AI has exponentially increased how much code gets written, and reviewing it has quickly become one of the key bottlenecks in the development cycle.

I still believe in reading through the code myself (for now). So I decided to focus on making the reading itself a better experience. GitHub shows a pull request as a list of files sorted by path, which is almost never the order the change makes sense in. You end up jumping between files to find where a new function is defined, or reading a caller before the thing it calls. And unless the author has heavily commented their work, it can often be quite difficult to follow exactly what the changes are meant to be doing.

What it is

PR Story Mode reads a pull request as a story instead of a pile of files. It puts the changes in an order that makes sense, like a new type before the code that uses it or a helper before its callers. It explains each step in plain language, with the code right below the words that describe it.

Every changed line appears exactly once, so you can still review line by line and nothing gets skipped. Formatting, renames, reordered imports and lockfiles are set aside in their own section, so the steps show the real changes.

It comes in two forms:

  • A Chrome extension that adds a Story mode button to pull requests on GitHub. You can highlight code to ask about it, and leave review comments without leaving the story.
  • A command-line tool that writes a story as a single HTML page, for local branches and scripts.

It uses your own model API key, and a typical pull request costs about 11 cents to turn into a story.

How it works

How PR Story Mode turns a pull request into a story A pull request is ingested, split into syntactic units with tree-sitter, and classified; mechanical changes such as formatting, renames, imports, lockfiles and generated files go to a side section shown after the steps. The rest are linked in a symbol graph, the model plans an order, and code validates that every line appears exactly once with dependencies first, sending errors back to the model for up to three repair rounds before falling back to plain dependency order. Unchanged context is added and the model explains each step in beats, producing the story. runs as code model call Pull request input on GitHub, or a local branch Ingest github.ts diff, old and new files, linked issues Atomize tree-sitter each changed line → its smallest enclosing unit Classify classify.ts set aside mechanical changes, spot moves Mechanical formatting, renames, imports, lockfiles, generated files shown after the steps Symbol graph graph.ts A → B when A defines something B uses Model plans the order order.ts groups the changes into steps Validate & repair validate.ts every line exactly once, dependencies first repair loop errors go back to the model, up to 3× still failing: plain dependency order Unchanged context context.ts definitions and callers the PR didn't touch Explain in beats explain.ts a few sentences, then the code they describe Story output ordered steps to read, each line once
From pull request to story. Blue stages run as code; orange ones call the model.
  1. Split the change into pieces. tree-sitter parses both versions of every changed file, and each changed line is matched to the smallest piece of code around it, such as a function, a method or a config key.
  2. Find what depends on what. A symbol graph links pieces together: if one piece defines something another uses, the definition has to come first.
  3. Set aside mechanical changes. Formatting-only edits, consistent renames, import shuffles, lockfiles and generated files go to their own section.
  4. Plan the order. The model groups the pieces into steps and orders them so they read well. The plan is then checked in code: every line must appear exactly once, and no step may come before something it depends on unless the model says why. A plan that fails goes back to the model to fix, up to three times, before falling back to plain dependency order.
  5. Find helpful unchanged code, such as the definitions the changed lines use and existing callers of code that changed, and show it collapsed above each step.
  6. Explain each step in short beats: a few sentences, then the lines of code they describe. Words in the explanation link to the exact lines they’re about.

The first step usually appears in about 15 seconds, and you can start reading while the rest are written.

Measuring it

An evaluation benchmark of 60 real PRs scores the output with LLM-as-judge rubrics, calibrated against hand labels and blind pairwise comparisons with raw diffs. A separate run over 40 recent Flask and ky pull requests checks the mechanics: every changed line covered in all 40, and no plan breaking dependency order without saying why.

Next projectDig Deeper →