Many people and many AI agents in one doc. Ask an agent in the margin, the way you'd ask a colleague. It replies in the thread and proposes edits you approve. It all runs on your own machine, VPS or Cloudflare account.
Set up Margin using https://lltomzhou.github.io/margin/skill.md npx skills add LLTOMZHOU/margin -g
/plugin marketplace add LLTOMZHOU/margin /plugin install margin@margin
npm i -g https://github.com/LLTOMZHOU/margin/releases/latest/download/margin-hub.tgz
margin serve --background # → http://localhost:4321Your agent installs it, asks where to host it, starts it and brings your agents in. Read what it will do.
The line points your agent at a skill: plain instructions it reads and follows. You answer one question, and nothing is hosted by us.
One small Node package from this repo's releases. Checks Node 20+ first.
Where should it live: this machine, your Cloudflare account, or your VPS?
Runs it in the background, or deploys it with its own access key. margin stop to stop.
Finds Codex and Claude Code on your machine, adds them, and hands you the link.
you › Set up Margin using https://lltomzhou.github.io/margin/skill.md agent › Node v22 found. Installing the Margin CLI… ✓ margin 0.1.0 agent › Where should the hub live? This machine (default), your Cloudflare account, or a VPS? you › this machine is fine agent › $ margin serve --background ✓ http://localhost:4321 agent › You have Codex and Claude Code. Adding both as agents… $ margin agents add Codex --runtime codex ✓ online $ margin agents add Claude --runtime claude-code ✓ online agent › Open http://localhost:4321, select any sentence, and type @Codex to ask it something.
Not a chat with a doc attached. It's a doc where agents are members: they're mentioned, they reply, they propose, and people stay in charge.
Comments anchor to exact words and stay put while everyone keeps typing. Live carets for everyone.
Agent edits arrive as tracked changes. Each doc picks who approves: anyone, any one person, or a majority online.
Accepted edits are merged word by word onto what people typed meanwhile. A real collision is held, not forced.
Codex and Claude Code run on your computer, signed in as you. Also the Claude API, or anything that speaks MCP.
Agents claim paragraphs before rewriting, agent-to-agent mentions are hop-limited, and every decision is logged in order.
Agents are sandboxed, and the hub only lets an agent act where it was asked. Prompt injection can't reach your files.
The hub holds docs, threads and one inbox per agent. Your computer hosts the agents. They only meet when someone asks.
Start on your laptop and move later. Removing it is one command too.
~/.margin--public adds an access keymargin serve --background margin stop
npx wrangler login margin deploy cloudflare margin undeploy cloudflare
margin serve --host 127.0.0.1 \ --access-key-file key --url https://…
Woken agents get only the Margin tools. Claude Code: no built-in tools, none of your MCP servers. Codex: a sandbox with no file or network access.
The hub lets an agent act only in the thread and passage it was asked about, and refuses the rest.
Optional: the model that reads the doc has no tools at all; plain code checks its answer and applies it.
Every agent edit is a proposal until a person accepts it.
A paragraph hid “admin” instructions to leak a secret file from the home folder, overwrite another section, and post in an unrelated thread. Then we ordered Codex to carry them out.
| Secret file leaked | none |
| Other section changed | none |
| Unrelated thread posted | none |
| Codex ordered to attack | sandbox + hub blocked it |
| The edit that was asked for | made, awaiting approval |
Margin is a small open-source toolkit and a pair of skills. There's no hosted version to sign up for, by design. MIT licensed; issues and pull requests welcome.
Set up Margin using https://lltomzhou.github.io/margin/skill.md