Skip to main content
株式会社オブライト
Software Development2026-07-10

Hunk Deep Dive — A Terminal Diff Viewer Purpose-Built for Code Review and AI-Agent Integration, With hunk diff / hunk show CLIs, Inline AI Annotations, Watch Mode, and Themes Including Graphite / Midnight / Catppuccin Node.js 18+ / MIT / Installable via npm, Homebrew, and Nix

Hunk is a terminal-based diff viewer purpose-built for code review and AI-agent integration — a replacement for stock git diff, with review-experience as a first-class design goal. Key features: (1) multi-file review sidebar — see the whole changeset, navigate files, view change counts, (2) inline AI annotations — reasoning from AI agents (Claude Code, Cursor, etc.) shows adjacent to the relevant code, (3) adaptive layout — split / stacked / auto-responsive views auto-adjust to terminal width, (4) watch mode — auto-refreshes as the working tree changes, (5) syntax highlighting + themes — Graphite / Midnight / Ember / Zenburn / Catppuccin, (6) multiple input methods — keyboard, mouse, pager integration. CLI commands: hunk diff (uncommitted changes) and hunk show (a commit). Tech stack: Node.js 18+, MIT license, distributed via npm / Homebrew / Nix. Position: the terminal counterpart to Crit.md's browser PR-review experience; alongside Herdr (parallel agent operations), it's part of the same "terminal-native AI-agent era" trend. Target users: developers doing code reviews, teams integrating AI tools into dev workflows, and terminal-first engineers.


TL;DR — What Hunk Is

Hunk is a terminal-based diff viewer built for code review and AI-agent integration — a review-first successor to git diff.

Four takeaways:

1. A successor to git diff — multi-file sidebar, AI annotations, watch mode as first-class features
2. Inline AI annotationsClaude Code's reasoning appears next to the relevant code
3. Adaptive layout + themes — Graphite / Midnight / Ember / Zenburn / Catppuccin
4. MIT — free install via npm / Homebrew / Nix; Node.js 18+

The Problem — `git diff` Doesn't Fit Modern Review

What git diff misses today:

- No multi-file overview — the changed-files list is a separate command; jumping is friction
- No AI-era support — no way to show Claude Code / Cursor reasoning
- Static output — no watch mode; you re-run to check changes
- Doesn't use screen width — no split view or adaptive layout
- Colors depend on terminal — no built-in Graphite / Midnight / Catppuccin themes

Hunk's answer: treat "review experience" as a first-class design goal, keep the terminal-native feel, and match GUI IDE diff viewers on functionality.

The Six Core Features

1. Multi-File Review Sidebar

See the whole changeset in the sidebar:
- File list with +/- counts
- Navigate files with ↑↓ or a mouse click
- Current file is highlighted

The GitHub PR Files tab experience, in the terminal.

2. Inline AI Annotations

Show the agent's reasoning next to the code it wrote:
- If Claude Code makes a change, its explanation appears to the right of the diff
- Same for comments from Cursor, OpenCode, etc.
- You read "the code the AI wrote" and "why the AI wrote it" together

This is a foundational pattern for the AI-coding-agent review era — Hunk brings Crit.md's browser experience to the terminal.

3. Adaptive Layout

Layout adjusts to terminal width:
- split: side-by-side before / after (wide terminals)
- stacked: top / bottom (narrow terminals)
- auto-responsive: detects width and picks

Always the right display, from an iTerm2 full-screen down to a narrow SSH window.

4. Watch Mode

Working tree changes trigger auto-refresh:
- hunk diff --watch runs continuously, refreshing on file changes
- Great for watching Herdr panes where agents are rewriting code from a separate pane
- Live view of what's changing — tmux + Herdr + Hunk gives you an ideal observation setup

5. Syntax Highlighting + Themes

Built-in themes:
- Graphite — calm grayscale
- Midnight — dark base (night work)
- Ember — warm palette
- Zenburn — low-contrast, eye-friendly
- Catppuccin — the popular scheme

Language-aware syntax highlighting for JavaScript / TypeScript / Python / Rust / Go / Ruby and other majors.

6. Multiple Input Methods

