@a5c-ai/babysitter-github 0.1.5-staging.f6cb97d6 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -226,7 +226,7 @@ active process library before the cloud agent starts working.
226
226
  | Variable | Default | Description |
227
227
  |----------|---------|-------------|
228
228
  | `CLAUDE_PROJECT_DIR` | CWD | Project root directory (set by Copilot CLI) |
229
- | `BABYSITTER_LOG_DIR` | `~/.a5c/logs` | Log output directory override; default is the user-global Babysitter log root |
229
+ | `BABYSITTER_LOG_DIR` | `<plugin>/.a5c/logs` | Log output directory |
230
230
  | `BABYSITTER_STATE_DIR` | `<cwd>/.a5c` | State directory for session data |
231
231
 
232
232
  ### SDK Version Pinning
@@ -4,9 +4,9 @@ argument-hint: "[run-id] Optional run ID to diagnose. If omitted, uses the most
4
4
  allowed-tools: Read, Grep, Write, Task, Bash, Edit, Grep, Glob, WebFetch, WebSearch, Search, AskUserQuestion, TodoWrite, TodoRead, Skill, BashOutput, KillShell, MultiEdit, LS
5
5
  ---
6
6
 
7
- You are a diagnostic agent for the babysitter runtime. Your job is to perform a comprehensive health check across 14 areas and produce a structured diagnostic report. Follow each section methodically. Track results as you go and produce the final summary at the end.
7
+ You are a diagnostic agent for the babysitter runtime. Your job is to perform a comprehensive health check across 10 areas and produce a structured diagnostic report. Follow each section methodically. Track results as you go and produce the final summary at the end.
8
8
 
9
- Initialize a results tracker with these 14 checks, all starting as PENDING:
9
+ Initialize a results tracker with these 10 checks, all starting as PENDING:
10
10
  1. Run Discovery
11
11
  2. Journal Integrity
12
12
  3. State Cache Consistency
@@ -17,10 +17,6 @@ Initialize a results tracker with these 14 checks, all starting as PENDING:
17
17
  8. Disk Usage
18
18
  9. Process Validation
19
19
  10. Hook Execution Health
20
- 11. Session-ID Provenance
21
- 12. Ancestor Liveness
22
- 13. Concurrent Session Detection
23
- 14. Windows Ancestor-Walk Strategy
24
20
 
25
21
  ---
26
22
 
@@ -181,13 +177,13 @@ Mark as PASS if no issues. Mark as WARN if runaway loops or stale sessions detec
181
177
  **Goal:** Analyze babysitter log files for errors, warnings, and stop hook decisions.
182
178
 
183
179
  Read the last 50 lines of each of these log files (if they exist):
