Where students and agents write together

Read, highlight and cite your sources. Bring any AI agent to do the heavy lifting. Open source and free.

chapters/2-related-work.typ

2.1 Retrieval and grounding

Retrieval-augmented generationreduces hallucination in long-form writing(Lewis et al., 2020). Yet few studies examinehow students verify the citations an agent proposesbefore they submit.

Recent work on agentic workflows suggests that keeping the human in the loop

Claude is writing §2.1 …

Bring your own agent

Bring the agent you already use

No new AI subscription and no lock-in. Your agent connects over MCP and works right inside your project.

  • Claude
  • ChatGPT
  • Cursor
  • Claude Code
  • Codex
  • Any MCP client

Connect in 30 seconds

  1. 1

    Create a project

    Start from the NTNU thesis template or a blank page.

  2. 2

    Copy your MCP URL

    Every account gets one. Sign-in happens in your browser.

  3. 3

    Paste it into your agent

    Your agent can now read, research and write in your paper.

MCP URLhttps://api.margin.madsnylund.no/mcpCopy

Write · Read · Delegate

One place for the whole paper

The editor, the reference manager and the AI assistant you juggle today, in one workspace that works together.

Write

A modern editor with an instant PDF

Write in Typst with a live preview that compiles in milliseconds. Type it yourself, or let your agent draft and polish.

  • Live PDF preview
  • Thesis template included
  • Every save is a revision
main.typ · PDF preview
#import "ntnu-thesis.typ": *
#show: thesis.with(
  title: [Writing with Agents],
  author: "Ingrid Solberg",
)

= Introduction
Students increasingly write
with AI agents @gao2024.

== Research questions

1  Introduction

Students increasingly write with AI agents (Gao et al., 2024). This thesis studies how…

1.1  Research questions

Compiled in 180 ms · 34 pages

Read

Your library, marked up

Keep every article in one place. Highlight, comment and cite in one click, and your agent sees the same notes you do.

  • Highlights and comments
  • One-click citations
  • Shared with your agent
Library
  • Retrieval-Augmented Generation for Knowledge-Intensive NLP

    Lewis et al. · 20204 highlights

  • RAG for Large Language Models: A Survey

    Gao et al. · 2024added by Claude

  • Survey of Hallucination in NLG

    Ji et al. · 20232 comments

Lewis et al. 2020 · p. 3

We explore a general-purpose fine-tuning recipe forretrieval-augmented generation, models which combine pre-trained parametric andnon-parametric memory for language generation.

You · key definition for chapter 2
Claude · cited in §2.1 as @lewis2020

Delegate

Hand the heavy lifting to your agent

Ask your agent to research, analyse articles and draft sections. It works in your project, not in a chat window you copy from.

  • Research and summarise
  • Analyse articles
  • Draft and compile
Claude · connected via MCP
Find recent work on how students check AI citations and draft §2.2.
  1. search_sources

    Searched 3 databases for “agent citation accuracy”

  2. read_article

    Read Lewis et al. 2020 and highlighted 4 claims

  3. edit_file

    Drafted §2.2 in chapters/2-related-work.typ

  4. compile

    Compiled PDF · 34 pages ✓

Built for honest work

You stay the author

Your agent does the legwork, and you make the calls. You can always see who wrote what.

  • Every change is signed

    Each edit records who made it, you or your agent, and why.

  • Every change is reversible

    Step back through the history of any file and restore it in one click.

  • Every line is open to comment

    Question a paragraph, and your agent answers in the margin.

History · chapters/2-related-work.typ
  1. ClaudeDrafted §2.2 from 3 sources2 min ago · +42 −3Restore
  2. YouRewrote the opening of §2.118 min ago · +11 −9Restore
  3. ClaudeAdded citation @gao20241 h ago · +1 −0Restore
  4. YouOutlined chapter 2Yesterday · +24 −0Restore

Open source

Your data. Your agent. Your code.

Academic writing shouldn't live in a black box. Read the source, suggest a change or run your own copy.

View on GitHub →
  • No lock-inYour paper is plain Typst files you can export any time.
  • Any agentBuilt on MCP, the open standard. Switch agents whenever you like.
  • Run it yourselfThe whole platform is open source, so you can host your own.

FAQ

Questions, answered

Which agents work?

Any agent that speaks MCP, the open Model Context Protocol. That includes Claude, ChatGPT, Cursor, Claude Code and Codex. Paste your Margin URL into the agent and sign in.

Is it free?

Yes, Margin is free for everyone. You bring your own agent, so there is no extra AI subscription from us.

Does it work at my university?

Yes. Start from the included NTNU thesis template, or start from scratch with your own structure.

Is using an agent allowed?

That's up to your institution's AI policy. Every change is recorded and attributed, so you can show your supervisor exactly what you wrote and what your agent did.

Can I run it myself?

Yes, it's open source. You can run your own copy and keep your papers on your own server.

Your thesis, with a little help in the margin

Set up your project in a minute, connect your agent and start writing.