Supported Agents
Hook locations, per-agent notes, and platform quirks for all six supported agents.
vakatime setup <agent> writes hooks into each agent's native configuration. Setup is idempotent — running it again refreshes the hook command (useful after moving the CLI) without creating duplicates.
| Agent | Hook location | Events used |
|---|---|---|
| Claude Code | ~/.claude/settings.json | SessionStart, UserPromptSubmit, Stop, SessionEnd |
| Codex | ~/.codex/config.toml (inline) | SessionStart, UserPromptSubmit, Stop |
| Cursor | ~/.cursor/hooks.json | sessionStart, beforeSubmitPrompt, stop, sessionEnd |
| OpenCode | ~/.config/opencode/plugins/vakatime.js | plugin events |
| Gemini CLI | ~/.gemini/settings.json | SessionStart, UserPromptSubmit, Stop |
| ZCode | ~/.zcode/cli/config.json | SessionStart, UserPromptSubmit, Stop |
Claude Code
Standard hook wiring in ~/.claude/settings.json under hooks.*. Your existing hooks are never touched — Vakatime appends its own entries only.
Codex
Vakatime writes an inline managed block into ~/.codex/config.toml and enables [features] hooks = true.
Codex shows a trust review for hooks (“Hook runs outside the sandbox”). This is expected — approve Vakatime's hooks in /hooks, otherwise Codex will not execute them.
On Windows, Codex invokes hook commands through sh/bash (MSYS), which mangles unquoted Windows paths. Vakatime wraps its own command in cmd /c '…' to survive the translation — no action needed from you.
Cursor
Hooks live in ~/.cursor/hooks.json. Events: sessionStart, beforeSubmitPrompt, stop, sessionEnd.
OpenCode
A managed plugin file is written to ~/.config/opencode/plugins/vakatime.js. It reports session.created, message.updated (user + assistant-done), and session.deleted. Deleting the file uninstalls it; vakatime remove opencode does this for you.
Gemini CLI
Hooks in ~/.gemini/settings.json with a 10-second timeout.
ZCode
Vakatime registers a process hook (argument vector, no shell) in ~/.zcode/cli/config.json under hooks.events, and sets hooks.enabled = true. ZCode loads hook configuration at app startup, so restart ZCode after setup.
Only three events exist for ZCode (there is no SessionEnd): SessionStart, UserPromptSubmit, and Stop. When a new ZCode version is installed, run vakatime setup zcode again to refresh the node path.
Windows notes
- The collector resolves its own absolute node + script paths at setup time, so global npm updates under the same path keep working.
- If you move the CLI (different node version manager, reinstall), re-run
vakatime setup <agent>to refresh hook commands.
Removing hooks
vakatime remove <agent>
Removes only Vakatime's entries, backs up modified files as *.backup, and (for Codex) reverts the hooks = true feature flag only if Vakatime originally set it.