← Back to Skills Marketplace
dayofyear

ima skills(中文-精炼版)

by dayofyear · GitHub ↗ · v1.0.2 · MIT-0
cross-platform ✓ Security Clean
561
Downloads
1
Stars
1
Active Installs
3
Versions
Install in OpenClaw
/install ima-skill-ref
Description
统一IMA OpenAPI技能,支持笔记管理和知识库操作。 触发:知识库、资料库、笔记、上传文件、添加网页、搜索内容。
README (SKILL.md)

ima-skill

IMA笔记和知识库管理技能。

所需配置路径

  • ~/.config/ima/client_id (可选,IMA API 客户端 ID)
  • ~/.config/ima/api_key (可选,IMA API 密钥)

网络访问域名

  • ima.qq.com (主要 API 服务)
  • *.myqcloud.com (腾讯云 COS 文件上传服务)

安全说明

详细权限说明请参阅 PERMISSIONS.md,包括:

  • 配置文件访问说明
  • 网络访问域名说明
  • 凭证安全存储建议
  • COS服务安全措施

模块路由

用户意图 模块 脚本
搜索/浏览/读取笔记、追加到笔记 notes notes/scripts/notes-ops.cjs
上传文件、添加网页、搜索/管理知识库 knowledge-base knowledge-base/scripts/kb-ops.cjs

意图判断

用户说的 实际意图 路由
"搜索我的笔记" 搜索笔记 notes → search
"新建一篇笔记" 创建笔记 notes → create
"追加到XX笔记" 追加内容 notes → append
"上传文件到知识库" 上传文件 kb (多步骤)
"添加到知识库" 添加网页/笔记 kb → add-urls/add-note
"搜索知识库内容" 知识库搜索 kb → search

易混淆场景

用户说的 实际意图 路由
"添加到知识库XX的笔记YY" 追加到笔记 notes → append
"把这篇笔记添加到知识库" 关联笔记到知识库 kb → add-note
"帮我记一下" 需确认 notes → 先询问

多语言调用方式

语言/环境 脚本
Node.js scripts/ima-api.cjs
Python scripts/ima-api.py

快速调用

笔记操作

node notes/scripts/notes-ops.cjs search --query "关键词"
node notes/scripts/notes-ops.cjs search --query "关键词" --type content
node notes/scripts/notes-ops.cjs list-folders
node notes/scripts/notes-ops.cjs list-notes --folder-id \x3Cid>
node notes/scripts/notes-ops.cjs read --doc-id \x3Cid>
node notes/scripts/notes-ops.cjs create --content "# 标题\
\
正文"
node notes/scripts/notes-ops.cjs append --doc-id \x3Cid> --content "\
\
补充内容"

知识库操作

node knowledge-base/scripts/kb-ops.cjs list-kbs
node knowledge-base/scripts/kb-ops.cjs list --kb-id \x3Cid>
node knowledge-base/scripts/kb-ops.cjs search --kb-id \x3Cid> --query "关键词"
node knowledge-base/scripts/kb-ops.cjs add-urls --kb-id \x3Cid> --urls "https://..."
node knowledge-base/scripts/kb-ops.cjs add-note --kb-id \x3Cid> --doc-id \x3C笔记ID> --title "标题"

文件上传(完整5步)

node knowledge-base/scripts/preflight-check.cjs --file "/path/report.pdf"
node knowledge-base/scripts/check-repeated-names.cjs --kb-id "kb_xxx" --names "report.pdf:1"
node knowledge-base/scripts/create-media.cjs --kb-id "kb_xxx" --file-name "report.pdf" --file-size 1048576 --content-type "application/pdf" --file-ext "pdf"
node knowledge-base/scripts/cos-upload.cjs --file "/path/report.pdf" ...
node knowledge-base/scripts/add-knowledge.cjs --kb-id "kb_xxx" --media-type 1 --title "报告" --media-id "media_xxx" --cos-key "xxx" --file-size 1048576 --file-name "report.pdf"

凭证配置

获取:https://ima.qq.com/agent-interface

配置(二选一):

