3.1.0-beta.3). Features may change before the next stable release.Switch to stable →CLI Reference
ak doctor
Run AgentKit health checks, interpret the nested JSON report, and opt into repair or exit-code gating safely.
Use ak doctor to check the AgentKit installation after setup or an update, or
when a runtime, kit, registry session, or local dependency behaves unexpectedly.
The command reports health without changing disk by default. Incomplete first-run
setup or a missing CLI session can warn as onboard_incomplete with suggested
ak onboard or ak login. When updates.channel and kit.channel both exist
and differ, channel_drift warns. Use ak config prefs set updates.channel stable
(or beta) to store the CLI channel. Set kit.channel separately if you need a
stored default for kits.
The read-only auto_update check, shown as Auto-update, reports the
background auto-update schedule, the last result, a stuck or overdue run, and
opted-in projects that can no longer be updated; it warns with a suggested
ak update command when one of those needs attention.
The read-only, offline semantic_decision check, shown as Semantic
decisions, reports whether semantic decisions are enabled, the provider,
model, permitted consumers, any project restriction, and whether the provider
credential resolves, without contacting the provider or printing credential
values. It skips when consent is not granted and warns when a credential or
model is missing. See
Running semantic decision experiments.
The CLI version check uses the signed release pointer for the channel selected by ak versions. The network check treats HTTP 404 as a failed endpoint check. When Doctor finds a shadowing ck shim, review its printed removal command and path before running it.
Usage
ak doctorThe command accepts no positional arguments.
Command flags
| Flag | Default | Description |
|---|---|---|
--adapter <name> | Empty | Filter checks to an adapter with a dedicated doctor suite: claude-code, codex, or cursor. |
--check <names> | Empty | Run named checks as a comma-separated list, such as binary_version,codex_binary_present. |
--exit-on-fail | false | Exit 1 when any completed check fails. |
--fix | false | Attempt available fixes for failing checks. |
--list | false | List registered check names and exit. |
--offline | false | Skip the binary_version and network checks. |
Shared flags such as --json, --no-interactive, --quiet, --verbose, and
--yes are described in CLI conventions.
Common examples
Read a human report
ak doctorThe report groups checks by subsystem and separates actionable warnings from
Notes. Its summary is Summary: N ✓ N ⚠ N ✗ N ◦; the Notes segment is omitted
when there are none.
Expand advisory Notes
ak doctor -V
ak doctor --check kit_integrityAdvisory warning bodies are collapsed by default as
N notes - rerun with -V for details (or 1 note ...). -V/--verbose and an
explicit --check expand them; --adapter alone does not. Commands from hidden
Notes are excluded from Quick Commands. Notes are not success or failure: they
cover advisory states such as a missing integrity manifest, while integrity
drift and active conflicts remain actionable.
Gate automation on health
Choose either the structured health field or an explicit exit-code gate:
ak doctor --json | jq '.data.healthy'
ak doctor --exit-on-failThe JSON health field is .data.healthy, not .healthy.
Discover and run focused checks
ak doctor --list
ak doctor --check disk_space
ak doctor --check binary_version,network
ak doctor --adapter codexAn unknown check name is a command error rather than an empty healthy result.
Run without network checks
ak doctor --offlineWithout --offline, the full suite includes network-dependent checks. Offline
mode skips those checks; it does not turn skipped results into successful
network verification.
Check runtime support tiers
ak doctor --check runtime_support_tierThe read-only runtime_support_tier check, shown as Runtime support tier,
compares each installed runtime with the support tier recorded for this
operating system. It reports OK when every installed runtime is certified here.
Otherwise it gives an advisory Note, not a failure, naming each assumed runtime
and why it is not certified. The Note does not change healthy,
--exit-on-fail, or the exit code. See
Support tiers
for what each tier means and how to report a problem with an assumed runtime.
Check Codex runtime limits
ak doctor --check codex_runtime_limitsThe read-only codex_runtime_limits check, shown as codex runtime limits,
names the Codex runtime limits that apply to what you installed. It looks at the
current directory, every registered project, and the user and project Codex
Hook registries, and gives an advisory Note for each limit it finds:
- Project rules are not active. A project install writes Kit rules to
<project>/.codex/AGENTS.md, which Codex does not read; Codex readsAGENTS.mdfrom the repository tree. The Note lists each such file. Install the Kit with--globalso the rules land in~/.codex/AGENTS.md, which Codex loads, or copy the rules you need into the repositoryAGENTS.mdyourself; AgentKit never edits that file. - The privacy guard does not cover MCP tool calls. Codex has no
Readtool, so theprivacy-blockHook runs for shell andapply_patchcalls only. Reads through MCP and local function tools are not guarded. The Note lists each Hook registry that registers the guard. See Sensitive-file approval.
The check skips when Codex is not detected or no installed target is affected.
The Note does not change healthy, --exit-on-fail, or the exit code. In a
full ak doctor run it is collapsed with the other Notes; add -V to see it.
Apply fixes safely
ak doctor --fix can run suggested repair commands that modify AgentKit or
runtime files. On an interactive terminal, it asks before each available fix.
For an intentional unattended repair, include --yes explicitly:
ak doctor --fix --yes --jsonDo not treat --fix --json or --fix --no-interactive as prompt-free unless
you also pass --yes. Without --yes, the current fix path can still read
process stdin. End-of-file skips a fix, while piped confirmation can apply it.
Review suggested commands before approving them. A fix is rechecked after it runs, and a failed repair remains visible in the final report.
Automation output
Successful JSON output uses a versioned envelope on stdout:
schema_version: 1
kind: doctor.report
data.schema_version: 1
data.checks: array of check results; advisory rows include advisory: true
data.summary: total, ok, warn, fail, and skip counts
data.healthy: booleanEach check can report a name, status, evidence, a suggested fix command, and
additional details. advisory: true is present only on advisory rows; false is
omitted. Advisory rows retain status: "warn", and summary.warn includes both
actionable warnings and Notes. There is no summary.notes field. Gate on the
outer schema_version and kind before reading data.
JSON-mode failures, including flag-parse errors (exit 2), end stderr with the
shared error envelope.
Exit behavior
| Exit | Meaning | What to do |
|---|---|---|
0 | The selected checks completed, whether healthy or unhealthy. | Read .data.healthy in JSON or the human summary. |
1 | The command failed, a check name was unknown, or --exit-on-fail found an unhealthy result. | Correct the check name, inspect the error, or act on the failing checks. |
2 | Flags or arguments were invalid. | Correct the invocation before retrying. |
The default unhealthy result is therefore not a process failure. Notes do not
change healthy, --exit-on-fail, --fix, or exit classification. Use
--exit-on-fail only when process status should represent health.
Verify and recover
After a repair, rerun the affected check without --fix:
ak doctor --check <check-name>If a suggested repair changes kit or runtime files, keep any recovery snapshot
reported by that underlying command and verify the target runtime before
removing recovery data. Do not repeat repairs with --force as a first step.