Once Claude Code reaches more than a handful of engineers, the important question changes. It's no longer "how do I configure my session?" but "what is every session in the organization allowed to do, who decided that, how does the decision reach each laptop, CI runner and cloud VM, and how do we change it safely?" The set of files, keys, servers and processes that answer that question is your control plane. Your developers' sessions are the data plane it governs.

This session treats Claude Code's governance features as one system with five parts. Configuration: the settings hierarchy, managed settings, policy keys and rosters of agents and skills. Portability: AGENTS.md, the Agent Skills standard, plugins, and adapters for the other harnesses your teams run. Environment: sandbox policy, secrets, gateways and API providers. Knowledge delivery: rules, SessionStart context, plugin marketplaces and documentation. Operations: versions, staged rollout, diagnosis and rollback.

You'll leave able to write and review a managed-settings.json key by key, predict which value wins anywhere in the hierarchy, decide which control actually enforces a requirement (and which only asks nicely), distribute skills and agents through a marketplace, and roll a policy change out in rings with a tested way back. It builds on core-2 Settings (personal and project settings), agents-3 Plugins and agents-5 Guardrails. It also sets up the team-scale work in autonomy-3 and the governance loop in autonomy-5.

Version stampFacts on this page are as of 2026-10-24 (Claude Code v2.1.310). Claude Code ships weekly, so version-gated features are marked "requires v2.1.xxx+". Before you deploy a key fleet-wide, check its entry in the settings reference.

Configuration

Every Claude Code session computes its effective configuration from up to five settings levels. At the top sits a managed tier that can itself have four sources. Governing a fleet means owning the top of that stack, knowing exactly which lower values still count, and writing policy keys whose effect you can predict. This topic covers that resolution order end to end, then the policy keys and the rosters of agents and skills that sit on top of it.

The Settings Hierarchy

Claude Code reads settings from JSON files at five levels, and "when the same key appears in more than one place, Claude Code uses the value from the highest level that sets it". Highest precedence first:

#LevelWhere it livesWho it's for
1Managedmanaged-settings.json (plus managed-settings.d/), an MDM/OS policy, or server-managed settings from the claude.ai console or a Claude apps gatewayThe organization
2Command lineclaude --settings <file-or-json>One session
3Project local.claude/settings.local.json (at the git repo root since v2.1.211, kept out of git)You, in one project
4Shared project.claude/settings.json, committedEveryone in the repo
5User~/.claude/settings.jsonYou, in every project

That one sentence hides most of the governance-relevant detail. Five rules refine it, and each one has caused real policy surprises:

  1. Lists merge instead of overriding. permissions.allow, permissions.deny, hooks and most arrays combine across levels, so each file adds entries and none removes another file's. That's why a developer can extend a managed allowlist but can't delete a managed deny. Four keys break the pattern: fallbackModel (an ordered chain, taken whole from the highest file), modelPicker (taken from managed, --settings or user only, v2.1.242+), availableModels (a managed list applies as-is and ignores lower entries) and modelSettings (resolved per model).
  2. Environment variables aren't a level. Each variable/key pair has its own rule. ANTHROPIC_MODEL exported in a shell beats the model key in any file, while ANTHROPIC_DEFAULT_MODEL applies only when no file sets model. An env block inside a settings file is an ordinary key and follows the levels.
  3. A few security keys honor a stricter lower value. For some restrictive keys a lower level can tighten what the managed tier allows. Examples: disableClaudeAiConnectors: true from any scope, permissions.blockReadsOutsideWorkingDirectories: true from any scope (v2.1.257+), the lowest maxEffortLevel cap from any scope (v2.1.267+), and remoteControlAtStartup: false from project files. Loosening never flows upward.
  4. Some keys never apply from a repository file. permissions.defaultMode values auto and bypassPermissions "don't take effect from project or local settings" (before v2.1.257, bypassPermissions did). They aren't skipped, though. A repo auto makes Claude Code use the built-in default "rather than a defaultMode from ~/.claude/settings.json", and a repo bypassPermissions starts the session in Manual mode. Telemetry exporter variables in a repo's env are ignored too, as is any key whose Scope line says User, Managed or Global config. A cloned repository can't grant itself bypass mode or send your telemetry elsewhere.
  5. Some project keys wait for workspace trust. permissions.allow, additionalDirectories, extraKnownMarketplaces and most env values in .claude/settings.json apply only after each teammate trusts the folder. deny and ask rules apply right away. A claude -p run never shows the trust dialog.
Five levels, highest on top. The managed tier is one level made of up to four sources, and by default only one of them supplies the policy ("first-wins"): the lit room, which follows the source combiner further down this topic. Environment variables sit beside the stack and are decided pair by pair. ~/.claude.json is app state Claude Code writes for itself, not a settings level. Pick a floor, a room, the riser, the annex or the shed for its path and rules.

Why it matters at org scale. A policy is only as good as your prediction of its effective value on someone else's machine. Most "the policy doesn't work" tickets come from one of these causes. A managed model was treated as a lock, though it's a starting default. A project allow rule hasn't applied because nobody trusted the folder. Or the policy author expected list keys to replace lower lists, when they merge. The widget below lets you test your predictions against these rules.

Pick a key, then turn levels on and off. Each level holds a fixed example value, and the gutter names the level that supplied each line of the result, like git blame; struck lines lost. The resolver applies the documented rules: the highest level wins for scalars, lists merge, managed availableModels replaces lower lists, stricter security values win, a repo-file auto/bypassPermissions doesn't take effect (built-in default or Manual instead), and project allow rules wait for trust. Toy scenario; the rules come from the docs.

How to apply it

Commit team-wide behavior to .claude/settings.json, keep personal overrides in .claude/settings.local.json, and treat the managed tier as the only place for things that must hold. Settings files are strict JSON: "a // comment or a trailing comma is a syntax error". Add the schema line for editor validation, and remember the schema can lag the newest keys:

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "allow": ["Bash(npm run *)"],
    "ask":   ["Bash(git push *)"],
    "deny":  ["Read(./.env)", "Read(./.env.*)", "Read(./secrets/**)"]
  },
  "enabledPlugins": { "code-formatter@acme-tools": true }
}

Then verify what loaded rather than what you meant. /status shows a Setting sources line listing each file that loaded, with the managed source in parentheses. claude doctor (in a terminal, no session) lists entries that Claude Code rejected. Most edits hot-reload, including permissions, hooks and apiKeyHelper. model, effortLevel and modelSettings are read once at session start.

Pitfall: "Yes, and don't ask again" doesn't beat a team ask ruleA standing approval saves an allow rule to your local file. Rules are evaluated deny, then ask, then allow across all files, so a project ask rule keeps prompting no matter how many local allows you collect. That's precedence by rule type, not by file level. Precedence by file level applies to scalar keys.
Cloud sessions see a smaller stackA cloud session reads the clone's .claude/settings.json (single-repo sessions) and your organization's server-managed settings. It doesn't read user or local files, or an MDM profile or managed-settings.json on your laptop. Policy that must reach cloud sessions has to be server-managed. Settings in cloud sessions
Why "stricter lower value wins" is safe, and why it's limited to a handful of keys

Think of each restrictive key as a lattice with an order from permissive to strict, such as accept < hold < refuse for crossSessionInbound, or effort caps low < medium < high < xhigh < max. Plain precedence picks the value at the highest level. The exception picks the meet (most restrictive element) across the levels that are allowed to vote. Letting any level move the result toward "strict" can never widen what the organization permits, so it's always safe. Letting a level move it toward "permissive" would be a privilege escalation, so the exception never works in that direction.

Why not apply it to every key? Most keys aren't totally ordered by risk. Is model: sonnet stricter than model: opus? Is one hook list "stricter" than another? For those keys a meet doesn't exist, so plain precedence (or list union) is the only coherent rule. The documented list is short because only a few keys have a natural order: disableClaudeAiConnectors, enableArtifact/disableArtifact, isolatePeerMachines, permissions.blockReadsOutsideWorkingDirectories, autoMode.classifyAllShell, remoteControlAtStartup, crossSessionInbound, useAutoModeDuringPlan, syncClaudeAiSkills, syncClaudeAiPlugins and maxEffortLevel. Note the scoping. autoMode.classifyAllShell: true counts only from ~/.claude/settings.json or --settings, because the whole autoMode block is read only from user settings, managed settings and --settings, never from a repository's files. Source: Exceptions to managed settings precedence.

One more exception sits outside the table. An app that embeds Claude Code and sets CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST takes its own model configuration over the managed model, fallbackModel, modelPicker and modelOverrides. A managed availableModels allowlist stays in force unless the host supplies its own.

Managed Settings

Managed settings are "the settings your organization deploys to every developer's machine". They sit above every other level, and the same JSON shape as settings.json travels over four delivery mechanisms. Pick one by how you already manage devices:

