remnote-bridge 0.1.1 → 0.1.2
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 +65 -3
- package/dist/cli/commands/install-skill.js +51 -11
- package/dist/cli/main.js +12 -4
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/instructions.js +57 -20
- package/dist/mcp/resources/separator-flashcard.js +31 -29
- package/package.json +2 -3
- package/{skill → skills/remnote-bridge}/SKILL.md +64 -34
- package/{docs/instruction → skills/remnote-bridge/instructions}/connect.md +24 -0
- package/{docs/instruction → skills/remnote-bridge/instructions}/overall.md +52 -35
- /package/{docs/instruction → skills/remnote-bridge/instructions}/disconnect.md +0 -0
- /package/{docs/instruction → skills/remnote-bridge/instructions}/edit-rem.md +0 -0
- /package/{docs/instruction → skills/remnote-bridge/instructions}/edit-tree.md +0 -0
- /package/{docs/instruction → skills/remnote-bridge/instructions}/health.md +0 -0
- /package/{docs/instruction → skills/remnote-bridge/instructions}/read-context.md +0 -0
- /package/{docs/instruction → skills/remnote-bridge/instructions}/read-globe.md +0 -0
- /package/{docs/instruction → skills/remnote-bridge/instructions}/read-rem.md +0 -0
- /package/{docs/instruction → skills/remnote-bridge/instructions}/read-tree.md +0 -0
- /package/{docs/instruction → skills/remnote-bridge/instructions}/search.md +0 -0
package/README.md
CHANGED
|
@@ -10,6 +10,35 @@ Bridge toolkit that exposes your RemNote knowledge base to AI agents. Single pac
|
|
|
10
10
|
npm install -g remnote-bridge
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## Super Quick Start (with AI)
|
|
14
|
+
|
|
15
|
+
One step to connect, then let AI guide you through the rest.
|
|
16
|
+
|
|
17
|
+
### Option A: Install Skill (works with Claude Code, Cursor, Windsurf, and 40+ tools)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx skills add baobao700508/unofficial-remnote-bridge-cli -s remnote-bridge
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Option B: Configure MCP Server (for any MCP-compatible AI client)
|
|
24
|
+
|
|
25
|
+
Add the following to your AI client's MCP settings:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"mcpServers": {
|
|
30
|
+
"remnote-bridge": {
|
|
31
|
+
"command": "remnote-bridge",
|
|
32
|
+
"args": ["mcp"]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Once connected, the AI will guide you through connecting to RemNote, loading the plugin, and everything else.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
13
42
|
## Quick Start
|
|
14
43
|
|
|
15
44
|
```bash
|
|
@@ -70,7 +99,7 @@ remnote-bridge disconnect
|
|
|
70
99
|
| Command | Description |
|
|
71
100
|
|:--------|:------------|
|
|
72
101
|
| `mcp` | Start the MCP Server (stdio transport) |
|
|
73
|
-
| `install skill` | Install
|
|
102
|
+
| `install skill` | Install AI agent skill (via [Vercel Skills](https://github.com/vercel-labs/skills)) |
|
|
74
103
|
|
|
75
104
|
## MCP Server
|
|
76
105
|
|
|
@@ -89,13 +118,46 @@ Use `remnote-bridge mcp` as an MCP server for AI clients:
|
|
|
89
118
|
|
|
90
119
|
The MCP server exposes all CLI commands as tools, plus documentation resources.
|
|
91
120
|
|
|
92
|
-
##
|
|
121
|
+
## AI Agent Skill
|
|
122
|
+
|
|
123
|
+
The Skill provides detailed instructions (SKILL.md + 11 command docs) that teach AI agents how to use remnote-bridge — including command selection, workflows, safety rules, and flashcard operations.
|
|
124
|
+
|
|
125
|
+
### Install via Vercel Skills (recommended)
|
|
126
|
+
|
|
127
|
+
Powered by the [Vercel Skills](https://github.com/vercel-labs/skills) ecosystem. Supports **40+ AI coding tools** including Claude Code, Cursor, Windsurf, GitHub Copilot, Cline, and more.
|
|
93
128
|
|
|
94
129
|
```bash
|
|
130
|
+
# Direct — interactive agent selection
|
|
131
|
+
npx skills add baobao700508/unofficial-remnote-bridge-cli -s remnote-bridge
|
|
132
|
+
|
|
133
|
+
# Or through the built-in wrapper (same interactive experience)
|
|
95
134
|
remnote-bridge install skill
|
|
96
135
|
```
|
|
97
136
|
|
|
98
|
-
|
|
137
|
+
The interactive installer will detect your installed AI tools and let you choose which ones to install the skill for.
|
|
138
|
+
|
|
139
|
+
### Fallback: Claude Code only
|
|
140
|
+
|
|
141
|
+
If `npx` is not available, or you prefer manual installation:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
remnote-bridge install skill --copy
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
This copies the skill files directly to `~/.claude/skills/remnote-bridge/`.
|
|
148
|
+
|
|
149
|
+
### What gets installed
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
<agent-skills-dir>/remnote-bridge/
|
|
153
|
+
├── SKILL.md # Core skill — command decisions, workflows, safety rules
|
|
154
|
+
└── instructions/ # Detailed per-command documentation
|
|
155
|
+
├── overall.md # Global overview
|
|
156
|
+
├── connect.md # connect command
|
|
157
|
+
├── read-tree.md # read-tree command
|
|
158
|
+
├── edit-tree.md # edit-tree command
|
|
159
|
+
└── ... # 8 more command docs
|
|
160
|
+
```
|
|
99
161
|
|
|
100
162
|
## JSON Mode
|
|
101
163
|
|
|
@@ -1,16 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* install skill 命令
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 薄层封装 Vercel Skills CLI(npx skills add),利用其交互式选择让用户适配不同 AI 编程工具。
|
|
5
|
+
* npx 不可用时 fallback 到直接复制(仅 Claude Code)。
|
|
5
6
|
*/
|
|
6
7
|
import fs from 'fs';
|
|
7
8
|
import path from 'path';
|
|
8
9
|
import os from 'os';
|
|
10
|
+
import { spawn, execSync } from 'child_process';
|
|
11
|
+
const GITHUB_REPO = 'baobao700508/unofficial-remnote-bridge-cli';
|
|
12
|
+
const SKILL_NAME = 'remnote-bridge';
|
|
9
13
|
export async function installSkillCommand() {
|
|
14
|
+
// 检测 npx 是否可用
|
|
15
|
+
let hasNpx = false;
|
|
16
|
+
try {
|
|
17
|
+
execSync('npx --version', { stdio: 'pipe', timeout: 5000 });
|
|
18
|
+
hasNpx = true;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// npx 不可用
|
|
22
|
+
}
|
|
23
|
+
if (!hasNpx) {
|
|
24
|
+
console.log('未检测到 npx,使用内置方式安装到 Claude Code...\n');
|
|
25
|
+
copySkillFiles();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// 直接调用 npx skills add,继承 stdio 让用户看到交互式选择界面
|
|
29
|
+
console.log(`通过 Vercel Skills CLI 安装 ${SKILL_NAME}...\n`);
|
|
30
|
+
const child = spawn('npx', ['skills', 'add', GITHUB_REPO, '-s', SKILL_NAME], {
|
|
31
|
+
stdio: 'inherit',
|
|
32
|
+
shell: true,
|
|
33
|
+
});
|
|
34
|
+
await new Promise((resolve) => {
|
|
35
|
+
child.on('close', (code) => {
|
|
36
|
+
if (code !== 0) {
|
|
37
|
+
console.log(`\nVercel Skills CLI 退出码: ${code}`);
|
|
38
|
+
console.log('如需使用内置方式安装(仅 Claude Code),请运行:');
|
|
39
|
+
console.log(' remnote-bridge install skill --copy\n');
|
|
40
|
+
process.exitCode = 1;
|
|
41
|
+
}
|
|
42
|
+
resolve();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export async function installSkillCopyCommand() {
|
|
47
|
+
copySkillFiles();
|
|
48
|
+
}
|
|
49
|
+
function copySkillFiles() {
|
|
10
50
|
// 从包安装路径计算包根(dist/cli/commands/install-skill.js → 包根)
|
|
11
51
|
const packageRoot = path.resolve(import.meta.dirname, '..', '..', '..');
|
|
12
|
-
const
|
|
13
|
-
const
|
|
52
|
+
const skillDir = path.join(packageRoot, 'skills', 'remnote-bridge');
|
|
53
|
+
const skillSource = path.join(skillDir, 'SKILL.md');
|
|
54
|
+
const instructionDir = path.join(skillDir, 'instructions');
|
|
14
55
|
if (!fs.existsSync(skillSource)) {
|
|
15
56
|
console.error(`错误: 找不到 SKILL.md: ${skillSource}`);
|
|
16
57
|
process.exitCode = 1;
|
|
@@ -19,15 +60,12 @@ export async function installSkillCommand() {
|
|
|
19
60
|
// 目标目录
|
|
20
61
|
const targetDir = path.join(os.homedir(), '.claude', 'skills', 'remnote-bridge');
|
|
21
62
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
22
|
-
// 复制 SKILL.md
|
|
23
|
-
|
|
24
|
-
const targetInstructionDir = path.join(targetDir, 'instruction');
|
|
25
|
-
// 替换相对路径 docs/instruction/ 为安装后的绝对路径
|
|
26
|
-
skillContent = skillContent.replace(/docs\/instruction\//g, targetInstructionDir + '/');
|
|
27
|
-
fs.writeFileSync(path.join(targetDir, 'SKILL.md'), skillContent, 'utf-8');
|
|
63
|
+
// 复制 SKILL.md
|
|
64
|
+
fs.copyFileSync(skillSource, path.join(targetDir, 'SKILL.md'));
|
|
28
65
|
console.log(` SKILL.md → ${targetDir}/SKILL.md`);
|
|
29
|
-
// 复制
|
|
66
|
+
// 复制 instructions/*.md
|
|
30
67
|
if (fs.existsSync(instructionDir)) {
|
|
68
|
+
const targetInstructionDir = path.join(targetDir, 'instructions');
|
|
31
69
|
fs.mkdirSync(targetInstructionDir, { recursive: true });
|
|
32
70
|
const files = fs.readdirSync(instructionDir).filter(f => f.endsWith('.md'));
|
|
33
71
|
for (const file of files) {
|
|
@@ -35,5 +73,7 @@ export async function installSkillCommand() {
|
|
|
35
73
|
console.log(` ${file} → ${targetInstructionDir}/${file}`);
|
|
36
74
|
}
|
|
37
75
|
}
|
|
38
|
-
console.log(`\nSkill 已安装到 ${targetDir}
|
|
76
|
+
console.log(`\nSkill 已安装到 ${targetDir}(仅 Claude Code)`);
|
|
77
|
+
console.log('如需安装到其他 AI 工具,请运行:');
|
|
78
|
+
console.log(` npx skills add ${GITHUB_REPO} -s ${SKILL_NAME}\n`);
|
|
39
79
|
}
|
package/dist/cli/main.js
CHANGED
|
@@ -15,7 +15,7 @@ import { editTreeCommand } from './commands/edit-tree.js';
|
|
|
15
15
|
import { readGlobeCommand } from './commands/read-globe.js';
|
|
16
16
|
import { readContextCommand } from './commands/read-context.js';
|
|
17
17
|
import { searchCommand } from './commands/search.js';
|
|
18
|
-
import { installSkillCommand } from './commands/install-skill.js';
|
|
18
|
+
import { installSkillCommand, installSkillCopyCommand } from './commands/install-skill.js';
|
|
19
19
|
const program = new Command();
|
|
20
20
|
/**
|
|
21
21
|
* --json 模式下解析 JSON 输入参数。
|
|
@@ -53,7 +53,7 @@ function parseJsonInput(command, jsonStr, requiredFields = []) {
|
|
|
53
53
|
program
|
|
54
54
|
.name('remnote-bridge')
|
|
55
55
|
.description('RemNote Bridge — CLI + MCP Server + Plugin')
|
|
56
|
-
.version('0.1.
|
|
56
|
+
.version('0.1.2')
|
|
57
57
|
.option('--json', '以 JSON 格式输出(适用于程序化调用)');
|
|
58
58
|
program
|
|
59
59
|
.command('connect')
|
|
@@ -295,6 +295,14 @@ program.command('mcp')
|
|
|
295
295
|
// install 子命令组
|
|
296
296
|
const installCmd = program.command('install').description('安装组件');
|
|
297
297
|
installCmd.command('skill')
|
|
298
|
-
.description('安装 Skill
|
|
299
|
-
.
|
|
298
|
+
.description('安装 Skill(推荐使用 npx skills add,或 --copy 直接复制)')
|
|
299
|
+
.option('--copy', '直接复制到 ~/.claude/skills/(不使用 Vercel Skills CLI)')
|
|
300
|
+
.action(async (opts) => {
|
|
301
|
+
if (opts.copy) {
|
|
302
|
+
await installSkillCopyCommand();
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
await installSkillCommand();
|
|
306
|
+
}
|
|
307
|
+
});
|
|
300
308
|
program.parse();
|
package/dist/mcp/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { SEPARATOR_FLASHCARD_CONTENT } from './resources/separator-flashcard.js'
|
|
|
17
17
|
export async function startMcpServer() {
|
|
18
18
|
const server = new FastMCP({
|
|
19
19
|
name: 'remnote-bridge',
|
|
20
|
-
version: '0.1.
|
|
20
|
+
version: '0.1.2',
|
|
21
21
|
instructions: SERVER_INSTRUCTIONS,
|
|
22
22
|
});
|
|
23
23
|
registerInfraTools(server);
|
package/dist/mcp/instructions.js
CHANGED
|
@@ -29,21 +29,31 @@ Rem 有两个独立维度:**type**(闪卡语义)和 **isDocument**(页
|
|
|
29
29
|
| \\\`default\\\` | 普通 Rem | 正常字重 |
|
|
30
30
|
| \\\`portal\\\` | 嵌入引用容器 | 紫色边框(**只读**,不可设置) |
|
|
31
31
|
|
|
32
|
-
###
|
|
32
|
+
### 闪卡的 CLI 操作方式
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
闪卡由 Rem 的 \\\`type\\\`、\\\`backText\\\`、\\\`practiceDirection\\\` 三个字段控制。通过 CLI 创建/修改闪卡,操作的是这些**字段**,而非分隔符。
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|:-------|:-----|:-----|
|
|
38
|
-
| \\\`::\\\` | concept | 概念定义(双向) |
|
|
39
|
-
| \\\`;;\\\` | descriptor | 描述属性(正向) |
|
|
40
|
-
| \\\`>>\\\` | default | 正向问答 |
|
|
41
|
-
| \\\`<<\\\` | default | 反向问答 |
|
|
42
|
-
| \\\`<>\\\` | default | 双向问答 |
|
|
43
|
-
| \\\`>>>\\\` | default | 多行答案(子 Rem 为答案) |
|
|
44
|
-
| \\\`{{}}\\\` | default | 完形填空 |
|
|
36
|
+
**禁止**:在文本中插入分隔符(\\\`::\\\`、\\\`;;\\\`、\\\`>>\\\` 等)来创建闪卡。分隔符是 RemNote 编辑器的输入语法,CLI 无法识别。
|
|
45
37
|
|
|
46
|
-
|
|
38
|
+
| 闪卡操作 | CLI 方法 |
|
|
39
|
+
|:---------|:---------|
|
|
40
|
+
| 创建概念定义 | \\\`edit_tree\\\` 新增行 \\\`概念 ↔ 定义\\\`,再 \\\`edit_rem\\\` 设 \\\`type: "concept"\\\` |
|
|
41
|
+
| 创建正向问答 | \\\`edit_tree\\\` 新增行 \\\`问题 → 答案\\\` |
|
|
42
|
+
| 创建多行答案 | \\\`edit_tree\\\` 新增行 \\\`问题 ↓\\\`(子行自动成为答案) |
|
|
43
|
+
| 改变闪卡类型 | \\\`edit_rem\\\` 修改 \\\`type\\\`、\\\`backText\\\`、\\\`practiceDirection\\\` |
|
|
44
|
+
|
|
45
|
+
### 理解用户意图:分隔符映射
|
|
46
|
+
|
|
47
|
+
用户在 RemNote 编辑器中通过分隔符创建闪卡。当用户提到这些分隔符时,你需要理解其意图并映射到 CLI 操作:
|
|
48
|
+
|
|
49
|
+
| 用户说 / 编辑器分隔符 | 对应的 type | 对应的 practiceDirection |
|
|
50
|
+
|:----------------------|:-----------|:-----------------------|
|
|
51
|
+
| \\\`::\\\` | concept | both |
|
|
52
|
+
| \\\`;;\\\` | descriptor | forward |
|
|
53
|
+
| \\\`>>\\\` / \\\`<<\\\` / \\\`<>\\\` | default | forward / backward / both |
|
|
54
|
+
| \\\`>>>\\\` / \\\`::>\\\` / \\\`;;>\\\` | default / concept / descriptor | forward / both / forward(多行) |
|
|
55
|
+
|
|
56
|
+
完整映射表见 \\\`resource://separator-flashcard\\\`。
|
|
47
57
|
|
|
48
58
|
### 链接机制
|
|
49
59
|
|
|
@@ -66,6 +76,8 @@ RemNote 的格式设置(标题、高亮、代码等)会注入隐藏的系统
|
|
|
66
76
|
\\\`\\\`\\\`
|
|
67
77
|
connect → 启动 daemon(幂等,重复调用安全)
|
|
68
78
|
↓
|
|
79
|
+
⚠️ 用户操作:确保 RemNote 中已加载插件(见下方说明)
|
|
80
|
+
↓
|
|
69
81
|
health → 确认三层就绪(daemon / Plugin / SDK)
|
|
70
82
|
↓
|
|
71
83
|
业务操作(read / search / edit)
|
|
@@ -79,6 +91,25 @@ disconnect → 关闭 daemon,清空所有缓存
|
|
|
79
91
|
- \\\`disconnect\\\` 会销毁所有缓存,之前的 read 结果全部失效
|
|
80
92
|
- daemon 默认 30 分钟无活动自动关闭
|
|
81
93
|
|
|
94
|
+
### ⚠️ connect 后需要用户配合(重要)
|
|
95
|
+
|
|
96
|
+
\\\`connect\\\` 成功只意味着 daemon 和 webpack-dev-server 已启动,**Plugin 并未自动连接**。用户必须在 RemNote 中完成以下操作,Plugin 才能连接到 daemon:
|
|
97
|
+
|
|
98
|
+
**首次使用**(RemNote 从未加载过此插件):
|
|
99
|
+
1. 打开 RemNote 桌面端或网页端
|
|
100
|
+
2. 点击左侧边栏底部的插件图标(拼图形状)
|
|
101
|
+
3. 点击「开发你的插件」(Develop Your Plugin)
|
|
102
|
+
4. 在输入框中填入 \\\`http://localhost:8080\\\`(即 connect 输出的 webpack-dev-server 地址)
|
|
103
|
+
5. 等待插件加载完成
|
|
104
|
+
|
|
105
|
+
**非首次使用**(之前已加载过此插件):
|
|
106
|
+
- 只需**刷新 RemNote 页面**即可(浏览器 F5 或 Cmd+R),插件会自动重新连接
|
|
107
|
+
|
|
108
|
+
**你必须这样做**:
|
|
109
|
+
1. 执行 \\\`connect\\\` 后,**立即告知用户需要完成上述操作**
|
|
110
|
+
2. **不要在 connect 后直接调用业务命令**——此时 Plugin 尚未连接,命令会失败
|
|
111
|
+
3. 引导用户完成操作后,用 \\\`health\\\` 确认三层就绪,再执行业务命令
|
|
112
|
+
|
|
82
113
|
---
|
|
83
114
|
|
|
84
115
|
## 3. Common Scenarios
|
|
@@ -136,26 +167,32 @@ str_replace 操作的是格式化 JSON 文本(2 空格缩进)。oldStr 要
|
|
|
136
167
|
|
|
137
168
|
**红线**:edit_tree **禁止修改已有行的文字内容**——改内容必须用 edit_rem。edit_tree 只做结构操作。
|
|
138
169
|
|
|
139
|
-
### 场景 F
|
|
170
|
+
### 场景 F:创建 / 修改闪卡
|
|
140
171
|
|
|
141
|
-
> 用户说:"创建一个概念定义"、"做个正向问答卡"
|
|
172
|
+
> 用户说:"创建一个概念定义"、"做个正向问答卡"、"把这个改成 concept"
|
|
142
173
|
|
|
143
|
-
|
|
174
|
+
闪卡由 \\\`type\\\`、\\\`backText\\\`、\\\`practiceDirection\\\` 三个字段控制。操作方式:
|
|
144
175
|
|
|
145
|
-
|
|
176
|
+
**创建新闪卡**(\\\`edit_tree\\\` 新增行 + 箭头):
|
|
146
177
|
- 正向问答:\\\`问题 → 答案\\\`
|
|
147
|
-
- 多行答案:\\\`问题 ↓\\\`(子行自动成为答案)
|
|
148
178
|
- 双向问答:\\\`问题 ↔ 答案\\\`
|
|
179
|
+
- 多行答案:\\\`问题 ↓\\\`(子行自动成为答案)
|
|
180
|
+
- 概念定义:\\\`概念 ↔ 定义\\\`,再用 \\\`edit_rem\\\` 设 \\\`type: "concept"\\\`
|
|
181
|
+
|
|
182
|
+
**修改现有 Rem 的闪卡行为**(\\\`read_rem\\\` → \\\`edit_rem\\\`):
|
|
183
|
+
- 改类型:修改 \\\`type\\\` 字段(\\\`"default"\\\` → \\\`"concept"\\\`)
|
|
184
|
+
- 改方向:修改 \\\`practiceDirection\\\`(\\\`"forward"\\\` / \\\`"backward"\\\` / \\\`"both"\\\` / \\\`"none"\\\`)
|
|
185
|
+
- 加/改背面:修改 \\\`backText\\\` 字段
|
|
149
186
|
|
|
150
|
-
|
|
187
|
+
**禁止**:在文本内容中插入 \\\`::\\\`、\\\`;;\\\`、\\\`>>\\\` 等分隔符——这些是 RemNote 编辑器语法,CLI 不识别。
|
|
151
188
|
|
|
152
189
|
### 场景 G:排查连接问题
|
|
153
190
|
|
|
154
191
|
> 用户说:"连不上"、"命令报错了"
|
|
155
192
|
|
|
156
193
|
使用 \\\`health\\\` 检查三层状态,然后对症处理:
|
|
157
|
-
- daemon 未运行 → 执行 \\\`connect
|
|
158
|
-
- Plugin 未连接 →
|
|
194
|
+
- daemon 未运行 → 执行 \\\`connect\\\`,然后引导用户在 RemNote 中加载插件
|
|
195
|
+
- Plugin 未连接 → 提醒用户:首次使用需在 RemNote 的「开发你的插件」中填入 \\\`http://localhost:8080\\\`;非首次使用只需刷新 RemNote 页面
|
|
159
196
|
- SDK 未就绪 → 等待几秒后重试 health
|
|
160
197
|
|
|
161
198
|
---
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
export const SEPARATOR_FLASHCARD_CONTENT = `
|
|
2
2
|
# Separator & Flashcard Reference
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
**重要**:分隔符(\\\`::\\\`、\\\`;;\\\`、\\\`>>\\\` 等)是 RemNote 编辑器的输入语法,**CLI 不使用分隔符**。通过 CLI 创建/修改闪卡,操作的是 \\\`type\\\`、\\\`backText\\\`、\\\`practiceDirection\\\` 字段和大纲箭头(\\\`→←↔↓↑↕\\\`)。本参考表用于理解用户意图——当用户提到分隔符时,映射到对应的 CLI 操作。
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
|
13
|
-
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
8
|
+
## 1. 用户意图映射:编辑器分隔符 → CLI 操作
|
|
9
|
+
|
|
10
|
+
当用户提到以下分隔符时,对应的 Rem 属性为:
|
|
11
|
+
|
|
12
|
+
| 编辑器分隔符 | 用户输入示例 | type | backText | 默认 practiceDirection |
|
|
13
|
+
|:-------------|:-------------|:-----|:---------|:-----------------------|
|
|
14
|
+
| (无) | \\\`普通文本\\\` | \\\`default\\\` | \\\`null\\\` | — |
|
|
15
|
+
| \\\`::\\\` | \\\`概念 :: 定义\\\` | \\\`concept\\\` | 后半部分 | \\\`both\\\` |
|
|
16
|
+
| \\\`;;\\\` | \\\`属性 ;; 值\\\` | \\\`descriptor\\\` | 后半部分 | \\\`forward\\\` |
|
|
17
|
+
| \\\`>>\\\` | \\\`问题 >> 答案\\\` | \\\`default\\\` | 后半部分 | \\\`forward\\\` |
|
|
18
|
+
| \\\`<<\\\` | \\\`问题 << 答案\\\` | \\\`default\\\` | 后半部分 | \\\`backward\\\` |
|
|
19
|
+
| \\\`<>\\\` | \\\`问题 <> 答案\\\` | \\\`default\\\` | 后半部分 | \\\`both\\\` |
|
|
20
|
+
| \\\`>>>\\\` | \\\`问题 >>>\\\` | \\\`default\\\` | \\\`null\\\` | \\\`forward\\\`(多行) |
|
|
21
|
+
| \\\`::>\\\` | \\\`概念 ::>\\\` | \\\`concept\\\` | \\\`null\\\` | \\\`both\\\`(多行) |
|
|
22
|
+
| \\\`;;>\\\` | \\\`属性 ;;>\\\` | \\\`descriptor\\\` | \\\`null\\\` | \\\`forward\\\`(多行) |
|
|
23
|
+
| \\\`{{}}\\\` | \\\`The {{capital}} of France\\\` | \\\`default\\\` | \\\`null\\\` | \\\`forward\\\`(完形填空) |
|
|
22
24
|
|
|
23
25
|
---
|
|
24
26
|
|
|
25
|
-
##
|
|
27
|
+
## 2. CLI 操作方式:大纲箭头
|
|
26
28
|
|
|
27
|
-
在 Markdown 大纲(read_tree / edit_tree
|
|
29
|
+
在 Markdown 大纲(read_tree / edit_tree)中,practiceDirection 编码为 Unicode 箭头:
|
|
28
30
|
|
|
29
31
|
### 单行箭头(有 backText)
|
|
30
32
|
|
|
@@ -46,7 +48,7 @@ export const SEPARATOR_FLASHCARD_CONTENT = `
|
|
|
46
48
|
|
|
47
49
|
---
|
|
48
50
|
|
|
49
|
-
## practiceDirection 取值
|
|
51
|
+
## 3. practiceDirection 取值
|
|
50
52
|
|
|
51
53
|
| 值 | 含义 | 闪卡生成 |
|
|
52
54
|
|:---|:-----|:---------|
|
|
@@ -57,28 +59,28 @@ export const SEPARATOR_FLASHCARD_CONTENT = `
|
|
|
57
59
|
|
|
58
60
|
---
|
|
59
61
|
|
|
60
|
-
## CDF(Concept-Descriptor Framework)
|
|
62
|
+
## 4. CDF(Concept-Descriptor Framework)
|
|
61
63
|
|
|
62
64
|
RemNote 推荐的知识结构化方法:
|
|
63
65
|
|
|
64
|
-
- **Concept
|
|
65
|
-
- **Descriptor
|
|
66
|
+
- **Concept**(type:concept):需要理解的核心概念——"X 是什么?"
|
|
67
|
+
- **Descriptor**(type:descriptor):概念的属性/描述——"X 的 Y 是什么?"
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
在 CLI 大纲中的表现(注意:用箭头和元数据标记,不用分隔符):
|
|
68
70
|
|
|
69
71
|
\\\`\\\`\\\`
|
|
70
|
-
线性回归
|
|
71
|
-
假设
|
|
72
|
-
损失函数
|
|
72
|
+
线性回归 ↔ 最基本的回归模型 <!--id1 type:concept-->
|
|
73
|
+
假设 → 因变量与自变量呈线性关系 <!--id2 type:descriptor-->
|
|
74
|
+
损失函数 → 均方误差 (MSE) <!--id3 type:descriptor-->
|
|
73
75
|
\\\`\\\`\\\`
|
|
74
76
|
|
|
75
77
|
---
|
|
76
78
|
|
|
77
|
-
## 通过 CLI 创建闪卡
|
|
79
|
+
## 5. 通过 CLI 创建闪卡
|
|
78
80
|
|
|
79
81
|
### 使用 edit_tree 新增行
|
|
80
82
|
|
|
81
|
-
|
|
83
|
+
通过箭头创建(**禁止在文本中插入 \\\`::\\\`、\\\`;;\\\`、\\\`>>\\\` 等编辑器分隔符**):
|
|
82
84
|
|
|
83
85
|
| 要创建的闪卡类型 | edit_tree 新增行格式 | 额外步骤 |
|
|
84
86
|
|:-----------------|:--------------------|:---------|
|
|
@@ -90,7 +92,7 @@ RemNote 推荐的知识结构化方法:
|
|
|
90
92
|
| 多行正向 | \\\`问题 ↓\\\`(子行为答案) | — |
|
|
91
93
|
| 多行双向 | \\\`问题 ↕\\\`(子行为答案) | — |
|
|
92
94
|
|
|
93
|
-
### 使用 edit_rem
|
|
95
|
+
### 使用 edit_rem 修改现有 Rem 的闪卡行为
|
|
94
96
|
|
|
95
97
|
修改闪卡行为的相关字段:
|
|
96
98
|
|
|
@@ -104,7 +106,7 @@ RemNote 推荐的知识结构化方法:
|
|
|
104
106
|
|
|
105
107
|
---
|
|
106
108
|
|
|
107
|
-
## 完形填空(Cloze)
|
|
109
|
+
## 6. 完形填空(Cloze)
|
|
108
110
|
|
|
109
111
|
完形填空通过 RichText 中的 \\\`cId\\\` 标记实现:
|
|
110
112
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remnote-bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "RemNote 自动化桥接工具集:CLI + MCP Server + Plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
"remnote-plugin/tailwind.config.js",
|
|
24
24
|
"remnote-plugin/webpack.config.js",
|
|
25
25
|
"remnote-plugin/tsconfig.json",
|
|
26
|
-
"
|
|
27
|
-
"docs/instruction/"
|
|
26
|
+
"skills/"
|
|
28
27
|
],
|
|
29
28
|
"scripts": {
|
|
30
29
|
"build": "tsc",
|
|
@@ -7,21 +7,21 @@ description: "RemNote 知识库操作指南。通过 remnote-bridge 命令行工
|
|
|
7
7
|
|
|
8
8
|
本 skill 指导 AI Agent 通过 remnote-bridge 操作 RemNote 知识库。
|
|
9
9
|
|
|
10
|
-
**详细命令文档**位于 `
|
|
10
|
+
**详细命令文档**位于 `instructions/` 目录下,执行具体命令前务必先读取对应文件:
|
|
11
11
|
|
|
12
12
|
| 命令 | 文档路径 |
|
|
13
13
|
|:-----|:---------|
|
|
14
|
-
| connect | `
|
|
15
|
-
| disconnect | `
|
|
16
|
-
| health | `
|
|
17
|
-
| read-rem | `
|
|
18
|
-
| edit-rem | `
|
|
19
|
-
| read-tree | `
|
|
20
|
-
| edit-tree | `
|
|
21
|
-
| read-globe | `
|
|
22
|
-
| read-context | `
|
|
23
|
-
| search | `
|
|
24
|
-
| 全局概览 | `
|
|
14
|
+
| connect | `instructions/connect.md` |
|
|
15
|
+
| disconnect | `instructions/disconnect.md` |
|
|
16
|
+
| health | `instructions/health.md` |
|
|
17
|
+
| read-rem | `instructions/read-rem.md` |
|
|
18
|
+
| edit-rem | `instructions/edit-rem.md` |
|
|
19
|
+
| read-tree | `instructions/read-tree.md` |
|
|
20
|
+
| edit-tree | `instructions/edit-tree.md` |
|
|
21
|
+
| read-globe | `instructions/read-globe.md` |
|
|
22
|
+
| read-context | `instructions/read-context.md` |
|
|
23
|
+
| search | `instructions/search.md` |
|
|
24
|
+
| 全局概览 | `instructions/overall.md` |
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
@@ -42,7 +42,7 @@ RemNote 中所有内容的基本单元都是 **Rem**。文档、文件夹、闪
|
|
|
42
42
|
|
|
43
43
|
两个独立维度:
|
|
44
44
|
|
|
45
|
-
- **type**(闪卡语义):`concept
|
|
45
|
+
- **type**(闪卡语义):`concept`(加粗)、`descriptor`(斜体)、`default`(普通)、`portal`(只读)
|
|
46
46
|
- **isDocument**(页面语义):与 type 完全独立
|
|
47
47
|
|
|
48
48
|
### CDF 框架(Concept-Descriptor Framework)
|
|
@@ -55,19 +55,30 @@ RemNote 推荐的知识结构化方法:
|
|
|
55
55
|
损失函数 ;; 均方误差 (MSE) ← Descriptor
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
###
|
|
58
|
+
### 闪卡的 CLI 操作方式
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
|
65
|
-
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
60
|
+
闪卡由 `type`、`backText`、`practiceDirection` 三个字段控制。通过 CLI 操作闪卡,修改的是这些**字段**。
|
|
61
|
+
|
|
62
|
+
**禁止**:在文本中插入分隔符(`::`、`;;`、`>>`、`<<` 等)来创建闪卡。分隔符是 RemNote 编辑器的输入语法,CLI 无法识别。
|
|
63
|
+
|
|
64
|
+
| 闪卡操作 | CLI 方法 |
|
|
65
|
+
|:---------|:---------|
|
|
66
|
+
| 创建概念定义 | `edit-tree` 新增行 `概念 ↔ 定义`,再 `edit-rem` 设 `type: "concept"` |
|
|
67
|
+
| 创建正向问答 | `edit-tree` 新增行 `问题 → 答案` |
|
|
68
|
+
| 创建多行答案 | `edit-tree` 新增行 `问题 ↓`(子行自动成为答案) |
|
|
69
|
+
| 改变闪卡类型 | `edit-rem` 修改 `type`、`backText`、`practiceDirection` |
|
|
70
|
+
|
|
71
|
+
### 理解用户意图:分隔符映射
|
|
72
|
+
|
|
73
|
+
用户在 RemNote 编辑器中通过分隔符创建闪卡。当用户提到这些分隔符时,理解其意图并映射到上述 CLI 操作:
|
|
74
|
+
|
|
75
|
+
| 用户说 / 编辑器分隔符 | 对应 type | 对应 practiceDirection |
|
|
76
|
+
|:----------------------|:----------|:----------------------|
|
|
77
|
+
| `::` | concept | both |
|
|
78
|
+
| `;;` | descriptor | forward |
|
|
79
|
+
| `>>` / `<<` / `<>` | default | forward / backward / both |
|
|
80
|
+
| `>>>` / `::>` / `;;>` | default / concept / descriptor | 多行(子 Rem 为答案) |
|
|
81
|
+
| `{{}}` | default | forward(完形填空) |
|
|
71
82
|
|
|
72
83
|
### 三种链接机制
|
|
73
84
|
|
|
@@ -141,16 +152,35 @@ Rem 的属性(文本、类型、格式、标签) → edit-rem (前置
|
|
|
141
152
|
|
|
142
153
|
## 3. 标准工作流
|
|
143
154
|
|
|
155
|
+
### ⚠️ connect 后需要用户配合(重要)
|
|
156
|
+
|
|
157
|
+
`connect` 成功只意味着 daemon 和 webpack-dev-server 已启动,**Plugin 并未自动连接**。用户必须在 RemNote 中完成操作,Plugin 才能连接到 daemon:
|
|
158
|
+
|
|
159
|
+
**首次使用**(RemNote 从未加载过此插件):
|
|
160
|
+
1. 打开 RemNote 桌面端或网页端
|
|
161
|
+
2. 点击左侧边栏底部的插件图标(拼图形状)
|
|
162
|
+
3. 点击「开发你的插件」(Develop Your Plugin)
|
|
163
|
+
4. 在输入框中填入 `http://localhost:8080`(即 connect 输出的 webpack-dev-server 地址)
|
|
164
|
+
5. 等待插件加载完成
|
|
165
|
+
|
|
166
|
+
**非首次使用**(之前已加载过此插件):
|
|
167
|
+
- 只需**刷新 RemNote 页面**即可(浏览器 F5 或 Cmd+R),插件会自动重新连接
|
|
168
|
+
|
|
169
|
+
**你必须**:执行 `connect` 后,**立即告知用户需要完成上述操作**,不要直接调用业务命令。引导用户完成后,用 `health` 确认三层就绪再继续。
|
|
170
|
+
|
|
171
|
+
### 完整流程
|
|
172
|
+
|
|
144
173
|
```
|
|
145
174
|
1. connect -- 启动会话(幂等,重复调用安全)
|
|
146
|
-
2.
|
|
147
|
-
3.
|
|
175
|
+
2. ⚠️ 引导用户在 RemNote 中加载插件(首次填端口,非首次刷新页面)
|
|
176
|
+
3. health -- 确认三层就绪:daemon → Plugin → SDK(链式依赖)
|
|
177
|
+
4. read-globe -- 了解知识库结构(首次探索)
|
|
148
178
|
或 read-context -- 了解用户当前上下文
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
179
|
+
5. search "关键词" -- 定位目标 Rem(结果不进缓存!)
|
|
180
|
+
6. read-tree <id> -- 展开子树 → 写入缓存(edit-tree 的前置)
|
|
181
|
+
7. read-rem <id> -- 读取属性 → 写入缓存(edit-rem 的前置)
|
|
182
|
+
8. edit-rem / edit-tree -- 执行修改
|
|
183
|
+
9. disconnect -- 结束会话(缓存全部清空,幂等)
|
|
154
184
|
```
|
|
155
185
|
|
|
156
186
|
**超时**:daemon 默认 30 分钟无 CLI 交互自动关闭,每次请求重置计时器。长时间操作间可用 health 保活。
|
|
@@ -299,12 +329,12 @@ read-tree / read-globe / read-context 输出 Markdown 大纲,edit-tree 基于
|
|
|
299
329
|
|
|
300
330
|
### 新增行格式
|
|
301
331
|
|
|
302
|
-
新增行可用 Markdown
|
|
332
|
+
新增行可用 Markdown 前缀和箭头:
|
|
303
333
|
|
|
304
334
|
```markdown
|
|
305
335
|
# 新标题
|
|
306
336
|
新闪卡 → 答案
|
|
307
|
-
|
|
337
|
+
问题 ↔ 回答
|
|
308
338
|
- [ ] 新待办
|
|
309
339
|
`代码块`
|
|
310
340
|
```
|
|
@@ -18,6 +18,30 @@ daemon 启动后脱离父进程(detached),CLI 进程退出但 daemon 继
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
+
## ⚠️ connect 后需要用户配合
|
|
22
|
+
|
|
23
|
+
`connect` 成功只意味着 daemon 和 webpack-dev-server 已启动,**Plugin 并未自动连接**。用户必须在 RemNote 中完成以下操作:
|
|
24
|
+
|
|
25
|
+
### 首次使用(RemNote 从未加载过此插件)
|
|
26
|
+
|
|
27
|
+
1. 打开 RemNote 桌面端或网页端
|
|
28
|
+
2. 点击左侧边栏底部的插件图标(拼图形状)
|
|
29
|
+
3. 点击「开发你的插件」(Develop Your Plugin)
|
|
30
|
+
4. 在输入框中填入 `http://localhost:8080`(即 connect 输出的 webpack-dev-server 地址)
|
|
31
|
+
5. 等待插件加载完成
|
|
32
|
+
|
|
33
|
+
### 非首次使用(之前已加载过此插件)
|
|
34
|
+
|
|
35
|
+
只需**刷新 RemNote 页面**即可(浏览器 F5 或 Cmd+R),插件会自动重新连接到已启动的 daemon。
|
|
36
|
+
|
|
37
|
+
### AI Agent 注意事项
|
|
38
|
+
|
|
39
|
+
- 执行 `connect` 后,**必须立即告知用户完成上述操作**
|
|
40
|
+
- **禁止在 connect 后直接调用业务命令**——此时 Plugin 尚未连接,命令会报 "Plugin 未连接" 错误
|
|
41
|
+
- 引导用户完成操作后,用 `health` 确认三层就绪(daemon → Plugin → SDK),再执行业务命令
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
21
45
|
## 用法
|
|
22
46
|
|
|
23
47
|
### 人类模式
|
|
@@ -51,7 +51,7 @@ Agent 的核心任务是将用户的自然语言请求翻译为 CLI 命令。以
|
|
|
51
51
|
| 用户表述 | 操作类型 | CLI 命令 |
|
|
52
52
|
|:---------|:---------|:---------|
|
|
53
53
|
| "改文本"、"改标题"、"改颜色"、"改类型" | 修改 Rem 属性 | `edit-rem` |
|
|
54
|
-
| "创建一个概念定义
|
|
54
|
+
| "创建一个概念定义"、"做个 :: 卡" | 新增行(edit-tree 箭头)+ 改 type(edit-rem) | `edit-tree` + `edit-rem` |
|
|
55
55
|
| "新增一个子节点"、"添加笔记" | 结构操作:新增 | `edit-tree` |
|
|
56
56
|
| "删除这个"、"移除" | 结构操作:删除 | `edit-tree` |
|
|
57
57
|
| "移动到…下面" | 结构操作:移动 | `edit-tree` |
|
|
@@ -66,42 +66,52 @@ Rem 有两个**独立维度**的类型:
|
|
|
66
66
|
|
|
67
67
|
#### type 字段(闪卡语义)
|
|
68
68
|
|
|
69
|
-
| type 值 |
|
|
70
|
-
|
|
71
|
-
| `concept` |
|
|
72
|
-
| `descriptor` |
|
|
73
|
-
| `default` |
|
|
74
|
-
| `portal` |
|
|
69
|
+
| type 值 | 含义 | UI 表现 | CLI 设置方式 |
|
|
70
|
+
|:--------|:-----|:--------|:-------------|
|
|
71
|
+
| `concept` | 概念定义 | 文字**加粗** | `edit-rem` 设 `type: "concept"` |
|
|
72
|
+
| `descriptor` | 描述/属性 | 文字*斜体* | `edit-rem` 设 `type: "descriptor"` |
|
|
73
|
+
| `default` | 普通 Rem | 正常字重 | `edit-rem` 设 `type: "default"` |
|
|
74
|
+
| `portal` | 嵌入引用容器 | 紫色左边框 | **只读**,不可通过 CLI 设置 |
|
|
75
75
|
|
|
76
76
|
#### isDocument 字段(页面语义)
|
|
77
77
|
|
|
78
78
|
`isDocument` 与 `type` 完全独立——一个 `concept` 类型的 Rem 可以同时是 Document。
|
|
79
79
|
|
|
80
|
-
### 2.4
|
|
80
|
+
### 2.4 闪卡的 CLI 操作方式
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
闪卡由 `type`、`backText`、`practiceDirection` 三个字段控制。通过 CLI 操作闪卡,修改的是这些**字段**和大纲**箭头**。
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|:-------|:-----|:---------|:---------|:-----|
|
|
86
|
-
| (无) | `default` | `null` | — | 无闪卡行为 |
|
|
87
|
-
| `::` | `concept` | 后半部分 | `both` | 概念定义(CDF 框架) |
|
|
88
|
-
| `;;` | `descriptor` | 后半部分 | `forward` | 描述属性(CDF 框架) |
|
|
89
|
-
| `>>` | `default` | 后半部分 | `forward` | 正向问答 |
|
|
90
|
-
| `<<` | `default` | 后半部分 | `backward` | 反向问答 |
|
|
91
|
-
| `<>` | `default` | 后半部分 | `both` | 双向问答 |
|
|
92
|
-
| `>>>` | `default` | `null` | `forward` | 多行答案(子 Rem 为答案) |
|
|
93
|
-
| `::>` | `concept` | `null` | `both` | 概念型多行答案 |
|
|
94
|
-
| `;;>` | `descriptor` | `null` | `forward` | 描述型多行答案 |
|
|
95
|
-
| `{{}}` | `default` | `null` | `forward` | 完形填空(Cloze) |
|
|
84
|
+
**禁止**:在文本中插入分隔符(`::`、`;;`、`>>`、`<<` 等)来创建闪卡。分隔符是 RemNote 编辑器的输入语法,CLI 无法识别。
|
|
96
85
|
|
|
97
|
-
|
|
86
|
+
| 闪卡操作 | CLI 方法 |
|
|
87
|
+
|:---------|:---------|
|
|
88
|
+
| 创建概念定义 | `edit-tree` 新增行 `概念 ↔ 定义`,再 `edit-rem` 设 `type: "concept"` |
|
|
89
|
+
| 创建正向问答 | `edit-tree` 新增行 `问题 → 答案` |
|
|
90
|
+
| 创建反向问答 | `edit-tree` 新增行 `问题 ← 答案` |
|
|
91
|
+
| 创建双向问答 | `edit-tree` 新增行 `问题 ↔ 答案` |
|
|
92
|
+
| 创建多行答案 | `edit-tree` 新增行 `问题 ↓`(子行自动成为答案) |
|
|
93
|
+
| 改变闪卡类型/方向 | `edit-rem` 修改 `type`、`backText`、`practiceDirection` |
|
|
98
94
|
|
|
99
|
-
|
|
95
|
+
`practiceDirection` 的取值:`forward`(正向)、`backward`(反向)、`both`(双向)、`none`(不练习)。
|
|
96
|
+
|
|
97
|
+
### 2.5 理解用户意图:编辑器分隔符映射
|
|
98
|
+
|
|
99
|
+
用户在 RemNote 编辑器中通过分隔符创建闪卡。当用户提到这些分隔符时,理解其意图并映射到上述 CLI 操作:
|
|
100
|
+
|
|
101
|
+
| 用户说 / 编辑器分隔符 | 对应 type | 对应 practiceDirection |
|
|
102
|
+
|:----------------------|:----------|:----------------------|
|
|
103
|
+
| `::` | concept | both |
|
|
104
|
+
| `;;` | descriptor | forward |
|
|
105
|
+
| `>>` / `<<` / `<>` | default | forward / backward / both |
|
|
106
|
+
| `>>>` / `::>` / `;;>` | default / concept / descriptor | 多行(子 Rem 为答案) |
|
|
107
|
+
| `{{}}` | default | forward(完形填空) |
|
|
108
|
+
|
|
109
|
+
**CDF(Concept-Descriptor Framework)**:RemNote 推荐的知识结构化方法——`Concept`(type:concept)是需要理解的概念,`Descriptor`(type:descriptor)是概念的属性/描述。在 CLI 大纲中的表现:
|
|
100
110
|
|
|
101
111
|
```
|
|
102
|
-
线性回归
|
|
103
|
-
假设
|
|
104
|
-
损失函数
|
|
112
|
+
线性回归 ↔ 最基本的回归模型 <!--id1 type:concept-->
|
|
113
|
+
假设 → 因变量与自变量呈线性关系 <!--id2 type:descriptor-->
|
|
114
|
+
损失函数 → 均方误差 (MSE) <!--id3 type:descriptor-->
|
|
105
115
|
```
|
|
106
116
|
|
|
107
117
|
### 2.5 三种链接机制
|
|
@@ -170,11 +180,17 @@ RemNote SDK → 知识库
|
|
|
170
180
|
一次**会话(Session)= 守护进程的生命周期**。
|
|
171
181
|
|
|
172
182
|
```
|
|
173
|
-
connect → daemon 启动
|
|
183
|
+
connect → daemon 启动
|
|
184
|
+
↓
|
|
185
|
+
⚠️ 用户在 RemNote 中加载插件(首次填端口,非首次刷新页面)
|
|
186
|
+
↓
|
|
187
|
+
health → 确认三层就绪 → 会话可用
|
|
174
188
|
↕ (业务命令:read-rem, edit-tree, search, ...)
|
|
175
189
|
disconnect → daemon 关闭 → 会话结束,缓存清空
|
|
176
190
|
```
|
|
177
191
|
|
|
192
|
+
> **重要**:`connect` 成功只意味着 daemon 已启动,Plugin 并未自动连接。首次使用需用户在 RemNote「开发你的插件」中填入 `http://localhost:8080`;非首次只需刷新 RemNote 页面。必须引导用户完成此步后再用 `health` 确认就绪。
|
|
193
|
+
|
|
178
194
|
`connect` 启动三个服务:
|
|
179
195
|
|
|
180
196
|
| 服务 | 默认端口 | 用途 |
|
|
@@ -322,18 +338,19 @@ Agent 需要根据用户意图选择正确的读取命令:
|
|
|
322
338
|
|
|
323
339
|
```
|
|
324
340
|
1. connect ← 启动会话
|
|
325
|
-
2.
|
|
326
|
-
3.
|
|
341
|
+
2. ⚠️ 引导用户在 RemNote 中加载插件(首次填端口,非首次刷新页面)
|
|
342
|
+
3. health ← 确认系统就绪(daemon → Plugin → SDK 三层全通过)
|
|
343
|
+
4. read-globe ← 了解知识库结构(首次探索)
|
|
327
344
|
或 read-context ← 了解用户当前上下文
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
345
|
+
5. search "关键词" ← 定位目标 Rem(中文搜索可能需单字策略,详见 search.md)
|
|
346
|
+
6. read-tree <id> ← 展开目标区域的子树
|
|
347
|
+
7. read-rem <id> ← 读取详细属性(编辑前必需)
|
|
348
|
+
8. edit-rem <id> ... ← 修改 Rem 属性
|
|
332
349
|
或 edit-tree <id> ...← 修改树结构
|
|
333
|
-
|
|
350
|
+
9. disconnect ← 结束会话
|
|
334
351
|
```
|
|
335
352
|
|
|
336
|
-
**注意**:步骤
|
|
353
|
+
**注意**:步骤 7 是 `edit-rem` 的强制前置条件,步骤 6 是 `edit-tree` 的强制前置条件。跳过会触发防线 1 错误。步骤 2 是必须的——connect 后不引导用户加载插件就直接调用业务命令,会报"Plugin 未连接"错误。
|
|
337
354
|
|
|
338
355
|
---
|
|
339
356
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|