aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xclaude-templates/bin/ai13
1 files changed, 10 insertions, 3 deletions
diff --git a/claude-templates/bin/ai b/claude-templates/bin/ai
index 63dc2e9..5a806ec 100755
--- a/claude-templates/bin/ai
+++ b/claude-templates/bin/ai
@@ -27,6 +27,13 @@
SESSION="ai"
CLAUDE_CMD="claude"
+# Run in the pane's shell just before Claude launches. `stty susp undef` clears
+# the tty's SIGTSTP (C-z) character for this pane only, so an accidental C-z is
+# passed through to Claude as input rather than suspending the session to the
+# shell. Scoped here so C-z keeps working as job control in every other
+# terminal, shell, and program.
+LAUNCH_PREFIX="stty susp undef; "
+
# Format the per-project opening line passed to claude. Takes the project
# directory's basename; returns a string of the form
# "This is <host> <name> project. Follow all instructions in .ai/protocols.org."
@@ -66,7 +73,7 @@ create_window() {
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
+ tmux send-keys -t "$wid" "${LAUNCH_PREFIX}$CLAUDE_CMD \"$instructions\"" Enter
echo "$wid"
}
@@ -311,7 +318,7 @@ single_mode() {
local instructions
wid=$(tmux new-session -d -s "$SESSION" -n "$name" -c "$dir" -P -F '#{window_id}')
instructions=$(build_instructions "$name")
- tmux send-keys -t "$wid" "$CLAUDE_CMD \"$instructions\"" Enter
+ tmux send-keys -t "$wid" "${LAUNCH_PREFIX}$CLAUDE_CMD \"$instructions\"" Enter
fi
sort_windows
@@ -371,7 +378,7 @@ multi_mode() {
local instructions
first_wid=$(tmux new-session -d -s "$SESSION" -n "$name" -c "$dir" -P -F '#{window_id}')
instructions=$(build_instructions "$name")
- tmux send-keys -t "$first_wid" "$CLAUDE_CMD \"$instructions\"" Enter
+ tmux send-keys -t "$first_wid" "${LAUNCH_PREFIX}$CLAUDE_CMD \"$instructions\"" Enter
for entry in "${selected[@]:1}"; do
dir="${entry/#\~/$HOME}"
name="$(basename "$dir")"