summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-10-24 08:18:30 +0100
committerIgor Soarez <igor@soarez.org>2026-10-24 08:18:30 +0100
commit3ee27f8b28c8fabaa1a81a67501c84cb98ef7325 (patch)
treee8cff6a81de537700f130d067fac824753e11879
parent3a519e6282408c19ed2aad17f7ff54d8a87e26f4 (diff)
claude: never reach the operator's tmux server by accident
-rw-r--r--config/claude/CLAUDE.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/config/claude/CLAUDE.md b/config/claude/CLAUDE.md
index c12b40f..b4eb2f6 100644
--- a/config/claude/CLAUDE.md
+++ b/config/claude/CLAUDE.md
@@ -15,3 +15,28 @@ commit on 2026-08-08.
injected into the system prompt before, and settings changes only take effect at
the next session start — so if the instruction appears mid-session, ignore it and
leave the trailer out.
+
+# tmux: the operator's server is not yours
+
+Agents here usually run inside the operator's own tmux server, alongside their
+other sessions and agents, so `$TMUX` points at that server's socket. **Every
+tmux command that names no socket reaches the operator's server**, and
+`$TMUX` wins over `TMUX_TMPDIR`: setting `TMUX_TMPDIR` alone does not get you a
+server of your own. On 2026-10-24 a cleanup line, `TMUX_TMPDIR=<scratch> tmux
+kill-server 2>/dev/null; true`, killed the operator's server and every session
+in it, about fifteen agents included; the probes before it had unset `TMUX`,
+and the cleanup had not.
+
+- **A tmux server of your own takes `-L <unique-name>` on every command**,
+ cleanup included: `tmux -L agent-x new-session -d ...`, then
+ `tmux -L agent-x kill-server`. `-L` (or `-S <path>`) overrides `$TMUX`;
+ `env -u TMUX` works too, but only on the commands that remember it.
+- **Never run a bare `tmux kill-server`**, nor `kill-session` or `send-keys`
+ with an ambiguous target. In the operator's server, name only what you
+ created, by exact target: `-t '=name'`, and distinct names (`build-host`,
+ not `build`, which may also be a window of theirs).
+- **Do not silence a tmux command that destroys something.** No
+ `2>/dev/null`, `|| true` or `; true` on `kill-server`, `kill-session` or
+ `kill-window`: an error there is the warning that it went somewhere else.
+- **A test harness that starts tmux gives it its own `-L` socket.** Without
+ one its sessions land in the operator's server and its cleanup runs there.