session-compare — Claude Code skill: compare sessions
Compare two Agent Monitor sessions across cost, tokens, events, and agent activity. Use it to see what changed between runs with different outcomes.
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill session-compare -a claude-codeWhat session-compare does
The skill builds a side-by-side report from two Agent Monitor sessions. It compares status, model, duration, cost, event and error counts, and tools used. Token details include input, output, cache reads, and cache writes; cost figures come from the pricing engine.
The report also covers event timelines, tool usage differences, and agent activity. It examines decisions that may have contributed to different outcomes and lists takeaways for future runs. The skill queries the Agent Monitor API at http://localhost:4820, so that service must be available for the comparison.
Provide two session IDs, ask for “best vs worst” or “latest 2,” or compare one session with the average of the last 50 sessions. The average comparison uses that specific group of sessions.
What it helps with
- compare token use and cost across two sessions
- spot tools used in only one run
- contrast error counts and subagent success rates
- locate where two event timelines diverged
- measure one session against the latest 50-session average
Example prompts for the agent
- Compare sessions
abc123anddef456by cost, tokens, and outcome. - Find the most and least productive sessions and explain the differences.
- Compare the two latest sessions and show where their timelines diverged.
How to install session-compare
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill session-compare -a claude-code2Manually: put the files in place
~/.claude/skills/session-compare/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/session-compare/
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill session-compare -a codex2Manually: put the files in place
.agents/skills/session-compare/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill session-compare -a cursor2Manually: put the files in place
.cursor/skills/session-compare/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install hoangsonww/Claude-Code-Agent-Monitor session-compare2Manually: put the files in place
.github/skills/session-compare/SKILL.md1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill session-compare -a gemini-cli2Platform CLI
gemini skills install https://github.com/hoangsonww/Claude-Code-Agent-Monitor --path plugins/ccam-insights/skills/session-compareManually: put the files in place
.devin/skills/session-compare/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill session-compare -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about session-compare
How do I install session-compare in Claude Code?
Run npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill session-compare -a claude-code. The skill file is placed at ~/.claude/skills/session-compare/SKILL.md.
What does session-compare do?
It creates a side-by-side report for two Agent Monitor sessions, covering cost, tokens, tools, errors, events, and agent activity. The report also identifies differences that may explain the outcomes and gives takeaways for later runs.
Which sessions can I compare?
Give it two IDs, ask for “best vs worst” or “latest 2,” or compare one ID with “vs average.” The average is calculated from the last 50 sessions.
Source text
SKILL.md · MIT
---
name: session-compare
description: >
Compare two sessions side-by-side using Agent Monitor data — per-model
token usage (input/output/cache_read/cache_write + compaction baselines),
pricing engine cost breakdowns, workflow intelligence (complexity scores,
tool flow transitions, subagent effectiveness), session metadata
(thinking_blocks, turn_count, turn_duration_ms, usage_extras), and
full event timelines with all 10+ event types.
---
# Session Compare
Compare two Claude Code sessions side-by-side using Agent Monitor data.
## Input
The user provides: **$ARGUMENTS**
This may be:
- Two session IDs: "abc123 def456"
- "best vs worst" — compare highest and lowest productivity sessions
- "latest 2" — compare the two most recent sessions
- A session ID + "vs average" — compare one session against the baseline
## Procedure
1. **Identify sessions to compare**:
- If two IDs given: fetch both from `http://localhost:4820/api/sessions/{id}`
- If "best vs worst": fetch sessions, score by completion + cost efficiency, pick extremes
- If "latest 2": `GET /api/sessions?limit=2` (default sort: most recently updated first)
- If "vs average": fetch session + compute averages from last 50 sessions
2. **Gather detailed data** for each session:
- Session metadata: `GET /api/sessions/{id}`
- Events: `GET /api/events?session_id={id}`
- Agents: `GET /api/agents?session_id={id}`
- Cost: `GET /api/pricing/cost/{id}`
3. **Build comparison**:
### Overview Comparison
| Metric | Session A | Session B | Difference |
|--------|-----------|-----------|-----------|
| Status | completed | error | — |
| Model | sonnet-4 | sonnet-4 | same |
| Duration | 12m 34s | 45m 12s | +32m 38s |
| Total Cost | $0.0234 | $0.1456 | +522% |
| Events | 45 | 187 | +315% |
| Tools Used | 8 | 12 | +4 |
| Error Count | 0 | 7 | +7 |
| Agents | 2 | 5 | +3 |
### Token Comparison
| Token Type | Session A | Session B | Difference |
|-----------|-----------|-----------|-----------|
| Input | N | N | ±N% |
| Output | N | N | ±N% |
| Cache Read | N | N | ±N% |
| Cache Write | N | N | ±N% |
| Efficiency | N% | N% | ±N% |
### Tool Usage Comparison
- Tools unique to Session A
- Tools unique to Session B
- Shared tools with usage count comparison
- Error rate per tool in each session
### Timeline Comparison
- Side-by-side event timeline
- Where sessions diverged in approach
- Key decision points that led to different outcomes
### Agent Activity Comparison
- Agent counts and types
- Subagent strategy differences
- Agent success rates
4. **Analysis**:
- Why one session was more efficient/successful than the other
- Key decisions that made the difference
- Lessons to apply to future sessions
## Output Format
Present as a side-by-side comparison report with:
- Executive comparison summary (which session was "better" and why)
- Structured comparison tables with color-coded differences (green = better, red = worse)
- A "Lessons Learned" section with actionable takeaways
- Overall winner declaration with justification
© hoangsonww · MIT · hoangsonww/Claude-Code-Agent-Monitor