MechanismWhere the policy livesWhen Claude Code reads itUse it when
Server-managedclaude.ai Organization settings > Claude Code > Managed settings (Teams/Enterprise, Owner or Primary Owner), or a self-hosted Claude apps gateway. Cached in ~/.claude/remote-settings.jsonFetched at startup and polled hourlyNo MDM, unmanaged devices, cloud sessions
MDM / OS policymacOS profile in domain com.anthropic.claudecode; Windows Settings REG_SZ under HKLM\SOFTWARE\Policies\ClaudeCodeAt startup, then every 30 minutesJamf, Intune, Group Policy fleets
FilemacOS /Library/Application Support/ClaudeCode/managed-settings.json; Linux/WSL /etc/claude-code/managed-settings.json; Windows C:\Program Files\ClaudeCode\managed-settings.json; plus managed-settings.d/*.jsonAt startup, and reloaded when a file changesLinux hosts, images you build, CI runners
HKCU registryHKCU\SOFTWARE\Policies\ClaudeCodeEvery 30 minutes, only when no admin document is present above itA convenience default, not enforcement: it's user-writable

The legacy Windows path C:\ProgramData\ClaudeCode\managed-settings.json is not read. The drop-in directory managed-settings.d/ (v2.1.83+) lets several teams own parts of one file-based policy. Claude Code merges managed-settings.json first, then every *.json in the directory in alphabetical order. Name them 10-telemetry.json, 20-security.json. Scalars from a later file replace earlier ones, lists union without duplicates, nested blocks merge key by key, and fallbackModel, modelPicker, extraKnownMarketplaces entries and managedMcpServers entries are replaced whole.

Precedence inside the managed tier

When several sources reach one machine, Claude Code ranks them remote (server-managed or gateway) > MDM (plist/HKLM) > files (with drop-ins) > HKCU. Under the default managedSourcesBehavior: "first-wins", it "uses the highest-ranked source that delivers at least one policy key and ignores the rest rather than merging them". It shows no warning for skipped sources, though /status lists them on a Skipped sources line (v2.1.242+). Two refinements matter:

  • Cross-source keys are read from every admin source even under first-wins. They include the sandbox locks sandbox.network.allowManagedDomainsOnly and sandbox.filesystem.allowManagedReadPathsOnly (a true anywhere turns the lock on, and the locked allowlist is then unioned across admin sources), allowManagedMcpServersOnly, deniedMcpServers, maxEffortLevel (lowest cap wins), forceRemoteSettingsRefresh and env, which merges per variable (v2.1.223+). A plain sandbox.network.allowedDomains without the lock is not cross-source.
  • managedSourcesBehavior: "merge" (v2.1.242+), set in the highest-ranked source, composes every admin source. Lists union, locks take the strictest value, and restriction allowlists such as availableModels come whole from the highest source that sets one. Credential helpers and permissions.defaultMode come from the highest source only. Turn it on "only when every source ranked below your highest one is under an administrator's control", because a lower source can now add permissions.allow entries and hooks.
Choose which managed sources reach the machine, the OS, and the combining mode. The plan shows the managed floor: under first-wins one door opens and the other rooms are stamped skipped, while cross-source keys run along the corridor from every admin room. The plate prints the /status Setting sources label the docs define, then come the skipped sources and the effective policy. Example payloads are illustrative. Your choices also light the building at the top of this topic.

Server-managed specifics

Server-managed delivery needs Claude for Teams or Enterprise, the Owner or Primary Owner role, and a direct connection to api.anthropic.com. The session must authenticate with an eligible credential: a Team/Enterprise OAuth login, CLAUDE_CODE_OAUTH_TOKEN, a directly configured API key, or (v2.1.257+) a user_oauth Anthropic profile. Keys returned by apiKeyHelper don't trigger the fetch. Neither does exporting any CLAUDE_CODE_USE_* provider variable or a non-default ANTHROPIC_BASE_URL, which skips the fetch entirely. Three behaviors catch administrators out:

  • Approval dialogs. Settings that run commands (apiKeyHelper, statusLine, otelHeadersHelper), sandbox binaries and network-rerouting keys, hooks, and many env variables "require explicit user approval". If the user rejects, Claude Code exits. Non-interactive runs (-p, SDK, the VS Code chat panel) apply them for that run only and keep re-fetching until someone approves interactively. A managed CLAUDE.md delivered through claudeMd needs no approval (since v2.1.260).
  • Caching. Cached settings apply immediately at startup, but proxy, TLS, base-URL, provider-selection and credential variables in a cached env block are withheld until the server confirms the payload. A tampered cache can't redirect the fetch that would correct it.
  • Not a security boundary. "They operate as a client-side control, not a security boundary. On unmanaged devices, a user doesn't need admin or sudo access to bypass them." The same holds for any client-side policy in a weaker form. Endpoint-managed files resist tampering only because writing them needs admin rights.

What fails closed

Managed sources are validated more forgivingly than user files, but in the safe direction. A managed file, drop-in, plist or HKLM value that isn't a JSON object makes Claude Code refuse to start, even if another admin source is valid. Individual invalid entries are dropped with a warning. Single-value restrictive keys such as allowManagedPermissionRulesOnly or disableAutoMode keep their restrictive value: "the key reads as that value until you fix it" (v2.1.282+). Allowlists like availableModels, allowedMcpServers, strictKnownMarketplaces and allowedProviders are enforced as empty while invalid. An invalid allowedProviders means "every API provider is refused and Claude Code doesn't start on the machine". The deliberate exceptions are requiredMinimumVersion and requiredMaximumVersion, which fail open. Test on one machine before you push.

Verify on one machine, then the fleet/status → Setting sources shows Enterprise managed settings (file), (plist), (HKLM), (remote), (drop-ins), (file + drop-ins), (HKCU), (parent process), (helper), or a list ending in , merged. claude doctor prints the Managed settings (remote) fetch outcome (v2.1.248+) and each dropped entry with its source and field. For fleet-wide drift, the OpenTelemetry event claude_code.managed_settings_resolved (v2.1.274+) carries the sources, and with OTEL_LOG_MANAGED_SETTINGS=1 it also carries a managed_settings.resolved_sha256 digest. "Machines with the same digest run the same policy."
Computed policy: policyHelper, parent settings, and why merge is opt-in

policyHelper is an executable that a plist, HKLM value or managed file names (never server-managed settings). Claude Code runs it before the first prompt, with CLAUDE_CODE_VERSION in its environment, and reads a JSON envelope from stdout (capped at 1 MiB). The settings go under a managedSettings key. A bare object without that key "applies nothing, and Claude Code reports no error". When the helper emits managedSettings, that object becomes the only managed source for the run. A failed startup run refuses to start the session, by design, so a helper that needs outage resilience "should serve from its own cache and exit 0". This is how you build device-posture or identity-derived policy, and it's a natural hook for rollout rings.

{
  "policyHelper": { "path": "/usr/local/bin/claude-policy", "timeoutMs": 5000, "refreshIntervalMs": 300000 }
}

Parent settings come from an embedding host (Claude Desktop, an IDE extension, an Agent SDK app) through the SDK managedSettings option. By default they're ignored whenever an admin source is present. parentSettingsBehavior: "merge" keeps only the host's restrictive values, "with one gap to know about: unless you also set the allowManaged*Only locks, the host's permission allow rules and sandbox allowlists still apply".

Why merge is opt-in. Under first-wins, the effective policy is a function of exactly one document plus a small set of cross-source keys. Most of those are monotone: adding a source can only make the result stricter (a lock turning on, a cap lowering, a deny list growing), and env only fills gaps. The exceptions are why every admin source still has to be trusted, even under first-wins. A lower admin source can add domains to a locked allowlist (the locked list is unioned across admin sources), turn on allowAllClaudeAiMcps, or point sandbox.bwrapPath, sandbox.socatPath or sandbox.ripgrep at other executables. Under merge, list keys such as permissions.allow become a union, and a union of allow lists is non-monotone in safety: one sloppy lower document widens everyone's grants. That's acceptable only when every contributing document is admin-controlled, which is exactly the docs' condition. The HKCU registry and parent settings never take part in the merge for the same reason. Sources: Deploy managed settings, policyHelper.

Policies

A policy is a managed document written to achieve a requirement: "nobody runs bypass mode", "only Opus and Sonnet", "only our plugins". Most of its keys are ordinary settings that any level can set, plus locks, managed-only keys that tell Claude Code to honor only the managed value of something. The docs' "Decide what to enforce" table is the map. These are the keys you'll actually write, with their verbatim names:

RequirementKeysNotes from the docs
Permission lockdownallowManagedPermissionRulesOnly, permissions.disableBypassPermissionsMode: "disable"The first makes managed settings "the only settings source of permission rules": user/project/local/--settings allow, ask and deny rules and --allowedTools are ignored, always-allow choices are hidden, and (v2.1.282+) skills' allowed-tools from repo and personal skills are ignored. --disallowedTools still applies. The second rejects --dangerously-skip-permissions and ignores permissionMode: bypassPermissions in agent files.
Starting modepermissions.defaultMode, disableAutoMode: "disable" (or permissions.disableAutoMode)Since v2.1.283 interactive terminal and VS Code sessions start in auto mode by default. disableAutoMode removes auto from the cycle and makes sessions that would start in auto start in default (Manual).
Hook controlallowManagedHooksOnly, allowedHttpHookUrls, httpHookAllowedEnvVarsOnly managed hooks, in-process Agent SDK hooks, and hooks from plugins your managed enabledPlugins force-enables (matched on the full plugin@marketplace ID) run. User/project/local hooks and agent-frontmatter hooks are blocked. /goal can't run. The status line narrows to managed settings.
MCP controlallowedMcpServers, deniedMcpServers, allowManagedMcpServersOnly, managedMcpServers (v2.1.259+), or a managed-mcp.json file"Nothing overrides a denylist match." managed-mcp.json takes exclusive control and is readable by any user, so it must hold no credentials.
Plugin supply chainstrictKnownMarketplaces, blockedMarketplaces, disableSideloadFlags (v2.1.193+), disableCommandPluginSources, pluginSuggestionMarketplacesstrictKnownMarketplaces: [] "locks every marketplace source out, including the official marketplace". blockedMarketplaces is checked first. disableSideloadFlags rejects --plugin-dir, --plugin-url, --agents, the SDK plugins option and non-SDK --mcp-config at startup: "Claude Code exits with an error naming the rejected flags."
Customization lockdownstrictPluginOnlyCustomizationtrue, or an array of "skills", "agents", "hooks", "mcp": those come only from plugins, managed settings or built-ins. It "doesn't restrict which plugins users install", so pair it with strictKnownMarketplaces.
Models and effortavailableModels, enforceAvailableModels (v2.1.175+), availableModelsMatch: "exact" and deniedModels (v2.1.283+), maxEffortLevelA managed model "is a default, not a lock". availableModels constrains /model, --model, ANTHROPIC_MODEL, subagent, skill and advisor models. Without enforceAvailableModels the Default option can still resolve outside the list.
Login and providerforceLoginMethod, forceLoginOrgUUID, allowedProviders (v2.1.285+)With forceLoginMethod set, "sessions authenticated by ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, or apiKeyHelper are blocked at startup". allowedProviders takes anthropic, bedrock, vertex, foundry, anthropicAws, mantle, customEndpoint, gateway.
VersionsminimumVersion, requiredMinimumVersion, requiredMaximumVersion (v2.1.163+), autoUpdatesChannelCovered in Versioning.
Fail-closed deliveryforceRemoteSettingsRefresh"Blocks CLI startup until remote managed settings are freshly fetched and exits if the fetch fails."

Here is a policy for an organization on Claude for Enterprise that enforces logins, models, a permission lockdown, an MCP allowlist, one plugin marketplace, a strict sandbox and a version floor. It's adapted from the docs' organization example:

{
  "forceLoginMethod": "claudeai",
  "forceLoginOrgUUID": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"],
  "availableModels": ["opus", "sonnet"],
  "enforceAvailableModels": true,
  "permissions": {
    "allow": ["Bash(npm run *)", "Bash(git diff *)"],
    "deny": ["Bash(curl *)", "Read(./.env)", "Read(./secrets/**)"],
    "disableBypassPermissionsMode": "disable"
  },
  "allowManagedPermissionRulesOnly": true,
  "allowedMcpServers": [{ "serverUrl": "https://api.githubcopilot.com/*" }],
  "allowManagedMcpServersOnly": true,
  "strictKnownMarketplaces": [{ "source": "github", "repo": "acme-corp/approved-plugins" }],
  "sandbox": {
    "enabled": true,
    "failIfUnavailable": true,
    "allowUnsandboxedCommands": false,
    "network": { "allowedDomains": ["registry.npmjs.org", "github.com"], "allowManagedDomainsOnly": true }
  },
  "requiredMinimumVersion": "2.1.285",
  "cleanupPeriodDays": 7,
  "companyAnnouncements": ["Claude Code policy v14 is live. Changes: go/claude-policy"]
}

Notice the managed permissions.allow. With allowManagedPermissionRulesOnly on, developers' own allow rules stop counting, so every pre-approval the team relies on has to live in the policy, or everything prompts.

Pick requirements and fleet facts. The compiler emits the managed JSON, lints it with the documented interactions (conflicts, keys with no effect, fleet breakage), and computes the minimum Claude Code version the policy's keys need; the marked lines show which key sets that floor. The lint messages paraphrase the docs. The JSON is a starting point to review, not a recommended baseline.

What you build: a policy pipeline. It compiles policy/org-policy.json (the lab's intent format) into managed-settings.json, and with --layout dropins also writes managed-settings.d/ drop-ins beside it. It merges another team's overlay by the documented drop-in rules and checks every key against the 247 documented settings keys (scope and type). It then shows what a repository's own .claude/settings.json can and can't override, and runs probes: tool calls, each with an expected deny, ask, allow or no-match outcome.

cd labs && python3 autonomy-2/managed_settings.py
python3 autonomy-2/managed_settings.py --layout dropins                       # adds managed-settings.d/10-permissions.json … 90-org.json
python3 autonomy-2/managed_settings.py --check path/to/settings.json --scope project   # lint any settings file

What to observe: in step [2], the overlay's lists are added to the compiled ones (permissions.allow gains Bash(dbt run *)). Step [4] flags the repo file: permissions.defaultMode: "bypassPermissions" isn't honored from project settings: it starts the session in Manual (default), and the user's own defaultMode doesn't apply either (v2.1.257+), a typo'd permisions key that "does nothing", and model "opus" → managed wins: "sonnet" (a default, not a lock: --model still picks). Step [5] reports Probes: 13/13 decisions as expected, including "project allow can't beat managed deny". Offline. It writes only to autonomy-2/out/ and prints the system paths without touching them.

Open the lab walkthrough

✗ Policy by intention

"model": "sonnet" to "standardize on Sonnet", "Bash(curl *)" deny to "stop exfiltration", a CLAUDE.md line "never read secrets". Each is a default, a string match, or a request. A developer's --model opus works, /usr/bin/curl isn't matched, and the instruction is advisory.

✓ Policy by mechanism

availableModels + enforceAvailableModels for models. For egress, the sandbox with allowManagedDomainsOnly and allowUnsandboxedCommands: false, plus WebFetch domain rules for the fetch tool. For secrets, Read deny rules plus sandbox.credentials. Each requirement maps to the layer that actually enforces it.

Pitfall: keys older clients don't knowA client that predates a key ignores it, sometimes silently. Policy written for allowedProviders (v2.1.285+) or deniedModels (v2.1.283+) does nothing on a v2.1.250 laptop. Pair new keys with a requiredMinimumVersion at or above their version, as the compiler widget computes.

Rosters of Agents and Skills

A roster is the set of subagents and skills a session can use, and where each one came from. At org scale you want three properties: the agents and skills you ship are present everywhere, nobody shadows them with a same-named local copy, and the set is small enough that descriptions don't crowd the context. Claude Code gives you the levers, but the resolution order differs between agents and skills, which surprises people:

Subagents (same name)
  1. Managed: .claude/agents/ inside the managed settings directory, e.g. /etc/claude-code/.claude/agents/
  2. --agents '<json>' on the command line
  3. Project .claude/agents/ (closest nested dir wins)
  4. User ~/.claude/agents/
  5. Plugin agents/, registered under a scoped name such as my-plugin:reviewer (the bare name also works when no other agent uses it)
Skills (same directory name)
  1. Enterprise: .claude/skills/<name>/SKILL.md in the managed settings directory
  2. Personal ~/.claude/skills/
  3. Project .claude/skills/
  4. Plugin skills load alongside as /plugin-name:skill-name, and answer to the bare /skill-name when nothing else claims it
  5. A skill beats a .claude/commands/ file of the same name

So for agents the project beats the user, while for skills the personal copy beats the project ("with deploy in both ~/.claude/skills/ and the project's .claude/skills/, /deploy runs the personal one"). Only the managed location wins in both. That's why an org-wide skill that must not be shadowed belongs in the enterprise skills directory or in a plugin (namespaced, so it can't collide).

The levers

  • Ship: managed directories for things every machine must have, and plugins from an allowed marketplace for everything versioned (see Plugin Distribution). An enterprise skill is removed by deleting its directory, for example /etc/claude-code/.claude/skills/<skill-name>/.
  • Lock: strictPluginOnlyCustomization: ["skills", "agents"] stops loading from ~/.claude/, .claude/ and --add-dir (and, for skills, claude.ai-synced skills). Plugin, built-in and managed entries keep loading. disableSideloadFlags closes the --agents and --plugin-dir doors.
  • Deny: "permissions": {"deny": ["Agent(Explore)", "Agent(legacy-migrator)"]} disables specific subagents. Skill(deploy) in deny blocks a skill, and the parameter form Skill(skill:deploy) matches it under any of its names. Model choices inside rosters obey availableModels: a subagent whose model is excluded runs on a fallback model, and a skill's excluded model is ignored.
  • Shape: skillOverrides sets a skill to "on", "name-only", "user-invocable-only" or "off" without editing its SKILL.md (not for plugin skills). disableBundledSkills removes bundled skills and workflows. disableSkillShellExecution: true replaces ! injections with [shell command execution disabled by policy], and a managed true can't be overridden.
  • Audit: /doctor reports unused skills, MCP servers and plugins against their context cost, and duplicate subagent names in one directory. /skill-doctor shows what each skill costs and how often it gets used (v2.1.252+; it needs feature-flag fetching, so it's unavailable on Bedrock, Agent Platform, Foundry or with telemetry turned off). claude plugin validate .claude/agents finds agent files whose frontmatter doesn't parse (v2.1.233+), which would otherwise be skipped without a message.
Toggle which sources define the subagent code-reviewer and the skill deploy, then add locks. The resolver applies the documented priority order for each type and shows what's shadowed, blocked, or hidden from Claude: the top present card runs, the cards behind it are shadowed, locked-out cards are pulled aside, and a plugin's scoped name peels off as its own card. Paths are examples.

Keep a roster file in your config repository: one line per agent and skill with owner, purpose, source (managed, plugin, project) and model tier. It isn't a Claude Code feature. It's the inventory you review when /doctor flags an unused skill or two teams ship the same reviewer. Plugin subagents ignore hooks, mcpServers, permissionMode and initialPrompt "for security reasons", so a plugin-distributed reviewer can't escalate its own mode. If you need those fields, ship the agent through the managed directory instead.

Exercise: audit your own configuration surface

In a repository you work in: (1) run /status and copy the Setting sources line; (2) run claude doctor in a terminal and note any invalid entries; (3) list every subagent and skill visible in the session (/skills, the @ agent typeahead) and write down which location each came from; (4) find one name defined in two places and predict which copy wins before checking.

Show a solution

A typical result: Setting sources lists User settings and Project local settings (no managed source on a personal machine). claude doctor may flag a malformed permission rule saved months ago. A common collision is a review skill in both ~/.claude/skills/ and the repo: the personal one wins, so teammates and you see different behavior from the same /review. Fix it by renaming one or moving the team copy into a plugin, which namespaces it as /plugin:review. Agents collide the other way: a project .claude/agents/code-reviewer.md beats your ~/.claude/agents/code-reviewer.md.

Key takeaways

  • Precedence is managed > --settings > local > project > user, but lists merge, env vars are decided per pair, a few security keys take the strictest value, and repo files can't set auto/bypassPermissions as the default mode.
  • The managed tier has four sources and by default uses one (first-wins). Cross-source keys such as sandbox locks, maxEffortLevel and env are read from every admin source. "merge" is opt-in for a reason.
  • Malformed managed JSON stops Claude Code from starting. Invalid locks read as their restrictive value, invalid allowlists as empty. Test policy on one machine first.
  • Write policy by mechanism: availableModels + enforceAvailableModels rather than model, and allowManagedPermissionRulesOnly with the allow rules the team needs.
  • Agents resolve managed > --agents > project > user. Skills resolve enterprise > personal > project. Ship must-not-shadow items through managed directories or namespaced plugins.

Portability

Most organizations run more than one coding agent: Claude Code in the terminal and CI, something else in an IDE, maybe a homegrown SDK runtime. Portability is about keeping one source of truth for instructions and procedures, so that what you write once loads in every harness that can read it, and about knowing exactly which Claude Code features stay behind when you cross the boundary. Two open formats do most of the work: AGENTS.md for instructions and the Agent Skills standard for procedures. Plugins are Claude Code's own packaging unit, and adapters cover the rest.

AGENTS.md

AGENTS.md is "a simple, open format for guiding coding agents": plain Markdown at the repository root (and optionally in subdirectories) that many coding agents read as project instructions. On December 9, 2025 the Linux Foundation announced the Agentic AI Foundation (AAIF), anchored by three founding contributions: the Model Context Protocol (MCP), goose and AGENTS.md. As of October 2026 the AAIF project list also includes agentgateway, Agent2Agent (A2A) and Agent Router. Neutral governance is the point: no single vendor can change the format under you.

How Claude Code reads it (v2.1.277+)

"By default, Claude reads AGENTS.md only when you have no CLAUDE.md in your working directory or above it." Before v2.1.281, sessions on Amazon Bedrock or with telemetry disabled read CLAUDE.md files only, so pin a floor of v2.1.281 if those sessions rely on AGENTS.md. The check is precise:

  • Counts as a CLAUDE.md (so AGENTS.md is skipped): CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in the working directory or any ancestor.
  • Doesn't count (keeps loading alongside AGENTS.md): ~/.claude/CLAUDE.md, the managed CLAUDE.md, and .claude/rules/ files.
  • Never read: AGENTS.local.md, AGENTS.override.md, or anything under .agents/.
  • Subdirectories: a subdirectory's AGENTS.md loads on demand when Claude reads a file there and that directory has no CLAUDE.md of its own.

The Project instructions setting (in /config) changes the rule. Its values are claude-md-or-agents-md (default), claude-md-and-agents-md, claude-md and managed-only. To set it fleet-wide, write the built-in plugin's option in managed settings. Claude Code reads it from user, --settings or managed settings, and ignores it in project and local files:

{
  "pluginConfigs": {
    "cc-plugin-agents-md@builtin": {
      "options": { "instructionFiles": "claude-md-and-agents-md" }
    }
  }
}

The plugin ID was agents-md@builtin before v2.1.285, and v2.1.285+ reads either ID. In a mixed fleet, write the old one too. managed-only is a governance tool in its own right: at launch it loads only the organization's managed CLAUDE.md and auto memory, and leaves out project, local and user CLAUDE.md files, .claude/rules/ and every AGENTS.md. Subdirectory and path-scoped files still load on demand.

Toggle which instruction files exist and pick the Project instructions value. Each directory has one instruction slot: the setting decides whether CLAUDE.md, AGENTS.md or both fill it, the numbers give a simplified load order (an imported AGENTS.md is numbered with the CLAUDE.md that imports it), and a file that loses waits outside with the rule that kept it out. Rules sit beside the slot. Path-scoped rules and subdirectory files that load on demand are left out.

One file for every tool

When a repo needs both a shared instruction file and Claude-specific additions, keep AGENTS.md as the shared source and import it:

@AGENTS.md

## Claude Code
Use plan mode for changes under `src/billing/`.
Run `make test` before every commit that touches `services/`.

The import never makes Claude read AGENTS.md twice, whatever the setting. A symlink (ln -s AGENTS.md CLAUDE.md) also works, but avoid it if anyone uses Windows: creating symlinks there needs Administrator rights or Developer Mode, and Git can check a committed symlink out as a one-line text file. The Edit and Write tools also refuse to write through a symlink.

Pitfalls(1) Adding a personal CLAUDE.local.md to a repo that relies on AGENTS.md silently stops Claude reading AGENTS.md for you. Switch to claude-md-and-agents-md instead. (2) Delete old SessionStart hooks that cat AGENTS.md; on v2.1.277+ they add a second copy. (3) InstructionsLoaded hooks don't fire for an AGENTS.md read through the setting, so instruction-load auditing must use the import or symlink form.

The Agent Skills Standard

"Claude Code skills follow the Agent Skills open standard, which works across multiple AI tools." A skill is a folder with a SKILL.md (YAML frontmatter plus Markdown), optionally with scripts/, references/ and assets/. The format "was originally developed by Anthropic, released as an open standard, and has been adopted by a growing number of agent products". The adopters agentskills.io lists include Claude Code, ChatGPT & Codex, Cursor, GitHub Copilot, VS Code, Gemini CLI, goose, OpenCode, Junie and Kiro.

AAIF status. Agent Skills was proposed to the AAIF on 2026-09-24 (proposal #47). The Technical Committee approved it on 2026-10-01. As of 2026-10-20 it awaits contributor paperwork and a Governing Board vote, and it isn't on the AAIF project list. Meanwhile the spec is developed in the open at github.com/agentskills/agentskills and is "open to contributions from the broader ecosystem". For a governance decision, that means a widely adopted spec that is likely, but not yet certain, to get foundation stewardship. Check the proposal's status before you cite it.

What's portable and what isn't

The spec defines six frontmatter fields: name (required; 1–64 characters, lowercase letters, digits and hyphens, no leading, trailing or consecutive hyphens, matching the folder name), description (required; 1–1024 characters), license, compatibility (≤ 500 characters), metadata (string map) and allowed-tools (space-separated, marked experimental). It also defines progressive disclosure: name and description (~100 tokens) at startup, the body (under 5,000 tokens recommended, under 500 lines) on activation, and resources on demand. Claude Code accepts all six and adds its own extensions: when_to_use, argument-hint, arguments, disable-model-invocation, user-invocable, disallowed-tools, model, effort, context: fork, agent, background, hooks, paths, shell, and body features such as !`cmd` dynamic context injection.

Those extensions are where portability breaks, and the failure isn't always soft. Claude Code skills "at any level" accept every field. But "claude.ai skill uploads, the Skills API, and packaging with package_skill.py" accept only the six spec fields, and an extra field is a hard error:

Unexpected key(s) in SKILL.md frontmatter: argument-hint. Allowed properties are: allowed-tools, compatibility, description, license, metadata, name
Edit the frontmatter (or load a preset) and lint it against the Agent Skills spec rules and Claude Code's documented fields. Each line gets a mark in each target's column, and each target gets a verdict in the footer: Claude Code, claude.ai upload / Skills API, and another spec-compliant agent ("client decides" where the spec leaves it open). It's a simple line-based parser for flat key: value frontmatter, not a full YAML parser.

How to apply it

Write shared skills spec-first: put the six fields and the procedure in SKILL.md, and push Claude-specific behavior into what other agents can safely ignore. A trigger hint can go in prose. A !`git diff` injection can become a "run git diff first" step, which loses the pre-computation but keeps the workflow. Validate with the reference library (skills-ref validate ./my-skill) for portability, and load the skill in Claude Code for behavior. For a skill that only makes sense in Claude Code, such as one using context: fork with a named agent, keep it in a Claude Code plugin and don't pretend it's portable.

Why the spec is small, and what progressive disclosure costs in Claude Code

A format that many independent harnesses implement survives only if its required surface is small. Every field in the spec is either needed for routing (name, description), metadata a harness can ignore (license, compatibility, metadata), or explicitly experimental (allowed-tools). Invocation control, execution context, hooks and model routing are harness semantics. Standardizing them would force every adopter to implement Claude Code's permission and subagent model. That's why they live in vendor extensions, and why a harness that doesn't know context: fork simply runs the skill inline.

In Claude Code, the "metadata at startup" stage has a concrete budget: the skill listing "scales at 1% of the model's context window", and each entry (description plus when_to_use) is truncated at 1,536 characters. The spec's 1,024-character description limit is stricter than Claude Code's listing cap, so a spec-valid description always fits. A Claude Code skill that leans on a long when_to_use may be truncated in the listing and is non-portable anyway. disable-model-invocation: true removes the description from context entirely, which saves budget, but a non-Claude harness may ignore the field and route to the skill on its own. Source: Skills, Agent Skills specification.

Plugins

"A Claude Code plugin is a directory of skills, agents, hooks, MCP servers, or other components that Claude Code installs and loads as one unit." Within the Claude ecosystem, the plugin is the portability unit. The same plugin loads in the terminal, the IDE extensions, the Desktop Code tab, claude -p in CI, and the Agent SDK (through the plugins option). With a seed directory, it also loads in containers that can't clone at runtime. It's also how you version a bundle of configuration as one thing, where loose files can drift independently.

Hover or tab down the tree for what each file becomes at runtime; the hooks line is lit to start. Only plugin.json goes inside .claude-plugin/ ("Components saved there don't load"). The plugin's name is the plate on every runtime name: skills as /plugin-name:skill, agents as plugin-name:agent, MCP tools as mcp__plugin_<plugin>_<server>__<tool>. Hooks get no plate, and bin/ tools run as bare commands. Hooks are not namespaced: a hook defined in both settings and hooks/hooks.json runs twice.

acme-platform/.claude-plugin/plugin.json

{
  "name": "acme-platform",
  "displayName": "Acme platform kit",
  "version": "1.4.0",
  "description": "Code-review agent, deploy skill and edit-audit hook for Acme repositories",
  "author": { "name": "Acme Platform Team", "email": "platform@acme.example" },
  "license": "Proprietary"
}

acme-platform/hooks/hooks.json

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/scripts/audit-edit.sh" }]
      }
    ]
  }
}

The manifest's only required key is name (kebab-case). claude plugin validate errors on names that pass as Anthropic's own, such as those starting with claude-, anthropic-, anthropics- or cc-plugin-, and claude plugin init/tag refuse them. Claude Code still loads such a plugin, so treat the check as a review gate. Component paths in the manifest are relative to the plugin root and must start with ./. ${CLAUDE_PLUGIN_ROOT} changes with every installed version, so write state to ${CLAUDE_PLUGIN_DATA} (under ~/.claude/plugins/data/<id>/, which survives updates). Develop with claude --plugin-dir ./acme-platform, check with claude plugin validate ./acme-platform (the last line reads ✔ Validation passed), and score behavior with claude plugin eval (v2.1.269+).

Pitfall: a plugin is code with your privileges"A Claude Code plugin you install can execute arbitrary code on your machine with your user privileges." Hooks, monitors, MCP and LSP servers run outside the sandbox, and auto-update can change files you reviewed. Before allowlisting a marketplace, read its hooks/hooks.json, .mcp.json and bin/. Plugin subagents ignore hooks, mcpServers, permissionMode and initialPrompt, but the plugin's own top-level hooks don't.

Versioning semantics matter for portability across machines. Users get a new copy only when the plugin's computed version changes. "If you set \"version\": \"1.0.0\" and push new commits without changing it, users don't receive them." Either bump version on every release or omit it everywhere, so the commit SHA identifies the release. Don't set it in both plugin.json and the marketplace entry: plugin.json wins without warning. The Operations topic builds release channels on this.

Watch: AAIF proposal #56, "Agent Plugins" (opened October 12, 2026, under review as of October 20) proposes "an open, vendor-neutral standard for packaging reusable components", Agent Skills and MCP server configurations, into plugins (spec 1.0.0 published). It's a separate format from Claude Code plugins. Watch it if you need cross-client distribution, and rely on Claude Code's documented plugin format today.

Adapters for Other Harnesses

An adapter translates your source of truth into a harness's native files and reports what it couldn't express. Claude Code ships one adapter in the inbound direction. claude import [source] (v2.1.213+), or /import [codex|gemini|cursor] [--dry-run] [--yes] in a session, brings "instruction files, MCP servers, commands, subagents, and skills" from OpenAI Codex, Gemini CLI or Cursor (Cursor needs v2.1.265+). It appends a one-time copy of instruction files such as AGENTS.md to the matching CLAUDE.md. It's not available on Bedrock, Google Cloud's Agent Platform, Foundry, Claude Platform on AWS or through a Claude apps gateway, or with feature-flag fetching turned off. /init also reads .cursor/rules/, .cursorrules and .github/copilot-instructions.md, and with CLAUDE_CODE_NEW_INIT=1, AGENTS.md, .devin/rules/, .windsurf/rules/, .windsurfrules and .clinerules.

claude import codex --dry-run     # preview what would be imported, write nothing
claude import codex --yes         # import without the interactive picker
claude -p "/import cursor"        # in -p, lists what it found and prints the confirming command

In the outbound direction you write the adapters yourself, and the useful question for each Claude Code artifact is how much survives:

Claude Code artifactPortable formFidelityWhat's lost or must be re-done
CLAUDE.mdAGENTS.md + @AGENTS.md importnativeClaude-only lines stay in CLAUDE.md. InstructionsLoaded auditing needs the import or symlink form.
.claude/rules/*.md with paths:Nested AGENTS.md per directory, or the target's rule formatshimGlob scoping becomes directory scoping. Glob dialects differ between tools.
SKILL.md (spec fields)Same filenativeNothing, within the six spec fields.
SKILL.md extensionsProse stepsdegraded!`cmd` injection, context: fork, hooks, model, invocation control.
.mcp.json serversThe target's MCP configshimThe protocol is portable. The config file shape, scopes and approval flow aren't.
Subagents, hooksThe target's own systems, if anyre-implementEvent names, payloads, exit-code blocking semantics and tool names differ per harness.
Permission rules, sandboxOS sandbox, container, CI checksharness-specificA deny rule becomes advisory text unless another layer enforces it.
Managed settings, gateway policyEach tool's admin channelharness-specificEverything. Govern each harness on its own terms.
Fidelity reads left to right as ■■■ native, ■■□ shim, ■□□ degraded, □□□ re-implement, and ——— harness-specific. Check each target harness's current docs before you rely on a cell. Only the Claude Code column is verified here.

The working pattern is a small config repository: AGENTS.md and spec-only skills as the shared core, a Claude Code plugin for the Claude-only layer (agents, hooks, extended skills), and a short adapter script per extra harness. Each adapter emits files with a "generated from" header and a loss report, so a security-critical deny rule that degrades into a sentence fails the build instead of slipping through.

Migrations are rollouts tooMoving a team from another agent to Claude Code is a configuration change at fleet scale. Run claude import <source> --dry-run on a pilot machine, commit the reviewed result (CLAUDE.md, .mcp.json, skills, agents) to the repo, then let teammates get it by cloning instead of importing individually. Every developer then runs the reviewed configuration, not their own import.

Exercise: make one skill portable

Take a skill you use in Claude Code. (1) List its frontmatter fields and mark each as spec or extension. (2) Produce a spec-only copy that keeps the procedure, and move extension behavior into prose steps. (3) Validate it with skills-ref validate and confirm Claude Code still triggers it (/skills, then a natural-language request). (4) Decide whether the Claude-only original or the portable copy is the source of truth, and write that down in the skill's metadata.

Show a solution

Example: a release-notes skill with argument-hint, disable-model-invocation: true and a !`git log --oneline v1.2..HEAD` injection. The portable copy keeps name, description and metadata: {source: "acme-platform plugin", owner: "platform"}, and replaces the injection with "Step 1: run git log --oneline <last-tag>..HEAD and group commits by type". The manual-only flag has no spec equivalent, so in other tools the skill may auto-trigger. Make the description narrow ("Use only when asked to draft release notes") to compensate. Keep the extended original in the Claude Code plugin and generate the portable copy from it in CI.

Key takeaways

  • AGENTS.md is an AAIF project (with MCP and goose). Claude Code reads it when no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md exists (v2.1.277+), or always with claude-md-and-agents-md.
  • Use @AGENTS.md in CLAUDE.md for a shared core plus Claude-only additions. Avoid committed symlinks on mixed-OS teams.
  • Agent Skills: open standard; proposed to the AAIF (TC-approved 2026-10-01, Governing Board vote pending as of 2026-10-20). Six spec fields port. Claude Code extensions don't, and claude.ai uploads reject them with a hard error.
  • The plugin is the portable, versioned unit within Claude surfaces. Bump version or omit it, never set it in two places, and treat every plugin as code running with your privileges.
  • claude import covers the inbound direction (Codex, Gemini CLI, Cursor). Outbound, write adapters that report losses, and never let a deny rule silently become prose.

Environment

Configuration says what Claude may do. The environment decides what it can do: which files a shell command can read, which hosts it can reach, which credentials sit in its environment, and where inference traffic goes. An org-grade control plane sets these deliberately: a required sandbox with a managed allowlist, credentials that never sit in config files, a gateway or provider choice that the fleet can't quietly route around, and defaults that stay safe when someone forgets a setting.

Sandbox Policies

The sandbox is OS-level isolation for the shell commands Claude runs (Bash, PowerShell, Monitor and their child processes). It uses Seatbelt on macOS, and bubblewrap plus socat on Linux and WSL2. "On native Windows, Claude Code runs commands unsandboxed." Two facts drive every policy decision. First, "the sandbox is off by default". Second, it "covers shell commands only": built-in file and web tools follow permission rules instead, and command hooks, local MCP servers, plugin monitors, LSP servers, the status line command and apiKeyHelper run with your full access.

Its defaults are permissive where people expect them to be strict. Writes are limited to the working directory, a per-user temp directory and added directories. Reads cover "most of the machine, including credential files such as ~/.ssh and ~/.aws/credentials". Network traffic goes through a local proxy whose allowed domains "start empty". Environment variables, secrets included, are inherited. A policy has to change those defaults on purpose.

Require it, and stop it from being widened

{
  "sandbox": {
    "enabled": true,
    "failIfUnavailable": true,
    "allowUnsandboxedCommands": false,
    "network": {
      "allowedDomains": ["github.com", "registry.npmjs.org", "pypi.org", "files.pythonhosted.org"],
      "allowManagedDomainsOnly": true
    },
    "filesystem": { "denyRead": ["~/.config/gcloud"] },
    "credentials": {
      "files":   [{ "path": "~/.aws/credentials", "mode": "deny" }, { "path": "~/.ssh", "mode": "deny" }],
      "envVars": [{ "name": "GITHUB_TOKEN", "mode": "deny" }, { "name": "NPM_TOKEN", "mode": "deny" }]
    },
    "excludedCommands": ["docker"],
    "enableWeakerNetworkIsolation": false,
    "enableWeakerNestedSandbox": false
  }
}

Each key closes a specific gap. failIfUnavailable makes a missing dependency (say, bubblewrap on Linux) block startup instead of silently running unsandboxed. allowUnsandboxedCommands: false removes the dangerouslyDisableSandbox retry escape hatch. allowManagedDomainsOnly means "non-allowed domains are blocked automatically instead of prompting, and only allowedDomains and WebFetch(domain:...) allow rules from managed settings are honored". Either of the last two makes the sandbox admin-required (v2.1.285+); so does allowUnsandboxedCommands: false passed with --settings. In that state, a repository's .claude/settings.json loses its loosening keys entirely (excludedCommands, network.allowedDomains, filesystem.allowWrite, proxy ports, the weaker-isolation flags), while deny entries from the repo still apply. A developer's own ~/.claude/settings.json can still add excludedCommands and allowWrite, because "most of them ... have no managed-only lock". Put the exclusions your approved tools need into the managed file, since repositories can't supply them anymore.

Managed, user and repository settings each propose sandbox entries. Each allowed domain is a gate tagged with who opened it, and each excluded command is a tunnel under the fence; what the repo opened is lit to start. Toggle the managed locks and the permission mode, then read what happens to six test commands (hover one to see its way out); the proposed entries and the effective policy sit in the disclosure under the drawing. The rules follow the sandboxing docs (admin-required sandbox, domain lock, how unlisted hosts are handled per mode). The example entries are illustrative.

Fleet realities

  • Windows. With failIfUnavailable, Claude Code exits at startup on native Windows. Deliver the sandbox block by OS (MDM or file on macOS/Linux only), or move Windows users into WSL2 or a container. Server-managed settings can't target by OS.
  • Typed commands. A command typed at the ! shell-mode prompt runs unsandboxed in most sessions, "with the same access they already have in any terminal outside Claude Code".
  • TLS. The built-in proxy checks hostnames and "does not terminate or inspect TLS traffic", so sandboxed code "can potentially use domain fronting". If your threat model needs inspection, point the sandbox at your own proxy (httpProxyPort/socksProxyPort, managed-only while the domain lock is on).
  • One boundary for everything. To put file tools, MCP servers and hooks behind the same wall, run the Claude Code process itself in a container, VM or the sandbox runtime. That's also the only context where --dangerously-skip-permissions belongs: it "offers no protection against prompt injection or unintended actions". The docs add that even in a dev container it doesn't stop a malicious project "from exfiltrating anything accessible inside the container, including the Claude Code credentials".
Permission rules and the sandbox are two layers, and each has a hole the other covers

A Read(./.env) deny rule stops Claude's Read tool and commands that name the file, such as cat .env, but "not grep -r run over the directory". The sandbox closes that gap, because it "adds your Read deny paths" to what every sandboxed command can't read. Conversely, sandbox.filesystem.denyRead "doesn't stop the Read tool". Network works the same way. Denying WebFetch blocks the fetch tool, "but if Bash is allowed, curl and wget can still reach any URL". The sandbox's allowedDomains closes that, but doesn't limit WebFetch. A Bash deny rule "isn't a security boundary around the program": Bash(rm *) doesn't stop /bin/rm or bash -c.

The general principle: rules govern Claude's tool calls as written, and the sandbox governs what processes can do at the OS level. Neither is complete alone, which is why the docs say to "use both for defense-in-depth". Hooks add a third, programmable layer, but they're defense in depth too, not the boundary. A PreToolUse command hook that times out lets the call through unless it sets "onFailure": "block" (v2.1.295+). Sources: Sandboxing, Permissions, How we contain Claude.

Secrets

Secrets reach a Claude Code session through four doors: the credential Claude Code sends to the model API, the environment every subprocess inherits, config files (.mcp.json, settings env blocks, hook commands), and files Claude can read. Govern each door separately.

The model credential: apiKeyHelper

apiKeyHelper runs "your own command to produce the credential Claude Code sends with model requests". The command runs through /bin/sh (or cmd on Windows), and Claude Code sends its output "as both the X-Api-Key and Authorization: Bearer headers". The value is cached for five minutes by default (CLAUDE_CODE_API_KEY_HELPER_TTL_MS). Claude Code reruns the helper after a 401/403, and (v2.1.246+) when a cached JWT has expired. A helper from project or local settings doesn't run until the workspace trust prompt is accepted. A helper slower than 10 seconds triggers a notice. A failing helper surfaces as Your apiKeyHelper script is failing within three attempts. Distribute one helper command that authenticates to your vault as the local developer, so every machine gets its own short-lived key and offboarding revokes one identity:

{
  "env": { "ANTHROPIC_BASE_URL": "https://llm-gateway.example.com" },
  "apiKeyHelper": "/usr/local/bin/get-gateway-key"
}
#!/bin/sh
# /usr/local/bin/get-gateway-key: print one short-lived key on stdout, nothing else.
# Illustrative: replace with your vault's CLI. Never echo the key to stderr or a log.
exec vault kv get -field=key "secret/claude/gateway/$(id -un)"

When several credentials are present, Claude Code picks one by a fixed order: a signed-in Claude apps gateway session (which "outranks" cloud providers), then cloud provider credentials (CLAUDE_CODE_USE_BEDROCK/_VERTEX/_FOUNDRY), ANTHROPIC_AUTH_TOKEN, ANTHROPIC_API_KEY, apiKeyHelper, CLAUDE_CODE_OAUTH_TOKEN, Anthropic profiles/federation, and last the subscription login from /login. The order explains real incidents. A stale ANTHROPIC_API_KEY in a shell profile quietly beats a developer's Enterprise login. A helper-sourced key never triggers the server-managed settings fetch.

Toggle what's present on the machine. The keys hang in the documented authentication precedence; the first applicable key turns the lock, its headers are shown, and present keys that lose are tagged unused. The resolver also applies the forceLoginMethod startup checks and the eligibility rules for the server-managed settings fetch. Profiles and federation sit in the order but aren't modelled here.

The other doors

  • Environment: sandbox.credentials with "mode": "deny" unsets named variables and blocks named files for sandboxed commands. Deny entries merge from every scope, and "no scope can remove one that another scope added". "mode": "mask" shows commands a sentinel and has the proxy inject the real value only to injectHosts (a mask entry with no injectHosts injects to every host in network.allowedDomains). It requires network.tlsTerminate and is honored only from user, managed or --settings scopes. "There is no built-in credential deny list." To strip credentials from all subprocesses, sandboxed or not, set CLAUDE_CODE_SUBPROCESS_ENV_SCRUB.
  • Config files: .mcp.json expands ${VAR} and ${VAR:-default}. Reference variables and never commit literal keys. A managed-mcp.json is readable by any user on the machine, so it must not hold credentials in env. Server-managed env credential variables are withheld from the cache until the server confirms the payload.
  • Readable files: Read(./.env), Read(./.env.*) and Read(./secrets/**) deny rules for the file tools, mirrored into the sandbox. Remember that "If your project has a .claudeignore file, it has no effect". Credentials Claude Code itself stores live in the macOS Keychain or ~/.claude/.credentials.json (mode 0600).
  • CI tokens: claude setup-token prints a one-year OAuth token for CLAUDE_CODE_OAUTH_TOKEN. It's tied to a person's subscription, so org-shared CI secrets should be API keys. A CI job using a Console API key belongs to the Console organization, and "settings you configure in claude.ai Admin Settings therefore don't reach" it. Use an OAuth token authorized for your org, or a managed file on the runner.
Why a cached policy can't redirect its own refresh: the env withholding rule

Server-managed settings are cached in ~/.claude/remote-settings.json and applied at startup, before the fresh fetch returns. That's a bootstrapping problem: the cache is user-writable, and some env values change how the fetch itself happens. A tampered cache that set HTTPS_PROXY, NODE_EXTRA_CA_CERTS, ANTHROPIC_BASE_URL, a CLAUDE_CODE_USE_* provider switch or a credential such as ANTHROPIC_API_KEY could route the confirming fetch through an attacker's proxy, trust a forged certificate, or re-authenticate as a different organization. The fetch would then "confirm" the tampered policy.

Claude Code breaks the cycle by withholding those categories from the cached env until the server confirms the payload: proxy and TLS settings, API routing and provider selection, authentication credentials, CLAUDE_CONFIG_DIR and (v2.1.223+) the identity-federation and OS directory selectors. Every other cached key applies immediately. Two operational consequences follow. A proxy your developers need to reach api.anthropic.com can't come only from server-managed settings, so put it in endpoint-managed env, the shell or user settings. And a first launch has no cache at all. The same reasoning explains why a Claude apps gateway pins its TLS certificate on first connect: a trusted policy source is also a code-execution channel. Source: Fetch and caching behavior.

Pitfall: diagnostics that leak/heapdump output "contains your full conversation and credentials, so don't share it." Debug logs and transcripts can contain whatever Claude read. Keep secrets out of what Claude can read in the first place, and don't count on redaction afterwards.

LLM Gateway

An LLM gateway sits between Claude Code and the model provider and gives the organization "one place to manage" credentials, usage attribution, budgets, audit logging and provider switching. Claude Code supports two kinds.

Claude apps gateway: claude gateway (v2.1.195+)

The Claude apps gateway is Anthropic's self-hosted gateway, "included in the claude binary, so the same executable that runs Claude Code on a laptop runs the gateway server with claude gateway --config gateway.yaml". It's aimed at organizations that route inference through Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform or Microsoft Foundry. Developers sign in with your OIDC IdP (Okta, Entra ID, Google Workspace, Keycloak, Dex) instead of holding cloud credentials. The gateway holds the upstream credential, needs PostgreSQL 11+ (11–13 need a gateway on v2.1.290+), runs on Linux, enforces model access server-side, delivers managed settings per IdP group, and relays OTLP telemetry to your collector. Both the gateway server and each developer machine need v2.1.195 or later.

Hover or tab to a flow, in the drawing or its legend, to light its path. Clients get short-lived bearer tokens after SSO (session.ttl_hours, 1 hour by default, which also bounds revocation latency). The gateway selects a policy by IdP group, serves it as managed settings, rejects non-granted models with 400 at /v1/messages, and fans telemetry out to OTLP. Upstreams can be Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry, Claude Platform on AWS or the Anthropic API, with failover between them. Its data plane sends nothing to Anthropic unless the Anthropic API is a configured upstream.
# gateway.yaml (excerpt; secrets via ${ENV} expansion so the file can live in git)
listen:
  host: 0.0.0.0
  port: 8080
  public_url: https://claude-gateway.internal.example.com   # must resolve to private IPs
oidc:
  issuer: https://login.example.com
  client_id: 0oa1example2
  client_secret: ${OIDC_CLIENT_SECRET}
  allowed_email_domains: [example.com]
session:
  jwt_secret: ${GATEWAY_JWT_SECRET}
  ttl_hours: 1
store:
  postgres_url: ${GATEWAY_POSTGRES_URL}
upstreams:
  - provider: bedrock
    region: us-east-1
    auth: {}            # AWS default credential chain (IRSA, task role, instance profile)
managed:
  policies:
    - match: { groups: [eng-contractors] }       # specific groups first
      cli:
        availableModels: [claude-sonnet-4-6]
        permissions: { deny: ["WebFetch", "WebSearch"] }
    - match: {}                                   # catch-all base, conventionally last
      cli:
        availableModels: [claude-opus-4-8, claude-sonnet-4-6, claude-haiku-4-5]
        enforceAvailableModels: true

Policy merge rules are what make per-group policy safe. The first matching policy is merged onto the match: {} base. Allow-lists (availableModels, permissions.allow) in a specific policy replace the base. Deny-lists and hook arrays take the union, "so an org-wide deny or audit hook can't be accidentally dropped by a per-role override". env shallow-merges. A user who matches no policy gets "every model in the catalog and no managed settings", so always keep a catch-all. The code key is now recommended over the legacy cli, but it needs a gateway on v2.1.296+, and a file can't mix the two keys.

Developers connect through endpoint-managed settings, not the gateway's own policy, because that only reaches clients that are already connected:

{
  "forceLoginMethod": "gateway",
  "forceLoginGatewayUrl": "https://claude-gateway.internal.example.com",
  "parentSettingsBehavior": "merge"
}

forceLoginMethod and forceLoginGatewayUrl open /login on the Cloud gateway screen with the URL filled in. parentSettingsBehavior: "merge" lets Claude Desktop pass the gateway's egress allowlist to the Claude Code sessions it launches. Without it, machines that only run Claude Desktop run those sessions without the egress restriction, "and nothing warns you".

Keep it private"Claude Code only connects to a gateway whose address is private. This is a security guard, because a trusted gateway can push settings that run commands on developer machines." The CLI pins the gateway's TLS leaf certificate on first connect. Publish the SHA-256 fingerprint and treat certificate rotation as a planned event, since every developer sees the trust prompt again. gatewayInternalNetworks exists only for internal networks numbered from public space you own, and "doesn't make it safe to expose a gateway to the internet".

Other LLM gateways

Any gateway that exposes a supported API format works, but "Anthropic doesn't endorse, maintain, or audit third-party gateway products". Point Claude Code at it with ANTHROPIC_BASE_URL and a credential: ANTHROPIC_AUTH_TOKEN (sent as Authorization: Bearer), ANTHROPIC_API_KEY (x-api-key), or apiKeyHelper (both). The gateway must stream SSE through unbuffered, forward anthropic-beta, anthropic-version and the body unchanged, return upstream errors unmodified, and exempt the path from WAF body inspection, because "Claude Code prompts carry source code and XML-style tags that match cross-site-scripting body rules". To make the gateway the only destination, set allowedProviders: ["customEndpoint"] and pin ANTHROPIC_BASE_URL in the same managed file's env (v2.1.285+). Claude Code then "refuses a session pointed anywhere else".

  • "Setting only that variable, without a gateway credential, doesn't replace the subscription": a saved claude.ai login stays the active credential, with its limits and billing.
  • Server-managed settings need a direct connection to api.anthropic.com, so they don't reach gateway-routed sessions. Use file or MDM delivery there.
  • Don't put forceLoginMethod or forceLoginOrgUUID in managed settings alongside a gateway credential. Developers would see This machine's managed settings require a first-party login and can't proceed.
  • "Sessions that go through a gateway aren't eligible for the HIPAA configuration."

Providers

The API provider decides billing, authentication, compliance posture, which managed-settings channels reach the session, and which features exist. The docs' default recommendation is Claude for Teams or Enterprise: "Team members get access to both Claude Code and Claude on the web with a single subscription, centralized billing, and no infrastructure setup required." Cloud providers are for inheriting existing AWS, GCP or Azure controls and billing. Switches: CLAUDE_CODE_USE_BEDROCK=1, CLAUDE_CODE_USE_VERTEX=1 (Google Cloud's Agent Platform, "formerly Vertex AI"), CLAUDE_CODE_USE_FOUNDRY=1, CLAUDE_CODE_USE_ANTHROPIC_AWS=1 (Claude Platform on AWS) and CLAUDE_CODE_USE_MANTLE=1.

Three provider facts reshape a control plane:

  1. Policy channel. Exporting any CLAUDE_CODE_USE_* variable or a non-default ANTHROPIC_BASE_URL means server-managed settings "are bypassed". On cloud providers, deliver policy through MDM/files, or run a Claude apps gateway for the same remote delivery. Enterprise org-level model restrictions, default model and effort limits don't reach Bedrock, Agent Platform, Foundry or Claude Platform on AWS either. Use availableModels, model and maxEffortLevel in managed settings.
  2. Alias drift. "Aliases point to the recommended version for your provider and update over time", and they resolve differently per provider. On Bedrock and Agent Platform, unpinned sonnet resolves to Sonnet 4.5, and on Foundry opus is Opus 4.6. Pin with ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL and ANTHROPIC_DEFAULT_FABLE_MODEL in the managed env, or you inherit Claude Code's built-in default, "which can lag the newest release and may not yet be enabled in your account".
  3. Feature set. Cloud sessions, cloud scheduled tasks, Code Review, Remote Control and the Chrome extension "aren't available through Console API keys or cloud-provider credentials alone". /import isn't available on cloud providers. Plan seats accordingly.
Pick a provider and whether you lock the fleet to it. The planner punches the features you lose out of the strip, unplugs the policy channels that don't reach these sessions, and prints the managed env and allowedProviders entries and the unpinned alias resolution. Values come from the provider pages. The account IDs, regions and model pins are placeholders to replace.
{
  "allowedProviders": ["bedrock"],
  "env": {
    "CLAUDE_CODE_USE_BEDROCK": "1",
    "AWS_REGION": "us-east-1",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "us.anthropic.claude-opus-4-8",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "us.anthropic.claude-sonnet-4-6"
  },
  "awsAuthRefresh": "aws sso login --profile claude",
  "availableModels": ["us.anthropic.claude-opus-4-8", "us.anthropic.claude-sonnet-4-6"],
  "enforceAvailableModels": true
}

On Bedrock and Agent Platform, enforceAvailableModels also limits the startup model checks (v2.1.287+), and the checks compare each entry with the exact ID they would send. On Bedrock that's "the inference profile ID ... including its region prefix", so list IDs such as us.anthropic.claude-opus-4-8. On Agent Platform it's "the model ID they would send to Agent Platform", such as claude-opus-4-8. Don't list the opus alias in either case. Without enforceAvailableModels, the list doesn't restrict these checks.

A /status check after rollout shows the API provider line, for example Microsoft Foundry with the resource you set. On Bedrock, remember "Opus models have a higher per-token price ... if you don't pin a primary model, you're billed at the Opus rate", and that Claude Code "uses the Amazon Bedrock Invoke API and does not support the Converse API".

Safe Defaults

A safe default is the behavior a session has when nobody configured anything, and a control plane is mostly a set of chosen defaults. First, know the built-in ones as of v2.1.310. Interactive terminal and VS Code sessions start in auto mode (v2.1.283+), where a classifier reviews actions and "auto mode reduces permission prompts but does not guarantee safety". claude -p and SDK runs start in Manual (default) when nothing sets a mode (v2.1.302+). The sandbox is off. Settings hooks fail open on timeout unless onFailure: "block". Project .mcp.json servers prompt for approval interactively but load without asking in -p, SDK and cloud sessions.

Then choose your own. A baseline worth starting from (adjust to your environment):

  • Never bypass outside isolation: permissions.disableBypassPermissionsMode: "disable" on developer machines. Allow bypass only in disposable containers or VMs, as non-root, with no host credentials mounted.
  • Secrets unreadable: managed Read denies for .env* and secrets folders, plus sandbox.credentials denies for ~/.ssh, ~/.aws and token variables.
  • Sandbox required, with a managed domain allowlist, failIfUnavailable, and no unsandboxed retry.
  • Supply chain closed: strictKnownMarketplaces naming your marketplace (plus the official one if you want it), disableSideloadFlags, and an MCP allowlist.
  • Destination pinned: allowedProviders, and a managed ANTHROPIC_BASE_URL if you use a gateway.
  • Floor and visibility: requiredMinimumVersion at or above your newest policy key, and OpenTelemetry delivered through managed env (exporter variables are ignored in repo files).
  • Untrusted repos in automation: a -p run never shows the trust dialog, so it uses a repository's hooks, env block and helper commands, and connects its .mcp.json servers without asking. Use --setting-sources user (reads neither the project's settings files nor its .mcp.json), or --bare (no project hooks, skills, plugins or .mcp.json, but the project's env block and helpers such as awsAuthRefresh still apply), or --settings '{"disableAllHooks": true}' with --strict-mcp-config.

Before you add a control, ask which layer actually enforces the requirement. The matrix below is the most useful artifact in this session.

Pick a requirement. The matrix lists every layer that can contribute, what enforces it (Claude Code client, OS sandbox, gateway server, git host, or nobody), how strong the guarantee is (● hard, ◐ client-side or partial, ○ advisory or none), and how it's bypassed. Strength ratings are this course's judgment. The mechanisms are from the docs.

Exercise: turn the sandbox on and try to break out (safely)

In a scratch directory, start a Manual-mode session with the sandbox passed for this run only, so none of your settings files change:

claude --permission-mode default --settings '{"sandbox": {"enabled": true, "network": {"allowedDomains": ["registry.npmjs.org"]}}}'

Ask Claude to run: (1) curl -sI https://registry.npmjs.org; (2) curl -sI https://example.com; (3) head -1 ~/.ssh/known_hosts. Note what prompts, what fails and what succeeds. Then restart with "credentials": {"files": [{"path": "~/.ssh", "mode": "deny"}]} added inside the sandbox object and repeat (3).

Show a solution

(1) succeeds through the proxy. (2) prompts in Manual mode for the unlisted host (in auto mode it's refused unless the command listed the host and the classifier approved; with strictAllowlist or a managed domain lock it's refused in every mode). (3) succeeds at first, without a prompt: built-in read-only commands such as head run without a permission prompt in every mode (unless an ask or deny rule matches, such as a Read deny for the path, or permissions.blockReadsOutsideWorkingDirectories applies), and the sandbox's default reads cover ~/.ssh. With the credentials deny, the same command fails inside the sandbox. Then ask Claude to read the file with its Read tool: the sandbox doesn't apply to file tools, so that path needs a Read(~/.ssh/**) deny rule. That's the two-layer lesson in one experiment, and nothing persists after you exit.

Key takeaways

  • The sandbox is off by default and covers shell commands only. Require it with failIfUnavailable, allowUnsandboxedCommands: false and allowManagedDomainsOnly, and deny credential paths explicitly.
  • An admin-required sandbox ignores a repo's loosening keys (v2.1.285+), but user settings can still add exclusions without a lock. Native Windows has no sandbox.
  • apiKeyHelper gives per-developer, rotating credentials. Know the authentication precedence, because a stray env var silently wins.
  • claude gateway (v2.1.195+) adds SSO, per-group policy, server-side model enforcement and OTLP. Keep it on a private address. Other gateways work via ANTHROPIC_BASE_URL, pinned with allowedProviders: ["customEndpoint"].
  • Cloud providers bypass server-managed settings and resolve aliases differently. Pin models and deliver policy by file, MDM or gateway.

Knowledge Delivery

Policy controls what Claude can do. Knowledge shapes what it decides to do. At team scale you're delivering conventions, environment facts, procedures and reference material to thousands of sessions, each with a finite context window and prompt cache. Every channel has a different reach (org, repo, directory, task), timing (launch, on demand, every session start), cost and strength. Good knowledge delivery puts each fact in the cheapest channel that still reaches the sessions that need it. Anything that must hold goes into enforcement, not prose.

Rules

Claude Code has three rule-like channels, from broadest to narrowest reach.

The managed CLAUDE.md applies to every session on a machine. Developers can skip other CLAUDE.md files with claudeMdExcludes, "but not this one"; still, "If a developer starts a session with CLAUDE.md loading turned off altogether, that session doesn't load the managed content either" (memory). It lives at /Library/Application Support/ClaudeCode/CLAUDE.md (macOS), /etc/claude-code/CLAUDE.md (Linux/WSL) or C:\Program Files\ClaudeCode\CLAUDE.md (Windows). Alternatively, put it inside the policy itself with the managed-only claudeMd key, which has no approval dialog when server-delivered (since v2.1.260):

{
  "claudeMd": "Acme engineering conventions (policy v14):\n- Run `make lint` before committing.\n- Customer data never leaves the prod VPC; use the anonymized fixtures in testdata/.\n- Questions about this policy: #claude-platform."
}

Project CLAUDE.md and .claude/rules/*.md are committed with the repo. A rule file without frontmatter loads at launch "with the same priority as .claude/CLAUDE.md". A rule with paths: frontmatter loads only when Claude reads, writes or edits a matching file (including single-file Bash reads such as cat), and paths "is the only field Claude Code reads from a rule". User-level rules in ~/.claude/rules/ load before project rules. "Neither set overrides the other": a conflicting user and project rule leaves Claude free to follow either.

---
paths:
  - "services/payments/**/*.{ts,tsx}"
  - "db/migrations/**"
