Skip to content
claudemods

Diff, a Claude Code diff pane mod: see the uncommitted changes in your session

A /diff pane for Claude Code: uncommitted git changes, file by file with their hunks, refreshed as Claude edits.

Permissions

  • Reads filesCan read files and list directories on your machine ($.fs.read / list / stat / exists).
  • Runs commandsCan run shell programs on your machine ($.process.run / spawn). Check the source for exactly which ones.
  • Intercepts tool callsSees every tool call Claude makes (tool.call / tool.check) and could block or change it.
  • Reads your promptsCan see what you type and the conversation transcript (prompt.* / session.append / session.messages).
  • Changes the UIDraws into the Claude Code interface: bands, panes, status text, toasts (ui.render / $.ui.*).
  • Adds commands/toolsRegisters new slash commands or tools that you or Claude can invoke ($.command.register / $.tool.register).
  • Stores dataKeeps data between sessions in the plugin's private store ($.store.*).
tested with
v2.1.310
last tested
requires
Claude Code ≥ 2.1.287
surfaces
pane

Install inside Claude Code:

git clone https://github.com/anthropics/claude-code
claude --plugin-dir ./claude-code/mods/diff
All install options ↓

What does this mod do?

Diff is a community-listed mod published by Anthropic in the claude-code repository. It is a Claude Code diff pane: /diff opens the session's uncommitted changes beside the transcript, with one row per changed file and each file's hunks underneath, and /diff again closes it. Each toggle leaves Diff panel shown or Diff panel hidden in the transcript.

The pane refreshes after Claude edits a file or runs a shell command, and while it is open it polls the repository's HEAD so a commit or checkout made elsewhere shows up too. It can compare the working tree with HEAD split at the start of the session (the default), with HEAD plainly, or with the merge-base of the default branch, and a picker can show one earlier turn's edits instead. Files that changed before the session started, plus lockfiles, generated files and tests, are listed apart and folded.

Where the terminal is wide enough, the first successful edit of a session opens the pane by itself. Without the fullscreen layout, /diff opens an inline dialog instead: a file list with five rows around the selected one, where Enter shows that file's hunks alone and Escape backs out. A file's [ ask ] button arms it, so its hunks ride the next prompt as context, once.

Demo

The recording starts Claude Code with the mod loaded in the small demo project, which has one uncommitted edit. It types /diff and the autocomplete lists "Toggle the diff panel showing uncommitted changes". After Enter, a bordered dialog opens above the prompt titled Uncommitted changes (git diff HEAD), with 1 file changed +2. It lists src/index.js with an [ ask ] button and, below it, the hunk with line numbers and the two added lines highlighted in green. The footer reads ↑/↓ to scroll · Esc to back. The clip stays on the dialog for several seconds. It shows the inline dialog form, because the demo terminal does not use the docked layout.

Install

Use any of the methods in the install block; they install straight from the author's own repository. After the next session start, type /diff inside a git repository that has a modified file.

$ install diff

Requires Claude Code ≥ 2.1.287

Installs from the author's own marketplace: anthropics/claude-code

  1. 1.Try it without installing

    git clone https://github.com/anthropics/claude-code
    claude --plugin-dir ./claude-code/mods/diff

    Loads the mod for one session only. Nothing is added to your settings.

How it works

The module hooks/register.ts registers /diff on session.start, draws the Pane component, and listens to tool.call for Edit, Write, NotebookEdit, Bash and PowerShell to know when to refresh. Every git child is given the repository's pinned git directory and work tree, and every diff starts from the same fixed arguments, from hooks/git/argv/diff-leading-args.ts:

export const DIFF_LEADING_ARGS = [
  '--no-optional-locks',
  '-c',
  'diff.relative=false',
  '-c',
  'core.quotePath=false',
  'diff',
  '--no-ext-diff',
  '--no-textconv',
  '--ignore-submodules=dirty',
  '--submodule=short',
] as const

Git is run only at the moments the built-in panel would run it: not at session start, once to find the repository when /diff or the first edit needs it, and then for fetches after an edit or a shell command. Output is capped, and files past 500 are shown as totals only. The mod stands down when another /diff command is already registered in the session.

Customize it

The mod has no options in /config. The comparison base is chosen in the pane, and ctrl+x b moves it on; the choice is kept per repository in the plugin's own store. The list scrolls with ctrl+up/ctrl+down and opt+up/opt+down. If you do not want the pane to open on the first edit, close it once and the mod remembers. Setting CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING also stops automatic opening.

Permissions & safety

