skills/olakai-monitor-doctor/SKILL.md
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, broken/deleted agent, drifted config). For first-time setup use olakai-monitor-local-coding-agent instead. AUTO-INVOKE when user says: my coding-tool monitoring isn't working, no events from Claude Code / Codex / Cursor, is monitoring on / working, check my olakai monitoring, what's monitored on this machine, monitor doctor, monitor repair, monitor list, fix my monitoring, my monitored agent disappeared / 404, hooks stopped firing, re-link my monitoring key. TRIGGER KEYWORDS: olakai monitor doctor, olakai monitor repair, olakai monitor list, monitor not working, no events claude code, no events codex, no events cursor, fix monitoring, repair monitoring, agent 404, agent missing, hooks stopped firing, drift, registry, agents mine, where am i monitoring, is my monitoring working, self-heal monitoring. 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), generic SDK / KPI / event troubleshooting unrelated to a coding tool (use olakai-troubleshoot).
npx skillsauth add olakai-ai/olakai-skills olakai-monitor-doctorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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. Upgrade:npm install -g olakai-cli@latest.
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 | Agent deleted (404) → 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) | Hooks installed but never fired → run a turn, then re-check; if still empty see the unattributed-activity caveat below |
--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.
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)
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 which| | monitor 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 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.json (this workspace only) |
| 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).
⚠️ 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.
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).
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
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.tools
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 explains how to enrich events with KPIs. This is the skill for "monitor my coding tool itself" (not for instrumenting your own agent's source code with the SDK — that is olakai-integrate). AUTO-INVOKE when user wants to: monitor Claude Code / Codex / Cursor / Gemini CLI / Antigravity CLI sessions, monitor THIS coding tool, add observability to a local coding agent, track my own coding-assistant usage, set up olakai monitoring in this workspace, see what is being monitored on this machine, check if monitoring is working, or enable / repair hooks-based monitoring for any local coding agent. TRIGGER KEYWORDS: olakai monitor, monitor my coding tool, monitor this tool, monitor claude code, monitor codex, monitor cursor, monitor gemini cli, monitor antigravity, codex cli, cursor hooks, gemini cli, gemini-cli hooks, antigravity cli, antigravity, agy, local coding agent, local agent monitoring, olakai hooks, olakai monitor init, olakai monitor list, olakai monitor doctor, olakai monitor repair, monitor workspace, track sessions, is my monitoring working, monitoring not working, no events from claude code, claude code monitoring, codex monitoring, cursor monitoring, agents mine, where am i monitoring. DO NOT load for: instrumenting your own agent's SDK code (use olakai-integrate), creating agents from scratch with custom code (use olakai-new-project), generic SDK / KPI / event troubleshooting unrelated to a coding tool (use olakai-troubleshoot).
tools
Diagnose and fix issues with events, KPIs, custom data, or SDK integration. AUTO-INVOKE when user mentions: events not appearing, KPIs showing wrong values, KPIs showing strings instead of numbers, custom data missing, null KPIs, authentication errors, CLI not working, events not associated with agent, monitoring broken, SDK errors, or any Olakai-related problem. TRIGGER KEYWORDS: olakai, troubleshoot, debug, not working, events missing, KPI wrong, KPI null, KPI string, customData missing, authentication failed, CLI error, no events, events not appearing, diagnose, fix olakai, broken, SDK error, monitoring issue, API key invalid, events not tracked. DO NOT load for: initial setup (use olakai-new-project or olakai-integrate), or generating reports (use olakai-reports).
tools
Generate usage summaries, KPI trends, ROI reports, and compliance analytics from the terminal. AUTO-INVOKE when user wants: usage summaries, KPI trends, risk analysis, ROI reports, efficiency metrics, agent comparisons, token usage reports, cost analysis, compliance reports, or any analytics without using the web dashboard. TRIGGER KEYWORDS: olakai, analytics, reports, usage summary, KPI trends, risk analysis, ROI, efficiency, agent comparison, token usage, cost analysis, metrics report, dashboard data, CLI analytics, terminal report, compliance, usage report, event summary, performance metrics, AI usage stats. DO NOT load for: setting up monitoring (use olakai-integrate), troubleshooting (use olakai-troubleshoot), or creating new agents (use olakai-new-project).
development
Create detailed implementation plans for Olakai monitoring that can be executed independently. AUTO-INVOKE when: Creating a plan for Olakai monitoring, writing implementation steps for AI observability, planning agent creation or SDK integration, entering plan mode for Olakai work, designing monitoring architecture. TRIGGER KEYWORDS: plan, implementation plan, steps, roadmap, architecture, design, olakai plan, monitoring plan, agent plan, planning, plan mode. DO NOT load for: Executing implementation (use olakai-new-project or olakai-integrate), troubleshooting (use olakai-troubleshoot), generating reports (use olakai-reports).