ima-skills: Reading and Writing Tencent IMA Notes and Knowledge Bases in an Agent

Preface

In knowledge management, a common workflow involves users collecting materials in IMA while conducting conversations in Agents like Cursor or OpenClaw. Because the data on both sides is disconnected, the Agent has to “guess” what you have recorded based solely on the context. If you wish to search the knowledge base, create or append notes, or index local files directly within a conversation, you need a Skill that integrates with the IMA OpenAPI. Below is an introduction to @tencent-adm/ima-skills (currently v1.1.9) from the SkillHub Enterprise Source. It encapsulates note and knowledge base capabilities into executable workflows for Agents and declares compatibility with the OpenClaw ecosystem.

What is this

ima-skills is an enterprise-grade Skill published on SkillHub by the Tencent IMA team (publisher tencent-ima). Its coordinates are @tencent-adm/ima-skills, categorized under knowledge-management. The official description states that it supports reading, writing, and retrieving notes and knowledge bases, facilitating the recording and invocation of IMA content within conversations, specifically designed for Agent environments like OpenClaw.

The SkillHub page marks requires_api_key=true: before use, you must configure the IMA OpenAPI Client ID and API Key. Requests are sent to the official domain https://ima.qq.com. The file upload process also uses temporary credentials returned by IMA to access Tencent Cloud COS (*.myqcloud.com); the credentials themselves are not sent to COS.

Core Features

The unified entry point within the skill package is ima-skill, currently covering two sub-modules (based on the SKILL.md in the installed package):

Notes

API path prefix: openapi/note/v1. Capabilities include:

  • Read: search_note (by title or body), list_notebook, list_note, get_doc_content
  • Write: import_doc (create new note), append_doc (append to existing note, classified as a sensitive operation requiring a clearly defined target note)

The write content format is Markdown (content_format=1); for reading note bodies, plain text is recommended (target_content_format=0). Local image paths cannot be written via the API; they must be filtered out, and the user should be prompted to use web links instead.

Knowledge Base

API path prefix: openapi/wiki/v1. Capabilities include:

  • Search & Browse: search_knowledge, search_knowledge_base, get_knowledge_list, get_knowledge_base, get_media_info
  • Write: Web/WeChat links via import_urls; Files via check_repeated_names → create_media → COS upload → add_knowledge; Associating existing notes via add_knowledge (media_type=11).
  • Selection Assistance: If the target library is unspecified, get_addable_knowledge_base_list can be used to list writable knowledge bases.

Before file upload, there is a type pre-check (preflight-check.cjs). Unsupported videos, Bilibili/YouTube links, file:// paths, etc., should guide the user to use the IMA desktop client.

Routing and Cross-Module

The root SKILL.md provides a “Notes vs. Knowledge Base” decision table: modifying note content goes to notes; uploading files, adding links, or attaching notes to a knowledge base goes to knowledge-base. If you need to search the knowledge base before taking a note, or view the original text of note-type media in the knowledge base, you must read both sub-modules in the documented order before execution.

Runtime dependency: Node.js ≥ 18 (for executing ima_api.cjs and upload-related scripts). The skill includes a version check on the first API call of the day; if credentials are missing or an upgrade is required, the script returns structured error codes (e.g., -100, -200) to stderr.

Installation and Activation

Install SkillHub CLI

If not already installed, you can run:

command -v skillhub && skillhub --version

If not installed, use the official script (CLI only):

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash -s -- --cli-only

Install ima-skills

During installation, you must use --dir to point to the current Agent’s skills directory; otherwise, it defaults to ./skills/ and may not be recognized. The installation method provided by the official page and CLI is:

skillhub install ima-skills --namespace tencent-adm --dir <your skills directory>

Common paths (from SkillHub Installation Docs):

  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • Codex: ~/.codex/skills/ or .agents/skills/ under the project

You can also let the Agent install @tencent-adm/ima-skills by following the instructions at https://skillhub.cn/install/skillhub.md.

Configure IMA OpenAPI Credentials

  1. Obtain Client ID and API Key at https://ima.qq.com/agent-interface.
  2. Choose one of the following storage methods (Agents prioritize environment variables, then config files):

Method A — Config File (Recommended):

mkdir -p ~/.config/ima
echo "your_client_id" > ~/.config/ima/client_id
echo "your_api_key" > ~/.config/ima/api_key

Method B — Environment Variables:

export IMA_OPENAPI_CLIENTID="your_client_id"
export IMA_OPENAPI_APIKEY="your_api_key"

The OpenClaw metadata also declares the above environment variable names. If credentials are missing, calling node ima_api.cjs will exit with code: -100 and explain the reason in stderr.

Typical Usage

The following examples come from the skill package documentation. In actual calls, ima_api needs to be replaced with node ima_api.cjs located in the skill directory, along with credential parameters (see the API call template in the root SKILL.md).

Search and read notes:

# 1. Search by title
ima_api "openapi/note/v1/search_note" '{"search_type": 0, "query_info": {"title": "Meeting Minutes"}, "start": 0, "end": 20}'
# 2. Read body content
ima_api "openapi/note/v1/get_doc_content" '{"note_id": "target_note_id", "target_content_format": 0}'

Create a new note:

ima_api "openapi/note/v1/import_doc" '{"content_format": 1, "content": "# Title\n\nBody content"}'

Search in Knowledge Base:

ima_api "openapi/wiki/v1/search_knowledge" '{"query": "keyword", "knowledge_base_id": "<kb_id>", "cursor": ""}'

Add webpage to Knowledge Base:

ima_api "openapi/wiki/v1/import_urls" '{
  "knowledge_base_id": "<kb_id>",
  "urls": ["https://example.com/article"]
}'

Uploading files to the knowledge base requires a complete process including pre-check, duplicate name check, and COS upload. See knowledge-base/SKILL.md in the package for details.

Trigger intents in conversations include: mentioning knowledge base, notes, memos, “help me note this down,” “search the knowledge base for XX,” uploading files, or bookmarking webpages. For ambiguous expressions (whether to create new or append), the skill requires the Agent to confirm with the user first to avoid mistakenly modifying existing notes.

Use Cases and Notes

Target Audience: Users already using Tencent IMA for personal or team knowledge accumulation who wish to directly operate notes and knowledge bases within Agents that support Skills, such as Cursor or OpenClaw. It can also serve as foundational capability for other Skills (e.g., workflows depending on the ima connector).

Limitations & Pitfalls:

  • You must provide your own IMA OpenAPI key; common authentication failure error codes include 20004 (apikey authentication failed).
  • Note strings must be valid UTF-8 before writing; when sending JSON to the API under PowerShell 5.1, use UTF-8 byte arrays to avoid garbled Chinese characters.
  • The knowledge base side does not provide a “create knowledge base” interface; libraries must be created in the IMA client first. API rate limit exceeded may return 20002.
  • Enterprise Source Skill; installation and updates are subject to SkillHub / skillhub CLI; SkillHub statistics (as of page crawl): Rating 100000, Downloads ~638284, Installs ~11831.

Conclusion

ima-skills consolidates IMA’s note reading/writing and knowledge base retrieval/indexing workflows into a set of OpenAPI-driven Agent Skills, reducing the fragmentation of “users in IMA, Agents outside.” If you want to manage content in your “second brain” directly within conversations, start with the official Skill page and installation guide:

  • SkillHub: https://www.skillhub.cn/skills/tencent-adm/ima-skills
  • Skill API Entry: https://api.skillhub.cn/tencent-adm/ima-skills
  • IMA Homepage: https://ima.qq.com
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye