Summary
Add a standardized AGENT=claude environment variable to complement the existing CLAUDECODE=1 and CLAUDE_CODE_ENTRYPOINT=cli variables.
Prior Art
Both Goose and Amp have implemented this pattern with AGENT=goose and AGENT=amp respectively. Goose just added this recently: aaif-goose/goose#7017
Motivation
Currently, detecting whether any AI agent is running requires checking multiple tool-specific variables:
if [[ $CLAUDECODE != 1 && $GOOSE_TERMINAL != 1 && -z $AGENT ]]; then
# Setup non-agent stuff
fi
With a standardized AGENT variable, this simplifies to:
if [[ -z $AGENT ]]; then
# Setup non-agent stuff
fi
Use Case
Scripts and tools that work with multiple AI coding assistants need a standardized way to detect the execution environment. While CLAUDECODE=1 exists, a generic AGENT=claude variable would:
- Follow emerging standards: Matches the pattern established by other AI coding tools
- Enable better interoperability: Scripts can check
$AGENT to adjust behavior across different AI assistants
- Complement existing vars: Works alongside
CLAUDECODE and CLAUDE_CODE_ENTRYPOINT for more specific detection
Example Usage
# Detect if running under any agent
if [ -n "$AGENT" ]; then
echo "Running under $AGENT"
fi
# Agent-specific behavior
if [ "$AGENT" = "claude" ]; then
# Claude-specific optimizations
fi
Implementation
This would be a simple addition to the environment variables Claude Code sets when spawning processes, similar to how CLAUDECODE=1 is currently set.
Suggested label: enhancement
Summary
Add a standardized
AGENT=claudeenvironment variable to complement the existingCLAUDECODE=1andCLAUDE_CODE_ENTRYPOINT=clivariables.Prior Art
Both Goose and Amp have implemented this pattern with
AGENT=gooseandAGENT=amprespectively. Goose just added this recently: aaif-goose/goose#7017Motivation
Currently, detecting whether any AI agent is running requires checking multiple tool-specific variables:
With a standardized
AGENTvariable, this simplifies to:Use Case
Scripts and tools that work with multiple AI coding assistants need a standardized way to detect the execution environment. While
CLAUDECODE=1exists, a genericAGENT=claudevariable would:$AGENTto adjust behavior across different AI assistantsCLAUDECODEandCLAUDE_CODE_ENTRYPOINTfor more specific detectionExample Usage
Implementation
This would be a simple addition to the environment variables Claude Code sets when spawning processes, similar to how
CLAUDECODE=1is currently set.Suggested label: enhancement