Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Margin documentation

Margin is the terminal review workspace for agent-assisted code: inspect changes, accept good hunks, reject bad ones safely, and return precise feedback while remaining accountable for every change.

brew install imrajyavardhan12/tap/margin
margin            # review the working tree

Where to go

If you want to…Read
learn the keysKeybindings
change themes, layout, or behaviourConfiguration · Themes
script Margin or feed an agentJSON output
understand current directionRoadmap
understand how it is built nowArchitecture
know why it is built that wayDecision records
see what shippedChangelog
read the original planHistorical blueprint
contributeContributing

Documentation authority

The root CONTEXT.md defines domain language, the README describes the current product, the roadmap describes direction, this book’s architecture page describes the current Implementation, ADRs preserve durable decisions, and the changelog records shipped history. The blueprint is historical and is not maintained as a live specification.

The review loop

Margin exists for the case where something else wrote the code and you have to decide whether to keep it:

  1. margin opens the working tree — untracked files included.
  2. J / K move by hunk, ] / [ by file, / searches the whole changeset.
  3. s stages a hunk you accept; x discards one you don’t (backed up to .git/margin/trash/ first — margin undo restores it).
  4. c leaves a note on a hunk that needs a human answer.
  5. m checks a file off. The mark is keyed to the file’s content, so it survives a rebase and clears itself if the file changes again.
  6. margin --notes prints every note as Markdown with path:line anchors — paste it into a pull request, or hand it back to the agent.

Nothing is written to your repository unless you press a key that says so, and the only destructive key asks you to type yes.