Enable hot-reload for SDK configuration by migrating from CLI args to settings files
I just discovered something really cool in Claude Code v1.0.90 - the settings files now support hot-reload. Yesterday I was looking at the release notes and noticed this feature where you can edit ~/.claude/settings.json and Claude Code picks up the changes immediately without needing to restart anything. This is amazing for interactive mode.
But here's the thing - I'm working on an app that uses Claude Code in SDK mode, and I have to pass all the configuration through CLI arguments every time. Looking at my code in Shift/Utils/ClaudeCode.swift:L837, I'm building these massive command strings with --add-dir, --mcp-config, --allowedTools, and all sorts of other flags. Every time I want to change which directories are accessible or update the MCP server configuration, I have to restart my entire AgentRunner process.
This morning I realized we're missing out on a huge opportunity here. If SDK mode could read from the same settings files that interactive mode uses - ~/.claude/settings.json, .claude/settings.json, and .claude/settings.local.json - then we could get the same hot-reload benefits. Imagine being able to add a new directory to additionalDirectories in the settings file and having the SDK pick it up instantly without restarting the parent process.
The way I see it working is that SDK mode would check for these configuration files first, then CLI arguments could override specific settings if needed. This would be backward compatible - existing SDK integrations keep working with their CLI args, but new ones could leverage the file-based config for dynamic updates.
This connects to the broader vision of making Claude Code more adaptable in production environments. Right now, changing SDK configuration means killing processes, losing context, and disrupting user workflows. With hot-reload from settings files, we could adjust permissions, add new MCP servers, or modify allowed tools on the fly.
The implementation seems straightforward since the file watching and hot-reload logic already exists for interactive mode. We'd just need to extend it to SDK mode and ensure CLI args properly override file settings when both are present.
Success looks like:
- [ ] SDK mode reads configuration from
~/.claude/settings.jsonand project-level settings files - [ ] Changes to settings files are picked up without restarting the SDK process
- [ ] CLI arguments override settings from files when both are specified
- [ ] Documentation updated to explain the configuration precedence
- [ ] The
--add-dirdirectories can be managed viaadditionalDirectoriesin settings - [ ] MCP server configuration can be updated through settings files instead of
--mcp-configJSON
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