# Where Cursor stores your chat and agent history

> Cursor keeps every editor chat in one SQLite file, state.vscdb, and the CLI in ~/.cursor/chats. The path per OS, what the tables hold, and how to read it safely.

Canonical: https://ranwhat.com/guides/cursor-chat-history
Last updated: 2026-11-16

The chat where Cursor's agent ran that migration is gone from the sidebar, and you want to know exactly what it did. It is still on your disk: Cursor keeps every editor chat, with each tool call and its result, in one SQLite database. Cursor publishes no storage format, so this is what ranwhat's reader found in it, with the caveats.

```
$ uvx ranwhat watch --source cursor
```

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

Paths and keys are the ones ranwhat's Cursor reader uses, checked against a real Cursor 3.6 session and the open-source readers under Sources. Published 16 November 2026.

## Where does Cursor store chat history?

In one SQLite database, `Cursor/User/globalStorage/state.vscdb`, in your system's application data folder.

- **macOS**: `~/Library/Application Support/Cursor/User/globalStorage/state.vscdb`
- **Linux**: `~/.config/Cursor/User/globalStorage/state.vscdb`, or under `$XDG_CONFIG_HOME`
- **Windows**: `%APPDATA%\Cursor\User\globalStorage\state.vscdb`
- **CLI**: `~/.cursor/chats/<md5 of the folder>/<agentId>/store.db`, and `~/.cursor/acp-sessions/<id>/store.db` with a `meta.json` that names the folder

Cursor ignores VS Code's `VSCODE_PORTABLE` and `VSCODE_APPDATA`, so these paths hold even when you moved VS Code's. The per-workspace `workspaceStorage/*/state.vscdb` files hold no chats any more: since the composer replaced the old chat panel, their chat table is empty.

## Where does the Cursor CLI store its sessions?

One SQLite file per session, `~/.cursor/chats/<md5 of the folder>/<agentId>/store.db`.

The folder name is the MD5 hash of the directory you ran `cursor-agent` in, so `ls ~/.cursor/chats` shows hashes, not project names. ACP sessions are under `~/.cursor/acp-sessions/<id>/`, with `meta.json` beside the database naming the folder. Messages sit in a `blobs` table as JSON, with each tool call and its result; a shell result is the text `Exit code: N` followed by the output. CLI messages carry no time of their own.

## What is in Cursor's state.vscdb?

Chats are rows in the `cursorDiskKV` table, each value a UTF-8 JSON document.

- **`composerData:`**: One row per chat: `composerData:<composerId>`, with `createdAt`, `lastUpdatedAt` and, when it has one, the workspace.
- **`bubbleId:`**: One row per message: `bubbleId:<composerId>:<bubbleId>`. A tool call is its `toolFormerData`, with the arguments and the result in the same row.
- **`composer.content.`**: The raw text of a file before or after an agent's edit.
- **Chat list**: In the other table, `ItemTable`, under `composer.composerHeaders`: every chat with its workspace.
- **Also there**: `ItemTable` is VS Code's shared state: Cursor's own login and other extensions' tokens live in it too. Never share or upload this file.

The database can grow to gigabytes, because every chat, every message and the file contents of every edit are in it. Bubbles that a rewind or an edit dropped from a chat are still rows: what they ran, ran. All of this is undocumented and can change with a Cursor update.

## How do I read Cursor chat history myself?

Copy the database and its `-wal` file, then open the copy read-only with `sqlite3`.

```
# macOS; on Linux use ~/.config/Cursor/User/globalStorage
cd ~/Library/Application\ Support/Cursor/User/globalStorage
mkdir -m 700 ~/cursor-copy
cp state.vscdb state.vscdb-wal ~/cursor-copy/ 2>/dev/null

# how many chats
sqlite3 -readonly ~/cursor-copy/state.vscdb \
  "SELECT count(*) FROM cursorDiskKV WHERE key >= 'composerData:' AND key < 'composerData;'"

# done: the copy holds your Cursor login too
rm -r ~/cursor-copy
```

A running Cursor keeps its newest rows in `state.vscdb-wal`, so copy both. The key range in the query uses the table's index, which matters on a large file; a `LIKE` would scan every row. Never write to the live database.

## How do I see what Cursor's agent ran?

Run `uvx ranwhat watch --source cursor`: it reads both stores read-only and lists the risky calls.

- **Reads**: The editor's `cursorDiskKV` chats, the chat list, and every CLI `store.db`. Never the backup or corrupted copies beside `state.vscdb`.
- **Skips**: `ItemTable` apart from the chat list, which is never searched for secrets; Cursor's `auth.json` and `mcp.json`. Encryption keys stored in a chat are dropped as soon as they are read.
- **Declined**: A call you rejected or cancelled is told apart from one that ran, from what its record says.
- **Secrets**: `uvx ranwhat clean --source cursor` reports credentials in Cursor's chats. It does not mask them: ranwhat never writes to Cursor's databases.

## How do I delete Cursor chat history?

Delete the chat in Cursor itself; Cursor documents no retention period, so nothing expires on its own.

Deleting `state.vscdb` removes far more than chats: it is the editor's shared state, login included. For the CLI, remove the session folders under `~/.cursor/chats`. If a chat showed a credential, rotate it at the provider first: deleting your copy does not undo that it was readable, as [rotating a leaked key](https://ranwhat.com/guides/rotate-leaked-api-key-ai-agent) explains.

## Common questions about Cursor chat history

### Does Cursor save chat history locally?

Yes. Every editor chat is saved in `state.vscdb` in Cursor's application data folder, and CLI sessions in `~/.cursor/chats`. Cursor publishes no retention period for either.

### Is Cursor chat history encrypted?

The chat values ranwhat reads are plain JSON inside SQLite, so file permissions are the only protection. Anything running as you can read them, and so can whatever backs up your home folder.

### Where are Cursor chats for one project?

In the same global database. Each chat records its workspace, and `composer.composerHeaders` lists every chat with it; `workspaceStorage/<id>/workspace.json` maps a workspace id to its folder.

### Why is Cursor's state.vscdb so large?

It holds every chat, every message and the before and after text of every file the agent edited, in one file.

## Sources

- [ranwhat source: cursor.pyevery path, table and key above, and what is never read](https://github.com/MatijaMiki/ranwhat/blob/main/ranwhat/sources/cursor.py)
- [empathic/toolpatha real Cursor 3.6 session and its format notes](https://github.com/empathic/toolpath)
- [kkrlstrm/cursor-loggeran open-source reader, checked to Cursor 3.21](https://github.com/kkrlstrm/cursor-logger)
- [S2thend/cursor-historynotes on the CLI's store](https://github.com/S2thend/cursor-history)

## Related guides

- [Where AI coding agents keep historyevery other agent's store](https://ranwhat.com/guides/ai-coding-agent-history-locations)
- [Codex session historythe same question for Codex](https://ranwhat.com/guides/codex-cli-session-history)
- [AI coding agent security checklistevery other control, in order](https://ranwhat.com/guides/ai-coding-agent-security)
- [All guideseverything in this section](https://ranwhat.com/guides)
