agent-policy-kit 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/AGENT_INSTALL.md +126 -42
  2. package/CHANGELOG.md +93 -3
  3. package/README.md +21 -53
  4. package/bin/agent-policy.mjs +10 -10
  5. package/docs/README.md +46 -0
  6. package/docs/assets/configurator.png +0 -0
  7. package/docs/assets/subagent-limits.svg +44 -0
  8. package/docs/design/2026-11-01-documentation-structure.md +58 -0
  9. package/docs/guide/commands.md +375 -0
  10. package/docs/guide/configurator.md +163 -0
  11. package/docs/guide/getting-started.md +119 -0
  12. package/docs/guide/preferences.md +168 -0
  13. package/docs/guide/privacy.md +76 -0
  14. package/docs/guide/updates-and-removal.md +188 -0
  15. package/docs/maintainers/architecture.md +71 -0
  16. package/docs/maintainers/development.md +93 -0
  17. package/docs/maintainers/model-review.md +101 -0
  18. package/docs/maintainers/release.md +114 -0
  19. package/docs/maintainers/verification.md +95 -0
  20. package/docs/maintainers/website.md +112 -0
  21. package/docs/reference/assistants.md +165 -0
  22. package/docs/reference/model-catalog.md +194 -0
  23. package/docs/reference/ownership.md +177 -0
  24. package/docs/reference/presets.md +128 -0
  25. package/docs/reference/roles.md +157 -0
  26. package/docs/research/2026-11-01-model-review.md +341 -0
  27. package/docs/research/limits-evidence.md +28 -0
  28. package/models/README.md +2 -6
  29. package/models/catalog.json +57 -26
  30. package/package.json +7 -3
  31. package/policies/balanced.json +3 -3
  32. package/policies/fast.json +3 -13
  33. package/policies/quality.json +4 -14
  34. package/schema/policy.schema.json +2 -2
  35. package/site/index.html +108 -60
  36. package/src/detect.mjs +61 -13
  37. package/src/explicit.mjs +4 -4
  38. package/src/inspect.mjs +14 -13
  39. package/src/install.mjs +19 -13
  40. package/src/native.mjs +8 -8
  41. package/src/output.mjs +5 -5
  42. package/src/policy.mjs +2 -2
  43. package/src/release.mjs +1 -1
  44. package/src/setup.mjs +1 -1
  45. package/src/share.mjs +5 -5
  46. package/docs/architecture.md +0 -17
  47. package/docs/compatibility.md +0 -23
  48. package/docs/configuration-page.md +0 -44
  49. package/docs/deployment.md +0 -31
  50. package/docs/development.md +0 -21
  51. package/docs/installation.md +0 -23
  52. package/docs/model-catalog.md +0 -102
  53. package/docs/model-updates.md +0 -22
  54. package/docs/npm-release.md +0 -27
  55. package/docs/policy.md +0 -16
  56. package/docs/privacy.md +0 -9
  57. package/docs/recovery.md +0 -13
  58. package/docs/releases.md +0 -40
  59. package/docs/use-cases.md +0 -25
  60. package/docs/verification.md +0 -45
