Some Bits: Nelson's log

Claude Code: no login shell for agent

Claude Code regularly runs “agents”, a fancy word for shell scripts. Unfortunately for some dumb reason they chose to run the agent in a bash login shell, which means it runs the script for all sorts of stuff you only want in an interactive shell. To stop it, I put this guard in my .bash_login.

if [[ -n “$CLAUDECODE” ]]; then
echo “Detected Claude Code. Not running login script.”
return
fi

The real problem was I had put cd $HOME in my .bash_login. Not sure why, that probably solved a problem I had 25 years ago. This was confusing the agent something awful, particularly when it was moving files around or dealing with git. It kept doing things in my home directory, potentially catastrophic!