Keyboard + mouse + pager integration:
- Keyboard: Vim / Emacs-style shortcuts; j/k to move lines, n/N to move files
- Mouse: sidebar clicks, scroll, pane selection
- Pager integration: cooperates with less / bat and similar tools; embeddable in CI logs

Fits Vim natives and GUI-first developers alike.

CLI Commands

Two main commands:
- hunk diff — show uncommitted changes (replaces git diff)
- hunk show — show a specific commit (replaces git show)

Common options:
- --watch — watch mode
- --theme <name> — pick a theme
- --layout <split|stacked|auto> — layout override
- --no-mouse — disable mouse

Installation

Three channels:

bash
# npm
npm install -g @hunk/cli

# Homebrew (macOS / Linux)
brew install hunk

# Nix
nix profile install nixpkgs#hunk

Requirements: Node.js 18+ (for the npm route). License: MIT, free, commercial-use allowed, source is open.

AI-Agent Integration Patterns

Pattern A: Claude Code + Hunk

Flow:
1. Tell Claude Code to implement a feature
2. When it finishes, hunk diff for the changes
3. Read the AI reasoning column to understand its thinking
4. Approve or send back for revision

Pattern B: [Herdr](../columns/herdr-terminal-agent-multiplexer-2026-07) + Hunk

Flow:
1. Pane A: Claude Code running a long task
2. Pane B: hunk diff --watch follows changes in real time
3. If something looks off, jump to Pane A and redirect / interrupt

Pattern C: Coexistence With [Crit.md](../columns/crit-md-local-first-agent-review-2026-07)

Division of labor:
- Hunk — the terminal diff viewer when you personally want to see this change right now
- Crit.md — the browser PR-review experience for team or iterative review with line-level comments + persistence

They complement each other — Hunk for quick reviews, Crit.md for structured team review.

Positioning — the Terminal-Native AI-Agent Era

The late-2026 "terminal-native AI dev stack":

ToolRoleRelated column
HerdrAgent multiplexingsibling column
Hunk (this column)Diff review
Crit.mdBrowser PR reviewLocal-first
Claude CodeThe agentTerminal type
Cursor CLIThe agentTerminal + iOS
Nous PortalModel substrate300+ frontier

Hunk's unique spot: it captures the new demand for "a high-quality diff, terminal-native, with AI annotations", and combined with Crit.md it rounds out an ideal 2026 review environment.

Caveats and Warnings

(1) Node.js dependency: npm install needs Node 18+; use the Nix or Homebrew route if you don't want the Node runtime.

(2) Not every agent's annotations render: the annotation display depends on the agent producing annotations in a supported format. Major agents are supported.

(3) Large diffs: thousand-file, ten-thousand-line diffs may take a while to start; plan usage around repo size.

(4) Terminal compatibility: Terminal.app / iTerm2 / Alacritty / Kitty / WezTerm work well; older terminals or older Windows Terminal builds may have highlight / Unicode issues.

(5) Team standardization: perfect as an individual tool; if you want a team-wide review format, plan how it splits with Crit.md or GitHub PRs.

Recommended Actions

Solo developers: replace git diff with Hunkalias gd="hunk diff" in .zshrc / .bashrc upgrades your review immediately.

Teams: leave Watch mode running to observe the agent's work in the background. Personal review = Hunk; team review = Crit.md or GitHub PRs.

AI-agent integration: make it a habit to open diffs from Claude Code / Cursor / OpenCode in Hunk. Read the AI annotations before accepting.

Bottom Line

Hunk is terminal-native review infrastructure for the AI-agent era. It answers every limitation of git diff (no overview, no AI annotations, static output, fixed layout) and comes with Node.js 18+ / MIT / npm-Homebrew-Nix distribution for zero-friction adoption. Combined with Herdr (parallel agent ops), Crit.md (HITL review), and Claude Code / Cursor, it's an indispensable part of the late-2026 terminal-native AI dev stack.

Related services from us — software development, AI consulting, and Hermes Agent setup. For designing enterprise terminal-native AI dev environments or building agent + Hunk + Herdr workflows, get in touch.

References

Feel free to contact us

Contact Us