hunk: Instructions file for Codex

AGENTS.md

hunk AGENTS.md is an instructions file for Codex, OpenCode from modem-dev/hunk. It costs 3,767 tokens per session, scanned A, original, MIT.

Repository instructions for hunk, a terminal-based tool for reviewing coding-agent changes. They describe its architecture and shared data and review rules.

In plain words
What is it for?
Finding the right files, working on diff parsing and review models, extending the terminal interface, and preserving shared review behavior across surfaces.
Why use it?
They help contributors understand where review behavior belongs and keep the terminal, web, and future interfaces consistent.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md.

This is modem-dev/hunk's own configuration. It tells Codex and OpenCode how to work on hunk itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything hunk configures →

About the project

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.

modem-dev/hunk · 9,717 stars · on GitHub · hunk.dev

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/modem-dev/hunk/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/modem-dev/hunk

Made for: Codex, OpenCode.

Wrote 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.

agentmods badge for hunk AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/modem-dev/hunk/agents-md/github.svg)](https://agentmods.dev/instructions/modem-dev/hunk/agents-md)
Your own site
<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.

agentmods 80×15 button for hunk AGENTS.md

Your own site · 80×15
<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>
Per session 3,767 This file is loaded in full into every session.
When invoked 3,767 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 18d ago against content hash 36c472dbbe5d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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.

AGENTS.md · 232 lines

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}.ts owns the ordered, JSON-safe document. File order is review/sidebar order; use key (referenced as fileKey elsewhere), contentIdentity, and sourceIdentity (cached source text additionally requires sourceAttested) — not runtime IDs or indexes — across reloads/surfaces.
  • Shared derivations: geometry.ts, expansion.ts, anchors.ts, stml.ts, and contentManifest.ts own ranges, gaps, source splitting, note targets/ownership, tag roles, and parity manifests. Consume them; never re-derive those facts in a renderer.
  • State: state.ts is semantic state; actions.ts transitions; reducer.ts pure/no-I/O; selectors.ts shared policies; store.ts synchronous observable storage. New cross-surface operations start as intents. Callers supply mutable-note IDs/timestamps; core derives identities.
  • Surfaces/publishers: useTerminalReview.ts is the TUI adapter and reviewNoteMapping.ts is terminal-only. Rows, measurement, scrolling, layout, themes, DOM mechanics, and source I/O stay local. useHunkSessionBridge.ts publishes the current terminal session export; registration.ts builds its metadata/initial snapshot and bridge.ts receives agent commands. This broker export is not a full ReviewState mirror.
  • 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.md for 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.ts keeps 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 updates docs/browser-review-seam-audit.md.

Read the full file on GitHub · 232 lines

Changes

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.

  1. 18d ago Changed · +5 lines · +60 tokens per session 36c472dbbe5d
  2. 1mo ago Changed · +2 lines · +36 tokens per session 44bf3bf39a6b
  3. 1mo ago Changed · +8 lines · +173 tokens per session b2a96062009e
  4. 1mo ago Changed · +3 lines · +60 tokens per session 07e1c7f8a4a2
  5. 1mo ago Changed · +28 lines · +433 tokens per session f1f0474aa333
  6. 1mo ago Changed · +63 tokens per session 34056803709b
  7. 2mo ago First seen · 186 lines · 2,942 tokens per session scan A 6eb5e3076901

Subscribe to this mod's changes

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.

Related

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).

microsoft/vscode · 9,715 tokens

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.

vercel/next.js · 7,461 tokens

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).

microsoft/vscode · 5,262 tokens

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.

langchain-ai/langchain · 4,680 tokens

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).

microsoft/vscode · 2,750 tokens

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.

deepseek-ai/deepseek-harness · 4,261 tokens