AI;DR – Implementing these tools and writing this blog post were done mostly by Claude Code. If you don’t want to read “AI slop”, stop reading now.
I use Claude Code a lot, in many different project directories. After a few weeks I had dozens of sessions, and quite often I wanted to get back to one of them but no longer remembered what exactly it was about, let alone in which project directory I had started it. Without that, claude --resume does not help much.
So I built claude-session-log: a small set of Claude Code extensions that keep a log of every session in one place, searchable across all projects, and let you jump straight back into a session from there.
The idea for this came from a skill written by TigerLilly, posted in this post on the German Delphi Praxis.
Note: This runs only on Linux and under WSL. macOS would need some adapting, and Claude Code running natively on Windows is not covered. See Requirements and installation below before you read on.
What it consists of
- An
/exitskill that replaces the built-in/exit. Before you leave, Claude writes a short summary of the session into the project and adds a line to a global index. - A SessionEnd hook that runs whenever a session ends, however you leave it. It catches the sessions you did not close with
/exit. - A
/discardskill for the sessions that are not worth remembering. - A
sessionscommand to search the index and resume a session.
Closing a session with /exit
A personal skill in Claude Code replaces a built-in command of the same name, but not its aliases. So when the skill is installed as exit, typing /exit runs the skill, while /quit still exits the CLI.
The skill does two things:
- It writes an entry at the top of
_Sessions/<session name>.mdin the project directory: date and time, a few sentences on goal and result, what was done (with the files changed) and what is still open. You can add a note:/exit remember to test the 64 bit build. - It adds a line to the index, a single Markdown file shared by all projects. By default that is
~/.claude/Sessions.md; the installer’s--indexoption puts it elsewhere, e.g. on the Windows side when you use WSL:
- 2026-11-29 13:28 | /home/me/src/webshop | webshop-login | Webshop login: session timeout fixed in auth.py, remember-me cookie still open | 6006b859-... | /home/me/src/webshop/_Sessions/webshop-login.md
Date, project directory, session name (the one given with /rename), a one sentence summary, the session ID and the path of the detailed log. The session ID is what claude --resume needs.
A skill cannot end the CLI session itself, so it finishes with “Now type /quit.” That second step is the price for getting a summary.
The hook catches the rest
Of course I do not always remember to use /exit. Ctrl+D, Ctrl+C, /clear or plain /quit skip the skill. For those, the SessionEnd hook writes a line without a summary, but with the project directory, the session name or Claude’s automatically generated title, and the first thing I typed in that session. That is usually enough to recognize it.
The hook and the skill must not get in each other’s way. The rule is structural: the hook’s lines end with | - because there is no detailed log, the skill’s lines end with the path of the log. At every session end the hook removes its own earlier lines for that session and adds a fresh one, unless the skill has already written a line. So a session has either one up to date hook line or the skill’s lines, never both.
Sessions that should not be logged
Some sessions are just quick questions. /discard followed by /quit leaves no trace in the index: the skill sets a marker, and when the session ends, the hook sees the marker, writes nothing and removes any line it wrote for that session earlier.
Finding a session again
sessions is an interactive picker in the terminal:
sessions all sessions sessions webshop login only those matching all words sessions -l webshop print a list instead sessions -r 2 webshop resume match 2 directly
The search words must all occur, in any case, either in the index line or in the session’s detailed log. Matches are highlighted in yellow. Up/Down, PgUp/PgDn and Pos1/End move the selection, the details of the selected session (full summary, project, log file) are shown below the list. Enter changes into the project directory and runs claude --resume for that session. d removes a session from the index, Esc or x exits.
Importing older sessions
Sessions from before the installation are not in the index, but Claude Code keeps the transcripts of past sessions in ~/.claude/projects. sessions --import reads them and adds every session that is not yet in the index, with the same kind of line the hook writes. On my machine it found and added 95 sessions in about 5 seconds. Sessions removed with d or closed with /discard are on an exclusion list, so the import does not bring them back.
Tip: Claude Code deletes old transcripts
While writing the import I found out that Claude Code deletes session transcripts after 30 days by default. After that, the session can no longer be resumed. The setting is cleanupPeriodDays in ~/.claude/settings.json. It cannot be switched off, but it can be set to a large value:
"cleanupPeriodDays": 3650
Transcripts take some disk space though: my roughly 100 sessions use about 950 MB.
Requirements and installation
It runs on Linux and under WSL. It needs bash, jq, flock, unix2dos and Python 3 with the curses module. On Debian or Ubuntu:
sudo apt install jq util-linux dos2unix python3
A word of warning: install.sh changes your Claude Code settings, and the hook then runs at the end of every session. Never execute code you found on the internet, this one included, without checking it first (or at least let Claude check it).
Installation:
unzip claude-session-log-2.0.zip cd claude-session-log bash install.sh
The installer checks the requirements, copies the files, and adds the hook to ~/.claude/settings.json, keeping everything else in that file and making a backup first. bash install.sh --uninstall removes it again. The README in the zip describes everything in detail, including what has been tested and what has not.
macOS would need some adapting: the hook uses bash 4 syntax, macOS ships bash 3.2, and it has no flock. Claude Code running natively on Windows (not in WSL) is not covered.
Download: claude-session-log-2.0.zip
old 1.0 version, same as in the DelphiPraxis post: claude-session-log-skill.zip
This is version 2.0. The README in the zip lists what changed since version 1.0, which I attached to my post on the German Delphi Praxis. To update, unpack the new zip and run bash install.sh again.
Discussion about this in the corresponding post in the international Delphi Praxis forum.