10cg/aria-plugin/aria-token-telemetry
Claude Code and agent skill by 10cg/aria-plugin
- community
Checking that the SKILL.md file is still in the repository.
Claude Code context/token telemetry 的共享数据层。内部工具, 仅供其他 skills 引用 (aria-context-monitor 消费实时占用; aria-plugin #18 estimator 复用 raw counts)。 提供 relay cache 读取 + transcript JSONL usage 解析 + window 大小 4 档 resolve。
Install
npx vskill@latest install 10cg/aria-plugin/aria-token-telemetrySKILL.md
The same SKILL.md was published earlier as 10cg/aria-plugin/aria-token-telemetry.
aria-token-telemetry
用途
aria-token-telemetry 是一个 internal skill(复用 git-remote-helper US-012 Layer 3 "internal skill 作跨-skill 共享基础设施"先例),不直接被用户触发。它为以下消费方提供标准化的 Claude Code context/token 数据采集:
- aria-context-monitor (user-facing) — 消费实时 context 占用 (used%/remaining%/window)
- aria-plugin #18 ai-native-estimator (future) — 复用 raw token counts (per-turn input/output/cache),独立于 window% (Q2=a)
核心脚本: scripts/token_telemetry.py (stdlib-only Python)。
数据来源 (3 档 fallback)
数据 schema (statusLine stdin) 是通用 Claude Code 特性;relay 抓取依赖 statusLine 配置 + relay marker。
| 档 | 来源 | 何时 | confidence | window_source | |
|---|---|---|---|---|---|
| 1 | .aria/cache/context-window.json (relay cache, fresh) | statusLine 已配 + relay marker + staleness≤阈值 | high (runtime-truth) | runtime | |
| 2 | setup helper 检测无 relay marker → 提示注入 | 未注入 | — (引导) | — | |
| 3 | transcript JSONL 解析 | 无 statusLine / cache 缺失/陈旧/corrupt | estimate | 4 档见下 |
statusLine stdin schema 契约 (TASK-001 BLOCKING gate 固化, 2026-05-29)
证据: 2026-05-29 重新 capture 实测 (aria-plugin-benchmarks/context-monitor/statusline-stdin-sample.json),验证context_window_size真实存在且为 number → gate PASS, 不触发回退条款。Claude Code runtime version2.1.156。
Claude Code runtime 每次渲染 statusLine 时 pipe 一个 JSON 到 statusLine command 的 stdin。冻结契约字段:
relay cache 写入子集 (setup_relay.sh 中 jq 投影): schema_version + model.id + context_window.* + exceeds_200k_tokens + transcript_path + captured_at。不写 cost/rate_limits/session_id (隐私 + 非必要)。
字段级注解与 transcript 字段映射见 references/schema.md。
relay cache schema (.aria/cache/context-window.json)
window 大小 4 档 resolve (transcript fallback 时)
relay cache 命中 → window_source = "runtime" (恒定, 不得标其他值)。
transcript fallback 时按优先级:
| 档 | window_source | 来源 | |
|---|---|---|---|
| 1 | cached_size_reuse | 复用上次 relay cache 见过的 context_window_size (session 内不变) | |
| 2 | config | .aria/config.json context_monitor.window_tokens | |
| 3 | empirical_peak | observed-peak input_tokens 反推最小 fitting tier (snap to {200000,1000000}) | |
| 4 | default | 200000 保守兜底 |
公共接口 (token_telemetry.py)
返回 JSON (供消费方解析):
口径不混用: relay 路径填used_percentage,transcript 路径填used_percentage_proxy—— 两者是不同的量,消费方按source读对应字段。unavailable态两者皆 null。
Python 复用接口 (供消费 skill / #18 直接 import):
错误处理 (graceful degradation, 永不抛异常给消费方)
| 情况 | 行为 | |
|---|---|---|
| relay cache 文件缺失 | → transcript fallback | |
| relay cache JSONDecodeError / OSError | → source=unavailable (不抛), 或 transcript fallback | |
relay cache schema_version 不匹配 | → 忽略 cache, transcript fallback | |
| relay cache staleness > 阈值 (默认 300s) | → transcript fallback, confidence 降级 | |
| transcript 缺失 / 无 usage block | → source=unavailable, used_percentage 与 proxy 皆 null | |
| jq 缺失 (relay 写入侧) | aria-doctor 提示; relay 不工作但 transcript fallback 仍可用 |
相关文档
- references/schema.md — statusLine stdin + relay cache 字段级契约 + transcript 映射
- aria-context-monitor — user-facing 消费方
- git-remote-helper — internal-skill 先例
- Spec:
openspec/changes/aria-context-monitor/proposal.md(#104) - 决策:
.aria/decisions/2026-05-29-context-monitor-architecture.md(DEC-20260529-001)
Skill 版本: 1.0.0 (2026-05-29, #104 Phase B) 类型: internal (user-invocable: false)
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/aria-token-telemetry/SKILL.md
Popularity
- Repository stars
- 1
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/10cg/aria-plugin/aria-token-telemetry)