Where do AI coding agents store your conversations on disk, and do pasted secrets persist in plaintext?
Audit of AI coding agent local storage: where sessions are saved, file format, retention defaults, and whether pasted secrets persist.
AI coding agents write your conversations to disk in readable form, usually in your home directory and in one case inside your repository. This audit documents where nine popular agents store session history, what format they use, how long they keep it, and whether any of them redact secrets before writing. It complements our previous audit of .env file handling. Even if an agent never reads .env, secrets you paste into prompts or that appear in command output can persist on your filesystem.
Summary: where does your history live?
| Tool | Version/Date | Local storage path | Format | Readable as-is? | Default retention | Cleanup options | In workspace (git risk)? | Evidence |
|---|---|---|---|---|---|---|---|---|
| Claude Code | Docs, Nov 2026 | ~/.claude/projects/<project>/<session>.jsonl | JSONL | Yes | 30 days (cleanupPeriodDays) | claude purge, manual delete | No | Docs: .claude directory |
| Codex CLI | Commit 36e074a, Nov 2026 | ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl | JSONL | Yes | None | Manual delete; codex archive only moves files | No | Source: recorder.rs |
| Gemini CLI | Commit 1930f25, Nov 2026 | ~/.gemini/tmp/<project_id>/chats/ | JSONL (older: JSON) | Yes | 30 days (sessionRetention) | --delete-session, /resume browser, manual delete | No | Docs: session-management.md |
| Cursor | Forum, Nov 2026 | ~/.cursor/projects/{workspace-slug}/agent-transcripts/ | JSONL | Yes | None documented | Manual delete | No | Cursor Forum (staff answer) |
| Cline | Commit 92b9f72, Nov 2026 | globalStorage/saoudrizwan.claude-dev/tasks/<task-id>/; SDK extension and CLI: ~/.cline/data/sessions/ | JSON | Yes | None | Delete per task or all in History view, manual delete | No | Source: disk.ts |
| Continue | Commit 5522c6f, Jul 2026 | ~/.continue/sessions/<session-id>.json | JSON | Yes | None | Delete or clear all in History view, manual delete | No | Source: paths.ts |
| Aider | Commit 5dc9490, May 2026 | .aider.chat.history.md (git root) | Markdown | Yes | None | Delete file, --chat-history-file | Yes, if .aider* isn’t ignored | Source: args.py |
| GitHub Copilot CLI | Docs, Nov 2026 | ~/.copilot/session-state/<session-id>/events.jsonl | JSONL | Yes | None locally; synced to GitHub by default | /session delete, /session prune, manual delete | No | Docs: config-dir-reference |
| Windsurf (Devin Desktop) | Docs, Nov 2026 | ~/.codeium/windsurf/cascade/ | Not documented | Not documented | None documented | Delete the folder (also clears local settings) | No | Docs: common issues |
The risk: pasted secrets persist on disk
When you paste a password, API key, or connection string into an AI coding agent (to debug an issue, configure a service, or ask about an error), that value enters the conversation. The agent sends it to the model provider as part of the prompt, and it also writes it to a local session file so you can resume later. The same happens to anything a tool prints: a cat .env, a failing deploy that echoes a token, or a database URL in a stack trace.
Some agents now expire old transcripts automatically. Claude Code and Gemini CLI default to 30 days. Most of the others keep everything until you delete it. While a secret sits in a transcript, it is exposed to:
- An attacker with local access: Malware, a compromised dependency, or another user on a shared machine can read files your account can read, and for Codex, files other accounts can read too (see below)
- Backup or sync software: Cloud backups, Time Machine, or file sync services copy these files to additional locations
- Accidental sharing: Sharing a VM image, a support bundle, or copying dotfiles to a new machine
- Git commits: For agents like Aider that write into the project directory, a careless
git add -f .or a missing ignore rule can commit your conversation. Apiiro’s GitHub scan counted committed agent transcripts among the places it found real secrets
Detailed findings by tool
Claude Code
Storage location: ~/.claude/projects/<project>/<session>.jsonl
Each session is a JSONL transcript. Anthropic’s docs say it holds “messages, tool calls, and tool results, plus the system prompt, tool definitions, and parameters of the requests Claude Code sent the model”. Subagent transcripts and large tool outputs sit in a per-session folder next to it. Typed prompts are also kept in ~/.claude/history.jsonl for up-arrow recall.
The docs are explicit about plaintext: “These files are plaintext. Anything that passes through a tool is written to a transcript on disk: file contents, command output, pasted text.” And: “Transcripts and history are not encrypted at rest. OS file permissions are the only protection.”
Retention: Claude Code deletes transcripts and related session data “once they’re older than cleanupPeriodDays… The default is 30 days and the minimum is 1.” There are exceptions. Transcripts of sessions started or last continued in Claude Desktop or Cowork are kept at any age unless you set desktopSessionCleanupPeriodDays. The sweep also pauses if Claude Code can’t safely work out the retention period, for example when a settings file can’t be parsed.
Session management:
/clearstarts a new conversation with empty context; the previous one stays on disk and can be reopened with/resume/compactsummarizes the conversation to free context- Double-tap Escape (or
/rewind) jumps back to an earlier point in the conversation
Cleanup: claude purge <path> deletes a project’s transcripts, auto memory, per-session task, debug and file-history entries, and its lines in history.jsonl, after showing a deletion plan. --all purges every project. Lowering cleanupPeriodDays shortens retention. To avoid writing transcripts at all, set CLAUDE_CODE_SKIP_PROMPT_HISTORY. In non-interactive mode you can pass --no-session-persistence with -p.
Secret redaction: None for local transcripts. Claude Code redacts “known API key and token patterns” only in feedback bundles you choose to submit.
Related risk: As documented in Apiiro’s research and our previous audit, Claude Code’s .claude/settings.local.json can also contain secrets if you approve shell commands that include them with “Yes, and don’t ask again.”
Source: Explore the .claude directory, cleanupPeriodDays, Data usage, Commands, accessed November 10, 2026.
OpenAI Codex CLI
Storage location: ~/.codex/sessions/YYYY/MM/DD/rollout-<timestamp>-<uuid>.jsonl
Codex CLI writes session transcripts as JSONL “rollout” files organized by date. Archived sessions are moved to ~/.codex/archived_sessions/. Session names are indexed in ~/.codex/session_index.jsonl, and thread metadata is kept in a SQLite database (state_5.sqlite at the audited commit). Your typed prompts also go to ~/.codex/history.jsonl.
The code also contains zstd compression for rollouts older than seven days (.jsonl.zst), but it sits behind the local_thread_store_compression feature flag. That flag is marked under development and off by default. Compressed files would still be readable with any zstd tool.
Session management:
codex resumeopens a picker of previous sessions (--lastcontinues the most recent)codex archive <SESSION>moves a session out of the picker intoarchived_sessions/codex unarchive <SESSION>restores it
Retention and cleanup: Rollout files have no automatic retention limit. Archiving is not deletion. To remove local data, delete the JSONL files. codex exec --ephemeral runs “without persisting session files to disk”. The history.persistence = "none" and history.max_bytes settings control only history.jsonl, not the rollout transcripts.
File permissions issue (still open): open_log_file in recorder.rs creates rollout files with OpenOptions::new().read(true).append(true).create(true) and no explicit Unix mode. With the standard 022 umask, that yields world-readable 0644 files in 0755 directories. Issue #21660 reports this. It is still open, and a September 2026 comment reproduced it on codex-cli 0.149.0: “Rollout files are created world-readable, while history.jsonl is correctly 0600”. On a shared machine, other local users may be able to read your transcripts. Fix the permissions yourself (see below).
Secret redaction: Codex has a best-effort regex sanitizer (codex-rs/secrets) for OpenAI-style sk- keys, AWS access key IDs, bearer tokens, and api_key/token/secret/password assignments. It is applied when Codex builds memories from past rollouts and when commands are displayed to app clients, not when rollouts are written. Issue #36079 reports a related case: a runtime-generated password passed to an MCP tool was stored unredacted in the local transcript.
Source: codex-rs/rollout/src/recorder.rs, codex-rs/rollout/src/lib.rs, codex-rs/secrets/src/sanitizer.rs, codex-rs/exec/src/cli.rs, commit 36e074a, November 10, 2026; Config reference.
Gemini CLI
Storage location: ~/.gemini/tmp/<project_id>/chats/
Gemini CLI saves every session automatically. Its docs say this covers “the complete conversation history”, including “your prompts and the model’s responses” and “all tool executions (inputs and outputs)”. Current versions write session-<timestamp>-<id>.jsonl files. Older ones wrote .json files, which the CLI still reads.
The docs call the folder <project_hash>. Current code uses a short, readable project ID from a registry at ~/.gemini/projects.json, usually based on the folder name. Older SHA-256-hash folders are migrated to it automatically. Sessions are project-scoped.
Manual checkpoints created with /chat save <tag> (also /resume save <tag>) are stored as checkpoint-<tag>.json in the same project temp directory.
Retention: Unlike most tools here, Gemini CLI cleans up by default: “The default policy is to retain sessions for 30 days.” Configure it under general.sessionRetention (enabled, maxAge, maxCount, minRetention) in settings.json.
Session management:
gemini --list-sessionsand/resumelist sessions for the current projectgemini --delete-session <index or ID>, orxin the/resumebrowser, deletes a session/chat list,/chat resume <tag>,/chat delete <tag>manage manual checkpoints/chat share [file]exports the conversation to Markdown or JSON
Cleanup: Use the commands above, shorten maxAge, or delete ~/.gemini/tmp/<project_id>/.
Secret redaction: We found none in the chat recording code, and none is documented.
Source: docs/cli/session-management.md, docs/reference/commands.md, chatRecordingService.ts, storage.ts, commit 1930f25, November 9, 2026.
Cursor
Storage location: ~/.cursor/projects/{workspace-slug}/agent-transcripts/
A Cursor staff member, answering a forum post, said: “Chat transcripts are stored locally at ~/.cursor/projects/{workspace-slug}/agent-transcripts/”, as .jsonl files. Another forum answer from Cursor says chat history “is stored locally on your computer and isn’t tied to your Cursor account”. It is not synced between machines.
Known issue: In the same thread, Cursor staff said that after an update “the workspace identity” can change slightly, so the sidebar stops showing old chats. The transcripts are still on disk.
Cleanup: We found no documented retention limit or bulk cleanup command. Delete files under ~/.cursor/projects/ to remove transcripts.
Secret redaction: Not documented.
Source: Cursor Forum: Chat history issues, Cursor Forum: Cross-device sync, accessed November 10, 2026.
Cline
Storage location (classic VS Code extension): VS Code global storage under saoudrizwan.claude-dev/tasks/<task-id>/
| Platform | Path |
|---|---|
| Linux | ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/tasks/ |
| macOS | ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/tasks/ |
| Windows | %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\tasks\ |
Each task directory contains:
api_conversation_history.json– the full API conversationui_messages.json– messages as displayed in the UItask_metadata.json– task metadata
SDK-based extension and CLI: Since version 4.1, the VS Code extension has shipped a legacy runtime and a new SDK-based runtime in one package, and is moving users to the SDK one gradually. The SDK runtime and the Cline CLI store sessions under ~/.cline/data/. There, sessions/<id>/<id>.messages.json holds the conversation and db/sessions.db is a SQLite index. Older tasks in global storage stay readable.
Session management: Task history is listed in the Cline History view, where you can delete individual tasks or delete all history (optionally keeping favorites).
Cleanup: Use the History view, or delete task or session directories manually. There is no automatic retention limit.
Secret redaction: Not documented.
Source: apps/vscode/src/core/storage/disk.ts, sdk/packages/shared/src/storage/paths.ts, docs: hub-spoke architecture, commit 92b9f72, November 10, 2026; Issue #7742.
Continue
Storage location: ~/.continue/sessions/<session-id>.json (override the base folder with CONTINUE_GLOBAL_DIR)
Continue stores each session as a separate JSON file. sessions.json in the same folder indexes all sessions with metadata, including the workspace directory, so the sidebar can filter by workspace.
Session management and cleanup: The History view lets you delete a session or clear all of them. The clear-all dialog warns: “Are you sure you want to permanently delete all chat sessions, including the current chat session?” You can also delete the files directly. There is no automatic retention limit.
Historical note: Older versions also kept chat history in VS Code’s webview session storage, where large sessions could exceed a 5 MB limit. This was removed in October 2025 (PR #7944).
Secret redaction: Not documented.
Source: core/util/paths.ts, core/util/history.ts, gui/src/components/History/index.tsx, commit 5522c6f, July 20, 2026.
Aider
Storage location: .aider.chat.history.md at the root of your git repo (or the current directory outside a repo)
Unlike every other tool in this audit, Aider writes its chat history into your project, not a hidden home folder. The file is Markdown, human-readable, and grows as you chat.
Additional files:
.aider.input.history– your typed input history, also at the git root- An optional raw LLM log, only if you set
--llm-history-file
The git risk, and Aider’s guard: By default (--gitignore, on), Aider checks at startup whether .aider* is ignored and asks: “Add .aider* to .gitignore (recommended)?” It also offers to ignore .env if one exists. The risk comes when you decline, run with --no-gitignore, start Aider in a directory that isn’t yet a git repo, or later force-add files. Then a git add . stages your whole conversation, including any secrets you pasted.
Session management:
--chat-history-file PATHwrites the history to a different location--restore-chat-historyreloads previous history into context on startup (off by default)/clearclears the in-memory chat but does not delete the history file
Cleanup: Delete .aider.chat.history.md manually, or use --chat-history-file /dev/null to discard the log. There is no automatic retention limit.
Secret exposure reported: Issue #5074 (open) reports that a .env file added with --read was sent to the model and written in plaintext to .aider.chat.history.md. The reporter lists DB_PASSWORD, AWS_SECRET_ACCESS_KEY, GITHUB_CLIENT_SECRET, JWT_SECRET and SENDGRID_API_KEY among the values found in the history file.
Source: Options reference, aider/args.py, aider/main.py (check_gitignore), commit 5dc9490, May 22, 2026; Issue #5074.
GitHub Copilot CLI
Storage location: ~/.copilot/session-state/<session-id>/events.jsonl
GitHub’s docs say each session directory “stores an event log (events.jsonl) and workspace artifacts (plans, checkpoints, tracked files)”. Additional data includes:
~/.copilot/logs/process-<timestamp>-<pid>.log– per-session log files~/.copilot/session-store.db– a SQLite database for cross-session data, used by/chronicle
Sync to GitHub: GitHub says: “By default, locally-run sessions created with Copilot CLI or the GitHub Copilot app are synced to your GitHub account.” The remoteExport setting defaults to true. Set it to false, or run with --sync-session=off, to opt out. For Copilot Business and Enterprise users, sessions sync only if the organization’s “Store local sessions in the Cloud” policy allows it. Otherwise they stay local. Synced data is private to your account by default.
Session management:
/sessionshows current session info/session delete [SESSION-ID]deletes a session and asks whether to delete the synced copy too/session delete-alldeletes all local sessions except the current one/session prune --older-than DAYSdeletes local sessions older than a number of days (--dry-runto preview)--continueresumes the most recent session;/resumeand--resumeopen a picker/shareshares or exports the current session (file, HTML, gist or link)
Cleanup: delete-all, prune and deleting files from ~/.copilot/session-state/ only affect local data. After deleting files by hand, run /chronicle reindex. Note that reindexing also “syncs your session data to your account”. Remove synced copies with /session delete or on GitHub.com.
Secret redaction: Not documented for session history.
Source: GitHub Copilot CLI configuration directory reference, Using Copilot CLI session data, About GitHub Copilot session data, CLI command reference, accessed November 10, 2026.
Windsurf (Devin Desktop)
Storage location: ~/.codeium/windsurf/cascade/
The Windsurf editor, now documented as Devin Desktop, keeps Cascade conversation history in this folder:
| Platform | Path |
|---|---|
| Linux/macOS | ~/.codeium/windsurf/cascade/ |
| Windows | C:\Users\<user>\.codeium\windsurf\cascade\ |
Cleanup: Deleting the folder removes chat history. The docs warn: “deleting these folders will remove your conversation history and local settings!”
Format and secret redaction: Neither is documented, and we did not inspect the files, so we can’t say whether they are readable as-is.
Source: Common Devin Desktop issues, accessed November 10, 2026.
Practical hardening steps
For all tools
-
Treat session folders as sensitive. Exclude
~/.claude,~/.codex,~/.gemini,~/.cursor/projects,~/.cline,~/.continueand~/.copilotfrom cloud sync and unencrypted backups, or make sure those backups are encrypted. -
Use variable references, not values. When asking about configuration, use
$DATABASE_URLinstead of the actual connection string. If you must paste a secret, rotate it after the session. -
Shorten retention where the tool supports it. Set
cleanupPeriodDayslow in Claude Code andgeneral.sessionRetention.maxAgein Gemini CLI. Run/session prune --older-than DAYSin Copilot CLI. Elsewhere, delete old session files on a schedule. -
Check file permissions. On Unix systems, make sure session directories are mode
0700and files0600.
For Aider specifically
-
Confirm
.aider*is in.gitignore. Aider offers to add it on startup; don’t decline:# Aider chat history and state.aider* -
Or write history outside the repo:
Terminal window aider --chat-history-file ~/.aider-history/$(basename "$(pwd)").md -
Audit existing repos for committed Aider files:
Terminal window git log --all --full-history -- "*.aider*"
For Codex CLI
-
Lock down existing and future session files until issue #21660 is fixed:
Terminal window chmod 700 ~/.codexfind ~/.codex/sessions ~/.codex/archived_sessions -type d -exec chmod 700 {} + 2>/dev/nullfind ~/.codex/sessions ~/.codex/archived_sessions -type f -exec chmod 600 {} + 2>/dev/nullSetting
chmod 700 ~/.codexblocks other users from reaching new rollout files even if they are created 0644. -
Use
codex exec --ephemeralfor scripted runs that handle secrets.
For GitHub Copilot CLI
-
If you don’t want sessions synced, set
"remoteExport": falsein~/.copilot/settings.jsonor run with--sync-session=off. -
Delete sensitive sessions with
/session deleteand choose to remove the synced copy too, or delete it on GitHub.com.
What ignore mechanisms don’t cover
The previous audit found that .env protection via ignore files doesn’t cover every access path. The same applies to local storage:
- User input is always stored. Ignore files stop an agent’s tools from reading
.env, but they don’t stop you pasting secrets into prompts. - Tool output is stored. If a command prints secrets to stdout or stderr, that output appears in the session transcript.
- “Don’t save this session” options are rare and partial. Claude Code can skip transcripts with
CLAUDE_CODE_SKIP_PROMPT_HISTORYor--no-session-persistencein-pmode, and Codex hascodex exec --ephemeral. None of the tools lets you mark a single prompt as sensitive so it isn’t written to disk.
Where Shadow fits
Shadow replaces secrets with reversible fakes before prompts leave your machine. Shadow can mask traffic from Claude Code, Codex CLI, Gemini CLI, GitHub Copilot, and Aider, Cline and Continue with your own keys. For those, the real secret values don’t reach the model provider. Cursor and Windsurf use binary protocols, so Shadow recognizes their traffic but cannot mask it.
However, local session files are written by the agent, not by Shadow. The agent records your original input before its request reaches Shadow, so the local file still contains the real secret. Shadow protects what reaches the cloud; local retention and cleanup are still up to you.
For setup: Protect secrets from AI coding assistants.
Limitations of this research
- We audited source code at specific commits and documentation at specific dates; behavior may differ in other versions
- We read code and docs; we did not run each agent and inspect the files it created
- For closed-source tools (Cursor, Windsurf, Copilot CLI), we relied on official docs and staff forum answers, not reverse engineering
- We did not verify that cleanup commands fully erase data (overwrite vs. unlink) or that deleted sessions are unrecoverable
- We did not audit what model providers retain server-side after receiving prompts
- File paths may vary on non-standard installations or with environment variable overrides (
CODEX_HOME,CLINE_DIR,CONTINUE_GLOBAL_DIR,COPILOT_HOMEand similar)
About this research
Written by the Shadow Research Team from source code inspection of open-source repositories and official documentation of closed-source tools. Shadow is a privacy layer for AI from Tiny Bubble Company. It is not affiliated with any of the AI coding tools examined in this article.
Disclaimer: This article describes publicly available source code and documentation as of the dates noted. It is not legal advice. Behavior may change between versions; verify on your actual installed version before relying on these findings.
Install Shadow Core freeAll research
Frequently asked questions
Does Claude Code save my chat history locally?
Yes. Claude Code stores each session as a JSONL transcript at ~/.claude/projects/<project>/<session>.jsonl, and your typed prompts in ~/.claude/history.jsonl. Anthropic's docs say these files are plaintext and not encrypted at rest. By default Claude Code deletes transcripts older than 30 days; change this with the cleanupPeriodDays setting. claude purge <path> deletes a project's transcripts on demand. /clear only starts a new conversation; the old one stays on disk and can be resumed.
How do I delete Codex CLI session history?
Delete the rollout files under ~/.codex/sessions/ (and ~/.codex/archived_sessions/). codex archive <SESSION> only moves a session out of the picker into archived_sessions/; it does not delete it. codex exec --ephemeral runs without writing session files. Codex has no automatic retention limit for rollout files.
Where does Gemini CLI store chat history?
Under ~/.gemini/tmp/<project_id>/chats/, as JSONL files in current versions (older versions wrote .json). Gemini CLI deletes sessions older than 30 days by default (general.sessionRetention). You can delete a session with gemini --delete-session <index or ID> or by pressing x in the /resume browser. Manual /chat save <tag> checkpoints are checkpoint-<tag>.json files in the project temp directory, removable with /chat delete <tag>.
Does Cursor save agent conversations to disk?
Yes. A Cursor staff member says agent transcripts are stored at ~/.cursor/projects/{workspace-slug}/agent-transcripts/ as .jsonl files. We found no documented retention limit or bulk cleanup command, so delete the files to remove that history.
Where is Cline task history stored?
The classic VS Code extension writes each task to VS Code's global storage under saoudrizwan.claude-dev/tasks/<task-id>/ (api_conversation_history.json, ui_messages.json, task_metadata.json). The Cline CLI and the newer SDK-based extension, which Cline is rolling out gradually, write sessions to ~/.cline/data/sessions/. Tasks can be deleted one at a time or all at once from Cline's History view.
Can Aider chat history be committed to git?
Yes. Aider writes .aider.chat.history.md and .aider.input.history to the root of your git repo. By default it asks to add .aider* to .gitignore when it starts. If you said no, run with --no-gitignore, or started Aider outside a repo, these files can be staged and pushed. Check that .aider* is in .gitignore, or use --chat-history-file to write the log outside the repo.
Does GitHub Copilot CLI store sessions locally?
Yes, under ~/.copilot/session-state/<session-id>/ as an events.jsonl event log plus workspace artifacts. By default sessions are also synced to your GitHub account (remoteExport defaults to true). Turn this off with "remoteExport": false in ~/.copilot/settings.json or --sync-session=off. /session delete can remove the synced copy too, but /session delete-all, /session prune and deleting local files only affect local data.
How do I delete Continue chat history?
Each session is ~/.continue/sessions/<session-id>.json, indexed by sessions.json. In the extension's History view you can delete single sessions or clear all sessions. You can also delete the files directly.
Do any AI coding agents redact secrets before saving history?
No tool we examined redacts secrets from its local session transcripts. Codex CLI has a best-effort regex sanitizer for OpenAI keys, AWS access key IDs, bearer tokens and password=/token=-style assignments. It applies when Codex builds memories from past sessions and when it displays commands in the app, not to the rollout files on disk. Claude Code redacts known key patterns only in feedback bundles you choose to send. Treat your session history as containing anything you typed or any tool printed.
Can Shadow protect secrets in AI coding agent history files?
Shadow replaces secrets with reversible fakes before prompts leave your machine, so the real values never reach the model provider. Local session files, however, are written by the agent itself, before its traffic reaches Shadow, so they contain whatever you typed. Shadow protects what reaches the cloud; local history still needs the retention and cleanup steps below.