Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

managed-policy.md

133 lines7.4 KB

1# Managed policy
2​
3A managed policy lets an administrator set defaults, lock settings, and restrict capabilities (such as maximum permission mode, allowed providers, or remote access) for every user on a machine. The T3 Code server enforces the policy for all connected clients (desktop, web, and mobile).
4​
5## Roll out a policy
6​
71. Author a JSON policy (see [Write a policy](#write-a-policy)). Do **not** include secrets—all local users can read the policy.
82. Validate it: `t3 policy check policy.json`.
93. Deploy via MDM/GPO or a file to [one supported location](#where-the-policy-goes).
104. Restart T3 Code on the machine (policies load at startup only).
115. Verify with `t3 policy show`.
12​
13## Write a policy
14​
15```json
17 "schemaVersion": 1,
18 "organization": "Example Corp",
19 "supportUrl": "https://it.example.com/t3",
20 "settings": {
21 "defaultRuntimeMode": { "value": "approval-required", "locked": false },
22 "enableAgentBrowserAccess": { "value": false, "locked": true }
23 },
24 "limits": {
25 "maxRuntimeMode": "auto-accept-edits",
26 "clients": ["desktop", "local-browser"],
27 "telemetry": false
28 }
30```
31​
32`schemaVersion` and `organization` are required. Locked controls display your organization name and optional `supportUrl` in Settings.
33​
34## Where the policy goes
35​
36Use **one** source per machine (having both a native policy and a policy file prevents T3 Code from starting):
37​
38| OS | Native policy | Policy file (admin-writable only) |
39| ----------- | --------------------------------------------------------------------------------- | ------------------------------------------------- |
40| **macOS** | Device configuration profile for `com.t3tools.t3code` | `/Library/Application Support/T3Code/policy.json` |
41| **Windows** | GPO template or `Policy` (`REG_SZ`) under `HKLM\SOFTWARE\Policies\T3Tools\T3Code` | `C:\Program Files\T3Code\policy.json` |
42| **Linux** | — | `/etc/t3code/policy.json` |
43​
44- **macOS profile**: Generate `macos/t3code.mobileconfig` with `t3 policy templates <dir> --policy policy.json` (or `plutil -convert xml1 -o com.t3tools.t3code.plist policy.json`). Deploy as a single device profile (profiles cannot represent `null`; use a policy file if needed).
45- **Windows GPO**: Generate `windows/t3code.admx` and `windows/en-US/t3code.adml` with `t3 policy templates <dir>`, import into `PolicyDefinitions`/Intune under **Computer Configuration → Administrative Templates → T3 Code**, set **Organization**, run `gpupdate /target:computer /force`, and restart T3 Code.
46- **Windows registry**: Set `Policy` (`REG_SZ`) to single-line JSON (do not mix with GPO template values).
47​
48## Check what the server loaded
49​
50Run `t3 policy show` as the user running T3 Code to inspect the installed policy, fingerprint, and whether the running server has loaded it. After any policy change or removal, restart the desktop app or run `t3 service restart`. Removing a policy restores the user's own saved settings.
51​
52> Note: T3 Code **refuses to start** if a policy is unreadable, invalid, uses unknown keys from a newer version, or conflicts with another policy source. Always validate with `t3 policy check` and upgrade T3 Code before deploying newer keys.
53​
54## Settings
55​
56Run `t3 policy settings` to list every manageable path from `settings.json` and its default.
57​
58- `"locked": false` sets a default (users can override).
59- `"locked": true` enforces the value across Settings and project overrides.
60​
61Key constraints:
62​
63- Lock `worktreeCleanup` together with `storageCleanup` worktree rules.
64- `observability` (OTLP endpoints) cannot be managed by policy.
65- Manage `idleCompaction` (not legacy `compactIdleThreads`).
66- Lock `providerInstances.<id>` as a whole, or pin per-driver fields under [`limits.providers.instances`](#providers).
67​
68## Limits
69​
70```json
72 "schemaVersion": 1,
73 "organization": "Example Corp",
74 "limits": {
75 "maxRuntimeMode": "auto-accept-edits",
76 "clients": ["desktop"],
77 "connect": false,
78 "webhookTasks": false,
79 "browserCookieImport": false,
80 "previewTunnel": false,
81 "worktreeLayoutCommands": false,
82 "telemetry": false,
83 "providers": {
84 "allowedDrivers": ["claudeAgent", "codex"],
85 "instances": {
86 "claudeAgent": {
87 "locked": true,
88 "environment": [{ "name": "CLAUDE_CODE_USE_BEDROCK", "value": "1" }]
89 }
90 }
91 },
92 "updates": { "mode": "auto", "feedUrl": "https://updates.example.com/t3code/" }
93 }
95```
96​
97### Permission modes
98​
99`maxRuntimeMode` caps all threads (`approval-required`, `auto-accept-edits`, `auto`, or `full-access`). Threads above the cap cannot run until lowered.
100​
101When `maxRuntimeMode` is set, users cannot modify provider launch settings (`binaryPath`, `launchArgs`, config home, or env vars)—pin required values (including absolute `binaryPath`s so user `PATH` entries can't shadow them) in `providers.instances`. Leave `acpRegistry` out of `allowedDrivers` if you don't want users adding arbitrary ACP Registry agents.
102​
103### Clients and T3 Connect
104​
105`clients` allows any subset of `desktop`, `local-browser`, and `remote` (keep `desktop` on desktop machines).
106​
107- Omitting `remote` restricts the server to loopback, revokes paired devices, disables LAN/Tailscale Serve/T3 Connect, and refuses startup if a Tailscale Serve route still forwards to T3 Code (or if a legacy service has LAN enabled—run `t3 up --no-lan`).
108- Set `"connect": false` to disable T3 Connect while allowing LAN/Tailscale remote access.
109​
110### Other capabilities
111​
112- `webhookTasks: false`: Disables scheduled-task and workflow webhooks.
113- `browserCookieImport: false`: Disables importing cookies from other browsers.
114- `previewTunnel: false`: Disables remote `localhost` tunneling and port forwarding (streams tabs instead).
115- `worktreeLayoutCommands: false`: Disables `t3.json` `worktreeLayout` `create`/`remove` commands.
116- `telemetry: false`: Disables product usage data and relay tracing for the server, desktop app, and server-opened browsers (does not control `app.t3.codes` or mobile).
117​
118### Providers
119​
120- `providers.allowedDrivers`: Whitelist of driver IDs (`codex`, `claudeAgent`, `cursor`, `grok`, `opencode`, `antigravity`, `fx`, `kiro`, `pi`, `muse`, `acpRegistry`).
121- `providers.instances`: Sets or locks (`"locked": true`) fields across all instances of a driver (e.g., Bedrock/gateway env vars, `binaryPath`, `launchArgs`). Locking `codex` (or using `maxRuntimeMode`) disables ChatGPT-managed Codex; locking `opencode` disables external `serverUrl`.
122​
123### Updates
124​
125- `mode`: `"auto"` or `"off"` (when updates are managed externally).
126- `feedUrl`: Custom update mirror matching GitHub Release layout (`latest*.yml` and installers at root; `t3-*` archives and `SHA256SUMS` under `v<version>/`).
127- `allowNightly: false`: Disables the nightly channel.
128​
129## What a policy does not cover
130​
131- **Provider CLIs**: Restrict underlying CLIs with their own managed settings (e.g., Claude Code managed settings).
132- **WSL**: Managed Windows desktop disables its WSL environment; a server started manually inside WSL reads `/etc/t3code/policy.json` in that distro.
133- **Local admins / port forwarding**: Administrators can modify policies or T3 Code binaries, and users can still port-forward loopback sockets with external tools. Use OS/MDM controls for binary integrity and network isolation.