Overview
TheSessionLink struct represents metadata about an AI session that contributed to a commit. Each anchor can have multiple session links, tracking which AI tools were involved and their resource usage.
SessionLink Fields
Unique identifier for the AI session.
Name of the AI agent/tool (e.g., “cursor”, “claude”, “windsurf”).
The AI model used in this session (e.g., “claude-sonnet-4-20250514”, “gpt-4o”).
How this session was linked to the commit.See LinkType enum for possible values.
Number of input tokens consumed by this session.
Number of output tokens generated by this session.
Number of tokens read from cache.
Number of tokens written to cache.
Duration of the session in seconds.
Number of tool/function calls made during the session.
List of file paths that the AI agent modified or created.
Whether this session was spawned as a subagent of another session.
LinkType Enum
Describes how a session was linked to a commit.| Value | Description |
|---|---|
explicit | From lifecycle hooks - we know for certain |
inferred | From time-window matching - best guess |
Example JSON
Optional fields like
model, input_tokens, output_tokens, cache_read_tokens, cache_creation_tokens, duration_secs, tool_calls, and files_touched are omitted from JSON when null or not available.Usage Context
Related Types
- Anchor - The parent commit structure that contains session links
- FileChange - Per-file attribution that uses session data
- Contributor - High-level contributor info derived from sessions
