Hacker News
Show HN: Tmux-restore saves tmux windows and agent sessions across reboots(github.com)
54 points by boldi 4 days ago | 36 comments
[–] ghshephard 21 hours ago
This is built on top of tmux-continuum & tmux-resurrect, tmux plugins which I've been using now for 10+ years - pretty much every day - they bring so much joy to using tmux.

Zero worries about having to restore local window settings - It's not uncommon for me to have 40+ panes split across 15+ windows. Windows / Dell / Security updates have me rebooting almost weekly - which means a restart of WSL - but, with continuum/ressurect - zero issues - all the windows, panes, scrollback (!) and with just a tiny bit of bash history foo - command history - are completely restored as though nothing had changed.

Really interested to see if restore lives up the foundations that it's built on.

[–] lloeki 19 hours ago
Except... any running process?

> Windows / Dell / Security updates have me rebooting almost weekly - which means a restart of WSL

Oh the irony of WSL being a VM but not leveraging VM snapshotting capabilities.

[–] boldi 4 days ago
Hi everyone I built this since it'd be so frustrating to have all my tmux windows with different paths and layouts all destroyed when restarting my computer (e.g. for installing drivers). It also resumes e.g. claude code sessions. Hope it helps!
[–] l9o 1 day ago
Love it! I've been doing this manually when I need to restart my hosts :) Would it be possible to have instructions to install it that don't involve executing a script? Something as simple as the dependencies I need to install and the tmux config required would be super helpful.
[–] visarga 23 hours ago
I forked Zed to pass a ZED_TERMINAL_ID which is tied to the individual shell pane, using it to restore whatever agent session I had running in that pane. I keep 10+ Zed windows open with 1 to 4 agent panes, a reboot used to be a disaster.
[–] boldi 20 hours ago
Sure! I'll add this tomorrow :P
[–] SwiftyBug 18 hours ago
In order to try this, do I need to remove my current tmux-resurrect and tmux-continuum?
[–] heding 6 hours ago
OOH I think this is a neat solution for a real problem I'm experiencing, I really liked the decision not the invent the wheel and use tools that have been working for years now (tmux continuum and resurrect) and just add the missing layer on top of them. OTOH My terminal today is only a bunch of agents, I don't ever run any commands myself anymore, I just tell my agent to do so, meaning I don't have any processes, history or anything that I care of, it's all inside the agent itself. so I'm wondering whether I really need this whole tmux wrapping and not just to expect my terminal app to be capable to handle those --resume commands for me.
[–] Roark66 18 hours ago
I've made a very similar tool github.com/lukolszewski/session-keeper

But my tool supports pi, claude code and copilot cli as this is what I use. It also saves any tail -f and few other processes I tend to leave running for a long time as well as folders I'm in.

My tool is likewise built on top of the same tmux plugins so it saves windows layouts, names etc.

After I started using it, especially on a Windows work laptop (in WSL) that has a habit of restarting almost every night to "do updates" I don't know how could I ever live without it.

But my tool saves every few min on a schedule as well as on keystroke. I didn't need save on shutdown, because my main use case is protecting from unexpected restarts such as a mashine crash or those updates pushed by corporate it every night.

It is very cool creating such tools has become so easy one can just casually do it without spending days of time on it. That's a great benefit of AI.

Another tool I find indispensable for pi, although it's still a work in progress is my tool use permission/classified called adaptive-acl (same github account). It has a very elaborate treesitter based deterministic classification layer plus an llm feature that extracts the intent from the user context and converts it into deterministic rules.

So there is no llm call on every tool use, just those tgat don't match the deterministic rules.

My favourite feature is good level of control on the grants, ability to preview them, alter them, export, import. I also have a bajillion of my private session records that I tend to test any prompt/classifier changes so I don't get unexpected regressions.

I tend to use opus 5.5 supervisor and a team of 7 DeepSeek v4.1 Flash 1017 agents to write it (used to be Qwen3.8-Flash-Next). It does a great job, but it needs substantial architecture hand holding.

