Preflight Checklist
What's Wrong?
What's Wrong?
The VS Code extension (anthropic.claude-code) continuously overwrites ~/.claude.json while running, stripping fields like hasCompletedOnboarding, lastOnboardingVersion, projects (including hasTrustDialogAccepted), and installMethod. This forces the CLI to show the full onboarding flow (theme picker, trust dialog) every time it's launched from a VS Code terminal.
The extension rewrites ~/.claude.json on every tool use (updating toolUsage counts), but the rewrite strips fields that the CLI wrote. The userID changes on each rewrite, suggesting the extension creates a fresh config object rather than merging. firstStartTime resets repeatedly (observed 4 resets in a single session). The CLAUDECODE=1 environment variable injected by the extension also blocks CLI launches entirely.
This is a regression — running the extension and CLI side by side in VS Code previously worked without issues.
What Should Happen?
- The extension should merge into
~/.claude.json rather than overwriting it, preserving fields written by the CLI
- Or: the extension and CLI should use separate config storage so they don't conflict
- The
CLAUDECODE=1 env var should not be injected into user-opened terminals (only into extension-managed terminals)
Error Messages/Logs
When trying to launch CLI from VS Code terminal:
Error: Claude Code cannot be launched inside another Claude Code session.
Nested sessions share runtime resources and will crash all active sessions.
To bypass this check, unset the CLAUDECODE environment variable.
After clearing `CLAUDECODE`, full onboarding is shown instead of the normal CLI prompt.
During debugging, `~/.claude.json` was fully reset at least 4 times:
- `firstStartTime` changed from `12:15:48Z` → `14:30:34Z` → `15:19:35Z` (all same day)
- `userID` changed 3 times (3 distinct hashes)
- Fields like `hasCompletedOnboarding`, `projects`, `installMethod` were present after manual edit, then gone seconds later
Steps to Reproduce
- Open VS Code with the
anthropic.claude-code extension installed and active
- Open a PowerShell terminal inside VS Code
- Clear the CLAUDECODE env var:
Remove-Item Env:\CLAUDECODE
- Run
claude
- Complete the onboarding (theme, trust dialog, login)
- Verify
~/.claude.json contains "hasCompletedOnboarding": true
- Wait a few seconds — the extension overwrites the file, losing those fields
- Open another terminal tab, run
claude again → full onboarding shown again
Note: The bug also happens with Python files containing CLI scripts.
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
2.1.59
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
Preflight Checklist
What's Wrong?
What's Wrong?
The VS Code extension (
anthropic.claude-code) continuously overwrites~/.claude.jsonwhile running, stripping fields likehasCompletedOnboarding,lastOnboardingVersion,projects(includinghasTrustDialogAccepted), andinstallMethod. This forces the CLI to show the full onboarding flow (theme picker, trust dialog) every time it's launched from a VS Code terminal.The extension rewrites
~/.claude.jsonon every tool use (updatingtoolUsagecounts), but the rewrite strips fields that the CLI wrote. TheuserIDchanges on each rewrite, suggesting the extension creates a fresh config object rather than merging.firstStartTimeresets repeatedly (observed 4 resets in a single session). TheCLAUDECODE=1environment variable injected by the extension also blocks CLI launches entirely.This is a regression — running the extension and CLI side by side in VS Code previously worked without issues.
What Should Happen?
~/.claude.jsonrather than overwriting it, preserving fields written by the CLICLAUDECODE=1env var should not be injected into user-opened terminals (only into extension-managed terminals)Error Messages/Logs
Steps to Reproduce
anthropic.claude-codeextension installed and activeRemove-Item Env:\CLAUDECODEclaude~/.claude.jsoncontains"hasCompletedOnboarding": trueclaudeagain → full onboarding shown againNote: The bug also happens with Python files containing CLI scripts.
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
2.1.59
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
hasTrustDialogAccepted: truevia sed (overwritten within seconds), addinghasCompletedOnboarding: true(overwritten), PowerShell profile wrapper to fix config before each launch (overwritten between write and CLI read),CLAUDE_CONFIG_DIRpointing CLI to separate directory (did not help)