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: Python Package: libtmux (PyPI) Repository: https://github.com/tmux-python/libtmux Read these before writing code: - https://libtmux.org/en/py/latest/llms.txt every page for Python, as a list - https://libtmux.org/en/py/latest/docs.json the same list with headings, as JSON - https://libtmux.org/en/py/latest/reference/ the Python API reference 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 Python project yet, start one: uv init Skip this in a project that already exists, and match what is here. 3. Add the dependency. libtmux 0.62.0 is the current release on PyPI. uv add libtmux Check https://pypi.org/project/libtmux/ if you need a different version. If this project already uses pip, Poetry or PDM, add the dependency with that tool instead: the package is the same. 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