openwriter 0.1.0 → 0.1.1
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/LICENSE +21 -0
- package/README.md +297 -0
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Travis Steward
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# OpenWriter
|
|
2
|
+
|
|
3
|
+
**The open-source writing surface for the agentic era.**
|
|
4
|
+
|
|
5
|
+
A local-first [TipTap](https://tiptap.dev/) rich text editor built for human-agent collaboration. Your AI agent writes, you review. Works with any MCP-compatible agent — Claude Code, Cursor, OpenCode, or your own.
|
|
6
|
+
|
|
7
|
+
<!-- TODO: Add screenshot or GIF demo here -->
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Why OpenWriter?
|
|
12
|
+
|
|
13
|
+
Every AI coding tool has a great editor. Writing has nothing.
|
|
14
|
+
|
|
15
|
+
Google Docs locks you into Gemini. Notion locks you into Notion AI. Obsidian has plugins but no native agent protocol. OpenWriter is different: it's an open editor that any agent can write into, with a review system that keeps you in control.
|
|
16
|
+
|
|
17
|
+
**The agent writes. You accept or reject. That's it.**
|
|
18
|
+
|
|
19
|
+
- Agent makes changes → they appear as colored decorations (green for inserts, blue for rewrites, red for deletions)
|
|
20
|
+
- You review with vim-style hotkeys (`j`/`k` navigate, `a` accept, `r` reject)
|
|
21
|
+
- Cross-document navigation when an agent edits multiple files at once
|
|
22
|
+
- Works with any MCP agent — no vendor lock-in
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx openwriter
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
That's it. Opens your browser to `localhost:5050` with a ready-to-use editor. Documents save as markdown files in `~/.openwriter/`.
|
|
33
|
+
|
|
34
|
+
### Connect Your Agent
|
|
35
|
+
|
|
36
|
+
Add to your MCP config (e.g., `.claude/mcp.json`):
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"mcpServers": {
|
|
41
|
+
"open-writer": {
|
|
42
|
+
"command": "npx",
|
|
43
|
+
"args": ["openwriter", "--no-open"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Now your agent has 24 tools to read, write, and organize documents — and every change goes through your review.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
### Agent Collaboration via MCP
|
|
56
|
+
|
|
57
|
+
24 tools across four categories:
|
|
58
|
+
|
|
59
|
+
| Category | Tools | What They Do |
|
|
60
|
+
|----------|-------|-------------|
|
|
61
|
+
| **Document** | `read_pad`, `write_to_pad`, `edit_text`, `get_pad_status`, + 5 more | Read/write document content, fine-grained text edits, metadata |
|
|
62
|
+
| **Multi-doc** | `list_documents`, `switch_document`, `create_document` | Navigate and manage multiple documents |
|
|
63
|
+
| **Workspace** | `create_workspace`, `get_workspace_structure`, `add_doc`, + 6 more | Organize docs into projects with containers and tags |
|
|
64
|
+
| **Import** | `import_gdoc` | Import Google Docs, auto-split into chapters |
|
|
65
|
+
|
|
66
|
+
Agents write in markdown or TipTap JSON. The server converts, assigns node IDs, and broadcasts changes to your browser in real-time via WebSocket.
|
|
67
|
+
|
|
68
|
+
### Pending Change Review
|
|
69
|
+
|
|
70
|
+
The core interaction model. When an agent (or the context menu) makes changes:
|
|
71
|
+
|
|
72
|
+
- **Inserts** appear highlighted in green
|
|
73
|
+
- **Rewrites** appear highlighted in blue (original content preserved for reject)
|
|
74
|
+
- **Deletions** appear with red strikethrough
|
|
75
|
+
|
|
76
|
+
Review Panel (floating bottom bar):
|
|
77
|
+
|
|
78
|
+
| Key | Action |
|
|
79
|
+
|-----|--------|
|
|
80
|
+
| `j` / `k` | Next / previous change |
|
|
81
|
+
| `h` / `l` | Previous / next document with changes |
|
|
82
|
+
| `a` | Accept current change |
|
|
83
|
+
| `r` | Reject current change |
|
|
84
|
+
| `Shift+A` | Accept all in document |
|
|
85
|
+
| `Shift+R` | Reject all in document |
|
|
86
|
+
|
|
87
|
+
### Multi-Document Workspaces
|
|
88
|
+
|
|
89
|
+
Documents are markdown files on disk. Organize them into workspaces with nested containers, cross-cutting tags, and shared context (characters, settings, rules) that agents can read for consistency.
|
|
90
|
+
|
|
91
|
+
Four sidebar views:
|
|
92
|
+
- **Tree** — Hierarchical folders with drag-and-drop
|
|
93
|
+
- **Timeline** — Sorted by last modified
|
|
94
|
+
- **Board** — Card-based drill-down navigation
|
|
95
|
+
- **Shelf** — Visual bookshelf metaphor with spine browsing
|
|
96
|
+
|
|
97
|
+
### Context Menu (Right-Click)
|
|
98
|
+
|
|
99
|
+
Select text and right-click for AI-powered transformations:
|
|
100
|
+
|
|
101
|
+
| Action | Key | Description |
|
|
102
|
+
|--------|-----|-------------|
|
|
103
|
+
| Rewrite | `R` | Rewrite selection at similar length |
|
|
104
|
+
| Shrink | `S` | Condense by 40-60% |
|
|
105
|
+
| Expand | `E` | Expand by 50-100% |
|
|
106
|
+
| Custom | — | Free-text instruction |
|
|
107
|
+
| Fill | `F` | Generate content between paragraphs |
|
|
108
|
+
| Insert after | `I` | Generate new content after selection |
|
|
109
|
+
| Delete | `D` | Mark for deletion |
|
|
110
|
+
| Link to doc | `L` | Create internal document links |
|
|
111
|
+
|
|
112
|
+
Context menu actions are provided by plugins. The built-in [Author's Voice](https://authors-voice.com) plugin rewrites text in your personal writing voice.
|
|
113
|
+
|
|
114
|
+
### Themes
|
|
115
|
+
|
|
116
|
+
5 themes, each with light and dark modes:
|
|
117
|
+
|
|
118
|
+
- **Ink** — Clean, minimal, professional
|
|
119
|
+
- **Novel** — Warm, serif-based, literary
|
|
120
|
+
- **Mono** — Monospace, code-focused
|
|
121
|
+
- **Editorial** — Bold magazine-style headings
|
|
122
|
+
- **Studio** — Contemporary sans-serif
|
|
123
|
+
|
|
124
|
+
Three typography presets (default, compact, expanded) work with any theme.
|
|
125
|
+
|
|
126
|
+
### Git Sync
|
|
127
|
+
|
|
128
|
+
Push your documents to GitHub directly from the editor. Three setup methods:
|
|
129
|
+
- **GitHub CLI** — Auto-detected if `gh` is authenticated
|
|
130
|
+
- **Personal Access Token** — Manual GitHub auth
|
|
131
|
+
- **Existing repo** — Connect to a repo you already have
|
|
132
|
+
|
|
133
|
+
### Export
|
|
134
|
+
|
|
135
|
+
Export any document to:
|
|
136
|
+
- Markdown (`.md`)
|
|
137
|
+
- HTML (styled web page)
|
|
138
|
+
- Word (`.docx`)
|
|
139
|
+
- Plain text (`.txt`)
|
|
140
|
+
- PDF (via print preview)
|
|
141
|
+
|
|
142
|
+
### Version History
|
|
143
|
+
|
|
144
|
+
Automatic snapshots with full rollback. Browse previous versions and restore any point.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Token-Efficient Wire Format
|
|
149
|
+
|
|
150
|
+
Agents don't parse JSON. OpenWriter uses a compact tagged-line format that's ~10x more token-efficient:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
title: My Document
|
|
154
|
+
words: 1,205
|
|
155
|
+
pending: 2
|
|
156
|
+
---
|
|
157
|
+
[h1:a1b2c3d4] Chapter One
|
|
158
|
+
[p:e5f6g7h8] The quick brown fox jumped over the **lazy** dog.
|
|
159
|
+
[ul:i9j0k1l2]
|
|
160
|
+
[li:m3n4o5p6] First bullet
|
|
161
|
+
[li:q7r8s9t0] Second bullet
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Each line: `[type:8-char-id] content` with inline markdown preserved. Agents read and write naturally.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Plugin System
|
|
169
|
+
|
|
170
|
+
OpenWriter is extensible via plugins. A plugin can:
|
|
171
|
+
|
|
172
|
+
- **Register MCP tools** — Extend the agent's capabilities
|
|
173
|
+
- **Add HTTP routes** — Custom API endpoints on the server
|
|
174
|
+
- **Contribute context menu items** — UI actions for text transformation
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
import type { OpenWriterPlugin } from 'openwriter';
|
|
178
|
+
|
|
179
|
+
const plugin: OpenWriterPlugin = {
|
|
180
|
+
name: 'my-plugin',
|
|
181
|
+
version: '1.0.0',
|
|
182
|
+
|
|
183
|
+
mcpTools(config) {
|
|
184
|
+
return [{
|
|
185
|
+
name: 'my-tool',
|
|
186
|
+
description: 'Does something useful',
|
|
187
|
+
inputSchema: { type: 'object', properties: {} },
|
|
188
|
+
handler: async (params) => ({ result: 'done' })
|
|
189
|
+
}];
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
contextMenuItems() {
|
|
193
|
+
return [{
|
|
194
|
+
label: 'My Action',
|
|
195
|
+
action: 'myplugin:do-thing',
|
|
196
|
+
condition: 'has-selection'
|
|
197
|
+
}];
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export default plugin;
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Load plugins at startup:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
npx openwriter --plugins my-plugin,another-plugin
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## CLI Options
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
npx openwriter [options]
|
|
216
|
+
|
|
217
|
+
Options:
|
|
218
|
+
--port <number> Port number (default: 5050)
|
|
219
|
+
--no-open Don't auto-open browser
|
|
220
|
+
--api-key <key> Author's Voice API key
|
|
221
|
+
--av-url <url> Author's Voice backend URL
|
|
222
|
+
--plugins <names> Comma-separated plugin names
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Environment variables: `AV_API_KEY`, `AV_BACKEND_URL`
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Architecture
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
Browser (localhost:5050)
|
|
233
|
+
├── TipTap 3.0 Editor (React)
|
|
234
|
+
├── Decoration Plugin (pending insert/rewrite/delete)
|
|
235
|
+
├── Review Panel (accept/reject with keyboard nav)
|
|
236
|
+
├── Sidebar (4 views: tree, timeline, board, shelf)
|
|
237
|
+
└── Context Menu (plugin-provided AI actions)
|
|
238
|
+
│
|
|
239
|
+
│ WebSocket + HTTP
|
|
240
|
+
▼
|
|
241
|
+
Pad Server (Express + WebSocket + MCP stdio)
|
|
242
|
+
├── Document state (in-memory + markdown on disk)
|
|
243
|
+
├── 24 MCP tools + plugin tools
|
|
244
|
+
├── Workspace management
|
|
245
|
+
├── Git sync, versions, export
|
|
246
|
+
└── Plugin loader
|
|
247
|
+
│
|
|
248
|
+
│ MCP stdio
|
|
249
|
+
▼
|
|
250
|
+
AI Agent (Claude Code, Cursor, etc.)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Three interfaces:
|
|
254
|
+
- **HTTP** — Browser UI operations, document CRUD, plugin proxying
|
|
255
|
+
- **WebSocket** — Real-time push of agent changes to browser
|
|
256
|
+
- **MCP stdio** — Agent reads/writes documents
|
|
257
|
+
|
|
258
|
+
The server supports **multi-session mode**: if port 5050 is already taken, additional instances proxy MCP calls via HTTP to the running server. Multiple agents can safely share the same document state.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Development
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Clone and install
|
|
266
|
+
git clone https://github.com/travsteward/openwriter.git
|
|
267
|
+
cd openwriter
|
|
268
|
+
npm install
|
|
269
|
+
|
|
270
|
+
# Dev mode (hot reload)
|
|
271
|
+
cd packages/openwriter
|
|
272
|
+
npm run dev
|
|
273
|
+
|
|
274
|
+
# Build
|
|
275
|
+
npx turbo run build --force
|
|
276
|
+
|
|
277
|
+
# Type check
|
|
278
|
+
npx tsc --noEmit -p packages/openwriter/tsconfig.json # frontend
|
|
279
|
+
npx tsc --noEmit -p packages/openwriter/tsconfig.server.json # server
|
|
280
|
+
|
|
281
|
+
# Run production build
|
|
282
|
+
node packages/openwriter/dist/bin/pad.js
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Monorepo structure: `packages/openwriter` (editor + server), `plugins/` (optional extensions).
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Contributing
|
|
290
|
+
|
|
291
|
+
Contributions welcome. Please open an issue first to discuss what you'd like to change.
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## License
|
|
296
|
+
|
|
297
|
+
[MIT](LICENSE) — Travis Steward
|