Cursor CLI fills zsh history file with shell env config snippets

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

This snippet shows up many times in my zsh history file since I’ve started using cursor agent. The agent confirmed that it’s due to it’s configuring of the shell env.

set +o ignoreeof
set -o interactive-comments
set +o keyword
set +o monitor
set +o noclobber
set +o noexec
set +o noglob
set +o nolog
set +o notify
set +o onecmd
set +o physical
set -o pipefail
set +o posix
set +o privileged
set +o verbose
set +o vi
set +o xtrace

Steps to Reproduce

Run the agent with zsh history enabled, make it do any shell commands and look at history file.

Expected Behavior

Cursor CLI should make sure that these commands don’t bleed through into the history.

Operating System

Linux

Version Information

2026.02.27-e7d2ef6

For AI issues: which model did you use?

opus 4.5

Additional Information

It’s resolved on my side by HISTORY_IGNORE=“(set [±]o *)”, I don’t need any further support.

From cursor agent:

Found the issue. Cursor is using bash (/usr/bin/bash), not zsh - so your zshaddhistory hook never gets called. But somehow commands are still being written to your zsh history file.
This is likely Cursor's terminal integration syncing commands to your zsh history. Since you can't control Cursor's shell initialization, the cleanest solution is to periodically clean your history.

The solution isn’t really acceptable.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This is a valid bug. The agent’s internal shell config commands shouldn’t end up in the user’s history file.

I’ve passed it on to the team. There’s no ETA yet, but your report helps us prioritize it.

As a temporary workaround, you’re already on the right track with HISTORY_IGNORE. If anything changes, I’ll update this thread.

Hi @deanrie

Adding a bit more technical context in case it’s helpful for the team: the repeated set +/-o block looks like part of the agent’s bootstrap shell configuration, and it seems to be executing while shell history is still enabled. That would explain why those internal setup commands end up being persisted into ~/.zsh_history, even though they aren’t user-issued commands.

If that’s the case, isolating the bootstrap phase for example by temporarily disabling history or running the setup in a non-interactive / non-persistent subshell should prevent the leakage without affecting normal user command history.

Hopefully that helps provide a bit more signal around the root cause.

1 Like