ima-skill
统一的 IMA OpenAPI 技能,支持笔记管理和知识库操作。 当用户提到知识库、资料库、笔记、备忘录、记事,或者想要上传文件、添加网页到知识库、 搜索知识库内容、搜索/浏览/创建/编辑笔记时,使用此 skill。 即使用户没有明确说"知识库"或"笔记",只要意图涉及文件上传到知识库、网页收藏、 知识搜索、个人文档存取(如"帮我记一下"、"搜一下知识库里有没有XX"),也应触发此 skill。
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/aishaoqing/amiima-skill
Unified IMA OpenAPI skill. Currently supports: notes, knowledge-base.
Setup
Security note: This skill authenticates with the official IMA API (
ima.qq.com) — the same service the user already uses. Credentials are only sent as HTTP headers toima.qq.comand never to any other domain, file, or log.
- 打开 https://ima.qq.com/agent-interface 获取 Client ID 和 API Key
- 存储凭证(二选一):
方式 A — 配置文件(推荐):
mkdir -p ~/.config/ima
echo "your_client_id" > ~/.config/ima/client_id
echo "your_api_key" > ~/.config/ima/api_key
方式 B — 环境变量:
export IMA_OPENAPI_CLIENTID="your_client_id"
export IMA_OPENAPI_APIKEY="your_api_key"
Agent 会按优先级依次尝试:环境变量 → 配置文件。
凭证预检
每次调用 API 前,先确认凭证可用。如果两个值都为空,停止操作并提示用户按 Setup 步骤配置。
# Load user-provisioned IMA credentials (used ONLY for ima.qq.com API authentication)
IMA_CLIENT_ID="${IMA_OPENAPI_CLIENTID:-$(cat ~/.config/ima/client_id 2>/dev/null)}"
IMA_API_KEY="${IMA_OPENAPI_APIKEY:-$(cat ~/.config/ima/api_key 2>/dev/null)}"
if [ -z "$IMA_CLIENT_ID" ] || [ -z "$IMA_API_KEY" ]; then
echo "缺少 IMA 凭证,请按 Setup 步骤配置 Client ID 和 API Key"
exit 1
fi
API 调用模板
所有请求统一为 HTTP POST + JSON Body,仅发往官方 Base URL https://ima.qq.com。
定义辅助函数避免重复 header — 每个模块传入完整路径:
# All requests go ONLY to the official IMA API (ima.qq.com)
ima_api() {
local path="$1" body="$2"
curl -s -X POST "https://ima.qq.com/$path" \
-H "ima-openapi-clientid: $IMA_CLIENT_ID" \
-H "ima-openapi-apikey: $IMA_API_KEY" \
-H "Content-Type: application/json" \
-d "$body"
}
Note: All IMA OpenAPI endpoints currently use HTTP POST. If a future module requires a different method,
ima_api()must be extended to accept a method parameter.
模块决策表
| 用户意图 | 模块 | 读取 |
|---|---|---|
| 搜索笔记、浏览笔记本、获取笔记内容、创建笔记、追加内容 | notes | notes/SKILL.md |
| 上传文件、添加网页链接、搜索知识库、浏览知识库内容、获取知识库信息、获取可添加的知识库列表 | knowledge-base | knowledge-base/SKILL.md |
⚠️ 易混淆场景
以下场景容易误判模块,需特别注意:
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-aishaoqing-ami": {
"enabled": true,
"auto_update": true
}
}
}