Then build a supervisor that reconciles running tmux sessions against a declared set. libtmux drives a real tmux server from code. It gives you objects for the server, its sessions, windows and panes. Documentation for every language is at https://libtmux.org/en/. Language: Rust Package: libtmux (crates.io) Repository: https://github.com/libtmux/libtmux-rs Read these before writing code: - https://libtmux.org/en/rs/latest/llms.txt every page for Rust, as a list - https://libtmux.org/en/rs/latest/docs.json the same list with headings, as JSON - https://libtmux.org/en/rs/latest/reference/ the Rust API reference - https://docs.rs/libtmux Rust reference on docs.rs If you cannot fetch URLs, clone the repository above and read its README and examples instead, or ask me to paste those pages in. Set up first: 1. Report the tmux version with `tmux -V`. libtmux drives a real tmux, so nothing below works without one. Stop and tell me if it is missing. 2. If this directory is not a Rust project yet, start one: cargo init Skip this in a project that already exists, and match what is here. 3. Add the dependency. libtmux has no stable release. 0.1.0-alpha.15 is the newest prerelease on crates.io, and the command below names it because the resolver skips prereleases otherwise. cargo add libtmux@0.1.0-alpha.15 Check https://crates.io/crates/libtmux for a newer version, and prefer a stable release over this one if there now is any. 4. Write the smallest program that proves the install works: connect to a tmux server, create a session, confirm it is there, then kill it. Give that server a socket of its own rather than using the default one, so this never touches a tmux I am already running. Run it, and show me the output and the files you added. Rules for everything below: - Use the reference above rather than guessing names. The ten libtmux ports do not share spellings, and a name from another language will look plausible and not exist. - If the reference does not have something you expected, say so instead of writing a call that does not exist. - Follow the conventions already in this repository. Session supervisor What it does: - Reads a declared set of sessions and windows from a file. - Compares it against what the server is running and reports the difference before changing anything. - Applies the difference: creates what is missing, and leaves alone anything already correct. - Has a dry-run mode that prints the plan and touches nothing. Constraints: - Converge. Running it repeatedly against an unchanged server must do nothing the second time and say so. - Never kill a window it did not create unless I pass an explicit flag. - Compare against the server's own state rather than against a file this tool wrote last time. - Report what changed in terms I can read, not a diff of internal structures. Anchor it in these pages: - https://libtmux.org/en/tmux/concepts/workspaces/ workspaces - https://libtmux.org/en/tmux/concepts/queries/ queries - https://libtmux.org/en/tmux/guides/querying-and-filtering/ querying and filtering