Skip to main content

agent-observability

Add or maintain CodeBuddy hook observability for projects that need local metrics for tool latency, transcript token usage, session cost, and multi-agent trace attribution. Use when wiring hook-based telemetry, debugging missing usage events, and validating AgentLens state.

来源信息

仓库
Tencent/LoopForge
最近来源活动
2026年9月17日 11:51
检测到的 SKILL.md 语言
英语
星标
48
分支
14

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
34 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
agent-observability
description
Add or maintain CodeBuddy hook observability for projects that need local metrics for tool latency, transcript token usage, session cost, and multi-agent trace attribution. Use when wiring hook-based telemetry, debugging missing usage events, and validating AgentLens state.
## Workflow 1. Merge `templates/settings-hook.json` into the user or project `settings.json`. 2. Keep hook entries command-only and keep timeouts around 5 to 10 seconds. 3. Run a normal CodeBuddy session and inspect `logs/metrics.ndjson`. 4. Inspect `logs/.state.json` when usage replay, offsets, or AgentLens turn state look wrong. 5. Keep the runtime generic and verify output from `metrics.ndjson` and `.state.json`. ## Read Next - Read `references/quickstart.md` for setup and smoke-test steps. - Read `references/schema-v2.md` when you need field definitions or sidecar state shape. ## Key Files - `scripts/main.py`: hook entrypoint for `session-start`, `user-prompt-submit`, `pre`, `post`, and `stop` - `scripts/run_hook.sh`: stable shell wrapper for CodeBuddy hook commands - `scripts/core/collector.py`: transcript parsing, pre/post pairing, and session usage recording - `scripts/core/agentlens.py`: AgentLens trace emission and agent or step grouping - `scripts/core/state.py`: persisted hook state, offsets, and AgentLens sidecar state - `scripts/core/devflow.py`: optional devflow-awareness — detects a `multi-agents-devflow-*` team, reads `workflow-state.json`, and emits `stage_transition` events. No-ops entirely on non-devflow projects. - `templates/settings-hook.json`: hook wiring template ## Output Contract - Always emit `event`, `sid`, and `ts`. - Emit `tool` for per-call latency and `usage` for transcript-derived token and cost events. - Emit `stop` for end-of-session flush. - Never block the main hook flow; hook exits must stay `0`.
在 GitHub 查看