Skip navigation
Rex can now resume your programs through a server restart!
0:00 / 2:20

Rex can now resume your programs through a server restart!

Mitchell Hashimoto

@mitchellh244K followers

Visit on X
3,528 likesDownloadOriginal post

240,214 views

Rex can now resume your programs through a server restart! This is based on a brand new terminal protocol we're also publishing today (OSC 7577) that we worked on in collaboration with herdr with review from multiple terminal emulator and terminal program authors. Link: This means that ANY program can restart, not just agentic coding tools, and it doesn't require any special integration with any specific terminal or out-of-band protocol. It's plain old terminal escape sequences that are easily implemented by any program! Rex is shipping with built-in support for Claude Code to start (we emit OSC 7577 in a session start hook), but hope that other programs will adopt this and enable restart. Program restart in terminals is fundamentally unsafe, so a lot of effort was put into making this as safe as possible. Ultimately, the security of this lies in the terminal emulator. For Rex, we have a highly flexible Lua-based configuration to opt-in to resume on a program-by-program basis. You can filter by program name, path, working directory, command-line flags, and more. You can also disable the whole thing with one line.

26 Comments

Comments from the original post on X (Twitter)

  • Karthik's profile picture

    @kartikktwt

    @herdrdev This is sickk honestly. Also i love that you guys are working with @herdrdev

    4 likes

  • serx · fireply.ai's profile picture

    @serxzsz

    @herdrdev escape sequences for this is the right call, no new ipc to maintain on either side

    2 likes

  • Caio Bianchi's profile picture

    @caioca

    @herdrdev Love that you're working together with @herdrdev!

    1 like

  • Petr Baudis's profile picture

    @xpasky

    @herdrdev TL;DR: Programs may emit an escape sequence describing how to restart them and resume from a saved checkpoint (e.g. a CC session snapshot, vim state from a .swp file, etc.). I have been thinking about this recently with all the kernel bugs prompting reboots - perfect timing!

    1 like

  • Karl's profile picture

    @captn_karl

    @herdrdev tmux brutally session/resurrect mogged

    1 like

  • Nick Woodhead | GPTree | Foremerge | TranslateTech's profile picture

    @naw103

    @herdrdev Does the Claude Code hook resume the same conversation by session id, or reopen claude fresh in the same directory?

  • commandersaki's profile picture

    @commandersaki

    @herdrdev Is this kind of like some nelhage/reptyr type thing?

  • Daniel Dosen's profile picture

    @DanielGDosen

    @herdrdev Should have probably waited for a build numbered 2669 or greater before trying :)

  • No Name Tokens's profile picture

    @NoNameTokens

    @herdrdev Open Beta wen?

  • Arie's profile picture

    @nwtseira

    @herdrdev this is big

  • Harrison's profile picture

    @harrisonju

    @herdrdev what happens to a tool call that was mid flight when the server restarted?

  • Adan Zweig's profile picture

    @Adojz

    @herdrdev when claude code comes back after the restart, does it pick up the same conversation (like --resume with the session id from the hook) or start a fresh session in the same dir?

  • Aditya Batra's profile picture

    @AdityaBatra072

    @herdrdev tmux could never

  • JT's profile picture

    @21jordantaylor

    @herdrdev Small but huge feature!

  • Beep's profile picture

    @bpisbuilding

    @herdrdev interesting proposal. I currently handle this by sending over a little binary based on zmx to keep shells open and running (like a lightweight tmux).

  • schrepfler's profile picture

    @schrepfler

    @herdrdev What does program resume mean, it saves the process entire state (program counter, allocated memory etc.) somewhere or does it require some soft support from the applications to save and load snapshots (ala `claude --resume :session-id`?

  • Fonsi_AI's profile picture

    @Fonsi_AI123

    @herdrdev Good news: sessions survive reboots. Bad news: no more excuse to log off.

  • Albert Purnama's profile picture

    @AlbertPurnama

    @herdrdev @calvintjoeng now we can restart our rex servers to update

  • Evert Junior's profile picture

    @evertjr

    @herdrdev if you get everyone to adopt that standard it would be so glorious. Session resume across agent CLIs is currently a shit show

  • Clever Username's profile picture

    @uhhhnobodyy

    @herdrdev Glad I don’t have to ask Claude “remember my tabs so you can resume them when I restart Rex” anymore lol