home ¦ Archives ¦ Atom ¦ RSS

The CLAUDECODE Environment Variable

Across my personal gear, the bash login startup has a pretty florid banner generated by hyfetch. This is fine for the occasional human paced terminal shell instantiation. However, when using claude code for agentic coding there’s a Bash tool which seems to use my login profile. The banner is just junk that eats up the context token budget, so I was casting about for a means to disable it when Claude was doing the invocation. Claude swore it wasn’t using a login shell, despite evidence to the contrary. I figured with all the agentic coding excitement, surfacing a discussion of this point would be relatively fruitless straightforward. Sadly I ended up a bit disappointed.

Turns out there’s a CLAUDECODE environment variable that is set to 1 for the Bash tool. I couldn’t really find any documentation other than this acknowledgment in a GitHub issue. Thought I’d publish a note on the Web in case someone else is struggling here as well. In any event, the following bash snippet conserves a few tokens.

if [[ -z "$CLAUDECODE" ]]; then
   if [[ -x $HOME/.local/bin/neowofetch ]]; then
      neowofetch --package_managers off --package_minimal
   fi
fi

Alternatively, the Claude Code documentation indicates the ability to customize the environment through a settings.json file, thereby allowing you to define your own flag if you’d like.

© 2008-2025 C. Ross Jam. Built using Pelican. Theme based upon Giulio Fidente’s original svbhack, and slightly modified by crossjam.