diagnose

Analyze Claude Code session files for token counts and context usage.

368|36|Updated Feb 6, 2026
One-click install
npx skills add https://github.com/Ruya-AI/cozempic --skill diagnose-ruya-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: diagnose
Source: https://github.com/Ruya-AI/cozempic/tree/main/plugin/skills/diagnose
Command: npx skills add https://github.com/Ruya-AI/cozempic --skill diagnose-ruya-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Detects and explains wasted context in Claude Code sessions by surfacing exact token counts, context usage percentage, and the messages that contribute the most bloat so teams can avoid accidental compaction and token overage.

Core Features & Use Cases

  • Token-aware diagnostics: reads usage token fields to report exact token counts and a visual context bar for a 200K window.
  • Bloat breakdown: shows bytes and token distribution by message type, top largest messages, and vital-sign categories like progress ticks and tool outputs.
  • Prescriptions & recommendations: estimates savings for gentle, standard, or aggressive pruning and recommends /cozempic:treat prescriptions when thresholds are exceeded.
  • Use Case: Inspect a growing Agent Team session to identify the messages causing auto-compaction risk and choose an appropriate prune strategy before state is lost.

Quick Start

Run a diagnostic of the current Claude Code session and report tokens, context percentage, top bloat contributors, and a recommended pruning prescription.

Frequently Asked Questions about diagnose

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

FAQPage Schema
How do I check Claude Code session bloat and token usage?

To check Claude Code session bloat, you can analyze live session files to read usage token fields and report exact token counts, context usage percentages against a 200K window, and per-message size breakdowns.

What causes context window limits and auto-compaction in Claude Code?

Context window limits and auto-compaction in Claude Code are caused by session bloat, where large messages like tool outputs and progress ticks consume excessive tokens and push the context near capacity.

How do I identify the largest messages wasting tokens in my session?

To identify the largest messages wasting tokens, you perform a token-aware diagnostic that shows bytes and token distribution by message type, highlighting top contributors causing auto-compaction risk.

Can I estimate token savings before pruning my Claude Code session?

You can estimate token savings before pruning your Claude Code session by generating prescriptions that calculate projected reductions for gentle, standard, or aggressive pruning treatments.

What is the best way to prevent accidental compaction in Agent Team sessions?

The best way to prevent accidental compaction in Agent Team sessions is to inspect growing session files, diagnose when context nears capacity, and choose an appropriate prune strategy before state is lost.

Does Claude Code token analysis require external dependencies?

Claude Code token analysis requires no external dependencies, reading usage token fields directly from live session files to output diagnostic metrics and recommended pruning prescriptions.