技能没有运行时钩子,读 SKILL.md 只是模型读一份文档;偏好指令也不能在别人电脑上起进程。要拿到「每个技能被调用多少次」,必须在协调器已有的埋点桩上做一次显式改造。本页给出机制澄清、改造方案、口径边界、实测依据与灰度路径。
Skills have no runtime hook: reading a SKILL.md is just the model reading a document, and a preference rule cannot start a process on someone else's machine. Getting per-skill call counts requires an explicit change to the coordinator's existing telemetry stubs. This page covers the mechanism, the design, the measurement scope, the measured evidence and the rollout path.
以下三条是设计的地基,错了后面全错。
These three are the foundation; if they are wrong, everything downstream is wrong.
协调器已经在员工技能列表里。本次不是「装一个新技能」,而是协调器自身升一个版本(当前 v3.17.4),脚本随包下发,员工无感、无需任何手动操作。是否「下次读即取到新版」需在灰度首日实测确认。
The coordinator is already in employees' skill list. This is not "install a new skill" but a version bump of the coordinator itself (now v3.17.4); scripts ship inside the package, no manual action. Whether the next read picks up the new version must be verified on day 1 of the pilot.
SKILL.md 是给模型看的文档,技能被调用时没有任何入口函数会自动执行。可靠挂载点只有两个:模型按文档指令执行的脚本,或我们发布的可执行入口。协调器恰好两者都有。
A SKILL.md is a document for the model; nothing auto-executes when a skill is invoked. The only reliable mount points are scripts the model runs on instruction or executable entry points we publish. The coordinator has both.
协调器 SKILL.md 明确要求「每次被调用时在开始和结束各调一次埋点桩」,并已有 Step 0 启动埋点、Step 0.5 环境预检、最后一步完成埋点,全部遵循「失败不阻塞」。改造点就是这三处。
The coordinator already mandates "call the telemetry stub at start and end of every invocation", with Step 0 start-telemetry, Step 0.5 env preflight and a final completion stub, all fail-open. Those three spots are the change surface.
员工机不做任何常驻进程,不写飞书,只往本地追加一行;上传由后台一次性进程完成。
No daemon on employee machines, no Feishu writes: append one line locally, upload via a one-shot background process.
~/.cgl/telemetry/POST /ingestaigov.db → 站点site| 字段Field | 示例Example | 用途Purpose |
|---|---|---|
skill | cgl-jd-writer | 技能维度(按技能名聚合,不按 skillID)skill dimension (aggregate by name, not skillID) |
version | v2.4.1 | 区分版本,解释口径漂移version attribution |
user / host | johnson.xue / Studio | 人维度与机器维度person and machine dimension |
ts / dur_ms | 1764940000 / 4820 | 时间与耗时time and duration |
status / kind | ok / start·end | 成功失败、开始或结束outcome, start vs end |
不采 对话内容、提示词、候选人信息、token 明细、文件内容。事件体固定 198 字节。
Never conversation content, prompts, candidate data, token detail, file contents. A record is a fixed 198 bytes.
macOS 自带 bash 与 curl,Windows 10+ 自带 PowerShell 与 curl.exe。热路径(追加一行)不需要 Python,也就不存在「员工机没装 Python 导致埋点全废」的风险。Python 版 client.py 保留为我们自己机器的参考实现与采集器。
macOS ships bash and curl; Windows 10+ ships PowerShell and curl.exe. The hot path (append one line) needs no Python, removing the "employee machine has no Python so telemetry is dead" risk. The Python client.py stays as the reference implementation and collector on our own machines.
游标只在 200 后推进、批 ID 由首条事件派生、坏行跳过、末尾半行丢弃、超 5 MB 只保留未确认行、必须带 user-agent(默认 urllib 会被 Cloudflare 静默 403)。这些都在 Python 版实测过,shell 版需按同一套用例复验。
Cursor advances only after a 200, batch ID derived from the first event, skip bad lines, drop a trailing partial line, keep only unacked rows past 5 MB, and a custom user-agent (default urllib is silently 403'd by Cloudflare). All validated on the Python version; the shell version must re-run the same suite.
kind=start(技能名 = 协调器,附带本次选定的技能链)。纯本地写文件,0.05ms。kind=start record (skill = coordinator, with the selected chain). Pure local write, 0.05 ms.kind=plan,代表「本次任务计划调用」。kind=plan per skill — "planned to be invoked in this task".kind=end(status / dur_ms),随后起一个脱离会话的后台进程批量上传。调用方只花 7.4ms,业务不被阻塞;失败不重试、不报错、不影响交付。kind=end (status / dur_ms), then spawn a detached one-shot process to upload in batches. The caller spends 7.4 ms; the task is never blocked; failures are not retried inline and never surface as errors.先说清楚边界,避免以后拿它当全量用。
State the boundary up front so it is never mistaken for a full count.
| 能回答Answers | 不能回答Does not answer |
|---|---|
| CGL 任务里经协调器路由的技能:被计划调用次数、成功率、耗时、按人/按天分布Skills routed by the coordinator in CGL tasks: planned invocations, success rate, duration, per-user and per-day distribution | 不经协调器直接调用的技能(员工手动点名、非 CGL 任务)Skills invoked outside the coordinator (manual mention, non-CGL tasks) |
| 技能版本与人/机器的对应关系,可解释口径漂移Skill version vs user/machine, explaining caliber drift | 平台内置技能、商店技能的真实调用(不在我们的包里)Real calls of platform built-in or store skills (not in our packages) |
| 与平台侧数据交叉验证的合理性检验A sanity cross-check against platform-side data | 每次调用消耗多少点数——平台侧不提供技能维度,这是硬缺口Points consumed per call — the platform exposes no skill dimension; a hard gap |
平台侧只给到「技能 → 装配伙伴 → 伙伴累计消耗」这个上限(971 伙伴 / 3,843,763.16 点 / 1,990 个被装配 skillID)。端侧给的是下限 + 计划口径。两者不能直接相减,但可以互相校验量级。
The platform only yields a ceiling: skill → assembled agent → agent cumulative spend (971 agents / 3,843,763.16 points / 1,990 assembled skillIDs). The client side gives a floor plus a planned-caliber count. They cannot be subtracted, but they can sanity-check each other.
1,990 个被装配 skillID 归因为:控制台自有 243 / 商店技能 220 / 不在册多伙伴共用 35 / 伙伴克隆私有副本 1,492 / 企业库内置 0。差异来自通道差异而非版本升级,任何按 skillID 的统计都会失真。
The 1,990 assembled skillIDs break down as: console-owned 243 / store skills 220 / unregistered shared 35 / agent-cloned private copies 1,492 / enterprise built-in 0. The difference is a channel difference, not version upgrades; any skillID-based count is distorted.
2026-12-04 在本机完成,范围仅限通道本身:未改动任何技能、未安装任何东西、未影响任何顾问电脑。
Done 2026-12-04 on our own machine, channel only: no skill touched, nothing installed, no consultant machine affected.
| 测试Test | 结果Result |
|---|---|
| 写入开销Write cost | 1000 次 mean 0.05ms / p95 0.072ms;198 B/条1000 writes, mean 0.05 ms / p95 0.072 ms; 198 B per record |
| 正常上传Normal upload | 200 条 → 4 批,accepted 200 / dup 0 / 0 错误;批往返 mean 4.3s200 records → 4 batches, accepted 200 / dup 0 / 0 errors; mean round trip 4.3 s |
| 断网补传Offline backfill | 断网时游标不推进、pending 100;恢复后 100 条全补齐,无丢失Cursor held, 100 pending; all 100 backfilled after recovery, no loss |
| 幂等Idempotency | 回滚重放 50 条 → dup 50,服务端计数零增长Replay 50 → dup 50, server count unchanged |
| 超时上界Timeout bound | 服务端睡 2s、客户端超时 200ms → 203ms 返回,游标未推进Server sleeps 2 s, client timeout 200 ms → returns in 203 ms, cursor held |
| 非阻塞Non-blocking | 50 条 + 起后台进程,调用方 7.4ms;后台 4.7s 排空,全部落库50 records + spawn: caller 7.4 ms; background drains in 4.7 s, all landed |
| 并发突发Burst | 并发 20 发 80 次(折合 409 次/分钟)→ 80/80 全 200,0 个 50020 concurrent, 80 requests (≈409/min) → 80/80 HTTP 200, zero 500s |
| 总量核对Total reconciliation | 写入累计 1060+31+80 = 1171,服务端读到 1171(281 批,missing 0 / read_errors 0)Written 1060+31+80 = 1171, server read 1171 (281 batches, missing 0 / read_errors 0) |
按 100 人 × 200 条/天估算:20,000 条/天 ≈ 3.96 MB/天 ≈ 1.2 GB/年;按 50 条一批上传约 400 次写入/天 ≈ 12,000 次/月,落在 R2 免费额度内,Worker 请求量同样在免费额度内。实际成本可视为零。
At 100 people × 200 records/day: 20,000 records ≈ 3.96 MB/day ≈ 1.2 GB/year; at 50 per batch that is ~400 writes/day ≈ 12,000/month, inside the R2 free tier, as is Worker request volume. Effectively zero cost.
| 风险Risk | 对策Mitigation |
|---|---|
| Windows 员工机行为差异Windows behaviour differs | 埋点桩提供 .ps1 版本;任何一步失败输出 EMBED_SKIP 后继续业务,绝不阻塞(沿用协调器既有哲学)Ship a .ps1 stub; any failure prints EMBED_SKIP and continues, never blocking (same philosophy as the coordinator today) |
| 共享 key 明文在员工机Shared key in plaintext on employee machines | 爆炸半径仅限往 bucket 写垃圾数据(无读权限)。灰度期加「每 IP 每日批次数上限 + 异常技能名告警」;正式期可换按人发放的 keyBlast radius is limited to junk writes (no read access). During the pilot add a per-IP daily batch cap and alerts on unknown skill names; later move to per-user keys |
| 员工对被采集的疑虑Employee concerns about being measured | 员工可感知层面留说明:采什么、不采什么、用途、保留期;提供一行退出开关(AIGOV_TELEMETRY=off)Disclose at employee-visible level: what is collected, what is not, purpose, retention; provide a one-line opt-out (AIGOV_TELEMETRY=off) |
| 限流不严格Rate limiting is approximate | 原生绑定按 isolate 近似计数,409 次/分钟未触发 429。要严格需 Durable Object 计数器或 zone 级 WAF 速率规则The native binding counts per isolate; 409 req/min did not trigger 429. Strict enforcement needs a Durable Object counter or a zone-level WAF rule |
| 读路径偶发少算(根因未归因)Occasional undercount on read (root cause open) | 每天用 ?detail=1 明细模式交叉校验汇总数,不一致即以明细为准Reconcile daily with ?detail=1; detail wins on mismatch |
| 两套埋点并行拖慢Two telemetry paths slow things down | 灰度期并行仅用于对比,阶段 2 验收后立即关掉飞书 Base 写入Parallel run only for comparison; switch off Feishu Base writes right after the stage 2 gate |
三层,随时可停:①员工机设 AIGOV_TELEMETRY=off 或删掉 ~/.cgl/telemetry/;②协调器回退到上一版本;③Worker 侧摘掉 /ingest 路由。任一层都不影响业务执行。
Three layers, stoppable at any time: ① set AIGOV_TELEMETRY=off or delete ~/.cgl/telemetry/ on the machine; ② roll the coordinator back one version; ③ remove the /ingest route from the Worker. None of them affects task execution.
每项都给了默认建议;你不反对我就按默认走。
Each has a default recommendation; I will proceed with the default unless you object.