I found this on 13 August 2026, with Kitty 0.48.1 and tmux 3.6b on macOS. Run straight in Kitty, the pi coding agent takes Shift+Enter as a newline. Run inside tmux in the same Kitty window, the same key sends the message. tmux’s extended-key settings were already in effect. The key was lost because Kitty ignores the one request tmux makes for modified keys.
In pi, Shift+Enter and Ctrl+J insert a newline. Option+Enter is not a newline at all: it queues the input as a follow-up. Ctrl+J sends a plain line feed, which needs no modifier protocol, and it kept working inside tmux the whole time. So the only key that was actually broken was Shift+Enter.
What was ruled out
The state of the machine at the time:
tmux -Vprinted 3.6b.- On the running server,
extended-keyswasalwaysandextended-keys-formatwascsi-u.~/.tmux.confsaidon, and either value lets pi ask for extended keys. tmux display-message -p '#{client_termname} #{client_termfeatures}'showed the client asxterm-kittywithextkeys, which came fromset -s terminal-features[3] 'xterm*:extkeys'in the config.- Kitty had no custom mapping for
shift+enter, andmacos_option_as_altwas alreadyboth.
Pi’s documentation says that on tmux 3.5 or later the two extended-keys lines are enough. Both were set, and the server was using them, so editing the tmux config again or running source-file once more could not change anything. The fault had to be further out, between tmux and the terminal.
The path the key takes
Run directly in Kitty, pi starts by sending CSI > 7 u and then CSI ? u, which asks for the first three flags of the Kitty keyboard protocol: disambiguate, report event types and report alternate keys. Kitty agrees, and from then on Shift+Enter arrives as CSI 13 ; 2 u, which pi reads as a newline.
Inside tmux, pi’s request lands on tmux’s pane and never reaches Kitty. tmux asks the outer terminal for modified keys on its own, using the extkeys feature defined in tty-features.c:
Eneks=\E[>4;2m
Dseks=\E[>4m
When extended-keys is not off, tty_update_features sends Eneks to the outer terminal. That is xterm’s modifyOtherKeys mode 2: report every key pressed with a modifier as an extended sequence. A terminal that honours it reports Shift+Enter as CSI 27 ; 2 ; 13 ~, and tmux, with extended-keys-format csi-u, rewrites that to CSI 13 ; 2 u for pi.
Kitty 0.48.1 does not honour it. screen_modify_other_keys does nothing except, when the keyboard protocol is off, log that the application is trying to use xterm’s modifyOtherKeys, which the Kitty keyboard protocol has superseded. The keyboard stays in the legacy encoding, where Enter and Shift+Enter are both a single \r. tmux has no modifier to keep, passes the byte through, and pi reads it as Send.
| Path | What the application asks for | What Kitty sends for Shift+Enter | What pi receives |
|---|---|---|---|
| Kitty, then pi | pi sends CSI > 7 u, CSI ? u (Kitty keyboard protocol) | CSI 13 ; 2 u | CSI 13 ; 2 u: a newline |
| Kitty, then tmux, then pi | tmux sends CSI > 4 ; 2 m (xterm modifyOtherKeys 2); pi’s request stops at tmux | \r, since Kitty ignores the request | \r: Send |
That is also why the direct path works. There pi asks for Kitty’s own protocol, and Kitty says yes. Through tmux the request is for xterm’s older protocol, and Kitty says no.
The fix
Make Kitty send the sequence pi understands before the key ever reaches tmux. In ~/.config/kitty/kitty.conf:
map shift+enter send_text all \x1b[13;2u
map alt+enter send_text all \x1b[13;3u
The first line is the newline. The second is pi’s follow-up queue, not a newline; without it Option+Enter is still indistinguishable from Enter inside tmux. send_text all applies in every keyboard mode Kitty has, so the two combinations send the same bytes whether the outer terminal is in the legacy encoding or has the keyboard protocol turned on. tmux then sees an extended key it can pass on, and pi gets the same sequence it gets without tmux.
tmux does not need a restart, but the running Kitty has to read its config again; until it does, the new mappings exist only in the file. This machine had allow_remote_control off, so kitten @ could not reload it. The reload key depends on the platform: Ctrl+Cmd+, on macOS and Ctrl+Shift+F5 on Linux. I pressed the Linux key first, on a Mac. The window came to the front, nothing was reloaded, and Shift+Enter still sent the message, which looked exactly like a wrong fix. After Ctrl+Cmd+,, pi inside tmux took Shift+Enter as a newline.
Without a shortcut, sending SIGUSR1 to the Kitty process reloads it too: kill -SIGUSR1 <kitty pid>. Kitty 0.48 also has auto_reload_config on by default and rereads the file about a tenth of a second after it changes. If a change seems to do nothing, check which key you pressed before you doubt the config.
The essay on keyboard shortcut systems treats modifiers as layer selectors. This is the same idea one level down: Kitty, tmux and pi each decide what a modified key means, and the layer that drops the modifier is rarely the one you are configuring. I run pi in tmux next to other agents, watched by tmux-radar, and these two lines are what make the newline key work there.
A check that misleads
Inside tmux, cat -v still shows this key as ^M, even with the fix in place. cat never sends CSI > 4 ; 2 m, and with extended-keys on in the config, tmux writes extended sequences to a pane only after the program in it asks for them. Without that request, tmux folds a CSI 13 ; 2 u from Kitty back into \r. Pi sends the request when it starts, so pi working while cat -v shows ^M is consistent, not a contradiction.
The running server was on always. With that value tmux forces mode 1 even when no program asked, and cat -v does show the extended sequence. The next tmux kill-server brings back the file’s on, which is the value you want. Do not switch to always just to make cat -v look right.