feat: add AGENT=goose environment variable for cross-tool compatibility

Merged
SW
8mo ago
+7-0

Summary

This PR adds a generic AGENT=goose environment variable that is set alongside GOOSE_TERMINAL=1 in all shell command executions.

Motivation

There's quite a bit of setup in my configuration files that I don't want AI agents to use. It's quite annoying having to check for each individual agent's environment variables:

# ~/.zshrc
if [[  $CLAUDECODE != 1 && $GOOSE_TERMINAL != 1 && $AGENT != amp ]] then
	# setup non-agent stuff that can take awhile
	PS1= # ... setup PS1
	bindkey # ... custom keybinds for terminal
	source /.../zsh-syntax-highlighting.zsh # syntax highlighting and autosuggestions
	source /.../zsh-autosuggestions.zsh
	# modify path to include interactive scripts I don't want agents to use
	path+=( ~/_bin )
fi

I noticed that amp uses AGENT=amp, and I figured that's a good environment variable name to standardize on. This PR adds that in.

Note that this complements the GOOSE_TERMINAL=1 environment variable; it might be nice to eventually remove GOOSE_TERMINAL if AGENT becomes standardized.