Skip to content

Commit 211a29f

Browse files
rysweetUbuntuclaude
authored
feat(skills): Add session-replay skill for trace analysis
* feat(skills): Add session-replay skill for trace analysis Add new skill for analyzing claude-trace JSONL files: - Session health reports (token usage, latency, errors) - Error pattern detection across sessions - Tool usage distribution analysis - Complements existing transcript tools Part of Issue #1611 Enhancement 1 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix(skills): Standardize session-replay frontmatter per FRONTMATTER_STANDARDS.md - Change `triggers` to `auto_activates` for skill discovery consistency - Add `priority_score: 38.0` with evaluation_criteria breakdown - Add `dependencies` section specifying Read and Glob tools - Add `maturity: production` indicator - Fix broken relative paths in README.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Improve session-replay skill quality to 9/10 Improvements: - Enhanced Philosophy Alignment with concrete examples for each principle - Added comprehensive Limitations section documenting skill boundaries - Added Error Handling section with malformed JSONL and edge case handling - Added Tool Selection Matrix for clear integration guidance - Added explicit Trigger phrases for auto-activation clarity - Added Combined Workflows showing integration with /transcripts and context_management - Added Troubleshooting section for common issues - Updated README.md with consistent philosophy and limitations These changes address the 8.5->9 quality gap by: 1. Documenting what the skill cannot do (previously missing) 2. Showing concrete error scenarios with working code 3. Clarifying when to use this skill vs alternatives 4. Providing actionable troubleshooting guidance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Ubuntu <azureuser@amplihack2.yb0a3bvkdghunmsjr4s3fnfhra.phxx.internal.cloudapp.net> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 83f1704 commit 211a29f

File tree

2 files changed

+720
-0
lines changed

2 files changed

+720
-0
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Session Replay Skill
2+
3+
Analyze claude-trace JSONL files for session health, patterns, and actionable insights.
4+
5+
## Overview
6+
7+
The session-replay skill provides API-level analysis of Claude Code sessions by parsing claude-trace JSONL files. It complements the `/transcripts` command by focusing on performance metrics, token usage, and error patterns rather than conversation content.
8+
9+
## Features
10+
11+
- **Session Health Analysis**: Token usage, request timing, error rates
12+
- **Error Pattern Detection**: Categorize and track recurring failures
13+
- **Tool Usage Analytics**: Identify inefficient patterns and bottlenecks
14+
- **Session Comparison**: Track trends across multiple sessions
15+
16+
## Quick Start
17+
18+
```
19+
User: Analyze my latest session health
20+
21+
Claude: I'll analyze the most recent trace file...
22+
[Reads .claude-trace/*.jsonl]
23+
[Extracts metrics]
24+
[Generates health report]
25+
```
26+
27+
## Actions
28+
29+
| Action | Description |
30+
| --------- | ------------------------------- |
31+
| `health` | Analyze session health metrics |
32+
| `errors` | Identify error patterns |
33+
| `compare` | Compare metrics across sessions |
34+
| `tools` | Analyze tool usage patterns |
35+
36+
## Trace File Format
37+
38+
Claude-trace produces JSONL files with request/response pairs:
39+
40+
```json
41+
{
42+
"timestamp": 1763926357.797,
43+
"request": {
44+
"method": "POST",
45+
"url": "https://api.anthropic.com/v1/messages",
46+
"body": { "model": "...", "messages": [...] }
47+
},
48+
"response": {
49+
"usage": { "input_tokens": N, "output_tokens": N },
50+
"content": [...]
51+
}
52+
}
53+
```
54+
55+
## Metrics Extracted
56+
57+
- **Token Usage**: Input/output tokens, efficiency ratio
58+
- **Request Stats**: Count, latency, error rate
59+
- **Tool Usage**: Call frequency, success rates
60+
- **Health Score**: Composite session quality metric
61+
62+
## Example Output
63+
64+
```
65+
Session Health Report
66+
=====================
67+
File: log-2025-11-23-19-32-36.jsonl
68+
Duration: 45 minutes
69+
70+
Token Usage:
71+
- Input: 125,432 tokens
72+
- Output: 34,521 tokens
73+
- Efficiency: 27.5% output ratio
74+
75+
Health Score: 82/100 (Good)
76+
```
77+
78+
## Related Tools
79+
80+
| Need | Use This |
81+
| -------------------------------- | ------------------------------- |
82+
| Session performance metrics | **session-replay** (this skill) |
83+
| Conversation content/restoration | `/transcripts` command |
84+
| Knowledge extraction | `codex_transcripts_builder.py` |
85+
| Token optimization | `context-management` skill |
86+
87+
## Philosophy Alignment
88+
89+
This skill strictly follows amplihack principles:
90+
91+
- **Ruthless Simplicity**: Direct file parsing using only Python standard library (json, pathlib)
92+
- **Zero-BS**: Every code example runs without modification, no stubs or placeholders
93+
- **Brick Philosophy**: Self-contained module with clear inputs (trace files) and outputs (reports)
94+
- **Fail Fast**: Clear error messages for malformed files, missing traces, or permission issues
95+
96+
## Limitations
97+
98+
- **Read-only**: Cannot modify or generate trace files
99+
- **Local only**: Analyzes traces in current project only
100+
- **JSONL format**: Only claude-trace JSONL format supported
101+
- **Post-session**: Analyzes completed sessions, not real-time
102+
103+
## See Also
104+
105+
- [SKILL.md](./SKILL.md) - Full skill specification with implementation details
106+
- `.claude-trace/` - Trace file location (project root)
107+
- `/transcripts` - Conversation transcript management command
108+
- `context-management` skill - Proactive context optimization

0 commit comments

Comments
 (0)