Then build a manager that keeps long-running services in a detached tmux session. 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: Go Package: github.com/libtmux/libtmux-go/tmux (pkg.go.dev) Repository: https://github.com/libtmux/libtmux-go Read these before writing code: - https://libtmux.org/en/go/latest/llms.txt every page for Go, as a list - https://libtmux.org/en/go/latest/docs.json the same list with headings, as JSON - https://libtmux.org/en/go/latest/reference/ the Go API reference - https://pkg.go.dev/github.com/libtmux/libtmux-go/tmux Go reference on pkg.go.dev 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 Go project yet, start one: go mod init example.com/tmuxdemo Skip this in a project that already exists, and match what is here. 3. Add the dependency. github.com/libtmux/libtmux-go/tmux has no stable release. v0.0.1-alpha.9 is the newest prerelease on pkg.go.dev, and the command below names it because the resolver skips prereleases otherwise. go get github.com/libtmux/libtmux-go@v0.0.1-alpha.9 Check https://pkg.go.dev/github.com/libtmux/libtmux-go/tmux 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. Detached service manager What it does: - Reads a small config listing services to run, each with a name, a working directory and a command. Start with a Jupyter notebook server as the worked example. - Starts them in one detached session at login, one window per service, so nothing depends on a terminal staying open. - Is idempotent. Running it twice does not start a second copy of anything; it reports what was already up and starts only what was missing. - Restarts a service that has died, and tells me which one and when. - Gives me a command to attach and look at any service's output. Constraints: - Decide whether a service is running by asking the tmux server what exists, not by writing a PID file that outlives the process. - A service that fails to start must be reported, not silently skipped. - Say in a comment how this gets invoked at login on this platform, and why detached is the right mode. Anchor it in these pages: - https://libtmux.org/en/tmux/concepts/workspaces/ workspaces - https://libtmux.org/en/tmux/concepts/server-session-window-pane/ server session window pane - https://libtmux.org/en/tmux/examples/workspace-from-file/ workspace from file