Diagnose and repair Olakai monitoring for a local coding tool you already set up — Claude Code, OpenAI Codex CLI, or Cursor. Drives `olakai monitor list`, `olakai monitor doctor [--fix]` and `olakai monitor repair` to self-heal hooks-based monitoring: no events, missing KPIs, a deleted or 404 agent, drifted config, hooks that stopped firing. AUTO-INVOKE whenever monitoring that was already set up looks broken or suspect, or when the user wants to confirm what is monitored on this machine and whether it is still reporting. TRIGGER KEYWORDS: olakai monitor doctor, olakai monitor repair, olakai monitor list, monitoring not working, no events from claude code, agent 404. DO NOT load for: first-time setup of a coding tool (use olakai-monitor-local-coding-agent), instrumenting your own agent's SDK code (use olakai-integrate), 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 diagnoses and repairs already-installed hooks-based monitoring for a local coding tool (Claude Code, Codex CLI, Cursor). Use it when monitoring seems broken: no events, missing KPIs, a deleted/404 agent, or a clobbered config.
First-time setup? Use
olakai-monitor-local-coding-agentinstead — it coversinit, what each tool captures, and KPI configuration. This skill is the repair half.
CLI requirement:
monitor list,monitor doctor,monitor repair, andagents minerequire olakai-cli ≥ 0.7.0. Older CLIs only haveinit/status/disable. 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.
⚠️ Read this before you run any hook-migration command in this skill.
Check that
olakai --versionreports 0.14.0 or later before running the migration commands. 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 treat
npm 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.
See Claude Code hook location for what changed and why.
If your monitoring seems broken, drive these 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 for the current workspace + tool.
olakai monitor doctor --tool claude-code # or codex / cursor
olakai monitor doctor --all # every workspace on this machine
# 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
Two distinct questions, 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) |
The backend has no scope model — agents are account-scoped only, with 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 ~/.olakai/registry.json, which monitor list reads. monitor doctor bridges the two lenses — it flags drift between the registry, the backend, and what's actually on disk.
olakai monitor list # MACHINE: every monitored workspace, grouped by tool
olakai monitor list --json
olakai agents mine # ACCOUNT: your coding agents across the whole account
olakai agents mine --source claude-code # filter to one tool
olakai agents mine --source codex --json
monitor doctor runs an ordered chain — each step gates the next, so the first failure is usually the real problem:
| # | Check | PASS means | A FAIL points to |
|---|---|---|---|
| 1 | registry-entry | This workspace is recorded in ~/.olakai/registry.json | Never inited here, or registry wiped → --fix adopts the on-disk config into the registry |
| 2 | config-valid | .olakai/monitor-<tool>.json exists and parses (key, agentId, endpoint) | Missing/corrupt config → monitor repair re-writes it |
| 3 | hooks-installed | The tool's settings file has the Olakai hook entries | Hooks removed or a settings edit clobbered them → --fix re-merges them |
| 4 | api-key-valid | The stored key authenticates (GET /api/monitoring/prompt/me) | Key revoked/rotated → --fix rotates a fresh key on the same agent and rewrites the config (cross-wired-key detection is a monitor init feature, not doctor) |
| 5 | agent-exists | The linked agent still exists on the backend on the active profile's host — not necessarily the workspace's | Agent deleted (404) → verify the host first (see the warning below); a cross-host 404 is false — recreation is gated behind --recreate-missing or repair (so a transient 404 can't spawn a duplicate) |
| 6 | events-flowing | Recent events exist for this agent (metadata probe) — resolved on the active profile's host, so it is skipped or empty whenever check 5 failed falsely | Hooks installed but never fired → run a turn, then re-check; if still empty see the unattributed-activity caveat below |
⚠️ A 404 on
agent-existsis not proof the agent is gone. Check the host first (OLA-1610, open against the CLI).
doctorresolves its two backend checks against two different hosts:
api-key-validuses the workspace'smonitoringEndpoint— correct.agent-existsandevents-flowinguse the active CLI profile's host.So on a machine with more than one deployment (SaaS, staging, on-prem), every workspace that is not on the active profile reports a passing key check and a false
no longer exists on the backend (404). The agent is fine; the CLI looked for it on the wrong deployment.monitor doctor --allshows the same false 404 for each such workspace, andolakai status --jsonreportsmonitoring.agentCount: 0for the same reason.This is why it matters here rather than only in the CLI: a 404 is exactly what gates
monitor repairanddoctor --fix --recreate-missing. Acting on a false one creates a duplicate agent on the wrong deployment and repoints the workspace at it — splitting the workspace's history across two agents on two hosts, which no later repair undoes.Before treating any 404 as real, compare the hosts (both commands work offline, and
monitor listneeds no valid token):olakai monitor list --json | jq -r '.[] | "\(.path)\t\(.monitoringEndpoint)"' olakai profiles list # every logged-in host, and which profile is activeThen:
Comparison What to do Active profile's host == the workspace's monitoringEndpointhostThe 404 is real. Proceed. A different profile is logged in to that host Re-run against it: olakai --profile <name> monitor doctor --tool <tool>. Report that result, not the first one.No profile is logged in to that host Report "cannot check: not logged in to <host>". Do not runrepairor--recreate-missing. Offerolakai loginfor that host instead.Never recreate an agent while the profile host and the workspace host differ, even when the user asks for it — say which host the agent is on and which one you are authenticated to.
--fix is idempotent and best-effort: it adopts the registry entry, re-merges missing hooks, and re-links a rejected key. It will not recreate a missing agent unless you add --recreate-missing — a deliberate guard against a flaky/transient 404 spawning a duplicate agent.
Claude Code hook location (olakai-cli ≥ 0.14.0).
hooks-installedpassing is no longer the whole story for Claude Code. Since 0.14.0 the hooks belong in.claude/settings.local.json. Doctor reports two extra conditions as awarnrather than a green check:
- Hooks in the legacy
.claude/settings.json, or in both files. Claude Code merges thehooksblock across both files: neither suppresses the other, and identical handlers are deduplicated, so the CLI's own block left in both runs once. The warning is about an unfinished migration, not duplicate events. It matters because the copy in the trackedsettings.jsonis onegit pullaway from deletion, and because two blocks that differ (an older command form beside the current one) both run and do duplicate events.doctor --fixandmonitor repairmigrate the block tosettings.local.json.- The hook file is not gitignored. Doctor runs
git check-ignoreon it and warns when the file is committable, because a teammate's commit could then delete your hooks. It stays silent when the workspace is not a git repository or git is unavailable. Notegit check-ignorereports a tracked file as not-ignored even when a.gitignorerule matches it. That is exactly the broken case: add the rule and rungit rm --cachedon the file.Before 0.14.0, doctor reported a legacy install as
okrather thanwarn, because.claude/settings.jsonwas then the correct location. Upgrade, confirm witholakai --version, and re-runolakai monitor doctor --tool claude-code.
An admin can push key files to ~/.olakai/monitor-<tool>.json with an MDM tool and install the hooks with olakai monitor install-machine-hooks as an administrator (see /olakai-monitor-local-coding-agent, admin fleet rollout). These machines have no workspace .olakai folder. The hooks walk up from the workspace for .olakai/monitor-<tool>.json, then fall back to the home key file. A workspace config always wins.
When such a machine sends no events, check these in order, as the logged-on developer:
olakai --version must print 1.0.0-beta.4 or later. npm 0.x has no install-hooks, no home key-file fallback for workspaces outside the home folder, and no multi-root handling. (Its walk-up does reach ~/.olakai for projects under the home folder.) If which -a olakai (or where.exe olakai) lists an npm copy first on the PATH, that copy runs the hooks.~/.olakai/monitor-<tool>.json exists for the tool and parses. olakai monitor status --tool <tool> prints Using home key file <path> on stderr when the hook will use it. 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. Outside home, no such line and no workspace config means the hook has no key.~/.olakai must be owned by the developer. A root or SYSTEM copy step that did not chown the files breaks this. status warns and doctor fails a home-owner check. Fix the owner (chown -R <user> the folder, chmod 700 the folder, chmod 600 the files), not the check. (macOS and Linux; on Windows the CLI checks only for the SYSTEM profile, not file owners).olakai monitor install-hooks must run as the logged-on developer, not as root or SYSTEM. It refuses when the home or ~/.olakai is owned by another user (macOS and Linux; on Windows the CLI checks only for the SYSTEM profile, not file owners), or when the home is a Windows SYSTEM profile. Re-running it is safe. If it exits 1, read stderr: it names a file it could not parse, or a Codex config.toml with a [hooks] table and comments that must be merged by hand. Codex needs 0.124.0 or later. If Claude Code hooks come from managed settings instead, install-hooks --tool codex,cursor is expected.NO_PROXY. A new machine environment variable reaches the tools only after a restart or a new sign-in.User scope (root == home). Here the Claude Code hooks belong in ~/.claude/settings.json (or $CLAUDE_CONFIG_DIR/settings.json), not settings.local.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 in ~/.claude/settings.json, so doctor --fix is safe. Do not run doctor --fix, repair or init on these machines with npm 0.x: they move the hooks to ~/.claude/settings.local.json, where Claude Code never reads them. The .claude/settings.local.json migration and gitignore warnings above apply to repositories, not to the home folder.
npm 0.13 to 0.15.1 bundles (per-repo, Claude Code only). Those releases push .claude/settings.local.json and .olakai/monitor-claude-code.json into a repository. The workspace is not in the local registry until the developer runs any olakai monitor command once. The registry reconcile then backfills it. Hooks fire and events flow regardless. A registry-entry FAIL (or the workspace missing from monitor list) on such a machine is expected, not broken. olakai monitor doctor --tool claude-code --fix adopts it.
Want the machine-wide picture ("what's monitored here")?
└── olakai monitor list (account-wide instead? → olakai agents mine)
No events appearing?
└── olakai monitor doctor --tool <tool> ← always start here
├── registry-entry FAIL → olakai monitor doctor --tool <tool> --fix (adopts config into registry)
├── hooks-installed FAIL → olakai monitor doctor --tool <tool> --fix (re-merges hooks)
├── api-key-valid FAIL → olakai monitor doctor --tool <tool> --fix (re-links a fresh key)
├── agent-exists FAIL (404)
│ ├── olakai monitor repair --tool <tool> (recommended — preserves linkage)
│ └── olakai monitor doctor --tool <tool> --fix --recreate-missing
└── events-flowing FAIL → run one turn, re-check; Codex/Cursor in an un-inited repo
→ silent-exit (see unattributed-activity caveat)
Doctor warns about the hook location (Claude Code)?
└── olakai --version → MUST be >= 0.14.0 first. On 0.13.0, --fix puts the hooks
│ BACK into .claude/settings.json and reports success.
└── olakai monitor doctor --tool claude-code --fix
(migrates the legacy block from .claude/settings.json to .claude/settings.local.json)
Config clobbered / settings file edited by hand / legacy layout?
└── olakai monitor repair --tool <tool>
(always re-merges hooks, migrates legacy config, re-links key only if invalid,
recreates the agent only on a TRUE 404 — never duplicates a healthy agent)
doctor --fix vs repair — when to use whichmonitor doctor --fix | monitor repair --tool <t> | |
|---|---|---|
| Intent | Surgical: fix only what a check flagged | Forceful re-init that preserves agent linkage |
| Hooks | Re-merges only if hooks-installed failed | Always re-merges (heals a clobbered settings file) |
| Legacy hook location (Claude Code, ≥ 0.14.0) | Migrates a .claude/settings.json block to .claude/settings.local.json | Same |
| Legacy config | — | Migrates legacy config layout |
| API key | Re-links only if invalid | Re-links only if invalid |
| Missing agent | Recreates only with --recreate-missing | Recreates only on a true 404 |
| Use when | Doctor told you exactly what's wrong | "Just make it work again" / settings got mangled |
Where the hooks live differs by tool, and that drives what gets attributed:
| Tool | Hook scope | Where hooks are written |
|---|---|---|
| Claude Code | Workspace | .claude/settings.local.json (this workspace only, olakai-cli ≥ 0.14.0) |
| Codex CLI | Global | ~/.codex/config.toml (all workspaces) |
| Cursor | Global | ~/.cursor/hooks.json (all workspaces) |
For all three, the per-workspace .olakai/monitor-<tool>.json holds the agent linkage (key + agent ID + endpoint).
Up to 0.13.0, Claude Code hooks went into .claude/settings.json. Teams track that file in git, so a pull could rewrite it and silently delete the hooks. Since 0.14.0 they live in .claude/settings.local.json, which is project-scoped and conventionally gitignored. Doctor finds hooks in either file; see Claude Code hook location for what it does about a legacy or duplicated install, and Check your CLI version before migrating before you act on it.
⚠️ Unattributed-activity caveat (Codex / Cursor). Because Codex and Cursor hooks are global, they fire in every workspace — including ones you never ran
initin. When the hook fires in a workspace with no.olakai/monitor-<tool>.json, it silently exits and that session is NOT attributed to any agent (no event). This is expected: a global hook with no local linkage has nowhere to report. If you expect Codex/Cursor activity from a repo and see none, the most common cause is you never ranolakai monitor init --tool <tool>in that repo. Runolakai monitor listto see which workspaces are linked, andolakai monitor doctor --tool <tool>for an in-context explanation.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).
olakai monitor doctor --tool <tool> # read the first failing check
olakai monitor doctor --tool <tool> --fix # auto-repair registry/hooks/key
If events-flowing is the only failure: run one real turn and re-check. For Codex/Cursor, confirm you ran init in this repo (global-hook silent-exit otherwise). For Codex, a hooks-approved warning means Codex skips the hook until the user approves it at "Hooks need review" or in /hooks. For a fleet, an admin runs olakai monitor install-machine-hooks instead.
olakai monitor repair --tool <tool> # recommended — recreates only on a true 404
# or explicitly:
olakai monitor doctor --tool <tool> --fix --recreate-missing
olakai monitor repair --tool cursor # re-merges hook entries, preserves the agent
cursor --version # confirm >= 1.7
Hooks installed by olakai-cli 0.13.0 or earlier sit in .claude/settings.json, which most teams track in git. A pull that rewrites that file deletes them, and monitoring stops with no error.
Ask the user before you run the upgrade on the first line. Run it only after they say yes.
npm install -g olakai-cli@latest # 0.x npm installs only; on 1.x run olakai update
olakai --version # MUST report 0.14.0 or later; see the guard above
olakai monitor doctor --tool claude-code --fix # attempts to migrate the hooks to .claude/settings.local.json
The version check is not optional here. See Check your CLI version before migrating. On 0.13.0 the same --fix puts the hooks back into .claude/settings.json and reports success, which recreates the exact problem you are fixing.
settings.local.json is project-scoped and conventionally gitignored, so a pull cannot reach it. Doctor also warns if that file is not actually gitignored in your repo.
Do not tell the user their events are being double-counted. Claude Code merges the hooks block across .claude/settings.json and .claude/settings.local.json, and neither file suppresses the other, but identical handlers are deduplicated. The CLI writes a deterministic block, so the same block in both files runs once.
Two things still make this worth fixing:
settings.json can be deleted by a git pull, which is the whole reason for the move.So check whether the two blocks are identical before you say anything about duplicate events, and fix it either way:
olakai --version # MUST report 0.14.0 or later; see the guard above
olakai monitor doctor --tool claude-code --fix # or: olakai monitor repair --tool claude-code
Confirm it against the data before you act: olakai activity list --limit 10 --json and look for paired events on one chatId. If the duplicates are real, the usual cause is two hook handlers that differ, not two that match. Compare the hooks block in both settings files, look for an Olakai handler installed by something other than olakai monitor init, then run the --fix above to leave a single current block in settings.local.json.
olakai on PATH"This 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.
olakai monitor repair --tool <tool> # always re-merges hooks + migrates legacy config
After repairing, confirm with a real event:
# 1. Run one turn in the coding tool
# 2. Fetch the latest event
olakai activity list --agent-id AGENT_ID --limit 1 --json
# 3. Inspect it
olakai activity get EVENT_ID --json | jq '{source, customData, kpiData}'
Confirm: event exists with a recent timestamp; source matches your --tool; prompt/response/tokens/modelName are populated; kpiData shows numbers (not strings or nulls). Find AGENT_ID via olakai monitor status --tool <tool> or olakai monitor list.
When doctor passes but events still seem off, watch the dispatcher directly:
export OLAKAI_MONITOR_DEBUG=1 # then run a turn
# Inspect /tmp/olakai-monitor-debug-<pid>.log for:
# dispatcher/posting — payload about to be posted
# dispatcher/posted — HTTP status + 500-byte response preview
# dispatcher/post-error — error details if the POST failed
# transcript-read-failed / transcript-parsed — transcript parsing signals
# See (two lenses)
olakai monitor list [--json] # MACHINE: what's monitored here + drift
olakai agents mine [--source claude-code|codex|cursor] [--json] # ACCOUNT: agents across the account
# Diagnose + repair
olakai monitor doctor --tool <tool> [--fix] [--recreate-missing]
olakai monitor doctor --all [--fix] # every workspace on this machine
olakai monitor repair --tool <tool> # forceful re-init, preserves agent
# Agent lifecycle (account-wide; requires current backend)
olakai agents archive AGENT_ID [--unarchive]
olakai agents rename AGENT_ID "New Name"
olakai agents delete AGENT_ID
# Debug
export OLAKAI_MONITOR_DEBUG=1
olakai-monitor-local-coding-agent — first-time setup (init), per-tool capture details, KPI configuration.olakai-troubleshoot — generic SDK / KPI / event diagnostics (string KPIs, null KPIs, customData pipeline) not specific to a coding tool.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/olakai-ai-olakai-skills:olakai-monitor-doctorfrom 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-skills2 plugins in one repository ship this exact skill · first indexed Nov 7, 2026
13 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).