Governance Hard ยท client-enforced GA ⓘ legend

Policies

Governance the client enforces regardless of what the model decides. This is the hard counterpart to conventions — and the thing people most often confuse with them.

Analogy โ€” conventions are the employee handbook; policies are the building’s keycard system and the firewall. The handbook asks; the keycard enforces. You don’t secure a server room with a memo.

Two layers, both hard

Permission rules

Declarative allow / ask / deny patterns in settings.json. Evaluated deny โ†’ ask โ†’ allow, first match wins. Config, not code — that’s what separates them from hooks.

"permissions": {
  "deny":  ["Read(./.env)", "Bash(curl *)"],
  "ask":   ["Bash(git push *)"],
  "allow": ["Bash(npm run test*)"],
  "defaultMode": "acceptEdits"
}

Managed settings (the enterprise policy layer)

Admin-deployed managed-settings.json at the highest precedence — cannot be overridden by user, project, or local settings. Permission rule arrays merge across scopes; most other keys override by priority.

Locations & managed-only keys

macOS /Library/Application Support/ClaudeCode/managed-settings.json ยท Linux/WSL /etc/claude-code/managed-settings.json ยท Windows C:\Program Files\ClaudeCode\managed-settings.json or HKLM\SOFTWARE\Policies\ClaudeCode.

Managed-only keys: allowManagedPermissionRulesOnly, allowManagedHooksOnly, allowManagedMcpServersOnly, forceLoginOrgUUID, availableModels, allowedMcpServers/deniedMcpServers, claudeMd, sandbox.enabled, disableWorkflows.

Subtle but exam-relevant A managed claudeMd key injects behavioral guidance org-wide — but it’s still soft guidance shipped through the hard layer. Managed settings (deny rules, sandbox) are the technical enforcement. Same delivery, different nature.

When to reach for it

โœ“
Something must be blocked or required for everyone, always (secrets, destructive commands).
โœ“
Silence prompts on safe, recurring commands (allow) or force a prompt on risky ones (ask).
โœ“
Org-wide: pin available models, restrict MCP servers, force login org, enable sandbox.

When not to

โœ•
Soft style preferences โ†’ CLAUDE.md.
โœ•
Logic config can’t express (inspect file contents, call an API to decide) โ†’ a PreToolUse hook.

Best practices

โ˜…
deny secrets and destructive commands first; deny always wins.
โ˜…
Controlling models takes three keys together: availableModels + model + ANTHROPIC_DEFAULT_*_MODEL (the model setting alone is only the initial selection, not enforcement).
โ˜…
Use allowManagedPermissionRulesOnly to stop users adding their own allowlist entries.

Sources