Overview
Each coding session in Claude Code generates a metadata file that tracks detailed activity: message counts, tool calls, git operations, token usage, code changes, and timestamps. These files enable per-session analysis and aggregation.File Location
File Format
JSON format with aSessionMeta object per file.
Data Structure
SessionMeta Interface
Core Session Fields
Unique identifier for this coding session
Absolute path to the project directory
ISO 8601 timestamp when the session began
Total session duration in minutes
Message Counts
Number of messages sent by the user
Number of responses from Claude
The initial user prompt that started the session
Tool Usage
Number of invocations per tool. Keys are tool names like
"Read", "Edit", "Bash", "Grep".Total number of tool invocations that resulted in errors
Breakdown of errors by category (e.g.,
"FileNotFound", "PermissionDenied")Feature Flags
Whether the Task agent was invoked during this session
Whether Model Context Protocol servers were used
Whether web search was invoked
Whether WebFetch was used to retrieve external content
Code Changes
Total lines of code added across all files
Total lines of code removed
Number of distinct files edited
Lines changed per programming language (e.g.,
{"TypeScript": 245, "Python": 89})Git Operations
Number of commits created during the session
Number of git push operations
Token Usage
Total input tokens consumed in this session
Total output tokens generated
Timestamps
Array of hour values (0-23) when messages were sent. Used for hourly activity charts.
Unix timestamps (milliseconds) for each user message. Enables precise timing analysis.
Count of times the user interrupted Claude’s response
Loading Function
Fromsrc/lib/load-data.ts:
- Reads all
.jsonfiles from thesession-metadirectory - Parses each file, skipping any that fail
- Filters out sessions with zero duration (incomplete/corrupted)
- Sorts by start time (newest first)
- Returns an empty array if the directory doesn’t exist
Usage in Export Script
Fromscripts/export.mjs:
- Reads all session metadata files
- Filters valid sessions (duration > 0)
- Sorts chronologically
- Logs the count of sessions found
- Includes the array in the export bundle
Use Cases
- Session Explorer: Browse and expand individual sessions
- Tool Usage Charts: Aggregate
tool_countsacross sessions - Project Breakdown: Group sessions by
project_path - Language Analysis: Sum
languagesto see which languages you work with most - Activity Patterns: Use
message_hoursto build hour-of-day distributions - Git Activity: Track commits and pushes over time
- Cost Estimation: Combine
input_tokensandoutput_tokenswith pricing data
Example Session Meta
Related Data Sources
- stats-cache - Aggregated statistics across all sessions
- history - Complete prompt history