184
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/hooks.log`
185
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-stop-hook.log`
186
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-stop-hook-stderr.log`
187
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-session-start-hook.log`
188
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-session-start-hook-stderr.log`
189
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter.log`
190
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/` and relevant run/session specific logs there
180
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/hooks.log`
181
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-stop-hook.log`
182
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-stop-hook-stderr.log`
183
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-session-start-hook.log`
184
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-session-start-hook-stderr.log`
185
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter.log`
186
+ - `$HOME/.a5c/logs/` and relevant logs and run/session specific logs there
191
187
 
192
188
 
193
189
  For each log file:
@@ -289,7 +285,7 @@ The hooks delegate to the `babysitter` CLI. Check if it is available:
289
285
  Check whether the stop hook has actually been invoked during this run's lifetime:
290
286
 
291
287
  **From log files:**
292
- - Read `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-stop-hook.log` (if it exists).
288
+ - Read `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-stop-hook.log` (if it exists).
293
289
  - Count the number of "Hook script invoked" lines. This is the total invocation count.
294
290
  - Count the number of "CLI exit code=" lines and extract exit codes.
295
291
  - If the log file does not exist or has zero invocations, the stop hook has NOT been running.
@@ -301,7 +297,7 @@ Check whether the stop hook has actually been invoked during this run's lifetime
301
297
  - If no STOP_HOOK_INVOKED events exist in the journal, note that the stop hook has not recorded any decisions for this run.
302
298
 
303
299
  **From stderr:**
304
- - Read `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-stop-hook-stderr.log`.
300
+ - Read `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-stop-hook-stderr.log`.
305
301
  - If it contains error output, display it and diagnose:
306
302
  - "command not found" or exit code 127 → CLI not installed (see 10c)
307
303
  - "MODULE_NOT_FOUND" or "Cannot find module" → SDK package corrupted or not built
@@ -354,65 +350,9 @@ Mark as FAIL if:
354
350
 
355
351
  ---
356
352
 
357
- ## 11. Session-ID Provenance
358
-
359
- **Goal:** Verify how the current babysitter session ID was resolved and flag stale or shadowed values.
360
-
361
- - Invoke: `npx babysitter session:whoami --json`
362
- - Parse the output and inspect the `resolvedFrom` field. Classify as follows:
363
- - `resolvedFrom: "pid-marker"` → mark as PASS ("Session ID derives from the live Claude Code ancestor process -- authoritative").
364
- - `resolvedFrom: "env-file"` → mark as PASS with a note ("CLAUDE_ENV_FILE was used; typically healthy").
365
- - `resolvedFrom: "env-var"` → mark as WARN ("`BABYSITTER_SESSION_ID` is set without a corroborating PID marker. Likely stale from a prior Claude Code session -- see GitHub issue #130").
366
- - Remediation: run `babysitter session:cleanup` and start a fresh Claude Code session, or `unset BABYSITTER_SESSION_ID` before invoking babysitter.
367
- - `resolvedFrom: "none"` → mark as ERROR ("No session ID resolvable. Either no session-start hook fired, or the ancestor walk failed").
368
-
369
- **Env-var shadow check:**
370
- - Independently inspect `envVarPresent` and `envVarMatches` in the output.
371
- - If `envVarPresent && !envVarMatches`, mark as WARN ("`BABYSITTER_SESSION_ID` in env does not match the resolved session ID; a stale value is shadowing the authoritative one. Unset the env var").
372
-
373
- ---
374
-
375
- ## 12. Ancestor Liveness
376
-
377
- **Goal:** Confirm the PID marker references a live Claude Code process.
378
-
379
- - Reuse the `session:whoami --json` output from check 11.
380
- - Inspect the `ancestorAlive` field.
381
- - If `ancestorAlive === false`, mark as ERROR ("The PID marker references a dead Claude Code process").
382
- - Remediation: `babysitter session:cleanup`.
383
- - Otherwise mark as PASS.
384
-
385
- ---
386
-
387
- ## 13. Concurrent Session Detection
388
-
389
- **Goal:** Surface multiple live harness sessions that may compete for the same session ID.
390
-
391
- - Enumerate files in `~/.a5c/` matching the pattern `current-session-*-pid-*`.
392
- - Count markers per harness (derived from the filename).
393
- - If more than one live marker exists for the same harness, mark as INFO ("Multiple live Claude Code / harness sessions detected; ensure each shell scopes `BABYSITTER_SESSION_ID` appropriately -- the PID marker handles this automatically").
394
- - Otherwise mark as PASS.
395
-
396
- ---
397
-
398
- ## 14. Windows Ancestor-Walk Strategy
399
-
400
- **Goal:** Verify the ancestor-walk strategy works on Windows, where `wmic` is no longer guaranteed to be present.
401
-
402
- - Only run this check when `process.platform === 'win32'`. On other platforms, mark as PASS ("Not applicable -- non-Windows platform").
403
- - Attempt the ancestor walk by invoking `npx babysitter session:whoami --json` (reuse output from check 11 if available).
404
- - If resolution succeeded (any `resolvedFrom` other than `none`), mark as PASS.
405
- - If `resolvedFrom: "none"` on Windows:
406
- - Test `wmic` availability: `where wmic` via shell.
407
- - If absent, document that Windows 11 24H2 removed `wmic`; the fallback PowerShell CIM path should handle this.
408
- - If the PowerShell ancestor walk also failed, mark as ERROR with remediation: ensure PowerShell is available (`powershell -NoProfile -Command "Get-CimInstance Win32_Process -Filter ProcessId=$PID"` should work).
409
- - If the cascade works but is slow (>5s on first probe), add an INFO note on first-probe latency.
410
-
411
- ---
412
-
413
353
  ## Final Report
414
354
 
415
- After completing all 14 checks, produce the diagnostic report in this format:
355
+ After completing all 10 checks, produce the diagnostic report in this format:
416
356
 
417
357
  ```
