Claude Code history security checklist
- Claude Code session history is primarily handled as local project/session files, so secure it by protecting the ~/.claude/projects/ data and any backups with OS account permissions, disk encryption, and restricted access; review enterprise or managed-account retention separately because local deletion may not remove centrally retained records.
- Inspect the relevant ~/.claude/projects/ directory and determine which session files require protection.
- Apply least-privilege filesystem permissions and keep the directory outside shared project repositories.
- Enable full-disk encryption, strong device authentication, and encrypted backups.
- Use a documented retention and deletion process for sensitive JSONL/session logs; verify backups and sync services are also addressed.
Claude Code session history is primarily local project/session files: protect ~/.claude/projects/ and backups with OS permissions, disk encryption, and restricted access; review enterprise retention because local deletion may not remove centrally retained records.
What securing Claude Code history involves
Securing Claude Code chat history means controlling local access, copies, retention, and organizational visibility. The main safeguards are:
- Restricting access to local session files
- Keeping history out of shared repositories and unprotected sync folders
- Encrypting the device and any retained backups
- Following a documented retention and deletion process
- Checking whether a managed deployment retains activity separately
These controls apply to Claude Code terminal sessions. They are separate from Claude web and Claude Desktop privacy and export controls.
Locate and identify Claude Code session history
When the local-storage workflow applies, inspect ~/.claude/projects/ for project and session data associated with Claude Code. Session records may appear as JSONL files, depending on the installed version and deployment. For a detailed explanation of the file locations and formats, see where Claude Code stores chat history.
Confirm the actual path and format on your system before moving, copying, or deleting anything. The operating system, Claude Code version, account type, and organizational deployment can affect what is stored and where. Local files are not necessarily the only records in every setup.
Find a past conversation
To find a specific Claude Code conversation, identify the relevant project directory, then review its session files using names, timestamps, and available contents. Do this in a protected location rather than copying the files into a shared folder.
Treat prompts, command output, file contents, generated code, and session metadata as sensitive data. Decide which records require protection, backup, retention, or deletion before handling them.
Restrict local access to session files
Apply least-privilege filesystem permissions to the relevant Claude Code directory and files so that only the intended user can read them, where supported by your operating system. Use a strong device password or passcode, lock the screen when away, and avoid shared OS accounts. For more detail on access boundaries and permissions, see the Claude Code file permissions guide.
Keep ~/.claude/projects/ and related data outside shared project repositories, team folders, public directories, and unprotected removable storage. Check repository and workspace layouts so history is not accidentally committed or copied with source code.
Runtime permission prompts do not replace protection for stored history. Anyone with access to an unlocked device account or readable session files may be able to inspect the history independently of those prompts.
Encrypt the device, backups, and sync locations
Enable full-disk encryption and strong device authentication. This helps protect local session files if the computer is lost or stolen, but it does not protect them from an already authorized, unlocked account. Combine encryption with account and filesystem controls.
Back up Claude Code session history only when there is a clear reason to retain it. Encrypt backup media and check who can access the backup account, storage location, shared drive, or recovery system.
Review whether cloud-sync, endpoint-backup, or device-migration services copy ~/.claude/projects/ or related files. Exclude sensitive history where appropriate, or confirm that the destination has suitable access controls and encryption. Do not place session files in unprotected shared drives or repositories.
Full-disk encryption protects storage under your control; it does not establish how any centrally retained Claude Code data is protected. Product-specific encryption details should be confirmed in the applicable deployment documentation.
Manage retention and deletion safely
Set a documented retention period based on session sensitivity and applicable organizational requirements. Keep only what you need, and separate records that must be retained from temporary troubleshooting or development conversations.
There may not be one Claude Code setting that controls every local, backup, sync, and organizational copy. Use documentation for the installed version and deployment instead of relying on an unverified setting or command.
Verify before deleting
- Confirm the current history path and identify the exact files involved.
- Make a protected backup first if the records may be needed later.
- Use the supported deletion workflow for the installed version.
- Check backup, sync, repository, migration, and recovery locations for additional copies.
- Record what was deleted and what remains subject to organizational retention.
Local deletion is not a guarantee of permanent erasure. It may leave backup or sync copies, and it may not remove activity retained centrally by an enterprise or managed deployment. Deleting local files also does not establish that audit records or other administrative data have been removed.
Limit sensitive information in Claude Code prompts
Reduce the risk of exposure by keeping unnecessary secrets out of Claude Code prompts, including:
- Passwords, API keys, access tokens, and other credentials
- Regulated personal information
- Unnecessary confidential source code or proprietary business data
- Secrets copied from configuration files or production systems
Review files and external data before providing them to Claude Code. Prompts or imported content can contain malicious instructions or sensitive information, so review them before reuse. Data minimization remains important even when permissions and encryption are configured correctly. For a broader explanation of this privacy risk, see sensitive information disclosure in LLM applications.
Protecting history also does not replace reviewing generated code. Follow the organization’s normal testing and secret-scanning practices before using generated changes in sensitive or production systems. For broader safeguards around the coding assistant, see Claude Code security best practices.
Review enterprise and managed-account visibility
Local protections do not necessarily cover centrally visible activity. Depending on the organization’s deployment and policies, a managed environment may retain or expose prompts, chats, file interactions, usage information, or other activity independently of local files.
Ask an administrator or consult the applicable policy about:
- Whether Claude Code prompts, session data, logs, or metrics are retained
- Which administrators or security teams can access that information
- How long records are retained and how export or deletion requests work
- Whether a deployment-specific Zero-Data-Retention agreement applies
Zero Data Retention, where available for a particular deployment, is an organization- and service-specific policy. It does not automatically control local files, personal backups, sync copies, or every category of audit data. Enterprise visibility is not universal across all Claude Code setups.
Runtime approvals and enterprise monitoring address different risks. Approval controls can limit actions during a session; they do not secure session files after they are written.
Keep Claude web and Desktop history separate
Claude Code terminal history is a different privacy-management concern from Claude web or Desktop chat history. On the Claude web app or Claude Desktop, users can export user information and chat history from Settings > Privacy.
That export capability does not establish an equivalent export, deletion, or privacy workflow for Claude Code’s local session files. Do not rely on web or Desktop settings to secure or delete local Claude Code chat history unless the applicable product documentation explicitly confirms that connection.
Final Claude Code history security checklist
- Locate: Confirm the local history path and file format, including whether
~/.claude/projects/applies. - Restrict: Check filesystem permissions, OS-account protection, shared-directory exposure, and device authentication.
- Encrypt: Verify full-disk encryption and encrypted backup storage.
- Review copies: Check cloud sync, endpoint backups, repositories, migration systems, and recovery locations.
- Confirm governance: Identify the deployment type, retention policy, administrator access, and scope of any deletion.
Protect the local files first, then investigate every backup and organizational record that may exist. Local deletion or Claude web settings should not be treated as complete control over Claude Code chat history.






