repos / zmx

session persistence for terminal processes
git clone https://github.com/neurosnap/zmx.git

commit
01dace3
parent
8a96363
author
Eric Bower
date
2025-12-01 20:52:38 -0500 EST
docs: readme
1 files changed,  +23, -6
M README.md
+23, -6
 1@@ -17,12 +17,6 @@ Reason for this tool: [You might not need `tmux`](https://bower.sh/you-might-not
 2 - Works on mac and linux
 3 - This project does **NOT** provide windows, tabs, or window splits
 4 
 5-## impl
 6-
 7-- The `daemon` and client processes communicate via a unix socket
 8-- Each session creates its own unix socket file `/tmp/zmx/*`
 9-- We restore terminal state and output using `libghostty-vt`
10-
11 ## install
12 
13 - Requires zig `v0.15`
14@@ -168,6 +162,29 @@ At this point, nothing is configurable.  We are evaluating what should be config
15 - `bug`: send resize event when a client first sends stdin
16 - `feat`: binary distribution (e.g. `aur`, `ppa`, `apk`, `brew`)
17 
18+## impl
19+
20+- The `daemon` and client processes communicate via a unix socket
21+- Each session creates its own unix socket file `/tmp/zmx/*`
22+- We restore terminal state and output using `libghostty-vt`
23+
24+### libghostty-vt
25+
26+We use libghostty-vt to restore the previous state of the terminal when a client re-attaches to a session.
27+
28+How it works:
29+
30+- user creates session `zmx attach term`
31+- user interacts with terminal stdin
32+- stdin gets sent to pty via daemon
33+- daemon sends pty output to client *and* ghostty-vt
34+- ghostty-vt holds terminal state and scrollback
35+- user disconnects
36+- user re-attaches to session
37+- ghostty-vt sends terminal snapshot to client stdout
38+
39+In this way, ghostty-vt doesn't sit in the middle of an active terminal session, it simply receives all the same data the client receives so it can re-hydrate clients that connect to the session.  This enables users to pick up where they left off as if they didn't disconnect from the terminal session at all.
40+
41 ## prior art
42 
43 Below is a list of projects that inspired me to build this project.