418
358
  ============================================
@@ -439,10 +379,6 @@ OVERALL HEALTH: <HEALTHY | WARNING | CRITICAL>
439
379
  | 8 | Disk Usage | <status> |
440
380
  | 9 | Process Validation | <status> |
441
381
  | 10 | Hook Execution Health | <status> |
442
- | 11 | Session-ID Provenance | <status> |
443
- | 12 | Ancestor Liveness | <status> |
444
- | 13 | Concurrent Session Detection | <status> |
445
- | 14 | Windows Ancestor-Walk Strategy | <status> |
446
382
 
447
383
  --------------------------------------------
448
384
  ISSUES & RECOMMENDATIONS
@@ -456,9 +392,9 @@ OVERALL HEALTH: <HEALTHY | WARNING | CRITICAL>
456
392
  ```
457
393
 
458
394
  **Overall health determination:**
459
- - **HEALTHY**: All 14 checks are PASS (INFO notes are acceptable).
460
- - **WARNING**: At least one check is WARN but none are FAIL or ERROR.
461
- - **CRITICAL**: At least one check is FAIL or ERROR.
395
+ - **HEALTHY**: All 10 checks are PASS.
396
+ - **WARNING**: At least one check is WARN but none are FAIL.
397
+ - **CRITICAL**: At least one check is FAIL.
462
398
 
463
399
  Present the full detailed findings for each check BEFORE the summary table, so the user can see the evidence. End with the summary table and recommendations. Also, create a single HTML report file with all the findings that uses the arwes UI framework and open it for the user in the browser.
464
400
 
@@ -488,25 +424,3 @@ After diagnosing issues, prompt the user to report or fix what was found -- they
488
424
  Example prompt after diagnosis:
489
425
 
490
426
  > "Diagnosis found a stale lock -- process 12847 crashed without cleanup. This is a known edge case in the orchestration loop. Even if you don't want to fix it yourself, reporting it helps: run `/babysitter:contrib bug report: orchestration loop doesn't release lock on unhandled rejection` to open an issue."
491
-
492
- ---
493
-
494
- ## Self-Heal Suggestions
495
-
496
- If any of checks 11-14 surface issues (stale env vars, dead ancestor PIDs, shadowed session IDs, or Windows ancestor-walk failures), suggest the following remediation sequence, in order. Present it as an actionable block:
497
-
498
- ```bash
499
- # 1. Cleanup dead markers and orphaned state files
500
- babysitter session:cleanup --dry-run # preview
501
- babysitter session:cleanup # apply
502
-
503
- # 2. Unset a stale env var
504
- unset BABYSITTER_SESSION_ID
505
-
506
- # 3. Re-bind a run explicitly if needed
507
- babysitter session:resume --session-id <fresh-id> --state-dir ~/.a5c --run-id <runId> --runs-dir .a5c/runs
508
-
509
- # 4. Start a fresh Claude Code session (closes and reopens the session)
510
- ```
511
-
512
- Run steps 1 and 2 first; re-run `/babysitter:doctor` after each step to confirm the session-provenance checks return to PASS. Step 3 is only needed when a specific run must be re-bound to the fresh session. If the issue persists after step 4, escalate via `/debug` or `/babysitter:contrib`.
@@ -30,7 +30,7 @@ if (-not $hasBabysitter) {
30
30
  }