---
# Payments and migrations
- Money is integer minor units (`amount_cents`); never floats.
- Every migration is reversible and has a matching `down` step.
- Read docs/payments/idempotency.md before changing a webhook handler.

The difference that matters is enforcement. All three channels deliver context: "CLAUDE.md content is delivered as a user message after the system prompt", and "Claude treats them as context, not enforced configuration". The docs give the division of labor explicitly. Blocking tools, paths and commands, sandbox isolation, provider routing and login restrictions go in managed settings. Code style, data-handling reminders and behavioral instructions go in managed CLAUDE.md.

Hover a block, or a channel on the right rail to slide it into the conversation; the path-scoped rule slides in first. Launch-time channels form part of the cached prompt prefix: editing CLAUDE.md mid-session "doesn't apply" until /clear, /compact or a restart. Hook context arrives as system reminders at the point the hook fired. On-demand channels (path rules, subdirectory CLAUDE.md, skill bodies, docs read by tools) cost nothing until Claude touches the matching area. A rule that must survive compaction should drop paths: or move to the project-root CLAUDE.md.

Sharing rules across many repositories

Three mechanisms, each with a catch. Symlinks into .claude/rules/ work, but a target outside the working directory counts as an external import. It doesn't load until the developer approves external imports for the project, and after approval only rules without paths load. Links to network paths (UNC, /net) never load. User rules in ~/.claude/rules/ load everywhere without approval, but each machine has to receive them. Plugins can't ship rules files as such, but they can ship skills (task knowledge) and SessionStart hooks (environment knowledge), which is usually the better fit. For a monorepo, give each team its own nested CLAUDE.md and rules, and let individuals skip irrelevant ancestors with claudeMdExcludes in their local settings (never applicable to the managed file).

