AgentKit
DocsKitsCLI ReferenceDesktop App
BetaYou are reading docs for the beta channel (3.0.0-beta.41). Features may change before the next stable release.Switch to stable →

ak agents model

ak agents model apply

Write the model config resolves to into pending installed Agent files, replacing runtime-side edits only with confirmation.

Use ak agents model apply to bring installed Agent files in line with config without waiting for the next kit refresh.

Usage

ak agents model apply [agent] [--runtime <runtime>] [--project <dir>] [--yes]

At most one Agent name is accepted; omit it to apply every Agent. The command has no --scope, because it only reads config.

FlagDefaultDescription
--runtime <runtime>all runtimesLimit to one of claude-code, codex, cursor, omp, pi.
--project <dir>nearest project config, else the current directoryProject whose installs and config apply.
--yesoffConfirm replacing drifted files without asking.

What it writes

The command rewrites the model fields of every pending file (config changed since AgentKit wrote it). A drift file (edited in the runtime) is replaced only with confirmation, and its previous content is backed up first under the AgentKit agent-models backups. Files already in-sync are untouched.

Before writing, it proves AgentKit owns every target file. If any file fails the proof, nothing is written and the command exits 1.

Confirmation

If drifted files are present and --yes is absent:

  • On an interactive terminal, the command lists each file as path: current -> desired and asks [y/N]. --no-interactive disables the prompt. The lock is released while it waits, and the confirmed run applies only the files that were shown. If the drifted set changed meanwhile, nothing is written and the command exits 3.
  • Otherwise nothing is written and the command exits 3. With --json, the result is printed on stdout under need_confirmation beside the error envelope.

Declining the prompt exits 3 with cancelled; nothing was written. To keep a runtime edit instead of replacing it, run adopt.

Side effects

Takes the kit lifecycle lock. Claude Code plugin files take effect after ak kit refresh re-activates the plugin; a warning says so. If a write fails part way, the error names the files already updated and the backups taken.

Output

Human stdout prints updated <path> and backup <path> lines, or Every installed agent file already carries its configured model. when nothing changed.

JSON success uses:

schema_version: 1
kind: agents.model.apply
data.applied[]
data.backup_paths?
data.need_confirmation?   (drifted files awaiting confirmation)
data.agents[], data.warnings?

Exit behavior

ExitMeaning
0Files were updated or none needed changes.
1Command failure, including an installed file AgentKit cannot prove it still owns.
2Invalid Agent name or flags, an unsupported runtime, or a missing --project directory.
3Drifted files need confirmation and none was given, or the answer was no.
4Another AgentKit operation holds the kit lifecycle lock.