# Comment threads in Markdown Mini documents

Copy this file (or paste its rules) into the instructions of any agent that edits
your markdown documents — Claude Code, Codex, etc.

## Format

Highlighted passages carry comment threads inline, as HTML `<mark>` tags inside
the markdown file:

```html
<mark style="background-color:rgba(255, 214, 0, 0.35)"
      data-cid="cmts7f1k"
      data-thread='[{"a":"user","t":"this paragraph is confusing, simplify"},
                    {"a":"codex","t":"Rewrote it as two short sentences."}]'
>the highlighted passage</mark>
```

- `data-cid` — stable thread id. Never change it.
- `data-thread` — JSON array of messages `{"a": author, "t": text}` in order.
  `"user"` is the human; use your own short name (e.g. `"claude"`, `"codex"`)
  as the author of your replies. The JSON is HTML-attribute-escaped in the file
  (`&quot;` for quotes) — unescape before parsing, re-escape when writing.
- `data-resolved="1"` — thread is closed; treat as informational.

## Rules for agents

1. Read every unresolved thread before editing: the highlighted text plus the
   thread is the review request.
2. After acting on a thread, append one message to its `data-thread` describing
   what you changed. Do not rewrite or delete the human's messages.
3. Keep the `<mark>` wrapped around the passage the comment refers to. If you
   rewrite that passage, keep the mark (with the same `data-cid`) around the
   replacement text. If the passage is deleted entirely, move the mark onto the
   nearest sentence and say so in your reply.
4. Do not resolve threads yourself unless asked — the human resolves them in
   the editor.
5. Never strip `<mark>` tags when reformatting the document.
