claude-session-analysis

majiayu000's avatarfrom majiayu000

Analyze Claude Code session files. Find current session ID, view timeline (tl), or search past chats.

0stars🔀0forks📁View on GitHub🕐Updated Jan 5, 2026

When & Why to Use This Skill

Claude Session Analysis is a specialized developer tool designed to provide deep observability into Claude Code session histories. It enables users to search past interactions, visualize detailed timelines of agent actions (including file writes, bash commands, and thought processes), and perform granular diffing of file versions. By parsing local .jsonl session logs, it transforms raw data into actionable insights for debugging and auditing AI-driven development workflows.

Use Cases

  • Debugging Agent Behavior: Analyze the session timeline to pinpoint exactly where an agent's logic diverged or identify the root cause of an unexpected file modification.
  • Session Auditing and Recovery: Search through historical chat logs by keyword or timestamp to retrieve previous context, lost code snippets, or rationale behind past architectural decisions.
  • Code Evolution Tracking: Use the file-diff and versioning scripts to compare different iterations of a file generated during a session, ensuring code quality and tracking incremental changes.
  • Workflow Optimization: Monitor the sequence of 'Think', 'Bash', and 'File' operations to understand how the agent approaches complex tasks and optimize prompt strategies accordingly.
nameclaude-session-analysis
descriptionAnalyze Claude Code session files. Find current session ID, view timeline (tl), or search past chats.

Claude Session Analysis

This is {SKILL_DIR}/SKILL.md. Scripts: {SKILL_DIR}/scripts/

Script Description
current-session.sh [dir] [sec] My session ID
sessions.sh [--full] [-g kw] [-mmin 1440] [-n 10] Search sessions by keyword/time
resolve-session.sh <id> Session ID → file path
timeline.sh [-t <types>] [-w <width>] <id> [range] Timeline (default: all, 55 chars; range: ..m, m.., m..m)
get-by-marker.sh [--raw] [-A n] [-B n] [-C n] <id> <marker> Entry details (with context)
file-ops.sh <id> Read/Write operations
file-diff.sh <id> <hash> <v1> [v2] Diff versions (v2 omitted: vs current)
summaries.sh <id> Session title history

Timeline Markers

Format: {hash}-{type} (e.g., 7e2451-U) with [+N] for truncated chars

Types (all by default, filter with -t):

  • U: User (includes /commands) | T: Think | F: File (Write: {hash}@v{n})
  • W: Web (no truncate) | B: Bash | G: Grep/Glob
  • A: Agent | S: Skill | Q: Question | D: toDo

Paths

  • Sessions: ~/.claude/projects/{project-path}/{session-id}.jsonl
  • Backups: ~/.claude/file-history/{session-id}/{hash}@v{version}

Usage Tips

  1. Start with full timeline (default width is enough for overview)
  2. Dive deeper with get-by-marker.sh or -w for specific entries

⚠️ Sandbox: Pipes (|) don't work. Use dangerouslyDisableSandbox: true when piping output.

claude-session-analysis – AI Agent Skills | Claude Skills