Encrypting coding-agent transcripts at rest

Published · Updated · Checked against Claude Code 2.1.319, Codex CLI 0.166.0, age 1.3.2

Full-disk encryption protects a powered-off laptop. Encrypting the transcripts themselves protects copies that leave the machine: backups, cloud drives, shares. Neither helps against software running as you, and neither removes the secrets inside the files. Name the adversary first, then pick the tool.

The starting point

Claude Code's docs say transcripts and history "are not encrypted at rest. OS file permissions are the only protection." The files are ~/.claude/projects/<project>/<session>.jsonl. Codex writes plain JSONL rollout files under ~/.codex/sessions/, a path no official Codex page states; it is what Codex CLI 0.166.0 writes on disk.

A request to encrypt Claude Code's logs with the system keychain was one of five proposals in #50014. The stale bot closed it as "not planned" on 16 Jul 2026, so nothing built in exists.

One constraint shapes everything below: the agent has to read its own transcript to resume a session. You cannot leave the active file encrypted and keep --resume. In practice you either encrypt the volume the file lives on, or you encrypt copies.

Who the adversary is

AdversaryExample
A thief with the powered-off deviceLaptop left in a taxi
Another person on the same machineShared workstation, a colleague's account
The storage providerCloud drive, bucket, backup service staff or a breach there
Whoever finds a leaked backupMisconfigured bucket, a repo pushed public
Software running as youMalware, a malicious npm package, a rogue editor extension
The model providerReceives the conversation as context

Full-disk encryption

Microsoft says BitLocker addresses "data theft or exposure from lost, stolen, or inappropriately decommissioned devices," including a drive moved to another machine (overview). Apple says FileVault keeps someone from decrypting your data "without entering your login password," and that Apple silicon Macs encrypt automatically (FileVault).

Both pages carry warnings. A BitLocker password-only setup without a TPM is described as not secure and discouraged. On Windows, device encryption on a machine with only local accounts "remains unprotected even though the data is encrypted," because the key is in the clear. And if you lose the password and recovery key, Apple says "your files and settings will be lost forever."

While you are logged in the disk is unlocked, so anything running as you can read the transcripts. That is the whole limit of this layer.

File permissions

The docs name them as the only built-in protection. They separate one user from another, they do not stop an administrator, and they mean nothing once a copy exists.

age on a copy

age encrypts a file or stream to a public key or a passphrase. It does not handle directories, so you pipe tar into it. That protects the archive from the storage provider and from anyone who finds the file.

RECIP=$(grep -o 'age1[a-z0-9]*' ~/age-key.txt | head -1)
tar -C ~/.claude -cf - projects | age -r "$RECIP" -o claude-projects.tar.age

The age README does not state the cipher and makes no audit claim; the format spec is there if that matters to you. The result is only as good as the private key. Keep it off the machine that holds the originals, or you have left the key beside the lock. gpg plays the same role with more features, but it was not tested for this guide.

restic adds snapshots and verification on top of encrypted backups. Its encryption design is not checked here, so read its documentation first. For rsync, git and archives compared, see back up Claude Code and Codex sessions.

Sealkeep's envelope

This description comes from Sealkeep's own README and is not independently verified. Each session gets a random per-archive key, and the session is encrypted in chunks under ChaCha20-Poly1305 or AES-256-GCM. The key is wrapped separately for each recipient: your recovery phrase and each device you trust. Every chunk is authenticated over its position, the archive identity and the chunk count, so reordering or truncation shows. In a bucket, paths are HMACs by default, so a listing reveals no project names or dates, and the control plane receives no transcript content or keys.

The README says directly that the format has not been independently audited, and that if you lose the recovery kit and every registered device, the archives are unreadable and support cannot recover them.

What each option stops

AdversaryFileVault / BitLockerFile permissionsage on a copySealkeep envelope
Thief, device offYesNoOnly for copiesOnly for copies
Another local userNo (disk is unlocked)Yes, not adminYes, if key is not readable by themCopy only
Storage providerNoNoYesYes
Leaked backupNoNoYesYes
Software running as youNoNoNoNo
Model providerNoNoNoNo

What none of them stop

Malware or an agent running as you reads the live transcript, .env and the key store. Sealkeep's README admits this for its own background service, which keeps the phrase in the OS keystore, so "anything running as you can read it once you are logged in." Opting out with --no-remember means typing the phrase each time and giving up unattended backups.

Encryption protects the container, not what is in it. Once someone with the key opens the file, every pasted key is there; scan and rotate as described in secrets in Claude Code transcripts. The model provider sees the conversation in the first place, and the data usage page covers retention by account type.

Lose the key or phrase and every option above becomes a delete button. And unless you delete it, the plaintext original stays beside the encrypted copy; if you want the originals gone, weigh Claude Code's own retention sweep and what you lose with it.

A sensible baseline

  1. Turn on FileVault or BitLocker with a TPM and PIN or an equivalent, and keep the recovery key somewhere else.
  2. Never copy ~/.claude or ~/.codex to a place you do not control without encrypting the copy.
  3. Keep keys off the machine that holds the originals.
  4. Keep credentials out of the transcript in the first place, with permission rules and by not printing secrets.
  5. Test a restore with the key and without the machine.

Where Sealkeep stops

Sealkeep covers the cases where a copy leaves the machine. It encrypts each session before it goes to your bucket or Sealkeep Cloud and verifies it by reading it back, and sealkeep share <id> gives a passcode-sealed bundle for one session.

It does not encrypt the original transcript the agent keeps writing: originals stay on the machine by default, and reclaim is opt-in and currently needs Sealkeep Cloud. It does not stop software running as you, and it does not redact secrets. Because the format is unaudited, a reviewer may prefer a well-known tool like age for high-value archives.

FAQ

Is FileVault enough for coding transcripts?

For a stolen powered-off laptop, yes. Backups, cloud copies and other users logged into the machine are not covered.

Can I encrypt ~/.claude/projects in place?

Not usefully. Claude Code reads the files to resume sessions, so they must be readable when you run it. Encrypt the volume or encrypt copies.

Does encryption help with the 30-day deletion?

No. It changes who can read a copy, not whether the copy exists. Where Claude Code stores your sessions lists the folders to copy before the sweep.