Hook files
Self-serve setup writes the user’s Codex configuration. MDM packages write the system Codex configuration.~ is the home folder of the person running setup.
Kontext writes hooks to
hooks.json and sets [features].hooks = true in config.toml.
Claude Code uses one system-wide drop-in for both deployment types:
.kontext-setup-backup-<timestamp>. If another file exists at Kontext’s Claude Code drop-in path, Kontext preserves it and reports an error.
Install or remove hooks
Use--scope user or --scope system to select the Codex paths in the table. Claude Code uses its system path for both scopes.
--binary to the Kontext executable’s absolute path. System scope requires root. For user scope, Kontext may request administrator access to write the Claude Code drop-in. The user-scope command uses an absolute CODEX_HOME override for Codex files. kontext setup always uses ~/.codex.
Add --dry-run to print the planned changes without writing files. You can run a system-scope dry run without root:
kontext hooks remove. It defaults to user scope and also accepts --dry-run:
What doctor reports
kontext doctor passes the hook check for an agent absent from the endpoint. For an agent on the endpoint, doctor requires valid hooks and an executable Kontext binary. Codex also requires its hooks feature enabled.
On a healthy MDM-managed endpoint, the hook lines look like this:
<Agent> hooks: <error> (<path>) and marks the check unhealthy. For a missing or disabled Codex hooks feature, doctor prints Codex hooks feature: <error>. Doctor also marks system hooks unhealthy if the user’s Codex configuration disables hooks.
The endpoint drawer on Home shows each agent’s hook state as Installed, Missing, or Not detected. To repair hooks on a self-serve endpoint, rerun kontext setup. For an MDM-managed endpoint, redeploy the package.
Doctor checks configuration. It cannot check whether Codex trusts the hooks or whether a hook ran. To confirm Kontext receives events, run one tool call and find it in Explore.