$npx -y skills add nexus-research-lab/nexus --skill ima-skill统一的 IMA OpenAPI 技能,支持笔记管理和知识库操作。 当用户提到知识库、资料库、笔记、备忘录、记事,或者想要上传文件、添加网页到知识库、 搜索知识库内容、搜索/浏览/创建/编辑笔记时,使用此 skill。 即使用户没有明确说"知识库"或"笔记",只要意图涉及文件上传到知识库、网页收藏、 知识搜索、个人文档存取(如"帮我记一下"、"搜一下知识库里有没有XX"),也应触发此 skill。
| 1 | # ima-skill |
| 2 | |
| 3 | Unified IMA OpenAPI skill. Currently supports: **notes**, **knowledge-base**. |
| 4 | |
| 5 | ## ⛔ MANDATORY RULES — read before ANY operation |
| 6 | |
| 7 | 1. **UTF-8 encoding (notes writes only):** Before calling `import_doc` or `append_doc`, ALL string fields (`content`, `title`) MUST be validated as legal UTF-8. Non-UTF-8 content causes irreversible garbled text. See [Detailed Rules](#detailed-utf-8-encoding-rules) for platform-specific methods. |
| 8 | 2. **File upload naming:** `title` MUST equal `file_name` (with extension). Never rename, shorten, translate, or modify the original filename. |
| 9 | 3. **Unsupported file types:** Reject immediately with a clear message. Do NOT ask user "do you still want to try?" Video files, Bilibili/YouTube URLs, and `file://` URLs are not supported — tell user to use IMA desktop client. |
| 10 | 4. **File upload integrity:** Keep file content as-is during upload. No encoding conversion for binary files (PDF, images, Excel, etc.). |
| 11 | 5. **PowerShell 5.1 (all modules):** If running in PowerShell, detect version before first API call. PS 5.1 silently converts request Body to GBK — must use UTF-8 byte array mode. See [Detailed Rules](#powershell-51-environment-detection). |
| 12 | |
| 13 | ## 模块决策表 |
| 14 | |
| 15 | | 用户意图 | 模块 | 读取 | |
| 16 | | ------------------------------------------------------------------------------------------ | -------------- | ------------------------- | |
| 17 | | 搜索笔记、浏览笔记本、获取笔记内容、创建笔记、追加内容 | notes | `notes/SKILL.md` | |
| 18 | | 上传文件、添加网页链接、搜索知识库、浏览知识库内容、获取知识库信息、获取可添加的知识库列表 | knowledge-base | `knowledge-base/SKILL.md` | |
| 19 | | 查看原文、分析原文、导出原文(需要 media_id) | knowledge-base | `knowledge-base/SKILL.md` | |
| 20 | |
| 21 | ### ⚠️ 易混淆场景 |
| 22 | |
| 23 | | 用户说的 | 实际意图 | 正确路由 | |
| 24 | | -------------------------------------------------------- | ------------------------ | ----------------------------------------------------------- | |
| 25 | | "把这段内容添加到知识库XX里的笔记YY" | 往已有**笔记**追加内容 | **notes** — 先搜索笔记获取 `note_id`,再用 `append_doc` | |
| 26 | | "把这个写到XX笔记里"、"记到XX笔记" | 往已有**笔记**追加内容 | **notes** — `append_doc` | |
| 27 | | "把这篇笔记添加到知识库" | 将笔记关联到**知识库** | **knowledge-base** — `add_knowledge` with `media_type=11` | |
| 28 | | "上传文件到知识库" | 上传**文件**到知识库 | **knowledge-base** — `create_media` → COS → `add_knowledge` | |
| 29 | | "新建一篇笔记记录这些内容" | **创建**新笔记 | **notes** — `import_doc` | |
| 30 | | "帮我记一下"、"记录一下"、"保存为笔记"(未指定已有笔记) | 意图不明确,**需要确认** | **notes** — 先询问用户是创建新笔记还是追加到哪篇已有笔记 | |
| 31 | | "添加到笔记里"(未指定具体哪篇) | 意图不明确,**需要确认** | **notes** — 先询问用户是创建新笔记还是追加到哪篇已有笔记 | |
| 32 | |
| 33 | ### ⚠️ 跨模块任务 — 必须读取两个子模块 |
| 34 | |
| 35 | 某些意图跨越 notes 和 knowledge-base 两个模块。**不要只读取一个子模块就开始执行**,必须先读取两个模块的 SKILL.md 再按顺序操作。 |
| 36 | |
| 37 | | 用户说的 | 实际流程 | 读取顺序 | |
| 38 | | ------------------------------------ | --------------------------------------------- | ------------------------------------------------------ | |
| 39 | | "把知识库里的XX内容记到笔记" | KB 搜索/读取 → Notes 创建/追加 | 先读 `knowledge-base/SKILL.md` → 再读 `notes/SKILL.md` | |
| 40 | | "查看原文"(知识库中的笔记类型媒体) | KB `get_media_info` → Notes `get_doc_content` | 先读 `knowledge-base/SKILL.md` → 再读 `notes/SKILL.md` | |
| 41 | | "把这篇笔记添加到知识库" | Notes 搜索获取 note_id → KB `add_knowledge` | 先读 `notes/SKILL.md` → 再读 `knowledge-base/SKILL.md` | |
| 42 | |
| 43 | **规则**:如果用户意图同时涉及「笔记」和「知识库」,或者 API 响应揭示需要另一个模块(如 `media_type=11` 表示笔记类型),必须读取两个子模块再继续。 |
| 44 | |
| 45 | **核心判断规则**: |
| 46 | |
| 47 | - 目标是**笔记的内容**(读、写、追加)→ notes 模块 |
| 48 | - 目标是 |