Skip to content
Automation
Skill

/agenttrace-session-audit

Audit local AI coding-agent sessions with agenttrace for cost, tool failures, latency, anomalies, health, diffs, and CI gates.

From plugin
lihongwei-cn
5200 skills1 agent
Install
$ npx -y skills add LiHongwei-cn/lihongwei-cn --skill agenttrace-session-audit --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/agenttrace-session-audit

Context preview

The summary Claude sees to decide when to auto-load this skill.

Audit local AI coding-agent sessions with agenttrace for cost, tool failures, latency, anomalies, health, diffs, and CI gates.

SKILL.md

agenttrace-session-audit.SKILL.md
name: agenttrace-session-audit
description: "Audit local AI coding-agent sessions with agenttrace for cost, tool failures, latency, anomalies, health, diffs, and CI gates."
category: development
risk: safe
source: community
source_repo: luoyuctl/agenttrace
source_type: community
date_added: "2026-05-10"
author: luoyuctl
tags: [ai-coding, observability, cost-tracking, session-analysis]
tools: [claude, cursor, gemini, codex-cli]
license: "MIT"
license_source: "https://github.com/luoyuctl/agenttrace/blob/master/LICENSE"

agenttrace Session Audit

Overview

Use this skill to inspect local AI coding-agent sessions with [agenttrace](https://github.com/luoyuctl/agenttrace). It focuses on the process behind a run: token and cost spikes, tool failures, retry loops, latency gaps, anomalies, health scores, and session-to-session diffs.

agenttrace is local-first and reads session logs from tools such as Claude Code, Codex CLI, Gemini CLI, Aider, Cursor exports, OpenCode, Qwen Code, Kimi, and generic JSON or JSONL traces.

When to Use This Skill

  • Use when a user asks why an AI coding run was slow, expensive, shallow, or unreliable.
  • Use when reviewing local agent logs before retrying a failed or suspicious task.
  • Use when building a lightweight CI health gate for AI-assisted coding sessions.
  • Use when comparing two attempts and looking for changed tool paths, retries, or cost patterns.

How It Works

Step 1: Discover Available Sessions

Prefer an installed `agenttrace` binary when it is available on `PATH`. If the current repository is `luoyuctl/agenttrace`, use `go run ./cmd/agenttrace` instead.

agenttrace --doctor
agenttrace --overview

If no sessions are detected, report the directories checked by `--doctor` and ask for the exported session file or log directory.

Step 2: Produce a Human-Readable Audit

Use Markdown when the user wants a concise report they can inspect or share.

agenttrace --overview -f markdown -o agenttrace-overview.md

In the report, lead with the highest-risk sessions and explain why they matter: critical anomalies, repeated tool failures, token or cost waste, long latency gaps, low health scores, and suspiciously shallow sessions.

Step 3: Inspect One Session or Directory

Use the latest session for a quick check, or pass an explicit export path when the user provides one.

agenttrace --latest
agenttrace --latest -f json
agenttrace path/to/session-or-export.json
agenttrace --overview -d path/to/session-dir

Step 4: Compare Attempts When Semantics Matter

Token and latency metrics can look healthy even when an agent confidently takes the wrong implementation path. When the risk is semantic drift, pair the trace audit with a diff against a previous or known-good attempt.

Look for:

  • changed files or commands that diverge from the intended task
  • missing tests or verification steps compared with the reference attempt
  • repeated edits around the same files without a clear reason
  • lower cost that came from skipping necessary exploration

Step 5: Add Automation Gates

For CI or repeatable team workflows, use JSON output or health thresholds.

agenttrace --overview -f json -o agenttrace-overview.json
agenttrace --overview --fail-under-health 80 --fail-on-critical --max-tool-fail-rate 15

Tune thresholds to the project. A strict gate is useful for critical workflows; a reporting-only command is better while the team is learning its baseline.

Examples

Quick Local Review

agenttrace --overview
agenttrace --latest

Use this after a long coding-agent run to decide whether the next prompt should split the task, avoid a failing tool path, add missing tests, or reset context.

CI Health Check

agenttrace --overview --fail-under-health 80 --fail-on-critical

Use this when agent session logs are available in CI and the team wants a simple guard against critical anomalies or unhealthy runs.

Best Practices

  • Start with `--doctor` when session discovery is uncertain.
  • Report missing fields plainly; do not invent cost, model, latency, or health data.
  • Treat prompts, code, and session contents as private local data.
  • Prefer JSON output for automation and Markdown output for human review.
  • Use trace metrics for process failures and diff/reference review for semantic drift.

Limitations

  • agenttrace can only analyze logs that are present locally or provided as exports.
  • Some agents do not expose enough fields to infer cost, model, cache use, or latency.
  • Healthy trace metrics do not prove the final code is correct; still run tests and review diffs.
  • CI gates should start as advisory until the team understands normal baseline behavior.

Security & Safety Notes

  • Do not upload private session logs to external services unless the user explicitly approves it.
  • Do not overwrite user reports unless they requested that exact output path.
  • Avoid printing secrets found in prompts, tool output, environment variables, or logs.

Common Pitfalls

  • **Problem:** No sessions are found.

**Solution:** Run `agenttrace --doctor`, then point agenttrace at the exported file or log directory.

  • **Problem:** A run looks cheap and fast but produced the wrong refactor.

**Solution:** Compare the session against a prior attempt or known-good diff; cost metrics alone will miss semantic drift.

  • **Problem:** CI fails too often after adding a health gate.

**Solution:** Start with JSON or Markdown reporting, inspect normal baselines, then tighten thresholds gradually.

Related Skills

  • `@langfuse` - Use for production LLM application tracing and evaluation.
  • `@observability-engineer` - Use for broader service monitoring, SLOs, and incident workflows.
Read more
Ships withlihongwei-cn

MUNDO - THE EMPEROR. Complete AI orchestration system with 1208 skills, 25 capability modules, self-evolving, collective consciousness. GitHub Actions 24/7 automation.

Get the whole plugin
Stats
5
Stars
1
Forks
Maintained
Maintenance
Python
Language
MIT
License
1mo ago
Last commit
4mo ago
Created

Repo: LiHongwei-cn/lihongwei-cn

Other skills on lihongwei-cn.

cheat-on-content
Skill

cheat-on-content

给所有想把"感觉"变成可校准预测的内容创作者。**方法论通用**——打分 → 盲预测 → T+3d 复盘 → 进化 rubric 的循环适用任何能被量化(播放 / 阅读 / 收听 / 点击)的内容。**rubric 是循环的内容,不是循环本身**——当前内置一份观点视频 rubric(参考博主 25+…

cheat-bump
Skill

cheat-bump

提议并执行 rubric 或 bucket 升级。两种模式:**完整 rubric bump**(最高风险动作,5 步强制 + 跨模型审核)和 **--bucket-only 轻量重校**(只换 bucket 边界,不动 rubric 公式)。**Phase 2 强制走 cheat-score-blind…

cheat-init
Skill

cheat-init

cheat-on-content 的首次 onboarding 与脚手架创建器。统一流程——所有用户都走相同 5 阶段闭环,唯一区别是"发过视频的人"会在 init 时多一步:抓取已有视频建立历史 context(用于后续 cheat-seed 给更贴合的选题、更准的…

cheat-migrate
Skill

cheat-migrate

把老用户的 .cheat-state.json 升级到当前 schema_version。读 migrations/registry.md 算迁移链,按顺序应用每一步迁移文件。幂等:跑两次结果一样。失败停在中间版本不前进。触发词:"迁移"/"升级 state"/"migrate"/"我的 state…

cheat-persona
Skill

cheat-persona

从复盘评论数据派生 / 刷新账号的受众画像,写入 audience.md。这是和 rubric 平行的第二个派生物——rubric 答"怎么打分",persona 答"谁在看"。cheat-seed 选题 / 写稿时读它。**audience.md 含实绩信号,cheat-score-blind…