Claude Code deletes your local session transcripts after 30 days by default. That is the cleanupPeriodDays setting, and most people only find out after a chat they needed is gone.
Months of my real work live in AI conversations: architecture decisions, long debugging sessions in Claude Code, and product ideas I worked out late at night in ChatGPT. That history was spread across Claude Code, Codex, Gemini CLI, ChatGPT and claude.ai, each with its own format and retention rules. None of it was really mine.
Everyone says to export your history regularly. I never did, and I doubt you do either. So I built a tool that does it for me, and made it open source.
Meet ChatVault
ChatVault is an open source plugin (MIT) that backs up your AI conversations automatically into a folder you own. It runs on a schedule you choose and writes everything in one open format that any agent, script or person can read.
It works with:
- Claude Code, including subagent sessions
- OpenAI Codex CLI
- Gemini CLI
- ChatGPT and claude.ai, through their official data exports
On my machine, the first run saved 83 sessions, about 13,000 messages and 37 MB of history.
How it works
1. One open format for every AI tool
Each source has a small adapter that reads that agent's local session files or the vendor's export zip. Every adapter converts the data into the Open Chat Archive (OCA v1) format: simple JSON where a conversation holds messages, and each message holds blocks (text, thinking, tool calls, tool results). A Markdown copy is saved next to every JSON file, so you can open your history in any editor or in Obsidian.
2. Automatic backups you never think about
ChatVault installs as a plugin. Session hooks run a quiet, non-blocking backup when an agent session starts or ends. For the hours when no agent is open, an optional OS scheduler (launchd, cron or Task Scheduler) takes over. You pick the frequency: after each session, hourly, daily, weekly or manual.
3. Nothing is ever lost
The vault only grows. If a conversation upstream gets shorter or disappears, ChatVault keeps the fuller version. Backups are incremental, so they are fast. Turn on git and every backup that changes something becomes a commit, giving you full history and point-in-time restore.
4. Search your history from any agent
ChatVault ships an MCP server with tools like search_history, get_conversation and list_conversations. Cursor can search something you discussed in Claude Code, and Gemini can pull up an idea you worked out in ChatGPT. Your context is no longer locked inside one vendor.
5. Private by default
Everything stays on your machine unless you add a private git remote or point the vault at iCloud or Dropbox. Common API key formats (OpenAI, Anthropic, GitHub, AWS, Slack and others) are redacted before anything is written.
6. Zero dependencies
Plain Node 18 or later. No npm install, no supply chain surprises.
Get started
In Claude Code:
/plugin marketplace add alphasr/chatvault
/plugin install chatvault@chatvault
Anywhere else:
npx chatvault init
npx chatvault schedule install
The first command creates your vault at ~/ChatVault and runs the first backup. The second adds an OS job so backups run even when no agent is open. There are also manifests for Codex, Cursor and Gemini CLI.
For ChatGPT and claude.ai, request your data export once a month and leave the zip in Downloads. ChatVault finds it and imports it on the next run, writing only new and changed conversations.
Why open source
Owning your data only works if the format is open. A backup that needs one company's tool to read it just moves the lock-in somewhere else. OCA v1 is documented in the repo, and every file in the vault can be read without ChatVault.
Adapters for Cursor, Windsurf, Copilot Chat, Cline and Aider are open for contributions. If you use one of those tools, a PR is very welcome.
Your conversations hold your decisions and fixes, so you should keep your own copy.
⭐ GitHub: github.com/alphasr/chatvault
📦 npm: npmjs.com/package/chatvault
How do you keep your AI history today, or do you?
Top comments (0)