unlose
v0.5.4
Published
Encrypted backup and native recovery for Claude Code and Codex sessions. Get a session back after an update wipe, Claude Code's 30-day cleanup, or a dead laptop.
Maintainers
Readme
unlose
Your agent sessions, after they're gone.
Claude Code's desktop app wiped people's session history after an update
(#64403). The Claude
Code CLI deletes transcripts older than 30 days by default (cleanupPeriodDays).
A dead laptop takes all of it.
unlose keeps an encrypted copy outside every path those failures touch, and
hands the session back to claude --resume byte-for-byte.
npx unlose init # sign in and make the first encrypted copy
npm install -g unlose # keep it installed for the watcher
unlose watch --install # capture every 15 min; upload when signed in
unlose status # what is protected right now
unlose restore <id> --to ~/project # get one backPrefer local-only backup? unlose snap needs no account, server, or key
ceremony. It writes the owner-only vault on this machine and never uploads.
What it does
| | |
| --- | --- |
| snap | Capture every Claude Code and Codex session locally, byte-exact. Add --push to upload every successfully captured capsule |
| status list show verify | See what's protected and hash-check it |
| restore <id> | Recover a session under its original id |
| continue <id> | Resume in the agent that created it |
| fork <id> | Branch a Claude Code session without touching the original; needs Claude Code 2.1.208 exactly, and says so before preparing anything |
| export / import | An encrypted file that travels over any channel |
| share <id> | A link anyone can open, with no account |
| sync push / pull | Encrypted copy off this machine |
| account delete | Permanently delete the active hosted account and data; backup copies expire within seven days; the local vault stays |
| key | See or restore your recovery code; key host on\|off\|status manages an opt-in server copy (the server can then decrypt) |
| watch --install | Scheduled local capture; when signed in, encrypt and push changes off this machine |
Two agents are supported today: Claude Code and Codex CLI.
Signing in again after account deletion creates a new, empty hosted account.
Encrypted before it leaves your machine
Session contents, file paths, and file topology are sealed client-side. The server stores ciphertext it cannot read, unless you opt into key hosting (below).
It is not a magic box, and the docs say which parts are visible: a small routing header (agent name, a random session UUID, file count, byte sizes) stays readable so the server can route and bill. Names, paths, prompts, and outputs never do.
The vault on your disk is plaintext and owner-only (0700/0600). It holds
real prompts, outputs, and possibly secrets. Encryption applies to what leaves
the machine, not to what sits in ~/.unlose.
Your recovery code stays on your side by default. On a Mac, unlose init
saves it in the login keychain; unlose key show prints it any time, and the
server never sees it. The keychain does not sync through iCloud. The code
lives only on that Mac, so a second machine still asks for it. If you never
want to type it, unlose key host on stores a copy with the server: new
machines then set up with nothing to type, and whoever runs the server can
decrypt your sessions. That trade is off until you switch it on.
Share links
unlose share <id>
# https://unlose.sh/s/K7m2pQ...#NQYBX0NK7XAD...
# \_______/ \______________/
# token decryption keyshare saves the session's latest state first, so a session you are still in
is shared with its newest turns.
The part after # never reaches the server: browsers don't put fragments on
the wire. Only sha256(token) is uploaded, so a database leak yields no working
link. The recipient needs nothing, and continues from their own clone:
npx unlose open '<link>'
npx unlose continue <id>Under zero-knowledge the link is the key, which makes some controls real and others impossible. unlose says which:
| Enforceable | Not enforceable |
| --- | --- |
| Expiry (7 days default, 30 max) | "Read-only" for someone who can decrypt |
| One-time use (--once) | Taking back a session already opened |
| Revoking before an open | Stopping a recipient re-sharing |
| An open count you can inspect | Knowing who opened it |
A view-only web preview would require the server to decrypt, which is the whole property unlose exists to keep. It is deliberately not built.
What a capsule contains
Claude Code: the session transcript, the project sidecar, and per-session
file-history, tasks, and session-env artifacts when they exist.
Codex: the rollout JSONL from both active and archived stores. Codex keeps
index state outside the rollout, so continue restores the rollout and hands
off to codex resume, which resolves by thread id and works without it. An
archived session comes back archived: run codex unarchive <id> before
resuming it.
unlose does not capture your repository. A restored conversation may
remember edits the source tree no longer has. Clone or restore the repo
separately and point at it with --to.
Status
Works today: local capture, restore, continue, encrypted export/import, share links, and encrypted sync against a self-hosted or hosted server.
Claude native fork is validated only for Claude Code 2.1.208. unlose
doctor --agent claude, fork, and launch-fork fail closed on every other
version, and fork refuses before it prepares anything, so there is no pending
fork left to clean up; that version gate does not apply to restore or continue.
Claude continue requires 2.1.223 or newer when the physical working
directory maps to a different Claude project than the transcript, such as a
workspace recorded through a symlink. Unlose checks this before restoring or
launching; ordinary same-project continue only requires the native --resume
flag.
Codex fork is not yet supported.
Not there yet: redacted sharing, a web viewer, Windows, and agents beyond Claude Code and Codex.
Docs
- Security model: what is protected, and the limits
- Sync, sharing, and hosting: everyday backup, restore, and sharing
- Hosted service: what the hosted service stores and can read
- Development: required local checks
- Support: how to get help, and what never to send
License
MIT. The LICENSE file ships inside the package.
