Terminal-interactive sessions register as Agent Teams leads by default, write no transcript, and silently override --session-id (npm 2.1.198?-2.1.201; 2.1.197 unaffected)

Open 💬 0 comments Opened Jul 5, 2026 by voidbotzero

Environment

  • @anthropic-ai/claude-code 2.1.201 via npm (nvm, node v24.11.1), macOS Darwin 25.5.0 (arm64)
  • Auth: Claude subscription (keychain); Claude Desktop app coexists on the machine (bundles CLI 2.1.197, unaffected)
  • CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS is set NOWHERE user-controllable. Swept and clean: ~/.claude/settings.json (+ .local), project settings, managed-settings, ~/.claude.json, statsig cache, shell snapshots, all shell rc files, launchd (launchctl getenv), Terminal.app process env, and the parent zsh of the affected process (ps eww).

Repro

  1. In Terminal.app: cd <project> && claude --session-id <minted-uuid>
  2. Complete one real turn (the bug is visible at init; the missing transcript is provable after a turn).
  3. Observe.

Observed

  • A team registration appears at ~/.claude/teams/session-<internal-id>/ — the minted --session-id is discarded and replaced by an internally minted lead id.
  • No <sid>.jsonl is written under ~/.claude/projects/<cwd-slug>/ for either id. lsof on the live process shows zero .jsonl write handles. The session is unrecoverable and non-resumable after exit.
  • ps eww on the session shows CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 and CLAUDE_CODE_CHILD_SESSION=1 in the process env even though no ancestor carries them — the CLI self-injects the flag into its startup respawn, i.e. the feature is ON by default for headed terminal sessions on this version.
  • Secondary inheritance path: terminals spawned under a Claude Desktop process tree inherit the flag (CLAUDE_CODE_ENTRYPOINT=claude-desktop, CLAUDE_CODE_SESSION_ID=<desktop-sid> observed in a carrier seat), so a pre-existing desktop session keeps re-infecting child terminals even after settings hygiene.

Evidence matrix (3 controlled terminal runs, machine-verified)

| Run | CLI version | env -u CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS? | Team registered | Transcript |
|---|---|---|---|---|
| A | 2.1.201 | no | yes (teams/session-<internal-id>) | none; --session-id overridden to internal id |
| B | 2.1.201 | yes | no | flat <sid>.jsonl, lineage token present; later resumed successfully with content recall |
| C | 2.1.197 (isolated npm install --prefix) | no | no | flat <sid>.jsonl; env carries neither CHILD_SESSION nor the flag |

Headless claude -p and desktop-app sessions on the same machine persist normally throughout.

Expected

  • The transcript persists under the --session-id the user passed.
  • An experimental multi-session feature does not switch on silently for standard terminal sessions.
  • Even when a session is a team lead, its conversation is persisted somewhere recoverable/resumable.

Impact

Silent, total loss of terminal session history: no resume, no --continue, no transcript-based tooling. Compounded by --continue exiting 0 on nothing-to-continue, so automation reports success while history is being dropped.

Workarounds (both verified)

  1. Spawn terminal sessions with the flag stripped: env -u CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS claude ...
  2. Pin @anthropic-ai/claude-code@2.1.197.

Notes

  • Regression window stated honestly: 2.1.197 good, 2.1.201 bad; 2.1.198–2.1.200 untested.
  • The flag-value gate is odd: the env var being unset disables the feature even on 2.1.201, while --settings-level overrides ("", "0") do not.

View original on GitHub ↗