Repository navigation
global claude settings plan
hbt edited this page Jun 22, 2025
·
1 revision
Currently, each Claude Code project has individual configurations stored in .claude.json with project-specific settings including:
-
allowedTools: Tools permitted for each project -
ignorePatterns: Files/directories to exclude -
mcpServers: MCP server configurations per project -
hasTrustDialogAccepted: Trust settings per project
Problems identified:
- Settings like allowedTools and ignorePatterns vary inconsistently across projects
- No centralized way to apply common settings across all projects
- Repetitive permission setup for each new project directory
- Inconsistent MCP server availability across different working directories
Create a centralized settings management system that:
- Defines common permissions that should be applied globally
- Maintains project-specific overrides when needed
- Syncs settings automatically when running
clcommand
- Find all
.claude/settings*.jsonfiles across/home/hassen/ - Catalog common
allowedToolspatterns (Bash, Read, Edit, Write, etc.) - Identify frequently used
ignorePatterns(node_modules, .git, .env, etc.) - Document project-specific settings that should remain local
- Create
~/.claude/global-settings.jsontemplate with common settings:{ "allowedTools": ["Bash", "Read", "Edit", "Write", "LS", "Glob", "Grep", "MultiEdit"], "ignorePatterns": ["node_modules", ".git", "*.log", ".env*", "dist", "build"], "commonMcpServers": { "browsermcp": true, "github-mcp": true, "gmail-mcp": true } }
- Add settings sync logic to
setupClaudeServersfunction - Merge global settings with existing project settings (non-destructive)
- Add
--skip-settings-syncflag for projects that need custom configs - Create backup of existing settings before modification
- Implement logic to:
- Copy global
allowedToolsif project has empty array - Merge
ignorePatterns(global + project-specific) - Apply
hasTrustDialogAccepted: truefor trusted global tools - Preserve project-specific MCP servers while adding global ones
- Copy global
When cl is executed:
- Load global settings template from
~/.claude/global-settings.json - Check if current directory has
.claude/settings.jsonor create it - Merge settings intelligently (project settings take precedence)
- Apply MCP server configurations
- Launch Claude Code with unified settings
{
"version": "1.0",
"globalDefaults": {
"allowedTools": [
"Bash", "Read", "Edit", "Write", "MultiEdit",
"LS", "Glob", "Grep", "Task", "TodoRead", "TodoWrite",
"WebFetch", "WebSearch"
],
"ignorePatterns": [
"node_modules/**",
".git/**",
"*.log",
".env*",
"dist/**",
"build/**",
".cache/**",
"tmp/**",
"*.tmp"
],
"hasTrustDialogAccepted": true,
"enabledMcpjsonServers": [],
"disabledMcpjsonServers": []
},
"projectOverrides": {
"/home/hassen/workspace/sensitive-project": {
"allowedTools": ["Read"],
"hasTrustDialogAccepted": false
}
}
}-
~/.claude/global-settings.json- Global settings template -
~/config/scripts/private/lib/claude-settings-manager.sh- Settings sync script - Enhanced
setupClaudeServersfunction inmisc.bash
# Normal usage - applies global settings
cl
# Skip settings sync for sensitive projects
cl --skip-settings-sync
# Force reset project settings to global defaults
cl --reset-to-global
# Show what settings would be applied
cl --dry-run- Consistency: All projects get same baseline permissions
- Security: Sensitive projects can opt-out with overrides
- Convenience: No repeated permission dialogs
- Maintainability: Central location for permission management
- Flexibility: Project-specific settings still supported
- Phase 1: ✅ Add browsermcp to global setupClaudeServers (COMPLETED)
- Phase 2: Audit existing settings across all projects
- Phase 3: Create global settings template
- Phase 4: Implement sync logic in setupClaudeServers
- Phase 5: Test with subset of projects
- Phase 6: Full rollout with documentation
- Settings Profiles: Different profiles for work/personal projects
- Validation: Ensure settings are valid before applying
- Backup/Restore: Easy rollback if settings cause issues
-
CLI Tool: Dedicated
claude-settingscommand for management - Integration: Sync with other development environment configs