[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-775d7ad4-542e-4557-b0f5-be72b73870fd":3,"$fXZWbr0rF32CGgKMo_xQk1BLkVFtun3mauhxK8x2pZr8":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"775d7ad4-542e-4557-b0f5-be72b73870fd","agenttrace-session-audit","使用agenttrace审计本地AI编码代理会话，包括成本、工具故障、延迟、异常、健康状况、差异和CI门控。","cat_coding_review","mod_coding","sickn33,coding","---\nname: agenttrace-session-audit\ndescription: \"Audit local AI coding-agent sessions with agenttrace for cost, tool failures, latency, anomalies, health, diffs, and CI gates.\"\ncategory: development\nrisk: safe\nsource: community\nsource_repo: luoyuctl\u002Fagenttrace\nsource_type: community\ndate_added: \"2026-05-10\"\nauthor: luoyuctl\ntags: [ai-coding, observability, cost-tracking, session-analysis]\ntools: [claude, cursor, gemini, codex-cli]\nlicense: \"MIT\"\nlicense_source: \"https:\u002F\u002Fgithub.com\u002Fluoyuctl\u002Fagenttrace\u002Fblob\u002Fmaster\u002FLICENSE\"\n---\n\n# agenttrace Session Audit\n\n## Overview\n\nUse this skill to inspect local AI coding-agent sessions with\n[agenttrace](https:\u002F\u002Fgithub.com\u002Fluoyuctl\u002Fagenttrace). It focuses on the process\nbehind a run: token and cost spikes, tool failures, retry loops, latency gaps,\nanomalies, health scores, and session-to-session diffs.\n\nagenttrace is local-first and reads session logs from tools such as Claude Code,\nCodex CLI, Gemini CLI, Aider, Cursor exports, OpenCode, Qwen Code, Kimi, and\ngeneric JSON or JSONL traces.\n\n## When to Use This Skill\n\n- Use when a user asks why an AI coding run was slow, expensive, shallow, or unreliable.\n- Use when reviewing local agent logs before retrying a failed or suspicious task.\n- Use when building a lightweight CI health gate for AI-assisted coding sessions.\n- Use when comparing two attempts and looking for changed tool paths, retries, or cost patterns.\n\n## How It Works\n\n### Step 1: Discover Available Sessions\n\nPrefer an installed `agenttrace` binary when it is available on `PATH`. If the\ncurrent repository is `luoyuctl\u002Fagenttrace`, use `go run .\u002Fcmd\u002Fagenttrace`\ninstead.\n\n```bash\nagenttrace --doctor\nagenttrace --overview\n```\n\nIf no sessions are detected, report the directories checked by `--doctor` and\nask for the exported session file or log directory.\n\n### Step 2: Produce a Human-Readable Audit\n\nUse Markdown when the user wants a concise report they can inspect or share.\n\n```bash\nagenttrace --overview -f markdown -o agenttrace-overview.md\n```\n\nIn the report, lead with the highest-risk sessions and explain why they matter:\ncritical anomalies, repeated tool failures, token or cost waste, long latency\ngaps, low health scores, and suspiciously shallow sessions.\n\n### Step 3: Inspect One Session or Directory\n\nUse the latest session for a quick check, or pass an explicit export path when\nthe user provides one.\n\n```bash\nagenttrace --latest\nagenttrace --latest -f json\nagenttrace path\u002Fto\u002Fsession-or-export.json\nagenttrace --overview -d path\u002Fto\u002Fsession-dir\n```\n\n### Step 4: Compare Attempts When Semantics Matter\n\nToken and latency metrics can look healthy even when an agent confidently takes\nthe wrong implementation path. When the risk is semantic drift, pair the trace\naudit with a diff against a previous or known-good attempt.\n\nLook for:\n\n- changed files or commands that diverge from the intended task\n- missing tests or verification steps compared with the reference attempt\n- repeated edits around the same files without a clear reason\n- lower cost that came from skipping necessary exploration\n\n### Step 5: Add Automation Gates\n\nFor CI or repeatable team workflows, use JSON output or health thresholds.\n\n```bash\nagenttrace --overview -f json -o agenttrace-overview.json\nagenttrace --overview --fail-under-health 80 --fail-on-critical --max-tool-fail-rate 15\n```\n\nTune thresholds to the project. A strict gate is useful for critical workflows;\na reporting-only command is better while the team is learning its baseline.\n\n## Examples\n\n### Quick Local Review\n\n```bash\nagenttrace --overview\nagenttrace --latest\n```\n\nUse this after a long coding-agent run to decide whether the next prompt should\nsplit the task, avoid a failing tool path, add missing tests, or reset context.\n\n### CI Health Check\n\n```bash\nagenttrace --overview --fail-under-health 80 --fail-on-critical\n```\n\nUse this when agent session logs are available in CI and the team wants a simple\nguard against critical anomalies or unhealthy runs.\n\n## Best Practices\n\n- Start with `--doctor` when session discovery is uncertain.\n- Report missing fields plainly; do not invent cost, model, latency, or health data.\n- Treat prompts, code, and session contents as private local data.\n- Prefer JSON output for automation and Markdown output for human review.\n- Use trace metrics for process failures and diff\u002Freference review for semantic drift.\n\n## Limitations\n\n- agenttrace can only analyze logs that are present locally or provided as exports.\n- Some agents do not expose enough fields to infer cost, model, cache use, or latency.\n- Healthy trace metrics do not prove the final code is correct; still run tests and review diffs.\n- CI gates should start as advisory until the team understands normal baseline behavior.\n\n## Security & Safety Notes\n\n- Do not upload private session logs to external services unless the user explicitly approves it.\n- Do not overwrite user reports unless they requested that exact output path.\n- Avoid printing secrets found in prompts, tool output, environment variables, or logs.\n\n## Common Pitfalls\n\n- **Problem:** No sessions are found.\n  **Solution:** Run `agenttrace --doctor`, then point agenttrace at the exported file or log directory.\n\n- **Problem:** A run looks cheap and fast but produced the wrong refactor.\n  **Solution:** Compare the session against a prior attempt or known-good diff; cost metrics alone will miss semantic drift.\n\n- **Problem:** CI fails too often after adding a health gate.\n  **Solution:** Start with JSON or Markdown reporting, inspect normal baselines, then tighten thresholds gradually.\n\n## Related Skills\n\n- `@langfuse` - Use for production LLM application tracing and evaluation.\n- `@observability-engineer` - Use for broader service monitoring, SLOs, and incident workflows.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,226,1526,"2026-05-16 13:01:45",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"代码审查","review","mdi-magnify-scan","代码质量分析、安全审查",4,145,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"19a95009-f148-4f3e-b8ee-1eedb54b7b5a","1.0.0","agenttrace-session-audit.zip",2612,"uploads\u002Fskills\u002F775d7ad4-542e-4557-b0f5-be72b73870fd\u002Fagenttrace-session-audit.zip","6811ab7e10f89f3b772423bd1974bffd9add23fe4566b3939cdf802359496aaa","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":5787}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]