From tmux-plugin
tmux pane/windowのプロセスを監視し、失敗時にログを取得して原因分析する。「このコマンドを監視して」「failwatchで見守って」「失敗したら教えて」と言われた時に使用する。
How this skill is triggered — by the user, by Claude, or both
Slash command
/tmux-plugin:tmux-failwatchThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
tmux paneのプロセス完了を監視し、失敗時にログ取得と原因分析を行う。
tmux paneのプロセス完了を監視し、失敗時にログ取得と原因分析を行う。
watch <target> → プロセス完了を待機 → 終了コードチェック → 失敗時ログ取得
check <target> → 指定paneの最新状態を即座にチェック
if [ -z "$TMUX" ]; then
echo "Error: tmuxセッション内で実行してください"
exit 1
fi
# ターゲットの解決(未指定時は現在のwindow)
TARGET="${1:-$(tmux display-message -p '#{window_index}')}"
# window:pane 形式の解析(:区切りを優先、.含むwindow名に対応)
case "$TARGET" in
*:*) WINDOW="${TARGET%%:*}"; PANE="${TARGET##*:}" ;;
*) WINDOW="$TARGET"; PANE="0" ;;
esac
TARGET_SPEC="${WINDOW}.${PANE}"
指定paneのプロセス完了を監視する。
# paneのPIDを取得
PANE_PID=$(tmux display-message -t "${TARGET_SPEC}" -p '#{pane_pid}')
if [ -z "$PANE_PID" ]; then
echo "Error: ターゲットpaneが見つかりません: ${TARGET_SPEC}"
exit 1
fi
# 子プロセスの完了を待機
echo "Watching pane ${TARGET_SPEC} (PID: ${PANE_PID})..."
# paneのコマンドが完了するまでポーリング(タイムアウト付き)
TIMEOUT="${TMUX_FAILWATCH_TIMEOUT:-600}" # デフォルト10分
ELAPSED=0
while [ "$ELAPSED" -lt "$TIMEOUT" ]; do
# paneが存在するか確認
if ! PANE_CMD=$(tmux display-message -t "${TARGET_SPEC}" -p '#{pane_current_command}' 2>/dev/null); then
echo "Error: pane ${TARGET_SPEC} が閉じられました"
exit 1
fi
# シェルに戻った = コマンド完了
case "$PANE_CMD" in
bash|zsh|fish|sh|dash|ksh|csh|tcsh|pwsh)
break
;;
esac
sleep 2
ELAPSED=$((ELAPSED + 2))
done
if [ "$ELAPSED" -ge "$TIMEOUT" ]; then
echo "Error: タイムアウト (${TIMEOUT}秒) に達しました"
echo "現在のコマンド: ${PANE_CMD}"
exit 1
fi
# paneのログを取得
LOG=$(tmux capture-pane -t "${TARGET_SPEC}" -p -S -50)
# コマンド完了を通知
echo "=== プロセス完了 ==="
echo "Pane: ${TARGET_SPEC}"
echo ""
echo "=== ログ末尾 ==="
echo "$LOG" | tail -30
指定paneの現在の状態を即座にチェックする。
# paneの現在のコマンド
PANE_CMD=$(tmux display-message -t "${TARGET_SPEC}" -p '#{pane_current_command}')
PANE_PID=$(tmux display-message -t "${TARGET_SPEC}" -p '#{pane_pid}')
PANE_CWD=$(tmux display-message -t "${TARGET_SPEC}" -p '#{pane_current_path}')
echo "=== Pane ${TARGET_SPEC} 状態 ==="
echo "Command: ${PANE_CMD}"
echo "PID: ${PANE_PID}"
echo "CWD: ${PANE_CWD}"
echo ""
# ログ末尾を取得
LOG=$(tmux capture-pane -t "${TARGET_SPEC}" -p -S -30)
echo "=== ログ末尾 ==="
echo "$LOG"
ログ取得後、Claudeが以下を分析して提示する:
npx claudepluginhub caphtech/claude-marketplace --plugin tmux-pluginManages TMUX background processes: starts services in named panes of a 'claude-controlled' window, checks output, restarts, finds existing panes by title.
Executes shell commands in other tmux panes with exit code detection; sends messages to CLI agents/scripts for inter-pane communication and coordination.
Manages tmux sessions, windows, and panes for persistent remote workflows and shell scripting automation. Useful for long-running processes, SSH disconnects, and multi-pane terminal layouts.