Claude Code deletes your session transcripts after 30 days.
This archives them permanently — and makes them beautiful to read.
😱 The problem
Claude Code writes every conversation to ~/.claude/projects/*.jsonl, then silently deletes anything older than cleanupPeriodDays — which defaults to 30.
That research session where you finally cracked the architecture? The debugging marathon with the fix you'd never reconstruct? Gone, with no warning and no undo.
✨ The fix
uv tool install lastword-cc # or: pipx install lastword-cc
lastword # archive everything Claude Code still has
lastword open # browse it
That's the whole setup — Python 3.9+, zero dependencies, zero network calls. The package is lastword-cc (cc for Claude Code); the command it installs is lastword. Want to try it without installing? uvx --from lastword-cc lastword. Upgrade later with uv tool upgrade lastword-cc.
Every later run picks up what's new and leaves the rest alone. Once a conversation is archived, it stays — even after Claude Code deletes the original.
👀 See it before you run it
Don't want to point it at your own chats yet? Build a demo archive from invented transcripts:
lastword demo --open
That builds eight fictional sessions in a temp folder, rendered by the same code that renders a real archive. Nothing in it touches ~/.claude. It's also the right way to grab screenshots or check a UI change without exposing your own work.
🖥️ What you get
📚 A browser for everything
Run lastword open for a two-pane reader: sessions grouped by Today / Yesterday / Earlier this week, live filtering, and full keyboard navigation — / to search, ↑↓ or jk to move, Esc to clear. Light and dark themes, remembered between visits.
💬 Conversations that read like conversations
Messages render as actual prose — headings, lists, tables, and syntax-styled code — not walls of preformatted text. Three lanes stay visually distinct so you always know who said what:
| Lane | Appearance |
|---|---|
| 🧑 You | Filled card with an accent border — the thing you scan for |
| 🤖 Claude | Clean prose, unadorned |
| ⚙️ Tools | Muted monospace folds, collapsed by default, each showing its own output |
Tool results are nested inside the call that produced them — so a 500-turn session scans in seconds, and nothing machine-generated is ever mislabelled as something you typed.
🔍 Search that actually finds things
index/search.html does instant client-side search across every turn, bash command and file edit — filter by type, jump straight to the moment in the conversation. No server, no index to build.
📦 Plain files underneath
Everything is JSON and Markdown you can grep, diff, or feed to other tools. Paths are relative to the archive home (lastword where):
| Path | Contents |
|---|---|
sessions/<project>/<id>/ |
source.jsonl, conversation.md, conversation.html |
index/session_index.{json,md} |
One row per session — title, project, duration, links |
extracts/tool_invocations.{json,md} |
Every tool call, matched with its result |
extracts/file_modifications.{json,md} |
Every Edit / Write / MultiEdit / NotebookEdit |
extracts/bash_commands.{json,md} |
Every Bash call with stdout and stderr |
extracts/architectural_decisions.{json,md} |
Heuristically surfaced decision points |
timeline/timeline.{json,md} |
All of the above, merged and sorted by date |
source.jsonl is a byte-for-byte copy of Claude Code's transcript, the archive of record; everything else is rebuilt from it. Session UUIDs and original timestamps survive everywhere — filenames, table rows, HTML anchors.
Note —
architectural_decisionsis a heuristic (plan proposals,AskUserQuestionpoints, decision language). Read it for signal, not as a curated list.
🛡️ Stop losing chats in the first place
Before anything else, widen Claude Code's retention window in ~/.claude/settings.json:
{
"cleanupPeriodDays": 365
}
This tool can only archive what still exists when it runs. A year of retention buys you margin; archiving automatically closes the gap completely.
Archive every session as it ends:
lastword hook install # adds a SessionEnd hook to ~/.claude/settings.json
When a session ends — you exit, /clear, or /resume another — Claude Code runs lastword hook run, which starts an archive run in the background and returns at once, so ending a session never waits on it. Your other settings are left exactly as they were (a backup is saved as settings.json.lastword-backup). lastword hook status shows the hook and its log (hook.log in the archive home); lastword hook uninstall removes it. Install lastword as a command first (uv tool install / pipx install): the hook runs it from whatever project you were in.
And as a backstop, a daily run. The hook doesn't fire if a terminal is killed or Claude Code crashes, so schedule one too:
macOS / Linux — crontab -e (cron has a minimal PATH, so give the full path from which lastword):
0 20 * * * $HOME/.local/bin/lastword --quiet
Windows — Task Scheduler → daily → lastword --quiet.
lastword exits non-zero if any session failed to archive, so a scheduler that alerts on failure will tell you. Two runs that overlap don't collide: the second waits for the first.
♻️ Already lost chats? Maybe not.
If you archived sessions before and they've vanished from your index, they are probably still on disk. Earlier versions rebuilt the index only from live sources, so pruned sessions dropped out even though sessions/ still held every byte.
Just run it again:
lastword
The backfill pass replays every session in manifest.json from its archived copy:
Sessions found: 23 | archived: 2 | unchanged: 21 | restored from archive: 28 | pages rendered: 2 | failed: 0
Total sessions in index: 51
As long as manifest.json and sessions/ survive, nothing is lost.
🚚 Renamed or moved a project?
Claude Code files sessions under the project's folder path, so renaming the folder splits its history in two: old sessions stay under the old name, new ones start under the new one. Join them back up:
lastword move-project ~/code/old-name ~/code/new-name --dry-run # preview
lastword move-project ~/code/old-name ~/code/new-name
lastword
This moves the old sessions to the new name both in ~/.claude/projects (so claude --resume finds them from the new folder) and in your archive, and from then on shows the old path as the new one in the index, search and timeline. Your transcripts are never rewritten; source.jsonl keeps the paths exactly as they were recorded.
Close any Claude Code session still running in the old folder first. move-project refuses to run while one is running, and stops without changing anything if a file at the new name would be overwritten. If a session was open during the move anyway, Claude Code writes a few closing records back to the old folder when it exits; run move-project again and it recognises that stub and clears it away, since everything in it is already in the moved copy. Pass --archive-only to leave ~/.claude/projects alone.
🏠 Where your archive lives
By default in ~/.lastword, private to your user (700). lastword where prints it; to put it elsewhere, pass --home DIR or set LASTWORD_HOME. Avoid folders that sync to the cloud (Documents or Desktop with iCloud or OneDrive): the archive holds everything you pasted into a session.
Archived into a git checkout before 0.1? Nothing breaks: run from inside a folder that already holds an archive, lastword keeps using it. To move it to the standard place:
lastword migrate --from /path/to/lastword # copies to ~/.lastword and checks every byte
lastword && lastword verify
The old copy is left untouched until you delete it. The first run on an archive from before 0.1 upgrades it in place, keeping the original manifest as manifest.v0.bak.json.
⚙️ Commands
lastword [archive] Archive new and changed sessions (the default)
--root DIR Claude Code projects dir (default: ~/.claude/projects)
--project SUBSTR Only process project dirs matching a substring
--force Re-render every session's pages
--quiet / --json Print nothing but problems / print counts as JSON
--wait SECONDS How long to wait for another run to finish (default: 60)
lastword open Open the session browser
lastword where Print the archive's location
lastword verify Check every archived transcript against its checksum
lastword migrate --from DIR Copy an existing archive to the archive home
lastword move-project OLD NEW Join a renamed project's sessions (see above)
lastword hook install Archive each session when it ends (also: uninstall, status)
lastword demo [--open] Build a demo archive from invented sessions
Every command takes --home DIR. Exit codes: 0 success, 1 something failed (details on stderr), 2 bad usage.
Stability: until 1.0, the commands above and the archive layout (sessions/, manifest.json) are stable — a newer lastword always upgrades an older archive, and an older lastword refuses a newer archive rather than damage it. The JSON layouts under extracts/, index/ and timeline/ may still change.
🔒 How it stays safe
Byte-exact — each transcript is copied verbatim to source.jsonl, with its sha256 in manifest.json. lastword verify re-checks every one.
Never overwritten — Claude Code only appends to a transcript, so a new snapshot replaces the old one only if it starts with every byte of it. If a transcript is ever rewritten instead, the earlier copy is kept alongside.
Append-only — aggregates rebuild from the union of live sources and every session in the manifest, replayed from its archived copy. Claude Code's prune can't remove anything from your index.
Crash-safe — every file is written to a temp file and renamed into place, and overlapping runs take turns, so an interrupted run never leaves a half-written archive.
Local — reads ~/.claude/projects, writes to disk. No network, no telemetry, no dependencies. Transcript text is escaped before rendering, and javascript: URLs are stripped.
🚨 Privacy — read this before pushing anywhere
Your exported conversations are private. Never commit them.
The archive holds whatever you discussed with Claude: proprietary source, file paths, customer data, credentials pasted into prompts. Keep it out of any repository. If you still archive into a git checkout, its bundled .gitignore excludes every path the exporter writes, so a fork stays code-only. Before your first push:
git status --porcelain # should list source files only
To back up the archive itself, use a private repo or ordinary file backup — never a public one.
🤝 Contributing
Issues and PRs welcome — see CONTRIBUTING.md. Run the tests with python3 -m unittest — they build invented transcripts and never touch your own. For screenshots or UI checks, python3 tools/make_demo.py rebuilds docs/demo/. Please never paste real transcript content into a bug report — a redacted snippet or the structure alone is plenty. Found a security problem? Report it privately as described in SECURITY.md. Release history is in the changelog.
📄 License
MIT — see LICENSE.
Your conversations are work. Keep them.
Metadata
Release files for lastword-cc 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lastword_cc-0.1.3.tar.gz | 80.4 kB | With provenance | Details for lastword_cc-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lastword_cc-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for lastword_cc-0.1.3-py3-none-any.whl |
Total release size: 155.4 kB
Release files / lastword_cc-0.1.3.tar.gz
| Download URL | lastword_cc-0.1.3.tar.gz |
|---|---|
| Size | 80.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b262d4e3ce67ac0dc5d6909cba7c7bd45691cfba0d2b32bc37725b7990edf66
|
|
BLAKE2b-256 checksum How to use checksums |
f6007d9a5ba49b39ec6a0a489323510e1cf5c5f435129da5ab883152ed1e073d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / lastword_cc-0.1.3-py3-none-any.whl
| Download URL | lastword_cc-0.1.3-py3-none-any.whl |
|---|---|
| Size | 75.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b68d5a960eecdc868ba2f0a5554fdc3250fff2ea6fa973eb271cef969bebf56
|
|
BLAKE2b-256 checksum How to use checksums |
614b33633bed4ed3ca09a25807ab124198b281d576e448b058dfd9d120b5ba88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for lastword-cc 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for lastword_cc-0.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.