Skip to content

seanoliver/code-guide

v1.0.0MIT

Turn a pull request, or a question about how code works, into a zoomable canvas of the files involved, with callouts, a merged diff, and every line checked against git.


Ask your agent for a guide to a PR, and you get one HTML file:

"Make a code guide for PR #11"

The demo above is PR #11 of sealed.page, which sends a failed signup magic link back to /signup instead of /login. To try it, download code-guide-demo.html and open it in a browser.

System view

See the whole PR at once. Each folder is a box and each file is a tile. Arrows show calls, data, and HTTP requests between them, and each tile's side bar maps where the highlighted lines sit in the file, top to bottom.

Summary bullets

Every claim points at its code. Each TL;DR bullet carries references to the lines that prove it. Hover a bullet and those lines are highlighted in every file; click it to zoom there.

Semantic zoom

Zoom from folders to lines. One continuous zoom runs through three levels: System (tiles), Snippets (just the highlighted lines), and Code (complete, syntax-highlighted files with callouts).

Deterministic build

Every line is deterministically checked against git. The model never draws the canvas or picks line numbers. It writes a guide.json that quotes a piece of each line it wants to point at. Then build.py reads the files from git, finds each quote with a plain string match, computes the diff, and writes one HTML file. The browser lays out the graph with ELK when you open it.

model ──writes──▶ guide.json ──build.py──▶ resolves every quote against the file from git
                                           git diff base...HEAD → added and deleted lines
                                           → one self-contained HTML file (ELK lays it out in the browser)

A quote that matches nothing, or matches more than one line, fails the build. A callout can't point at the wrong line.

Merged diff

Diffs merged in place. In PR mode, deleted lines sit in red directly above the lines that replaced them, numbered by their old line numbers. Press d and they fold away so you can read the final file.

Callouts

Callouts open beside the line. In Code view each callout is a one-line title next to the line it explains. Click to open it. It stays open until you close it.

Guided tour

Every guide includes a 4–9 step tour in reading order. Each step zooms to one line and highlights the links it crosses. Arrow keys step through it.

Install

Claude Code

/plugin marketplace add seanoliver/code-guide
/plugin install code-guide@code-guide

Codex

codex plugin marketplace add seanoliver/code-guide
codex plugin add code-guide@code-guide

Other agents: copy skills/code-guide/ into any agent's skills folder that loads SKILL.md skills.

Requirements: python3, git, and a browser. gh is used to read PR descriptions.

Usage

"Make a code guide for PR #482"
"Walk me through this branch visually"
"Show me how the checkout flow works as a code guide"
  • pr mode: the PR's changed files plus the code they call or are called by, with the merged diff.
  • explore mode: traces one question ("how does X work") from its entry point to where the behavior is decided.

The agent reads the code in a detached git worktree, so your checkout and branch are never touched. Output is written to docs/guides/YYYY-MM-DD-<slug>/ as guide.json and guide.html.

Roles and flags

Each highlight gets one role, shown by color everywhere it appears:

RoleMeaning
coreDoes the thing being asked about
supportingChanges how the core path runs
plumbingPasses things along, with no logic of its own
contractTypes, schemas, API shapes
testTests that pin the behavior

Flags are gotcha (behaves differently from what a reader would assume) and changed (added automatically in PR mode).

Data and privacy

code-guide sends no telemetry and runs no server. Full policy: PRIVACY.md.

  • build.py reads files from your local checkout and runs git diff locally. It makes no network requests.
  • The generated guide.html embeds the code it shows. When you open it, the browser loads elkjs from cdn.jsdelivr.net and highlight.js from cdnjs.cloudflare.com. Those requests fetch the libraries; no code or guide data is sent.
  • The agent reads your code the same way it does for any other task, through whichever model provider you already use.

The plugin ships no hooks, binaries, or MCP servers. The skill has your agent run these commands locally, through the agent's own shell tool and its normal permission prompts:

  • git fetch and git worktree add --detach, to read the code without touching your checkout, then git worktree remove when done
  • gh pr view, in PR mode, to read the PR description
  • python3 build.py, to resolve anchors, compute the diff, and write guide.html
  • python3 -m http.server --bind 127.0.0.1, to serve the guide locally for the browser check

Limits

  • Guides with more than about 15 files or 5k lines get slow.
  • The canvas loads its layout engine (elkjs) and syntax highlighter (highlight.js) from a CDN, so it needs a network connection.
  • Very deep call chains need about 90% zoom to fit the System view on a 1440px screen.

Files

skills/code-guide/
├── SKILL.md                 # the workflow the agent follows
├── reference.md             # guide.json schema, anchor rules, validation
├── build.py                 # resolves anchors, computes the diff, validates, renders
├── template.html            # the canvas renderer (one file, same for every guide)
└── examples/sealed-pr-11.json