Describe a piece of knowledge with five questions, or start from an example. Each channel is a station on the band with its context cost, and the needle settles on the match as you answer; below it, the router explains why and names the next-best option. It's a course heuristic built on the docs' guidance ("target under 200 lines per CLAUDE.md file"; a skill's full file loads only "when the task calls for it"; hooks or permissions for must-happen rules).
Pitfall: the policy that lives in prose"Never push to main" in a managed CLAUDE.md is a request. Claude will usually comply, but CLAUDE.md is "context, not enforced configuration". Adherence drops with vague, conflicting or long instructions, and a path-scoped rule can be summarized away by compaction (the project-root CLAUDE.md and unscoped rules are re-injected from disk; a boundary stated only in conversation can be lost). If it must hold, express it as a permission rule (Bash(git push *) in ask), a hook, and ultimately branch protection on the server. Keep the prose for the why.

SessionStart Context

Static conventions belong in CLAUDE.md. Facts that change per machine or per day belong in a SessionStart hook: the current branch, the deploy target, the policy version, today's on-call, open incidents. A SessionStart hook "runs when Claude Code starts a new session or resumes an existing session", and its matcher says how the session began: startup, resume, clear, compact or fork. Only command and mcp_tool hooks are supported. A command hook's plain-text stdout is added to Claude's context. JSON output can instead return hookSpecificOutput.additionalContext, plus sessionTitle, watchPaths, initialUserMessage (in -p) and reloadSkills.

{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "startup|resume|clear|compact",
        "hooks": [
          { "type": "command", "command": "/usr/local/lib/claude/session-facts.sh", "timeout": 10 }
        ]
      }
    ]
  }
}
#!/bin/bash
# /usr/local/lib/claude/session-facts.sh: print FACTS, not instructions. Stdout becomes context.
set -euo pipefail
input=$(cat)
cwd=$(printf '%s' "$input" | jq -r '.cwd // "."')
src=$(printf '%s' "$input" | jq -r '.source // "startup"')
branch=$(git -C "$cwd" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "not a git repo")
echo "Session source: $src"
echo "Current branch: $branch"
echo "Claude Code policy version: $(cat /etc/claude-code/POLICY_VERSION 2>/dev/null || echo unknown)"
echo "Deploy target for this repo: staging (production deploys go through the release pipeline)"

