@a5c-ai/babysitter-github 0.1.1-staging.0825aadb

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.
Files changed (44) hide show
  1. package/.github/plugin.json +25 -0
  2. package/AGENTS.md +41 -0
  3. package/README.md +545 -0
  4. package/bin/cli.js +104 -0
  5. package/bin/install-shared.js +450 -0
  6. package/bin/install.js +81 -0
  7. package/bin/uninstall.js +76 -0
  8. package/commands/assimilate.md +37 -0
  9. package/commands/call.md +7 -0
  10. package/commands/cleanup.md +20 -0
  11. package/commands/contrib.md +33 -0
  12. package/commands/doctor.md +426 -0
  13. package/commands/forever.md +7 -0
  14. package/commands/help.md +244 -0
  15. package/commands/observe.md +12 -0
  16. package/commands/plan.md +7 -0
  17. package/commands/plugins.md +255 -0
  18. package/commands/project-install.md +17 -0
  19. package/commands/resume.md +8 -0
  20. package/commands/retrospect.md +55 -0
  21. package/commands/user-install.md +17 -0
  22. package/commands/yolo.md +7 -0
  23. package/hooks/session-end.ps1 +68 -0
  24. package/hooks/session-end.sh +65 -0
  25. package/hooks/session-start.ps1 +110 -0
  26. package/hooks/session-start.sh +100 -0
  27. package/hooks/user-prompt-submitted.ps1 +51 -0
  28. package/hooks/user-prompt-submitted.sh +41 -0
  29. package/hooks.json +29 -0
  30. package/package.json +50 -0
  31. package/plugin.json +25 -0
  32. package/scripts/sync-command-surfaces.js +62 -0
  33. package/scripts/team-install.js +86 -0
  34. package/skills/assimilate/SKILL.md +38 -0
  35. package/skills/babysit/SKILL.md +77 -0
  36. package/skills/call/SKILL.md +8 -0
  37. package/skills/doctor/SKILL.md +427 -0
  38. package/skills/help/SKILL.md +245 -0
  39. package/skills/observe/SKILL.md +13 -0
  40. package/skills/plan/SKILL.md +8 -0
  41. package/skills/resume/SKILL.md +9 -0
  42. package/skills/retrospect/SKILL.md +56 -0
  43. package/skills/user-install/SKILL.md +18 -0
  44. package/versions.json +3 -0
