ima-copilot
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIMA Copilot
IMA Copilot
One-command installer, troubleshooter, and personalization layer for the official Tencent IMA skill.
官方腾讯IMA skill的一站式命令行安装器、故障排查工具与个性化配置层。
Overview
概述
The official Tencent IMA skill (ima-skill) exposes a powerful OpenAPI for notes and knowledge base operations, but its installation flow is designed for a specific proprietary agent and recent releases have shipped submodule files that fail strict SKILL.md loaders. IMA Copilot solves both problems:
- Installs ima-skill to Claude Code, Codex, and OpenClaw in a single command via the vercel-labs/skills open installer.
- Walks the user through API key setup with a live validation call.
- Detects known upstream issues and — with explicit user consent — fixes them in place, without ever forking, vendoring, or mirroring any part of the upstream package.
- Provides a fan-out search strategy that respects user-configured knowledge base priorities and boosts, with awareness of the 100-result per-KB truncation limit.
官方腾讯IMA skill(ima-skill)提供了用于笔记和知识库操作的强大OpenAPI,但其安装流程是针对特定专有Agent设计的,且近期版本发布的子模块文件无法通过严格的SKILL.md加载器验证。IMA Copilot解决了这两个问题:
- 通过vercel-labs/skills开源安装器,只需一条命令即可将ima-skill安装到Claude Code、Codex和OpenClaw。
- 通过实时验证调用引导用户完成API密钥设置。
- 检测上游已知问题,并在获得用户明确同意后就地修复,无需分叉、托管或镜像上游包的任何部分。
- 提供扇出搜索策略,尊重用户配置的知识库优先级和权重,同时考虑到每个知识库最多返回100条结果的截断限制。
Architectural principles (do not violate)
架构原则(不得违反)
This skill is a wrapper layer around ima-skill. The wrapper contract is non-negotiable:
- Never vendor upstream files. This skill directory does not contain any copy, fork, or excerpt of ima-skill's own content. When ima-skill ships a new release, users get the new release without any interference from this wrapper.
- Repairs happen at runtime, not at ship time. If an upstream bug needs patching, this skill carries the instructions for how to patch, not the patched files. Running a repair is idempotent: rerunning after an upstream update re-detects and re-fixes anything that came back.
- Always ask before touching upstream files. Modifying ,
~/.claude/skills/ima-skill/**, or any other upstream install directory requires explicit user consent via AskUserQuestion. No silent patching.~/.agents/skills/ima-skill/** - Teach rather than hide. When a fix is applied, show the user exactly what changed and where the backup was saved. This is how users learn to maintain their own installs.
本skill是ima-skill的封装层。封装协议不可协商:
- 绝不托管上游文件:本skill目录不包含ima-skill自身内容的任何副本、分叉或摘录。当ima-skill发布新版本时,用户无需本封装层干预即可获取新版本。
- 修复仅在运行时进行,而非发布时:如果上游存在需要修补的bug,本skill仅携带修补的操作说明,而非修补后的文件。运行修复操作具有幂等性:上游更新后重新运行,会重新检测并修复任何复发的问题。
- 修改上游文件前必须征得用户同意:修改、
~/.claude/skills/ima-skill/**或任何其他上游安装目录时,必须通过AskUserQuestion获得用户明确同意。禁止静默修补。~/.agents/skills/ima-skill/** - 授人以渔而非代劳:应用修复时,向用户展示具体的修改内容以及备份文件的保存位置。这能帮助用户学会自行维护安装。
What this skill does
本skill的功能
| Capability | Entry point | Detail |
|---|---|---|
| 1. Install upstream ima-skill to 3 agents | | See |
| 2. Configure API credentials (XDG style) | Inline workflow below | See |
| 3. Diagnose and fix known upstream issues | | See |
| 4. Fan-out search with priority boosting | | See |
| 能力 | 入口 | 详情 |
|---|---|---|
| 1. 将上游ima-skill安装到3个Agent | | 参见 |
| 2. 配置API凭证(XDG规范) | 下方内置工作流 | 参见 |
| 3. 诊断并修复上游已知问题 | | 参见 |
| 4. 带优先级提升的扇出搜索 | | 参见 |
Routing
路由规则
When this skill is triggered, classify the user's intent and jump to the corresponding capability:
| User says something like… | Go to |
|---|---|
| "装 ima"、"install ima-skill"、"把 ima 装一下"、"我想用 ima" | Capability 1 |
| "配 ima 的 key"、"configure ima credentials"、"ima API key" | Capability 2 |
| "ima 报错"、"SKILL.md warning"、"frontmatter 错误"、"ima 加载失败" | Capability 3 |
| "搜 X"、"在 ima 里搜 X"、"跨知识库搜索"、"扇出搜 X" | Capability 4 |
| "帮我从头跑一遍 ima" | 1 → 2 → 3 → 4 in sequence |
When in doubt, start with Capability 3 (diagnose) — it surfaces exactly which capabilities are blocked and in what order.
触发本skill时,先分类用户意图,再跳转到对应功能:
| 用户表述类似… | 跳转至 |
|---|---|
| "装 ima"、"install ima-skill"、"把 ima 装一下"、"我想用 ima" | 能力1 |
| "配 ima 的 key"、"configure ima credentials"、"ima API key" | 能力2 |
| "ima 报错"、"SKILL.md warning"、"frontmatter 错误"、"ima 加载失败" | 能力3 |
| "搜 X"、"在 ima 里搜 X"、"跨知识库搜索"、"扇出搜 X" | 能力4 |
| "帮我从头跑一遍 ima" | 按顺序执行1 → 2 → 3 → 4 |
若不确定用户意图,先从能力3(诊断)开始——它会明确显示哪些能力受阻以及处理顺序。
Capability 1: Install upstream ima-skill
能力1:安装上游ima-skill
The installer downloads the latest official release from , stages it in a temp directory, and hands off to to distribute it across Claude Code, Codex, and OpenClaw.
https://app-dl.ima.qq.com/skills/npx skills add <local-path>To run it:
bash
bash scripts/install_ima_skill.shThe script auto-detects which of the three target agents are installed on the user's machine. For agents that are not present, it skips silently rather than installing anywhere the user hasn't opted in. For agents that are present, it installs globally () in vercel skills' default symlink mode: the first detected agent's directory becomes the canonical copy, and the remaining agents are symlinked to it. This means a repair or an upgrade applied once propagates automatically to every agent — detects this sharing and dedupes its reports so you don't see the same issue multiple times.
-gdiagnose.shFor a version override, detection logic, troubleshooting, and the full file-by-file layout produced by the installer, read .
references/installation_flow.md安装器从下载最新官方版本,暂存到临时目录,然后通过将其分发到Claude Code、Codex和OpenClaw。
https://app-dl.ima.qq.com/skills/npx skills add <local-path>运行方式:
bash
bash scripts/install_ima_skill.sh脚本会自动检测用户机器上已安装的三个目标Agent。对于未安装的Agent,会静默跳过,不会在用户未授权的位置进行安装。对于已安装的Agent,会以全局模式()采用vercel skills的默认符号链接方式安装:第一个检测到的Agent目录成为标准副本,其余Agent则通过符号链接指向该目录。这意味着只需执行一次修复或升级,即可自动同步到所有Agent——会检测这种共享机制并去重报告,避免重复显示同一问题。
-gdiagnose.sh如需版本覆盖、查看检测逻辑、故障排查或了解安装器生成的完整文件布局,请阅读。
references/installation_flow.mdCapability 2: Configure API credentials
能力2:配置API凭证
Credentials are stored in XDG style, decoupled from any agent's skill directory:
- (mode
~/.config/ima/client_id)600 - (mode
~/.config/ima/api_key)600 - (mode
~/.config/ima/)700
Environment variables and act as fall-back overrides — the wrapper reads the environment first, then the config file.
IMA_OPENAPI_CLIENTIDIMA_OPENAPI_APIKEYStep through the setup with the user:
- Open and create a new Client ID and API Key.
https://ima.qq.com/agent-interface - Write both values into the XDG config path (or export the environment variables).
- Make a single liveness call against with
https://ima.qq.com/openapi/wiki/v1/search_knowledge_baseto confirm the credentials are accepted — a{"query": "", "cursor": "", "limit": 1}response means ready.code: 0, msg: success
The full script and the exact request/response schema lives in .
references/api_key_setup.md凭证采用XDG规范存储,与任何Agent的skill目录解耦:
- (权限
~/.config/ima/client_id)600 - (权限
~/.config/ima/api_key)600 - (权限
~/.config/ima/)700
环境变量和可作为 fallback 覆盖配置——封装层会优先读取环境变量,再读取配置文件。
IMA_OPENAPI_CLIENTIDIMA_OPENAPI_APIKEY引导用户完成设置的步骤:
- 打开,创建新的Client ID和API Key。
https://ima.qq.com/agent-interface - 将两个值写入XDG配置路径(或导出为环境变量)。
- 调用接口,传入参数
https://ima.qq.com/openapi/wiki/v1/search_knowledge_base进行一次存活验证——返回{"query": "", "cursor": "", "limit": 1}即表示配置完成。code: 0, msg: success
完整脚本和精确的请求/响应架构可参见。
references/api_key_setup.mdCapability 3: Diagnose and fix known issues
能力3:诊断并修复上游已知问题
This is the reason this skill exists. The upstream package has real bugs that break loading on certain agents, and the fixes are well-understood but need user consent to apply. The diagnose/repair workflow is the core contract of this skill.
这是本skill存在的核心原因。上游包存在会导致部分Agent加载失败的真实bug,修复方案已明确,但需要用户同意才能应用。诊断/修复工作流是本skill的核心协议。
Step 1 — Run the read-only diagnosis
步骤1 — 运行只读诊断
bash
bash scripts/diagnose.shdiagnose.sh✅ upstream ima-skill installed (claude-code)
✅ upstream ima-skill installed (codex)
❌ upstream ima-skill NOT installed (openclaw)
✅ API credentials valid (search_knowledge_base returned 12 KBs)
⚠️ ISSUE-001: notes/SKILL.md missing YAML frontmatter (claude-code)
⚠️ ISSUE-001: knowledge-base/SKILL.md missing YAML frontmatter (claude-code)
⚠️ ISSUE-001: notes/SKILL.md missing YAML frontmatter (codex)
⚠️ ISSUE-001: knowledge-base/SKILL.md missing YAML frontmatter (codex)bash
bash scripts/diagnose.shdiagnose.sh✅ 已安装上游ima-skill (claude-code)
✅ 已安装上游ima-skill (codex)
❌ 未安装上游ima-skill (openclaw)
✅ API凭证有效(search_knowledge_base返回12个知识库)
⚠️ ISSUE-001: notes/SKILL.md缺少YAML前置元数据 (claude-code)
⚠️ ISSUE-001: knowledge-base/SKILL.md缺少YAML前置元数据 (claude-code)
⚠️ ISSUE-001: notes/SKILL.md缺少YAML前置元数据 (codex)
⚠️ ISSUE-001: knowledge-base/SKILL.md缺少YAML前置元数据 (codex)Step 2 — Parse the report and ask the user
步骤2 — 解析报告并询问用户
For each or line, look up the issue in . That file is the source of truth for:
⚠️❌references/known_issues.md- What the issue is (symptom, root cause)
- Which repair strategies exist (,
A,B)skip - The exact shell commands for each strategy
- What files each strategy touches
- Why the upstream maintainer probably hasn't fixed it yet
对于每条或记录,请在中查找对应问题。该文件是以下内容的权威来源:
⚠️❌references/known_issues.md- 问题详情(症状、根本原因)
- 可用修复策略(、
A、跳过)B - 每种策略的精确shell命令
- 每种策略会修改哪些文件
- 上游维护者尚未修复该问题的可能原因
Step 3 — Ask for explicit consent before touching upstream files
步骤3 — 修改上游文件前需获得明确同意
Use AskUserQuestion for every issue that has more than one repair strategy. Frame it plainly — the user may not know what "YAML frontmatter" means. Describe what the bug does to them in user terms ("loader skips two files silently, so note-search and knowledge-base-search don't actually work"), then describe each strategy in terms of the outcome, not the mechanism.
Never offer a single "just fix it" option when multiple strategies exist. The user's pick may legitimately differ based on factors the skill cannot observe — e.g., they might prefer Strategy B (minimal diff) if they plan to manually compare with upstream.
对于存在多种修复策略的每个问题,使用AskUserQuestion询问用户。表述要通俗易懂——用户可能不知道“YAML前置元数据”是什么。用用户能理解的语言描述bug的影响(“加载器会静默跳过两个文件,导致笔记搜索和知识库搜索无法正常工作”),然后用结果而非技术机制来描述每种策略。
当存在多种策略时,绝不能只提供一个“直接修复”选项。用户的选择可能基于skill无法观察到的因素——例如,如果用户计划手动与上游版本对比,可能会偏好策略B(最小化差异)。
Step 4 — Execute the chosen strategy
步骤4 — 执行选定的策略
Every repair command in is written to be:
references/known_issues.md- Idempotent — rerunning after the fix is already applied does nothing harmful and prints a clear "already fixed" message.
- Backed up — the repair copies the original file to before modifying anything, then tells the user the backup location.
/tmp/ima-copilot-backups/<timestamp>/<relative-path> - Reversible — the user can restore from the backup with a single command shown at the end.
cp
references/known_issues.md- 幂等性:修复完成后重新运行不会造成任何有害影响,会打印清晰的“已修复”提示。
- 自动备份:修复前会将原始文件复制到,然后告知用户备份位置。
/tmp/ima-copilot-backups/<timestamp>/<relative-path> - 可回滚:用户只需使用修复结束时显示的单个命令即可从备份恢复。
cp
Step 5 — Re-run diagnose to confirm
步骤5 — 重新运行诊断以确认修复
After the repair, run a second time and show the user the diff. The issue should flip from to . If it does not, stop and surface the raw before/after to the user instead of silently retrying — unexpected failures here usually mean upstream shipped an unforeseen change.
diagnose.sh⚠️✅修复完成后,再次运行并向用户展示差异。问题应从变为。如果未改变,应停止操作并向用户展示修复前后的原始报告,而非静默重试——此处的意外失败通常意味着上游发布了未预料到的变更。
diagnose.sh⚠️✅An important note about upstream updates
关于上游更新的重要说明
Every repair is temporary in the sense that ima-skill upgrades replace everything. This is by design: the skill does not fight upstream for persistent state. When the user upgrades ima-skill via Capability 1, Step 4 of diagnose will again flag the fixed issue, and the user can rerun the repair. This is a feature, not a bug — if upstream eventually fixes the issue, the repair becomes unnecessary and will report ✅ with no prompt.
diagnose.sh每次修复都是临时的,因为ima-skill升级会替换所有文件。这是有意设计的:本skill不会与上游争夺持久状态。当用户通过能力1升级ima-skill时,诊断步骤4会再次标记已修复的问题,用户可重新运行修复。这是一项特性而非bug——如果上游最终修复了该问题,修复操作将不再必要,会报告✅且不会提示用户。
diagnose.shCapability 4: Personalized fan-out search
能力4:个性化扇出搜索
IMA's OpenAPI has three hard constraints that any serious search workflow must account for:
- No cross-knowledge-base endpoint. requires a single
search_knowledgeper call. Cross-KB search is a client-side fan-out, not an API feature.knowledge_base_id - No relevance score in results. items only carry
info_list,media_id,title, andparent_folder_id. Any ranking beyond insertion order must happen on the client.highlight_content - Silent 100-result truncation. returns at most 100 hits per KB with no
search_knowledgeoris_endfield in the response. High-frequency queries are silently capped.next_cursor
scripts/search_fanout.pybash
python3 scripts/search_fanout.py "<query>"The script reads for personalization (priority KBs, skip list, strategy), calls to enumerate KBs, fans out calls in parallel, detects truncation by exact-100 length match, and renders results grouped by KB with priority groups at the top.
~/.config/ima/copilot.jsonsearch_knowledge_basesearch_knowledgeThe personalization file is per-user and private. This skill ships only a template — see . A user with no config file gets a neutral default: fan out all accessible KBs, sort groups by hit count, no boosting.
config-template/copilot.json.exampleFor the full algorithm, truncation handling strategy, rendering format, and a walkthrough of the evidence-based decision to allow a "subset KB skip" (e.g., a curated KB that is a strict subset of a master KB can be safely skipped to reduce duplicate hits), read .
references/search_best_practices.mdIMA的OpenAPI存在三个任何严谨的搜索工作流都必须考虑的硬约束:
- 无跨知识库端点:每次调用需要指定单个
search_knowledge。跨知识库搜索是客户端侧的扇出操作,而非API特性。knowledge_base_id - 结果中无相关性评分:项仅包含
info_list、media_id、title和parent_folder_id。插入顺序之外的任何排序都必须在客户端完成。highlight_content - 静默截断100条结果:每个知识库最多返回100条结果,响应中无
search_knowledge或is_end字段。高频查询会被静默限制。next_cursor
scripts/search_fanout.pybash
python3 scripts/search_fanout.py "<query>"脚本读取获取个性化配置(优先级知识库、跳过列表、策略),调用枚举知识库,并行发起调用,通过结果数量是否恰好为100来检测截断,并按知识库分组渲染结果,优先级分组显示在顶部。
~/.config/ima/copilot.jsonsearch_knowledge_basesearch_knowledge个性化配置文件是每个用户私有的。本skill仅提供模板——参见。无配置文件的用户会使用中立默认设置:扇出所有可访问的知识库,按命中数排序分组,无权重提升。
config-template/copilot.json.example如需了解完整算法、截断处理策略、渲染格式,以及基于证据决定允许“子集知识库跳过”(例如,某个精选知识库是主知识库的严格子集,可安全跳过以减少重复命中)的详细说明,请阅读。
references/search_best_practices.mdWhat this skill refuses to do
本skill绝不执行的操作
- Never vendor upstream content. This directory does not contain and will never contain a copy of ,
ima-skill/SKILL.md,ima-skill/notes/**, or any other upstream file. Anyone adding such files to this skill should be rejected.ima-skill/knowledge-base/** - Never pin an upstream version in SKILL.md. The installer script carries a default version for fallback purposes, but SKILL.md itself is version-agnostic to survive upstream releases without requiring a skill bump.
- Never silently patch upstream files. Every modification path requires an explicit AskUserQuestion and the user's active choice.
- Never hardcode a user's knowledge base names. The and
priority_kbsfields inskip_kbsare 100% user-configured. Example values incopilot.jsonare illustrative only.config-template/copilot.json.example - Never skip the backup step when executing a repair, no matter how trivial the diff.
- 绝不托管上游内容:本目录不包含且永远不会包含、
ima-skill/SKILL.md、ima-skill/notes/**或任何其他上游文件。任何向本skill添加此类文件的行为都应被拒绝。ima-skill/knowledge-base/** - 绝不在SKILL.md中固定上游版本:安装器脚本携带默认版本作为 fallback,但SKILL.md本身与版本无关,以便在不更新skill的情况下兼容上游版本发布。
- 绝不静默修补上游文件:所有修改路径都需要明确的AskUserQuestion和用户的主动选择。
- 绝不硬编码用户的知识库名称:中的
copilot.json和priority_kbs字段完全由用户配置。skip_kbs中的示例值仅作演示用。config-template/copilot.json.example - 执行修复时绝不跳过备份步骤,无论差异多么微小。
File layout
文件布局
ima-copilot/
├── SKILL.md # This file — entry and routing
├── scripts/
│ ├── install_ima_skill.sh # Download → stage → npx skills add to 3 agents
│ ├── diagnose.sh # Read-only health report
│ └── search_fanout.py # Fan-out search with priority grouping
├── references/
│ ├── installation_flow.md # Capability 1 deep dive
│ ├── api_key_setup.md # Capability 2 deep dive
│ ├── known_issues.md # Issue registry — source of truth for repairs
│ └── search_best_practices.md # Capability 4 deep dive
└── config-template/
└── copilot.json.example # Template for ~/.config/ima/copilot.jsonima-copilot/
├── SKILL.md # 本文件——入口与路由
├── scripts/
│ ├── install_ima_skill.sh # 下载 → 暂存 → npx skills add 到3个Agent
│ ├── diagnose.sh # 只读健康报告
│ └── search_fanout.py # 带优先级分组的扇出搜索
├── references/
│ ├── installation_flow.md # 能力1深度解析
│ ├── api_key_setup.md # 能力2深度解析
│ ├── known_issues.md # 问题注册表——修复的权威来源
│ └── search_best_practices.md # 能力4深度解析
└── config-template/
└── copilot.json.example # ~/.config/ima/copilot.json 的模板