Three details make the difference between a helpful hook and a harmful one:

  • Timing. At launch, SessionStart hooks run in the background: "You can type right away", but "Claude's first response still waits for the hooks to finish". A slow hook therefore adds latency to every first turn in the fleet. Keep it fast, and give it a timeout.
  • Phrasing. additionalContext is wrapped in a system reminder. The docs warn that "text framed as out-of-band system commands can trigger Claude's prompt-injection defenses, which causes Claude to surface the text to you instead of treating it as context". Write "The deploy target is staging", not "SYSTEM: you must deploy to staging".
  • Size. Values over 10,000 characters are written to a file, and Claude gets the path with a 2,000-character preview. "Claude can read the file, but Claude Code doesn't ask it to." Summarize instead of dumping.
Follow one session from launch through compaction, /clear, resume and fork. Each event feeds a fresh context sheet, and the SessionStart plate prints its header, stamped with the event's matcher value, only when the hook's matcher includes that value. Change the matcher to startup and watch the facts go missing after compaction, when only the summary survives. The session's lines are illustrative.

Governance angle. Deliver org-wide SessionStart hooks through managed settings. They keep running under allowManagedHooksOnly and can't be disabled by a user's disableAllHooks (only a managed disableAllHooks turns managed hooks off). Server-delivered hooks need the developer to approve a security dialog once. File and MDM delivery don't. For messages meant for people rather than Claude, use companyAnnouncements, which shows the developer one of your strings at startup. A SessionStart hook that syncs a skills repository can return {"hookSpecificOutput": {"hookEventName": "SessionStart", "reloadSkills": true}} so the fresh skills are available in the same session.

