[BUG] Settings file written with unexpected ordering
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
My ~/.claude/settings.json file is a symlink to a file in a Git repo, so whenever Claude edits the settings file automatically, I need to either commit those changes or revert them. When I first edited the file myself, I put the top-level keys in lexicographical order. However, when Claude subsequently edited the file, the keys were no longer in lexicographical order. I could see this making sense if there's Claude were simply inserting new settings at the end, or if there were a specific documented fixed ordering Claude uses, but neither of those seem to be the case: for instance, the Available settings list in the documentation is in lexicographical order.
What Should Happen?
Probably the keys should remain in their original order; this is what VS Code does, for instance. Or at the very least, the order they use should match the documentation.
Error Messages/Logs
Steps to Reproduce
- Create
~/.claude/settings.jsonwith these contents:
```json
{
"autoMemoryEnabled": false,
"permissions": {
"defaultMode": "bypassPermissions"
}
}
- Run
claude - Select "Yes, I accept"
- Observe that the keys in
~/.claude/settings.jsonare in neither lexicographical order nor insertion order:
``json``
{
"permissions": {
"defaultMode": "bypassPermissions"
},
"autoMemoryEnabled": false,
"skipDangerousModePermissionPrompt": true
}
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.148 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