wecom-cli AGENTS.md

Repository guidance for AI coding agents and contributors working on wecom-cli, a Rust command-line tool for WeCom business services.

In plain words
What is it for?
Use it when changing wecom-cli or its WeCom integrations, especially when you need to find modules, understand generated commands, or update the repository guide.
Why use it?
It explains the project structure, command routing, discovery system, and how to build and test changes without guessing from the code alone.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/wecomteam/wecom-cli/agents-md
Clone the repo
git clone --depth 1 https://github.com/WecomTeam/wecom-cli

Made for: Codex, OpenCode.

Per session 3,651 This file is loaded in full into every session.
When invoked 3,651 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.03651 $0.03651
Opus 5 $0.01826 $0.01826
Sonnet 5 $0.00730 $0.00730
Haiku 4.5 $0.00365 $0.00365

Measured 2d ago against content hash ece3a8bc531f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

wecom-cli AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 141 lines

How it starts

The opening of the file, as written. The whole thing — 141 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

面向 AI Agent 与贡献者的仓库导览:快速定位关键代码、理解核心机制、正确构建与测试。 本文只描述当前实现;改动代码后若结构或机制发生变化,请同步更新本文。

项目概述

wecom-cli 是企业微信官方 CLI(Rust 实现,经 npm 包 @wecom/cli 分发),覆盖消息、邮件、在线文档、智能文档、在线表格、智能表格、待办、日程、会议、微盘、通讯录等办公能力。仓库同时内置 skills/ 下的 Agent Skills,供 AI Agent 调用 CLI 完成业务操作。

CLI 通过 discovery 协议从服务端动态下发服务目录与方法 schema,再在本地构建 clap 命令树。命令模型(按 Client::run 的调度顺序):

wecom-cli --version | --help                       # 版本与帮助
wecom-cli auth <init|show>                         # 扩展命令:bin 侧经 ClientBuilder::command() 挂载
wecom-cli cache <status|clear>                     # 内建命令:discovery 缓存管理(help 中隐藏)
wecom-cli schema <list|get>                        # 内建命令:服务/方法 schema(help 中隐藏)
wecom-cli <service> --doc | --schema               # 服务级文档(service 由 discovery 下发)
wecom-cli <service> [resource...] <method> [flags] # 远程方法调用(方法参数由 schema 生成)
wecom-cli <service> +<helper> [flags]              # 本地 helper(+ 前缀,HelperRegistry 调度)

仓库结构

Cargo workspace(resolver = "3",edition 2024)+ pnpm workspace(仅管理 packages/* 平台二进制包):

路径 说明
crates/wecom/ 核心库(lib):Client/ClientBuilder、argv 调度、discovery 与缓存、schema 驱动命令树、指令处理、输出路由、沙箱 FS
crates/wecom-cli/ 二进制(bin):main.rs 装配入口、auth 鉴权体系、config/env/logging、WecomBackend
crates/wecom-transport/ 传输层:TransportBackend trait、reqwest HTTP 后端、信封 trait、端点目录泛型、长任务轮询
bin/wecom.js npm 入口脚本:定位并 exec 当前平台的二进制
packages/* 各平台 npm 二进制包(optionalDependencies 分发:darwin/linux × x64/arm64、win32-x64)
skills/* 内置 Agent Skills(14 个,导航见 docs/skills.md
docs/ 持续维护的使用与开发文档(入口 docs/README.md

模块职责

crates/wecom(lib)

模块 职责
client/ Client/ClientBuilderbuilder.rs);run.rsCliRun 负责 argv 调度;invoke.rs/upload.rs 程序化调用;custom_command.rs 扩展命令点;catalog.rs 定义 EndpointKey 内建默认与 PayloadStringReq 请求信封
service/ 服务调用链:handler.rs 服务内分发(helper 优先于 method);command/ 由 schema 构建 clap 子命令树(build.rs/schema_clap.rs)并装配请求体(assemble.rs,命名参数 + --json + --set);execute.rs 执行与游标分页;output.rs 输出路由;preview.rs --dry-rundoc.rs --docalias.rs path_alias 隐藏别名;service_handle.rs/method_handle.rs 程序化句柄
registry/ discovery 服务目录、schema 拉取与缓存(<config_dir>/cache,TTL 60 秒)
schema/ schema 类型、解析、TS 文档生成(ts_doc.rs
directive/ x-wecom-* 指令:UploadMedia(媒体上传)、UploadMultipart(表单上传)、Save(响应字段落盘);请求前与响应后各收集处理一次
builtins/ 媒体上传的内建实现(upload_media.rs
helpers/ Helper trait 与 HelperRegistry:以 + 前缀挂载在任意命令路径上的本地命令
fs/ 沙箱文件系统 Fs(按 readable/writable roots 校验)、PathResolver 路径解析、文件名清洗
constants.rs CLI_INFO/CliInfo:编译期注入的版本信息(--version 输出与 X-WeCom-Cli-Info 请求头)
error.rs lib 层统一错误(错误码段 893000–893099);后台 errcode 经 transport 透传
telemetry/ lib 侧 telemetry 事件

Read the full file on GitHub · 141 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 141 lines · 3,651 tokens per session scan A ece3a8bc531f

Subscribe to this mod's changes

wecom-cli AGENTS.md is an instructions file published in the GitHub repository WecomTeam/wecom-cli (2,997 stars, last pushed 7d ago), licensed MIT. It adds 3,651 tokens to every session, about $0.0183 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,182 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

next.js AGENTS.md

Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,345 tokens