# 环境变量
export IMA_OPENAPI_CLIENTID="id"
export IMA_OPENAPI_APIKEY="key"

# 配置文件(自动加载)
mkdir -p ~/.config/ima
echo "id" > ~/.config/ima/client_id
echo "key" > ~/.config/ima/api_key

通用错误码

含义 处理
0 成功
110001 参数非法 检查参数
110010 网络错误 可重试
110011 逻辑错误 不可重试
110021 频控 降低频率
110030 无权限 确认权限

响应字段为 code/msg,不是 retcode/errmsg

通用脚本参数

参数 说明
--json 输出完整JSON响应
--help 显示帮助信息

游标分页

适用于:list、search等接口

  1. 首次:cursor: ""
  2. 检查 is_endfalse=还有更多
  3. next_cursor 继续
  4. is_end=true 停止

实测经验

问题 解决方案
search_note_book空标题报错 query_info.title不可为空
import_urls根目录处理 folder_id省略,不要传kb_id
笔记搜索必须带关键词 query_info至少一个非空字段

脚本列表

scripts/
  ima-api.cjs, ima-api.py

notes/scripts/
  notes-ops.cjs, notes-ops.py

knowledge-base/scripts/
  kb-ops.cjs, kb-ops.py
  preflight-check.cjs, check-repeated-names.cjs
  create-media.cjs, cos-upload.cjs, add-knowledge.cjs

Python接口详细文档

环境准备

# 设置环境变量
export IMA_OPENAPI_CLIENTID="your_client_id"
export IMA_OPENAPI_APIKEY="your_api_key"

# 或创建配置文件
mkdir -p ~/.config/ima
echo "your_client_id" > ~/.config/ima/client_id
echo "your_api_key" > ~/.config/ima/api_key

一、笔记操作接口 (notes-ops.py)

1. search - 搜索笔记

入参:

参数 必需 类型 说明
--query string 搜索关键词
--type string 搜索类型:title(标题) 或 content(内容),默认 title
--start int 起始位置,默认 0
--end int 结束位置,默认 20
--json flag 输出完整JSON响应

出参(JSON结构):

{
  "is_end": true,           // 是否最后一页
  "total_hit_num": "6",     // 总命中数
  "docs": [                 // 笔记列表
    {
      "doc": {
        "basic_info": {
          "docid": "7439576008228970",
          "title": "笔记标题",
          "summary": "笔记摘要",
          "create_time": "1773733141678",
          "modify_time": "1773758324793",
          "status": 0,
          "folder_id": "",
          "folder_name": "",
          "summary_style": {}
        }
      }
    }
  ]
}

示例:

# 搜索标题包含"工作"的笔记
python3 notes/scripts/notes-ops.py search --query "工作"

# 搜索内容包含"会议"的笔记,输出JSON
python3 notes/scripts/notes-ops.py search --query "会议" --type content --json

# 分页搜索
python3 notes/scripts/notes-ops.py search --query "项目" --start 0 --end 10

2. list-folders - 列出文件夹

入参:

参数 必需 类型 说明
--cursor string 分页游标,默认 "0"
--limit int 返回数量,默认 20
--json flag 输出完整JSON响应

出参(JSON结构):

{
  "cursor": "next_cursor",
  "has_more": false,
  "folder_list": [
    {
      "folder_id": "folder_xxx",
      "folder_name": "文件夹名称",
      "create_time": "1773733141678",
      "modify_time": "1773758324793"
    }
  ]
}

3. list-notes - 列出笔记

入参:

参数 必需 类型 说明
--folder-id string 文件夹ID,不指定则列出所有笔记
--cursor string 分页游标,默认 ""
--limit int 返回数量,默认 20
--json flag 输出完整JSON响应

4. read - 读取笔记

入参:

参数 必需 类型 说明
--doc-id string 笔记文档ID
--format int 格式:0=文本(默认),1=HTML
--json flag 输出完整JSON响应

出参(JSON结构):

{
  "doc": {
    "basic_info": {
      "docid": "7439576008228970",
      "title": "笔记标题",
      "summary": "摘要",
      "create_time": "1773733141678",
      "modify_time": "1773758324793"
    },
    "content": "笔记完整内容"
  }
}

5. create - 创建笔记

入参:

参数 必需 类型 说明
--title string 笔记标题
--body string 笔记内容
--folder-id string 目标文件夹ID
--json flag 输出完整JSON响应

6. append - 追加到笔记

入参:

参数 必需 类型 说明
--doc-id string 笔记文档ID
--body string 要追加的内容
--json flag 输出完整JSON响应

二、知识库操作接口 (kb-ops.py)

1. list-kbs - 列出所有知识库

入参:

参数 必需 类型 说明
--query string 搜索关键词
--json flag 输出完整JSON响应

出参(JSON结构):

{
  "info_list": [
    {
      "id": "64VbjCXIm3XittrNBDZxkwI5I4KV9suC5LQYa6wGuDY=",
      "name": "知识库名称",
      "cover_url": "https://ima-media-pub-prod.image.myqcloud.com/..."
    }
  ]
}

2. get-kb - 获取知识库信息

入参:

参数 必需 类型 说明
--kb-id string 知识库ID
--json flag 输出完整JSON响应

3. list - 列出知识库内容

入参:

参数 必需 类型 说明
--kb-id string 知识库ID
--query string 搜索关键词
--cursor string 分页游标,默认 ""
--limit int 返回数量,默认 50
--json flag 输出完整JSON响应

出参(JSON结构):

{
  "is_end": true,
  "next_cursor": "",
  "doc_list": [
    {
      "doc_id": "doc_xxx",
      "title": "文档标题",
      "summary": "文档摘要",
      "create_time": "1773733141678",
      "modify_time": "1773758324793",
      "media_type": "document"
    }
  ]
}

4. search - 搜索知识库

入参:

参数 必需 类型 说明
--kb-id string 知识库ID
--query string 搜索关键词
--cursor string 分页游标,默认 ""
--limit int 返回数量,默认 20
--json flag 输出完整JSON响应

5. create-kb - 创建知识库

入参:

参数 必需 类型 说明
--name string 知识库名称
--desc string 知识库描述
--json flag 输出完整JSON响应

6. delete-kb - 删除知识库

入参:

参数 必需 类型 说明
--kb-id string 知识库ID
--json flag 输出完整JSON响应

7. create-note - 创建知识库笔记

入参:

参数 必需 类型 说明
--kb-id string 知识库ID
--title string 笔记标题
--body string 笔记内容
--json flag 输出完整JSON响应

8. add-urls - 添加网页到知识库

入参:

参数 必需 类型 说明
--kb-id string 知识库ID
--urls string 网页URL,多个用逗号分隔
--json flag 输出完整JSON响应

9. import-urls - 导入网页

入参:

参数 必需 类型 说明
--urls string 网页URL,多个用逗号分隔
--folder-id string 目标文件夹ID,不指定则导入到根目录
--json flag 输出完整JSON响应

三、通用API调用 (ima-api.py)

用法:

python3 scripts/ima-api.py --path \x3CAPI路径> --body \x3CJSON字符串> [--json]

常用API路径:

接口 路径 说明
搜索笔记 openapi/note/v1/search_note_book 搜索笔记
列出知识库 openapi/wiki/v1/search_knowledge_base 获取知识库列表
获取知识库内容 openapi/wiki/v1/search_knowledge 搜索知识库内容

示例:

# 搜索笔记
python3 scripts/ima-api.py --path openapi/note/v1/search_note_book \
  --body '{"search_type":0,"query_info":{"title":"工作"},"start":0,"end":20}'

# 列出知识库
python3 scripts/ima-api.py --path openapi/wiki/v1/search_knowledge_base \
  --body '{"limit":50}'

四、错误码说明

错误码 含义 处理建议
0 成功 -
110001 参数非法 检查参数格式
110010 网络错误 可重试
110011 逻辑错误 检查业务逻辑
110021 频控 降低调用频率
110030 无权限 确认权限设置

五、调用技巧

  1. 环境检查:调用前检查环境变量或配置文件
  2. 参数验证:使用 --help 查看参数格式
  3. 分页处理:大数据量使用游标分页
  4. JSON解析:添加 --json 参数获取完整响应
  5. 错误处理:网络错误可重试,参数错误需检查