Context, cache and the cost of pushing knowledge every session

Claude Code's prompt cache matches an exact prefix: system prompt and tools, then project context (CLAUDE.md, auto memory, unscoped rules), then the conversation. "A change anywhere in the prefix recomputes everything after it." Launch-time knowledge is therefore paid for once per cache lifetime, at cache-write price, and read cheaply after that. That's why you shouldn't regenerate CLAUDE.md content per session: a timestamp in a managed CLAUDE.md would make the project-context layer of every session's prefix unique, so each session pays its own cache write for it (the system prompt and tools before it stay shared).

SessionStart context is injected at the start of the conversation, after the project context. Its size matters per session start, and when it changes it changes only the conversation part of the prefix. So put stable knowledge in CLAUDE.md or rules, volatile facts in a short hook output, and bulky references behind on-demand channels. A toy calculation: 2,000 tokens of always-loaded guidance read from cache across 30 turns costs about 30 × 2,000 × the cache-read rate, plus one cache write. The same guidance as a path rule costs nothing in sessions that never touch the path. Fleet-wide, 1% of the window per skill listing and a 200-line CLAUDE.md are the budgets worth defending. /context shows what each session actually loaded. Sources: Prompt caching, SessionStart.

Plugin Distribution

Procedures (skills), specialists (agents), automation (hooks) and integrations (MCP servers) travel best as plugins from a marketplace: "a directory or repository with a .claude-plugin/marketplace.json file that lists your plugins and where to fetch each one". Requiring them fleet-wide takes two managed keys, and restricting everything else takes a third:

