From 68569726f4ca1e550a3e4e288a8f861703cdeb8e Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 19 May 2026 01:45:01 -0500 Subject: fix(ai): explicit end-of-session placement for new windows tmux's default new-window placement chooses the lowest free index, which can land between existing windows when the session's window indexes have gaps. The -a flag plus the :{end} target makes it explicit: insert after the existing last window, every time. The change only touches create_window. The two tmux new-session sites (single_mode and multi_mode first window) create fresh sessions; the first window's position is whatever base-index dictates, and there's nothing to append after. --- claude-templates/bin/ai | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/claude-templates/bin/ai b/claude-templates/bin/ai index a167174..63dc2e9 100755 --- a/claude-templates/bin/ai +++ b/claude-templates/bin/ai @@ -63,7 +63,7 @@ attach_session() { # Create a window in the ai session, launch claude, return window id. create_window() { local dir="$1" name="$2" wid instructions - wid=$(tmux new-window -t "$SESSION" -n "$name" -c "$dir" -P -F '#{window_id}') + wid=$(tmux new-window -a -t "$SESSION:{end}" -n "$name" -c "$dir" -P -F '#{window_id}') sleep 0.1 instructions=$(build_instructions "$name") tmux send-keys -t "$wid" "$CLAUDE_CMD \"$instructions\"" Enter -- cgit v1.2.3