@@ -0,0 +1,33 @@
1
+ ---
2
+ description: Submit feedback or contribute to babysitter project
3
+ argument-hint: Specific instructions for the run.
4
+ allowed-tools: Read, Grep, Write, Task, Bash, Edit, Grep, Glob, WebFetch, WebSearch, Search, AskUserQuestion, TodoWrite, TodoRead, Skill, BashOutput, KillShell, MultiEdit, LS
5
+ ---
6
+
7
+ Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
8
+
9
+ ## Process Routing
10
+
11
+ Contribution processes live under the active process library's `cradle/` directory. Resolve the active library root with `babysitter process-library:active --json` and route based on arguments:
12
+
13
+ ### Issue-based (opens a GitHub issue in a5c-ai/babysitter)
14
+ * **Bug report** → `cradle/bug-report.js#process` — Report a bug in the SDK, CLI, process library, etc.
15
+ * **Feature request** → `cradle/feature-request.js#process` — Request a new feature or enhancement
16
+ * **Documentation question** → `cradle/documentation-question.js#process` — Ask about undocumented behavior or missing docs
17
+
18
+ ### PR-based (forks repo, creates branch, submits PR to a5c-ai/babysitter)
19
+ * **Bugfix** → `cradle/bugfix.js#process` — User already has the fix for a bug
20
+ * **Feature implementation** → `cradle/feature-implementation-contribute.js#process` — User already has a feature implementation
21
+ * **Harness integration** → `cradle/feature-harness-integration-contribute.js#process` — User has a harness (CI/CD, IDE, editor) integration
22
+ * **Library contribution** → `cradle/library-contribution.js#process` — New or improved process/skill/subagent for the library
23
+ * **Documentation answer** → `cradle/documentation-contribute-answer.js#process` — User has an answer for an unanswered docs question
24
+
25
+ ### Router (when arguments are empty or general)
26
+ * **Contribute** → `cradle/contribute.js#process` — Explains contribution types and routes to the specific process
27
+
28
+ ## Contribution Rules
29
+
30
+ * PR-based contributions: fork the babysitter repo (a5c-ai/babysitter) for the user, ask to star if not already starred, perform changes, submit PR
31
+ * Issue-based contributions: gather details, search for duplicates, review, then open an issue in a5c-ai/babysitter
32
+ * Add breakpoints (permissions) before ALL gh actions (fork, star, submit PR/issue) to allow user review and cancellation
33
+ * If arguments are empty: use the `contribute.js` router process to show options and route accordingly
@@ -0,0 +1,426 @@
1
+ ---
2
+ description: Diagnose babysitter run health - journal integrity, state cache, effects, locks, sessions, logs, and disk usage
3
+ argument-hint: "[run-id] Optional run ID to diagnose. If omitted, uses the most recent run."
4
+ allowed-tools: Read, Grep, Write, Task, Bash, Edit, Grep, Glob, WebFetch, WebSearch, Search, AskUserQuestion, TodoWrite, TodoRead, Skill, BashOutput, KillShell, MultiEdit, LS
5
+ ---
6
+
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
+
9
+ Initialize a results tracker with these 10 checks, all starting as PENDING:
10
+ 1. Run Discovery
11
+ 2. Journal Integrity
12
+ 3. State Cache Consistency
13
+ 4. Effect Status
14
+ 5. Lock Status
15
+ 6. Session State
16
+ 7. Log Analysis
17
+ 8. Disk Usage
18
+ 9. Process Validation
19
+ 10. Hook Execution Health
20
+
21
+ ---
22
+
23
+ ## 1. Run Discovery
24
+
25
+ **Goal:** Identify the target run and display its metadata.
26
+
27
+ - List all runs by running: `ls -lt .a5c/runs/`
28
+ - If the user provided a run ID argument, use that as the run ID. Otherwise, use the most recent run directory (the first entry from the listing).
29
+ - Store the resolved run ID and construct the run directory path: `.a5c/runs/<runId>`
30
+ - Verify the run directory exists. If it does not exist, report FAIL for this check and stop the entire diagnostic (no run to diagnose).
31
+ - Show run metadata by running: `npx babysitter run:status .a5c/runs/<runId> --json`
32
+ - Parse and display: runId, processId, entrypoint/importPath, createdAt, current state.
33
+ - Mark this check as PASS.
34
+
35
+ ---
36
+
37
+ ## 2. Journal Integrity
38
+
39
+ **Goal:** Verify the append-only event journal is well-formed and uncorrupted.
40
+
41
+ - List all journal events by running: `npx babysitter run:events .a5c/runs/<runId> --json`
42
+ - List all files in `.a5c/runs/<runId>/journal/` sorted by name.
43
+ - If the journal directory is empty or missing, mark as FAIL and note "No journal entries found."
44
+
45
+ For each journal file (named `<seq>.<ulid>.json`):
46
+
47
+ **Sequential numbering check:**
48
+ - Extract the sequence number prefix from each filename (e.g., `000001` from `000001.01JAXYZ.json`).
49
+ - Verify sequence numbers are contiguous starting from 000001 with no gaps.
50
+ - If gaps found, mark as WARN and list the missing sequence numbers.
51
+
52
+ **Checksum verification:**
53
+
54
+ The SDK computes checksums as follows: it first builds the event payload **without** the `checksum` field (`{ type, recordedAt, data }`), serializes it with `JSON.stringify(payload, null, 2) + "\n"` (pretty-printed with a trailing newline), then computes SHA256 of that string. To verify:
55
+
56
+ - Read each journal file as JSON.
57
+ - Extract and remove the `checksum` field from the parsed object.
58
+ - Re-serialize the remaining object with `JSON.stringify(remaining, null, 2) + "\n"` — **must** use 2-space indentation and a trailing newline to match the SDK.
59
+ - Compute SHA256 (hex) of that exact string.
60
+ - Compare computed checksum with the stored checksum.
61
+ - If any mismatch, mark as FAIL and list the corrupt files.
62
+
63
+ Example bash one-liner for a single file:
64
+ ```bash
65
+ node -e "const fs=require('fs'); const f=process.argv[1]; const obj=JSON.parse(fs.readFileSync(f,'utf8')); const stored=obj.checksum; delete obj.checksum; const expected=require('crypto').createHash('sha256').update(JSON.stringify(obj,null,2)+'\n').digest('hex'); console.log(stored===expected?'OK':'MISMATCH',f)" <file>
66
+ ```
67
+
68
+ **Timestamp monotonicity check:**
69
+ - Extract `recordedAt` from each event.
70
+ - Verify each timestamp is >= the previous one.
71
+ - If any timestamp goes backward, mark as WARN and list the offending entries.
72
+
73
+ **Event type summary:**
74
+ - Count events by type: RUN_CREATED, EFFECT_REQUESTED, EFFECT_RESOLVED, STOP_HOOK_INVOKED, RUN_COMPLETED, RUN_FAILED, and any other types encountered.
75
+ - Display the counts in a table.
76
+
77
+ **Orphan detection:**
78
+ - Flag any files in the journal directory that do not match the expected `<seq>.<ulid>.json` naming pattern.
79
+
80
+ If all sub-checks pass, mark as PASS. If any sub-check is WARN, mark as WARN. If any sub-check is FAIL, mark as FAIL.
81
+
82
+ ---
83
+
84
+ ## 3. State Cache Consistency
85
+
86
+ **Goal:** Verify the derived state cache matches the current journal.
87
+
88
+ - Check if `.a5c/runs/<runId>/state/state.json` exists.
89
+ - If it does not exist, mark as WARN and recommend: `npx babysitter run:rebuild-state .a5c/runs/<runId>`
90
+
91
+ If it exists:
92
+ - Read `state.json` and extract the `journalHead` field (contains `seq`, `ulid`, and `checksum`).
93
+ - Determine the actual last journal entry by reading the last file in `.a5c/runs/<runId>/journal/` (highest sequence number).
94
+ - Extract the sequence number and ULID from the last journal filename, and the checksum from its content.
95
+ - Compare:
96
+ - `journalHead.seq` should match the last journal file's sequence number.
97
+ - `journalHead.ulid` should match the last journal file's ULID.
98
+ - `journalHead.checksum` should match the last journal file's checksum.
99
+ - If all match, mark as PASS.
100
+ - If any mismatch, mark as WARN and recommend: `npx babysitter run:rebuild-state .a5c/runs/<runId>`
101
+ - Also verify `schemaVersion` field is present and report its value.
102
+
103
+ ---
104
+
105
+ ## 4. Effect Status
106
+
107
+ **Goal:** Identify stuck, errored, or pending effects.
108
+
109
+ - Run: `npx babysitter task:list .a5c/runs/<runId> --json`
110
+ - Run: `npx babysitter task:list .a5c/runs/<runId> --pending --json`
111
+ - Parse the JSON output from both commands.
112
+
113
+ **All effects summary:**
114
+ - Count total effects, resolved effects, and pending effects.
115
+ - Group and count effects by `kind` (node, breakpoint, orchestrator_task, sleep, etc.).
116
+
117
+ **Stuck effect detection:**
118
+ - For each pending effect, check its `requestedAt` timestamp.
119
+ - If any pending effect was requested more than 30 minutes ago, flag it as STUCK.
120
+ - List stuck effects with their effectId, kind, taskId, and age.
121
+
122
+ **Error detection:**
123
+ - Identify any effects with error status in their results.
124
+ - List errored effects with their effectId and error message.
125
+
126
+ **Pending summary:**
127
+ - Summarize pending effects grouped by kind with count per kind.
128
+
129
+ Mark as PASS if no stuck or errored effects. Mark as WARN if there are pending effects older than 30 minutes. Mark as FAIL if there are errored effects.
130
+
131
+ ---
132
+
133
+ ## 5. Lock Status
134
+
135
+ **Goal:** Detect stale or orphaned run locks.
136
+
137
+ - Check if `.a5c/runs/<runId>/run.lock` exists.
138
+ - If it does not exist, mark as PASS ("No lock held -- run is not actively being iterated").
139
+
140
+ If it exists:
141
+ - Read the lock file (JSON with `pid`, `owner`, `acquiredAt`).
142
+ - Display the lock info: PID, owner, acquired time, and age of the lock.
143
+ - Check if the PID is still alive by running: `kill -0 <pid> 2>/dev/null; echo $?` (exit code 0 means alive, non-zero means dead). On Windows/MINGW, use `tasklist //FI "PID eq <pid>" 2>/dev/null` or equivalent.
144
+ - If the process is alive, mark as PASS ("Lock held by active process").
145
+ - If the process is dead, mark as FAIL ("Stale lock detected -- process <pid> is no longer running").
146
+ - Recommend: `rm .a5c/runs/<runId>/run.lock`
147
+
148
+ ---
149
+
150
+ ## 6. Session State
151
+
152
+ **Goal:** Inspect babysitter session files for health and detect runaway loops.
153
+
154
+ - Search for session state files using Glob:
155
+ - `plugins/babysitter/skills/babysit/state/*.md`
156
+ - `.a5c/state/*.md`
157
+ - `.a5c/state/*.json`
158
+ - For each session state file found:
159
+ - Read the file and extract available information: iteration count, associated runId, timestamps, session status.
160
+ - Display: filename, iteration count, runId (if present), last activity time.
161
+
162
+ **Runaway loop detection:**
163
+ - If any session file contains iteration timing data, compute the average time between iterations.
164
+ - If the average iteration time is less than 3 seconds, flag as WARN ("Possible runaway loop detected -- average iteration time is under 3 seconds").
165
+
166
+ **Session classification:**
167
+ - Active: session has recent activity (within last 30 minutes).
168
+ - Stale: session has no activity for more than 30 minutes.
169
+ - Display counts of active vs stale sessions.
170
+
171
+ Mark as PASS if no issues. Mark as WARN if runaway loops or stale sessions detected.
172
+
173
+ ---
174
+
175
+ ## 7. Log Analysis
176
+
177
+ **Goal:** Analyze babysitter log files for errors, warnings, and stop hook decisions.
178
+
179
+ Read the last 50 lines of each of these log files (if they exist):
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
187
+
188
+
189
+ For each log file:
190
+ - If the file does not exist, note it as "Not found (OK if hooks have not run yet)."
191
+ - If the file exists, analyze its content.
192
+
193
+ **Stop hook analysis (babysitter-stop-hook.log):**
194
+ - Count lines containing "approve" vs "block" decisions (case-insensitive).
195
+ - Display the approve/block ratio.
196
+ - Show the last 20 stop hook decision entries (lines containing "approve" or "block").
197
+ - Count and display CLI exit codes from lines containing "CLI exit code=".
198
+
199
+ **Stderr analysis (babysitter-stop-hook-stderr.log, babysitter-session-start-hook-stderr.log):**
200
+ - If stderr logs contain content, display the last 20 lines from each.
201
+ - Look for common failure patterns: "command not found", "MODULE_NOT_FOUND", "ENOENT", "EACCES", "permission denied", "npm ERR", "Cannot find module".
202
+ - Flag any stderr content as a potential issue.
203
+
204
+ **Error/Warning detection (all logs):**
205
+ - Count and list lines containing "ERROR" or "WARN" (case-insensitive).
206
+ - Display the last 10 error/warning lines from each log.
207
+
208
+ Mark as PASS if no ERROR lines found and stderr logs are empty. Mark as WARN if WARN lines found or stderr has content but no ERROR. Mark as FAIL if ERROR lines found.
209
+
210
+ ---
211
+
212
+ ## 8. Disk Usage
213
+
214
+ **Goal:** Report disk consumption and identify oversized files.
215
+
216
+ - Run `du -sh .a5c/runs/<runId>` for the total run directory size.
217
+ - Run `du -sh` on each subdirectory:
218
+ - `.a5c/runs/<runId>/journal/`
219
+ - `.a5c/runs/<runId>/tasks/`
220
+ - `.a5c/runs/<runId>/blobs/`
221
+ - `.a5c/runs/<runId>/state/`
222
+ - `.a5c/runs/<runId>/process/` (if it exists)
223
+
224
+ - Display results in a table: directory, size.
225
+
226
+ **Large file detection:**
227
+ - Find individual files larger than 10MB within the run directory: `find .a5c/runs/<runId> -type f -size +10M -exec ls -lh {} \;`
228
+ - If any found, list them with their paths and sizes.
229
+
230
+ - Report the total run directory size prominently.
231
+
232
+ Mark as PASS if total size < 500MB and no files > 10MB. Mark as WARN if total size > 500MB or any files > 10MB. Mark as FAIL if total size > 2GB.
233
+
234
+ ---
235
+
236
+ ## 9. Process Validation
237
+
238
+ **Goal:** Verify the process entrypoint and SDK dependency are valid.
239
+
240
+ - Read `.a5c/runs/<runId>/run.json` and extract the `importPath` (or `entrypoint`) field.
241
+ - Check if the referenced process file exists on disk. Use Glob or file read to verify.
242
+ - If the file does not exist, mark as FAIL ("Process entrypoint not found on disk").
243
+
244
+ **SDK dependency check:**
245
+ - Read `.a5c/package.json` (if it exists) or the project root `package.json`.
246
+ - Check for `@a5c-ai/babysitter-sdk` in `dependencies` or `devDependencies`.
247
+ - Report the installed version.
248
+ - If the dependency is missing, mark as WARN.
249
+ - If present, verify it looks like a valid semver version and mark as PASS.
250
+
251
+ ---
252
+
253
+ ## 10. Hook Execution Health
254
+
255
+ **Goal:** Verify that the stop hook and session-start hook are properly configured, can execute, and have been running. If the stop hook has NOT been running, diagnose why.
256
+
257
+ ### 10a. Hook Registration
258
+
259
+ - Locate the plugin root. Check for `CLAUDE_PLUGIN_ROOT` env var, or search for `plugins/babysitter/hooks/hooks.json` by walking up from the current directory.
260
+ - If found, read `hooks.json` and verify:
261
+ - A `Stop` hook entry exists with a command referencing `babysitter-stop-hook.sh`.
262
+ - A `SessionStart` hook entry exists with a command referencing `babysitter-session-start-hook.sh`.
263
+ - If `hooks.json` is not found, mark as FAIL ("Hook registration file not found — hooks are not registered with Claude Code").
264
+
265
+ ### 10b. Hook Script Availability
266
+
267
+ - Locate the hook scripts relative to the plugin root:
268
+ - `hooks/babysitter-stop-hook.sh`
269
+ - `hooks/babysitter-session-start-hook.sh`
270
+ - For each script:
271
+ - Check if the file exists.
272
+ - Check if it is executable (`test -x <path>`).
273
+ - If any script is missing or not executable, mark as FAIL and list which scripts are missing/not-executable.
274
+
275
+ ### 10c. CLI Availability (babysitter command)
276
+
277
+ The hooks delegate to the `babysitter` CLI. Check if it is available:
278
+ - Run: `command -v babysitter 2>/dev/null && babysitter --version 2>/dev/null`
279
+ - If the command is found, display its path and version. Mark sub-check as PASS.
280
+ - If not found, check the user-local prefix: `$HOME/.local/bin/babysitter --version 2>/dev/null`
281
+ - If neither is found, mark sub-check as FAIL ("babysitter CLI not found — hooks will fail with exit code 127. Install with: `npm i -g @a5c-ai/babysitter-sdk`").
282
+
283
+ ### 10d. Stop Hook Execution Evidence
284
+
285
+ Check whether the stop hook has actually been invoked during this run's lifetime:
286
+
287
+ **From log files:**
288
+ - Read `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-stop-hook.log` (if it exists).
289
+ - Count the number of "Hook script invoked" lines. This is the total invocation count.
290
+ - Count the number of "CLI exit code=" lines and extract exit codes.
291
+ - If the log file does not exist or has zero invocations, the stop hook has NOT been running.
292
+
293
+ **From journal events:**
294
+ - Search the run's journal events for `STOP_HOOK_INVOKED` type events (using the run:events output from section 2 if available).
295
+ - Count the number of STOP_HOOK_INVOKED events.
296
+ - If present, display the last 5 with their timestamps and decision data.
297
+ - If no STOP_HOOK_INVOKED events exist in the journal, note that the stop hook has not recorded any decisions for this run.
298
+
299
+ **From stderr:**
300
+ - Read `$CLAUDE_PLUGIN_ROOT/.a5c/logs/babysitter-stop-hook-stderr.log`.
301
+ - If it contains error output, display it and diagnose:
302
+ - "command not found" or exit code 127 → CLI not installed (see 10c)
303
+ - "MODULE_NOT_FOUND" or "Cannot find module" → SDK package corrupted or not built
304
+ - "ENOENT" → Missing file referenced by the hook
305
+ - "EACCES" or "permission denied" → Permission issue on hook script or CLI
306
+ - "npm ERR" → npm installation failure during hook execution
307
+
308
+ ### 10e. Stop Hook Not Running — Root Cause Diagnosis
309
+
310
+ If the stop hook shows NO evidence of execution (no log entries, no journal events, zero invocations):
311
+
312
+ Perform these diagnostic steps in order and report the first failure found:
313
+
314
+ 1. **Plugin not installed**: Check if `plugins/babysitter/` exists relative to the project root and if `CLAUDE_PLUGIN_ROOT` is set. If the plugin directory doesn't exist, report: "Plugin not installed — the babysitter plugin directory is missing."
315
+
316
+ 2. **Plugin not enabled**: Check for Claude settings files:
317
+ - `~/.claude/settings.json` — look for `babysitter` in `enabledPlugins`.
318
+ - `~/.claude/plugins/installed_plugins.json` — look for `babysitter` in the plugins list.
319
+ - If not found in either, report: "Plugin not enabled in Claude Code settings."
320
+
321
+ 3. **hooks.json not registered**: If `hooks.json` doesn't contain a `Stop` hook entry (checked in 10a), report: "Stop hook not registered in hooks.json."
322
+
323
+ 4. **Hook script missing or not executable**: If the stop hook script doesn't exist or isn't executable (checked in 10b), report with the specific file path.
324
+
325
+ 5. **CLI not available**: If `babysitter` CLI is not found (checked in 10c), report: "babysitter CLI not installed — hook script will fail silently."
326
+
327
+ 6. **Hook running but failing silently**: If the log file exists but shows exit codes other than 0, or if stderr has content, report: "Stop hook is being invoked but failing — see stderr log for details."
328
+
329
+ 7. **No active session**: If no session state files exist (from section 6), report: "No active babysitter session — the stop hook only activates when a session is bound to a run."
330
+
331
+ 8. **All checks pass but hook still not running**: Report: "All prerequisites are met but the stop hook shows no evidence of execution. Possible causes: Claude Code may not be invoking plugin hooks (check Claude Code version), or the session may have ended before the hook could fire."
332
+
333
+ ### 10f. Verdict
334
+
335
+ Mark as PASS if:
336
+ - Hook registration is correct (10a)
337
+ - Hook scripts exist and are executable (10b)
338
+ - CLI is available (10c)
339
+ - There is evidence of stop hook execution (10d) with exit code 0
340
+
341
+ Mark as WARN if:
342
+ - Hooks are registered and scripts exist, but there's no evidence of execution yet
343
+ - Stop hook ran but had non-zero exit codes
344
+
345
+ Mark as FAIL if:
346
+ - Hook registration is missing
347
+ - Hook scripts are missing or not executable
348
+ - CLI is not available
349
+ - Stop hook is failing (consistent non-zero exit codes or stderr errors)
350
+
351
+ ---
352
+
353
+ ## Final Report
354
+
355
+ After completing all 10 checks, produce the diagnostic report in this format:
356
+
357
+ ```
358
+ ============================================
359
+ BABYSITTER DIAGNOSTIC REPORT
360
+ Run: <runId>
361
+ Time: <current timestamp>
362
+ ============================================
363
+
364
+ OVERALL HEALTH: <HEALTHY | WARNING | CRITICAL>
365
+
366
+ --------------------------------------------
367
+ CHECK RESULTS
368
+ --------------------------------------------
369
+
370
+ | # | Check | Status |
371
+ |----|--------------------------|--------|
372
+ | 1 | Run Discovery | <status> |
373
+ | 2 | Journal Integrity | <status> |
374
+ | 3 | State Cache Consistency | <status> |
375
+ | 4 | Effect Status | <status> |
376
+ | 5 | Lock Status | <status> |
377
+ | 6 | Session State | <status> |
378
+ | 7 | Log Analysis | <status> |
379
+ | 8 | Disk Usage | <status> |
380
+ | 9 | Process Validation | <status> |
381
+ | 10 | Hook Execution Health | <status> |
382
+
383
+ --------------------------------------------
384
+ ISSUES & RECOMMENDATIONS
385
+ --------------------------------------------
386
+
387
+ <For each WARN or FAIL check, list:>
388
+ - [WARN|FAIL] <Check name>: <description of issue>
389
+ Fix: <specific actionable command or instruction>
390
+
391
+ --------------------------------------------
392
+ ```
393
+
394
+ **Overall health determination:**
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.
398
+
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.
400
+
401
+ ---
402
+
403
+ ## Escalation: Claude /debug
404
+
405
+ If any check results in FAIL and the root cause is unclear after your own analysis -- especially for environment issues, hook execution failures, CLI availability problems, or permission errors that may relate to the Claude Code runtime itself -- invoke the built-in Claude `/debug` command to get additional diagnostic context from the Claude Code environment. This is particularly useful for:
406
+ - Hook scripts that should be running but show no evidence of execution (check 10)
407
+ - Permission or path resolution issues that don't match expected behavior
408
+ - Unexpected CLI behavior that might be a Claude Code environment issue rather than a babysitter issue
409
+
410
+ Call `/debug` with a summary of the failing check and what you've already ruled out, so it can focus on environment-level causes.
411
+
412
+ ---
413
+
414
+ ## After Diagnosis: Contribute Back
415
+
416
+ After diagnosing issues, prompt the user to report or fix what was found -- they don't need to fix the bug themselves, just reporting it is valuable. Suggest `/babysitter:contrib` based on the situation:
417
+
418
+ - **Found a bug but didn't fix it**: `/babysitter:contrib bug report: [what the doctor found, e.g. "state cache rebuild silently drops EFFECT_RESOLVED events when journal has duplicate invocation keys"]`
419
+ - **Found and fixed a bug**: `/babysitter:contrib bugfix: [description of the fix]`
420
+ - **Found confusing or missing docs that made diagnosis harder**: `/babysitter:contrib documentation question: [what was unclear or missing]`
421
+ - **Found an issue in a plugin**: `/babysitter:contrib bug report: [plugin-name] [description]`
422
+ - **Improved a process or skill during diagnosis**: `/babysitter:contrib library contribution: [description]`
423
+
424
+ Example prompt after diagnosis:
425
+
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."
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: Use this command to start babysitting a never-ending babysitter run.
3
+ argument-hint: Specific instructions for the run.
4
+ allowed-tools: Read, Grep, Write, Task, Bash, Edit, Grep, Glob, WebFetch, WebSearch, Search, AskUserQuestion, TodoWrite, TodoRead, Skill, BashOutput, KillShell, MultiEdit, LS
5
+ ---
6
+
7
+ Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md). but create a process that uses an infinte loop and a ctx.sleep to create a never-ending babysitter loop. an example of such process is a daily process that reads new support ticket every day and tries to resolve them, then sleeps for 4 hours and repeats the process.