Claude writes a lot.
Mark what matters.

Margin is a free mod for Claude Code. Highlight replies in three colours, pin a note to a highlight, drop a "read up to here" marker, sketch an idea, and find it all again in your notebook.

Install in a minute ★ Source on GitHub

Works in the Claude desktop app (Code tab) and the terminal · Everything stays on your computer · MIT

Try itSelect any words in the reply below, then press a colour.

Claude Code · my-app
why does the login page sometimes log me out?

Short answer: your session cookie and your access token expire at different times, and the page only checks one of them.

Here's what happens. When you sign in, the server sets a cookie that lives for 7 days, but the access token inside it lives for only 15 minutes. The refresh call that should swap in a new token runs only when you navigate, so a tab left open for a while ends up holding a dead token.

The next request fails with a 401, and the error handler treats every 401 as "signed out". That's the logout you're seeing.

Three ways to fix it, from smallest to sturdiest:

  • Refresh the token on a timer, a minute before it expires.
  • Retry once on a 401 after refreshing, before giving up.
  • Move the refresh into the API client so every call is covered.

I'd go with the third. It's about twenty lines in api.ts and it covers the cases the other two miss, like a laptop waking from sleep.

│ │
Select text in a reply, then pick a colour. Erase takes highlights off your selection.
Reply to Claude…

Read long replies without losing the thread

Claude's answers are good and long. Margin gives you a pen and a bookmark, right in the app.

🖍️

Highlight in colour

Yellow, green, pink. Select, press, done. Press it again or use Erase to take it off.

✎

Notes on the side

Pin a one-line note to any highlight. It shows under the paragraph and in your notebook.

📍

Read up to here

Drop a marker where you stopped. Resume shows everything after it. Clear it when you're done.

✏️

Sketch an idea

A small sketch pad in the side pane. Strokes are smoothed into clean SVGs with perfect-freehand.

📓

A notebook you can browse

Every highlight, note and sketch lands in Documents/Margin Notebook: a searchable page plus Markdown for Obsidian or Logseq.

🔒

Yours, on your machine

No account, no server, no tracking. It's a few files on your computer and you can read every line.

Install

You need Claude Code (the desktop app's Code tab or the terminal). Then:

In a terminal, add the marketplace and install
claude plugin marketplace add basithladdu/margin
claude plugin install margin@margin
Or from inside Claude CodeType this at the prompt in a terminal session, say y, then pick a scope:
/plugin install margin --marketplace basithladdu/margin
Start a new sessionThe Margin row appears above the prompt. Select text in a reply and press a colour. Type /margin to open your notebook.

The honest list