{
  "extraKnownMarketplaces": {
    "acme-tools": {
      "source": { "source": "github", "repo": "acme-corp/acme-tools" },
      "autoUpdate": true
    }
  },
  "enabledPlugins": {
    "acme-platform@acme-tools": true,
    "deploy-helper@acme-tools": true,
    "legacy-migrator@acme-tools": false
  },
  "strictKnownMarketplaces": [
    { "source": "github", "repo": "anthropics/claude-plugins-official" },
    { "source": "github", "repo": "acme-corp/*" },
    { "source": "skills-dir" }
  ],
  "disableSideloadFlags": true
}
{
  "name": "acme-tools",
  "owner": { "name": "Acme Platform Team" },
  "plugins": [
    { "name": "acme-platform", "source": "./plugins/acme-platform", "description": "Review agent, deploy skill, edit audit hook" },
    { "name": "deploy-helper", "source": { "source": "github", "repo": "acme-corp/deploy-helper", "ref": "v2.3.0" } }
  ]
}

A managed enabledPlugins: true installs the plugin at the user's next session and can't be disabled locally. A managed false "is blocked from installation at every scope and hidden from the marketplace". The allowlist is enforced before any download and again at session start, so a plugin whose source no longer matches stops loading. The skills-dir entry keeps users' skills-directory plugins working while an allowlist is set. Without it they stop loading, though plain skills keep working. Keep the marketplace entry name and each plugin's manifest name identical, and run claude plugin validate ./acme-tools after every edit.

Hover or tab to a strand for its detail. The four surfaces share one pipeline and split apart only at the step that differs for them. Interactive machines clone the marketplace with the user's git credentials. Containers and CI use a read-only seed (CLAUDE_CODE_PLUGIN_SEED_DIR) built ahead of time. Anthropic-hosted cloud sessions get plugin keys only from server-managed settings, and a repo's .claude/settings.json can require plugins for its own contributors after they trust the folder.

Containers, CI and air-gapped fleets

# Build time: install into a seed instead of ~/.claude/plugins
CLAUDE_CODE_PLUGIN_CACHE_DIR=/opt/claude-seed claude plugin marketplace add acme-corp/acme-tools
CLAUDE_CODE_PLUGIN_CACHE_DIR=/opt/claude-seed claude plugin install acme-platform@acme-tools

# Runtime: point at the seed (read-only, autoUpdate forced off); plugins still need enabledPlugins
export CLAUDE_CODE_PLUGIN_SEED_DIR=/opt/claude-seed
export CLAUDE_CODE_SYNC_PLUGIN_INSTALL=1      # make -p wait for installs before the first query
claude -p "list your plugins" --output-format stream-json --verbose | head -1   # init event lists plugins[]

In CI the system/init event's plugins array, with each plugin's path under the seed, is your rollout check. Seed marketplaces still pass through the allowlist and blocklist, so allow the source you built them from.

Release channels for plugins"Claude Code has no release-channel concept, and one marketplace serves one version of each plugin at a time." Run two marketplaces with different names (say stable-tools and latest-tools) whose entries point at different refs, and assign them to groups through per-group endpoint files or Claude apps gateway policies. Server-managed settings apply to everyone and can't do it. The rollout concept uses this.

What you build: kit/ is a marketplace named team-tools with two plugins. guardrails is a fail-closed PreToolUse guard plus a status skill. release-notes is a user-only skill with ! context injection plus a Haiku subagent. validate_marketplace.py checks the kit with claude plugin validate's documented messages where they exist, plus its own checks of plugin files. It lists everything the kit executes, runs the guard on documented PreToolUse payloads, and breaks the kit 14 ways to prove each break is caught.

cd labs && python3 autonomy-2/plugin_marketplace/validate_marketplace.py
python3 autonomy-2/plugin_marketplace/validate_marketplace.py --with-claude   # also runs `claude plugin validate --json` (local, no model call)
claude plugin marketplace add ./autonomy-2/plugin_marketplace/kit && claude plugin install guardrails@team-tools

What to observe: section [3], "what runs with the user's privileges, outside the sandbox", names the guard hook (onFailure=block, timeout=10s) and the skill's git log injection. These are the lines to read before you allowlist any marketplace. In [4], malformed hook input and a crashing guard both come out deny. In [5], every mutation shows caught with the validator's message, such as Path contains "..": ./../guardrails or only plugin.json goes inside .claude-plugin/. The run ends with verdict: PASS.

Open the lab walkthrough

Documentation

Two kinds of documentation matter here: docs for Claude (reference material it should consult) and docs about the control plane (for the humans who live under it).

Docs for Claude: point, don't paste

"Imports help you organize a long file but don't reduce its context cost, because imported files load together with the CLAUDE.md that imports them." For the project CLAUDE.md, that's at launch (memory · imports). The scalable pattern is a short CLAUDE.md that tells Claude where documentation lives and when to read it. Claude then reads docs with its file tools only when a task needs them. For external or generated docs, prefer local files and CLIs over MCP where they exist (CLIs "don't add any per-tool listing", per the costs page). Use an internal docs MCP server, distributed through managedMcpServers or a plugin, when the source of truth is a service. Push knowledge into skills when it's a procedure and into path rules when it's a local convention.

✗ Documentation dumped into context

A 900-line CLAUDE.md that @-imports the API guide, the style guide and the runbook. Every session pays for all of it, adherence drops ("Longer files consume more context and reduce adherence"), and nobody notices when the runbook goes stale.

✓ Documentation routed on demand

A 120-line CLAUDE.md with a "Where to look" section (docs/api.md before editing src/api/; the /runbook skill for incidents), path rules for the two directories with sharp edges, and a scheduled /doctor prompt-audit to find outdated or conflicting instructions.

Docs about the control plane

A control plane that developers can't read gets routed around. Keep a policy register next to the managed settings in your config repo. For each key, record the requirement it serves, the owner, the version that introduced it, the test that proves it, and the escape path a developer can request. Publish a changelog per policy version, and link it from companyAnnouncements. Use pluginTrustMessage to append your review policy to the plugin trust warning. Two built-in commands help keep human docs current: /team-onboarding "generate[s] a team onboarding guide from your Claude Code usage history" (with a share link on Team and Enterprise), and /doctor offers to migrate always-loaded guidance into skills and nested CLAUDE.md files that load on demand.

# Claude Code policy register (excerpt)
| Key | Requirement | Owner | Since | Proof | Exception path |
|---|---|---|---|---|---|
| sandbox.network.allowManagedDomainsOnly | No unreviewed egress from shell commands | secops | v9 | ci/policy-tests/egress.sh | #claude-platform, 2-day SLA |
| availableModels + enforceAvailableModels | Models approved by procurement only | platform | v11 | doctor check in image build | budget request |
| strictKnownMarketplaces | Plugins only from reviewed sources | platform | v12 | plugin_marketplace/validate.py | PR to acme-corp/acme-tools |

Exercise: move one always-loaded paragraph to the right channel

Open your largest CLAUDE.md. Pick one paragraph and run it through the placement router above. Move it (to a path rule, a skill, a hook or a docs link), then start a fresh session and compare /context before and after. Finally, ask Claude a question that needs the moved knowledge, in a file where it should load, and confirm it still finds it.

Show a solution

Typical move: a 40-line "database migration conventions" section becomes .claude/rules/migrations.md with paths: ["db/migrations/**"]. /context shows the Memory files total drop by the section's size in sessions that don't touch migrations. Asking "add a column to users" makes Claude open a migration file, which loads the rule. You can confirm with an InstructionsLoaded hook (the load_reason is path_glob_match) or by asking Claude what rules apply. If the convention must survive compaction mid-task, keep a one-line pointer in the root CLAUDE.md.

Key takeaways

  • Managed CLAUDE.md (or claudeMd) reaches every session and can't be excluded, but it's context, not enforcement. Put must-hold rules in settings, hooks and server-side checks.
  • Path-scoped rules are the cheapest way to deliver local conventions. Symlinked shared rules need external-import approval, and only unscoped ones load after it.
  • SessionStart hooks deliver volatile facts at startup, resume, clear, compact and fork. Keep them fast, factual and short. The first response waits for them.
  • Distribute skills, agents and hooks as plugins: extraKnownMarketplaces + enabledPlugins to require, strictKnownMarketplaces + disableSideloadFlags to restrict, a seed directory for CI.
  • Point to docs instead of importing them, and document the control plane itself with a policy register and changelog.

Operations

A control plane is software, and it fails like software: a bad version reaches the fleet, a policy key breaks a workflow nobody tested, a plugin update changes behavior overnight. Operating it means versioning both the Claude Code binary and your configuration, rolling changes out in rings with gates between them, diagnosing quickly with the built-in tools, and being able to roll back every layer on a known clock.

Versioning

Two version axes move independently. Treat both as release artifacts.

The binary

Native installs auto-update: "Updates download and install in the background, then take effect the next time you start Claude Code." Pick the release channel with autoUpdatesChannel: "latest" (the default) or "stable", "a version that is typically about one week old and skips releases with major regressions". Package managers choose differently. The Homebrew cask claude-code tracks stable and claude-code@latest tracks latest, apt/dnf/apk repositories pick a channel per repository, and none of them auto-update by default. For an organization, four managed keys bound what can run:

Key / variableWhat it constrainsFailure mode it prevents
minimumVersionBackground updates and claude update won't install below itA move to stable downgrading machines already on a newer latest
requiredMinimumVersion (v2.1.163+)Refuses to start below it ("The check runs at startup only, so a session that's already running continues")Old clients that silently ignore your newest policy keys
requiredMaximumVersion (v2.1.163+)Refuses to start above it. Updates skip versions above the ceilingA regressed release spreading while you investigate
DISABLE_AUTOUPDATER vs DISABLE_UPDATESThe first stops only the background check (claude update and claude install still work). The second "block[s] all update paths"Drift on fleets where you ship the binary yourself

Both required-version keys "fail open by design: an invalid value is dropped rather than enforced", and claude update, claude install and claude doctor keep working outside the range "so users can recover". Pin a specific version with claude install 2.1.289, or with curl -fsSL https://claude.ai/install.sh | bash -s 2.1.289. claude --version prints 2.1.289 (Claude Code). The native installer keeps the version the launcher points to, any version a running session uses, and "the two newest versions", and deletes the rest. Two more binaries have their own versions. The VS Code extension's version is the Claude Code version it bundles, and the Desktop Code tab "runs its own copy of Claude Code, which has its own version number".

Set the installed version, channel, install method and the managed version keys, and watch the marker against the bounds and the band where a session may start. The simulator applies the documented rules for startup, background updates, claude update and recovery. The channel heads (latest = 2.1.304, stable = 2.1.296) are illustrative: stable is "typically about one week old".

The configuration

Version policy like code. Keep managed fragments in a config repository, one drop-in per owner (10-security.json, 20-models.json, 30-plugins.json). Stamp each release with a policy version (in companyAnnouncements, a POLICY_VERSION file the SessionStart hook prints, or both). Confirm deployment with the managed_settings.resolved_sha256 digest, which needs OTEL_LOG_MANAGED_SETTINGS=1. Plugins version through plugin.json or the commit SHA, and marketplace entries can pin ref and sha. The Claude apps gateway is a binary too. Pin its image tag (for example claude-gateway:2.1.298), and note that a gateway using the code policy key needs v2.1.296+ and refuses to start on an older version: "change code back to cli before you roll back".

Pitfall: stable channel vs new models"A newly launched model can require a Claude Code version newer than the stable channel serves." If procurement approves a new model, your availableModels change may need a requiredMinimumVersion bump, and a temporary move of the pilot ring to latest.

Rollout

