Where 10 Popular AI Coding Tools Store Your Pasted Secrets on Disk
Tools like Gitleaks and TruffleHog guard your git history, so they never look inside ~/.claude, ~/.codex, ~/.continue, or your editor's state.vscdb SQLite databases. When you paste a .env file, a production database URL, or a curl command with a bearer token into an AI coding tool while debugging, that secret gets written straight into local session transcripts, prompt histories, and SQLite Write-Ahead Log (-wal) files.
To measure how widely this happens and what survives cleanup, I audited the local storage behavior of the 10 most widely used AI coding tools: Claude Code, Codex CLI, Cursor, Gemini CLI, Windsurf, Cline, Aider, OpenCode, Continue, and Goose. Findings for the 7 open-source codebases come directly from pinned commits and exact file:line checks in their GitHub repositories. Findings for the 3 closed-source clients (Claude Code, Cursor, and Windsurf) come from official vendor documentation, public issue trackers, and documented on-disk storage formats.
Summary Results
| Check Across 10 Tools | Count | Share | Why It Matters on a Developer Machine |
|---|---|---|---|
| Redacts pasted secrets before writing to disk | 0 / 10 | 0% | Zero tools scrub API keys or .env output pasted into prompts or returned by tools before saving them locally. Codex CLI still carries a literal // TODO: check `text` for sensitive patterns above its history.jsonl write. |
| Stores primary chat history in plaintext | 9 / 10 | 90% | Only Windsurf encrypts primary Cascade conversation files (~/.codeium/windsurf/cascade/*.pb) per conversation UUID. The other 9 write unencrypted JSONL, JSON, Markdown, or SQLite WAL files. |
| Keeps transcripts or prompt history forever | 8 / 9 | 89% | 7 plaintext tools have zero automatic expiration. Claude Code sweeps session transcripts at 30 days but keeps ~/.claude/history.jsonl forever unless HIPAA org settings apply. Only Gemini CLI defaults to 30-day chat retention (its sweep still skips shell_history). |
Enforces owner-only Unix mode (0600 / 0700) |
3 / 9 | 33% | OpenCode (0600 on .db, -wal, -shm), Goose (0700 on sessions/), and Claude Code (0600 on transcripts, with an open gap on workflow journals). Codex locks history.jsonl to 0600 but leaves rollout-*.jsonl at default umask (0644). |
| Uses SQLite WAL where deleted rows can linger | 4 / 10 | 40% | Cursor (state.vscdb), OpenCode (opencode.db), Goose (sessions.db), and Codex (state_5.sqlite, logs_2.sqlite). Without PRAGMA secure_delete = ON and VACUUM, deleted rows remain recoverable in free pages or uncheckpointed -wal frames. |
Check your setup
Paths (macOS): ~/.claude/projects/<proj>/<id>.jsonl, ~/.claude/history.jsonl, ~/.claude/paste-cache/, ~/.claude.json
Offline read-only scan command for your selection:
npx leaktap@0.4.3
Read-only by default, zero telemetry, offline after npm download. On macOS/Linux you can also install via brew install vssinghh/tap/leaktap.
Key Findings
1. Zero of the 10 tools redact pasted secrets before writing to disk
None of the 10 tools scan user prompts or tool stdout for API keys, private keys, or database passwords before persisting conversation logs:
- Codex CLI (
openai/codex): Right before serializing and appending every user prompt to~/.codex/history.jsonl,codex-rs/message-history/src/lib.rs:119contains an unimplemented placeholder:// TODO: check `text` for sensitive patterns. Full session transcripts under~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonllikewise persist raw prompts and tool outputs without secret scrubbing. - Claude Code (
anthropics/claude-code): Anthropic's official.claudedirectory documentation states plainly under Plaintext storage: "Transcripts and history are not encrypted at rest. OS file permissions are the only protection. If a tool reads a.envfile or a command prints a credential, that value is written toprojects/<project>/<session>.jsonl." - Aider (
Aider-AI/aider):aider/main.py:750callsscrub_sensitive_info(args, cmd_line)to scrub startup CLI flags such as--api-key, so startup logs stay clean. However,aider/io.py:740andaider/io.py:1131append raw user prompts and command output directly into.aider.input.historyand.aider.chat.history.mdinside your git repository root. Becauseaider/main.py:163-164offers to add.aider*to.gitignore, those plaintext files stay invisible togit statusand git-only secret scanners while sitting indefinitely in your working tree. - Gemini CLI, Cursor, Cline, OpenCode, Continue, and Goose: All write raw conversation payloads straight into JSONL, JSON, or SQLite tables without secret redaction.
2. Deleting a chat in the UI does not always remove the secret from disk
Even if you realize you pasted a production key and immediately delete the chat in your editor or CLI, shadow copies and unvacuumed SQLite pages can keep the secret on disk:
- Continue (
continuedev/continue): Deleting a conversation in Continue's History UI callsHistoryManager.delete()incore/util/history.ts:60-84, which unlinks~/.continue/sessions/<sessionId>.jsonand updatessessions.json. Separately,gui/src/redux/thunks/streamNormalInput.ts:233-241emits achatInteractionevent carrying the fullpromptandcompletion, andDataLogger.logDevData()incore/data/log.ts:95-106(// Local logs (always on for all levels)) appends it to~/.continue/dev_data/0.2.0/chatInteraction.jsonl. Deleting a session in the UI never touches thatdev_datafile. - Goose (
aaif-goose/goose): Sessions live in SQLite WAL mode at~/.local/share/goose/sessions/sessions.db(session_manager.rs:1104,logs.md:34). Callinggoose session removerunsdelete_session()atsession_manager.rs:2618-2639, which executesDELETE FROM messages WHERE session_id = ?without callingVACUUM. Under upstream SQLite's defaultPRAGMA secure_delete = OFF, deleted payload bytes remain in unzeroed free pages and WAL frames until overwritten or vacuumed. Goose's logs documentation also notes that upgrading pastv1.10.0imports legacy.jsonlsessions intosessions.dbwhile leaving the old.jsonlfiles unmanaged on disk. - Cursor: Standard IDE chats and Composer sessions are stored in
state.vscdb(cursorDiskKVkeys such ascomposerData:*,bubbleId:*, andagentKv:*), alongside plaintext agent runs under~/.cursor/projects/<encoded-path>/agent-transcripts/*.jsonl. Cursor has no automatic size cap or rolling expiration. Deleting a thread from the sidebar can leave orphanedagentKvblobs and free SQLite pages behind until you explicitly runDeveloper: Delete Old Chats...andDeveloper: GC Agent KV Blobsfrom the Command Palette. - Cline (
cline/cline): Cline's storage architecture doc (.clinerules/storage.md) notes that migrating VS Code extension data to the newer unified~/.cline/data/layout intentionally leaves the older VS CodeglobalStorage/saoudrizwan.claude-devdata intact on disk for downgrade safety.
3. Even the two tools with 30-day default retention leave forever-files behind
Seven of the 9 plaintext tools (Codex CLI, Cursor, Cline, Aider, OpenCode, Continue, and Goose) keep local chat history indefinitely by default. Codex CLI spawns a background worker (codex-rs/rollout/src/compression.rs:26,51) that compresses cold rollouts into .jsonl.zst archives rather than expiring them, and defaults history.jsonl to HistoryPersistence::SaveAll with max_bytes: None (codex-rs/config/src/types.rs:241-258).
The only two plaintext tools with automatic 30-day cleanup enabled out of the box still have gaps worth knowing:
- Claude Code:
cleanupPeriodDaysdefaults to30days for~/.claude/projects/<project>/<session>.jsonl,tool-results/, andpaste-cache/. However, Anthropic's.claudedirectory docs explicitly list~/.claude/history.jsonl(every prompt typed across every project, with timestamps and paths) under Kept until you delete them, noting it is only pruned bycleanupPeriodDayswhen HIPAA org configuration applies (tracked in open issueanthropics/claude-code#98575). Project auto-memory (projects/<project>/memory/) and Claude Desktop/Cowork transcripts are also excluded from the default 30-day sweep unlessdesktopSessionCleanupPeriodDaysis set. - Gemini CLI (
google-gemini/gemini-cli): Defaults to 30-day retention (general.sessionRetention.enabled: true,maxAge: "30d"insettingsSchema.ts:401-419, merged viasettings.ts:258and documented insession-management.md:159). That sweep cleanschats/session-*.jsonl,logs/session-*.jsonl, andtool-outputs/(sessionOperations.ts:59-85), while leaving~/.gemini/tmp/<project>/shell_history(storage.ts:480-481) untouched.
4. Unix file permissions range from hardened 0600 (OpenCode) to world-readable 0644
On multi-user Linux workstations, bastion hosts, CI runners, or shared macOS machines, default umask (0022) creates files with mode 0644 (readable by any local user who can traverse the directory):
- Best Unix permission hygiene (OpenCode & Goose): OpenCode runs
restrictToOwner()inpackages/core/src/database/database.ts:86-99on every database open, creating the DB with0o600and explicitly callingchmod(..., 0o600)onopencode.db,opencode.db-wal, andopencode.db-shm. Goose enforces0o700on itssessions/directory insession_manager.rs:1094, blocking other local users from traversing intosessions.db. - Inconsistent permission splits (Codex CLI, Claude Code, Cline):
- Codex CLI enforces
0o600on~/.codex/history.jsonl(lib.rs:149-155), but omits.mode(0o600)when opening~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl(recorder.rs:1717-1721), leaving full session transcripts world-readable (0644, tracked inopenai/codex#21660). - Claude Code creates main session and subagent transcripts with mode
0600, while workflowjournal.jsonlandmeta.jsonomit0600(tracked inanthropics/claude-code#109279). - Cline enforces
0o600on~/.cline/data/secrets.json(storage.md:10), but writes session manifests andmessages.jsonlwithout a mode argument (session-manifest-store.ts:238,atomic-file.ts:31).
- Codex CLI enforces
- Default umask throughout (Gemini CLI, Continue, Aider, Cursor):
chatRecordingService.ts:971,history.ts:131,log.ts:95,aider/io.py:1131, and Cursor's storage files inherit standard OS umask.
5. Windsurf is the one tool of the 10 that encrypts local chat history
To keep this audit fair, Windsurf deserves credit on local transcript confidentiality: Cascade conversations saved under ~/.codeium/windsurf/cascade/*.pb (and rolled-over sessions in ~/.codeium/windsurf/implicit/*.pb) are stored as high-entropy binary Protocol Buffer files encrypted per conversation UUID, not plaintext JSON or SQLite text. Raw grep, text editors, and offline secret scanners (including leaktap) cannot read those .pb transcripts. Plaintext artifacts in Windsurf remain limited to user-authored rules (~/.codeium/windsurf/memories/global_rules.md, .windsurf/rules/), MCP config (~/.codeium/windsurf/mcp_config.json), manually exported trajectories, and standard editor state.
Full 10-Tool Comparison Matrix
| Tool | Primary On-Disk Storage Paths | Format | Redacts? | Default Retention | Unix Mode | Key Verified Gotcha | leaktap v0.4.3 Coverage |
|---|---|---|---|---|---|---|---|
| Claude Code | ~/.claude/projects/<proj>/<id>.jsonl, ~/.claude/history.jsonl, ~/.claude/paste-cache/, ~/.claude.json |
Plaintext JSONL & JSON | No | 30d transcripts, history.jsonl forever | 0600 transcripts (workflow journal.jsonl omits 0600) |
Official docs exempt history.jsonl from cleanupPeriodDays unless HIPAA config applies (#98575). Desktop/Cowork transcripts and auto-memory also exempt. |
Auto-scanned & scrubbed (~/.claude, ~/.claude.json minus login/MCP keys) |
| Codex CLI | ~/.codex/history.jsonl, ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl (+ .zst), ~/.codex/{state_5,logs_2,memories_1}.sqlite |
Plaintext JSONL, .zst, SQLite WAL |
No | Forever (SaveAll, compresses cold rollouts to .zst) |
Split: history.jsonl 0600, rollout-*.jsonl 0644 |
Literal // TODO: check `text` for sensitive patterns at lib.rs:119. Rollouts world-readable (#21660). |
Auto-scanned & scrubbed (plain .jsonl & SQLite, skips .jsonl.zst) |
| Cursor | <AppConfig>/Cursor/User/{global,workspace}Storage/state.vscdb, ~/.cursor/projects/*/agent-transcripts/*.jsonl |
SQLite WAL + plaintext JSONL | No | Forever (no automatic cap or TTL) | Default umask (0644) | Sidebar deletion can leave orphaned agentKv blobs and unvacuumed pages until running Developer: Delete Old Chats... and Developer: GC Agent KV Blobs. |
Auto-scanned & scrubbed (state.vscdb + -wal + ~/.cursor, lock-checked) |
| Gemini CLI | ~/.gemini/tmp/<proj>/chats/session-*.jsonl, logs/session-*.jsonl, tool-outputs/, shell_history |
Plaintext JSONL & text | No | 30d (sessionRetention.enabled: true) |
Default umask (0644) | Strongest default chat expiry among plaintext tools (session-management.md:159), but sweep skips shell_history and sets no 0600 mode. |
Auto-scanned & scrubbed (~/.gemini) |
| Windsurf | ~/.codeium/windsurf/{cascade,implicit}/*.pb, plaintext memories/global_rules.md, mcp_config.json, Windsurf/User/*/state.vscdb |
Encrypted binary .pb (plaintext rules/configs) | N/A for .pb, No for rules/configs |
Rolls older threads to implicit/ (~20 active) |
Default umask (.pb encrypted per UUID) |
Only tool of 10 encrypting chat logs at rest. Plaintext rules, .windsurf/rules/, and mcp_config.json remain unencrypted. |
Auto-scanned for plaintext rules, MCP configs & IDE state (cannot read .pb) |
| Cline | ~/.cline/data/sessions/ (messages.jsonl, manifest.json), tasks/taskHistory.json, legacy VS Code globalStorage/saoudrizwan.claude-dev/tasks/ |
Plaintext JSONL & JSON | No | Forever | Split: secrets.json 0600, sessions 0644 |
VS Code migration copies into ~/.cline/data/ while leaving old VS Code storage intact (storage.md). Session writes omit 0600. |
Auto-scanned for VS Code saoudrizwan.claude-dev, pass ~/.cline/data explicitly for new store |
| Aider | <git-repo-root>/.aider.chat.history.md, <git-repo-root>/.aider.input.history |
Plaintext Markdown & text | CLI flags only | Forever (append-only) | Default umask (0644) | Written inside every git repo root and added to .gitignore (main.py:164). scrub_sensitive_info (main.py:750) does not scrub chat history. |
Auto-scanned & scrubbed in current working directory |
| OpenCode | ~/.local/share/opencode/opencode.db (+ -wal, -shm, respects XDG_DATA_HOME) |
SQLite WAL | No | Forever | 0600 on .db, -wal, -shm | Best Unix permission hygiene among plaintext tools (database.ts:86-99), still unencrypted plaintext in SQLite WAL forever. |
Explicit path: scan ~/.local/share/opencode, pass opencode.db directly to clean |
| Continue | ~/.continue/sessions/<id>.json, ~/.continue/dev_data/0.2.0/chatInteraction.jsonl |
Plaintext JSON & JSONL | No | Forever | Default umask (0644) | UI delete only removes sessions/<id>.json (history.ts:60-84), leaving full prompts forever in always-on dev_data/0.2.0/chatInteraction.jsonl (log.ts:95-106). |
Auto-scanned & scrubbed (~/.continue, including sessions/ and dev_data/) |
| Goose | ~/.local/share/goose/sessions/sessions.db (+ -wal, Windows %APPDATA%\Block\goose\data\sessions\sessions.db) + legacy .jsonl |
SQLite WAL + legacy JSONL | No | Forever | 0700 on sessions/ | Locks sessions/ to 0700 (session_manager.rs:1094), but delete_session() skips VACUUM (L2618-2639) and leaves legacy .jsonl unmanaged. |
Explicit path: scan ~/.local/share/goose/sessions, pass sessions.db directly to clean |
<AppConfig> resolves to ~/Library/Application Support on macOS, ~/.config (or $XDG_CONFIG_HOME) on Linux, and %APPDATA% on Windows.
Pinned Commits & Primary Sources
Every open-source line link in this report is pinned to the exact commit verified on December 3, 2026:
| Tool | Repository / Source | Stars | Verified Commit / Reference |
|---|---|---|---|
| OpenCode | anomalyco/opencode | 230,720 | 1a8580d778bd8ebadd12a66ee0c36790b87ebadb (dev) |
| Claude Code | anthropics/claude-code | 157,942 | Official .claude directory docs, #98575, #109279 |
| Codex CLI | openai/codex | 137,152 | c4c02a3b7aadb7e6ad5b2ad1f27c0851dc80943b (main), #21660 |
| Gemini CLI | google-gemini/gemini-cli | 109,542 | d2d10b90a3213704c77c31b58cbb5669cfdadecd (main) |
| Cline | cline/cline | 72,038 | fa6a3452b84b64cf6b04c59aebdb42f1386c540a (main) |
| Goose | aaif-goose/goose | 57,263 | 60ff58bfce225d74828bf45834d1f8a4e221e67c (main) |
| Aider | Aider-AI/aider | 50,342 | 5dc9490bb35f9729ef2c95d00a19ccd30c26339c (main) |
| Continue | continuedev/continue | 36,610 | 5522c6f44ca0ac3528b37244818fbfa39b5af470 (main) |
| Cursor | Closed-source editor | N/A | Official Cursor docs/forum (state.vscdb cursorDiskKV, agent-transcripts/*.jsonl, Command Palette GC commands) |
| Windsurf | Closed-source editor | N/A | Codeium/Windsurf local Cascade storage (~/.codeium/windsurf/cascade/*.pb per-UUID encrypted protobufs, plaintext rules/MCP configs) |
Practical Hardening Checklist (Built-In Controls First)
You can tighten local secret retention on every tool right now without installing anything extra:
- Claude Code: Lower
cleanupPeriodDaysin~/.claude/settings.json(minimum1, setting0fails validation), setCLAUDE_CODE_SKIP_PROMPT_HISTORY=1in sensitive environments to stop writing transcripts andhistory.jsonl, and periodically prune~/.claude/history.jsonlmanually. - Codex CLI: Add
[history]withpersistence = "none"(or setmax_bytes) in~/.codex/config.toml, and tighten rollout permissions on shared Unix machines withchmod -R go-rwx ~/.codex/sessions. - Cursor: Run
Developer: Delete Old Chats...andDeveloper: GC Agent KV Blobsfrom the Command Palette, and prune~/.cursor/projects/*/agent-transcripts/after sensitive debugging sessions. - Gemini CLI: Shorten
general.sessionRetention.maxAge(for example"7d") in~/.gemini/settings.jsonand clear~/.gemini/tmp/*/shell_historyseparately. - Continue: After deleting sensitive threads in the History UI, also clear
~/.continue/dev_data/0.2.0/chatInteraction.jsonl. - Aider: Pass
--chat-history-file /dev/nullwhen working near credentials, or remove.aider.chat.history.mdand.aider.input.historyfrom project directories. - Goose & OpenCode: After deleting a sensitive session, compact the database with
sqlite3 ~/.local/share/goose/sessions/sessions.db "VACUUM;"(oropencode.db) while the tool is closed so deleted pages and-walframes are cleared. On Goose, also check~/.local/share/goose/sessions/for unmanaged pre-v1.10.jsonlfiles. - Cline: Tighten permissions on
~/.cline/data/sessions(chmod -R go-rwx ~/.cline/data/sessions) and remove legacy VS CodeglobalStorage/saoudrizwan.claude-dev/tasks/if you migrated to~/.cline/data/.
Audit and Scrub Your Own Machine
If you do not want to dig through hundreds of JSONL logs and SQLite -wal files by hand, run leaktap (v0.4.3, single 6 to 8 MB MIT Rust CLI, zero telemetry, offline after download):
# 1. Read-only scan across the 8 auto-discovered tools (Claude Code, Codex, Cursor,
# Gemini CLI, Windsurf configs/rules, VS Code Cline, Aider, Continue) + MCP configs
npx leaktap@0.4.3
# 2. Scan OpenCode, Goose, and Cline's newer ~/.cline/data directory explicitly
npx leaktap@0.4.3 scan ~/.local/share/opencode ~/.local/share/goose/sessions ~/.cline/data
# 3. Preview local log and SQLite redactions (dry run, modifies nothing), then scrub in place
npx leaktap@0.4.3 clean
npx leaktap@0.4.3 clean --apply
# 4. Scrub explicit SQLite databases outside default auto-discovery (pass the .db file directly)
npx leaktap@0.4.3 clean ~/.local/share/opencode/opencode.db
npx leaktap@0.4.3 clean ~/.local/share/opencode/opencode.db --apply
npx leaktap@0.4.3 clean ~/.local/share/goose/sessions/sessions.db --apply
leaktap v0.4.3.Pass --backup with --apply only if you want 0600 .leaktap.bak copies before editing (off by default so raw secrets are not left behind in backup files). On macOS or Linux you can also install once with brew install vssinghh/tap/leaktap and run leaktap directly instead of npx leaktap@0.4.3.
Honest limitations: leaktap v0.4.3 cannot inspect Windsurf's encrypted .pb Cascade files or decompress Codex CLI's cold .jsonl.zst archives on disk. Close open editors before running clean --apply on state.vscdb, opencode.db, or sessions.db (if a database holds an active lock, leaktap skips it safely rather than risking corruption). Scrubbing local disk only cleans up local exposure. Rotate any credential that was already sent to a model API or pushed to git.