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:

ls -la ~/.claude
total 0
drwx------. 7 runner runner  86 Jan 19 11:22 .
drwxr-xr-x. 1 runner runner 109 Jan 19 11:22 ..
drwx------. 2 runner runner 116 Jan 19 11:21 debug
drwx------. 3 runner runner  34 Jan 19 11:22 projects
drwxr-xr-x. 2 runner runner  51 Jan 19 11:21 shell-snapshots
drwxr-xr-x. 2 runner runner 170 Jan 19 11:21 statsig
drwx------. 2 runner runner  98 Jan 19 11:21 todos

After we make our first request to Claude, the directory expands:

ls -la ~/.claude
total 4
drwx------. 8 runner runner 126 Jan 19 11:23 .
drwxr-xr-x. 1 runner runner 109 Jan 19 11:23 ..
drwx------. 2 runner runner 116 Jan 19 11:21 debug
-rw-------. 1 runner runner 163 Jan 19 11:23 history.jsonl
drwx------. 3 runner runner  34 Jan 19 11:22 projects
drwxr-xr-x. 3 runner runner  50 Jan 19 11:22 session-env
drwxr-xr-x. 2 runner runner  51 Jan 19 11:21 shell-snapshots
drwxr-xr-x. 2 runner runner 170 Jan 19 11:21 statsig
drwx------. 2 runner runner  98 Jan 19 11:21 todos

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.

Sign up

Join the 1M+ learners on CodeSignal

Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal