Expose AI_AGENT=codex to shell subprocesses
Problem
Tools launched by Codex currently have Codex-specific signals such as CODEX_THREAD_ID, but no stable, vendor-neutral way to learn which AI agent invoked them. Downstream CLIs therefore need an expanding set of product-specific heuristics (environment variables, parent-process names, and terminal behavior) to decide whether to use machine-readable output, suppress pagers, avoid prompts, or shorten progress output.
Proposal
Set AI_AGENT=codex in the environment built for shell commands, while preserving any non-empty value supplied by a wrapper.
AI_AGENT is useful as a universal marker because the producer knows its identity exactly, while every downstream tool otherwise has to rediscover it imperfectly. One common marker scales across agents and tools: each agent writes one slug, and consumers read one variable instead of carrying an N-by-M matrix of vendor heuristics.
This would be an advisory UX hint only. It must not be treated as an authorization, sandbox, policy, or trust boundary, because child processes and wrappers can modify environment variables.
I have a focused implementation and unit tests prepared on a fork, but am opening this enhancement first because the external contribution template says code PRs are by invitation and must link an enhancement request.
1 Comment
Alternatively, there is the
AGENT=codexoption.