tandem-editor 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tandem-editor",
3
- "version": "0.4.0",
4
- "description": "Collaborative AI-human document editor with MCP tool integration for Claude",
3
+ "version": "0.6.0",
4
+ "description": "Edit and iterate on documents with Claude no copy-paste, real-time push via plugin monitor",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/bloknayrb/tandem"
@@ -23,7 +23,9 @@
23
23
  "files": [
24
24
  "dist/",
25
25
  "sample/",
26
- "CHANGELOG.md"
26
+ "CHANGELOG.md",
27
+ ".claude-plugin/",
28
+ "skills/"
27
29
  ],
28
30
  "exports": {
29
31
  ".": "./dist/cli/index.js",
@@ -71,11 +73,14 @@
71
73
  ],
72
74
  "*.json !package-lock.json": [
73
75
  "biome check --write"
76
+ ],
77
+ "*.{yml,yaml,md}": [
78
+ "node scripts/normalize-eol.mjs"
74
79
  ]
75
80
  },
76
81
  "dependencies": {
77
- "@hocuspocus/provider": "^3.4.4",
78
- "@hocuspocus/server": "^2.13.0",
82
+ "@hocuspocus/provider": "3.4.4",
83
+ "@hocuspocus/server": "2.15.3",
79
84
  "@modelcontextprotocol/sdk": "^1.12.1",
80
85
  "@tauri-apps/api": "^2.10.1",
81
86
  "@tauri-apps/plugin-dialog": "^2.7.0",
@@ -111,9 +116,9 @@
111
116
  "remark-stringify": "^11.0.0",
112
117
  "unified": "^11.0.0",
113
118
  "update-notifier": "^7.3.1",
114
- "y-prosemirror": "^1.2.12",
115
- "y-protocols": "^1.0.6",
116
- "yjs": "^13.6.0",
119
+ "y-prosemirror": "1.3.7",
120
+ "y-protocols": "1.0.7",
121
+ "yjs": "13.6.30",
117
122
  "zod": "^3.23.0"
118
123
  },