31
31
  }
32
32
 
33
- $LogDir = if ($env:BABYSITTER_LOG_DIR) { $env:BABYSITTER_LOG_DIR } else { Join-Path $HOME ".a5c\logs" }
33
+ $LogDir = if ($env:BABYSITTER_LOG_DIR) { $env:BABYSITTER_LOG_DIR } else { Join-Path $PluginRoot ".a5c\logs" }
34
34
  $LogFile = Join-Path $LogDir "babysitter-session-end-hook.log"
35
35
  New-Item -ItemType Directory -Path $LogDir -Force -ErrorAction SilentlyContinue | Out-Null
36
36
 
@@ -32,7 +32,7 @@ if ! command -v babysitter &>/dev/null; then
32
32
  fi
33
33
  fi
34
34
 
35
- LOG_DIR="${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}"
35
+ LOG_DIR="${BABYSITTER_LOG_DIR:-$PLUGIN_ROOT/.a5c/logs}"
36
36
  LOG_FILE="$LOG_DIR/babysitter-session-end-hook.log"
37
37
 
38
38
  mkdir -p "$LOG_DIR" 2>/dev/null
@@ -14,7 +14,7 @@ $ErrorActionPreference = "Stop"
14
14
  $PluginRoot = if ($env:COPILOT_PLUGIN_DIR) { $env:COPILOT_PLUGIN_DIR } else { Split-Path -Parent $PSScriptRoot }
15
15
  $MarkerFile = Join-Path $PluginRoot ".babysitter-install-attempted"
16
16
 
17
- $LogDir = if ($env:BABYSITTER_LOG_DIR) { $env:BABYSITTER_LOG_DIR } else { Join-Path $HOME ".a5c\logs" }
17
+ $LogDir = if ($env:BABYSITTER_LOG_DIR) { $env:BABYSITTER_LOG_DIR } else { Join-Path $PluginRoot ".a5c\logs" }
18
18
  $LogFile = Join-Path $LogDir "babysitter-session-start-hook.log"
19
19
  New-Item -ItemType Directory -Path $LogDir -Force -ErrorAction SilentlyContinue | Out-Null
20
20
 
@@ -15,7 +15,7 @@ set -euo pipefail
15
15
  PLUGIN_ROOT="${COPILOT_PLUGIN_DIR:-$(cd "$(dirname "$0")/.." && pwd)}"
16
16
  MARKER_FILE="${PLUGIN_ROOT}/.babysitter-install-attempted"
17
17
 
18
- LOG_DIR="${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}"
18
+ LOG_DIR="${BABYSITTER_LOG_DIR:-$PLUGIN_ROOT/.a5c/logs}"
19
19
  LOG_FILE="$LOG_DIR/babysitter-session-start-hook.log"
20
20
  mkdir -p "$LOG_DIR" 2>/dev/null
21
21
 
@@ -29,7 +29,7 @@ if (-not $hasBabysitter) {
29
29
  }
30
30
  }
31
31
 
32
- $LogDir = if ($env:BABYSITTER_LOG_DIR) { $env:BABYSITTER_LOG_DIR } else { Join-Path $HOME ".a5c\logs" }
32
+ $LogDir = if ($env:BABYSITTER_LOG_DIR) { $env:BABYSITTER_LOG_DIR } else { Join-Path $PluginRoot ".a5c\logs" }
33
33
  New-Item -ItemType Directory -Path $LogDir -Force -ErrorAction SilentlyContinue | Out-Null
34
34
 
35
35
  # Capture stdin
@@ -24,7 +24,7 @@ if ! command -v babysitter &>/dev/null; then
24
24
  fi
25
25
  fi
26
26
 
