diagnose-agent-session

Diagnose abnormal token usage, model activity, and tool calls in Codex, Cursor, and Copilot agent sessions.

Updated May 19, 2026
One-click install
npx skills add https://github.com/wenyue/SmartKit --skill diagnose-agent-session-wenyue
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: diagnose-agent-session
Source: https://github.com/wenyue/SmartKit/tree/main/docs/zh-CN/skills/diagnose-agent-session
Command: npx skills add https://github.com/wenyue/SmartKit --skill diagnose-agent-session-wenyue

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? When an AI agent session shows suspicious token consumption, unexpected API-equivalent costs, stalled tool calls, or confusing sub-agent behavior, there is no easy way to determine what actually happened. This Skill collects bounded, immutable evidence from local session logs and Tokscale usage data, then produces a structured diagnostic conclusion. ## Core Features & Use Cases - Scoped evidence collection: Diagnoses a single identified client/session at turn, session, or both scope, copying Codex logs into immutable snapshots before analysis. - Multi-surface capability reporting: Reports usage, model activity, tool calls, unfinished calls, sub-agent lifecycle, collaboration, and waits with explicit available/unavailable/failed status per capability. - Privacy-preserving conclusions: Reports only metadata and derived observations, never prompts, responses, tool inputs, or credentials, and always expresses amounts as estimated API-equivalent cost. - Use Case: A developer notices a Codex session consumed far more tokens than expected. They invoke this Skill with the client and session ID, and receive a structured report distinguishing observed facts from inference, ending in exactly one conclusion: anomaly observed, no anomaly observed, or inconclusive. ## Quick Start Ask the agent to diagnose the current Codex session for abnormal token usage and tool activity at both turn and session scope.

Frequently Asked Questions about diagnose-agent-session

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I diagnose high token usage in a Codex agent session?▼

Invoke the Skill with the client identifier codex and the exact session ID, choosing turn, session, or both scope. It copies the local session log into an immutable snapshot and correlates usage evidence with task context to reach one conclusion.

What AI coding clients does this session diagnostic support?▼

It supports Codex, Cursor, and GitHub Copilot CLI. Codex supports turn, session, and both scopes, while Cursor and Copilot only support whole-session Tokscale evidence; requesting turn scope for them stops before any fetch.

Can I diagnose a specific historical turn in a session?▼

No. Turn scope only covers the last recorded turn of the session, from the latest user message boundary to the final event. Requests for other historical turns stop before evidence collection with the exact precondition reported.

Does the diagnostic report include conversation content or credentials?▼

No. The report contains only metadata and derived observations. Prompts, responses, tool inputs, tool outputs, and credentials are never disclosed, and all amounts are stated as estimated API-equivalent cost, never as billing.

Why does a Cursor or Copilot session diagnosis report missing evidence?▼

Cursor may require an existing valid Tokscale identity and a previously authorized sync, while Copilot requires OTEL file export configured before the activity occurred. Missing historical telemetry cannot be reconstructed retroactively.