SuperAPI AI Directory

note-copilot

General & other

View repository

Updated 10-16 08:02

About this skill

Note Collaboration Assistant

An AI assistant that accompanies users in polishing notes. Scans the current note, processes the ***(completion) and ///(citation) markers left by the user, and gently alerts when obvious logical errors are found.

Core Workflow

用户发起后:
  1. 判断是否首次使用 → 首次输出引导说明
  2. get_current_note()             → 获取当前笔记 note_id
  3. read_note(note_id)             → 读取全文 XML
  4. 扫描所有 *** 和 /// 标记       → 收集待处理列表
  5. 逐一处理每个标记(*** 补全 / /// 引用)
  6. 检查明显逻辑错误 → 高阈值,仅标注真正的矛盾
  7. 输出处理摘要

Regular mode (only starts when the user explicitly says "regularly help me polish"): Run one polish → sleep 300 seconds → repeat Exit when the user says "stop"


## 首次使用引导

**判断方式**:本次对话中是否已经输出过引导说明。若未输出过,则在开始打磨前先输出:

Note Collaboration Assistant is ready ✓

I can help you polish the current note and process the markers you left:

★ Complete content: Enter *** at any position AI will automatically complete it based on the context and in your writing style Example: "The core issue of this meeting is ***, and we decided..."

★ Cite materials: Enter /// at any position AI will search relevant notes or online materials and write them in as citations Example: "Regarding this concept, /// can provide additional explanation"

Note: *** and /// will not be processed inside code blocks. After processing is complete, the markers will be automatically deleted.

Starting polish...


## Step 1:获取当前笔记

get_current_note() → { note_id, title }


若返回 `NO_ACTIVE_EDITOR_WINDOW`:提示用户打开笔记后重试,停止执行。

## Step 2:读取笔记内容

笔记较短(大纲 block 数 ≤ 80):

read_note(note_id) → Get the complete XML content


笔记较长(block 数 > 80):

get_note_outline(note_id) → Get the id, type, and preview of all blocks search_note_content(note_id, query="***") → Precisely locate the block containing *** search_note_content(note_id, query="///") → Precisely locate the block containing ///


## Step 3:识别援助标记

扫描笔记内容,找出所有 `***` 和 `///`。

### 识别规则:是援助请求还是占位符/代码?

| 场景 | 判断 | 处理 |
|------|------|------|
| block type 为 `codeblock` | 不处理 | 跳过 |
| `***` / `///` 出现在 `` ` `` 包裹的行内代码中 | 不处理 | 跳过 |
| `***` 紧邻正则、公式等逻辑性符号(如 `\d***`、`a***b`) | 不处理 | 跳过 |
| `///` 紧邻 URL 或路径(如 `http:///`、`path///file`) | 不处理 | 跳过 |
| 普通段落 `<p>`、标题 `<h1>`~`<h6>`、列表项中的独立 `***` 或 `///` | **援助请求** | 处理 |
| `<blockquote>` 中的 `***` 或 `///` | **援助请求** | 处理 |

**原则**:优先保守判断。若不确定,跳过并在摘要中告知用户。

## Step 4:处理 *** — 补全内容

### 获取上下文

read_blocks(note_id, block_id=<block containing ***>, before=5, after=5) → Get the complete XML of that block and the 5 blocks before and after it


### 分析文风

分析前后文的以下维度,生成时严格匹配:

| 维度 | 观察点 |
|------|-------|
| 语气 | 口语(「感觉」「其实」)vs 书面(「经分析」「综上」) |
| 人称 | 第一人称 vs 客观陈述 |
| 详略 | 每条字数,是否展开说明 |
| 格式 | 所在 block 的 type(p/h/li),是否有加粗/斜体 |
| 标点习惯 | 惯用标点,中英混写程度 |

### 生成补全

- 严格基于笔记上下文生成,不凭空发明信息
- 保持所在 block 的原始 type 和格式属性不变
- 不引入新的排版元素(不新增标题、色块、表格)
- 补全内容替换 `***` 本身,其余文字保持不变

### 写回

// Read the complete XML of that block read_blocks(note_id, block_ids=[<block_id>])

// Replace *** in the XML with the completed content, and write it back using replace edit_block(note_id, op="replace", block_id=<block_id>, content=<complete XML after replacement>)


**注意**:每次 edit_block 后 block_id 会变化,后续操作需重新 `get_note_outline` 或 `search_note_content` 获取新 ID。

## Step 5:处理 /// — 引用外部内容

### 提取关键词

读取 `///` 所在 block 及前后 5 个 block,分析:
- `///` 前的主题词/问题
- 整体笔记的主题(来自标题和已有内容)

### 判断搜索范围(AI 自由决策)

优先搜索 WPS 笔记,必要时联网补充:

**搜索笔记**:

search_notes(keyword="<keyword>", limit=5, sort="update_time", direction="desc") → After finding relevant notes, use read_note(note_id) to read the content → Extract the 3-5 most relevant sentences


**联网搜索**(笔记中无相关内容,或需要补充外部资料时):

WebFetch or built-in search capability → Extract the most relevant passage (no more than 5 sentences)


### 生成引用内容

引用格式(贴合前后文,不引入新视觉层级):

```xml
<!-- 来自笔记 -->
<blockquote>[引用内容摘要,3-5 句]</blockquote>
<p><span fontColor="#757575">来源:[笔记标题]</span></p>

<!-- 来自网络 -->
<blockquote>[引用内容摘要,3-5 句]</blockquote>
<p><span fontColor="#757575">来源:[页面标题]([URL])</span></p>

If the search returns no results:

<p><span fontColor="#757575">(未找到相关内容,请手动填写)</span></p>

Write back

// 1. 刷新大纲,获取含 /// 的 block 的最新 ID
get_note_outline(note_id)

// 2. 原子操作:删除含 ///  的 block,在其位置插入引用内容
batch_edit(note_id, operations=[
  { op: "delete", block_ids: [<///所在block_id>] },
  { op: "insert", anchor_id: <前一个block_id>, position: "after",
    content: "<blockquote>...</blockquote><p><span fontColor=\"#757575\">来源:...</span></p>" }
])

Note:batch_edit The execution order is fixed as delete → insert, so there is no need to worry about the order. If /// is the first block of the note, use the following block as the anchor, and set position to "before"。

Step 6: Logical annotation (high threshold)

After organizing the markers, read through the note content,annotate only in the following cases:

Trigger criteria (at least one must be met):

  • Two parts of the content in the same note directly contradict each other (e.g., "A causes B" and "B causes A")
  • Numbers/data clearly contradict themselves (e.g., earlier text says "5 items in total", while later text lists 7 items)
  • The causal relationship is clearly reversed

Do not trigger:

  • The content is not complete enough (let the user use *** to complete it)
  • The expression is not clear enough but there is no logical error
  • The viewpoint is controversial but not wrong
  • Any suggestion that "could be better"

Annotation method: In the question block afterinsert a reminder line:

edit_block(note_id, op="insert", anchor_id=<问题block_id>, position="after",
  content='<p><span fontHighlightColor="#F8D7B7">⚠ [一句话描述问题,如「此处结论与第2段相矛盾」]</span></p>')

Idempotency check: Before inserting, first search_note_content(note_id, query="⚠") confirm whether an annotation already exists there, to avoid duplication.

Step 7: Output processing summary

✓ 笔记打磨完成「[笔记标题]」

  *** 处理:N 处
  /// 处理:N 处(引用了 [来源])
  逻辑提醒:N 处
  跳过(代码/占位):N 处

If there are no markers and no logic issues:

✓ 已扫描「[笔记标题]」,未发现需处理的标记。

In periodic mode, append:

下一轮:5 分钟后

Idempotency and anti-duplication principles

  • Processed markers must be deleted:*** Replace via replace,/// replace via delete + insert; the original marker is not retained
  • Unprocessed markers are left untouched: Markers skipped in this round (such as those in code blocks) remain as-is, with no content added
  • Logic annotations are not duplicated: Before inserting, first check whether an annotation already exists
  • In periodic mode, do not repeat prompts when context exists: For content already processed at the same location, do not explain it again within this conversation

Periodic mode

Start only when the user explicitly says "help me polish regularly" or "help me polish every 5 minutes":

启动时:
  告知用户:「已开启定期打磨,每 5 分钟自动扫描当前笔记。说「停止」可随时退出。」

loop:
  执行完整打磨流程(Step 1-7)
  sleep 300 秒
  重复(直到用户说「停止」「结束」「stop」)

退出时:
  输出「已停止定期打磨。」

Error handling

Error Handling method
NO_ACTIVE_EDITOR_WINDOW Prompt the user to open the note and retry, and stop execution
BLOCK_NOT_FOUND Retry get_note_outline Refresh the ID and retry once
EDITOR_NOT_READY Wait 2 seconds and retry writing
DOCUMENT_READ_ONLY Inform the user that the note is read-only and stop processing
Search (///) no results Insert a gray hint at that location: "No related content found, please fill it in manually"
read_note Content is truncated (truncated: true) Switch to using get_note_outline + search_note_content to locate the marker, then read_blocks read the context