Set up and self-heal Olakai monitoring for the coding tool you are using — Claude Code, OpenAI Codex CLI, Cursor, Google Gemini CLI, or Antigravity CLI. Installs hooks, creates the agent record, and enriches events with KPIs. This is the skill for "monitor my coding tool itself". AUTO-INVOKE for any request to start, inspect, extend or fix hooks-based monitoring of a local coding assistant: monitor this tool or its sessions, confirm monitoring is working, see what is monitored on this machine, or (as an ADMIN) bulk-provision coding-agent monitoring across a team or fleet. TRIGGER KEYWORDS: olakai monitor, monitor my coding tool, local coding agent, olakai hooks, olakai monitor init, bulk-provision, fleet rollout, intune, jamf, mdm. DO NOT load for: instrumenting your own agent's SDK code (use olakai-integrate), building an agent from scratch (use olakai-new-project), or SDK / KPI / event troubleshooting unrelated to a coding tool (use olakai-troubleshoot).
Ships in olakai-ai-olakai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill sets up hooks-based monitoring for local coding agents and teaches you to self-diagnose and repair that monitoring. Every session in a monitored workspace reports activity to Olakai — no SDK code required.
| You want to… | Use |
|---|---|
| Monitor the coding tool itself (Claude Code / Codex / Cursor / Gemini CLI / Antigravity CLI sessions) | this skill |
| Check / fix your own monitoring ("is it working?", "no events") | this skill → Self-healing |
| Roll out monitoring to a whole team/fleet as an Olakai ADMIN | this skill → Admin bulk-provisioning |
Instrument your own agent's source code with the @olakai/sdk / olakai-sdk | olakai-integrate |
| Build a brand-new agent project from scratch | olakai-new-project |
| Debug SDK / KPI / event issues unrelated to a coding tool | olakai-troubleshoot |
Five tools are supported, all behind the same olakai monitor command, gated by a --tool flag:
| Tool | --tool value | Minimum version |
|---|---|---|
| Claude Code | claude-code | any current version |
| OpenAI Codex CLI | codex | 0.124.0 (stable hooks) |
| Cursor | cursor | 1.7 (hooks beta; validated against 3.x) |
| Gemini CLI | gemini-cli | 0.26.0 |
| Antigravity CLI | antigravity | recent agy w/ hooks (validated 1.0.4) |
CLI requirement: the
monitor list,monitor doctor,monitor repair, andagents mine/agents archive|rename|deletecommands documented here require olakai-cli ≥ 0.7.0. Older CLIs only haveinit/status/disable. The adminbulk-provisioncommand requires ≥ 0.13.0 (Claude Code only, per-repo bundles). The multi-tool fleet flow (--tool claude-code,codex,cursor,monitor install-hooks, home key file) needs the standalone CLI 1.0.0-beta.4 or later (beta); no npm stable release has it. Claude Code hooks move to.claude/settings.local.jsonat ≥ 0.14.0 (see Claude Code hooks live in.claude/settings.local.json). To upgrade, first runolakai --version. If it prints 0.x, ask the user, then runnpm install -g olakai-cli@latestafter they say yes. If it prints 1.x (standalone or npm@next), do not runnpm install -g olakai-cli@latest: it downgrades to 0.15.1. Runolakai updateinstead, after the user says yes. The standalone binary (beta, 1.0.0-beta.4) has every command and flag of the npm CLI, so it meets these minimums. It addsmonitor install-hooksandolakai update, and itsadmin monitor bulk-provisionwrites home-folder key files instead of the npm per-repo bundle. A compatibility suite of 142 recorded cases from the TypeScript CLI runs in CI against the beta binary, and all pass. For install options without Node.js, see/olakai-get-started.Since olakai-cli 0.13.0, every monitored event also reports the CLI version that produced it — no action needed, but it helps diagnose version drift across machines.
⚠️ Check your CLI version before migrating hooks. Check that
olakai --versionreports 0.14.0 or later before running any hook-migration command in this skill. On 0.13.0 and earlier,doctor --fixre-adds the hooks to.claude/settings.jsonand reports success, so a green result there does not mean the hooks are safe from agit pull. Do not treatnpm install -g olakai-cli@latestas proof you are on 0.14.0: runolakai --versionand read the number. If it is below 0.14.0, say so and stop, rather than reporting a migration that did not happen.
What you get:
All / Claude Code / Codex / Cursor / Gemini CLI / Antigravity CLI).What is NOT included yet:
There are two distinct questions, answered by two distinct commands. Keep them straight.
| Question | Lens | Command | Source of truth |
|---|---|---|---|
| "What is monitored on THIS machine, and where?" | Machine | olakai monitor list | Local registry at ~/.olakai/registry.json |
| "What coding agents exist across my whole account?" | Account | olakai agents mine | Olakai backend (cross-machine) |
Why two lenses? The backend has no scope model. Agents are account-scoped only — there are no per-repo / per-workspace / per-host fields. So "where am I monitoring?" is a purely machine-local fact that nobody persists server-side. The CLI records it in a local registry (~/.olakai/registry.json) that monitor list reads. monitor doctor is what bridges the two lenses — it flags drift between the registry, the backend, and what is actually on disk.
# Machine lens — every workspace monitored on this box, grouped by tool,
# with scope + linked agent + a drift flag where registry/backend/disk disagree.
olakai monitor list
olakai monitor list --json
# Account lens — your coding agents across the whole Olakai account.
olakai agents mine
olakai agents mine --source claude-code # filter to one tool
olakai agents mine --source codex --json
Where the hooks live differs by tool — this matters for what gets attributed.
| Tool | Hook scope | Where hooks are written | Agent linkage (per-workspace) |
|---|---|---|---|
| Claude Code | Workspace | .claude/settings.local.json (this workspace only, ≥ 0.14.0) | .olakai/monitor-claude-code.json |
| Codex CLI | Global | ~/.codex/config.toml (all workspaces) | .olakai/monitor-codex.json |
| Cursor | Global | ~/.cursor/hooks.json (all workspaces) | .olakai/monitor-cursor.json |
| Gemini CLI | Global | ~/.gemini/settings.json (all workspaces) | .olakai/monitor-gemini-cli.json |
| Antigravity | Global | ~/.gemini/config/hooks.json (all workspaces) | .olakai/monitor-antigravity.json |
For all five tools, the per-workspace .olakai/monitor-<tool>.json file holds the agent linkage (API key + agent ID + endpoint).
.claude/settings.local.json (olakai-cli ≥ 0.14.0)Up to 0.13.0 the hooks went into .claude/settings.json. Teams commonly track that file in git, so a git pull could rewrite it, delete the hook block, and stop monitoring with no error. Since 0.14.0 the hooks go into .claude/settings.local.json: the project-scoped personal settings file, which is conventionally gitignored.
What this means in practice:
.claude/settings.json. Confirm olakai --version reports 0.14.0 or later (see the version guard above), then run olakai monitor doctor --tool claude-code --fix (or olakai monitor repair --tool claude-code) to migrate them. olakai monitor init --tool claude-code migrates them too. On 0.13.0 the same --fix puts the hooks back into .claude/settings.json and reports success.init migrates rather than adds. Claude Code merges the hooks block across settings.json and settings.local.json: neither file suppresses the other. Identical handlers are then deduplicated, so the CLI's own block left in both files runs once. Two blocks both run, and events duplicate, only when they differ (an older command form beside the current one, for example). So the reason to migrate is not double-firing: it is that a block sitting in the tracked settings.json is one git pull away from deletion. init migrates the legacy block so nothing is left there to delete or to drift out of step.settings.json with no Olakai hooks is left byte-identical. init, status and disable do not rewrite it. Running the CLI never dirties your team's tracked settings file.init and doctor run git check-ignore on the hook file and warn when it is not ignored. They stay silent when the workspace is not a git repository or git is unavailable. Note that git check-ignore reports a tracked file as not-ignored even when a rule matches it, which is exactly the state you want to hear about: add the file to .gitignore and git rm --cached it.Only Claude Code changed. Codex, Cursor, Gemini CLI and Antigravity write to ~/ paths and are unaffected.
⚠️ Unattributed activity caveat (Codex / Cursor / Gemini CLI / Antigravity). Because Codex, Cursor, Gemini CLI, and Antigravity install hooks globally, their hook fires in every workspace — including ones you never ran
olakai monitor initin. When the hook fires in a workspace that has no.olakai/monitor-<tool>.json, it silently exits and that session is NOT attributed to any agent (no event is sent). This is expected: a global hook with no local linkage has nowhere to report. If you expect Codex/Cursor/Gemini CLI/Antigravity activity from a repo and see none, the most common cause is that you never ranolakai monitor init --tool <tool>in that repo. Runolakai monitor listto see exactly which workspaces are linked, andolakai monitor doctor --tool <tool>for an explanation in context.Claude Code does not have this caveat — its hooks are workspace-scoped, so they only fire where you installed them (except after
olakai monitor install-hooks, which installs them user-wide).Exception: home key file (1.0.0-beta.4+). When
~/.olakai/monitor-<tool>.jsonexists (a bulk-provisioned machine), a workspace with no.olakaiconfig reports with that home key instead of exiting. See How the hook finds its key.
If you are an installed coding agent and your monitoring seems broken (no events, missing KPIs, "is this even on?"), drive these commands in order. Always start with monitor list, then monitor doctor, then escalate to repair.
# 1. SEE — machine-wide picture: what's installed, where, and which entries are drifting.
olakai monitor list
# 2. DIAGNOSE — ordered health-check chain (registry → config → hooks → key → agent → events).
olakai monitor doctor --tool claude-code # or codex / cursor / gemini-cli / antigravity; --all for every workspace
# 3. FIX — idempotent, best-effort auto-repair of what doctor flagged.
olakai monitor doctor --tool claude-code --fix
# 4. ESCALATE — forceful re-init that preserves agent linkage (heals a clobbered config).
olakai monitor repair --tool claude-code
monitor doctor runs an ordered chain — each step gates the next, so the first failure is usually the real problem: registry-entry → config-valid → hooks-installed → api-key-valid → agent-exists → events-flowing. --fix is idempotent and best-effort (adopts the registry entry, re-merges missing hooks, re-links a rejected key). It will not recreate a missing agent unless you add --recreate-missing — a deliberate guard so a transient 404 can't spawn a duplicate. On a true 404, prefer olakai monitor repair --tool <tool>, which re-merges hooks, migrates legacy config, re-links the key only if invalid, and recreates the agent only on a genuine 404.
For the full self-healing playbook — every doctor check explained, the complete decision tree,
doctor --fixvsrepaircomparison, and common repair scenarios — use theolakai-monitor-doctorskill.
which olakai || echo "CLI_NOT_INSTALLED"
olakai whoami 2>/dev/null || echo "NOT_AUTHENTICATED"
| Result | Action |
|---|---|
CLI_NOT_INSTALLED | Ask the user, then run npm install -g olakai-cli@latest and olakai login after they say yes. No Node.js 20+? Offer the standalone binary (beta) from /olakai-get-started |
NOT_AUTHENTICATED | Run olakai login |
| Shows email/account | Ready to proceed |
Not set up at all? Use
/olakai-get-startedfirst.
You also need the local coding agent itself installed and operational in your workspace.
If you don't know which tool is in this workspace, run olakai monitor init with no flag — the CLI auto-detects the configured agent in interactive mode and prompts you to confirm. For scripted setup, always pass --tool explicitly.
Are you monitoring …
├── Anthropic Claude Code? → --tool claude-code
├── OpenAI Codex CLI? → --tool codex (requires Codex CLI ≥ 0.124.0)
├── Cursor IDE/CLI? → --tool cursor (requires Cursor ≥ 1.7, hooks in beta)
├── Google Gemini CLI? → --tool gemini-cli (requires Gemini CLI ≥ 0.26.0)
└── Google Antigravity CLI? → --tool antigravity (requires recent agy with hooks, validated 1.0.4)
You can install monitoring for multiple tools in the same workspace — each tool stores its config in its own settings file and creates its own agent record.
olakai monitor init is the right path for a single developer setting up their own machine interactively. If you are an Olakai ADMIN rolling out monitoring to a whole team, with no action from each developer, use bulk-provision instead. You push the key files with Intune, Jamf, Group Policy, or another device-management (MDM) tool.
Machine-wide hooks (
install-machine-hooks, the default fleet path) need CLI 1.0.1 or later and Codex 0.140.0 or later.Version requirement. The rest of the fleet flow below (Claude Code, Codex and Cursor, home layout,
install-hooks, home key-file lookup) needs the standalone CLI 1.0.0-beta.4 or later (beta) on the admin machine and on every developer machine. No stable npm release supports it: npmolakai-clistays at 0.15.1. npm also publishes the beta asolakai-cli@next. Install the beta only through/olakai-get-started, which asks the user to confirm the beta first. Always checkolakai --versionand read the number. An npmolakaimust not come first on thePATH.
olakai admin monitor bulk-provision \
--emails roster.txt \
--out ./bundles \
[--tool claude-code,codex,cursor] [--rotate-existing-keys] [--name-prefix "Prefix "] [--json] [--yes]
--emails accepts .txt or .csv: one email per line (or first CSV column), # comments allowed, a header row is auto-skipped, emails are deduped case-insensitively, max 500 per run.--tool takes a comma-separated list of claude-code, codex and cursor. The default is claude-code. Gemini CLI and Antigravity are not part of bulk provisioning.What it does, per email and per tool:
creatorUserId), named <tool>-<email-localpart> (or <prefix>-<localpart> with --name-prefix), so Coding IQ attribution is per developer.<out>/<developer>/.olakai/monitor-<tool>.json (agentId, apiKey, monitoringEndpoint, mode 0600). The bundle has no agent settings files. A pushed settings file would replace the developer's own Claude Code, Codex or Cursor settings. keymap.json / keymap.csv (0600) at the out root have one row per (email, tool), with a trailing tool column. Parse them by header name. With --json, the output also has summaryByTool with the counts per tool.Under the hood it calls the ADMIN-gated POST /api/config/agents/bulk-provision endpoint on your own instance (SaaS or on-prem), in chunks of 100 emails (server rate limit: 10 requests / 120s per admin).
Key semantics. Read before re-running:
reused with no key and no key file. This is deliberate, so re-runs are safe for already-deployed devices.--rotate-existing-keys revokes and remints keys for existing developers, for every selected tool. This invalidates the key files already deployed to their devices. Only use it when you intend to push the new files.<out>/unprocessed.txt. Re-run with that file as the roster and a fresh --out, without --rotate-existing-keys, or you rotate keys this run already wrote.Push to each device (MDM recipe):
PATH location, for example /usr/local/bin or C:\Program Files\Olakai. The hooks run olakai monitor hook ..., so the CLI must be on the machine PATH..olakai folder to C:\Users\<user>\.olakai\, /Users/<user>/.olakai/ or /home/<user>/.olakai/. Do not use ~ in a root script: it expands to root's home. On macOS and Linux, chown -R <user> the folder, chmod 700 the folder and chmod 600 the files. Windows needs no owner fix: the user profile ACL is enough.olakai monitor install-machine-hooks once per device, as SYSTEM, an elevated administrator or root. No developer action and no approval prompt. See What install-machine-hooks does. Cursor has no machine command: run olakai monitor install-hooks --tool cursor as the logged-on developer (Intune: "Run this script using the logged-on credentials" = Yes; macOS/Linux from a root script: sudo -H -u <user>).NO_PROXY as a machine environment variable. The tools see a new machine variable only after a restart or a new sign-in.Running sessions pick up the hooks after a restart. A ChatGPT Agent Security cloud policy for Codex ranks above local files, and the CLI cannot see it.
install-machine-hooks doesolakai monitor install-machine-hooks [--tool claude-code,codex] runs on the device as an administrator:
Stop and SubagentStop hooks to managed settings: C:\Program Files\ClaudeCode\managed-settings.json, /Library/Application Support/ClaudeCode/managed-settings.json or /etc/claude-code/managed-settings.json. It stops if HKLM\SOFTWARE\Policies\ClaudeCode sets a policy, because that outranks the file. Add the hooks there, then run --tool codex.Stop hook to %ProgramData%\OpenAI\Codex\hooks.json or /etc/codex/hooks.json. Codex treats it as managed, so no user sees "Hooks need review". It adds no second hook when requirements.toml holds one..codex/config.toml and .codex/hooks.json, and exits 2 when it finds any. An unapproved one keeps the prompt; an approved one sends each event twice. It does not rewrite user files: each listed user runs olakai monitor uninstall-hooks --tool codex.olakai monitor uninstall-machine-hooks removes the machine hooks and keeps key files.
Do not use install-hooks for a Codex fleet. Codex skips a user-level hook until that user approves it at the "Hooks need review" prompt or in /hooks, and sends nothing until then. olakai monitor doctor --tool codex warns when no approval is recorded.
install-hooks doesolakai monitor install-hooks [--tool claude-code,codex,cursor] is the user-level path. It runs on the device, as the developer. Each user must approve a Codex hook written this way. MDM scripts do not load the developer's shell profile, so set CLAUDE_CONFIG_DIR or CODEX_HOME in the script if you use them.
~/.olakai/monitor-<tool>.json. Use --tool to choose.~/.claude/settings.json (or $CLAUDE_CONFIG_DIR/settings.json), ~/.codex/config.toml (or $CODEX_HOME/config.toml) and ~/.cursor/hooks.json, and keeps every other setting.config.toml that already has a [hooks] table and contains comments. Merge that file by hand. It warns when [features] hooks = false turns hooks off, and never changes that setting.~/.olakai is owned by another user (for example a root script pointed at the developer's home), or when the home is a Windows SYSTEM profile. A developer who is root in a dev container, with a home root owns, is allowed. The owner check runs on macOS and Linux only; on Windows the CLI checks only for the SYSTEM profile, not file owners.The hook walks up from the workspace folder looking for .olakai/monitor-<tool>.json. When no workspace has one, it uses ~/.olakai/monitor-<tool>.json. A workspace config always wins, also for Cursor multi-root workspaces. olakai monitor status --tool <tool>, doctor and repair print Using home key file <path> on stderr when the home file is in use. Run it from a project folder, not the home folder. From the home folder, status reports the home config directly and prints no such line.
So on a bulk-provisioned machine the unattributed activity caveat does not apply: a global Codex or Cursor hook in a workspace with no .olakai config reports with the home key.
Root == home is user scope. When the monitored root is the home folder, the Claude Code hooks belong in ~/.claude/settings.json (Claude Code does not read settings.local.json at user level). On 1.0.0-beta.4+, init, doctor --fix, repair and disable keep them there and never move them to settings.local.json. doctor --fix is safe on these machines. On npm 0.x it is not: 0.x treats ~/.claude/settings.json as the legacy file and moves the hooks where Claude Code never reads them.
Deployment checks:
olakai monitor status --tool <tool>. It prints Using home key file ... on stderr when the hook will use the home key. Run it from a project folder, not the home folder. From the home folder, status reports the home config directly and prints no such line.curl to /api/monitoring/prompt: it can return 200 and still be dropped by the pipeline./olakai-monitor-doctor (see its bulk-provisioned machines checklist).Offboarding a developer: delete the agents (or their keys) in Olakai. On the machine, delete ~/.olakai/monitor-*.json (the hooks then send nothing). olakai monitor disable --tool <tool> run from the home folder removes that tool's hooks and deletes the home key file unless you pass --keep-config.
Prefer a UI? The same capability exists in the dashboard: Coding IQ → Coding IQ Settings → Bulk Provisioning. On instances that include the multi-tool bulk provisioning UI (localnode-app with OLA-1596), Claude Code, Codex CLI and Cursor are selected by default. Download the key-map CSV and the bundles ZIP. The ZIP uses the same home layout and has a README.txt with the device recipe. Older instances offer Claude Code only and produce the per-repo bundle.
This is legacy guidance for admins still on npm olakai-cli 0.13 to 0.15.1. Those releases support --tool claude-code only and write a per-repo bundle under <out>/<localpart>/: .claude/settings.local.json (hook block, ≥ 0.14.0; 0.13.0 wrote .claude/settings.json) plus .olakai/monitor-claude-code.json. You push both into the target repo layout. Pushed bundles appear in olakai monitor list / doctor only after any olakai monitor command runs once on the machine (registry reconcile). The hooks report fine regardless.
Already rolled out 0.13.0 bundles? Most push mechanisms overwrite, so a bundled
.claude/settings.jsoncan replace the team's tracked file. Confirm your admin machine is on 0.14.0 or later (olakai --version), re-run bulk-provision, and push the new bundles. Or have each developer confirm their ownolakai --versionis 0.14.0 or later and then runolakai monitor doctor --tool claude-code --fix. A developer still on 0.13.0 gets a green--fixthat leaves the hooks in.claude/settings.json. For a new rollout, prefer the 1.0.0-beta.4 home layout above.
olakai monitor init --tool claude-code
What it does:
AgentSource.CLAUDE_CODE on your Olakai accountStop and SubagentStop hook entries to .claude/settings.local.json (workspace-scoped, ≥ 0.14.0). If a legacy Olakai hook block is still in .claude/settings.json, init migrates it: the block moves to settings.local.json and init tells you it did so. A settings.json that holds no Olakai hooks is left byte-identical..olakai/monitor-claude-code.json (API key, agent ID, endpoint). Pre-Stage-2 installs at .claude/olakai-monitor.json are auto-migrated on first read.~/.olakai/registry.json) so monitor list / doctor can see it.git check-ignore and warns if it is not gitignored (silent when the workspace is not a git repository, or when git is unavailable).init links an agent in one of two ways, and only one of them rotates a key. Know which one you are in before you report anything to the developer:
| Path | What happens to the key | Blast radius |
|---|---|---|
| Reuse an existing agent (pick it from the list) | Provisioning rotates that agent's API key | Any other workspace already using that agent starts failing on its next monitor request until it re-runs olakai monitor init. The CLI warns you about this before it proceeds. |
| Paste a key you already hold | No rotation | The CLI calls GET /api/monitoring/prompt/me with the pasted key and aborts (default n) if the resolved agent does not match the agent you picked |
Your API key is protected against a failed install. On the rotate path the plaintext key is shown only once, so init parses the settings files before it provisions, and writes .olakai/monitor-claude-code.json before it writes the hooks. A settings file that will not parse stops the run before any key is rotated, and a rotated key is on disk before the hook write is attempted.
The command is interactive — it prompts for an agent name if one is not provided, and lets you pick an existing agent or create a new one.
Re-running
olakai monitor init --tool claude-code: Settings-merge preserves any user-customized Olakai hook commands. It will not overwrite manually-edited commands. For a clean reinstall that refreshes hook commands, runolakai monitor disable --tool claude-codefirst, thenolakai monitor init --tool claude-code. To heal a clobbered config without losing the agent, preferolakai monitor repair --tool claude-code.
olakai monitor status --tool claude-code # this workspace
olakai monitor doctor --tool claude-code # full ordered health check
status confirms Stop and SubagentStop hooks are registered and the config at .olakai/monitor-claude-code.json is valid. It finds the hooks in either .claude/settings.local.json or .claude/settings.json, names the file they are in, and warns when they are in both. Treat that warning as an unfinished migration, not as duplicate reporting: identical blocks are deduplicated and run once. It matters because the copy in the tracked settings.json can be deleted by a git pull, and because two blocks that later drift apart would both run. status never rewrites settings.json. doctor runs the deeper chain (registry → config → hooks → key → agent → events).
Two hooks are installed by default:
Both hooks read Claude Code's transcript JSONL file (at transcript_path from the hook event) and extract:
| Field | Description |
|---|---|
prompt | Last non-meta user message in the session transcript |
response | Last assistant message text (tool-only turns preserve the prior text response) |
chatId | Claude Code session_id — groups all turns of a conversation |
modelName | Model from the last assistant message (e.g., claude-sonnet-4-5) |
tokens | Input (incl. cache_creation + cache_read) + output tokens from last turn's usage |
customData.inputTokens / outputTokens | Last turn's usage broken down |
customData.numTurns | Count of non-sidechain assistant messages in the session |
customData.latencyMs | Integer milliseconds from the user message timestamp to the assistant response timestamp |
customData.subagent | Subagent name, set only on SubagentStop events |
customData.skill | Slash-command skill name, set when the user turn begins with /<skill> |
customData.sessionId / transcriptPath / cwd / stopHookActive / hookEvent | Raw hook event metadata |
source | Top-level "claude-code" tag |
Notes on token counts: Token totals include cache tokens (cache_creation + cache_read) because real Claude Code sessions typically show very high cache-read volume. Excluding cache would massively under-report billable volume.
Empty-parse safeguard: If the transcript parser produces an empty prompt, empty response, AND zero turns, the hook returns null and does not fire an event — defensive against unrecognized payload shapes from future Claude Code versions.
olakai monitor init --tool codex
What it does:
AgentSource.CODEX on your Olakai accountStop hook entry into the inline [hooks] block of ~/.codex/config.toml (global — fires in every workspace). Comment-preserving TOML serialization isn't supported by @iarna/toml, so existing comments in your ~/.codex/config.toml may be reformatted on first install — the CLI prints a warning when this happens..olakai/monitor-codex.json (API key, agent ID, endpoint) and records this workspace in ~/.olakai/registry.json.Codex CLI ≥ 0.124.0 is required. The hooks API was unstable in earlier Codex versions; the integration is only validated from
0.124.0onward. Check withcodex --versionbefore running init.Global-hook caveat: because the Codex hook is global, running it in a workspace with no
.olakai/monitor-codex.jsonproduces no event (silent exit). See Scope is honest per tool.
olakai monitor status --tool codex
olakai monitor doctor --tool codex
Codex hooks fire on session turn completion. The integration captures:
prompt / response — last user/assistant turn from Codex's transcriptchatId — Codex session identifiermodelName — model from the last assistant messagetokens — input + output token totals from the turn's usagecustomData.inputTokens / outputTokens — usage broken downcustomData.numTurns — turn count for the sessionsource — "codex"olakai monitor init --tool cursor
What it does:
AgentSource.CURSOR on your Olakai accountbeforeSubmitPrompt, afterAgentResponse, sessionEnd, and stop hook entries to ~/.cursor/hooks.json (global per-user install — fires in every workspace).olakai/monitor-cursor.json (API key, agent ID, endpoint) and records this workspace in ~/.olakai/registry.json.Cursor ≥ 1.7 is required and the Cursor hooks API is in beta. The integration is validated against Cursor
3.xbut the upstream hook contract may shift. If hooks stop firing after a Cursor update, see Troubleshooting.Global-hook caveat: as with Codex, the Cursor hook is global, so a workspace without
.olakai/monitor-cursor.jsonproduces no event. See Scope is honest per tool.
olakai monitor status --tool cursor
olakai monitor doctor --tool cursor
In addition to the standard fields (prompt, response, tokens, modelName, chatId, numTurns), Cursor hook events expose the active user's email, which is captured as:
userEmail — automatically populated from the Cursor hook payload, so per-user analytics work without explicit identificationsource — "cursor"olakai monitor init --tool gemini-cli
What it does:
AgentSource.GEMINI_CLI on your Olakai account~/.gemini/settings.json (global — fires in every workspace). The hooks cover SessionStart, SessionEnd, BeforeModel, AfterModel, BeforeTool, and AfterTool — only AfterModel emits a monitoring event, while the others maintain sidecar session state..olakai/monitor-gemini-cli.json (API key, agent ID, endpoint) and records this workspace in ~/.olakai/registry.json.Gemini CLI ≥ 0.26.0 is required. The hooks API used by this integration is only available from
0.26.0(GA 2026-01-28) onward. Check withgemini --versionbefore running init.Global-hook caveat: because the Gemini CLI hooks are global, running in a workspace with no
.olakai/monitor-gemini-cli.jsonproduces no event (silent exit). See Scope is honest per tool.
olakai monitor status --tool gemini-cli
olakai monitor doctor --tool gemini-cli
The hooks merged into ~/.gemini/settings.json span the full session lifecycle (SessionStart, SessionEnd, BeforeModel, AfterModel, BeforeTool, AfterTool). Only AfterModel emits a monitoring event; the other hooks maintain sidecar session state (tool counts, session identity) so the emitted event is complete. Each event captures:
hookEvent — the hook that fired (AfterModel for emitted events)sessionId — Gemini CLI session identifier, groups all turns of a conversationcwd — the workspace directory the session ran ininputTokens / outputTokens — token usage for the turntoolCallCount — number of tool calls observed in the session via the BeforeTool / AfterTool hookstoolNames — the names of the tools invokedsource — "gemini-cli"olakai monitor init --tool antigravity
What it does:
AgentSource.ANTIGRAVITY on your Olakai accountStop hook entry into ~/.gemini/config/hooks.json (global — fires in every workspace). The Stop hook fires at the end of each agy turn and emits one monitoring event..olakai/monitor-antigravity.json (API key, agent ID, endpoint) and records this workspace in ~/.olakai/registry.json.A recent
agywith hooks support is required (validated againstagyv1.0.4). Antigravity CLI (agy) is Google's agentic coding CLI. The integration relies on theStophook, so older builds without hooks support will not emit events.Interactive-only: the
Stophook only fires in interactiveagysessions. Headless runs (agy -p) skip hooks entirely, so no event is sent for non-interactive invocations.No token counts: agy's hook payload carries no usage metadata, so emitted events have no input/output token counts. Olakai still computes its own model-based cost estimate.
Global-hook caveat: because the Antigravity hook is global, running it in a workspace with no
.olakai/monitor-antigravity.jsonproduces no event (silent exit). It is also written to~/.gemini/config/hooks.json, a different file from Gemini CLI's~/.gemini/settings.json, so the two coexist cleanly. See Scope is honest per tool.
olakai monitor status --tool antigravity
olakai monitor doctor --tool antigravity
The Stop hook reads agy's transcript JSONL to reconstruct the turn. Each event captures:
prompt — the last user turn from agy's transcriptresponse — the agent's final response for the turncustomData.hookEvent — the hook that fired (Stop)customData.conversationId — agy conversation identifier, groups all turns of a conversationcustomData.cwd — the workspace directory the session ran incustomData.terminationReason — why the turn endedsource — "antigravity"Note — interactive-only and no token counts. Antigravity events are only produced in interactive
agysessions (headlessagy -pskips hooks), and agy's payload has no usage metadata, so emitted events have no token counts.
When you select an existing agent during olakai monitor init and the CLI asks you to paste the API key, the CLI validates that the key actually resolves to the agent you picked:
GET /api/monitoring/prompt/me with your pasted keyUse the pasted key anyway? (y/n) [n]:
The default is abort. Pressing Enter cancels the init and protects you from wiring a key into the wrong agent's config. Pick again, get a fresh key for the right agent (copy it from the agent's card under Global Settings > Configuration & Controls > Agents in the web UI (admin access; otherwise ask an admin); olakai agents get shows only a masked key), or type y if you intentionally want a cross-wired setup (rare, usually a mistake).
After completing your first task in the local agent, fetch and inspect the event:
# 1. Use the local agent normally — write code, ask questions, run a turn
# 2. Fetch the latest event for your agent
olakai activity list --agent-id AGENT_ID --limit 1 --json
# 3. Inspect it
olakai activity get EVENT_ID --json | jq '{source, customData, kpiData}'
Confirm:
source is "claude-code", "codex", "cursor", "gemini-cli", or "antigravity" (matches your --tool)prompt, response, tokens, and modelName are populated (not empty/null)customData contains session metadatauserEmail is set from the hook payloadkpiData shows numbers, not strings or nullsReplace AGENT_ID with the ID shown by olakai monitor status --tool <tool> (or olakai monitor list).
Local agent traffic is evaluated by the same KPI system as SDK-monitored agents. New agents automatically receive metric slot KPIs:
| Slot KPI | Output Unit | Description |
|---|---|---|
| Execution Cost | USD | Token-based cost estimate |
| Time Saved | minutes | time_saved_estimator classifier (CHAT scope) |
| Value Created | USD | Time Saved * hourly rate |
| Governance Compliance | % | Policy pass rate |
Plus the composite: ROI = Value Created / Execution Cost.
olakai kpis list --agent-id AGENT_ID
If the Time Saved classifier is missing, add it manually. agents create and monitor init auto-provision it today, so this only applies to agents created before slot provisioning existed:
olakai kpis create --name "Time Saved" \
--calculator-id classifier --template-id time_saved_estimator \
--scope CHAT --agent-id AGENT_ID
If you want metrics beyond the defaults, register custom data fields first, then create formula-based KPIs:
# Example: track task complexity
olakai custom-data create --agent-id AGENT_ID --name "Complexity" --type STRING
olakai kpis create \
--name "Complex Tasks" \
--agent-id AGENT_ID \
--calculator-id formula \
--formula "IF(Complexity = \"complex\", 1, 0)" \
--scope PROMPT_REQUEST \
--aggregation SUM
Classifier templates provide AI-evaluated KPIs without writing formulas. They analyze the full conversation at the CHAT scope:
olakai kpis templates # List available templates
olakai kpis create --name "Session Sentiment" \
--calculator-id classifier --template-id sentiment_scorer \
--scope CHAT --agent-id AGENT_ID
Note: Classifier KPIs run at CHAT scope, meaning they evaluate the entire session, not individual turns. Results appear after chat decoration processes (there may be a short delay).
# Health (machine, single-workspace, account)
olakai monitor list # MACHINE: everything monitored on this box
olakai monitor doctor --tool <tool> # ordered health check (--all for every workspace)
olakai monitor status --tool <tool> # quick single-workspace status
olakai agents mine [--source claude-code|codex|cursor|gemini-cli|antigravity] # ACCOUNT: your coding agents
# Events + KPIs for one agent
olakai activity list --agent-id AGENT_ID --limit 10
olakai activity sessions --agent-id AGENT_ID # decoration status (DECORATED = KPIs populated)
olakai activity kpis --agent-id AGENT_ID --json
Dashboard: Navigate to Coding IQ → AI Impact → AI Coding Apps at https://app.olakai.ai. The unified table shows agents from all five tools side-by-side, with a source filter chip (All / Claude Code / Codex / Cursor / Gemini CLI / Antigravity CLI, default All).
These act on the agent record on the Olakai backend, across all machines — not on local hooks:
olakai agents archive AGENT_ID # hide an agent you no longer use
olakai agents archive AGENT_ID --unarchive # bring it back
olakai agents rename AGENT_ID "New Name" # rename
olakai agents delete AGENT_ID # also a soft delete: archives the agent (no CLI command destroys one)
Backend requirement:
agents archive/renamerequire a current Olakai backend (self-owner lifecycle support shipped alongside these CLI commands). Against older backends these are admin-only andarchivemay no-op silently — if archive appears to do nothing, your backend predates the feature.
To stop hooks on this machine without touching the account record, use olakai monitor disable instead (below).
Each tool's monitoring is uninstalled independently:
olakai monitor disable --tool claude-code
olakai monitor disable --tool codex
olakai monitor disable --tool cursor
olakai monitor disable --tool gemini-cli
olakai monitor disable --tool antigravity
What this does:
.claude/settings.local.json. A .claude/settings.json that holds no Olakai hooks is left byte-identical. Run from the home folder on 1.0.0-beta.4+, it removes the user-level hooks from ~/.claude/settings.json (and ~/.claude/settings.local.json) and deletes the home key file unless you pass --keep-config.monitor-claude-code.json / monitor-codex.json / monitor-cursor.json / monitor-gemini-cli.json / monitor-antigravity.json (and any legacy .claude/olakai-monitor.json)~/.olakai/registry.json)What this does NOT do:
olakai agents archive/delete for that)To re-enable, run olakai monitor init --tool <tool> again.
No events, missing KPIs, deleted/404 agent, drifted config, hooks stopped firing? That is the self-healing playbook — use the
olakai-monitor-doctorskill, or just runolakai monitor doctor --tool <tool>(add--fixto auto-repair, orolakai monitor repair --tool <tool>to forcefully re-init while preserving the agent). The subsections below cover only setup-specific transcript/KPI issues that doctor does not auto-fix.
prompt, response, tokens, or modelName are empty/nullThis usually means the transcript file at transcript_path (Claude Code) or the equivalent for Codex/Cursor could not be read or parsed. Common causes:
olakai --version first. On 0.x, ask the user, then run npm install -g olakai-cli@latest after they say yes. On 1.x (standalone or npm @next), do not run it: it downgrades to 0.15.1. Run olakai update instead.0.124.0, Cursor must be ≥ 1.7For Claude Code specifically, the empty-parse silent-exit guard means the hook returns null (no event) when prompt empty AND response empty AND numTurns is 0 — protective against unrecognized payload shapes. If you see no events at all and debug mode shows transcript-parsed: empty, you've hit this guard.
Enable OLAKAI_MONITOR_DEBUG=1 to confirm whether transcript reading succeeded. Look for transcript-read-failed or transcript-parsed entries in the debug log.
KPIs must be configured on the agent:
olakai kpis list --agent-id AGENT_ID
If empty, add at minimum the Time Saved classifier:
olakai kpis create --name "Time Saved" \
--calculator-id classifier --template-id time_saved_estimator \
--scope CHAT --agent-id AGENT_ID
The hook is designed to fail silently — errors in the monitoring hook should never interrupt your local agent session. If you suspect issues:
cat .olakai/monitor-claude-code.json (or the Codex/Cursor equivalent)olakai monitor doctor --tool <tool> (the api-key-valid check). Add --fix to rotate the key and rewrite the config. Rotation invalidates the old key, so any other config that uses it stops reportingolakai whoamiolakai on PATHThis happens when the standalone binary (beta) is installed and the npm CLI (olakai-cli) is still installed too. Agent hooks run olakai monitor hook ..., so they may run either copy. Only one copy should stay.
Detect it:
which -a olakai # macOS / Linux: lists every olakai on PATH
On Windows, run where.exe olakai.
This is the primary check, and it works for both installs. Copies count only when they are in different directories. npm's olakai and olakai.cmd in the same folder are one copy.
The standalone beta's olakai monitor doctor also warns when more than one olakai is on PATH. The npm 0.x CLI's doctor has no PATH check, so do not rely on doctor alone.
Fix it: ask the user which copy to keep. Remove the other copy only after they confirm.
npm uninstall -g olakai-clibrew uninstall olakai-beta, scoop uninstall olakai-beta, or delete the binary the install script placed (~/.local/bin/olakai, or /usr/local/bin/olakai if installed with --global)Both copies use the same config files and the same hook entries, so you do not need to log in again or re-run olakai monitor init. Run which -a olakai (or where.exe olakai) again to confirm only one copy is left.
Use /olakai-troubleshoot for comprehensive diagnostics including API key validation, endpoint connectivity, event payload inspection, and KPI formula debugging.
# Setup (pick the right --tool)
olakai monitor init --tool claude-code # Claude Code (workspace-scoped hooks)
olakai monitor init --tool codex # Codex CLI (>= 0.124.0, global hooks)
olakai monitor init --tool cursor # Cursor (>= 1.7, hooks beta, global hooks)
olakai monitor init --tool gemini-cli # Gemini CLI (>= 0.26.0, global hooks)
olakai monitor init --tool antigravity # Antigravity CLI (recent agy w/ hooks, validated 1.0.4, global hooks)
# Admin: zero-touch fleet rollout (ADMIN role, standalone CLI >= 1.0.0-beta.4)
olakai admin monitor bulk-provision --emails <file> --out <dir> [--tool claude-code,codex,cursor] [--rotate-existing-keys] [--name-prefix <p>] [--json] [--yes]
olakai monitor install-machine-hooks [--tool claude-code,codex] # >= 1.0.1, once per device as admin; no approval prompt
olakai monitor uninstall-machine-hooks [--tool claude-code,codex]
olakai monitor install-hooks [--tool claude-code,codex,cursor] # as the developer; Cursor fleet path; Codex users must approve
# npm 0.13-0.15.1: bulk-provision supports --tool claude-code only (per-repo bundle), no install-hooks
# See what's monitored (two lenses)
olakai monitor list # MACHINE: everything on this box + drift flags
olakai agents mine [--source claude-code|codex|cursor|gemini-cli|antigravity] # ACCOUNT: agents across the whole account
# Diagnose + repair your own monitoring
olakai monitor doctor --tool <tool> [--fix] [--recreate-missing]
olakai monitor doctor --all # every workspace on this machine
olakai monitor repair --tool <tool> # forceful re-init, preserves agent linkage
olakai monitor status --tool <claude-code|codex|cursor|gemini-cli|antigravity>
olakai monitor disable --tool <claude-code|codex|cursor|gemini-cli|antigravity>
# Agent lifecycle (account-wide, backend record)
olakai agents archive AGENT_ID [--unarchive]
olakai agents rename AGENT_ID "New Name"
olakai agents delete AGENT_ID
# Activity + KPIs — see "Checking Your Data" above
# Debug
export OLAKAI_MONITOR_DEBUG=1 # Verbose dispatcher logs at /tmp/olakai-monitor-debug-<pid>.log
# Dashboard: Coding IQ -> AI Impact -> AI Coding Apps at https://app.olakai.ai
What SKILL.md sets; muted values are Claude Code's defaults
/olakai-ai-olakai-skills:olakai-monitor-local-coding-agentfrom olakai-ai-olakai-skills
olakai-ai-olakai-skills@cascade-ai-ml-agents-misc-1 is listed by joshuarweaver/cascade-ai-ml-agents-misc-1 — review the source before installing
npx claudepluginhub joshuarweaver/cascade-ai-ml-agents-misc-1 --plugin olakai-ai-olakai-skills13 skills in this plugin
/olakai-finopsReads and interprets Olakai AI cost data over MCP — spend posture, unit economics, showback, anomalies, budget variance, forecasts, model-mix optimization and AI ROI — without confusing the three numbers Olakai calls "cost".
AUTO-INVOKE when the user asks what they spend on AI, cost per developer or team, who is burning the budget, whether they will land on plan, why spend spiked, where to cut, or their AI ROI.
TRIGGER KEYWORDS: olakai, finops, AI spend, AI cost, burn rate, run rate, forecast, budget variance, chargeback, showback, allocation, unattributed spend, unit economics, spend spike, model swap, seat licensing, ROI, execution cost.
CRITICAL: there are THREE cost authorities — virtual, billed and allocated — never summed. Budgets are overlapping lenses, not a partition, and they only alert: nothing caps spend. flaggedDays flags seasonality as readily as incidents.
DO NOT load for: risk or compliance (olakai-governance), SDK setup (olakai-integrate), or CLI KPI reports (olakai-reports).
/olakai-get-startedInstall the CLI, authenticate, and send your first monitored event.
AUTO-INVOKE when: CLI is not installed, user is not authenticated, user asks about getting started with Olakai, user wants to try Olakai, user mentions they don't have an account yet, or when other skills fail due to missing prerequisites.
TRIGGER KEYWORDS: get started, setup, install olakai, olakai account, sign up, signup, new to olakai, try olakai, olakai onboarding, first agent, getting started, no account, create account, register.
DO NOT load for: users who are already authenticated and have agents set up (use olakai-new-project, olakai-integrate, or olakai-troubleshoot instead).
Other plugins' skills for the same job