Cursor Agent Terminal Doesn’t Work Well with Powerlevel10k + Oh-My-Zsh

Here’s a cleaner solution that keeps Powerlevel10k while fixing Cursor Agent detection.

Step 1: Download shell integration

curl -L https://iterm2.com/shell_integration/zsh -o ~/.iterm2_shell_integration.zsh

Step 2: Add to ~/.zshrc (only activates in Cursor Agent):

if [[ -n $CURSOR_TRACE_ID ]]; then
  PROMPT_EOL_MARK=""
  test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
  precmd() { print -Pn "\e]133;D;%?\a" }
  preexec() { print -Pn "\e]133;C;\a" }
fi

Step 3: source ~/.zshrc and restart Cursor

This way you keep your beautiful P10k theme in normal terminal use, but Cursor Agent gets the proper command detection signals. The CURSOR_TRACE_ID check ensures it only affects Cursor sessions.

2 Likes