When your terminal crashes mid-session, how do you pick the work back up?

by•

I run 8 or more sessions at once, so terminal hangs and crashes show up way more often than I'd like. claude --resume looks like it should help, but it doesn't always pull the whole history back. I've stopped relying on it.

Our workaround is small. Every time the agent finishes a reply, a Stop hook writes a little card for that terminal pane, holding my last instruction, the tail of the agent's answer, the working folder, and the path to the full session log. It's a plain text file that gets overwritten on each run, so it costs zero tokens, and cards older than 7 days get cleaned up on their own.

Opening a new session in the same pane or folder triggers a SessionStart hook that reads the latest card and drops it into the agent's context. That way the new session already knows where the last one stopped, and it can always go read the full log when it needs more detail. Usually that's plenty.

For anything that has to outlive a single session, like decisions or mistakes, we put it in the project's memory files. That's the only place I trust the next session to look.

What do you do when a session dies on you? How do you pick things back up?

15 views

Add a comment

Replies

Best

Similar idea. Mine is one file per repo rather than a card per pane. The agent appends to it at the end of every session. It says what got done, what's half done and what's next. It's append only. An agent once tidied it up and a week of context went with it. A crash still loses the last stretch. So it also commits after every step and the git log is the fallback.

 Ouch, losing a week of context to a cleanup hurts.

We have something close to yours too. Each project gets a monthly work log that's built automatically from the session logs, mostly what I asked for and anything that went out to production. We used to have the agent keep a progress file by hand, but it kept forgetting to update it, so we dropped that.

Using the git log as the fallback makes sense. It doesn't forget.

Same problem, different shape of fix: I decided the session must never be the only place where state lives, so three places hold it. Git, with a rule in the notes file that says commit and push when a stage is done, without asking, so a crash costs at most the current stage. The project notes, one file per area, with the rule that a non obvious finding goes in there the moment it is learned and not into a commit message, so the next session reads why before touching the area. And a small memory folder outside the repo, one fact per file with a one line index loaded at start, for the things that are not code: what I corrected, which account owns which project, which deploy is a test. When a session dies I open a new one and say in one sentence what I was doing; the rest it reads. The gap mine has is exactly what your card covers, the last instruction and the tail of the answer, and the append only point above is well taken: a notes file an agent is allowed to tidy is a notes file that will be tidied.

 that line about the notes file is exactly it.. the three places idea is good.. git is the one that saved me most