27
- LOG_DIR="${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}"
27
+ LOG_DIR="${BABYSITTER_LOG_DIR:-$PLUGIN_ROOT/.a5c/logs}"
28
28
  mkdir -p "$LOG_DIR" 2>/dev/null
29
29
 
30
30
  INPUT_FILE=$(mktemp 2>/dev/null || echo "/tmp/hook-user-prompt-submitted-$$.json")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a5c-ai/babysitter-github",
3
- "version": "0.1.5-staging.f6cb97d6",
3
+ "version": "0.1.5",
4
4
  "description": "Babysitter orchestration plugin for GitHub Copilot CLI with lifecycle hooks and SDK-managed process-library bootstrapping",
5
5
  "scripts": {
6
6
  "test": "node scripts/sync-command-surfaces.js --check && node test/cloud-agent-install.test.js",
@@ -45,6 +45,6 @@
45
45
  },
46
46
  "homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-github#readme",
47
47
  "dependencies": {
48
- "@a5c-ai/babysitter-sdk": "0.0.188-staging.f6cb97d6"
48
+ "@a5c-ai/babysitter-sdk": "0.0.188"
49
49
  }
50
50
  }
@@ -18,21 +18,24 @@ Read the SDK version from `versions.json` to ensure version compatibility:
18
18
 
19
19
  ```bash
20
20
  SDK_VERSION=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync('${PLUGIN_ROOT}/versions.json','utf8')).sdkVersion||'latest')}catch{console.log('latest')}")
21
- CLI="npx -y @a5c-ai/babysitter-sdk@$SDK_VERSION"
21
+ sudo npm i -g @a5c-ai/babysitter-sdk@$SDK_VERSION
22
+ # sudo is depending on the env and system
22
23
  ```
23
24
 
24
- If `babysitter` is already installed globally at the correct version, you may use `CLI="babysitter"` instead.
25
+ then use the CLI alias: CLI="babysitter"
26
+
27
+ **Alternatively, use the CLI alias:** `CLI="npx -y @a5c-ai/babysitter-sdk@$SDK_VERSION"`
25
28
 
26
29
  ### jq
27
30
 
28
- Make sure `jq` is installed and available in the path. If not, install it.
31
+ make sure you have jq installed and available in the path. if not, install it.
29
32
 
30
33
  ## Instructions
31
34
 
32
35
  Run the following command to get full orchestration instructions:
33
36
 
34
37
  ```bash
35
- $CLI instructions:babysit-skill --harness github-copilot --json
38
+ babysitter instructions:babysit-skill --harness github-copilot --json
36
39
  ```
37
40
 
38
41
  Follow the instructions returned by the command above to orchestrate the run.
@@ -46,9 +49,9 @@ is ignored and cannot block or restart the session.
46
49
  Therefore, you MUST use **in-turn iteration**: run the full orchestration loop
47
50
  within a single session turn. The pattern is:
48
51
 
49
- 1. `$CLI run:iterate --json` -- get pending actions
52
+ 1. `babysitter run:iterate --json` -- get pending actions
50
53
  2. For each pending action: execute it (run tasks, post results via `task:post`)
51
- 3. `$CLI run:iterate --json` -- check for more pending actions
54
+ 3. `babysitter run:iterate --json` -- check for more pending actions
52
55
  4. Repeat steps 2-3 until run completes or reaches a breakpoint requiring user input
53
56
  5. If a breakpoint requires user input, ask the user and post the response, then continue iterating
54
57
 
@@ -60,7 +63,7 @@ the orchestration loop. The agent drives the loop directly by calling
60
63
 
