hunk AGENTS.md

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

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/modem-dev/hunk/agents-md
Clone the repo
git clone --depth 1 https://github.com/modem-dev/hunk

Made for: Codex, OpenCode.

Per session 2,942 This file is loaded in full into every session.
When invoked 2,942 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.02942 $0.02942
Opus 5 $0.01471 $0.01471
Sonnet 5 $0.00588 $0.00588
Haiku 4.5 $0.00294 $0.00294

Measured yesterday against content hash 6eb5e3076901, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 yesterday.

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 · 186 lines

How it starts

The opening of the file, as written. The whole thing — 186 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

CLI input
  -> parse runtime + config-backed view options
  -> normalize into one Changeset / DiffFile model
  -> App shell coordinates state, layout, and review navigation
  -> pane components render review UI
  -> Pierre-backed terminal renderer draws diff rows

shared review seam

Review core serves multiple surfaces: TUI today; web, API, and agent/runtime consumers later. Do not recreate semantic review behavior in a surface:

DiffFile[] -> projectReviewDocument -> ReviewDocumentV1 -> ReviewStore
ReviewIntent + caller facts -> planReviewIntent -> ReviewAction[] -> reducer -> surface projection
  • Model: 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/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 · 186 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. yesterday 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 (8,933 stars, last pushed yesterday), licensed MIT. It adds 2,942 tokens to every session, about $0.0147 per session on Opus 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.