方案 · 2026-12-04Proposal · 2026-12-04

员工下次读协调器,不会自动安装技能,也不会自动开始上传

技能没有运行时钩子,读 SKILL.md 只是模型读一份文档;偏好指令也不能在别人电脑上起进程。要拿到「每个技能被调用多少次」,必须在协调器已有的埋点桩上做一次显式改造。本页给出机制澄清、改造方案、口径边界、实测依据与灰度路径。

Reading the coordinator does not install a skill, and does not start uploading

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.

0.05 ms
单次埋点开销(均值)cost per event (mean)
7.4 ms
50 条 + 后台上传的调用方耗时caller cost, 50 events + async flush
198 B
每条事件体积bytes per event
132 天
5 MB 本地缓冲可撑(200 条/天)days of 5 MB buffer at 200/day

01机制:先纠正三个前提Mechanism: three premises corrected

以下三条是设计的地基,错了后面全错。

These three are the foundation; if they are wrong, everything downstream is wrong.

✕读协调器 ≠ 安装技能Reading ≠ installing

协调器已经在员工技能列表里。本次不是「装一个新技能」,而是协调器自身升一个版本(当前 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.

✕没有运行时钩子No runtime hook

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.

✓协调器已有埋点桩Stubs already exist

协调器 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.

为什么非改不可:现有埋点写飞书多维表格,是整条链路最大的瓶颈——全量仅 423 条 / 28 技能 / 81 用户 / 141 天,而平台侧近 30 天任务是 9,121,量级差三四个数量级;token 只有 1/423 条有值,也没有 version 列。新通道把「写飞书」换成「本地追加 + 异步上传」,彻底绕开多维表格。
Why it must change: the current telemetry writes to a Feishu Base, the biggest bottleneck in the chain — only 423 rows / 28 skills / 81 users / 141 days in total, against 9,121 platform-side tasks in the last 30 days, three to four orders of magnitude apart; token is populated in 1 of 423 rows and there is no version column. The new channel replaces "write to Base" with "local append + async upload", bypassing the Base entirely.

02方案:一条零依赖的旁路Design: a zero-dependency side channel

员工机不做任何常驻进程,不写飞书,只往本地追加一行;上传由后台一次性进程完成。

No daemon on employee machines, no Feishu writes: append one line locally, upload via a one-shot background process.

Employee
协调器埋点桩Coordinator stub
shell 追加一行 JSONappend one JSON line
→
Local
~/.cgl/telemetry/
events.ndjson + cursor.jsonevents + cursor
→
Edge
POST /ingest
aigov.jxccwx.comCloudflare Worker
→
Storage
R2(APAC,按批一个对象)R2 (APAC, one object per batch)
幂等 + 读时汇总idempotent, count on read
→
Platform
aigov.db → 站点site
技能 × 人 × 日期skill × user × day

只采元数据,不采内容Metadata only, never content

字段Field示例Example用途Purpose
skillcgl-jd-writer技能维度(按技能名聚合,不按 skillID)skill dimension (aggregate by name, not skillID)
versionv2.4.1区分版本,解释口径漂移version attribution
user / hostjohnson.xue / Studio人维度与机器维度person and machine dimension
ts / dur_ms1764940000 / 4820时间与耗时time and duration
status / kindok / 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.

为什么把埋点桩改成 shell + curlWhy the stub becomes shell + curl

零依赖Zero dependencies

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.

已验证的语义照搬Reuse validated semantics

游标只在 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.

03触发:什么时候上报、没开机怎么办Trigger: when it uploads, and what if the PC is off

  1. Step 0 · 任务开始Step 0 · task start
    协调器被读到时追加一条 kind=start(技能名 = 协调器,附带本次选定的技能链)。纯本地写文件,0.05ms。
    When the coordinator is read, append one kind=start record (skill = coordinator, with the selected chain). Pure local write, 0.05 ms.
  2. 链选定后 · 每个被选中的技能一条After routing · one record per selected skill
    这是「技能维度」的关键:协调器知道它把任务路由给了哪些技能,这里逐个追加 kind=plan,代表「本次任务计划调用」。
    This is where the skill dimension comes from: the coordinator knows which skills it routed to, so append one kind=plan per skill — "planned to be invoked in this task".
  3. 最后一步 · 结果 + 后台上传Final step · outcome + background upload
    追加 kind=end(status / dur_ms),随后起一个脱离会话的后台进程批量上传。调用方只花 7.4ms,业务不被阻塞;失败不重试、不报错、不影响交付。
    Append 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.
  4. 没开机 / 没跑任务 / 断网PC off / no task / offline
    数据留在本地缓冲,游标只在服务端返回 200 后推进。下次跑 CGL 任务时自动补传,5 MB 缓冲在 200 条/天 下可撑 132 天。不丢,但会延迟——这是「不做常驻进程」的必然代价。
    Records stay in the local buffer; the cursor advances only after a 200. The next CGL task backfills them; 5 MB lasts 132 days at 200 records/day. No loss, but latency — the price of not running a daemon.
明确不做:不在员工机装常驻守护进程、不做开机自启、不监控非 CGL 任务、不采内容与 token。如果你要「当天必传」,唯一干净的解法是员工机加一个每天一次的 launchd / 计划任务只跑上传——这属于常驻范畴,需要你单独拍板。
Explicitly not doing: no daemon on employee machines, no autostart, no monitoring of non-CGL work, no content or token capture. If "must upload same day" is a hard requirement, the only clean option is a once-a-day launchd / scheduled task that only uploads — that is daemon territory and needs your separate decision.

04口径:这套数能回答什么、不能回答什么Scope: what these numbers can and cannot answer

先说清楚边界,避免以后拿它当全量用。

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

与平台侧的关系:一上一下Relation to platform data: floor and ceiling

平台侧只给到「技能 → 装配伙伴 → 伙伴累计消耗」这个上限(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.

必须按技能名聚合Aggregate by skill name, always

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.

05实测依据:这条通道已经验过了Evidence: the channel is already validated

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 cost1000 次 mean 0.05ms / p95 0.072ms;198 B/条1000 writes, mean 0.05 ms / p95 0.072 ms; 198 B per record
正常上传Normal upload200 条 → 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-blocking50 条 + 起后台进程,调用方 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)
来源与可复跑入口Sources and how to re-run
aigov/telemetry/VALIDATION.md · validate_run_2026-12-04.txt · validate_result_2026-12-04.json
Worker: aigov (aigov.jxccwx.com) · Version 5db4c000-dc24-4791-a223-04a066f5efb0
Storage: R2 aigov-telemetry-apac (APAC, one object per batch) · endpoint POST /ingest · GET /ingest?date=YYYY-MM-DD[&detail=1]
验证中修掉的坑(改造时必须继承)Bugs fixed during validation (must be inherited)
1. Cloudflare 按 UA 拦截:默认 Python-urllib 被静默 403(1010)→ 必须自带 user-agent
2. R2 区域:WNAM 单次操作 350–450ms,50 条一批要 12s → 换 APAC + 按批存一个对象,降到 879ms
3. 限流状态写在 R2 上是错的:同 IP 并发改写同一对象被 R2 拒绝(10058)→ 40 次并发里 9 个 500,限流失效;改用原生 Rate Limiter 绑定后消失
4. 读路径曾静默少算(同一批对象多次求和 590/535/489/584/518,失败计数却为 0)→ 加 null 重试 + 明细模式;根因未完全归因,正式期建议每天用明细模式交叉校验

成本Cost

按 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.

06灰度:四阶段,每阶段都有验收门Rollout: four stages, each with a gate

  1. 阶段 0 · 本机(已完成)Stage 0 · our machine (done)
    通道端到端验证通过,见上表。
    End-to-end validation passed, see table above.
  2. 阶段 1 · 3–5 名顾问,1 周Stage 1 · 3–5 consultants, 1 week
    协调器发一个灰度版本。验收:①员工机是否取到新版(版本号回传)②emit 失败率 ③上传延迟分布 ④员工是否感知到异常 ⑤Windows 机器是否可用。任一不过就停在阶段 1。
    Ship a pilot coordinator build. Gate: ① do employee machines pick up the new version ② emit failure rate ③ upload latency ④ any user-visible disturbance ⑤ do Windows machines work. Any failure stops the rollout here.
  3. 阶段 2 · 一个团队,2 周Stage 2 · one team, 2 weeks
    与旧飞书 Base 埋点并行跑,做覆盖率与量级对比;确认端侧调用次数与平台侧任务数不存在数量级矛盾。验收后关掉 Base 写入。
    Run in parallel with the old Feishu Base telemetry to compare coverage and magnitude; confirm no order-of-magnitude contradiction with platform task counts. Then switch off Base writes.
  4. 阶段 3 · 全员Stage 3 · everyone
    协调器正式版上架豆包开放平台企业专属技能库;站点新增「技能调用(端侧)」板块并明确标注口径与覆盖边界;每日用明细模式核对总量。
    Publish the coordinator release to the Doubao open platform enterprise skill library; add the "skill calls (client-side)" panel to the site with explicit scope labels; reconcile totals daily in detail mode.

07风险与对策Risks and mitigations

风险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

停用与回滚Kill switch and rollback

三层,随时可停:①员工机设 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.

08需要你拍板的五件事Five decisions for you

每项都给了默认建议;你不反对我就按默认走。

Each has a default recommendation; I will proceed with the default unless you object.

D1是否启动阶段 1 灰度(3–5 人)?这是第一次真正碰到技能本体与员工机。Start the stage 1 pilot (3–5 people)? This is the first time skills and employee machines are touched.建议:启动,但只发灰度版本、不动其他技能Recommend: yes, pilot build only, no other skills touched
D2新埋点与旧飞书 Base 埋点的关系?替换还是并存。Replace or coexist with the old Feishu Base telemetry?建议:灰度期并存对比,阶段 2 后关掉 Base(它是最大瓶颈)Recommend: coexist during the pilot, switch off Base after stage 2
D3是否接受「当天没跑任务就不上传」的延迟?不做常驻进程的必然结果。Accept the latency of "no task today, no upload"? The consequence of no daemon.建议:接受。需要当日必传再单独评估每日一次上传任务Recommend: accept. Revisit only if same-day delivery becomes a hard requirement
D4员工可感知说明的措辞与发布方式?涉及员工行为数据。Wording and channel for the employee-facing disclosure? It concerns employee activity data.建议:随协调器版本说明一起发,只讲清采什么/不采什么/用途/退出方式Recommend: ship with the coordinator release notes; state what is and is not collected, purpose, opt-out
D5共享 key 还是按人发 key?决定分发复杂度与泄露半径。Shared key or per-user keys? Trades distribution complexity against blast radius.建议:灰度期共享 key + 监控;全员前换成按人 keyRecommend: shared key with monitoring during the pilot; per-user keys before full rollout