61
64
  ```bash
62
65
  # Initial iterate
63
- RESULT=$($CLI run:iterate --run-id "$RUN_ID" --json)
66
+ RESULT=$(babysitter run:iterate --run-id "$RUN_ID" --json)
64
67
  STATUS=$(echo "$RESULT" | jq -r '.status')
65
68
 
66
69
  while [ "$STATUS" != "completed" ] && [ "$STATUS" != "failed" ]; do
@@ -68,7 +71,7 @@ while [ "$STATUS" != "completed" ] && [ "$STATUS" != "failed" ]; do
68
71
  # ... execute tasks, post results ...
69
72
 
70
73
  # Iterate again
71
- RESULT=$($CLI run:iterate --run-id "$RUN_ID" --json)
74
+ RESULT=$(babysitter run:iterate --run-id "$RUN_ID" --json)
72
75
  STATUS=$(echo "$RESULT" | jq -r '.status')
73
76
  done
74
77
  ```
@@ -5,9 +5,9 @@ description: Diagnose babysitter run health - journal integrity, state cache, ef
5
5
 
6
6
  # doctor
7
7
 
8
- You are a diagnostic agent for the babysitter runtime. Your job is to perform a comprehensive health check across 14 areas and produce a structured diagnostic report. Follow each section methodically. Track results as you go and produce the final summary at the end.
8
+ You are a diagnostic agent for the babysitter runtime. Your job is to perform a comprehensive health check across 10 areas and produce a structured diagnostic report. Follow each section methodically. Track results as you go and produce the final summary at the end.
9
9
 
10
- Initialize a results tracker with these 14 checks, all starting as PENDING:
10
+ Initialize a results tracker with these 10 checks, all starting as PENDING:
11
11
  1. Run Discovery
12
12
  2. Journal Integrity
13
13
  3. State Cache Consistency
@@ -18,10 +18,6 @@ Initialize a results tracker with these 14 checks, all starting as PENDING:
18
18
  8. Disk Usage
19
19
  9. Process Validation
20
20
  10. Hook Execution Health
21
- 11. Session-ID Provenance
22
- 12. Ancestor Liveness
23
- 13. Concurrent Session Detection
24
- 14. Windows Ancestor-Walk Strategy
25
21
 
26
22
  ---
27
23
 
@@ -182,13 +178,13 @@ Mark as PASS if no issues. Mark as WARN if runaway loops or stale sessions detec
182
178
  **Goal:** Analyze babysitter log files for errors, warnings, and stop hook decisions.
183
179
 
184
180
  Read the last 50 lines of each of these log files (if they exist):