A rollout ring is a group of machines or people that receives a change before the next group does. Rings work only if your delivery mechanism can target groups, and server-managed settings can't: "Settings apply uniformly to all users in the organization. Per-group configurations are not yet supported." Three mechanisms can:

  • Per-group endpoint files or profiles: an MDM profile or managed-settings.json per device group. If an organization-wide server-managed source also reaches the device, first-wins ignores your file, apart from cross-source keys. Check /status, or use "merge" deliberately.
  • Claude apps gateway policies by IdP group: "Policies are evaluated in order; the first match is selected, then merged onto the match: {} catch-all base." Put claude-ring-canary first, claude-ring-early second, and the base last.
  • A policyHelper that computes the ring from device or identity at startup and on refreshIntervalMs. Because a failing helper refuses to start sessions, it must serve from its own cache.

Plugins get rings through two marketplaces on different refs (stable vs early access), assigned per group with the same mechanisms. Model rollouts can use availableModels per ring. Binary rollouts can use autoUpdatesChannel and requiredMinimumVersion per ring.

Propagation clocks

A ring's "soak" can't start until the change has actually arrived, and arrival depends on the mechanism. Server-managed settings are fetched at startup and polled hourly. MDM is read at startup and checked every 30 minutes. Files apply at startup and on change. Gateway policy contents reach connected clients "on their next managed-settings poll, within an hour", while group membership changes take effect "on the next session re-mint ... bounded by session.ttl_hours". Some keys wait for the next launch regardless (forceRemoteSettingsRefresh, requiredMinimumVersion, model, OpenTelemetry exporter configuration, removal of an env variable). Server-delivered settings that need approval wait for the developer to accept a dialog. And "a session left open for weeks can still lag a rollout".

A change ships through rings. Pick the delivery mechanism, soak time and whether the change carries a defect that your gate signal detects after some exposure. The rings show how many machines run the new policy at the time you scrub to (or play), the gate ring marks where exposure crossed the threshold, and the revert empties them again. Toy model: the fleet sizes, propagation ramps and detection threshold are illustrative. The propagation delays follow the documented polling clocks.

Gates between rings

# On a ring machine (or in the image build): source, dropped entries, remote fetch outcome
claude doctor                      # read-only; lists invalid entries, "Managed settings (remote)", "Organization policy"
# then, in an interactive session: /status -> read "Setting sources" (and "Skipped sources", v2.1.242+)

# Fleet-wide (OpenTelemetry events, v2.1.274+ for managed_settings_resolved):
#   claude_code.managed_settings_resolved  -> managed_settings.sources, .resolved_sha256 (with OTEL_LOG_MANAGED_SETTINGS=1)
#   trigger="refused" + error.type          -> version_below_minimum | policy_invalid | provider_not_allowed | consent_rejected | ...
#   claude_code.tool_decision               -> spikes in denials after a permission change

Pick gate signals before you start. Ring machines report the expected digest. There are zero refused events with policy_invalid. Denial rates for the tools the change touched stay normal. And support channel volume stays flat. Widen only when every signal is green, and halt automatically when one isn't.

Onboarding waves use the same machineryBringing a new team onto Claude Code is a rollout. Pilot claude import codex --dry-run (or gemini/cursor) on one machine and commit the reviewed result to the repo. Put the team's group in your canary ring policy, and use /team-onboarding to produce a setup guide from the pilot users' history.

The managed_settings.py lab's probes are a ready-made gate: thirteen tool calls, each with an expected deny, ask, allow or no-match outcome, and a non-zero exit if any decision changes. Run them in CI on every policy change, before ring 0.

/doctor and Safe Mode

When "the policy doesn't apply" or "Claude behaves strangely since Tuesday" lands in your queue, three tools narrow it fast. They do different jobs.

ToolWhereWhat it does
claude doctorTerminal, no session"Read-only installation and settings diagnostics": install health, settings-file validation errors with source and field, the Auto-updates line and last update attempt, Remote Control eligibility, the Managed settings (remote) fetch outcome (v2.1.248+), and the Organization policy line (v2.1.261+).
/doctor (alias /checkup)In a session (bundled skill)A setup checkup that "proposes fixes that Claude applies after you confirm". It covers installation health, unused skills, MCP servers and plugins against their context cost, slow hooks, CLAUDE.md duplication and derivable content, and permission offers. /doctor prompt-audit [path] (v2.1.283+) audits instruction files for outdated or conflicting guidance. DISABLE_DOCTOR_COMMAND hides it.
claude --safe-mode (v2.1.169+)Session launch flag"Start with all customizations disabled": CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, themes, keybindings, status line and file-suggestion commands, LSP servers and auto memory. Authentication, model selection, built-in tools and permissions work normally.
Pick a symptom, then throw the main breaker (claude --safe-mode): every customization circuit drops at once, and the fault lamp tells you whether the cause was one of them. Managed hooks and settings policy stay on under the organization's locked lid, and authentication, model selection, built-in tools and permissions have no breaker at all. What safe mode turns off and keeps comes from the docs (test against a clean configuration, CLI reference). There are no per-circuit switches inside safe mode, so each breaker only names the check to run next. The symptoms and their causes are illustrative.

Safe mode is a bisection tool: "If the problem disappears in safe mode, you've narrowed the cause to one of the items you turned off." Two governance details matter. First, "Safe mode still applies managed hooks and settings policy from your organization", so a policy-caused problem persists in safe mode, which is itself a clue. Second, managed plugins, skills, CLAUDE.md and MCP servers are turned off. If the problem persists, run the clean-configuration test from an empty directory. Managed settings still apply there, which isolates the managed tier from everything personal:

mkdir -p ~/claude-clean/empty && cd ~/claude-clean/empty
CLAUDE_CONFIG_DIR=~/claude-clean/config claude --setting-sources user   # fresh home config, no project config
# problem gone   -> cause is in ~/.claude or the project; copy files back one at a time
# problem stays  -> check /status for managed settings, your shell environment, then Troubleshooting
Choose a symptom, then answer the safe-mode question. The navigator gives the ordered checks from the debugging docs and what each result means; tick each one off as you run it.
Don't confuse the three "minimal" modes--safe-mode is for troubleshooting and keeps your login and permissions. --bare is for scripted calls: it skips discovery of hooks, skills, plugins, MCP, CLAUDE.md and auto memory, uses no OAuth or keychain, and "is the recommended mode for scripted and SDK calls". --restricted (v2.1.248+) is for evaluation harnesses on shared machines: it removes command-running tools and WebFetch, confines file tools to the working directories, loads only managed settings and --settings, and refuses bypassPermissions.
Reading the evidence: debug logs, settings-source labels and refusal reasons

For delivery problems, claude --debug-file /tmp/cc-debug.txt and a search for Remote settings shows each server-managed fetch. The /status labels map one-to-one to mechanisms: (remote), (plist)/(HKLM), (file)/(drop-ins)/(file + drop-ins), (HKCU), (parent process), (helper), or …, merged. When the line is missing, Claude Code found no managed source with a policy key. Either the file is at the wrong path or it holds only control keys (an unparseable file would have refused startup instead). When the line names the wrong source, a higher-priority source won, and Skipped sources says which.

Refusals are the fleet-level version of the same evidence. The managed_settings_resolved event with trigger: "refused" carries error.type: helper_failed, policy_invalid, provider_not_allowed (v2.1.285+), consent_rejected, force_refresh_failed, gateway_rejected or version_below_minimum (which also covers being above requiredMaximumVersion). A rollout dashboard that counts these by policy digest finds a broken ring within one polling interval. Source: Monitoring usage, Debug your configuration.

Rollback

Rollback is a property you design in, not a command you run in a panic. For each layer, know its kill switch (the fastest way to stop the damage), its revert (restoring the previous good state) and its clock (when running and new sessions actually see the change).

LayerKill switchRevertGotchas
Claude Code binaryManaged requiredMaximumVersion just below the bad releaseclaude install <good-version>, then hold with the ceiling or DISABLE_UPDATESRunning sessions continue. New launches above the ceiling exit with a pointer to your approved method.
Managed policyRedeploy the previous document (git revert)SameServer-managed caches "persist on client machines until the next successful fetch". model and added env variables stay until relaunch.
A pluginManaged enabledPlugins: {"name@mkt": false}Publish a new version string that contains the old code (e.g. 1.4.1 = revert of 1.4.0)Moving a ref back without changing the computed version leaves users on the cached copy.
A marketplaceblockedMarketplacesFix the catalog, unblockInstalled plugins from a blocked source stop loading at session start.
An MCP serverdeniedMcpServers ("Nothing overrides a denylist match")Remove the entryRead from every admin source (v2.1.273+).
A modeldeniedModels (v2.1.283+)Remove the entrySessions on Default don't run a blocked model either.
HooksManaged disableAllHooks (drastic: also stops managed hooks and installed mods)Fix and redeploy the hookA user-level disableAllHooks doesn't stop managed hooks.
Pick what you're reverting and how it was delivered, on the board or in the menu. The board shows the worst-case wait, under the documented clocks, until running sessions and newly started sessions pick up each revert, and what a human has to do; the platform note carries the gotcha. Times are upper bounds from the polling intervals, not measurements.

Rehearse before you need it. Once per quarter, ship a harmless policy change through all rings, then roll it back, and measure how long the fleet's digests take to converge back. If server-managed settings are your only channel, also rehearse a fallback to endpoint delivery. Clearing the console doesn't instantly hand control to an MDM profile, because cached settings persist until the next successful fetch.

Exercise: practice version pinning and safe mode without touching your fleet

On your own machine: (1) run claude doctor and note the Auto-updates line and current version; (2) in ~/.claude/settings.json, set "autoUpdatesChannel": "stable" and "minimumVersion" to your current version, and predict what the next update will do; (3) start claude --safe-mode, run /context and /hooks, and compare them with a normal session; (4) write down the kill switch you'd use if a plugin you rely on shipped a bad update tomorrow.

Show a solution

(1) Typical output shows Auto-updates: enabled and your version. (2) With the floor at your current version, moving to stable won't downgrade you. You stay put until the stable channel passes your version, then follow it. (3) In safe mode, /context shows no memory files or custom skills, and /hooks shows nothing personal, though managed hooks (if any) remain. (4) For a personal machine, claude plugin disable <name>@<marketplace>, or pin the marketplace to a known-good ref. For a fleet, managed enabledPlugins: {"<name>@<marketplace>": false}, then a new version string from the marketplace owner. Revert step (2) afterwards if you prefer the latest channel.

Key takeaways

  • Version two things: the binary (channels, minimumVersion, requiredMinimum/MaximumVersion v2.1.163+, DISABLE_UPDATES) and the configuration (git, drop-ins, digests, plugin versions).
  • Rings need group-targeted delivery: per-group endpoint files, gateway policies by IdP group, or a policyHelper. Server-managed settings apply to everyone at once.
  • Know the propagation clocks: hourly (server/gateway), 30 minutes (MDM), on change (files), next launch for some keys, and approval dialogs for hooks and some env vars.
  • claude doctor diagnoses read-only, /doctor proposes fixes, and --safe-mode bisects customizations while keeping managed policy in force.
  • Every layer needs a kill switch and a revert path with a known clock, and plugin reverts need a new version string.

Session wrap-up

A Claude Code control plane is the managed tier at the top of the settings stack, plus everything that feeds it and everything that checks it. You now have the pieces. Configuration resolves by documented rules: lists merge, env vars are decided per pair, a few security keys take the strictest value, the managed tier is first-wins by default, and malformed policy refuses to start. Portability runs through AGENTS.md (an AAIF project), the Agent Skills standard (open standard; proposed to the AAIF, TC-approved 2026-10-01, Governing Board vote pending as of 2026-10-20), plugins as the versioned unit, and adapters that report their losses. In the environment, a required sandbox, per-developer credentials, a gateway or pinned provider, and safe defaults decide what Claude can do. Knowledge delivery puts each fact in the cheapest channel that still reaches the sessions that need it. Operations versions the binary and the policy, rolls out in rings on known clocks, and keeps a kill switch and a revert path for every layer.

Control-plane maturity ladder

LevelWhat existsNext step
0. PersonalEach developer's ~/.claude, ad-hoc repo filesCommit .claude/settings.json, CLAUDE.md and shared skills per repo
1. TeamCommitted project config, a team pluginA marketplace, plus managed extraKnownMarketplaces/enabledPlugins
2. ManagedOne managed document: bypass off, secrets denied, model allowlistSandbox required, supply-chain allowlists, version floor, telemetry
3. GovernedPolicy in git with a register, drop-ins per owner, OTel digestsGroup-targeted delivery and rings with gates
4. OperatedRings, rehearsed rollbacks, kill switches, gateway with per-group policyFeed incidents back into policy and evals (autonomy-5)

How this connects

Labs

What to do next

  1. Run /status and claude doctor on your machine and one CI runner, and write down every source that's in force.
  2. Draft your organization's first managed document with the compiler widget, then review each key against the "which control enforces this?" matrix.
  3. Move one team's shared skills and agents into a plugin in a private marketplace, and require it through extraKnownMarketplaces + enabledPlugins in a test ring.
  4. Pick the kill switch and revert path for each layer you operate, and rehearse one rollback.
  5. Continue with autonomy-3: Orchestrating Claude Code Teams.