We read the manifest, hooks/hooks.json, hooks/register.ts and searched the other roughly 800 files under hooks/ for network, process, file-write and environment access. We did not read every line of the 3.4 MB directory, which is mostly small TypeScript modules and tests. There is no package.json, install script, binary, minified or encoded code.

  • Changes the UI: the pane or dialog, and toasts.
  • Adds a command: /diff.
  • Processes: $.process.run for read-only git subcommands only (rev-parse, status, diff, ls-files, merge-base, show-ref, symbolic-ref), with the locale forced to C.
  • Network: none found. Files: reads files and timestamps in the repository through $.fs; writes only to $.store.
  • Environment: reads CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING.
  • Telemetry: calls $.telemetry.log and $.telemetry.mark, which are dropped where Claude Code's telemetry built-in is absent; we did not find the mod sending anything itself.
  • Model influence: the prompt.submit hook adds an armed file's hunks to the prompt context, only after you press that file's ask button.
  • License: LICENSE.md says all rights reserved, with no SPDX id, so this page links and does not mirror.

claude plugin validate reported no errors or warnings for the plugin, but listed advice that the README has no install line and a missing-icon notice, plus notes that seven hooks have no .catch. The author's tests passed: 234 pass, 0 fail across 30 files, on Claude Code 2.1.310.

Reads files
Can read files and list directories on your machine ($.fs.read / list / stat / exists).
Runs commands
Can run shell programs on your machine ($.process.run / spawn). Check the source for exactly which ones.
Intercepts tool calls
Sees every tool call Claude makes (tool.call / tool.check) and could block or change it.
Reads your prompts
Can see what you type and the conversation transcript (prompt.* / session.append / session.messages).
Changes the UI
Draws into the Claude Code interface: bands, panes, status text, toasts (ui.render / $.ui.*).
Adds commands/tools
Registers new slash commands or tools that you or Claude can invoke ($.command.register / $.tool.register).
Stores data
Keeps data between sessions in the plugin's private store ($.store.*).

Compatibility & troubleshooting

Checked with Claude Code 2.1.310 on macOS (validate, tests and the recording). If /diff shows nothing:

  • You are inside a git repository; outside one, /diff says so and does nothing else.
  • A file is actually modified; otherwise you see No changes this session.
  • Another /diff is registered: the mod then leaves itself idle.
  • For the automatic open, the terminal is at least 144 columns wide under the fullscreen layout.
  • Under 110 columns in the fullscreen layout you get a line asking for a wider terminal.

FAQ

Does Diff send my code anywhere?
No network code was found. It runs read-only git commands (rev-parse, status, diff, ls-files, merge-base, show-ref, symbolic-ref) on your machine and draws the result. The only text that reaches the model is a file's hunks, and only after you arm that file with its ask button.
Does it change my repository?
No. Every git command we found is a read, run with --no-optional-locks, --no-ext-diff and --no-textconv. The plugin's only writes go to its own store, which remembers whether the pane was open and which comparison base you picked.
Why does /diff sometimes open on its own?
After the first successful edit of a session, if file checkpointing is on and the terminal is wide enough (144 columns, or 110 if you kept the pane open before). If you closed it, it leaves you alone. Narrower terminals and inline layouts only open it through /diff.
What does the ask button do?
It arms one file. On your next prompt the plugin adds that file's hunks to the prompt as context, once, and disarms. If the hunks do not fit in the context room they are dropped and the status line says so.
Can I redistribute or fork it?
Not on the basis of what we found. The repository's LICENSE.md says "All rights reserved" and points to Anthropic's Commercial Terms of Service, so we link to the repository and do not mirror the code.
Git Branch Above Prompt running in Claude CodeFeatured

Git Branch Above Prompt

Shows your git branch, changed-file count and ahead/behind status in a one-line band above the Claude Code prompt.

  • above-prompt
  • Runs commands
  • Intercepts tool calls
  • Changes the UI

tested with v2.1.310

cc-pr-tracker running in Claude CodeFeatured

cc-pr-tracker

One line per GitHub PR above the Claude Code prompt: merge state, review, required checks, and alerts on change.

  • above-prompt
  • toast
  • Reads files
  • Runs commands
  • Intercepts tool calls
  • Reads your prompts
  • Changes the UI
  • Adds commands/tools
  • Stores data

tested with v2.1.296

Blast Radius running in Claude CodeFeatured

Blast Radius

Holds rm -r, force pushes and database migrations in Claude Code and shows what they would change before they run.

  • pane
  • above-prompt
  • Runs commands
  • Intercepts tool calls
  • Changes the UI

tested with v2.1.291

More in Git & GitHub, Tools you add to Claude.