185
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/hooks.log`
186
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-stop-hook.log`
187
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-stop-hook-stderr.log`
188
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-session-start-hook.log`
189
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-session-start-hook-stderr.log`
190
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter.log`
191
- - `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/` and relevant run/session specific logs there
181
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/hooks.log`
182
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-stop-hook.log`
183
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-stop-hook-stderr.log`
184
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-session-start-hook.log`
185
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-session-start-hook-stderr.log`
186
+ - `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter.log`
187
+ - `$HOME/.a5c/logs/` and relevant logs and run/session specific logs there
192
188
 
193
189
 
194
190
  For each log file:
@@ -290,7 +286,7 @@ The hooks delegate to the `babysitter` CLI. Check if it is available:
290
286
  Check whether the stop hook has actually been invoked during this run's lifetime:
291
287
 
292
288
  **From log files:**
293
- - Read `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-stop-hook.log` (if it exists).
289
+ - Read `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-stop-hook.log` (if it exists).
294
290
  - Count the number of "Hook script invoked" lines. This is the total invocation count.
295
291
  - Count the number of "CLI exit code=" lines and extract exit codes.
296
292
  - If the log file does not exist or has zero invocations, the stop hook has NOT been running.
@@ -302,7 +298,7 @@ Check whether the stop hook has actually been invoked during this run's lifetime
302
298
  - If no STOP_HOOK_INVOKED events exist in the journal, note that the stop hook has not recorded any decisions for this run.
303
299
 
304
300
  **From stderr:**
305
- - Read `${BABYSITTER_LOG_DIR:-$HOME/.a5c/logs}/babysitter-stop-hook-stderr.log`.
301
+ - Read `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-stop-hook-stderr.log`.
306
302
  - If it contains error output, display it and diagnose:
307
303
  - "command not found" or exit code 127 → CLI not installed (see 10c)
308
304
  - "MODULE_NOT_FOUND" or "Cannot find module" → SDK package corrupted or not built
@@ -355,65 +351,9 @@ Mark as FAIL if:
355
351
 
356
352
  ---
357
353
 
358
- ## 11. Session-ID Provenance
359
-
360
- **Goal:** Verify how the current babysitter session ID was resolved and flag stale or shadowed values.
361
-
362
- - Invoke: `npx babysitter session:whoami --json`
363
- - Parse the output and inspect the `resolvedFrom` field. Classify as follows:
364
- - `resolvedFrom: "pid-marker"` → mark as PASS ("Session ID derives from the live Claude Code ancestor process -- authoritative").
365
- - `resolvedFrom: "env-file"` → mark as PASS with a note ("CLAUDE_ENV_FILE was used; typically healthy").
366
- - `resolvedFrom: "env-var"` → mark as WARN ("`BABYSITTER_SESSION_ID` is set without a corroborating PID marker. Likely stale from a prior Claude Code session -- see GitHub issue #130").
367
- - Remediation: run `babysitter session:cleanup` and start a fresh Claude Code session, or `unset BABYSITTER_SESSION_ID` before invoking babysitter.
368
- - `resolvedFrom: "none"` → mark as ERROR ("No session ID resolvable. Either no session-start hook fired, or the ancestor walk failed").
369
-
370
- **Env-var shadow check:**
371
- - Independently inspect `envVarPresent` and `envVarMatches` in the output.
372
- - If `envVarPresent && !envVarMatches`, mark as WARN ("`BABYSITTER_SESSION_ID` in env does not match the resolved session ID; a stale value is shadowing the authoritative one. Unset the env var").
373
-
374
- ---
375
-
376
- ## 12. Ancestor Liveness
377
-
378
- **Goal:** Confirm the PID marker references a live Claude Code process.
379
-
380
- - Reuse the `session:whoami --json` output from check 11.
381
- - Inspect the `ancestorAlive` field.
382
- - If `ancestorAlive === false`, mark as ERROR ("The PID marker references a dead Claude Code process").
383
- - Remediation: `babysitter session:cleanup`.
384
- - Otherwise mark as PASS.
385
-
386
- ---
387
-
388
- ## 13. Concurrent Session Detection
389
-
390
- **Goal:** Surface multiple live harness sessions that may compete for the same session ID.
391
-
392
- - Enumerate files in `~/.a5c/` matching the pattern `current-session-*-pid-*`.
393
- - Count markers per harness (derived from the filename).
394
- - If more than one live marker exists for the same harness, mark as INFO ("Multiple live Claude Code / harness sessions detected; ensure each shell scopes `BABYSITTER_SESSION_ID` appropriately -- the PID marker handles this automatically").
395
- - Otherwise mark as PASS.
396
-
397
- ---
398
-
399
- ## 14. Windows Ancestor-Walk Strategy
400
-
401
- **Goal:** Verify the ancestor-walk strategy works on Windows, where `wmic` is no longer guaranteed to be present.
402
-
403
- - Only run this check when `process.platform === 'win32'`. On other platforms, mark as PASS ("Not applicable -- non-Windows platform").
404
- - Attempt the ancestor walk by invoking `npx babysitter session:whoami --json` (reuse output from check 11 if available).
405
- - If resolution succeeded (any `resolvedFrom` other than `none`), mark as PASS.
406
- - If `resolvedFrom: "none"` on Windows:
407
- - Test `wmic` availability: `where wmic` via shell.
408
- - If absent, document that Windows 11 24H2 removed `wmic`; the fallback PowerShell CIM path should handle this.
409
- - If the PowerShell ancestor walk also failed, mark as ERROR with remediation: ensure PowerShell is available (`powershell -NoProfile -Command "Get-CimInstance Win32_Process -Filter ProcessId=$PID"` should work).
410
- - If the cascade works but is slow (>5s on first probe), add an INFO note on first-probe latency.
411
-
412
- ---
413
-
414
354
  ## Final Report
415
355
 
416
- After completing all 14 checks, produce the diagnostic report in this format:
356
+ After completing all 10 checks, produce the diagnostic report in this format:
417
357
 
418
358
  ```
