Skip to content

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

Open
sw-square wants to merge 1 commit intoblock:mainfrom
sw-square:swesterman-goose.2026-02-05.add-agent-env-var
Open

feat: add AGENT=goose environment variable for cross-tool compatibility#7017
sw-square wants to merge 1 commit intoblock:mainfrom
sw-square:swesterman-goose.2026-02-05.add-agent-env-var

Conversation

@sw-square
Copy link

@sw-square sw-square commented Feb 6, 2026

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.

Set AGENT=goose alongside GOOSE_TERMINAL=1 in all shell command executions.
This enables scripts and tools to detect AI agent execution without hardcoding
specific agent names.

The AGENT variable is set in developer extension, retry manager, computer
controller, and CLI update commands. Documentation updated with usage examples.
@sw-square sw-square marked this pull request as ready for review February 6, 2026 01:20
@sw-square sw-square requested a review from a team as a code owner February 6, 2026 01:20
Copilot AI review requested due to automatic review settings February 6, 2026 01:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a generic AGENT=goose environment variable to complement the existing GOOSE_TERMINAL=1 variable for better cross-tool compatibility. This enables users to write shell configuration that works across multiple AI agents without hardcoding agent-specific checks, following a pattern established by other agents like amp.

Changes:

  • Added AGENT=goose environment variable to all shell command executions alongside GOOSE_TERMINAL=1
  • Updated documentation to explain the new variable's purpose and provide usage examples
  • Maintains backward compatibility with existing GOOSE_TERMINAL checks

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
documentation/docs/guides/environment-variables.md Documents the new AGENT variable with clear examples and use cases
crates/goose/src/agents/retry.rs Adds AGENT=goose to shell command execution for both Windows (cmd) and Unix (sh)
crates/goose-mcp/src/developer/shell.rs Adds AGENT=goose to the shell command configuration
crates/goose-mcp/src/computercontroller/platform/windows.rs Adds AGENT=goose to Windows PowerShell automation commands
crates/goose-mcp/src/computercontroller/mod.rs Adds AGENT=goose to both PowerShell and Unix shell executions
crates/goose-cli/src/commands/update.rs Adds AGENT=goose to the update script execution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant