# Agent instructions: set up dev-session You are an AI coding agent (Claude Code, Cursor, …). The user wants `dev-session` set up on this machine and, optionally, their other machines. Do the work yourself and explain it in plain words. The user should not need a terminal. ## Rules 1. **Never attach to tmux.** You have no real terminal. Add `--detach` when you start a session. The one exception: when the user types `/dev-session` or `/ds`, follow that skill, which switches their terminal to the session. 2. **Never stop, kill or restart anything you did not create.** This includes the tmux server and running agents. 3. **The user types passwords, not you.** When a command needs one (`ssh-copy-id`, `sudo`, an agent login), give them that single command. In Claude Code they type `! ` in the prompt; in Cursor they run it in the terminal panel. 4. **Ask first** before you edit a shell startup file, create an SSH key, or disable another tool. Never use `sudo` on macOS. 5. **Never guess** hostnames, accounts or conversation IDs. Ask. ## Before you start, ask Ask these together in one message, so the user answers once: 1. **Project folder on this machine:** the folder that holds their projects, as a full path (e.g. `~/dev`). 2. **Agents:** which they use: Claude Code (`claude`), Grok (`grok`), or neither. 3. **Other machines:** do they want to start sessions on other machines too? For each one: - a short name (e.g. `server`); - the SSH address (`user@host`, an alias from `~/.ssh/config`, or the machine's Tailscale name); - whether sessions there run as another account (`--run-as USER`); - the project folder on that machine. Use these answers in the steps below instead of asking again. If an answer is missing or unclear, ask for it; never fill it in yourself. ## Steps **1. Get the code.** It needs Git, Python 3.8+ and tmux 3.3+. `setup.sh` installs tmux and Python with Homebrew or apt if they are missing. ```bash REPO=~/.local/share/tmux-session-manager/repo git -C "$REPO" pull --ff-only 2>/dev/null || git clone https://github.com/emgould/dev-session.git "$REPO" ``` Keep this folder. Upgrades and new machines are installed from it, so don't use a temp directory. **2. Install.** Run `bash "$REPO/setup.sh"`. It should end with `Installed.` If `command -v dev-session` finds nothing, ask before adding `export PATH="$HOME/.local/bin:$PATH"` to `~/.zshrc` or `~/.bashrc`. Until then, use `~/.local/bin/dev-session`. **3. Check.** Run `dev-session doctor`. - `tmux`, `git` and `ssh` must be found. - Each agent the user named must be found. If one is missing, the user installs it and signs in. Agents they didn't name can be missing. - If doctor lists other snapshot tools, tell the user and ask what to do with them. Run `dev-session --set-root DIR` with this machine's project folder. You can't answer the prompt that would otherwise ask them on first use. Then run a quick test and clean up: `dev-session hello --detach`, then `dev-session list`, then `dev-session stop hello --yes`. **4. Add other machines.** Skip this step if the user has none. For each machine they gave you: 1. Run `ssh -o BatchMode=yes HOST true`. If it fails: - If `ls ~/.ssh/id_*.pub` finds no key, ask whether to create one (`ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519`). - Hand the user `! ssh-copy-id HOST`. 2. With `--run-as USER`: `ssh -o BatchMode=yes HOST sudo -n -u USER true` must succeed. If it doesn't, suggest logging in as that account directly (`USER@host`). 3. Run `dev-session machine add NAME HOST [--run-as USER]`. A `Pseudo-terminal will not be allocated` warning is harmless. Then run `dev-session --set-root DIR --machine NAME` with that machine's project folder (a full path, or `'~/dev'` in quotes so `~` means the home folder there). 4. Run `dev-session list`. The machine must not show as `unreachable`. **5. Hand over.** Tell the user: - **Open a session:** `dev-session NAME --claude --folder PROJECT` from any terminal. The first session on each machine asks for the folder that holds their projects (e.g. `~/dev`); `--folder` is relative to it. `dev-session NAME --wt WT` opens a second agent in a Git worktree of NAME's project. With other machines added, a new session asks which machine to start on (arrow keys, Enter), and an existing session opens on the machine that runs it. - **Shortcuts:** Option+B then `h` lists them. Option+B then `d` detaches. - **From inside an agent:** in Claude Code or Grok running in a session, `/ds` picks or starts a session on that machine and switches to it. `/ds sessions` lists every session on every machine; `/ds machine-list` lists the machines. - **After a reboot:** sessions come back as tabs. Run `dev-session NAME` to restart an agent; it continues its conversation. - **Updates:** `dev-session upgrade --machine all`. Ask them to try these and report anything that goes wrong. ## Later requests | Request | Do | | --- | --- | | Start an agent session | `dev-session NAME --claude --folder PROJECT --detach`, then give them `dev-session NAME`. If it says no project folder is set, ask the user which folder holds their projects and run `dev-session --set-root DIR [--machine M]` | | What's running? | `dev-session list` | | Close a session | Confirm with the user, then `dev-session stop NAME --yes` | | Update everything | `dev-session upgrade --machine all` |