Teach your AI how you write

Mark up AI-generated text with corrections, voice signals, and writing rules. Margin turns your feedback into a style guide your AI actually follows.

for macOS · Free & open source

Margin with highlights and margin notes

Most AI writing tools try to fix your words after the fact. Margin works the other way — you mark up what's wrong, and your corrections compound into rules your AI follows before it writes.

Built for annotating

If the tool doesn't feel good to sit in, you won't annotate. If you don't annotate, your AI never learns.

Typography and measure

A 65-character measure, generous line-height, dark mode. Your markdown files become pages worth sitting in.

Six colors of thought

Highlight passages in six colors. Write margin notes in the gutter. Undo anything. Each color can carry its own meaning.

Local-first, always

Files stay on disk. Annotations live in a local SQLite database. No account, no cloud, no telemetry. Open the database yourself — it's just a file.

Style Memory

The biggest gap in AI writing isn't capability — it's that your AI doesn't know what you sound like. Style Memory closes that gap. React to what your AI gets wrong, and your preferences compound into a system it actually follows.

Corrections

When your AI writes something wrong — wrong tone, wrong phrasing, wrong instinct — highlight it and add a note. Margin captures the original text, your feedback, and the surrounding context. Tag each correction with a writing type so rules stay scoped.

generalemailprdblogcover-letterresumeslackpitchoutreach
Margin showing corrections with pink highlights, strikethroughs, and an export summary

Corrections with voice signals exported to file

Voice signals

Not every correction means "stop doing this." Some mean "do more of this." The polarity system lets you tag corrections as positive (emulate this) or corrective (avoid this). Your AI learns both what to reach for and what to stay away from.

Positive

"This opening is exactly the right energy — conversational, mid-thought, no preamble."

Corrective

"Never use 'furthermore' — it's an AI transition tell."

Rules and export

Corrections synthesize into writing rules — concrete instructions your AI can follow. Rules auto-export to ~/.margin/writing-rules.md. Point Claude at this file and it reads your rules before writing anything.

# Writing Rules

_For AI agents: apply rules matching the writing type._
_General rules always apply._

## General

### Voice Calibration

**Rule: Almost never end messages with periods
(~0.8%). This is the single strongest voice
signal.** [must-fix]
- When to apply: All casual and semi-formal writing
- Why: Periods on short messages are the #1 AI tell
- Signal: seen 10 time(s)

### Ai Slop

**Rule: Eliminate sentence patterns that signal
AI-generated text.** [must-fix]
- Before: "The deeper issue isn't that AI features
  are hard to build in-house. It's that AI makes it
  trivially easy..."
- After: "AI makes it trivially easy for anyone to
  reverse-engineer product surface area."

### Authenticity

**Rule: Remove any claim you do not genuinely
believe or cannot defend with your own
experience.** [must-fix]
- Why: Readers and interviewers will probe claims;
  inauthentic ones collapse under scrutiny.

Writing guard hook

Margin generates a Claude Code hook that blocks kill words automatically. Every time Claude tries to write "leverage" or "furthermore," the hook intercepts the edit before it lands.

# ~/.claude/hooks/margin-writing-guard.sh
# Auto-generated by Margin — regenerated on rules export

KILL_WORDS=("leverage" "utilize" "furthermore"
            "moreover" "additionally")

for word in "${KILL_WORDS[@]}"; do
  if grep -qi "$word" "$1"; then
    echo "BLOCKED: '$word' violates your writing rules"
    exit 1
  fi
done

Your corrections compound

10 correctionsyour AI stops saying "leverage"
50 correctionsit matches your tone
200 correctionsfirst drafts you barely edit

What you can do with it

Margin's MCP server exposes your documents, annotations, and rules to Claude. These are real workflows, not hypotheticals.

Writing review

Review my writing rules and tell me which ones this draft violates

Claude reads your exported rules and audits a draft against them.

Annotation analysis

I just exported from Margin — review the annotations and give me revision notes

After exporting highlights and notes, Claude turns them into actionable edits.

Pattern detection

What patterns are showing up in my corrections this month?

Claude surfaces recurring mistakes across your correction history.

Automated annotation

Add a margin note to every paragraph that uses passive voice

Claude reads a document through MCP and annotates it programmatically.

Diff review for AI edits

Claude Code edits your file. Margin notices. An FSEvents watcher detects changes, shows a diff banner, and renders inline diffs with green insertions and red deletions. Review each change and keep or revert it — one hunk at a time.

+ Your AI should write like you.
- Your AI should leverage synergies.
↑ Keep    ↓ Revert    ⌘Z Undo all

20+ MCP tools

Your documents, annotations, corrections, and writing rules — exposed to any MCP-compatible AI client. Read files, create highlights, search across your library, export rules as prompt-ready markdown.

// Example: highlight text and attach a note
{
  "tool": "margin_highlight_by_text",
  "arguments": {
    "document_id": "abc-123",
    "text_to_highlight": "We leverage AI to optimize",
    "color": "pink",
    "note": "Kill this. Say 'we use AI to save time.'"
  }
}

Works the way your Mac does

Default .md handler

Double-click any markdown file. It opens in Margin.

Quick launch

Open recent files from Raycast, Spotlight, or the command line.

File watcher

Edit the file in another app. Margin picks up changes without reloading.

Claude Desktop toggle

Enable the MCP server from Margin's preferences. No config files needed.

Auto-updater

Margin checks for updates on launch and installs them in the background.

Your AI should write like you

Free, open-source, and yours to keep.

Built by Sam Zoloth. Source on GitHub.