Skip to content

K1ta141k/margin

Repository files navigation

Margin

An AI-native editor for PDF, LaTeX, and Markdown. Claude edits your document in place, the rendered output updates live, and every claim stays linked to the source it came from. It runs on your own Claude subscription, not a metered API key.

Demo

Margin demo

A live PDF edit, a Markdown edit, and Claude citing its own sources as it goes (sped up).

Launch post: LinkedIn.

Margin is a desktop app (Tauri + React) that pairs a live document renderer with an agent that makes surgical, in-place edits:

  • Edit in place, render live. Ask Claude to change one paragraph and it changes one paragraph; the PDF recompiles (SwiftLaTeX/WebAssembly) or the Markdown re-renders (KaTeX) in place. No rewrite-recompile-reopen loop.
  • Source provenance. Every claim the agent writes is linked to its source in a hidden .margin/provenance.json sidecar. Hover a passage to see its source, click a source to jump to the passage; the agent can find a source on the web and cite it for you.
  • Bring your own subscription. The agent runs through the Claude Code CLI, so it uses the Claude plan you already have. Pick the model (Opus / Sonnet / Haiku / Fable) from the composer or the Cmd+K palette.

Requirements

  • macOS (Apple Silicon or Intel).
  • The Claude Code CLI installed and signed in. Margin shells out to it; without it the editor renders but the agent will not run.
  • Node.js 18+ and Rust (stable) to build from source.

Develop

npm install
npm run tauri dev

Frontend only (Vite, no desktop shell): npm run dev. Tests: npm test (Vitest) and cargo test in src-tauri/.

Build a desktop app

npm run tauri build
# output under src-tauri/target/release/bundle/

The build is unsigned. On first launch macOS Gatekeeper will block it; clear the quarantine flag once after moving it to /Applications:

xattr -dr com.apple.quarantine /Applications/Margin.app

For a universal (Intel + Apple Silicon) binary:

rustup target add x86_64-apple-darwin aarch64-apple-darwin
npm run tauri build -- --target universal-apple-darwin

How it works

  • src/ — React UI, the render pipeline (Markdown + PDF), provenance marks, and the command palette.
  • src-tauri/ — the Rust backend: spawns the Claude Code CLI per turn, streams results, manages project files and per-project snapshots.
  • public/swiftlatex/ — the in-browser LaTeX engine and a frozen TeX Live subset.

License

MIT. See LICENSE.

About

An AI-native editor for PDF, LaTeX, and Markdown, powered by your Claude subscription. Edits in place with live preview and links every claim to its source.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors