Expose whether a shell command was user-typed (`!`) vs agent-initiated
Status Open
Maintainer reply None cached
Activity 0 comments · opened Sep 1, 2026
Commands the user types via the ! prefix run in the same environment as agent-initiated Bash tool calls: identical env (CLAUDECODE=1, AI_AGENT=…) and no TTY. Child processes cannot tell a human typed the command.
This breaks CLIs that adapt behavior to agent environments. Concrete case: pulumi login detects CLAUDECODE and mints an ephemeral agent account instead of running its interactive browser login — even when the human typed ! pulumi login themselves, silently creating throwaway accounts.
Request: set a variable like CLAUDE_CODE_USER_INITIATED=1 (or omit CLAUDECODE) for ! bash-input commands, so tools can distinguish "human typed this" from "agent ran this".
Related: #531 (request to expose CLAUDECODE itself).