419
359
  ============================================
@@ -440,10 +380,6 @@ OVERALL HEALTH: <HEALTHY | WARNING | CRITICAL>
440
380
  | 8 | Disk Usage | <status> |
441
381
  | 9 | Process Validation | <status> |
442
382
  | 10 | Hook Execution Health | <status> |
443
- | 11 | Session-ID Provenance | <status> |
444
- | 12 | Ancestor Liveness | <status> |
445
- | 13 | Concurrent Session Detection | <status> |
446
- | 14 | Windows Ancestor-Walk Strategy | <status> |
447
383
 
448
384
  --------------------------------------------
449
385
  ISSUES & RECOMMENDATIONS
@@ -457,9 +393,9 @@ OVERALL HEALTH: <HEALTHY | WARNING | CRITICAL>
457
393
  ```
458
394
 
459
395
  **Overall health determination:**
460
- - **HEALTHY**: All 14 checks are PASS (INFO notes are acceptable).
461
- - **WARNING**: At least one check is WARN but none are FAIL or ERROR.
462
- - **CRITICAL**: At least one check is FAIL or ERROR.
396
+ - **HEALTHY**: All 10 checks are PASS.
397
+ - **WARNING**: At least one check is WARN but none are FAIL.
398
+ - **CRITICAL**: At least one check is FAIL.
463
399
 
464
400
  Present the full detailed findings for each check BEFORE the summary table, so the user can see the evidence. End with the summary table and recommendations. Also, create a single HTML report file with all the findings that uses the arwes UI framework and open it for the user in the browser.
465
401
 
@@ -489,25 +425,3 @@ After diagnosing issues, prompt the user to report or fix what was found -- they
489
425
  Example prompt after diagnosis:
490
426
 
491
427
  > "Diagnosis found a stale lock -- process 12847 crashed without cleanup. This is a known edge case in the orchestration loop. Even if you don't want to fix it yourself, reporting it helps: run `/babysitter:contrib bug report: orchestration loop doesn't release lock on unhandled rejection` to open an issue."
492
-
493
- ---
494
-
495
- ## Self-Heal Suggestions
496
-
497
- If any of checks 11-14 surface issues (stale env vars, dead ancestor PIDs, shadowed session IDs, or Windows ancestor-walk failures), suggest the following remediation sequence, in order. Present it as an actionable block:
498
-
499
- ```bash
500
- # 1. Cleanup dead markers and orphaned state files
501
- babysitter session:cleanup --dry-run # preview
502
- babysitter session:cleanup # apply
503
-
504
- # 2. Unset a stale env var
505
- unset BABYSITTER_SESSION_ID
506
-
507
- # 3. Re-bind a run explicitly if needed
508
- babysitter session:resume --session-id <fresh-id> --state-dir ~/.a5c --run-id <runId> --runs-dir .a5c/runs
509
-
510
- # 4. Start a fresh Claude Code session (closes and reopens the session)
511
- ```
512
-
513
- Run steps 1 and 2 first; re-run `/babysitter:doctor` after each step to confirm the session-provenance checks return to PASS. Step 3 is only needed when a specific run must be re-bound to the fresh session. If the issue persists after step 4, escalate via `/debug` or `/babysitter:contrib`.
package/versions.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "sdkVersion": "0.0.188-staging.f6cb97d6"
2
+ "sdkVersion": "0.0.188"
3
3
  }