Skip to content

[Docs] Question: doctor /skill:doctor SKILL.md sections 6/7/10 hard-code Claude Code plugin layout — false-FAIL on Pi (and other non-StopHook harnesses) #877

@nhvvin

Description

@nhvvin

Documentation Question

The /skill:doctor SKILL.md (and its sibling commands/doctor.md) is shipped byte-for-byte identical across every harness plugin (babysitter-codex, babysitter-cursor, babysitter-github, babysitter-omp, babysitter-opencode, babysitter-pi), but its hook-related sections are written exclusively for the Claude Code plugin layout. On the Pi harness (npm:@a5c-ai/babysitter-pi) those code paths can never succeed, so the doctor reports false FAILs on a perfectly healthy run.

Specifically:

  • Section 6 — Session State tells the agent to glob plugins/babysitter/skills/babysit/state/*.md. On Pi the package is installed under ~/.pi/agent/npm/node_modules/@a5c-ai/babysitter-pi/skills/babysit/state/*.md; that glob is wrong by design.
  • Section 7 — Log Analysis reads $CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-stop-hook.log, …/babysitter-session-start-hook.log, etc. CLAUDE_PLUGIN_ROOT does not exist in a Pi session, so every one of those reads degrades to "Not found".
  • Section 10 — Hook Execution Health is the most striking: it walks plugins/babysitter/hooks/hooks.json, hooks/babysitter-stop-hook.sh, hooks/babysitter-session-start-hook.sh, and finally ~/.claude/settings.json / ~/.claude/plugins/installed_plugins.json. Pi has none of those files; the SDK's own packages/sdk/src/harness/pi.ts declares supportsHookType() returns false and emits the message "Pi does not use babysitter hook:run for ... Use the Pi package skills and extension bridge instead." — but the doctor SKILL is unaware of this and marks Section 10 as FAIL.
  • The /babysitter:contrib postscript at the bottom of commands/doctor.md even instructs users to call Claude Code's /debug slash command, which doesn't exist in Pi.

Net effect on Pi: a healthy run shows up as CRITICAL in the final report on the strength of false negatives in 6/7/10, even though sections 1–5, 8, 9 pass cleanly.

The SDK already encodes the right answer; the SKILL just doesn't ask. What's the canonical fix the project wants here?

Topic Area

plugins/<harness>/skills/doctor/SKILL.md and plugins/<harness>/commands/doctor.md — harness-aware skill content. Expected doc type: harness-aware skill source / per-harness branching guidance (or, if the project prefers, a single Pi-specific equivalent for sections 6/7/10).

What I've Searched

  • CLAUDE.md, AGENTS.md, CONTRIBUTING.md, CHANGELOG.md, README.md (root)
  • All six plugins/*/skills/doctor/SKILL.md — all md5 ccc1a16f8f267a08cc4b429d6340e08f, 427 lines, byte-for-byte identical.
  • All six plugins/*/commands/doctor.md — same Claude-Code-shaped content.
  • plugins/babysitter-pi/extensions/index.ts — confirms Pi exposes slash commands via pi.registerCommand (babysit, babysitter, assimilate, call, cleanup, contrib, doctor, forever, help, observe, plan, plugins, project-install, resume, retrospect, user-install, yolo, plus babysitter:<name> aliases). No Stop / SessionStart hook scripts are registered.
  • packages/sdk/src/harness/{discovery,pi,types,registry}.ts and the harness adapter siblings — see "Existing machinery" below.
  • docs/assimilation/harness/{claude-code-integration,generic-harness-guide}.md.
  • library/specializations/meta/harnesses/pi/.
  • GitHub issue search across this repo on the following queries (all combined open + closed): doctor SKILL.md harness, doctor Pi flavor, doctor stop hook claude, skill harness aware, doctor hook execution health, doctor claude plugin layout, doctor false fail pi. No existing issue covers this.

The closest open issue, #876, is a different bug (Pi resource-path crash inside pi-coding-agent's package-manager). The cluster of closed Claude-Code stop-hook bugs (#69, #107, #130, #133, #138, #139, #160, #166, #170) all assume the same Claude-Code layout that doctor SKILL.md hard-codes — they reinforce the question rather than answer it.

Expected Documentation

I think this is really a code question masquerading as a docs question — the doctor SKILL.md is the documentation-as-skill. So the resolution is most likely either:

Option (a) — Recommended: harness-aware doctor that consults KNOWN_HARNESSES / capability bits. The SDK already exposes everything you need:

  • KNOWN_HARNESSES in packages/sdk/src/harness/discovery.ts lists every harness with its capability set:
    • claude-code[SessionBinding, StopHook, Mcp, HeadlessPrompt]
    • pi[Programmatic, SessionBinding, HeadlessPrompt] (no StopHook)
    • cursor[…, StopHook, …], opencode[HeadlessPrompt], etc.
  • detectCallerHarness() in the same file resolves the active harness from env vars (CLAUDE_ENV_FILE → claude-code, PI_SESSION_ID/PI_PLUGIN_ROOT → pi, …).
  • pi.ts#supportsHookType() returns false; getUnsupportedHookMessage() produces a ready-made "use the Pi extension bridge instead" string.

The doctor SKILL could open with a "Phase 0: Detect harness" step that calls detectCallerHarness() and asks the SDK whether the active adapter has Cap.StopHook. If it doesn't, sections 6/7/10 emit a single N/A — harness <name> does not register stop / session-start hooks (KNOWN_HARNESSES capability set: …) line and skip cleanly. The verdict logic should treat N/A as neither pass nor fail.

Option (b) — replacement Pi-specific 6/7/10. If the project prefers explicit per-harness skill bodies, the Pi versions of those sections should validate:

  • 6 (Session State): glob ~/.pi/agent/npm/node_modules/@a5c-ai/babysitter-pi/skills/babysit/state/*.md plus .a5c/state/* (already covered).
  • 7 (Log Analysis): drop $CLAUDE_PLUGIN_ROOT/.a5c/logs/* (no analogue on Pi) and either (i) skip log analysis entirely or (ii) point at whatever the Pi extension chooses to log.
  • 10 (Hook Execution Health): replace with "Pi extension registration health" — verify ~/.pi/agent/settings.json lists npm:@a5c-ai/babysitter-pi, that ~/.pi/agent/npm/node_modules/@a5c-ai/babysitter-pi/extensions/index.ts resolves, and that pi.registerCommand registers the expected slash commands.

I'd recommend (a) because it scales to all harnesses (cursor and codex have similar mismatches in opposite directions) and reuses authoritative SDK detection rather than duplicating the truth across six SKILL.md copies.

Related Documentation

  • packages/sdk/src/harness/discovery.tsKNOWN_HARNESSES, detectCallerHarness(), discoverHarnesses().
  • packages/sdk/src/harness/types.tsHarnessCapability enum (Programmatic, SessionBinding, StopHook, Mcp, HeadlessPrompt).
  • packages/sdk/src/harness/pi.tscreatePiAdapter, supportsHookType(), getUnsupportedHookMessage().
  • docs/assimilation/harness/claude-code-integration.md and docs/assimilation/harness/generic-harness-guide.md — per-harness integration docs (do not cover doctor portability).
  • CHANGELOG.md — entries "Doctor command enhanced with hook execution health diagnostics" and "Auto-detection of harness environment when binding sessions" both shipped, but the harness-detection work didn't propagate into the doctor SKILL.

Reproduction

Reproduced against a fresh clean run on the Pi harness:

  • Run: 01KT5T02R3G3ZTS7X2THYWE8FP (process cradle/project-install, completed HEALTHY at the journal level).
  • Env: babysitter-sdk 0.0.187, Pi extension npm:@a5c-ai/babysitter-pi registered via ~/.pi/agent/settings.json.
  • Steps:
    1. From a Pi session in the repo root: /skill:doctor (or /babysitter:doctor).
    2. Sections 1–5, 8, 9: PASS. Section 6: WARN (no Claude-shaped session state files). Sections 7 + 10: FAIL (CLAUDE_PLUGIN_ROOT empty; no plugins/babysitter/hooks/*.sh; no ~/.claude/...).
    3. Final verdict: CRITICAL even though every functionally meaningful check passed.

The byte-identical SKILL.md is verifiable with:

md5sum plugins/*/skills/doctor/SKILL.md
# all six → ccc1a16f8f267a08cc4b429d6340e08f

Happy to send a PR for option (a) if the maintainers agree on the direction.

Metadata

Metadata

Assignees

Labels

automated-triageCreated or updated by automated triagebugSomething isn't workingdocumentationImprovements or additions to documentationeffort:mediumMedium implementation effortplugin-pipluginsPlugin system componentpriority:mediumMedium priority issue with meaningful workflow impactready-for-devTriaged and ready for developmentroot-causeRoot cause analysis ticketsdkSDK package and CLI runtime

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions