Sessions and conversations
Claude Code activity is modeled at two levels.
Session
Section titled “Session”A session is one Claude Code session_id. The atomic unit of activity. One session = one continuous block of work in one Claude Code window.
Each row in sessions carries:
id(the Claude Code session id)started_at,ended_athuman_seconds,agent_seconds,cost_usd_centsproject_id,attribution_method(path|agent-inline|subagent-heuristic|manual),attribution_confidence,attribution_subcategorypaths_touched(array — used by the classifier)project_distribution(per-project prefix-match scores — used for the attribution debug view)worker_email(who ran the session)
Conversation
Section titled “Conversation”A conversation is a logical chat thread — one Claude Code JSONL transcript file under ~/.claude/projects/. A conversation may chain multiple sessions via --resume.
Each row in conversations carries:
id(derived from the JSONL filename)first_session_id,last_session_id- Aggregate human/agent/cost/turns
When you claude --resume <id>, a new session_id starts but the same JSONL grows. The aggregator joins on JSONL filename to compute conversation rollups.
Session events and tool calls
Section titled “Session events and tool calls”Two child tables capture finer-grained activity:
| Table | What it stores |
|---|---|
session_events | One row per SessionStart, UserPromptSubmit, Stop, SessionEnd. Used for the session timeline view. |
session_tool_calls | One row per PostToolUse. Used for tool-mix analysis. |
Both are immutable. They never get re-classified or merged.
What’s stable across re-syncs
Section titled “What’s stable across re-syncs”id,started_at— immutable.paths_touched,project_distribution— recomputed on every sync. The classifier may pick a different project ifproject_path_prefixeschange.project_id— re-set by the classifier unlessattribution_method = 'manual', in which case it sticks.
To make a manual reassignment permanent across syncs, the SQL update sets attribution_method = 'manual' and attribution_confidence = '1.00'. For systemic fixes (a whole class of sessions misattributed), edit seeds/projects.yaml instead — see Project taxonomy operations.