# Where each AI coding agent keeps your conversation history

> Where Claude Code, Codex, Gemini CLI, Copilot CLI, Cursor, Aider, Windsurf, Cline and Continue keep chat history on disk, its format, and how to clear it.

Canonical: https://ranwhat.com/guides/ai-coding-agent-history-locations
Last updated: 2026-10-20

Claude Code, Codex, Gemini CLI, Copilot CLI, Cursor, Aider, Windsurf, Cline and Continue all record your sessions on your own disk. Where each one puts them, what format they are in, how long they stay, and how to see how much you have.

```
$ uvx ranwhat sources
```

[Install](https://ranwhat.com/install)

```
$ uvx ranwhat sources
```

Paths are the ones ranwhat reads, checked against vendor documentation where it exists (see Sources). Published 20 October 2026.

## Where each agent keeps its sessions

Most terminal agents write one file per session under a dot folder in your home directory. Editor-based agents tend to use a database inside the editor's own data folder. On Windows, `~` is `%USERPROFILE%`.

| Agent | Where | Format | Retention |
| --- | --- | --- | --- |
| **Claude Code** | `~/.claude/projects/<project>/<session-id>.jsonl` | JSONL | 30 days by default. [Full guide](https://ranwhat.com/guides/claude-code-history) |
| **Codex** (CLI, IDE extension, desktop app) | `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl`, `archived_sessions/` and `history.jsonl`, or under `$CODEX_HOME` | JSONL, one thread per file; `.jsonl.zst` once a thread has been idle for a week | None documented for sessions. `history.max_bytes` caps the file the docs name |
| **Gemini CLI** | `~/.gemini/tmp/<project>/chats/`, or under `$GEMINI_CLI_HOME` | JSONL (v0.39.0 and later), JSON before that | 30 days by default (`general.sessionRetention`) |
| **GitHub Copilot CLI** | `~/.copilot/session-state/<session-id>/events.jsonl`, or under `$COPILOT_HOME` | JSONL | None documented; removal is manual |
| **Cursor** (editor and `cursor-agent`) | `Cursor/User/globalStorage/state.vscdb` under `~/Library/Application Support` (macOS), `~/.config` (Linux) or `%APPDATA%` (Windows); and `~/.cursor/chats/*/*/store.db` | SQLite, undocumented | None documented |
| **Windsurf** | `~/.codeium/windsurf/cascade/*.pb`, and `~/.windsurf/transcripts/*.jsonl` when its transcript hook is on | Encrypted protobuf; JSONL for the hook copy | The hook copy keeps the newest 100 files |
| **Cline** | `<editor>/User/globalStorage/saoudrizwan.claude-dev/tasks/<task>/`, and `~/.cline/data` | JSON | None documented |
| **Roo Code** | `<editor>/User/globalStorage/rooveterinaryinc.roo-cline/tasks/<task>/` | JSON, text | None documented |
| **Continue** (IDE and `cn`) | `~/.continue/sessions/<session>.json`, or under `$CONTINUE_GLOBAL_DIR` | JSON | None documented |
| **Aider** | `.aider.chat.history.md` and `.aider.input.history` in the repository you ran it in, or the folder you ran it from | Markdown, plain text | None; every session is appended to the same file |

`<editor>` is the editor's data folder, such as `Code` for VS Code, under the same parent as Cursor's above. **None documented** means the vendor publishes no retention period that ranwhat or this page could find, not that nothing is ever deleted. Cursor, Windsurf and Cline publish no storage format, so what ranwhat reads there was worked out from open-source readers and real dumps, and can change with an update.

ranwhat also reads Antigravity, GitHub Copilot in VS Code, Kilo Code, OpenCode, Goose, Zed, Warp, Amazon Q, Qwen Code, CodeBuddy, Grok Build, Droid, Kimi Code, Kimi CLI, Pi, Oh My Pi, Muse Code, Mistral Vibe, DeepSeek Harness and OpenClaw. The [README](https://github.com/MatijaMiki/ranwhat#ranwhat-watch-audit-what-claude-code-and-your-other-agents-ran) has each path.

## What is in them

More than the chat. A session file is a record of everything the agent saw and did: your prompts, the contents of every file it opened, the output of every command it ran, and anything you pasted. If the agent ran `cat .env`, the values are in the file.

- **Prompts**: What you typed, with timestamps. Codex also keeps typed prompts in `history.jsonl`, and Aider in `.aider.input.history`.
- **Files read**: Tool results hold file contents. Windsurf's transcript steps record the content of each file viewed and the before and after text of each edit.
- **Command output**: Shell output is stored with the call that ran it. Large outputs can spill to separate files: Copilot CLI and Roo Code both do this.
- **Secrets**: Anything in the three above that was a credential. A key you pasted to ask for help is in the file the same way as one printed by a command.
- **Codex extras**: A snapshot of your shell's exported variables under `shell_snapshots/`, and a SQLite index of threads.

### Why plaintext matters

Apart from Windsurf's Cascade files, which are encrypted, ranwhat reads every store in the table as plain JSON, text or SQLite, so file permissions are the only protection. Anything that runs as you can read them, and so can whatever backs up or syncs your home folder. Aider is the odd one out: its history sits in the repository, so a careless `git add .` can commit it. A secret printed once by a tool can sit in several of these files, for as long as the tool keeps them. For what infostealers now collect, see [the Claude Code history guide](https://ranwhat.com/guides/claude-code-history), and for the wider habits, [Developer OPSEC](https://ranwhat.com/guides/developer-opsec).

## How much you have on your machine

A folder that does not exist means that agent is not on this machine, or keeps its history somewhere else. Each command below prints a size.

```
# Claude Code, Codex, Gemini CLI, Copilot CLI, Continue
du -sh ~/.claude/projects
du -sh ~/.codex/sessions ~/.codex/archived_sessions ~/.codex/history.jsonl
du -sh ~/.gemini/tmp/*/chats
du -sh ~/.copilot/session-state
du -sh ~/.continue/sessions

# Windsurf
du -sh ~/.codeium/windsurf/cascade ~/.windsurf/transcripts

# Cursor on macOS (Linux: ~/.config/Cursor/User/globalStorage)
du -sh ~/Library/Application\ Support/Cursor/User/globalStorage/state.vscdb ~/.cursor/chats

# Cline and Roo Code in VS Code on macOS (Linux: ~/.config/Code/User/globalStorage)
du -sh ~/Library/Application\ Support/Code/User/globalStorage/saoudrizwan.claude-dev/tasks
du -sh ~/Library/Application\ Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/tasks

# Aider leaves its files in each repository, so look for them
find ~ -maxdepth 4 -name '.aider*history*' 2>/dev/null
```

`ls -lt` on a folder shows the newest first. On Windows, use the same folders under `%USERPROFILE%` and `%APPDATA%`. Cursor's database holds every chat in one file, so its size is the total, not one project's.

## How to limit or delete them

Only some of these agents give you a setting. For the rest, the history is a file or a database you delete yourself.

- **Claude Code**: `cleanupPeriodDays`, and `claude project purge`. Both are in [the Claude Code history guide](https://ranwhat.com/guides/claude-code-history).
- **Gemini CLI**: Set `general.sessionRetention` in `settings.json`: `enabled`, `maxAge` (default `"30d"`), `maxCount` and `minRetention` (default `"1d"`). Deleting a session removes its tool outputs and logs too.
- **Codex**: The docs give `[history] persistence = "none"` in `config.toml` to stop saving history, and `history.max_bytes` to cap it. They do not say whether the rollout files under `sessions/` follow it, so check the folder after a new session. To delete, remove the files.
- **Copilot CLI**: Deleting `~/.copilot/session-state/` removes the history and you can no longer resume those sessions. Synced sessions are stored separately: delete or hide them on GitHub.com.
- **Cursor**: Delete the chat in Cursor. ranwhat reads these databases and never writes to them.
- **Windsurf**: Remove `~/.windsurf/transcripts/` and turn the hook off. The encrypted Cascade files are Windsurf's own.
- **Cline, Roo, Continue**: Delete the task folders or session files you no longer need.
- **Aider**: Delete `.aider.chat.history.md` and `.aider.input.history`. `AIDER_CHAT_HISTORY_FILE` and `AIDER_INPUT_HISTORY_FILE` move them.

Deleting a file removes your local copy and nothing else. What the model provider kept is governed by your account's terms with that provider. If a session held a credential, rotate it first, then decide whether to delete or mask.

## Let ranwhat list what it can find

`sources` prints every agent ranwhat reads, the folders it checked on this machine, and whether it found any history there. It changes nothing and does not read the contents.

```
$ uvx ranwhat sources
```

[Install](https://ranwhat.com/install)

To see what is inside, run `uvx ranwhat check`. It reads the sessions of every agent it finds and lists the risky actions and the credentials sitting in the files, each with the agent and project. It reads files, and rewrites nothing unless you then run [ranwhat clean](https://ranwhat.com/clean) with `--apply`. `clean` masks a value only in a plain JSONL, JSON or text file; for the databases (Cursor, OpenCode, Goose and others) it reports and leaves them untouched.

```
ranwhat sources                   where it looked, what it found
ranwhat check                     actions and secrets, nothing changed
ranwhat check --source codex      one agent (repeatable)
ranwhat check --path codex=~/work/.codex   history kept somewhere else
```

The default window is 30 days (`--days`). Zero found is not a clean machine: `sources` tells you whether the folder was missing or empty.

## Next

- [Claude Code historythe full detail for the first row of the table](https://ranwhat.com/guides/claude-code-history)
- [Claude Code and .env secretskeeping credentials out of transcripts](https://ranwhat.com/guides/claude-code-env-secrets)
- [Developer OPSECthe rest of your laptop](https://ranwhat.com/guides/developer-opsec)
- [AI coding agent securitythe wider checklist](https://ranwhat.com/guides/ai-coding-agent-security)

## Sources

Paths and formats are as ranwhat reads them, from its source. Where a vendor documents a location or setting, that page is listed. Cursor, Cline, Roo Code, Continue and Windsurf's encrypted files have no vendor page for storage, so no retention is claimed for them.

- [Gemini CLI: session managementchats folder, general.sessionRetention and its defaults](https://geminicli.com/docs/cli/session-management/)
- [Codex: advanced configurationCODEX_HOME, history persistence, history.max_bytes](https://learn.chatgpt.com/docs/config-file/config-advanced)
- [Copilot CLI: config directory referencesession-state, COPILOT_HOME, deletion and synced sessions](https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-config-dir-reference)
- [Aider: options referencehistory file names and their environment variables](https://aider.chat/docs/config/options.html)
- [Windsurf: Cascade hookstranscript path, JSONL, 0600, 100 file cap](https://docs.devin.ai/desktop/cascade/hooks)
- [Continue: FAQsthe ~/.continue data folder](https://docs.continue.dev/faqs)
- [ranwhat READMEthe table of agents, paths and formats](https://github.com/MatijaMiki/ranwhat#ranwhat-watch-audit-what-claude-code-and-your-other-agents-ran)
- [cursor.pyCursor databases and how they were checked](https://github.com/MatijaMiki/ranwhat/blob/main/ranwhat/sources/cursor.py)
- [codex.pyrollout files, .zst, history.jsonl, SQLite](https://github.com/MatijaMiki/ranwhat/blob/main/ranwhat/sources/codex.py)
- [gemini.pyJSONL and JSON layouts, 30 day default](https://github.com/MatijaMiki/ranwhat/blob/main/ranwhat/sources/gemini.py)
- [copilot_cli.pyevents.jsonl and tool output files](https://github.com/MatijaMiki/ranwhat/blob/main/ranwhat/sources/copilot_cli.py)
- [windsurf.pyencrypted Cascade files, hook transcripts](https://github.com/MatijaMiki/ranwhat/blob/main/ranwhat/sources/windsurf.py)
- [cline.pytask folders and the Cline data folder](https://github.com/MatijaMiki/ranwhat/blob/main/ranwhat/sources/cline.py)
- [roo.pyRoo Code task folders, command output files](https://github.com/MatijaMiki/ranwhat/blob/main/ranwhat/sources/roo.py)
- [continue_dev.pysession files and CONTINUE_GLOBAL_DIR](https://github.com/MatijaMiki/ranwhat/blob/main/ranwhat/sources/continue_dev.py)
- [aider.pyhistory file locations and format](https://github.com/MatijaMiki/ranwhat/blob/main/ranwhat/sources/aider.py)

## Related guides

- [Claude Code historylocation, retention, deletion](https://ranwhat.com/guides/claude-code-history)
- [Claude Code and .env secretskeeping credentials out of transcripts](https://ranwhat.com/guides/claude-code-env-secrets)
- [Developer OPSECthe laptop around the agent](https://ranwhat.com/guides/developer-opsec)
- [AI coding agent securitythe wider picture](https://ranwhat.com/guides/ai-coding-agent-security)
- [All guideseverything in this section](https://ranwhat.com/guides)
