Korean IME composition buffer leaks into tmux send-keys during agent team spawning
Bug Description
When Claude Code spawns teammate agents via tmux, the send-keys command can be corrupted by residual Korean (Hangul) IME composition buffer data on macOS. This causes the agent launch command to fail.
Reproduction
Environment:
- macOS Darwin 25.3.0
- tmux 3.6a
- Claude Code 2.1.62
- Korean 2-Set IME enabled (
com.apple.inputmethod.Korean.2SetKorean) - Current layout: ABC (English) — bug occurs even when not actively in Korean mode
Steps:
- Have Korean IME installed and enabled (even if currently on ABC/English layout)
- Use Claude Code team mode to spawn multiple agents
- One or more agent panes receive corrupted commands
Expected:
cd /Users/user/project && env CLAUDECODE=1 ... --agent-id agent-c1@team ...
Actual:
본 cd /Users/user/project && env CLAUDECODE=1 ... --agent-id agent-c1@team ...
"본" (Korean Hangul syllable ㅂ+ㅗ+ㄴ) was prepended, causing command not found. The character came from the macOS IME composition buffer being flushed into the new pane, not from misinterpreted keystrokes.
Root Cause
Claude Code spawns agents using a two-step pattern:
tmux split-window -h # Create new pane
tmux send-keys '...' Enter # Send agent launch command
send-keys passes through the terminal's input processing pipeline, which includes the macOS IME layer. When a new pane is created and receives focus, macOS flushes any residual IME composition buffer into it — before the send-keys content arrives.
This is an intersection of:
- Claude Code: Using
send-keysinstead of passing the command as asplit-windowargument - macOS IME: Composition buffer leaking across terminal focus changes (known Apple InputMethodKit issue)
Proposed Fix
Pass the command directly as a split-window argument:
# Current (vulnerable to IME)
tmux split-window -h
tmux send-keys 'cd /path && env CLAUDECODE=1 ...' Enter
# Fixed (bypasses IME pipeline entirely)
tmux split-window -h 'cd /path && env CLAUDECODE=1 ...'
When the command is passed as a split-window argument, it becomes the pane's initial process via exec — it never touches the terminal input/IME pipeline. This would also fix the shell initialization race condition in #23513.
Related Issues
- #23513 — Team agents fail to start: tmux send-keys race condition
- #21382 — Korean IME composition fails in Quick Launcher
- #2620 — IME Composition Failure for Korean Character Input
- #23615 — Agent teams should spawn in new tmux window
Workarounds
- Install
macism(brew install laishulu/homebrew/macism) and add to~/.zshrc:
``bash``
if [[ -n "$TMUX" ]]; then
command -v macism &>/dev/null && macism com.apple.keylayout.ABC
fi
- Skip heavy shell init for agent panes in
~/.zshrc:
``bash``
if [[ -n "$CLAUDECODE" ]]; then return; fi
Impact
- Affects all macOS users with CJK (Korean/Japanese/Chinese) IME installed
- Causes intermittent agent spawn failures in team mode
- Agent appears to start but receives garbled command → silent failure or delayed retry
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