Exploring Conversation History
Introduction
Welcome to the fifth unit of Foundation — Getting Started with Claude Code! So far, we've learned what Claude Code is, how to manage sessions with essential commands, and how Claude autonomously uses tools to create files and execute commands. Now we'll explore where all this work is stored and how Claude maintains transparency about every action it takes.
In this lesson, we'll discover how Claude Code persists our conversations in plain text files on our filesystem and how the /resume command reconstructs previous sessions. Unlike many AI tools that operate as black boxes, Claude Code stores everything locally in standard formats that we can inspect, search, and understand.
Understanding Session Persistence
When we work with Claude Code, every interaction builds on what came before. Claude remembers which files we created, what commands we ran, and the context of our project. This enables multi-turn conversations where we can say "update that function we wrote earlier" and Claude knows exactly what we mean.
But when we close a terminal session and return later, how does /resume restore our entire conversation? The answer: everything is written to disk in standard, human-readable formats. Claude maintains a simple directory structure in our home directory where all conversation data lives transparently. This means we can audit what Claude has done, search through our history, and never be locked out of our own data.
The ~/.claude Directory
When we first interact with Claude Code, it creates a hidden directory in our home folder called ~/.claude. This directory stores all our global state: conversation logs, debug information, and session data.
Let's explore this directory ourselves. Right after starting Claude Code but before making any requests, we'll see:
After we make our first request to Claude, the directory expands:
Notice what changed: the history.jsonl file appeared, and the session-env/ directory was created. These are generated as soon as we start interacting with Claude.
Each subdirectory has a specific purpose: debug/ contains diagnostic logs, projects/ holds our conversation histories, session-env/ and shell-snapshots/ track shell state, statsig/ stores analytics, and todos/ manages task lists.
