This page covers persistence mechanics. It is separate from the live in-memory app state described in the session-state page.
Three persistence classes
The source separates persisted state into three broad classes:- durable config and project metadata
- session transcripts and resume data
- session-only process flags that never hit disk
Session transcript persistence
src/utils/sessionStorage.ts is the core session-persistence layer.
It handles:
- storing transcript and log entries
- loading sessions for resume and continue flows
- restoring side-state from log snapshots
- extracting todo state from the transcript when needed
What gets reconstructed on resume
restoreSessionStateFromLog() restores more than message history.
Visible restore paths include:
- file history snapshots
- attribution state
- context-collapse persistence
- todo state for non-v2 todo flows
Session IDs and project scoping
Bootstrap state insrc/bootstrap/state.ts carries:
sessionId- optional
parentSessionId - stable project root
- optional session project directory override
Session-only state
Several pieces of state are intentionally non-persistent in the source. Examples include:- session-only trust acceptance
- session-only bypass-permissions mode
- session-only scheduled tasks
- session-created teams
- prompt-cache latches
- in-memory error logs
- some bridge and remote-control runtime flags
Configuration persistence versus session persistence
src/utils/config.ts and src/utils/settings/settings.ts handle durable config, not transcript persistence.
Those layers store:
- global config
- per-project config
- settings from multiple sources
- project-level stats and metadata
- MCP server config
Project config examples visible in source
ProjectConfig in src/utils/config.ts includes fields such as:
- allowed tools
- MCP context URIs
- MCP server config
- last-run metrics and usage summaries
- trust-dialog acceptance
- worktree-session state
- disabled and enabled MCP server lists
Global config examples visible in source
GlobalConfig carries user-level settings and metadata such as:
- onboarding state
- theme
- preferred notification channel
- oauth account info
- editor mode
- diff tool choice
- auto-update metadata
- connected Claude.ai MCP connectors
Resume is intentionally selective
A useful takeaway from the source is that Claude Code does not try to serialize every live field inAppState.
Instead it persists:
- the transcript and structured log stream
- enough snapshots to reconstruct key operational subsystems
- durable config in separate config files