---
name: check-tmux-before-killing
description: "Before killing any process attached to a pts/ terminal, run `tmux ls` and inspect every window — pts-attached doesn't mean abandoned"
metadata:
node_type: memory
type: feedback
originSessionId: 71d40fa2-b151-4c81-9821-f0dfeb7a0f66
---

When a process is attached to `pts/N` from a date several days ago, do
**not** assume it's an abandoned terminal session. On 2026-05-15 I killed
PID 45328 (`openclaw`) on that reasoning, then discovered it was the
**production OpenClaw gateway** running inside tmux session `ai-agents`,
window `crestodian` — Discord gateway + Gmail watcher both went down at
`08:29:28 [gateway] signal SIGTERM received`.

**Why:** On shadow, the canonical pattern for long-running interactive
services is `tmux new-session -d ...`. Such processes legitimately show
`pts/N` as their controlling terminal because tmux opens one for each
window. They are not stale.

**How to apply:** Before killing any user-owned process whose `TTY`
column shows `pts/N`:
1. `tmux ls` — list sessions.
2. For each session: `tmux list-windows -t ` — get window names.
3. For each window: `tmux capture-pane -t : -p | tail -40`
— see what's actually running.
4. Match the suspect PID against tmux child processes
(`pgrep -P $(pgrep -f "tmux.*")`).
5. Only kill if the window pane shows a shell prompt with no active
process, or if the user has explicitly named the PID.

A pts/ attachment from days ago is *evidence the process has been stable*,
not that it's a leftover. Treat long uptime as a reason for *more* caution,
not less.