remnote-bridge 0.1.13 → 0.1.15
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/README.md +147 -28
- package/README.zh-CN.md +374 -0
- package/dist/cli/commands/health.js +231 -112
- package/dist/cli/commands/read-rem-in-tree.js +84 -0
- package/dist/cli/config.js +2 -0
- package/dist/cli/daemon/registry.js +8 -0
- package/dist/cli/handlers/edit-handler.js +14 -0
- package/dist/cli/handlers/patch-engine.js +347 -0
- package/dist/cli/handlers/read-handler.js +2 -53
- package/dist/cli/handlers/rem-field-filter.js +102 -0
- package/dist/cli/handlers/tree-edit-handler.js +67 -7
- package/dist/cli/handlers/tree-read-handler.js +4 -1
- package/dist/cli/handlers/tree-rem-read-handler.js +73 -0
- package/dist/cli/main.js +53 -2
- package/dist/cli/server/ws-server.js +9 -1
- package/dist/mcp/daemon-client.js +22 -2
- package/dist/mcp/instructions.js +99 -58
- package/dist/mcp/tools/edit-tools.js +7 -2
- package/dist/mcp/tools/infra-tools.js +20 -11
- package/dist/mcp/tools/read-tools.js +88 -2
- package/package.json +1 -1
- package/remnote-plugin/dist/index-sandbox.js +24 -24
- package/remnote-plugin/dist/index.js +24 -24
- package/remnote-plugin/dist/manifest.json +1 -1
- package/remnote-plugin/package.json +1 -1
- package/remnote-plugin/public/manifest.json +1 -1
- package/remnote-plugin/src/bridge/message-router.ts +3 -0
- package/remnote-plugin/src/services/read-rem-in-tree.ts +43 -0
- package/remnote-plugin/src/services/read-rem.ts +31 -16
- package/remnote-plugin/src/services/read-tree.ts +5 -0
- package/remnote-plugin/src/settings.ts +1 -1
- package/skills/remnote-bridge/SKILL.md +50 -8
- package/skills/remnote-bridge/instructions/connect.md +31 -8
- package/skills/remnote-bridge/instructions/disconnect.md +5 -0
- package/skills/remnote-bridge/instructions/edit-tree.md +117 -51
- package/skills/remnote-bridge/instructions/health.md +81 -53
- package/skills/remnote-bridge/instructions/overall.md +39 -8
- package/skills/remnote-bridge/instructions/read-rem-in-tree.md +100 -0
- package/skills/remnote-bridge/instructions/read-rem.md +30 -11
- package/skills/remnote-bridge-test/SKILL.md +847 -0
- package/skills/remnote-bridge-test/references/regression-suite.md +960 -0
- package/skills/remnote-bridge-test/references/verification-guide.md +161 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# remnote-bridge
|
|
2
2
|
|
|
3
|
-
[中文文档](./
|
|
3
|
+
[中文文档](./README.zh-CN.md)
|
|
4
4
|
|
|
5
5
|
Bridge toolkit that exposes your RemNote knowledge base to AI agents. Single package — CLI, MCP Server, and Plugin all in one.
|
|
6
6
|
|
|
@@ -43,27 +43,9 @@ Once connected, the AI will guide you through connecting to RemNote, loading the
|
|
|
43
43
|
|
|
44
44
|
## Quick Start
|
|
45
45
|
|
|
46
|
-
###
|
|
46
|
+
### Standard Mode (recommended)
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
# 1. One-time: login to RemNote in Chrome (saves credentials)
|
|
52
|
-
remnote-bridge setup
|
|
53
|
-
|
|
54
|
-
# 2. Auto-connect with headless Chrome (no browser window needed)
|
|
55
|
-
remnote-bridge connect --headless
|
|
56
|
-
|
|
57
|
-
# 3. Verify all layers are ready
|
|
58
|
-
remnote-bridge health
|
|
59
|
-
|
|
60
|
-
# 4. Use any command — done!
|
|
61
|
-
remnote-bridge search "machine learning"
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Standard Mode
|
|
65
|
-
|
|
66
|
-
Requires user to manually load the plugin in RemNote.
|
|
48
|
+
Recommended for daily use — you control when to load and unload the plugin.
|
|
67
49
|
|
|
68
50
|
```bash
|
|
69
51
|
# 1. Start the daemon (launches WS server + plugin server)
|
|
@@ -84,13 +66,31 @@ remnote-bridge read-tree <remId> # Expand a subtree
|
|
|
84
66
|
remnote-bridge read-rem <remId> # Read Rem properties
|
|
85
67
|
|
|
86
68
|
# 5. Edit content
|
|
87
|
-
remnote-bridge edit-rem <remId> --
|
|
69
|
+
remnote-bridge edit-rem <remId> --changes '{"text":["new text"]}'
|
|
88
70
|
remnote-bridge edit-tree <remId> --old-str ' old line <!--id-->' --new-str ' new line\n old line <!--id-->'
|
|
89
71
|
|
|
90
72
|
# 6. Stop the daemon
|
|
91
73
|
remnote-bridge disconnect
|
|
92
74
|
```
|
|
93
75
|
|
|
76
|
+
### Headless Mode (fully automated)
|
|
77
|
+
|
|
78
|
+
Zero human intervention after initial setup — use only for fully automated workflows.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 1. One-time: login to RemNote in Chrome (saves credentials)
|
|
82
|
+
remnote-bridge setup
|
|
83
|
+
|
|
84
|
+
# 2. Auto-connect with headless Chrome (no browser window needed)
|
|
85
|
+
remnote-bridge connect --headless
|
|
86
|
+
|
|
87
|
+
# 3. Verify all layers are ready
|
|
88
|
+
remnote-bridge health
|
|
89
|
+
|
|
90
|
+
# 4. Use any command — done!
|
|
91
|
+
remnote-bridge search "machine learning"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
94
|
## Commands
|
|
95
95
|
|
|
96
96
|
### Infrastructure
|
|
@@ -101,6 +101,7 @@ remnote-bridge disconnect
|
|
|
101
101
|
| `connect` | Start the daemon (`--headless` for auto Chrome, default requires manual plugin load) |
|
|
102
102
|
| `health` | Check daemon/Plugin/SDK status (`--diagnose` for screenshots, `--reload` to restart Chrome) |
|
|
103
103
|
| `disconnect` | Stop the daemon and release resources |
|
|
104
|
+
| `clean` | Remove all residual files (.pid / .log / .json / skill dirs) |
|
|
104
105
|
|
|
105
106
|
### Read
|
|
106
107
|
|
|
@@ -110,13 +111,14 @@ remnote-bridge disconnect
|
|
|
110
111
|
| `read-context` | Current focus/page context view | No |
|
|
111
112
|
| `read-tree <remId>` | Subtree as Markdown outline | Yes |
|
|
112
113
|
| `read-rem <remId>` | Single Rem's full JSON properties | Yes |
|
|
114
|
+
| `read-rem-in-tree <remId>` | Subtree outline + all Rem objects in one call | Yes |
|
|
113
115
|
| `search <query>` | Full-text search | No |
|
|
114
116
|
|
|
115
117
|
### Write
|
|
116
118
|
|
|
117
119
|
| Command | Description | Prerequisite |
|
|
118
120
|
|:--------|:------------|:-------------|
|
|
119
|
-
| `edit-rem <remId>` |
|
|
121
|
+
| `edit-rem <remId>` | Directly modify Rem fields (text, backText, type, etc.) | `read-rem` first |
|
|
120
122
|
| `edit-tree <remId>` | Edit tree structure via str_replace | `read-tree` first |
|
|
121
123
|
|
|
122
124
|
### Utilities
|
|
@@ -125,6 +127,7 @@ remnote-bridge disconnect
|
|
|
125
127
|
|:--------|:------------|
|
|
126
128
|
| `mcp` | Start the MCP Server (stdio transport) |
|
|
127
129
|
| `install skill` | Install AI agent skill (via [Vercel Skills](https://github.com/vercel-labs/skills)) |
|
|
130
|
+
| `addon list\|install\|uninstall` | Manage addon projects (e.g. remnote-rag) |
|
|
128
131
|
|
|
129
132
|
## MCP Server
|
|
130
133
|
|
|
@@ -141,7 +144,7 @@ Use `remnote-bridge mcp` as an MCP server for AI clients:
|
|
|
141
144
|
}
|
|
142
145
|
```
|
|
143
146
|
|
|
144
|
-
The MCP server exposes all CLI commands as tools
|
|
147
|
+
The MCP server exposes all CLI commands as tools. Documentation is inlined into tool descriptions and server instructions (no separate resources).
|
|
145
148
|
|
|
146
149
|
## AI Agent Skill
|
|
147
150
|
|
|
@@ -196,6 +199,24 @@ remnote-bridge --json read-rem '{"remId":"abc123","fields":["text","type"]}'
|
|
|
196
199
|
# {"ok":true,"command":"read-rem","timestamp":"...","data":{...}}
|
|
197
200
|
```
|
|
198
201
|
|
|
202
|
+
## Multi-Instance
|
|
203
|
+
|
|
204
|
+
Run multiple daemon instances in parallel (e.g. different knowledge bases):
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Named instances
|
|
208
|
+
remnote-bridge --instance work connect
|
|
209
|
+
remnote-bridge --instance personal connect
|
|
210
|
+
|
|
211
|
+
# Headless shorthand
|
|
212
|
+
remnote-bridge --headless connect # equivalent to --instance headless
|
|
213
|
+
|
|
214
|
+
# Commands auto-route to the right instance
|
|
215
|
+
remnote-bridge --instance work search "project notes"
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Instances are managed via a global registry at `~/.remnote-bridge/`. Each instance gets its own port allocation, PID file, and log file.
|
|
219
|
+
|
|
199
220
|
## Architecture
|
|
200
221
|
|
|
201
222
|
```
|
|
@@ -213,8 +234,9 @@ RemNote SDK → Knowledge Base
|
|
|
213
234
|
- **CLI commands** are stateless — each invocation is an independent OS process
|
|
214
235
|
- **Daemon** holds state: cache, WS connections, timeout timer
|
|
215
236
|
- **Plugin** runs in the browser (or headless Chrome), calls RemNote SDK on behalf of the daemon
|
|
237
|
+
- **Multi-instance** — multiple daemons can run simultaneously, each plugin can connect to multiple daemons with twin priority
|
|
216
238
|
- **Headless mode** launches Chrome automatically using saved credentials — no browser window needed
|
|
217
|
-
- **Three safety guards** protect edits: cache existence check, optimistic concurrency detection, str_replace exact match
|
|
239
|
+
- **Three safety guards** protect edits: cache existence check, optimistic concurrency detection, str_replace exact match (for edit-tree)
|
|
218
240
|
|
|
219
241
|
## Configuration
|
|
220
242
|
|
|
@@ -243,13 +265,110 @@ This project was inspired by and learned from:
|
|
|
243
265
|
- [remnote-mcp-bridge](https://github.com/quentintou/remnote-mcp-bridge) by [@quentintou](https://github.com/quentintou) — The original MCP bridge connecting RemNote to AI assistants. Pioneered the idea of bridging RemNote SDK to external tools via MCP.
|
|
244
266
|
- [remnote-mcp-bridge (fork)](https://github.com/robert7/remnote-mcp-bridge) by [@robert7](https://github.com/robert7) — Extended the original with a generic, extensible WebSocket bridge architecture. Its Plugin ↔ WebSocket ↔ CLI layered design gave us valuable architectural insights.
|
|
245
267
|
|
|
268
|
+
## Addons
|
|
269
|
+
|
|
270
|
+
Addon projects extend remnote-bridge with additional capabilities:
|
|
271
|
+
|
|
272
|
+
| Addon | Description |
|
|
273
|
+
|:------|:------------|
|
|
274
|
+
| [remnote-rag](https://github.com/baobao700508/remnote-rag) | Semantic search via ChromaDB + DashScope embeddings |
|
|
275
|
+
| [remnote-chat](https://github.com/baobao700508/remnote-chat) | Chat interface for RemNote knowledge base |
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# List available addons
|
|
279
|
+
remnote-bridge addon list
|
|
280
|
+
|
|
281
|
+
# Install an addon
|
|
282
|
+
remnote-bridge addon install remnote-rag
|
|
283
|
+
|
|
284
|
+
# Uninstall (--purge to remove data)
|
|
285
|
+
remnote-bridge addon uninstall remnote-rag --purge
|
|
286
|
+
```
|
|
287
|
+
|
|
246
288
|
## Roadmap
|
|
247
289
|
|
|
248
|
-
- **
|
|
249
|
-
- **Improved agent instructions** — Refine Skill documentation and MCP server instructions for better AI agent comprehension
|
|
250
|
-
- **RAG-powered search** — Research RemNote's local database structure to enable retrieval-augmented search, replacing the current SDK-based full-text search with more efficient semantic retrieval
|
|
290
|
+
- **RAG-powered search** — Semantic retrieval via local SQLite + ChromaDB, complementing SDK full-text search
|
|
251
291
|
- **Multi-language support** — Internationalization for broader accessibility
|
|
252
292
|
|
|
293
|
+
## Changelog
|
|
294
|
+
|
|
295
|
+
### 0.1.15 (2026-03-18)
|
|
296
|
+
|
|
297
|
+
- **Defense-2 false positive fix** — Removed `.sort()` from ID arrays in RemObject serialization that caused spurious concurrency conflicts in edit-rem
|
|
298
|
+
- **Documentation overhaul** — Strengthened headless mode warnings, added anti-hallucination guardrails for Plugin loading instructions, restructured edit-tree template/fallback dual-mode docs
|
|
299
|
+
- **Skill ↔ MCP doc sync** — Aligned connect, edit-tree, overall instructions across Skill and MCP layers
|
|
300
|
+
|
|
301
|
+
### 0.1.14 (2026-03-18)
|
|
302
|
+
|
|
303
|
+
- **read-rem-in-tree** — New command: fetch subtree outline + all Rem objects in one call (batch read for bulk edits)
|
|
304
|
+
- **Token Slimming** — `read-rem` omits default-value fields by default, reducing token usage; use `--full` for complete output
|
|
305
|
+
- **rem-field-filter** — Extracted reusable field filtering logic from read-handler
|
|
306
|
+
- **Headless policy** — Added headless prohibition to CLAUDE.md for testing scenarios
|
|
307
|
+
- **health improvements** — Refactored diagnostics with better status reporting
|
|
308
|
+
|
|
309
|
+
### 0.1.13 (2026-03-15)
|
|
310
|
+
|
|
311
|
+
- **edit-rem rewrite** — Replaced str_replace with direct field modification (`--changes` flag)
|
|
312
|
+
- **MCP resources removed** — All documentation inlined into tool descriptions and server instructions
|
|
313
|
+
- **MCP return format standardized** — Frontmatter+Body for outline tools, Data JSON for action tools
|
|
314
|
+
|
|
315
|
+
### 0.1.12 (2026-03-15)
|
|
316
|
+
|
|
317
|
+
- **Multi-instance support** — `--instance <name>` flag, global registry at `~/.remnote-bridge/`, parallel daemons
|
|
318
|
+
- **Multi-connection Plugin** — Single Plugin connects to multiple daemons with twin priority mechanism
|
|
319
|
+
- **Addon system** — `addon list|install|uninstall` commands for managing extension projects (remnote-rag, remnote-chat)
|
|
320
|
+
- **read-context focusRemId** — Optional parameter to specify focus target without changing RemNote UI
|
|
321
|
+
- **Output refinements** — `children` moved from default to full mode (`read-rem --full`)
|
|
322
|
+
|
|
323
|
+
### 0.1.9 (2026-03-09)
|
|
324
|
+
|
|
325
|
+
- Recommend standard mode for daily use; headless only for full automation
|
|
326
|
+
|
|
327
|
+
### 0.1.8 (2026-03-09)
|
|
328
|
+
|
|
329
|
+
- **Headless Chrome** — `setup` + `connect --headless` + `health --diagnose/--reload` for zero-intervention workflows
|
|
330
|
+
- **Static plugin server** — Lightweight production server replacing webpack-dev-server in non-dev mode
|
|
331
|
+
|
|
332
|
+
### 0.1.7 (2026-03-08)
|
|
333
|
+
|
|
334
|
+
- **Portal support** — Read/edit Portal Rem with dual-path resolution (portal ↔ source)
|
|
335
|
+
- **Tree operations** — Create and delete Rem via `edit-tree`
|
|
336
|
+
|
|
337
|
+
### 0.1.6 (2026-03-07)
|
|
338
|
+
|
|
339
|
+
- Connect timeout extended from 10s to 60s
|
|
340
|
+
|
|
341
|
+
### 0.1.5 (2026-03-07)
|
|
342
|
+
|
|
343
|
+
- Dev-server crash self-healing (clean reinstall + retry)
|
|
344
|
+
|
|
345
|
+
### 0.1.4 (2026-03-07)
|
|
346
|
+
|
|
347
|
+
- **Windows compatibility** fixes
|
|
348
|
+
- `clean` command for removing residual files
|
|
349
|
+
- `read-context` prompt enhancements
|
|
350
|
+
|
|
351
|
+
### 0.1.3 (2026-03-07)
|
|
352
|
+
|
|
353
|
+
- RichText documentation overhaul
|
|
354
|
+
|
|
355
|
+
### 0.1.2 (2026-03-07)
|
|
356
|
+
|
|
357
|
+
- **Vercel Skills** ecosystem integration (`npx skills add ...`)
|
|
358
|
+
- `connect` user guidance improvements
|
|
359
|
+
|
|
360
|
+
### 0.1.1 (2026-03-07)
|
|
361
|
+
|
|
362
|
+
- Slim npm package (precise `files` whitelist)
|
|
363
|
+
|
|
364
|
+
### 0.1.0 (2026-03-07)
|
|
365
|
+
|
|
366
|
+
- Initial release — CLI + MCP Server + Plugin as single `remnote-bridge` package
|
|
367
|
+
- Commands: `connect`, `disconnect`, `health`, `read-rem`, `edit-rem`, `read-tree`, `edit-tree`, `read-globe`, `read-context`, `search`
|
|
368
|
+
- Three-layer architecture: Plugin (RemNote SDK) → CLI (commands) → MCP/Skill (AI agents)
|
|
369
|
+
- Session-based LRU cache with optimistic concurrency control
|
|
370
|
+
- Powerup noise filtering, ancestor breadcrumbs, ellipsis for large trees
|
|
371
|
+
|
|
253
372
|
## License
|
|
254
373
|
|
|
255
374
|
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
# remnote-bridge
|
|
2
|
+
|
|
3
|
+
[English](./README.md)
|
|
4
|
+
|
|
5
|
+
将 RemNote 知识库能力暴露给 AI Agent 的桥接工具集。单包发布 — CLI、MCP Server、Plugin 三合一。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g remnote-bridge
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 极速上手(配合 AI)
|
|
14
|
+
|
|
15
|
+
一步接入,剩下的交给 AI 引导。
|
|
16
|
+
|
|
17
|
+
### 方式 A:安装 Skill(支持 Claude Code、Cursor、Windsurf 等 40+ 工具)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx skills add baobao700508/unofficial-remnote-bridge-cli -s remnote-bridge
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 方式 B:配置 MCP Server(适用于任何支持 MCP 协议的 AI 客户端)
|
|
24
|
+
|
|
25
|
+
在 AI 客户端的 MCP 设置中添加:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"mcpServers": {
|
|
30
|
+
"remnote-bridge": {
|
|
31
|
+
"command": "remnote-bridge",
|
|
32
|
+
"args": ["mcp"]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**建议两者都安装效果最佳。** MCP 文档精简(一次性全部加载),Skill 文档详细(按需加载),两者互补。当然,单独使用任一方式也完全可以。
|
|
39
|
+
|
|
40
|
+
接入后,AI 会引导你完成连接 RemNote、加载插件等所有后续步骤。
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 快速开始
|
|
45
|
+
|
|
46
|
+
### 标准模式(推荐)
|
|
47
|
+
|
|
48
|
+
推荐日常使用 — 由你控制插件的加载和卸载。
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# 1. 启动守护进程(启动 WS 服务器 + 插件服务器)
|
|
52
|
+
remnote-bridge connect
|
|
53
|
+
|
|
54
|
+
# 2. 在 RemNote 中加载插件
|
|
55
|
+
# 打开 RemNote → Plugins → Develop Your Plugin
|
|
56
|
+
# 输入:http://localhost:8080
|
|
57
|
+
|
|
58
|
+
# 3. 检查系统状态
|
|
59
|
+
remnote-bridge health
|
|
60
|
+
|
|
61
|
+
# 4. 浏览知识库
|
|
62
|
+
remnote-bridge read-globe # 全局文档概览
|
|
63
|
+
remnote-bridge read-context # 当前焦点/页面上下文
|
|
64
|
+
remnote-bridge search "machine learning" # 全文搜索
|
|
65
|
+
remnote-bridge read-tree <remId> # 展开子树
|
|
66
|
+
remnote-bridge read-rem <remId> # 读取 Rem 属性
|
|
67
|
+
|
|
68
|
+
# 5. 编辑内容
|
|
69
|
+
remnote-bridge edit-rem <remId> --changes '{"text":["new text"]}'
|
|
70
|
+
remnote-bridge edit-tree <remId> --old-str ' old line <!--id-->' --new-str ' new line\n old line <!--id-->'
|
|
71
|
+
|
|
72
|
+
# 6. 停止守护进程
|
|
73
|
+
remnote-bridge disconnect
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Headless 模式(全自动)
|
|
77
|
+
|
|
78
|
+
初始设置后无需人工干预 — 仅用于全自动化场景。
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 1. 一次性操作:在 Chrome 中登录 RemNote(保存凭据)
|
|
82
|
+
remnote-bridge setup
|
|
83
|
+
|
|
84
|
+
# 2. 使用 headless Chrome 自动连接(无需浏览器窗口)
|
|
85
|
+
remnote-bridge connect --headless
|
|
86
|
+
|
|
87
|
+
# 3. 验证所有层就绪
|
|
88
|
+
remnote-bridge health
|
|
89
|
+
|
|
90
|
+
# 4. 直接使用任何命令
|
|
91
|
+
remnote-bridge search "machine learning"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 命令一览
|
|
95
|
+
|
|
96
|
+
### 基础设施
|
|
97
|
+
|
|
98
|
+
| 命令 | 说明 |
|
|
99
|
+
|:-----|:-----|
|
|
100
|
+
| `setup` | 启动 Chrome 登录 RemNote,为 headless 模式保存凭据 |
|
|
101
|
+
| `connect` | 启动守护进程(`--headless` 自动启动 Chrome,默认需手动加载插件) |
|
|
102
|
+
| `health` | 检查守护进程/插件/SDK 状态(`--diagnose` 截图诊断,`--reload` 重启 Chrome) |
|
|
103
|
+
| `disconnect` | 停止守护进程并释放资源 |
|
|
104
|
+
| `clean` | 清理所有残留文件(.pid / .log / .json / skill 目录) |
|
|
105
|
+
|
|
106
|
+
### 读取
|
|
107
|
+
|
|
108
|
+
| 命令 | 说明 | 缓存 |
|
|
109
|
+
|:-----|:-----|:-----|
|
|
110
|
+
| `read-globe` | 全局文档级概览 | 否 |
|
|
111
|
+
| `read-context` | 当前焦点/页面上下文视图 | 否 |
|
|
112
|
+
| `read-tree <remId>` | 子树序列化为 Markdown 大纲 | 是 |
|
|
113
|
+
| `read-rem <remId>` | 单个 Rem 的完整 JSON 属性 | 是 |
|
|
114
|
+
| `read-rem-in-tree <remId>` | 子树大纲 + 所有 Rem 对象,一次调用 | 是 |
|
|
115
|
+
| `search <query>` | 全文搜索 | 否 |
|
|
116
|
+
|
|
117
|
+
### 写入
|
|
118
|
+
|
|
119
|
+
| 命令 | 说明 | 前置条件 |
|
|
120
|
+
|:-----|:-----|:---------|
|
|
121
|
+
| `edit-rem <remId>` | 直接修改 Rem 字段(text、backText、type 等) | 需先 `read-rem` |
|
|
122
|
+
| `edit-tree <remId>` | 通过 str_replace 编辑树结构 | 需先 `read-tree` |
|
|
123
|
+
|
|
124
|
+
### 工具
|
|
125
|
+
|
|
126
|
+
| 命令 | 说明 |
|
|
127
|
+
|:-----|:-----|
|
|
128
|
+
| `mcp` | 启动 MCP Server(stdio 传输) |
|
|
129
|
+
| `install skill` | 安装 AI Agent Skill(通过 [Vercel Skills](https://github.com/vercel-labs/skills)) |
|
|
130
|
+
| `addon list\|install\|uninstall` | 管理增强项目(如 remnote-rag) |
|
|
131
|
+
|
|
132
|
+
## MCP Server
|
|
133
|
+
|
|
134
|
+
使用 `remnote-bridge mcp` 作为 AI 客户端的 MCP 服务器:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"mcpServers": {
|
|
139
|
+
"remnote-bridge": {
|
|
140
|
+
"command": "remnote-bridge",
|
|
141
|
+
"args": ["mcp"]
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
MCP 服务器将所有 CLI 命令暴露为工具。文档直接内联在工具描述和服务器说明中(无独立 resources)。
|
|
148
|
+
|
|
149
|
+
## AI Agent Skill
|
|
150
|
+
|
|
151
|
+
Skill 提供详细的使用说明(SKILL.md + 11 个命令文档),教 AI Agent 如何使用 remnote-bridge — 包括命令选择、工作流程、安全规则和闪卡操作。
|
|
152
|
+
|
|
153
|
+
### 通过 Vercel Skills 安装(推荐)
|
|
154
|
+
|
|
155
|
+
基于 [Vercel Skills](https://github.com/vercel-labs/skills) 生态。支持 **40+ AI 编程工具**,包括 Claude Code、Cursor、Windsurf、GitHub Copilot、Cline 等。
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# 直接安装 — 交互式选择 Agent
|
|
159
|
+
npx skills add baobao700508/unofficial-remnote-bridge-cli -s remnote-bridge
|
|
160
|
+
|
|
161
|
+
# 或通过内置封装(同样的交互体验)
|
|
162
|
+
remnote-bridge install skill
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
交互式安装器会自动检测已安装的 AI 工具,让你选择为哪些工具安装 Skill。
|
|
166
|
+
|
|
167
|
+
### 备选方案:仅限 Claude Code
|
|
168
|
+
|
|
169
|
+
如果 `npx` 不可用,或偏好手动安装:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
remnote-bridge install skill --copy
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
这会将 Skill 文件直接复制到 `~/.claude/skills/remnote-bridge/`。
|
|
176
|
+
|
|
177
|
+
### 安装内容
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
<agent-skills-dir>/remnote-bridge/
|
|
181
|
+
├── SKILL.md # 核心 Skill — 命令决策、工作流程、安全规则
|
|
182
|
+
└── instructions/ # 逐命令详细文档
|
|
183
|
+
├── overall.md # 全局概览
|
|
184
|
+
├── connect.md # connect 命令
|
|
185
|
+
├── read-tree.md # read-tree 命令
|
|
186
|
+
├── edit-tree.md # edit-tree 命令
|
|
187
|
+
└── ... # 另外 8 个命令文档
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## JSON 模式
|
|
191
|
+
|
|
192
|
+
所有命令支持 `--json` 用于程序化调用。JSON 模式下输入和输出均为 JSON:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# 输入:所有参数打包在 JSON 字符串中
|
|
196
|
+
remnote-bridge --json read-rem '{"remId":"abc123","fields":["text","type"]}'
|
|
197
|
+
|
|
198
|
+
# 输出:单行 JSON
|
|
199
|
+
# {"ok":true,"command":"read-rem","timestamp":"...","data":{...}}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## 多实例
|
|
203
|
+
|
|
204
|
+
支持并行运行多个守护进程实例(如不同的知识库):
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# 命名实例
|
|
208
|
+
remnote-bridge --instance work connect
|
|
209
|
+
remnote-bridge --instance personal connect
|
|
210
|
+
|
|
211
|
+
# Headless 简写
|
|
212
|
+
remnote-bridge --headless connect # 等同于 --instance headless
|
|
213
|
+
|
|
214
|
+
# 命令自动路由到对应实例
|
|
215
|
+
remnote-bridge --instance work search "project notes"
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
实例通过 `~/.remnote-bridge/` 下的全局注册表管理。每个实例拥有独立的端口分配、PID 文件和日志文件。
|
|
219
|
+
|
|
220
|
+
## 架构
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
AI Agent(Claude Code / MCP Client)
|
|
224
|
+
↕ CLI 命令(无状态短进程)
|
|
225
|
+
remnote-bridge CLI
|
|
226
|
+
↕ WebSocket IPC
|
|
227
|
+
守护进程(长生命周期:WS 服务器 + 处理器 + 缓存)
|
|
228
|
+
↕ WebSocket
|
|
229
|
+
remnote-plugin(运行在 RemNote 浏览器或 headless Chrome 中)
|
|
230
|
+
↕
|
|
231
|
+
RemNote SDK → 知识库
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
- **CLI 命令** 无状态 — 每次调用都是独立的 OS 进程
|
|
235
|
+
- **守护进程** 持有状态:缓存、WS 连接、超时计时器
|
|
236
|
+
- **插件** 运行在浏览器(或 headless Chrome)中,代守护进程调用 RemNote SDK
|
|
237
|
+
- **多实例** — 多个守护进程可同时运行,每个插件可连接多个守护进程(孪生优先级机制)
|
|
238
|
+
- **Headless 模式** 使用保存的凭据自动启动 Chrome — 无需浏览器窗口
|
|
239
|
+
- **三道安全防线** 保护编辑操作:缓存存在检查、乐观并发检测、str_replace 精确匹配(edit-tree)
|
|
240
|
+
|
|
241
|
+
## 配置
|
|
242
|
+
|
|
243
|
+
可选配置文件:项目根目录下的 `.remnote-bridge.json`。
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"wsPort": 3002,
|
|
248
|
+
"devServerPort": 8080,
|
|
249
|
+
"configPort": 3003,
|
|
250
|
+
"daemonTimeoutMinutes": 30,
|
|
251
|
+
"defaults": {
|
|
252
|
+
"maxNodes": 200,
|
|
253
|
+
"maxSiblings": 20,
|
|
254
|
+
"readTreeDepth": 3
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
所有值都有合理的默认值 — 配置文件不是必需的。
|
|
260
|
+
|
|
261
|
+
## 致谢
|
|
262
|
+
|
|
263
|
+
本项目的灵感来源和学习对象:
|
|
264
|
+
|
|
265
|
+
- [remnote-mcp-bridge](https://github.com/quentintou/remnote-mcp-bridge) by [@quentintou](https://github.com/quentintou) — 最早将 RemNote 连接到 AI 助手的 MCP 桥接项目。开创了通过 MCP 将 RemNote SDK 桥接到外部工具的理念。
|
|
266
|
+
- [remnote-mcp-bridge (fork)](https://github.com/robert7/remnote-mcp-bridge) by [@robert7](https://github.com/robert7) — 在原版基础上扩展了通用、可扩展的 WebSocket 桥接架构。其 Plugin ↔ WebSocket ↔ CLI 分层设计为我们提供了宝贵的架构参考。
|
|
267
|
+
|
|
268
|
+
## 增强项目(Addons)
|
|
269
|
+
|
|
270
|
+
增强项目为 remnote-bridge 扩展额外能力:
|
|
271
|
+
|
|
272
|
+
| 增强项目 | 说明 |
|
|
273
|
+
|:---------|:-----|
|
|
274
|
+
| [remnote-rag](https://github.com/baobao700508/remnote-rag) | 基于 ChromaDB + DashScope 嵌入的语义搜索 |
|
|
275
|
+
| [remnote-chat](https://github.com/baobao700508/remnote-chat) | RemNote 知识库聊天界面 |
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# 查看所有增强项目
|
|
279
|
+
remnote-bridge addon list
|
|
280
|
+
|
|
281
|
+
# 安装增强项目
|
|
282
|
+
remnote-bridge addon install remnote-rag
|
|
283
|
+
|
|
284
|
+
# 卸载(--purge 同时删除数据)
|
|
285
|
+
remnote-bridge addon uninstall remnote-rag --purge
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Roadmap
|
|
289
|
+
|
|
290
|
+
- **RAG 语义搜索** — 基于本地 SQLite + ChromaDB 的语义检索,补充 SDK 全文搜索
|
|
291
|
+
- **多语言支持** — 国际化,更广泛的可访问性
|
|
292
|
+
|
|
293
|
+
## Changelog
|
|
294
|
+
|
|
295
|
+
### 0.1.15 (2026-03-18)
|
|
296
|
+
|
|
297
|
+
- **防线 2 误判修复** — 移除 RemObject 序列化中 ID 数组的 `.sort()`,消除 edit-rem 并发检测的假阳性
|
|
298
|
+
- **文档全面优化** — 加强 headless 模式警告、新增 Plugin 加载防幻觉红线、重组 edit-tree 模板/回退双模式文档
|
|
299
|
+
- **Skill ↔ MCP 文档同步** — connect、edit-tree、overall 说明在 Skill 和 MCP 层全面对齐
|
|
300
|
+
|
|
301
|
+
### 0.1.14 (2026-03-18)
|
|
302
|
+
|
|
303
|
+
- **read-rem-in-tree** — 新命令:一次调用获取子树大纲 + 所有 Rem 对象(批量读取,用于批量编辑场景)
|
|
304
|
+
- **Token Slimming** — `read-rem` 默认省略处于默认值的字段,减少 token 消耗;`--full` 获取完整输出
|
|
305
|
+
- **rem-field-filter** — 从 read-handler 提取可复用的字段过滤逻辑
|
|
306
|
+
- **Headless 策略** — CLAUDE.md 新增测试场景禁止 headless 模式的规则
|
|
307
|
+
- **health 改进** — 重构诊断逻辑,优化状态报告
|
|
308
|
+
|
|
309
|
+
### 0.1.13 (2026-03-15)
|
|
310
|
+
|
|
311
|
+
- **edit-rem 重写** — 从 str_replace 改为直接字段修改(`--changes` 参数)
|
|
312
|
+
- **移除 MCP resources** — 所有文档内联到工具描述和服务器说明中
|
|
313
|
+
- **MCP 返回格式标准化** — 大纲工具使用 Frontmatter+Body,操作工具使用 Data JSON
|
|
314
|
+
|
|
315
|
+
### 0.1.12 (2026-03-15)
|
|
316
|
+
|
|
317
|
+
- **多实例支持** — `--instance <name>` 参数,`~/.remnote-bridge/` 全局注册表,并行守护进程
|
|
318
|
+
- **插件多连接** — 单个插件可连接多个守护进程,孪生优先级机制
|
|
319
|
+
- **增强项目系统** — `addon list|install|uninstall` 命令,管理扩展项目(remnote-rag、remnote-chat)
|
|
320
|
+
- **read-context focusRemId** — 可选参数,指定焦点目标而无需改变 RemNote 界面
|
|
321
|
+
- **输出优化** — `children` 从默认输出移至 full 模式(`read-rem --full`)
|
|
322
|
+
|
|
323
|
+
### 0.1.9 (2026-03-09)
|
|
324
|
+
|
|
325
|
+
- 建议日常使用标准模式,headless 仅用于全自动化场景
|
|
326
|
+
|
|
327
|
+
### 0.1.8 (2026-03-09)
|
|
328
|
+
|
|
329
|
+
- **Headless Chrome** — `setup` + `connect --headless` + `health --diagnose/--reload`,零干预工作流
|
|
330
|
+
- **静态插件服务器** — 轻量生产服务器,替代非开发模式下的 webpack-dev-server
|
|
331
|
+
|
|
332
|
+
### 0.1.7 (2026-03-08)
|
|
333
|
+
|
|
334
|
+
- **Portal 支持** — 读写 Portal Rem,双路径解析(portal ↔ source)
|
|
335
|
+
- **树操作** — 通过 `edit-tree` 创建和删除 Rem
|
|
336
|
+
|
|
337
|
+
### 0.1.6 (2026-03-07)
|
|
338
|
+
|
|
339
|
+
- 连接超时从 10 秒延长到 60 秒
|
|
340
|
+
|
|
341
|
+
### 0.1.5 (2026-03-07)
|
|
342
|
+
|
|
343
|
+
- dev-server 崩溃自愈机制(清洁重装 + 重试)
|
|
344
|
+
|
|
345
|
+
### 0.1.4 (2026-03-07)
|
|
346
|
+
|
|
347
|
+
- **Windows 兼容性**修复
|
|
348
|
+
- `clean` 命令,清理残留文件
|
|
349
|
+
- `read-context` 提示增强
|
|
350
|
+
|
|
351
|
+
### 0.1.3 (2026-03-07)
|
|
352
|
+
|
|
353
|
+
- RichText 文档全面修正
|
|
354
|
+
|
|
355
|
+
### 0.1.2 (2026-03-07)
|
|
356
|
+
|
|
357
|
+
- **Vercel Skills** 生态适配(`npx skills add ...`)
|
|
358
|
+
- `connect` 用户引导改进
|
|
359
|
+
|
|
360
|
+
### 0.1.1 (2026-03-07)
|
|
361
|
+
|
|
362
|
+
- 瘦身 npm 包(精确 `files` 白名单)
|
|
363
|
+
|
|
364
|
+
### 0.1.0 (2026-03-07)
|
|
365
|
+
|
|
366
|
+
- 首次发布 — CLI + MCP Server + Plugin 单包 `remnote-bridge`
|
|
367
|
+
- 命令:`connect`、`disconnect`、`health`、`read-rem`、`edit-rem`、`read-tree`、`edit-tree`、`read-globe`、`read-context`、`search`
|
|
368
|
+
- 三层架构:Plugin(RemNote SDK)→ CLI(命令层)→ MCP/Skill(AI 接入层)
|
|
369
|
+
- 基于会话的 LRU 缓存 + 乐观并发控制
|
|
370
|
+
- Powerup 噪音过滤、祖先面包屑、大树省略机制
|
|
371
|
+
|
|
372
|
+
## License
|
|
373
|
+
|
|
374
|
+
MIT
|