Developer shares .zshrc tips for handling both human and AI shell sessions
A developer has published a breakdown of key configurations in their Zsh shell setup, focusing on logic that adapts shell behavior depending on whether a human or an automated process is running it. A central feature is an AGENT_MODE flag that activates when environment variables like CI are set or the shell is non-interactive, disabling prompts, beeps, and interactive corrections that can confuse coding agents like Claude Code. In agent mode, destructive commands such as rm and mv are aliased with force flags to prevent agents from getting stuck on confirmation prompts they cannot answer. The setup also pulls API tokens and secrets from macOS Keychain at shell startup using a helper function, avoiding the risk of credentials being stored in plaintext dotfiles synced to GitHub. The full configuration is publicly available on GitHub, and the author notes that most developers have never considered how their interactive shell defaults can be hostile to non-interactive processes.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in