A better harness for writing.

An open-source, local-first AI writing studio for Markdown users. Margin tracks your context automatically, works with small models, and keeps everything on your machine.

simple-workspace / chapter_1.md
Chapters
chapter_1.md
chapter_2.md
Characters
kaelen.md
Worlds
eldoria.md
Styles
gothic.md
voice.md

Chapter 1 — The Damp Hollow

The fog settled thick over the rotting floor of the wood. Kaelen walked slowly, his eyes shifting behind the branches. The weather was bad, and he was quite cold. The trail had vanished an hour ago under a thick shroud of pine needles and damp leaf mulch.

He paused, pressing a calloused palm against the cold bark of a dying elm. In the silence, the distant babble of the creek sounded like muted whispering.

Assist

Every AI writing tool makes you fight it — pasting context, writing prompts, managing chat histories. margin reads your manuscript, your characters, your worlds — and writes like it already knows the story.

Markdown-Native

A distraction-free editor designed for long-form writing. Loads and saves plain .md files — no lock-in, no database, no proprietary format.

Runs Locally

Your manuscripts, notes, and context stay on your machine. No cloud servers, no telemetry, no required internet.

SLM Friendly

Works well with lightweight language models. Use Ollama, LM Studio, or any OpenAI-compatible provider — swap them from the settings UI.

Automatic Context

Organize characters, lore, outlines, and style guides into folders. Margin automatically includes what's relevant for each request.

Diff Review

Review AI-generated edits with clear inline diffs before accepting or rejecting changes. Suggestions, not insertions.

Customizable Workflows

Configure prompts, agents, and writing pipelines to match your process instead of adapting to rigid presets.

Quick Installation

git clone https://github.com/prxshetty/margin && cd margin
pip install -r requirements.txt
uvicorn api.main:app --reload

Frequently Asked Questions

Does margin cost anything?

No. It's open source. You only pay for the LLM you choose — local models are free, APIs cost per token.

Where does my writing go?

Your files stay local. Text only leaves your machine when you send it to your chosen LLM endpoint (DeepSeek, Claude, local model, etc.). margin doesn't log or store anything on the cloud.

Which models work best?

2B–15B instruction-tuned models like Mistral or Llama 3. Larger models work as well. Reasoning models also produce better edits.

Are there rate limits or safeguards?

No built-in limits in margin. Your LLM provider's rate limits apply. Content filters depend on the model you use.

Does it work with Obsidian / my existing setup?

Yes, if your workspace is markdown files in a folder. Obsidian vaults, exported Notion docs, personal folders — all work as-is. No export needed.

How is this different from ChatGPT?

ChatGPT resets every chat. margin reads your character profiles, style guides, and notes automatically. You write edits, not prompts. Every change shows as a diff you accept or reject.