六、快速调用示例

笔记操作:

# 搜索笔记
python3 notes/scripts/notes-ops.py search --query "关键词" --json

# 读取笔记
python3 notes/scripts/notes-ops.py read --doc-id "doc_xxx" --json

# 创建笔记
python3 notes/scripts/notes-ops.py create --title "标题" --body "内容"

知识库操作:

# 列出知识库
python3 knowledge-base/scripts/kb-ops.py list-kbs --json

# 搜索知识库
python3 knowledge-base/scripts/kb-ops.py search --kb-id "kb_xxx" --query "关键词" --json

# 创建知识库笔记
python3 knowledge-base/scripts/kb-ops.py create-note --kb-id "kb_xxx" --title "标题" --body "内容"
Usage Guidance
This skill appears to do what it says (manage notes and knowledge bases on ima.qq.com) and only needs your IMA API credentials. Before installing or running it: 1) Only provide IMA_OPENAPI_CLIENTID and IMA_OPENAPI_APIKEY to trusted agents; these are sent to ima.qq.com as intended. 2) Be cautious when using the file-upload flow: create-media.cjs will write COS upload credentials to a temporary file (e.g., /tmp/ima-cos-cred-*.json) for the cos-upload step; on multi-user systems this can expose secrets—prefer passing credentials via secure channel or ensure temp-dir permissions are secure and delete files promptly. 3) Verify the source (homepage and owner) if you need stronger assurance—this bundle includes many scripts, so run them in a sandbox or review the code if you have sensitive data. 4) Rotate credentials if you suspect they were exposed during testing. If you want me to flag exact lines or suggest safer changes (e.g., use OS-level secure storage instead of temp files), I can point them out.
Capability Analysis
Type: OpenClaw Skill Name: ima-skill-ref Version: 1.0.2 The ima-skill bundle provides a legitimate interface for managing notes and knowledge bases via the IMA OpenAPI. It handles authentication through environment variables or local configuration files in `~/.config/ima/` and restricts network communication to authorized domains (`ima.qq.com` and `*.myqcloud.com`). The multi-step file upload process (implemented across scripts like `create-media.cjs`, `cos-upload.cjs`, and `add-knowledge.cjs`) includes security considerations such as temporary credential cleanup and pre-upload validation, with no evidence of malicious intent or data exfiltration.
Capability Assessment
Purpose & Capability
Name/description (IMA OpenAPI note & knowledge-base operations) align with the included scripts and SKILL.md. Required env vars (IMA_OPENAPI_CLIENTID, IMA_OPENAPI_APIKEY) are exactly what the scripts use to authenticate to ima.qq.com. Network hosts enumerated (ima.qq.com and *.myqcloud.com) match the code paths (API requests to ima.qq.com and COS upload to *.myqcloud.com).
Instruction Scope
SKILL.md and the scripts only call the declared IMA API and Tencent COS endpoints and read credentials from the declared config paths or environment variables. However, create-media.cjs writes COS credentials to a temporary file (in /tmp or TMPDIR) for downstream scripts to consume, and cos-upload.cjs supports reading a credential file or command-line secret arguments. Writing sensitive COS credentials to world-readable temporary locations can increase exposure on multi-user systems; the scripts attempt to delete the cred-file after use but deletion/error-handling is best-effort.
Install Mechanism
No install spec; this is instruction-only with bundled scripts. All included code is present in the bundle (no downloads or remote installers), so nothing is fetched from untrusted URLs at install time.
Credentials
The skill only declares two primary env vars (IMA_OPENAPI_CLIENTID, IMA_OPENAPI_APIKEY), which are appropriate. Additional credentials (COS secret_id/secret_key/token) are used only for uploads and are either returned by create-media or accepted as arguments/temporary files. That behaviour is coherent but results in transient handling of extra secrets that the SKILL.md does not list as required env vars—expect the upload flow to require additional credentials and take care with temporary file handling.
Persistence & Privilege
The skill is not always-enabled and does not request elevated or persistent platform-level privileges. It does not modify other skills or global agent configuration beyond writing temporary files for upload flows (its own transient artifacts).
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install ima-skill-ref
  3. After installation, invoke the skill by name or use /ima-skill-ref
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.2
# IMA 笔记管理(腾讯)- 中文精炼版 **技能标识**: `ima-skill-ref` --- ## 📌 本次升级方向 - **精准实现功能**:尽可能减少大模型的幻觉 - **更节省资源**:优化性能和资源使用 --- ## 🔧 实现方式 - 将固定的调用过程封装成脚本 - 在 Markdown 文件中暴露入参和出参,方便 Agent 快速识别 --- ## ✅ 测试情况 - ✅ **Node.js 脚本**:测试完成,效果丝滑,有质的提升 - ✅ **Python 脚本**:测试完成,效果丝滑,有质的提升 - ⚠️ **其他脚本**:未增加可以看官方的说明自行增加 --- ## 🎯 下一步优化计划 ### 业务场景优化 - **输出格式优化**:根据实际输出需求进行调整 - **偏差纠正**:修正真实输出内容与预期的偏差 - **场景适配**:针对具体业务场景进行深度优化 --- *版本 1.0.2 · 持续改进中*
v1.0.1
# IMA 笔记管理(腾讯)- 中文精炼版 **技能标识**: `ima-skill-ref` --- ## 📌 本次升级方向 - **精准实现功能**:尽可能减少大模型的幻觉 - **更节省资源**:优化性能和资源使用 --- ## 🔧 实现方式 - 将固定的调用过程封装成脚本 - 在 Markdown 文件中暴露入参和出参,方便 Agent 快速识别 --- ## ✅ 测试情况 - ✅ **Node.js 脚本**:测试完成,效果丝滑,有质的提升 - ✅ **Python 脚本**:测试完成,效果丝滑,有质的提升 - ⚠️ **其他脚本**:因环境有限未测试,需自行验证。另外,(powershell方式有个脚本因为clawhub平台上传校验规则限制删除了,不确定是否对powershell用户是否有影响) --- ## 🎯 下一步优化计划 ### 业务场景优化 - **输出格式优化**:根据实际输出需求进行调整 - **偏差纠正**:修正真实输出内容与预期的偏差 - **场景适配**:针对具体业务场景进行深度优化 --- *版本 1.0.1 · 持续改进中*
v1.0.0
ima-skills 1.0.0 官方的skill看上去内容太冗余,可读性太差。 优化效果: -- 保留核心信息保留,去掉冗余。技能描述的Token 消耗降低约 69% (按字符估算) - 结构更清晰:凭证→环境检测→路由→常量 - 新增环境检测和多环境调用模板 - 实测经验已融入文档 - 提供统一的IMA OpenAPI技能文档,支持笔记与知识库两大模块的管理与操作。 - 精简并统一API调用模板,分别给出 Bash、Python、Node.js、PowerShell 调用方式和编码细节。 - 提供环境检测建议,明确各平台下HTTP/文件处理方法。 - 总结易混淆场景,简化意图路由表,明确笔记/知识库操作分界。 - 出现的典型错误码、分页方法、响应规范等统一列示,便于快速定位问题。 - 仅notes笔记模块要求文本写入前强制UTF-8转码,知识库文件需保持原样。
Metadata
Slug ima-skill-ref
Version 1.0.2
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 3
Frequently Asked Questions

What is ima skills(中文-精炼版)?

统一IMA OpenAPI技能,支持笔记管理和知识库操作。 触发:知识库、资料库、笔记、上传文件、添加网页、搜索内容。 It is an AI Agent Skill for Claude Code / OpenClaw, with 561 downloads so far.

How do I install ima skills(中文-精炼版)?

Run "/install ima-skill-ref" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is ima skills(中文-精炼版) free?

Yes, ima skills(中文-精炼版) is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does ima skills(中文-精炼版) support?

ima skills(中文-精炼版) is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created ima skills(中文-精炼版)?

It is built and maintained by dayofyear (@dayofyear); the current version is v1.0.2.

💬 Comments