feat: add AGENT=goose environment variable for cross-tool compatibility#7017
Open
sw-square wants to merge 1 commit intoblock:mainfrom
Open
feat: add AGENT=goose environment variable for cross-tool compatibility#7017sw-square wants to merge 1 commit intoblock:mainfrom
sw-square wants to merge 1 commit intoblock:mainfrom
Conversation
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.
Contributor
There was a problem hiding this comment.
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=gooseenvironment variable to all shell command executions alongsideGOOSE_TERMINAL=1 - Updated documentation to explain the new variable's purpose and provide usage examples
- Maintains backward compatibility with existing
GOOSE_TERMINALchecks
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a generic
AGENT=gooseenvironment variable that is set alongsideGOOSE_TERMINAL=1in 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:
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=1environment variable; it might be nice to eventually removeGOOSE_TERMINALifAGENTbecomes standardized.