@@ -0,0 +1,58 @@
1
+ # Documentation structure
2
+
3
+ ## Intent
4
+
5
+ The documentation grew as a set of notes: one flat `docs/` folder for four audiences, documents that mix several topics, the same facts repeated in up to eight places, and stale statements from before the first publication. The goal is a set of independent documents. Each document answers one question for one audience, can be read without the others, and links to the single place where a related fact is documented.
6
+
7
+ The research behind the presets is also documented, so a reader can check why a preset has its values.
8
+
9
+ ## Decisions
10
+
11
+ - Documents move into audience folders. Old paths are removed without redirect stubs (owner decision). Links in code, tests, the page template and the changelog are updated to the new paths.
12
+ - The work is a separate pull request, stacked on the 0.4.0 preset pull request (#22).
13
+ - Language stays English. Style follows ASD-STE100 principles: short sentences, active voice, present tense, one instruction per step, terms defined on first use.
14
+ - Every fact has one canonical document. Other documents link to it instead of restating it. Short summaries with a link are allowed where a reader needs the context.
15
+ - Every document starts with a title and a short paragraph that says what it covers and who it is for.
16
+ - No account data, private paths, raw configuration, credentials or test evidence from a real account goes into Git. Research describes product facts and public sources, not what one account can access.
17
+
18
+ ## Structure
19
+
20
+ | Path | Audience | Covers | Main sources |
21
+ |---|---|---|---|
22
+ | `README.md` | Everyone | What APK is, quick start, links | current README |
23
+ | `AGENT_INSTALL.md` | AI agent that installs APK | Step-by-step runbook: select release, detect, plan, apply, verify, remove, report. Details are links. | current AGENT_INSTALL |
24
+ | `CONTRIBUTING.md`, `SECURITY.md` | Contributors, reporters | Refreshed, no pre-publication statements | current files |
25
+ | `docs/README.md` | Everyone | Index: which document answers which question | new |
26
+ | `docs/guide/getting-started.md` | People who use APK | Configurator → command → check → remove the package; common scenarios | installation, use-cases |
27
+ | `docs/guide/configurator.md` | People who use APK | The page: steps, modes, top models switch, per-tool limits, share links | configuration-page (user parts) |
28
+ | `docs/guide/commands.md` | People and agents | CLI reference: every command, input mode and flag, output formats, exit codes | AGENT_INSTALL §2, installation, releases, `bin/` and `src/` |
29
+ | `docs/guide/preferences.md` | Advanced users | Preferences JSON format and validation rules | policy |
30
+ | `docs/guide/updates-and-removal.md` | People who use APK | Choose a release, upgrade, downgrade, uninstall, recover from an interrupted change, what a release does not freeze | releases, recovery, model-updates (user part) |
31
+ | `docs/guide/privacy.md` | Everyone | What APK reads, writes and never sends | privacy |
32
+ | `docs/reference/assistants.md` | Everyone | Per assistant: detected executable, files written, native limits, desktop apps, prerequisites | compatibility, AGENT_INSTALL §4, installation, design/grok |
33
+ | `docs/reference/roles.md` | Everyone | The six roles, their prompts and permissions, the default subagent per assistant, how effort applies | `src/roles.mjs`, `src/native.mjs`, `src/install.mjs`, architecture |
34
+ | `docs/reference/presets.md` | Everyone | Light, Standard, Top-tier matrices, top models switch, parallel limits, design principles, short reasons with links to research | model-catalog (preset parts) |
35
+ | `docs/reference/model-catalog.md` | Everyone | What `models/catalog.json` contains: fields, inventory per assistant, efforts, defaults, lifecycle | model-catalog (catalog parts), models/README |
36
+ | `docs/reference/ownership.md` | Advanced users, maintainers | Receipts v2–v4, state directory, transactions, drift, rollback; glossary of owned, drift, receipt | architecture, releases, recovery, AGENT_INSTALL §5 |
37
+ | `docs/research/2026-11-01-model-review.md` | Maintainers, curious users | Evidence for the 0.4.0 presets: sources by vendor, Opus vs Sonnet by effort, Fable vs Opus, effort returns, small models, open questions | `.agent-work` research report and notes |
38
+ | `docs/research/limits-evidence.md` | Everyone | How the README limit illustration was measured | limits-evidence |
39
+ | `docs/maintainers/architecture.md` | Maintainers | Modules, data flow, release = version | architecture |
40
+ | `docs/maintainers/development.md` | Maintainers | Setup, tests, hooks, sandbox requirements | development |
41
+ | `docs/maintainers/model-review.md` | Maintainers | How to review models and presets for a release | model-updates, model-catalog maintenance text |
42
+ | `docs/maintainers/release.md` | Maintainers | Prepare, verify and publish a configuration release | npm-release |
43
+ | `docs/maintainers/website.md` | Maintainers | Page build, hosting, versioned pages, automatic deployment, credentials | configuration-page (build parts), deployment |
44
+ | `docs/maintainers/verification.md` | Maintainers | Verification log per release | verification |
45
+ | `models/README.md` | Maintainers | Two lines: what the file is, link to the catalog reference | models/README |
46
+ | `docs/design/` | Maintainers | Dated design specs, unchanged | — |
47
+
48
+ ## Constraints
49
+
50
+ - `test/catalog.test.mjs` parses the preset tables (`### Light`, `### Standard`, `### Top-tier`, rows `| Coder | … |`). The tables move to `docs/reference/presets.md` in the same format, and the test reads that path.
51
+ - `scripts/build-site.mjs` links the page to the limits evidence; the link moves to `docs/research/limits-evidence.md`.
52
+ - The packaged `README.md` must keep `# Agent Policy Kit` as its first line and the `docs/assets/subagent-limits.svg` image.
53
+ - `CHANGELOG.md` keeps its entries; only link targets change. The 0.4.0 entry notes the reorganization.
54
+ - Facts must match the code on this branch. Where a document and the code disagree, the code wins and the difference is reported.
55
+
56
+ ## Out of scope
57
+
58
+ Code behavior, presets, catalog values, the page interface and the changelog wording of released versions.
@@ -0,0 +1,375 @@
1
+ # Commands
2
+
3
+ This document is the full reference for the `agent-policy` command line: every command, input mode and option, the output formats and the exit codes. It is for people and AI agents that run APK in a terminal. For a first setup, see [Getting started](getting-started.md).
4
+
5
+ ## Run the CLI
6
+
7
+ APK needs Node.js 22.13 or later in the 22 line, or Node.js 24 or later.
8
+
9
+ Run a pinned release with `npx`:
10
+
11
+ ```sh
12
+ npx --yes --ignore-scripts --package agent-policy-kit@0.4.0 agent-policy <command> [options]
13
+ ```
14
+
15
+ - `--package agent-policy-kit@0.4.0` selects the configuration release. The package version is the release version.
16
+ - `--ignore-scripts` prevents npm install scripts.
17
+ - `--yes` lets npx download the package without a prompt.
18
+
19
+ The examples below write only `agent-policy <command>`. Put the `npx` prefix in front of them, or use an installed `agent-policy` executable.
20
+
21
+ APK is a one-shot configurator. Each command runs once and exits. The native files that it writes do not depend on the package.
22
+
23
+ ## Commands
24
+
25
+ | Command | Purpose | Writes files |
26
+ |---|---|---|
27
+ | [`setup`](#setup-and-install) | Plan the native configuration for detected assistants. With `--apply`, write it. | Only with `--apply` |
28
+ | [`install`](#setup-and-install) | The same as `setup`. | Only with `--apply` |
29
+ | [`show`](#show) | Read the current user-level subagent settings of each assistant. | No |
30
+ | [`doctor`](#doctor) | Verify the configuration that APK owns. | No |
31
+ | [`detect`](#detect) | Find installed assistants from their executables. | No |
32
+ | [`release`](#release) | Show the configuration release of this package and its release notes. | No |
33
+ | [`uninstall`](#uninstall) | Plan the removal of the configuration that APK owns. With `--apply`, remove it. | Only with `--apply` |
34
+ | [`init`](#init) | Create an editable preferences file. | Yes, a new file only |
35
+ | [`instructions`](#instructions) | Print the AI operator guide. | No |
36
+ | `help` | Print the usage summary. | No |
37
+
38
+ Each command accepts exactly one command name and no other positional argument. Two more options work without a command:
39
+
40
+ - `--help` prints the usage summary. No command or `help` does the same.
41
+ - `--version` prints the package version.
42
+
43
+ ## Common options
44
+
45
+ | Option | Value | Used by | Meaning |
46
+ |---|---|---|---|
47
+ | `--client` | `chatgpt`, `claude`, `kimi`, `gemini` or `grok` | `setup`, `install`, `show`, `doctor`, `detect`, `uninstall` | Limit the command to one assistant. |
48
+ | `--home` | A path | `setup`, `install`, `show`, `doctor`, `uninstall` | Use the standard assistant folders under this folder instead of your home folder. |
49
+ | `--state-dir` | An absolute path | `setup`, `install`, `show`, `doctor`, `uninstall` | Use this APK state directory. |
50
+ | `--apply` | none | `setup`, `install`, `uninstall` | Write the planned changes. Without it, the command is a preview. |
51
+ | `--json` | none | all commands except `instructions` and `help` | Print JSON. See [Output](#output). |
52
+
53
+ Assistant IDs map to coding agents: `chatgpt` is Codex, `claude` is Claude Code, `kimi` is Kimi Code, `gemini` is Antigravity and `grok` is Grok Build. Version 0.2.0 and earlier used `codex` and `agy`. These IDs are not accepted.
54
+
55
+ ### Home folder and state directory
56
+
57
+ The *state directory* is the private APK folder with receipts, saved preferences and transaction backups. The [ownership reference](../reference/ownership.md#state-directory) gives its default location, the order in which APK selects it, and its content. A path that is not absolute fails with `STATE_PATH_MUST_BE_ABSOLUTE`.
58
+
59
+ If you use `--home` or `--state-dir` for setup, use the same values for `doctor`, `show` and `uninstall` later.
60
+
61
+ Automatic setup uses the standard native folders, for example `~/.codex` and `~/.claude`. If `CODEX_HOME`, `CLAUDE_CONFIG_DIR`, `KIMI_CODE_HOME` or `GROK_HOME` points to a different folder, setup writes nothing for that assistant. It reports the prerequisite `native-home-override-unsupported`. With `--home`, APK skips this check and uses the standard layout under `--home`.
62
+
63
+ ## setup and install
64
+
65
+ `setup` plans the native configuration for each detected and selected assistant. `install` is the same command. Without `--apply`, the command writes nothing. With `--apply`, it writes the plan.
66
+
67
+ ```sh
68
+ agent-policy setup [input] [--client ID] [--home PATH] [--state-dir PATH] [--apply] [--json]
69
+ ```
70
+
71
+ APK configures only assistants that are installed and selected in the preferences. It finds them as `detect` does. An assistant that is not installed is skipped. Each assistant has its own transaction: one assistant can succeed while another stops.
72
+
73
+ A repeated setup with the same values changes no file. The preview reports `planned` with no files, and the readable output shows `Already up to date`. With `--apply`, the result is `unchanged`. After a change, open a new session in the assistant to load it.
74
+
75
+ ### Input modes
76
+
77
+ The input sets the preferences. Use one input mode at a time. A second mode fails with `CONFLICTING_OPTIONS`.
78
+
79
+ | Mode | Options | Preferences | Recorded source | Replaces an earlier APK setup |
80
+ |---|---|---|---|---|
81
+ | Default | none | The saved `policy.json` in the state directory, or the Standard preset if there is none | `saved` or `release` | No |
82
+ | [Explicit tool arguments](#explicit-tool-arguments) | `--roles`, `--max-concurrent` and one or more tool options | The values in the command | `custom` | Yes |
83
+ | [Release presets](#release-presets---release-and---preset) | `--release`, `--preset NAME`, or both | A preset of this release | `release`, with the preset name | Yes |
84
+ | [Encoded preferences](#encoded-preferences---config) | `--config BASE64URL` | The decoded JSON | `custom` | Yes |
85
+ | [Preferences file](#preferences-file---policy) | `--policy FILE` | The file | `custom` | No |
86
+
87
+ *Replaces an earlier APK setup* means that APK can change an existing APK configuration to the new values in one step. Modes that do not replace stop with `INSTALLATION_CONFLICT` or `POLICY_CONFLICT` if the request differs from the saved setup. The [ownership reference](../reference/ownership.md) explains receipts and replacement.
88
+
89
+ ### Explicit tool arguments
90
+
91
+ The configurator generates this mode. You can also write it yourself.
92
+
93
+ ```sh
94
+ agent-policy setup \
95
+ --roles 'reviewer,explorer' \
96
+ --max-concurrent 3 \
97
+ --chatgpt 'reviewer=gpt-6.1-sol:high,explorer=gpt-6-luna:high' \
98
+ --avoid-chatgpt 'gpt-6-astra' \
99
+ --claude 'reviewer=claude-sonnet-5-5:high,explorer=claude-haiku-5-5:native' \
100
+ --claude-max-concurrent 2 \
101
+ --gemini 'reviewer=pro,explorer=flash' \
102
+ --grok 'reviewer=grok-4.7,explorer=grok-4.7'
103
+ ```
104
+
105
+ | Option | Value | Rules |
106
+ |---|---|---|
107
+ | `--roles` | Comma-separated role IDs: `worker`, `reviewer`, `explorer`, `tester`, `writer`, `routine` | Required. No duplicates. |
108
+ | `--max-concurrent` | A whole number from 1 to 32 | Required. The shared parallel limit. |
109
+ | `--chatgpt`, `--claude`, `--kimi` | `ROLE=MODEL:EFFORT,...` | One entry for each role in `--roles`, exactly once. |
110
+ | `--gemini` | `ROLE=TIER,...` | `TIER` is `pro`, `flash`, `flash_lite` or `inherit`. No effort. |
111
+ | `--grok` | `ROLE=MODEL,...` | No effort. A model that ends with `:` and an effort word is refused. |
112
+ | `--TOOL-max-concurrent` | A whole number from 1 to 32 | Optional. Replaces `--max-concurrent` for one assistant. Needs the `--TOOL` option. |
113
+ | `--avoid-TOOL` | Comma-separated model IDs | Optional. At most 32 models. Routing guidance only. Needs the `--TOOL` option. |
114
+
115
+ `TOOL` is `chatgpt`, `claude`, `kimi`, `gemini` or `grok`. At least one tool option is necessary. Each tool option selects that assistant. Assistants without a tool option are not configured.
116
+
117
+ Rules for the values:
118
+
119
+ - `EFFORT` is `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` or `native`. `native` sets no explicit effort, so the assistant uses its native default.
120
+ - APK splits `MODEL:EFFORT` at the last colon. A model ID can contain colons.
121
+ - A model ID must follow the rule in [Preferences](preferences.md#choices).
122
+ - The effort must be a level that the assistant supports. For a model in the catalog, it must be a level of that model. The [model catalog reference](../reference/model-catalog.md) lists the levels.
123
+ - A model in `--avoid-TOOL` cannot also be selected for a role.
124
+ - For Kimi, effort applies to a model alias, not to a role. [Roles](../reference/roles.md#how-effort-applies) gives the rules. The alias `primary` is not accepted.
125
+ - Each explicit option can appear only once. A duplicate fails with `DUPLICATE_OPTION`.
126
+ - This mode works only with `setup` and `install`. It cannot be used with `--client`.
127
+
128
+ Keep the shell quotes. A value that is not valid fails with `INVALID_EXPLICIT_CONFIG` before APK reads any assistant file.
129
+
130
+ ### Release presets (`--release` and `--preset`)
131
+
132
+ This mode applies a named preset of the package release that you run.
133
+
134
+ ```sh
135
+ agent-policy setup --release
136
+ agent-policy setup --release --preset quality --apply
137
+ ```
138
+
139
+ | Option | Value | Meaning |
140
+ |---|---|---|
141
+ | `--release` | none | Use a preset of this release. Without `--preset`, the preset is `balanced`. |
142
+ | `--preset` | `fast`, `balanced` or `quality` | Select the preset: Light, Standard or Top-tier. `--preset` alone also selects this mode. |
143
+
144
+ `--release` takes no version. The package version in the `npx` command selects the release. This mode is the supported way to upgrade or downgrade to the defaults of one release. See [Updates and removal](updates-and-removal.md). Some release changes cross a migration boundary and need a removal first, for example Claude from 0.4.0 to 0.3.0. See [Migration boundaries](updates-and-removal.md#migration-boundaries). An unknown preset fails with `UNKNOWN_PRESET`. The [presets reference](../reference/presets.md) lists the values.
145
+
146
+ ### Encoded preferences (`--config`)
147
+
148
+ This mode applies a preferences JSON that is encoded as base64url.
149
+
150
+ ```sh
151
+ agent-policy setup --config eyJzY2hlbWFWZXJzaW9uIjoxLC...
152
+ ```
153
+
154
+ - The value is canonical base64url without padding.
155
+ - The decoded JSON is at most 64 KiB.
156
+ - The JSON must be valid [preferences](preferences.md). It contains data only.
157
+
158
+ APK writes the decoded JSON to a private temporary file and removes that file when the command ends. A value that is not valid fails with `INVALID_CONFIG`. To make a value from a file, see [Preferences](preferences.md#apply-a-preferences-file).
159
+
160
+ ### Preferences file (`--policy`)
161
+
162
+ This mode reads preferences from a file.
163
+
164
+ ```sh
165
+ agent-policy setup --policy ./preferences.json
166
+ ```
167
+
168
+ - The file must be a regular file, not a symbolic link, and at most 64 KiB.
169
+ - The JSON must be valid [preferences](preferences.md). Otherwise the command fails with `INVALID_POLICY`.
170
+
171
+ This mode is conservative. If APK already has a setup with other values, setup stops with `INSTALLATION_CONFLICT` or `POLICY_CONFLICT`. To replace a saved setup with the values of a file, use `--config`.
172
+
173
+ ### Setup results
174
+
175
+ Each assistant gets one result status:
176
+
177
+ | Status | Meaning |
178
+ |---|---|
179
+ | `planned` | Preview: APK would make the listed changes. A plan with no files means that the configuration is already current. |
180
+ | `configured` | APK wrote the changes. |
181
+ | `unchanged` | Only with `--apply`: the configuration was already current, and APK wrote nothing. |
182
+ | `not_selected` | The preferences do not include this assistant. |
183
+ | `not_found` | The assistant is not installed. |
184
+ | `invalid` | An executable was found, but its identity could not be verified. |
185
+ | `timeout` | Detection did not finish in time. |
186
+ | `prerequisite` | A condition outside APK must be fixed first. APK writes nothing for this assistant. |
187
+ | `error` | The operation failed for this assistant. |
188
+
189
+ The overall status is `planned`, `configured`, `partial` or `no_clients`. `no_clients` means that no selected assistant is installed. `partial` means that at least one assistant has `prerequisite`, `error`, `invalid` or `timeout`.
190
+
191
+ A plan lists files as `~/...` or `<state-dir>/...` with the action `create`, `update` or `remove`. Release fields show the target, previous and applied release, source and preset for each assistant.
192
+
193
+ If an assistant stops, it keeps its earlier APK configuration. The readable output then shows `Existing configuration retained`.
194
+
195
+ ## show
196
+
197
+ `show` reads the current user-level subagent settings of each assistant. It also reads settings that you made yourself.
198
+
199
+ ```sh
200
+ agent-policy show [--client ID] [--home PATH] [--state-dir PATH] [--json]
201
+ ```
202
+
203
+ - It needs no APK receipts and no assistant executables.
204
+ - It reads the native folders that the native-home environment variables select. With `--home`, it reads the standard folders under that folder.
205
+ - It shows the default subagent model and effort, the parallel limit, each role with its model and effort, and the Kimi model pool.
206
+ - For Kimi and Gemini, the parallel limit is guidance from the APK instructions. Kimi role models are routing guidance.
207
+ - For Claude, it also shows environment overrides of the subagent model, effort and parallel limit.
208
+ - It shows APK files that have local edits with their current values, and marks them.
209
+
210
+ `show` does not read project settings, managed settings, plugins, session flags or external role files. These can override the values that it shows. It never prints prompts, credentials, raw configuration or private paths. It writes nothing and calls no model.
211
+
212
+ If `show` cannot read an assistant completely, that assistant has the status `attention` and the command exits with code 3. The readable output shows `incomplete read`. Causes include unsupported role syntax, unsafe files, files that change during the read and APK files with local edits.
213
+
214
+ `show` does not accept `--apply`, `--policy`, `--preset`, `--release`, `--config` or explicit tool arguments.
215
+
216
+ ## doctor
217
+
218
+ `doctor` verifies the configuration that APK owns, for each assistant.
219
+
220
+ ```sh
221
+ agent-policy doctor [--client ID] [--home PATH] [--state-dir PATH] [--json]
222
+ ```
223
+
224
+ For each assistant, it reports:
225
+
226
+ - The detection result.
227
+ - The configuration status: `verified` with the applied release, source and preset, `not_configured`, or `attention` with a reason code.
228
+ - What the native settings control: native role settings, native tiers (Gemini) or a native pool with routing guidance (Kimi). It also reports whether the parallel limit is a native setting or guidance only.
229
+
230
+ `doctor` reads the receipts. It does not need the current presets or saved preferences. It does not run a model, so `modelExecution` is always `not_checked`.
231
+
232
+ `doctor` exits with code 0 also when an assistant has `attention`. Read the status of each assistant.
233
+
234
+ ## detect
235
+
236
+ `detect` finds installed assistants.
237
+
238
+ ```sh
239
+ agent-policy detect [--client ID] [--json]
240
+ ```
241
+
242
+ APK looks for each executable on `PATH` and in the usual install folders. On macOS, it also checks the CLI copies in ChatGPT Desktop and Claude Desktop. It starts each candidate once with `--version`, and for Kimi and Antigravity sometimes with `--help`. A folder alone does not count as an installed assistant.
243
+
244
+ Each result has a status: `detected` with the version, `not_found`, `invalid` or `timeout`. The `origin` field is `path`, `known_location` or `desktop_app`. The [assistants reference](../reference/assistants.md) lists the executables and locations.
245
+
246
+ ## release
247
+
248
+ `release` shows the configuration release of the package that you run.
249
+
250
+ ```sh
251
+ agent-policy release [--preset NAME] [--json]
252
+ ```
253
+
254
+ The JSON output contains the version, the selected preset, all presets with their labels, the catalog review date, a hash of the preset preferences and the full release notes. The readable output shows the version and the preset. `--release` and `--config` are not accepted here.
255
+
256
+ ## uninstall
257
+
258
+ `uninstall` plans the removal of the configuration that APK owns. With `--apply`, it removes it.
259
+
260
+ ```sh
261
+ agent-policy uninstall [--client ID] [--home PATH] [--state-dir PATH] [--apply] [--json]
262
+ ```
263
+
264
+ - Without `--client`, it uses every assistant that has a receipt in the state directory.
265
+ - It needs no assistant executable and no preferences.
266
+ - It restores your original values and keeps unrelated later edits.
267
+ - If you edited a file or block that APK owns, it stops for that assistant with `OWNED_DRIFT`.
268
+
269
+ The overall status is `completed`, `partial` or `not_installed`. If one assistant fails, the command exits with code 3. For the full procedure, see [Updates and removal](updates-and-removal.md#remove-apk).
270
+
271
+ ## init
272
+
273
+ `init` creates an editable preferences file with the Standard preset.
274
+
275
+ ```sh
276
+ agent-policy init --policy ./preferences.json
277
+ ```
278
+
279
+ - `--policy` is required. Otherwise the command fails with `POLICY_PATH_REQUIRED`.
280
+ - `init` never replaces a file. If the file exists, the command fails with `EEXIST`.
281
+ - It creates missing folders and makes the file readable only by you.
282
+
283
+ To edit and apply the file, see [Preferences](preferences.md).
284
+
285
+ ## instructions
286
+
287
+ `instructions` prints the AI operator guide ([AGENT_INSTALL.md](../../AGENT_INSTALL.md)) as plain text. An AI agent that installs APK for you follows this guide.
288
+
289
+ ## Output
290
+
291
+ APK prints readable text or JSON:
292
+
293
+ - In an interactive terminal, the output is readable text.
294
+ - When the output goes to a pipe or a file, it is JSON.
295
+ - `--json` always selects JSON.
296
+
297
+ Readable output starts with `Agent Policy Kit · VERSION`. A setup preview shows `Preview · no files changed`. Other headings are `Configuration applied`, `Already up to date`, `Setup incomplete` and `No supported selected tools found`. Readable output names problems with a short reason and the code, for example `Local edits prevent an update (OWNED_DRIFT)`.
298
+
299
+ Setup JSON contains `requiredActions`: one entry for each problem, with the assistant and the code. A command error prints only `{"error": "CODE"}`.
300
+
301
+ No output contains configuration bodies, raw executable output, raw errors or private paths. See [Privacy](privacy.md).
302
+
303
+ ## Exit codes
304
+
305
+ | Code | Meaning |
306
+ |---|---|
307
+ | 0 | The command completed. For `setup`, all selected and installed assistants are planned, configured or unchanged. |
308
+ | 1 | The command failed before it could produce a result, for example because of an unknown option or input that is not valid. The output contains only an error code. |
309
+ | 3 | The result is incomplete. `setup`: no selected assistant is installed, or at least one assistant has `prerequisite`, `error`, `invalid` or `timeout`. `uninstall`: at least one assistant failed. `show`: at least one assistant has `attention`. |
310
+
311
+ `doctor`, `detect`, `release`, `init` and `instructions` exit with code 0 when they produce a result.
312
+
313
+ ## Error codes
314
+
315
+ ### Command errors
316
+
317
+ These codes come with exit code 1:
318
+
319
+ | Code | Cause |
320
+ |---|---|
321
+ | `UNKNOWN_COMMAND` | The command name is not known. |
322
+ | `UNEXPECTED_ARGUMENT` | More than one positional argument. |
323
+ | `ERR_PARSE_ARGS_UNKNOWN_OPTION` and other `ERR_PARSE_ARGS_*` codes | An option is not known or has a wrong value type. |
324
+ | `CONFLICTING_OPTIONS` | Two input modes, or an option that the command does not accept. |
325
+ | `DUPLICATE_OPTION` | An explicit tool option appears twice. |
326
+ | `UNSUPPORTED_CLIENT` | `--client` is not a supported assistant ID. |
327
+ | `STATE_PATH_MUST_BE_ABSOLUTE` | The state directory path is relative. |
328
+ | `UNKNOWN_PRESET` | `--preset` is not `fast`, `balanced` or `quality`. |
329
+ | `INVALID_EXPLICIT_CONFIG` | Explicit tool arguments are not valid. |
330
+ | `INVALID_CONFIG` | The `--config` value is not valid. |
331
+ | `INVALID_POLICY` | The preferences file is not valid. |
332
+ | `POLICY_PATH_REQUIRED` | `init` has no `--policy`. |
333
+ | `EEXIST` | The `init` target file already exists. |
334
+ | `ENOENT` | The `--policy` file of `setup` does not exist. |
335
+ | `OPERATION_FAILED` | Another failure. |
336
+
337
+ ### Assistant results
338
+
339
+ These codes appear in the result of one assistant. `setup` and `uninstall` then exit with code 3. `doctor` reports an error code as the reason of the status `attention` and exits with code 0.
340
+
341
+ | Code | Meaning |
342
+ |---|---|
343
+ | `OWNED_DRIFT` | You edited a file or block that APK owns. APK keeps your edit. |
344
+ | `INSTALLATION_CONFLICT` | The installed APK preferences differ from this request. |
345
+ | `POLICY_CONFLICT` | The saved preferences differ from this request. |
346
+ | `OWNERSHIP_CONFLICT` | A file that APK wants to create already exists, or the instructions file already has an APK block that APK does not own. |
347
+ | `INVALID_RECEIPT` | The receipt has an unknown format or content, for example a receipt that a newer APK version wrote. See [Migration boundaries](updates-and-removal.md#migration-boundaries). |
348
+ | `LEGACY_RUNTIME_RECEIPT` | The receipt comes from an experimental runtime version: format v1, hooks or a package path. Remove it with the version that created it. |
349
+ | `RECOVERY_REQUIRED` | An interrupted transaction needs recovery. |
350
+ | `INSTALL_LOCKED` | Another APK operation holds the lock. |
351
+ | `STALE_PLAN` | A file that the plan read changed before or during the apply. Make a new plan. |
352
+ | `INSTALL_FAILED` | A write failed. APK restored the earlier configuration of the assistant. |
353
+ | `ROLLBACK_CONFLICT` | APK could not restore a file after a failure. It keeps the lock and the journal for recovery. |
354
+ | `UNSAFE_PATH` | A path contains a symbolic link, is outside its expected folder, or has a part with an unexpected file type. |
355
+ | `UNSAFE_FILE` | A file that APK reads is not a regular file, or it is larger than 1 MiB. |
356
+ | `UNSUPPORTED_CONFIG` | A native configuration file has a structure or a value type that APK cannot change safely. |
357
+ | `INVALID_JSON`, `INVALID_TOML` | A native configuration file is not valid JSON or TOML. |
358
+ | `UNSUPPORTED_TOML_STRUCTURE`, `UNSUPPORTED_TOML_VALUE` | A TOML file uses a form that APK does not edit. |
359
+ | `CHATGPT_CAP_ALIAS_CONFLICT` | The ChatGPT `config.toml` has the older `[agents] max_threads` setting. See the [assistants reference](../reference/assistants.md#chatgpt-codex). |
360
+ | `PLATFORM_UNSUPPORTED` | APK cannot write on Windows. |
361
+ | `EACCES`, `EPERM`, `ENOENT`, `ENOSPC`, `EIO`, `EROFS` | A file operation failed in the operating system. |
362
+ | `SETUP_FAILED` | Another `setup` failure. `uninstall` reports another failure as `OPERATION_FAILED`. |
363
+ | `native-home-override-unsupported` | The assistant uses a native folder that is not standard. `doctor` reports it as `NATIVE_HOME_OVERRIDE_UNSUPPORTED`. |
364
+ | `client-not-selected` | `--client` names an assistant that the preferences do not include. |
365
+ | `claude-force-model-conflict` | Claude Code forces one subagent model. |
366
+ | `kimi-provisioned-models-required` and other `kimi-*` codes | Kimi needs model aliases or effort support that are not configured. |
367
+
368
+ For recovery codes, see [Updates and removal](updates-and-removal.md#recover-from-an-interrupted-change). For the assistant-specific prerequisites, see the [assistants reference](../reference/assistants.md).
369
+
370
+ ## Related documents
371
+
372
+ - [Getting started](getting-started.md): the first setup.
373
+ - [Configurator](configurator.md): the page that generates the setup command.
374
+ - [Preferences](preferences.md): the preferences JSON format.
375
+ - [Updates and removal](updates-and-removal.md): change the release, uninstall and recover.
@@ -0,0 +1,163 @@
1
+ # Configurator
2
+
3
+ This document describes the configurator page: its four steps, the work modes, the top models switch, the per-assistant limits and the share links. It is for people who use the page to make a setup command. For a first setup from start to end, see [Getting started](getting-started.md).
4
+
5
+ ## Open the page
6
+
7
+ Use one of these pages:
8
+
9
+ - The hosted page for the current release: <https://agent-policy-kit.trymenow.io/>.
10
+ - The hosted page for one release, for example <https://agent-policy-kit.trymenow.io/v/0.4.0/>.
11
+ - The local file `site/index.html` from the APK package or repository.
12
+
13
+ Use a current version of Google Chrome. The page is one self-contained HTML file. It has no backend and makes no requests while you use it. It never runs the command and never grants model access.
14
+
15
+ Each page belongs to one configuration release. A *configuration release* is one APK package version with its presets, model catalog and role templates. The status line under step 4 shows the release, for example `Configuration release 0.4.0`. While the release notes mark the release as unreleased, the line shows a release-candidate notice instead. The [website document](../maintainers/website.md#release-status-on-the-page) tells when each line is shown.
16
+
17
+ ## Step 1: Subagent roles
18
+
19
+ All six roles are selected when the page opens.
20
+
21
+ - Click **×** on a role to remove it.
22
+ - Click a role below the field to add it again. Click **Add all** to add all missing roles.
23
+ - Click **?** on a role to read its description and the base prompt that APK saves.
24
+
25
+ A green check on the step means that at least one role is selected. The [roles reference](../reference/roles.md) describes each role.
26
+
27
+ ## Step 2: AI assistants
28
+
29
+ 1. Click an assistant below the field to add it. **Add all** adds every assistant.
30
+ 2. Click **×** on an assistant to remove it.
31
+
32
+ Assistants keep the order in which you add them. The command uses the same order.
33
+
34
+ - With one assistant, you edit that assistant.
35
+ - With two or more assistants, an **All** button appears and is active. **All** edits all selected assistants together.
36
+ - Click one assistant to edit only that assistant. Its current mode shows under its name.
37
+
38
+ When you select Gemini, the page shows a note: APK configures Antigravity, not Gemini CLI. The page does not check which assistants are installed. The CLI checks this when you run the command.
39
+
40
+ ## Step 3: Work mode
41
+
42
+ A *work mode* sets the models, effort levels and parallel limit for an assistant. No mode is selected when the page opens. Each selected assistant needs a mode before the command is available.
43
+
44
+ | Mode | Use |
45
+ |---|---|
46
+ | Light | Light models for every role. Limits last longest. |
47
+ | Standard | Stronger models for code, review, tests and docs. Fits most plans. |
48
+ | Top-tier | High-end models for most roles. Uses limits fastest. |
49
+ | Custom | Your own models and effort. |
50
+
51
+ The values of Light, Standard and Top-tier are in the [presets reference](../reference/presets.md).
52
+
53
+ ### Choose a mode for all assistants
54
+
55
+ 1. Make sure that **All** is active.
56
+ 2. Select a mode.
57
+
58
+ If the change replaces edited values, different modes or unfinished choices, the page asks you to confirm. Click **Cancel** to keep your choices. The **All** view does not show the model table. To change models, click one assistant.
59
+
60
+ ### Choose a mode for one assistant
61
+
62
+ 1. Click the assistant in step 2.
63
+ 2. Select a mode.
64
+
65
+ The first mode choice needs no confirmation. Later, the page asks you to confirm if other assistants are selected or if you edited this assistant. Other assistants keep their choices.
66
+
67
+ For some assistants, every mode uses the same models. The page then says that the modes change only how many subagents run at once.
68
+
69
+ ### Change models and effort
70
+
71
+ The **Models & effort** table shows one row for each selected role. It is visible only when you edit one assistant.
72
+
73
+ 1. Select a model in the **Model** list.
74
+ 2. To use a model that is not in the list, select **Custom model…** and type the native model ID. Gemini has no custom models. It accepts only its native tiers.
75
+ 3. Click an effort button. Only the levels that the model supports are shown. A dash (—) means that the model has no native effort setting.
76
+
77
+ Any change to a model or effort sets the assistant to **Custom**. Selecting **Custom** without a change does not change any value. A model ID can have 1 to 128 ASCII characters and no spaces.
78
+
79
+ For Kimi, roles that use the same model alias share one effort. A change to one of these roles changes all of them. For Grok, the page has no effort buttons. Grok subagents use the main session effort. The [assistants reference](../reference/assistants.md) explains these limits.
80
+
81
+ ### Use the top models switch
82
+
83
+ The top models switch is shown in Top-tier mode for assistants that have a top model. Its label names each model and effort. When you edit one assistant, the label is `Use <model · effort> for code, review and tests`. In the **All** view, it is `Use top models (…) for code, review and tests` and lists the top model of each assistant.
84
+
85
+ - Turn the switch on to use the top model for the Coder, Reviewer and Test writer roles.
86
+ - Turn the switch off to go back to the Top-tier values.
87
+
88
+ The switch changes only code roles that have no role-specific Top-tier value. The top model for each assistant is listed in the [presets reference](../reference/presets.md).
89
+
90
+ ### Set the parallel limit
91
+
92
+ The **Parallel subagents** field sets the maximum number of subagents that run at once in one session. It is visible only when you edit one assistant.
93
+
94
+ 1. Click one assistant in step 2.
95
+ 2. Type a whole number from 1 to 32, or use **−** and **+**.
96
+
97
+ Each assistant keeps its own limit. A change sets only that assistant to **Custom**. Selecting a mode restores the limit of that mode. For Kimi and Gemini, the label is **Max per session (advisory)**: these assistants get the limit as guidance, not as a native cap.
98
+
99
+ ## Step 4: Copy setup command
100
+
101
+ When all steps are complete, the page shows the command and a summary, for example `3 subagent roles · 2 AI assistants`.
102
+
103
+ 1. Click **Copy command**.
104
+ 2. Paste the command into a terminal or a text editor.
105
+
106
+ If the clipboard is not available, the page selects the command. Copy it with your keyboard. The green check on step 4 means that you copied the current command. It does not mean that APK is installed. A change to the form removes the check.
107
+
108
+ If a step is missing, the page names it with a link. If a value is not valid, the page shows `Check your settings.` and the first problem. It then shows no command.
109
+
110
+ ### What the command contains
111
+
112
+ The command always lists every selected assistant and role with its model and effort. A preset fills the form, but the command does not refer to the preset by name. For this reason, APK records the source of the setup as custom.
113
+
114
+ A generated command has this form:
115
+
116
+ ```sh
117
+ npx --yes --ignore-scripts --package agent-policy-kit@0.4.0 agent-policy setup \
118
+ --roles 'reviewer,explorer' \
119
+ --max-concurrent 3 \
120
+ --chatgpt 'reviewer=gpt-6.1-sol:high,explorer=gpt-6-luna:high' \
121
+ --claude 'reviewer=claude-sonnet-5-5:high,explorer=claude-haiku-5-5:medium' \
122
+ --apply
123
+ ```
124
+
125
+ - The package version is the release of the page.
126
+ - `--roles` lists the selected role IDs.
127
+ - `--max-concurrent` is the shared limit. If the limits of the assistants differ, the assistants with a different limit also get `--TOOL-max-concurrent`.
128
+ - Each assistant gets one argument with `role=model:effort` entries. Gemini and Grok entries have no effort.
129
+ - `--avoid-TOOL` appears only when the list of models to avoid is not empty. A model that you select is removed from that list.
130
+ - `--apply` is always the last line.
131
+
132
+ The [Commands](commands.md#explicit-tool-arguments) reference describes this syntax. To preview without writes, delete the `--apply` line and the ` \` at the end of the line before it.
133
+
134
+ ## Reset the form
135
+
136
+ Click **Reset form** under step 4. The page selects all six roles again and clears the assistants, the modes and the copy status. The address then holds only the six roles, as on a page that you open for the first time. Reset does not change files on your computer.
137
+
138
+ ## Check current settings
139
+
140
+ At the bottom of the page, **Check current settings** has a **Copy** button. It copies a read-only `show` command for the release of the page. Run it in a terminal to see the roles, models, effort and parallel limits that your assistants use now. See [Commands](commands.md#show).
141
+
142
+ ## Share a setup
143
+
144
+ The page saves the form in the address. Each change replaces the part after `#setup=`.
145
+
146
+ 1. Complete the form, or a part of it.
147
+ 2. Copy the page address from the browser.
148
+ 3. Send the address to the other person.
149
+
150
+ The link contains the roles, the assistant order, the mode of each assistant, the model and effort choices, each limit and the assistant that you edit. It does not contain the copy status. The link stays in the browser. The page needs no database to open it.
151
+
152
+ When someone opens the link, the page restores the form, including unfinished choices. The command is still blocked until all values are valid.
153
+
154
+ - A link contains its release version. A link from another release opens only on the page of that release. The hosted page sends such a link to the page of its release, if that page is hosted. Otherwise, the page shows an error.
155
+ - If a link is not valid, the page shows an error. Click **Reset form** to start again.
156
+ - A link to a local file works only on the same computer.
157
+
158
+ ## Related documents
159
+
160
+ - [Getting started](getting-started.md): the first setup from start to end.
161
+ - [Commands](commands.md): run, preview and check the command.
162
+ - [Presets reference](../reference/presets.md): the values of each mode.
163
+ - [Privacy](privacy.md): what the page and the CLI read and send.