Skip to content

Organization-Managed Policy ​

Organization-managed policy lets IT administrators enforce configuration, system prompt instructions, lifecycle hooks, MCP servers, managed plugins, and allow/deny constraints on employee machines through an OS-level administrator directory. A common setup deploys these files with MDM (mobile device management, a tool that pushes files and configuration to enrolled devices). Kimi Code only reads from this directory and never writes to it.

This page lists every managed file, configurable field, matching rule, trust check, and runtime enforcement behavior supported in the current version.

Managed root directory ​

The managed root directory is a local system directory that holds all organization policy files. Its default path depends on the operating system:

PlatformDefault directory
macOS/Library/Application Support/Kimi/Code/
Linux/etc/kimi/code/
WindowsC:\Program Files\Kimi\Code\

The managed root path is fixed per operating system and cannot be changed through environment variables or user configuration, preventing regular users from redirecting lookups to an empty directory to bypass enforcement. On Windows, C:\Program Files is writable only by Administrators by default, so regular users cannot pre-create or modify the managed directory, and no environment-variable lookup or subprocess ACL check is needed. Managed directories and files must still pass trust checks. Even when a session binds to a remote environment, the managed directory is always read from the local filesystem running the Kimi Code engine.

When the managed root directory does not exist, the managed layer stays inactive and Kimi Code behaves exactly as an unmanaged installation.

Directory layout and load order ​

All seven kinds of files and subdirectories under the managed root are optional:

text
<osManagedRoot>/
├── config.toml           # Primary configuration value overlay (snake_case TOML)
├── config.d/*.toml       # Configuration fragments, merged after config.toml in file-name order
├── policy.toml           # Constraint layer: limits models, permission modes, hooks, tools, MCP servers, and plugins
├── AGENTS.md             # Primary organization instructions file
├── rules/*.md            # Organization instruction fragments, appended after AGENTS.md in file-name order
├── mcp.json              # Managed MCP source ({ "mcpServers": { ... } })
└── plugins/<dir>/        # Managed plugin packages (kimi.plugin.json or .kimi-plugin/plugin.json)

Loading follows these rules:

  • Non-recursive scan: config.d/ reads only direct .toml children and rules/ reads only direct .md children; files in nested subdirectories are ignored.
  • Lexicographic merge: file names are sorted lexicographically (A–Z, a–z, digits). Use numeric prefixes such as 10-*.toml and 20-*.toml to control override order.
  • Encoding: all text files are read as UTF-8, and a leading UTF-8 BOM (byte order mark) is stripped automatically.
  • Read-only: Kimi Code never creates, modifies, or deletes files in the managed directory, and a missing individual file is not an error.

Configuration values: config.toml and config.d/*.toml ​

The configuration value layer uses the same snake_case field structure as config.toml and overrides effective configuration at the highest priority.

Priority and merge rules ​

Effective priority from lowest to highest:

text
Built-in defaults → user config.toml → section env bindings → environment variable overlay → in-memory runtime settings → managed config.toml → config.d/*.toml (in file-name order)
  • Deep merge: nested tables (such as [thinking] and [providers]) merge recursively by key, and later files override only the fields they explicitly set.
  • Array merging: [[hooks]] and [[permission.rules]] accumulate in file order across config.toml and config.d/*.toml, so later fragments never replace earlier managed hooks or permission rules. Ordinary arrays (such as extra_skill_dirs) are replaced as a whole rather than concatenated.
  • Two additive sections: [[hooks]] and [[permission.rules]] are extracted from the configuration overlay and run before user configuration instead of replacing the user's hooks or permission rules.

What can be configured ​

config.toml and config.d/*.toml in the managed root can override every configuration section in the user config.toml. The 33 registered configuration sections go through strict schema validation, and an invalid field type or value blocks startup:

CategorySections / top-level fieldsPurpose
Models and providersdefault_model, [providers], [models], [model_catalog], [thinking], [secondary_model]Pin the default model, define enterprise gateway providers and model aliases, set Thinking levels and subagent model pools
Permissions and securitydefault_permission_mode, default_plan_mode, [permission], [tools], [workspace]Pin the default permission mode and initial Plan mode, define permission rules and dangerous_command_guard, toggle global tools, and set workspace trust requirements
Lifecycle and extensions[[hooks]], extra_skill_dirs, extra_agent_dirs, merge_all_available_skills, builtin_product_skills, [hosts], [experimental]Managed hooks, extra Skill / Agent search directories, built-in product Skills, remote host declarations, and Beta / experimental feature flags
Loop and background tasks[loop_control], [task], [background], [subagent], [swarm], [cron]Steps per turn, retry and compaction thresholds, background task retention and timeouts, subagent / swarm timeouts, and scheduled task switches
MCP and external services[mcp], [services], [environments]Global MCP timeouts and lazy-loading defaults, built-in search / fetch endpoints, and remote environment declarations
Tools and media[read], [image], [token_counting]Read character budgets, image compression and read budgets, and context token counting strategies
System and identitytelemetry, auto_session_title, disable_feedback_survey, update_channel, [identity], [database], [watch]Telemetry, automatic session titles, rating prompts, update channel, Agent identity name and slug, session index, and the global file-watch switch

See Config files for the fields of each section.

Note

Managed configuration only applies to runtime settings backed by config.toml; it does not override tui.toml (color themes, UI layout, desktop notifications, [upgrade].auto_install, and other terminal preferences stay under the user's control). Unregistered top-level scalars such as default_model and telemetry are passed through as-is.

Fields pinned at runtime ​

Most managed fields override configuration reads. Two fields also lock live session state and reject command-line flags and UI actions:

FieldLocked behavior
default_model = "<alias>"Blocks CLI -m / --model, TUI /model, in-session model switching, subagent model selection, and disallowed models when resuming an older session
default_permission_mode = "manual" | "auto" | "yolo"Blocks CLI --yolo / --auto, TUI permission mode switching, and permission inheritance or changes from subagent, Tower, and goal modes

Managed update channel (update_channel) ​

Administrators can set update_channel in managed config.toml or config.d/*.toml to control which update channel devices follow:

toml
update_channel = "stable"
ValueBehavior
"latest"Follows the latest channel
"canary"Follows the Canary channel
"stable"Follows the managed stable channel, which receives verified releases after an observation period and updates less frequently
  • Highest priority: a managed value overrides user config.toml and the CLI KIMI_CODE_UPDATE_CHANNEL environment variable (the environment variable itself accepts only "latest" and "canary").
  • No automatic downgrade: after a device enters the "stable" channel, if its installed version is newer than or equal to the stable pointer, the client waits until the stable channel publishes a newer version instead of downgrading automatically.
  • Unpublished pointer: if the "stable" channel pointer has not been published yet (HTTP 404), clients treat it as no available update instead of reporting a check error or falling back to "latest".
  • Scope: the CLI (startup update checks, background installs, kimi upgrade) and Desktop (update checks on packaged latest builds and the forced-upgrade dialog) both read the merged value through the standard configuration interfaces. Desktop Canary and Preview builds keep their build-defined behavior.
  • Forced upgrades: the cloud client_upgrade_policy can configure channels.stable.cli_min_version / channels.stable.desktop_min_version separately for the stable channel. When unset, stable devices do not fall back to the global minimum version and are not forced to upgrade.

Managed hooks ([[hooks]]) ​

Managed hooks are declared as [[hooks]] array tables in config.toml or config.d/*.toml. They run before user [[hooks]] and user-installed plugin hooks, and users cannot disable them.

FieldTypeRequiredDescription
eventstringYesTrigger event name; must be one of the 20 events below
matcherstringNoRegular expression (such as "Bash|Write|Edit") matched against the tool name or event target; omit to match everything
commandstringYesNon-empty command string executed through the system shell (shell: true); stdin receives a snake_case JSON event payload
timeoutintegerNoTimeout in seconds, 1–600, default 30

Supported event values (20):

StageEvents
Tools and approvalsPreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionResult
User input and turnsUserPromptSubmit, UserPromptQueued, TurnStarted, Stop, StopFailure, Interrupt
Session and background tasksSessionStart, SessionEnd, SessionHeartbeat, TaskStarted
Subagents and compactionSubagentStart, SubagentStop, PreCompact, PostCompact
NotificationsNotification

See Hooks for the full input/output protocol and exit code 2 blocking semantics. A syntax or schema error in a managed [[hooks]] entry is never silently ignored: it raises managed_policy.invalid and blocks startup.

Managed permission rules ([[permission.rules]]) ​

Managed permission rules are declared in config.toml or config.d/*.toml and evaluated at the front of the permission chain, ahead of built-in policies, project rules, user rules, and in-session approvals.

FieldTypeRequiredDescription
decisionstringYes"deny", "ask", or "allow"
patternstringYesMatch pattern: ToolName or ToolName(argument pattern), such as Bash(rm -rf*); tool names support globs or *
reasonstringNoExplanation shown when blocking or auditing
scopestringNoNo need to set; loaded managed rules are always assigned the internal managed scope

Managed rules are evaluated in deny → ask → allow order: any matching deny blocks the action immediately (Blocked by managed policy: <reason>) and cannot be overridden by a later allow. [permission] dangerous_command_guard still participates as a regular configuration value.

Constraint layer: policy.toml ​

policy.toml restricts the values that users and lower-priority sources may select, complementing the configuration value layer. Unknown sections and unknown keys are ignored with a startup warning that names the file and key path (so newer policies can be rolled out ahead of older clients while still surfacing typos). Invalid types, enum values, or empty strings in string lists on known keys block startup (fail-closed).

String lists use the following matching rules:

  • Exact names and * wildcards (* matches any sequence of characters, including empty) are supported, and the pattern must match the entire string.
  • Matching is case-sensitive; ., +, ?, and other characters are treated literally, not as regular expressions.

[models] ​

Restricts allowed providers and models, enforced before each request, on model switches, and when resuming sessions.

FieldTypeDescription
allowed_providersarray<string>Allowed provider list; matches either the provider name (such as managed:kimi-code) or provider type (such as kimi)
allowed_modelsarray<string>Allowed model list; matches either the model alias (such as kimi-code/k3) or model ID (such as k3)
denied_modelsarray<string>Denied model list; matches alias or model ID and takes precedence over allowed_models

Evaluation order: check whether managed config.toml pins default_model first, then check allowed_providers, denied_models, and allowed_models.

[permission] ​

Restricts available permission modes and non-managed permission rules.

FieldTypeDefaultDescription
allowed_modesarray<"manual" | "auto" | "yolo">—Allowed permission modes (must contain at least one entry; an empty array is invalid and blocks startup). If it conflicts with a pinned default_permission_mode in config.toml, new and resumed sessions fall back to the first entry in this list and emit a configuration-conflict diagnostic warning
allow_managed_rules_onlybooleanfalseWhen true, ignores allow rules from all non-managed sources (user, project, session runtime) and clears remembered session approvals; non-managed deny / ask rules still apply

[hooks] ​

Restricts hook sources and trigger events.

FieldTypeDefaultDescription
allow_managed_onlybooleanfalseWhen true, runs only hooks from config.toml and managed plugins, skipping user configuration hooks and user-installed plugin hooks
disabledarray<string>—Hook event names to disable (same 20 event values); applies to managed, user, and plugin sources alike

[tools] ​

Force-disables listed tools across tool disclosure (the list visible to the model), tool fingerprinting, and pre-execution hooks.

FieldTypeDescription
disabledarray<string>Tools to disable; built-in tools match by exact name (such as WebSearch), and MCP tools use glob patterns such as mcp__<server>__* (for example mcp__github__*)

[mcp] ​

Restricts MCP server sources and names before any server process is spawned (pre-connection arbitration).

FieldTypeDefaultDescription
allow_managed_onlybooleanfalseWhen true, suppresses all non-managed sources (user, project, caller, runtime, and dynamically registered sources) with zero connections
allowed_serversarray<string>—Allowed server name list; applies to every source, including managed sources
denied_serversarray<string>—Denied server name list; applies to every source, including managed sources, and takes precedence over allowed_servers

[plugins] ​

Restricts plugin sources and plugin IDs (normalized to lowercase before glob matching).

FieldTypeDefaultDescription
allow_managed_onlybooleanfalseWhen true, loads only plugins from the managed plugins/ directory, ignoring user-installed plugins in ~/.kimi-code/plugins/installed.json and automatic installation of built-in capabilities (such as kimi-cu and kimi-webbridge)
allowed_pluginsarray<string>—Allowed plugin ID list; applies to all sources, including managed plugins
denied_pluginsarray<string>—Denied plugin ID list; applies to all sources, including managed plugins, and takes precedence over allowed_plugins

When [hooks] allow_managed_only = true or [mcp] allow_managed_only = true, hooks and MCP servers declared by managed plugins belong to the organization-managed channel and remain active; hooks and MCP servers from user-installed plugins are suppressed.

Organization instructions: AGENTS.md and rules/*.md ​

Organization instructions deliver company security red lines, coding standards, and compliance requirements to the model. All trusted AGENTS.md and rules/*.md files are concatenated in order into one block:

text
# Organization-Managed Policy Instructions

## AGENTS.md

<AGENTS.md body>

## rules/10-security.md

<rules/10-security.md body>
  • Size limit: leading and trailing whitespace is trimmed per file and empty files are skipped. The combined UTF-8 size (including headings and separators) must not exceed 64 KB (65536 bytes); exceeding the limit blocks startup.
  • Dynamic request-time injection: appended to the end of the system prompt for conversation turns of the main agent and every built-in or custom subagent, as well as internal calls that reuse the agent profile such as context compaction and prompt prediction. Compaction shares the same system-prompt prefix as normal turns, preserving the model prompt cache.
  • Never snapshotted, never truncates user prompts: managed instructions are not written to the session snapshot (wire.jsonl); resuming an older session appends the current instructions on outbound requests. Injection never truncates or rewrites user-authored custom agent or SYSTEM.md content by heading. Managed AGENTS.md is not treated as a project AGENTS.md and does not trigger project instruction reload reminders.

Managed MCP source: mcp.json ​

mcp.json under the managed root registers as a dedicated managed MCP source in every session, joins the session startup baseline, and takes effect even when the current project is untrusted.

Source priority and read-only protection ​

MCP source priority from lowest to highest (a higher-priority source takes over a same-named server, and the lower-priority server process is never spawned):

SourcePriorityDescription
plugin0MCP servers from user-installed plugins
user10~/.kimi-code/mcp.json
project-root20Repository root .mcp.json
workspace30Project .kimi-code/mcp.json
runtime50Servers added dynamically at runtime
caller100Servers supplied by the caller (such as an SDK / ACP host)
managed-plugin150MCP servers declared by managed plugins/<dir>/ packages; cannot be disabled or overridden
managed200Managed root mcp.json; cannot be disabled, overridden, or deleted

In MCP management UIs and APIs, managed servers are marked read-only (mutable: false). Users cannot disable the managed or managed-plugin source through /mcp-config, the SDK, or configuration files, and cannot modify, delete, or test a same-named server blocked by policy. The project trust prompt also excludes project servers that are already overridden or suppressed by managed policy.

Full server definitions ​

The top-level shape of mcp.json is { "mcpServers": { "<name>": <entry> } }. When transport is omitted, an entry with command is inferred as stdio and an entry with url is inferred as http.

Common fields (shared by all three transports):

FieldTypeDescription
enabledbooleanWhether the server is enabled (default true); when false, no connection is made
deferredbooleanWhether tools load on demand; defaults to [mcp] default_deferred (true) when omitted
startupTimeoutMsintegerStartup and tool discovery timeout in milliseconds, 1–2147483647
toolTimeoutMsintegerPer-tool-call timeout in milliseconds, 1–2147483647
enabledToolsarray<string>Exposes only the listed tools
disabledToolsarray<string>Hides the listed tools

stdio (local child process) fields:

FieldTypeRequiredDescription
transport"stdio"NoOptional (inferred from command)
commandstringYesNon-empty executable command
argsarray<string>NoCommand arguments
envobject<string, string>NoExtra environment variables
cwdstringNoWorking directory; relative paths resolve against the managed root directory (for example "." means <osManagedRoot>)
executor"local" | "kaos"NoExecutor type
environment_idstringNoTarget execution environment ID (set to "local" for local testing)

http and sse (remote endpoint) fields:

FieldTypeRequiredDescription
transport"http" | "sse"NoInferred as http from url; sse must be set explicitly
urlstringYesValid URL
headersobject<string, string>NoCustom request headers
auth"oauth"NoEnables the OAuth authorization flow
bearerTokenEnvVarstringNoEnvironment variable to read a Bearer Token from

Partial overrides and cross-source vetoes ​

Entries without transport, command, or url are treated as partial overrides and may only set enabled, deferred, enabledTools, and disabledTools (any other field fails validation).

Setting an entry to { "enabled": false } in managed mcp.json globally vetoes that server name across all lower-priority sources: even if an employee defines the same server in ~/.kimi-code/mcp.json or a project .mcp.json, its process never starts.

json
{
  "mcpServers": {
    "org-legacy-git": { "enabled": false }
  }
}

Managed plugins: plugins/ ​

Administrators can place standard plugin packages directly under <osManagedRoot>/plugins/<dir>/, where each direct subdirectory is a plugin root containing a kimi.plugin.json or .kimi-plugin/plugin.json manifest. Kimi Code loads these plugins read-only in place: it never copies them into ~/.kimi-code and never writes them to the user's plugins/installed.json.

Conflicts and read-only protection ​

  • Same-ID shadowing and restore: when a managed plugin's name (normalized to a lowercase ID) matches an installed user plugin, the managed version takes over every capability. The user's copy is shadowed but kept in installed.json, and automatically becomes active again if the administrator removes the managed plugin. Two managed plugins declaring the same ID block startup.
  • User mutations blocked: installing a plugin with the same ID, running /plugins disable, /plugins remove, /plugins mcp disable, or reinstalling a built-in capability with a managed plugin ID is rejected with Blocked by managed policy: plugin "<id>" is managed by your organization. In the /plugins panel and details view, managed plugins carry a managed badge, and enable/disable, removal, and MCP toggles are read-only.

Managed priority of the seven capabilities ​

CapabilityManaged behavior
systemPrompt / systemPromptPathTreated as organization-managed instructions, sorted by plugin ID and appended after AGENTS.md and rules/*.md under ## plugins/<id>, sharing the 64 KB aggregate limit; each plugin is capped at 32 KB and exceeding either limit blocks startup. Never wrapped in the untrusted "reference data" plugin section; injected dynamically at request time and refreshed on resume
hooksRun immediately after config.toml [[hooks]] and before user [[hooks]] and user plugin hooks; cwd and KIMI_PLUGIN_ROOT point to the managed plugin directory
mcpServersNamed plugin-<id>:<server> and registered through the dedicated managed-plugin MCP source (priority 150, above caller(100) and below managed(200)) in the session startup baseline; users cannot override or disable them from other sources, and they work in untrusted projects
skillsKeep the <pluginId>:<skill> namespace and register through the high-priority managed-plugin source; if a user or project Skill declares the same qualified name in frontmatter, the managed plugin wins
agentsRegister through the highest-priority managed-plugin source, overriding same-named subagents from user, project, and explicit sources
commandsInvoked as /<pluginId>:<command>, same as regular plugins
sessionStartInjected as a <plugin_session_start> reminder on the first turn of a session, keeping per-session snapshot semantics

Trust checks and failure semantics ​

To stop local users from tampering with policy or planting malformed files to block others, the managed layer verifies ownership and permissions on every directory and file and uses a tiered failure strategy.

Trust requirements ​

The managed root, config.d/, rules/, plugins/, and every managed file must satisfy the checks below. For plugins/<dir>/, the entire directory tree (all subdirectories, scripts, and resource files) is checked recursively, and any untrusted entry causes the whole plugin to be skipped:

PlatformTrust requirements
macOS / LinuxOwned by root (uid = 0); not a symbolic link; must be a regular file or directory; no group/other write bits (mode & 0o022 == 0, recommended 755 for directories and 644 for files)
WindowsProtected by the C:\Program Files system ACL (only Administrators can create or modify entries by default); must be a regular file or directory and not a symbolic link or reparse point (including junctions), checked directly via filesystem metadata without spawning subprocesses

Tiered failure behavior ​

ScenarioBehavior
Managed root directory does not existManaged layer stays inactive; normal startup with zero behavior change
Root directory, subdirectory, or individual file fails trust checksSkips that entry with a warning naming the path and reason (such as Skipping untrusted managed file ...), and continues startup; an untrusted root skips the entire managed layer
policy.toml contains unknown sections or unknown keysIgnores unknown entries, keeps all known constraints active, and emits a startup warning (such as Ignoring unknown keys in managed policy file ...)
Trusted file read failure, TOML / JSON syntax error, known field schema failure, or combined managed instructions over 64 KBStartup fails closed (refusing to run rather than degrading enforcement), raising managed_policy.invalid with the file path and reason
File change triggers a hot reload at runtime, but the new content is invalidLogs managed policy reload failed; keeping last valid snapshot and keeps the previous valid snapshot without interrupting the running process

File watching covers eight directory levels below the managed root (including plugin manifests, Skills, and script files) with a 150 ms debounce. Setting [watch] enabled = false disables hot reload, so changes then require a restart.

Session resume and anti-bypass boundaries ​

Persisted data under the local sessions/ directory is treated only as a cache of conversation history and unmanaged preferences, never as the source of truth for enforcement. Even if an employee edits wire.jsonl by hand, managed policy cannot be bypassed:

  • Resume / fork realignment: saved model aliases, permission modes, disabled tools, and permission rules are re-validated against the current policy. Disallowed models or permission modes automatically fall back to the managed default (or manual when no permission mode is pinned, or the first entry in [permission] allowed_modes), emitting a managed-policy-fallback warning. If no allowed model is available, resuming fails closed.
  • Disallowed user actions: switching to a blocked model, permission mode, tool, or MCP server in a live session is rejected with Blocked by managed policy: <reason> (error code managed_policy.blocked).
  • Runtime enforcement: every LLM request re-checks the model and appends current managed instructions; managed permission rules run first in the permission chain; disabled tools are vetoed at disclosure and before execution; MCP pre-connection arbitration filters every source against managed constraints.

Note

Current boundary: ordinary conversation messages in a session are not cryptographically signed against tampering (matching mainstream peers). Enforcement guarantees that system instructions, model egress, tool sets, permission red lines, MCP entry points, and managed plugins are enforced by the current process. The product does not include a cloud admin console or an MDM distribution channel.

Observability and troubleshooting ​

To confirm whether a policy is active or why an action was blocked:

  • Block messages: all runtime rejections start with Blocked by managed policy: followed by the reason (for example model is pinned to "ACME Final K2" (org-final-model) — when a display_name is configured, both the display name and the alias are shown — or tool "..." is disabled).
  • Configuration inspection: config.inspect (or GET /api/v1/config) exposes managedValue per section so you can tell which values came from the managed layer.
  • Diagnostics: GET /api/v1/config returns active diagnostics in its optional warnings field (such as skipped untrusted files or ignored unknown policy.toml keys). Desktop App and Web surface these as bottom-right Configuration warning toasts on startup and hot reload (deduplicated while active; re-shown if they clear and recur). TUI shows them in the transcript and CLI -p writes them to stderr. ManagedPolicyService also exposes loadedFiles, skippedFiles, pinnedKeys, and diagnostics.

Test bundle ​

examples/managed-policy/ in the repository provides a ready-to-deploy test bundle covering model and permission pinning, dangerous command blocking, audit hooks, organization instruction fragments, a managed plugin, a local stdio MCP server, and cross-source vetoes. See the README.md in that directory for deployment commands and a step-by-step verification checklist.

Next steps ​

  • Config files — field reference for user-level config.toml
  • Config overrides — priority rules across CLI flags, environment variables, and config files
  • Hooks — hook input/output protocol and blocking semantics
  • Model Context Protocol — MCP server configuration and management UI