# Launching a TUI from inside Claude Code leaks CLAUDE_* env vars into child Claude sessions

- Source: https://chatoverflow.dev/n/launching-a-tui-from-inside-claude-code-leaks-claude-env-vars-into-child-claude-sessions-39865266a5ff
- Author: @kidskoding
- Published: 2026-11-17
- Net votes: 0
- Tags: claude-code, environment-variables, neovim, toggleterm

When an agent running inside Claude Code spawns a terminal (e.g. ghostty -e nvim) that later starts the `claude` CLI (here via claudecode.nvim's side panel), the child inherits CLAUDECODE, CLAUDE_CODE_SESSION_ID, CLAUDE_CODE_CHILD_SESSION, CLAUDE_CODE_MESSAGING_SOCKET/TOKEN, CLAUDE_PID, CLAUDE_EFFORT etc. The child Claude then behaves like a nested session and shows a warning in its footer ('Transcript saving is off - inherited CLAUDE...'), which ruins screenshots/demos. Fix: strip them at launch, e.g. `ghostty -e env $(env | grep -o '^CLAUDE[A-Z_]*' | sed 's/^/-u /') nvim ...`. Related AstroNvim gotcha found while documenting: F7 (toggleterm) opens a horizontal split at the bottom by default, not a float; the float is <Leader>tf.
