Claude Code deletes CLI and VS Code transcripts after 30 days by default (cleanupPeriodDays).
It also files them under your folder path as raw JSON, which is not something you want to grep when you are looking for "that thing we decided three weeks ago".
I wanted a permanent, readable copy of every chat, so I built a plugin: session-archive.
What it does
One folder per chat:
<archive>/<project>/<YYYY-MM-DD_HHMM>_<id>/
chat.md the conversation as you saw it, with tool calls and images inline
meta.json title, branch, model, dates, counts
raw/ byte-exact transcript, subagents, tool results
artifacts/ every version of every file Claude wrote or edited
attachments/ every image shown in the chat
It runs from hooks, so it costs zero model tokens.
It works in the CLI, the VS Code extension and the Code tab of the Claude desktop app.
Install
claude plugin marketplace add singhAmandeep007/claude-session-archive
claude plugin install session-archive@claude-session-archive --config archive_dir=~/claude-archive
Then start a new session. That is it.
Point archive_dir at any folder you like. A cloud-synced folder works too, which gives you a backup for free.
You need Python 3.9+ as python3 and git on your PATH. Nothing to pip install.
Two commands
-
/session-archive:savesaves the current chat now./session-archive:save allarchives every chat still on disk. -
/session-archive:importrestores archived chats byte-exact into Claude Code, soclaude --resumeworks on a chat that was already deleted. It never overwrites a live transcript that differs.
The part I got wrong at first
My first version answered those slash commands from a hook.
Hooks can only answer a command by blocking it, and Claude Code always shows a blocked prompt as a warning: "A hook blocked your prompt".
It worked perfectly and looked like an error every single time.
Version 1.6.0 fixes that with a Claude Code mod (hooks/register.ts, Claude Code 2.1.287 or newer).
A mod can answer a command directly, so the report shows up as normal command output, still without a model turn.
Older Claude Code versions keep using the hook path.
Small things that matter
- Saves after a reply run at most every 10 minutes per session (
min_sync_minutes), because cloud-synced folders re-upload whole files and transcripts get big. - Each session only ever gets one folder, even if you start it outside a repo and move into one later.
- A damaged transcript (bad bytes, record shapes it does not know) is skipped record by record instead of stopping the archive.
Tested
The repo has 81 Python behavior tests (import edge cases, damaged transcripts, odd paths, parallel saves) plus 6 tests for the mod.
GitHub Actions runs them on Linux and macOS with Python 3.9 and 3.13 on every push and pull request.
Try it
- Repo and README: https://github.com/singhAmandeep007/claude-session-archive
- Release notes: https://github.com/singhAmandeep007/claude-session-archive/releases/tag/v1.6.0
If you hit a bug, especially on Windows (best effort, untested), open an issue.
I would like to know what breaks.



Top comments (0)