Skip to content

Sessions and conversations

Claude Code activity is modeled at two levels.

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_at
  • human_seconds, agent_seconds, cost_usd_cents
  • project_id, attribution_method (path | agent-inline | subagent-heuristic | manual), attribution_confidence, attribution_subcategory
  • paths_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)

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.

Two child tables capture finer-grained activity:

TableWhat it stores
session_eventsOne row per SessionStart, UserPromptSubmit, Stop, SessionEnd. Used for the session timeline view.
session_tool_callsOne row per PostToolUse. Used for tool-mix analysis.

Both are immutable. They never get re-classified or merged.

  • id, started_at — immutable.
  • paths_touched, project_distribution — recomputed on every sync. The classifier may pick a different project if project_path_prefixes change.
  • project_id — re-set by the classifier unless attribution_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.

  • Data flow — how sessions and conversations are populated.
  • Leverage — how human/agent seconds are computed per session.