[–] hxugufjfjf 1 day ago
I’m pretty sure I’ve used tmux-ressurect for this. What’s the difference?
[–] boldi 21 hours ago
Hi! The main use case for me was to make sure agent sessions are also resumed and right where I left them :)
[–] hxugufjfjf 20 hours ago
I have this exact use case, which resurrect doesn’t solve. I will try your plugin then, thanks!
[–] boldi 19 hours ago
You're welcome :) Let me know if you have any feedback
[–] Octetmed 19 hours ago
I’ve been using this for a while, tmux resurrect by itself I had been using for forever but since Claude code came out it’s been frustrating to not have those long sessions restored in their right panes and this makes it soo much better. You restore and everything is in its place
[–] atomicstack 17 hours ago
tmux might be getting a native save / restore feature for v4.0: https://github.com/tmux/tmux/issues/5693
[–] gb2d_hn 21 hours ago
I think herdr does this out of the box
[–] boldi 21 hours ago
Hadn't heard about herdr before! Downloading it now
[–] jauntywundrkind 1 day ago
After much delay I finally got tmux-continuum & tmux-resurrect going. Which I think are very well known plugins for this.

https://github.com/tmux-plugins/tmux-continuum https://github.com/tmux-plugins/tmux-resurrect

Also used tpm, the plugin manager. There's some variants. I went with ahiru-tpm which is pretty drop in compatible but not seeing much action, and tpm seems more active again. https://github.com/tmux-plugins/tpm https://github.com/x3rAx/ahiru-tpm

One of the weird cool (but also, wish I'd known, has risks!) things I wasn't expecting is that captures the screen buffer. The program is dead, but there it is, whatever was last there, when you reboot. Wild.

I've had some system instability some, alas (blast you ram crunch), and did everything under the sun to build tools to capture my workspace. This, this was way way easier.

[–] boldi 21 hours ago
Happy to hear that it helped :)
[–] ShinyLeftPad 1 day ago
What are the risks?
[–] jauntywundrkind 1 day ago
If there's anything sensisitve open on a tmux window somewhere it's just sitting in a file in your hard drive. It's overwritten every 10 minutes by whatever is there.

If that's a password for some reason, it could be captured.

I just thought it was going to be the sessions, window names, layouts. I wasn't expecting the content too. Not a big deal for me, but a surprise!

[–] ShinyLeftPad 19 hours ago
Ooh yeah. Very good point
[–] TeaVMFan 1 day ago
This sounds great! Might convince me to defect from GNU screen.
[–] boldi 21 hours ago
Would highly recommend it myself ;)
[–] peterdemin 1 day ago
Does it restore active python venvs?
[–] boldi 21 hours ago
Not right now! I exclusively use uv these days which works in whatever directory you're in. Added to my todo list!
[–] tonymet 22 hours ago
This is clever, but running in a VM with hibernation is a lot easier, more consistent and more comprehensive (all state is saved, and restored instantly)
[–] Roark66 18 hours ago
I built an almost the same thing for myself and the main use case for me is on a work laptop where I run WSL and I leave on standby overnight. Then the I'd dept forces a reboot to install updates and all my windows are gone...

Saving state every afternoon would be a pain.

[–] tonymet 13 hours ago
Move it to hyperv . Windows terminal integrates as cleanly as wsl . Hyperv gives you hibernation by default
[–] boldi 21 hours ago
Might be a bit naïve, but wouldn't a VM take up a lot more memory?
[–] tonymet 13 hours ago
You can get the overhead down to 85mb, about an empty browser tab
[–] b112 22 hours ago
But the VM needs reboots too, kernel upgrades for example.

And if you upgrade libraries, especially for security issues, you need to restart apps dependent upon them, needrestart in Debian helps greatly with this.

So a VM doesn't really help solve this.

[–] tonymet 13 hours ago
You’re always making tradeoffs. For 100 sessions , which one works better ? Would you use the worse setup for the once a month you need to reboot ?
[–] _blk 23 hours ago
Cool thanks, will give it a shot.

Does anyone know how this compares to herdr? I've been curious to try that I've too.

[–] enoch_hou 1 day ago
This is exactly the pain point for me — losing a whole tmux layout after a reboot is annoying, but losing the agent sessions running in those windows is worse. tmux-resurrect never quite got the agent part right for me, so I'm curious to try this and see how it handles restoring those sessions.
[–] boldi 21 hours ago
Yup, that was exactly my pain point too!