Hunk is a terminal application for reviewing code changes created by coding agents, with views for multi-file diffs, inline annotations, and Git-backed reviews. Developers use it to inspect, navigate, and approve changesets from the command line.
Borrowing it
Nothing to install: this file belongs to modem-dev/hunk. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/modem-dev/hunk/main/AGENTS.mdgit clone --depth 1 https://github.com/modem-dev/hunkWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/modem-dev/hunk/agents-md)<a href="https://agentmods.dev/instructions/modem-dev/hunk/agents-md"><img src="https://agentmods.dev/badge/instructions/modem-dev/hunk/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/modem-dev/hunk/agents-md"><img src="https://agentmods.dev/badge/instructions/modem-dev/hunk/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.03767 | $0.03767 |
| Opus 5.5 | $0.01507 | $0.01507 |
| Sonnet 5.5 | $0.00753 | $0.00753 |
| Haiku 4.5 | $0.00377 | $0.00377 |
Grade A, and why
hunk AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 18d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 232 lines — stays where its author put it; the contents beside it link to each section on GitHub.
hunk agent notes
purpose
- Terminal-first diff viewer for understanding coding-agent changesets.
- Product target is "modern desktop diff tool in a terminal", not a pager-style TUI.
architecture
workspace map
packages/hunk/ published CLI, application, and public extension/OpenTUI facades
packages/hunk-vcs/ private dependency-bottom VCS helpers
packages/hunk-{git,jj,sapling}/ private bundled VCS providers
packages/hunk-gh/ private bundled GitHub review extension
packages/session-broker-core/ low-level broker protocol and state
packages/session-broker/ runtime-neutral broker, daemon, auth, and connection lifecycle
packages/session-broker-{bun,node}/ runtime listener adapters
packages/term-video/ private terminal capture tooling
website/ product/documentation site, not the browser review client
application flow
main.tsx -> app/startup.ts -> app/cli.ts
-> headless command/history plan returned to main.tsx, or
-> app plan: extensionBootstrap.ts -> sessionBootstrap.ts -> normalized Changeset / DiffFile[]
-> main.tsx lazy-loads runInteractiveApp.tsx -> HunkSessionHost -> AppHost -> App
-> pane/diff planning -> Pierre-backed terminal rows
shared review seam
Terminal, agent/session, broker/protocol, extension, and HTTP/SSE consumers share review semantics. The browser client and UI remain planned. Do not recreate semantic review behavior in a surface:
DiffFile[] -> projectReviewDocument -> ReviewDocumentV1 -> ReviewStore
ReviewIntent + caller facts -> planReviewIntent -> ReviewAction[] -> reducer -> surface projection
- Model:
packages/hunk/src/core/review/{types,document,identity}.tsowns the ordered, JSON-safe document. File order is review/sidebar order; usekey(referenced asfileKeyelsewhere),contentIdentity, andsourceIdentity(cached source text additionally requiressourceAttested) — not runtime IDs or indexes — across reloads/surfaces. - Shared derivations:
geometry.ts,expansion.ts,anchors.ts,stml.ts, andcontentManifest.tsown ranges, gaps, source splitting, note targets/ownership, tag roles, and parity manifests. Consume them; never re-derive those facts in a renderer. - State:
state.tsis semantic state;actions.tstransitions;reducer.tspure/no-I/O;selectors.tsshared policies;store.tssynchronous observable storage. New cross-surface operations start as intents. Callers supply mutable-note IDs/timestamps; core derives identities. - Surfaces/publishers:
useTerminalReview.tsis the TUI adapter andreviewNoteMapping.tsis terminal-only. Rows, measurement, scrolling, layout, themes, DOM mechanics, and source I/O stay local.useHunkSessionBridge.tspublishes the current terminal session export;registration.tsbuilds its metadata/initial snapshot andbridge.tsreceives agent commands. This broker export is not a fullReviewStatemirror. - Other consumers: Web/API consumers reuse the model, derivations, state, intents, and the
producer/protocol tier. Never build a parallel protocol. Keep presentation/client-local state
local; host/extension commands need explicit remote capabilities. See
docs/browser-review-rebuild.mdfor the rollout and current boundaries. - Conformance:
test/review-conformance/has hand-authored semantic fixtures covering every registered core, terminal, producer, broker, protocol, and extension projection. Every new semantic consumer registers its real projection and runs the whole corpus.scripts/quality/source-boundaries.test.tskeeps the seam renderer/platform-free; its Node-debt list is shrink-only and tombstone lists append-only. A repaid seam finding deletes copies, adds a file or banned-symbol tombstone and adversarial fixture, registers consumers, and updatesdocs/browser-review-seam-audit.md.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 18d ago Changed · +5 lines · +60 tokens per session 36c472dbbe5d
- 1mo ago Changed · +2 lines · +36 tokens per session 44bf3bf39a6b
- 1mo ago Changed · +8 lines · +173 tokens per session b2a96062009e
- 1mo ago Changed · +3 lines · +60 tokens per session 07e1c7f8a4a2
- 1mo ago Changed · +28 lines · +433 tokens per session f1f0474aa333
- 1mo ago Changed · +63 tokens per session 34056803709b
- 2mo ago First seen · 186 lines · 2,942 tokens per session scan A 6eb5e3076901
hunk AGENTS.md is an instructions file published in the GitHub repository modem-dev/hunk (9,717 stars, last pushed today), licensed MIT. It adds 3,767 tokens to every session, about $0.0151 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode copilot-instructions.md
Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).
deepseek-harness AGENTS.md
AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.