119
124
  "devDependencies": {
package/sample/welcome.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Welcome to Tandem
2
2
 
3
- Tandem is a collaborative document editor where you and Claude can review your documents together in real-time.
3
+ Tandem lets you work on documents with Claude — highlight text and Claude sees it directly, no copy-paste needed. Because Claude connects via MCP, it brings all its knowledge and tools to the document.
4
4
 
5
5
  ## Getting Started
6
6
 
@@ -10,7 +10,7 @@ Open Claude Code from any directory -- your Tandem tools are already configured.
10
10
 
11
11
  ## Try These
12
12
 
13
- 1. **Review an annotation** -- Look at the highlighted text in this document. Open the side panel to accept or dismiss annotations, or press Ctrl+Shift+R for Review Mode.
13
+ 1. **Respond to a suggestion** -- Look at the highlighted text in this document. Open the side panel to accept or dismiss annotations, or press Ctrl+Shift+R for Review Mode.
14
14
  2. **Ask Claude a question** -- Select some text and press Ctrl+Shift+A, or type in the Chat panel.
15
15
  3. **Make an edit** -- Click anywhere in the document and start typing. You can simplify sentences, fix typos, or add new content.
16
16
 
@@ -18,4 +18,4 @@ Open Claude Code from any directory -- your Tandem tools are already configured.
18
18
 
19
19
  The project launched in early 2025 with three core goals: simplify onboarding, reduce support tickets by 40%, and ship a self-service dashboard by Q3. The team completed the first two milestones ahead of schedule, but the dashboard timeline slipped due to an unexpected API redesign in May.
20
20
 
21
- > Once Claude connects, ask it to review this document -- you'll see highlights and suggestions appear in the side panel.
21
+ > Once Claude connects, try asking it to help you improve this text -- you'll see highlights and suggestions appear in the side panel.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: tandem
3
+ description: >
4
+ Use when tandem_* MCP tools are available, the user asks about Tandem
5
+ document editing, or iterating on text collaboratively. Provides workflow
6
+ guidance, annotation strategy, and tool usage patterns for the Tandem
7
+ collaborative editor.
8
+ ---
9
+
10
+ # Tandem — Collaborative Document Editor
11
+
12
+ Tandem lets you annotate and edit documents alongside the user in real time. The user sees your changes in a browser editor; you interact via the tandem_* MCP tool suite.
13
+
14
+ ## Hard Rules
15
+
16
+ These prevent the most common failures. Follow them always.
17
+
18
+ 1. **Resolve before mutating.** Call `tandem_resolveRange` (or `tandem_search`) to get offsets before calling `tandem_edit`, `tandem_highlight`, `tandem_comment`, `tandem_suggest`, or `tandem_flag`. Never compute offsets by counting characters in previously-read text — they go stale when the user edits.
19
+ 2. **Pass `textSnapshot`.** Include the matched text as `textSnapshot` on mutations and annotations. If the text moved, the server returns `RANGE_MOVED` with relocated coordinates instead of corrupting the document.
20
+ 3. **Use `tandem_getTextContent`, not `tandem_getContent`.** `getContent` returns ProseMirror JSON and burns tokens. Use `getTextContent({ section: "Section Name" })` for targeted reads. The `section` parameter is case-insensitive.
21
+ 4. **`tandem_edit` cannot create paragraphs.** Newlines become literal characters. For multi-paragraph changes, use multiple `tandem_edit` calls or `tandem_suggest`.
22
+ 5. **`.docx` files are read-only.** Use annotations instead of `tandem_edit`. Offer `tandem_convertToMarkdown` if the user wants an editable copy.
23
+
24
+ ## Workflow
25
+
26
+ Standard workflow:
27
+
28
+ 1. `tandem_status` — check for already-open documents (sessions restore automatically)
29
+ 2. `tandem_getOutline` — understand document structure
30
+ 3. `tandem_setStatus("Working on [section]...", { focusParagraph: N })` — show progress (use `index` from outline)
31
+ 4. `tandem_getTextContent({ section: "..." })` — read one section at a time
32
+ 5. Annotate or edit as needed (see annotation guide below)
33
+ 6. `tandem_checkInbox` — check for user messages and actions
34
+ 7. Repeat steps 3-6 for each section
35
+ 8. `tandem_save` — persist edits to disk when done
36
+
37
+ ## Annotation Guide
38
+
39
+ Choose the right type for each finding:
40
+
41
+ - **`tandem_highlight`** — Visual marker with a short note. Colors (full set): `green` (verified/good), `red` (problem), `yellow` (needs attention), `blue` (informational), `purple` (style/tone). Prefer the first three for review work; `blue`/`purple` are available when a fourth/fifth category is meaningful. Use when the finding is self-evident from the color and a brief note.
42
+ - **`tandem_comment`** — Observation requiring explanation. Use when you need more than one sentence to convey reasoning.
43
+ - **`tandem_suggest`** — Specific text replacement. **Prefer over comment when you can provide replacement text** — the user gets one-click accept/reject. Cannot create new paragraphs.
44
+ - **`tandem_flag`** — Factual errors, compliance risks, missing required content. Signals a blocking issue the user must address before the document ships.
45
+
46
+ **User questions to Claude.** Users can author a "question" annotation in the UI. The server normalizes it to `type: "comment"` with `directedAt: "claude"` before returning it — so when scanning `tandem_checkInbox` or `tandem_getAnnotations`, match on `type === "comment" && directedAt === "claude" && author === "user"`, not `type === "question"`. Respond with `tandem_reply` for conversational answers, or a new `tandem_comment` on the same range for a textual annotation.
47
+
48
+ ## Collaboration Mode
49
+
50
+ Check `mode` from `tandem_status` or `tandem_checkInbox` and adapt:
51
+
52
+ - **Tandem** (`"tandem"`, default) — Full collaboration. Annotate freely and react to selections and document changes.
53
+ - **Solo** (`"solo"`) — The user wants to write undisturbed. Only respond when the user sends a chat message. Do not proactively annotate or react to document activity.
54
+
55
+ ## Reacting to Document Events
56
+
57
+ Selections are **not** sent as standalone events. Instead, when the user sends a chat message, any buffered selection is attached as a `selection` field on the `chat:message` payload. This gives you context about what text the user was looking at when they wrote their message. When polling via `tandem_checkInbox`, the current selection shows up under `activity.selectedText`. Use `tandem_reply` for any document-context reaction (chat messages, question annotations); reserve terminal output for non-document work the user explicitly requests. In Solo mode, hold reactions until the user sends a chat message.
58
+
59
+ ## Collaboration Etiquette
60
+
61
+ - Check `tandem_getActivity()` before annotating near the user's cursor. If `isTyping` is true, wait for typing to stop before annotating that area.
62
+ - Use `tandem_setStatus` to show what you're working on — the user sees it in the browser status bar.
63
+ - **Call `tandem_checkInbox` every 2-3 tool calls**, not just at the end of a task. The real-time channel is often not connected; polling is the reliable path.
64
+ - Reply to chat messages with `tandem_reply`, not annotations.
65
+
66
+ ## .docx Review Workflow
67
+
68
+ 1. `tandem_open` — opens in read-only mode (`readOnly: true`)
69
+ 2. `tandem_getAnnotations({ author: "import" })` — check for imported Word comments; read and act on them
70
+ 3. Annotate with findings (highlight, comment, suggest, flag)
71
+ 4. `tandem_exportAnnotations` — generate a review summary the user can share
72
+ 5. If the user wants editable text, offer `tandem_convertToMarkdown`
73
+
74
+ ## Error Recovery
75
+
76
+ - **`RANGE_MOVED`** — Text shifted since you read it. The response includes `resolvedFrom`/`resolvedTo` — use those coordinates for your next call.
77
+ - **`RANGE_GONE`** — The text was deleted. Re-read the section with `tandem_getTextContent` and re-assess.
78
+ - **`INVALID_RANGE`** — You hit heading markup (e.g., `## `). Target text content only, not the heading prefix.
79
+ - **`FORMAT_ERROR`** — Attempted `tandem_edit` on a read-only `.docx`. Use annotations instead.
80
+
81
+ ## Session Handoff
82
+
83
+ When starting a new Claude session with Tandem already running:
84
+
85
+ 1. `tandem_status()` — check `openDocuments` array for restored sessions
86
+ 2. `tandem_listDocuments()` — see all open docs with details
87
+ 3. `tandem_getOutline()` — orient on the active document
88
+ 4. `tandem_getAnnotations()` — see what was already reviewed
89
+ 5. Continue where the previous session left off
90
+
91
+ ## Multi-Document
92
+
93
+ When multiple documents are open, always pass `documentId` explicitly — omitting it targets the active document, which may have changed since your last call. Use `tandem_listDocuments` to see what's available. Cross-reference by reading both docs via `tandem_getTextContent({ documentId: "..." })` and annotating the relevant one.