@a5c-ai/babysitter-opencode 5.0.1-staging.e4f17eff → 5.0.1-staging.e920fef118ef

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 (55) hide show
  1. package/README.md +19 -21
  2. package/bin/cli.cjs +1 -191
  3. package/bin/cli.js +90 -49
  4. package/bin/install-shared.cjs +1 -478
  5. package/bin/install-shared.js +615 -0
  6. package/bin/install.cjs +1 -143
  7. package/bin/install.js +18 -98
  8. package/bin/uninstall.cjs +1 -87
  9. package/bin/uninstall.js +12 -34
  10. package/commands/call.md +5 -1
  11. package/commands/cleanup.md +30 -8
  12. package/commands/doctor.md +7 -8
  13. package/commands/help.md +246 -244
  14. package/commands/observe.md +17 -12
  15. package/commands/yolo.md +11 -7
  16. package/hooks/babysitter-proxied-session-created.js +18 -212
  17. package/hooks/babysitter-proxied-session-created.sh +11 -0
  18. package/hooks/babysitter-proxied-shell-env.js +21 -145
  19. package/hooks/babysitter-proxied-shell-env.sh +3 -0
  20. package/hooks/babysitter-proxied-stop-hook.sh +3 -0
  21. package/hooks/babysitter-proxied-tool-execute-after.js +20 -160
  22. package/hooks/babysitter-proxied-tool-execute-after.sh +3 -0
  23. package/hooks/babysitter-proxied-tool-execute-before.js +20 -162
  24. package/hooks/babysitter-proxied-tool-execute-before.sh +3 -0
  25. package/hooks/hooks.json +14 -22
  26. package/package.json +21 -19
  27. package/plugin.json +6 -4
  28. package/scripts/create-release-tag.mjs +18 -0
  29. package/scripts/publish-from-tag.mjs +41 -0
  30. package/scripts/team-install.js +23 -0
  31. package/skills/accomplish-status/SKILL.md +1 -1
  32. package/skills/babysit/SKILL.md +4 -3
  33. package/skills/call/SKILL.md +5 -1
  34. package/skills/cleanup/SKILL.md +30 -8
  35. package/skills/contrib/SKILL.md +25 -25
  36. package/skills/doctor/SKILL.md +7 -8
  37. package/skills/help/SKILL.md +4 -2
  38. package/skills/observe/SKILL.md +7 -2
  39. package/skills/plugins/SKILL.md +243 -243
  40. package/skills/project-install/SKILL.md +3 -3
  41. package/skills/resume/SKILL.md +1 -1
  42. package/skills/retrospect/SKILL.md +48 -48
  43. package/skills/user-install/SKILL.md +3 -3
  44. package/skills/yolo/SKILL.md +5 -1
  45. package/versions.json +2 -2
  46. package/hooks/babysitter-proxied-session-idle.js +0 -173
  47. package/hooks/hooks.json.legacy +0 -46
  48. package/hooks/proxied-hooks.json +0 -47
  49. package/hooks/session-created.js +0 -182
  50. package/hooks/session-idle.js +0 -124
  51. package/hooks/shell-env.js +0 -88
  52. package/hooks/tool-execute-after.js +0 -107
  53. package/hooks/tool-execute-before.js +0 -109
  54. package/scripts/sync-command-docs.cjs +0 -107
  55. package/scripts/sync-command-surfaces.js +0 -52
package/bin/install.cjs CHANGED
@@ -1,146 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- /**
5
- * Babysitter OpenCode Plugin Installer
6
- *
7
- * Copies the babysitter plugin bundle into the OpenCode plugins directory:
8
- * <workspace>/.opencode/plugins/babysitter/
9
- *
10
- * Registers hooks in OpenCode config, creates the index.js entry point
11
- * for plugin discovery, and bootstraps the global process library.
12
- *
13
- * Usage:
14
- * node install.cjs # Install into cwd workspace
15
- * node install.cjs --workspace /path # Install into specified workspace
16
- * node install.cjs --global # Global install (user home)
17
- * node install.cjs --accomplish # Install only to Accomplish AI data dir
18
- */
19
-
20
- const path = require('path');
21
- const {
22
- copyPluginBundle,
23
- ensureGlobalProcessLibrary,
24
- ensureMarketplaceEntry,
25
- getAccomplishOpenCodeHome,
26
- getHomeMarketplacePath,
27
- getHomePluginRoot,
28
- getOpenCodeHome,
29
- installAccomplishSurface,
30
- installOpenCodeSurface,
31
- isAccomplishInstalled,
32
- writeIndexJs,
33
- } = require('./install-shared.cjs');
34
-
35
- const PACKAGE_ROOT = path.resolve(__dirname, '..');
36
-
37
- function parseArgs(argv) {
38
- let workspace = process.env.OPENCODE_WORKSPACE || process.cwd();
39
- let accomplish = false;
40
- for (let i = 2; i < argv.length; i += 1) {
41
- const arg = argv[i];
42
- if (arg === '--workspace') {
43
- const next = argv[i + 1];
44
- workspace = next && !next.startsWith('-') ? path.resolve(argv[++i]) : process.cwd();
45
- continue;
46
- }
47
- if (arg === '--global') {
48
- workspace = null;
49
- continue;
50
- }
51
- if (arg === '--accomplish') {
52
- accomplish = true;
53
- continue;
54
- }
55
- throw new Error(`unknown argument: ${arg}`);
56
- }
57
- return { workspace, accomplish };
58
- }
59
-
60
- function installStandardOpenCode(workspace) {
61
- const openCodeHome = getOpenCodeHome(workspace);
62
- const pluginRoot = getHomePluginRoot(workspace);
63
- const marketplacePath = getHomeMarketplacePath(workspace);
64
-
65
- console.log(`[babysitter] Installing OpenCode plugin to ${pluginRoot}`);
66
-
67
- // 1. Copy plugin bundle
68
- copyPluginBundle(PACKAGE_ROOT, pluginRoot);
69
- console.log('[babysitter] Copied plugin bundle');
70
-
71
- // 2. Write index.js entry point for OpenCode plugin discovery
72
- writeIndexJs(pluginRoot);
73
- console.log('[babysitter] Created index.js entry point');
74
-
75
- // 3. Register in marketplace
76
- ensureMarketplaceEntry(marketplacePath, pluginRoot);
77
- console.log(`[babysitter] Marketplace: ${marketplacePath}`);
78
-
79
- // 4. Install OpenCode surfaces (skills, hooks config)
80
- installOpenCodeSurface(PACKAGE_ROOT, openCodeHome);
81
- console.log('[babysitter] Installed hooks and skills');
82
-
83
- // 5. Bootstrap global process library
84
- try {
85
- const active = ensureGlobalProcessLibrary(PACKAGE_ROOT);
86
- console.log(`[babysitter] Process library: ${active.binding?.dir || '(default)'}`);
87
- if (active.defaultSpec?.cloneDir) {
88
- console.log(`[babysitter] Process library clone: ${active.defaultSpec.cloneDir}`);
89
- }
90
- console.log(`[babysitter] Process library state: ${active.stateFile}`);
91
- } catch (err) {
92
- console.warn(`[babysitter] Warning: Could not bootstrap process library: ${err.message}`);
93
- console.warn('[babysitter] Run "babysitter process-library:clone" manually if needed.');
94
- }
95
- }
96
-
97
- function installToAccomplish() {
98
- const accomplishHome = getAccomplishOpenCodeHome();
99
- console.log(`[babysitter] Installing plugin to Accomplish AI: ${accomplishHome}`);
100
-
101
- installAccomplishSurface(PACKAGE_ROOT, accomplishHome);
102
-
103
- console.log('[babysitter] Copied plugin bundle to Accomplish');
104
- console.log('[babysitter] Created index.js entry point for Accomplish');
105
- console.log('[babysitter] Installed hooks and skills for Accomplish');
106
- console.log('[babysitter] Accomplish AI installation complete.');
107
- console.log('[babysitter] Restart Accomplish to pick up the installed plugin.');
108
- }
109
-
110
- function main() {
111
- const { workspace, accomplish } = parseArgs(process.argv);
112
-
113
- try {
114
- // If --accomplish is used without --global/--workspace, install only to Accomplish
115
- if (accomplish && workspace !== null) {
116
- installToAccomplish();
117
- return;
118
- }
119
-
120
- // Standard OpenCode install
121
- installStandardOpenCode(workspace);
122
-
123
- // Auto-detect Accomplish and install there too (unless --accomplish was explicit)
124
- if (!accomplish) {
125
- try {
126
- if (isAccomplishInstalled()) {
127
- console.log('[babysitter] Detected Accomplish AI installation.');
128
- installToAccomplish();
129
- }
130
- } catch (err) {
131
- console.warn(`[babysitter] Warning: Accomplish AI detection failed: ${err.message}`);
132
- }
133
- } else {
134
- // --accomplish combined with --global: install to both
135
- installToAccomplish();
136
- }
137
-
138
- console.log('[babysitter] Installation complete!');
139
- console.log('[babysitter] Restart OpenCode to pick up the installed plugin.');
140
- } catch (err) {
141
- console.error(`[babysitter] Failed to install plugin: ${err.message}`);
142
- process.exitCode = 1;
143
- }
144
- }
145
-
146
- main();
4
+ require('./install.js');
package/bin/install.js CHANGED
@@ -1,110 +1,30 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * Babysitter OpenCode Plugin Installer
4
- *
5
- * Copies plugin files into the OpenCode plugins directory:
6
- * .opencode/plugins/babysitter/
7
- *
8
- * OpenCode discovers plugins as JS/TS modules in .opencode/plugins/.
9
- * This installer creates the necessary directory structure and copies
10
- * hook scripts, skills, and an index.js entry point.
11
- */
2
+ 'use strict';
12
3
 
13
- "use strict";
4
+ const path = require('path');
5
+ const shared = require('./install-shared');
14
6
 
15
- const fs = require("fs");
16
- const path = require("path");
17
-
18
- const PLUGIN_ROOT = path.resolve(__dirname, "..");
19
- const WORKSPACE = process.env.OPENCODE_WORKSPACE || process.cwd();
20
- const TARGET_DIR = path.join(WORKSPACE, ".opencode", "plugins", "babysitter");
21
-
22
- function copyRecursive(src, dest) {
23
- const stat = fs.statSync(src);
24
- if (stat.isDirectory()) {
25
- fs.mkdirSync(dest, { recursive: true });
26
- for (const entry of fs.readdirSync(src)) {
27
- copyRecursive(path.join(src, entry), path.join(dest, entry));
28
- }
29
- } else {
30
- fs.mkdirSync(path.dirname(dest), { recursive: true });
31
- fs.copyFileSync(src, dest);
32
- }
33
- }
7
+ const PACKAGE_ROOT = path.resolve(__dirname, '..');
34
8
 
35
9
  function main() {
36
- console.log(`Installing babysitter plugin for OpenCode...`);
37
- console.log(` Source: ${PLUGIN_ROOT}`);
38
- console.log(` Target: ${TARGET_DIR}`);
10
+ const pluginRoot = shared.getHomePluginRoot();
11
+ const marketplacePath = shared.getHomeMarketplacePath();
39
12
 
40
- // Create target directory
41
- fs.mkdirSync(TARGET_DIR, { recursive: true });
13
+ console.log(`[${shared.PLUGIN_NAME}] Installing plugin to ${pluginRoot}`);
42
14
 
43
- // Copy hooks
44
- const hooksDir = path.join(PLUGIN_ROOT, "hooks");
45
- if (fs.existsSync(hooksDir)) {
46
- copyRecursive(hooksDir, path.join(TARGET_DIR, "hooks"));
47
- console.log(" Copied hooks/");
48
- }
49
-
50
- // Copy skills
51
- const skillsDir = path.join(PLUGIN_ROOT, "skills");
52
- if (fs.existsSync(skillsDir)) {
53
- copyRecursive(skillsDir, path.join(TARGET_DIR, "skills"));
54
- console.log(" Copied skills/");
55
- }
56
-
57
- // Copy commands
58
- const commandsDir = path.join(PLUGIN_ROOT, "commands");
59
- if (fs.existsSync(commandsDir)) {
60
- copyRecursive(commandsDir, path.join(TARGET_DIR, "commands"));
61
- console.log(" Copied commands/");
62
- }
63
-
64
- // Copy plugin.json and versions.json
65
- for (const file of ["plugin.json", "versions.json"]) {
66
- const src = path.join(PLUGIN_ROOT, file);
67
- if (fs.existsSync(src)) {
68
- fs.copyFileSync(src, path.join(TARGET_DIR, file));
69
- console.log(` Copied ${file}`);
15
+ try {
16
+ shared.copyPluginBundle(PACKAGE_ROOT, pluginRoot);
17
+ shared.ensureMarketplaceEntry(marketplacePath, pluginRoot);
18
+ if (typeof shared.harnessInstall === 'function') {
19
+ shared.harnessInstall(PACKAGE_ROOT, pluginRoot);
70
20
  }
21
+ shared.runPostInstall && shared.runPostInstall(pluginRoot);
22
+ console.log(`[${shared.PLUGIN_NAME}] Installation complete!`);
23
+ console.log(`[${shared.PLUGIN_NAME}] Restart your IDE/CLI to pick up the plugin.`);
24
+ } catch (err) {
25
+ console.error(`[${shared.PLUGIN_NAME}] Failed to install: ${err.message}`);
26
+ process.exitCode = 1;
71
27
  }
72
-
73
- // Create index.js entry point for OpenCode plugin discovery
74
- const indexContent = `#!/usr/bin/env node
75
- /**
76
- * Babysitter plugin entry point for OpenCode.
77
- *
78
- * OpenCode discovers plugins by looking for JS/TS modules in
79
- * .opencode/plugins/. This file registers the babysitter hooks
80
- * with the OpenCode plugin system.
81
- */
82
-
83
- "use strict";
84
-
85
- const path = require("path");
86
-
87
- const PLUGIN_DIR = __dirname;
88
-
89
- module.exports = {
90
- name: "babysitter",
91
- version: require(path.join(PLUGIN_DIR, "plugin.json")).version,
92
-
93
- hooks: {
94
- "session.created": require(path.join(PLUGIN_DIR, "hooks", "session-created.js")),
95
- "session.idle": require(path.join(PLUGIN_DIR, "hooks", "session-idle.js")),
96
- "shell.env": require(path.join(PLUGIN_DIR, "hooks", "shell-env.js")),
97
- "tool.execute.before": require(path.join(PLUGIN_DIR, "hooks", "tool-execute-before.js")),
98
- "tool.execute.after": require(path.join(PLUGIN_DIR, "hooks", "tool-execute-after.js")),
99
- },
100
- };
101
- `;
102
-
103
- fs.writeFileSync(path.join(TARGET_DIR, "index.js"), indexContent);
104
- console.log(" Created index.js");
105
-
106
- console.log(`\nBabysitter plugin installed to ${TARGET_DIR}`);
107
- console.log("Restart OpenCode to activate the plugin.");
108
28
  }
109
29
 
110
30
  main();
package/bin/uninstall.cjs CHANGED
@@ -1,90 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- /**
5
- * Babysitter OpenCode Plugin Uninstaller
6
- *
7
- * Removes the babysitter plugin from the OpenCode plugins directory
8
- * and cleans up hooks config and marketplace entries.
9
- *
10
- * Usage:
11
- * node uninstall.cjs # Uninstall from cwd workspace
12
- * node uninstall.cjs --workspace /path # Uninstall from specified workspace
13
- * node uninstall.cjs --global # Global uninstall
14
- */
15
-
16
- const fs = require('fs');
17
- const path = require('path');
18
- const {
19
- getHomeMarketplacePath,
20
- getHomePluginRoot,
21
- getOpenCodeHome,
22
- removeManagedHooks,
23
- removeMarketplaceEntry,
24
- } = require('./install-shared.cjs');
25
-
26
- function parseArgs(argv) {
27
- let workspace = process.env.OPENCODE_WORKSPACE || process.cwd();
28
- for (let i = 2; i < argv.length; i += 1) {
29
- const arg = argv[i];
30
- if (arg === '--workspace') {
31
- const next = argv[i + 1];
32
- workspace = next && !next.startsWith('-') ? path.resolve(argv[++i]) : process.cwd();
33
- continue;
34
- }
35
- if (arg === '--global') {
36
- workspace = null;
37
- continue;
38
- }
39
- throw new Error(`unknown argument: ${arg}`);
40
- }
41
- return { workspace };
42
- }
43
-
44
- function main() {
45
- const { workspace } = parseArgs(process.argv);
46
- const openCodeHome = getOpenCodeHome(workspace);
47
- const pluginRoot = getHomePluginRoot(workspace);
48
- const marketplacePath = getHomeMarketplacePath(workspace);
49
- let removedPlugin = false;
50
-
51
- console.log(`[babysitter] Uninstalling OpenCode plugin from ${pluginRoot}`);
52
-
53
- // 1. Remove plugin directory
54
- if (fs.existsSync(pluginRoot)) {
55
- try {
56
- fs.rmSync(pluginRoot, { recursive: true, force: true });
57
- console.log(`[babysitter] Removed ${pluginRoot}`);
58
- removedPlugin = true;
59
- } catch (err) {
60
- console.warn(`[babysitter] Warning: Could not remove plugin directory: ${err.message}`);
61
- }
62
- }
63
-
64
- // 2. Remove marketplace entry
65
- removeMarketplaceEntry(marketplacePath);
66
- console.log('[babysitter] Cleaned marketplace entry');
67
-
68
- // 3. Remove managed hooks from OpenCode config
69
- removeManagedHooks(openCodeHome);
70
- console.log('[babysitter] Cleaned hooks config');
71
-
72
- // 4. Clean up empty parent directories
73
- const pluginsDir = path.dirname(pluginRoot);
74
- try {
75
- const remaining = fs.readdirSync(pluginsDir);
76
- if (remaining.length === 0) {
77
- fs.rmdirSync(pluginsDir);
78
- console.log('[babysitter] Removed empty plugins/ directory');
79
- }
80
- } catch { /* best-effort */ }
81
-
82
- if (!removedPlugin) {
83
- console.log('[babysitter] Plugin directory not found; config and hooks cleaned if present.');
84
- return;
85
- }
86
-
87
- console.log('[babysitter] Uninstallation complete. Restart OpenCode to finish removal.');
88
- }
89
-
90
- main();
4
+ require('./uninstall.js');
package/bin/uninstall.js CHANGED
@@ -1,46 +1,24 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * Babysitter OpenCode Plugin Uninstaller
4
- *
5
- * Removes the babysitter plugin from the OpenCode plugins directory.
6
- */
2
+ 'use strict';
7
3
 
8
- "use strict";
9
-
10
- const fs = require("fs");
11
- const path = require("path");
12
-
13
- const WORKSPACE = process.env.OPENCODE_WORKSPACE || process.cwd();
14
- const TARGET_DIR = path.join(WORKSPACE, ".opencode", "plugins", "babysitter");
15
-
16
- function removeRecursive(dir) {
17
- if (!fs.existsSync(dir)) return;
18
- fs.rmSync(dir, { recursive: true, force: true });
19
- }
4
+ const fs = require('fs');
5
+ const shared = require('./install-shared');
20
6
 
21
7
  function main() {
22
- console.log(`Uninstalling babysitter plugin from OpenCode...`);
23
- console.log(` Target: ${TARGET_DIR}`);
8
+ const pluginRoot = shared.getHomePluginRoot();
24
9
 
25
- if (!fs.existsSync(TARGET_DIR)) {
26
- console.log(" Plugin not installed -- nothing to remove.");
10
+ if (!fs.existsSync(pluginRoot)) {
11
+ console.log(`[${shared.PLUGIN_NAME}] Plugin not installed at ${pluginRoot}`);
27
12
  return;
28
13
  }
29
14
 
30
- removeRecursive(TARGET_DIR);
31
- console.log(" Removed babysitter plugin directory.");
32
-
33
- // Clean up empty parent directories
34
- const pluginsDir = path.join(WORKSPACE, ".opencode", "plugins");
35
15
  try {
36
- const remaining = fs.readdirSync(pluginsDir);
37
- if (remaining.length === 0) {
38
- fs.rmdirSync(pluginsDir);
39
- console.log(" Removed empty .opencode/plugins/ directory.");
40
- }
41
- } catch { /* best-effort */ }
42
-
43
- console.log("\nBabysitter plugin uninstalled. Restart OpenCode to complete removal.");
16
+ fs.rmSync(pluginRoot, { recursive: true, force: true });
17
+ console.log(`[${shared.PLUGIN_NAME}] Uninstalled from ${pluginRoot}`);
18
+ } catch (err) {
19
+ console.error(`[${shared.PLUGIN_NAME}] Failed to uninstall: ${err.message}`);
20
+ process.exitCode = 1;
21
+ }
44
22
  }
45
23
 
46
24
  main();
package/commands/call.md CHANGED
@@ -4,4 +4,8 @@ argument-hint: Specific instructions for the run.
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
- Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
7
+ Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md). Then continue executing the returned instructions in this same turn. Do not stop after the Skill tool returns; carry the requested run through to completion proof.
8
+
9
+ User arguments for this command:
10
+
11
+ $ARGUMENTS
@@ -10,11 +10,33 @@ Create and run a cleanup process using the process at `skills\babysit\process\cr
10
10
 
11
11
  Implementation notes (for the process):
12
12
  - Parse arguments for `--dry-run` flag (if present, set dryRun: true in inputs) and `--keep-days N` (default: 7)
13
- - The process scans .a5c/runs/ for completed/failed runs, aggregates insights, writes summaries, then removes old data
14
- - Always show the user what will be removed before removing (in interactive mode via breakpoints)
15
- - In non-interactive mode (yolo), proceed with cleanup using defaults
16
- - The insights file goes to docs/run-history-insights.md
17
- - Only remove terminal runs (completed/failed) older than the keep-days threshold
18
- - Never remove active/in-progress runs
19
- - Remove orphaned process files not referenced by remaining runs
20
- - After cleanup, show remaining run count and disk usage
13
+
14
+ CRITICAL: The cleanup MUST follow this exact phase order. Do NOT delete any run before Phase 2 completes.
15
+
16
+ Phase 1 Scan:
17
+ - Scan .a5c/runs/ for all runs
18
+ - Classify each as terminal (completed/failed) or active (in-progress/created)
19
+ - Identify terminal runs older than the keep-days threshold as removal candidates
20
+ - Never mark active/in-progress runs for removal
21
+ - Count and report: total runs, terminal, active, removal candidates, disk usage
22
+
23
+ Phase 2 — Aggregate insights (BEFORE any deletion):
24
+ - For EVERY removal candidate, read its run.json and journal/ events
25
+ - Extract: processId, prompt, status, event count, created date, task summaries
26
+ - Group by process type and extract patterns (retry counts, convergence behavior, failure modes)
27
+ - Append a new dated section to docs/run-history-insights.md with:
28
+ - Summary statistics (runs removed, disk freed, runs retained)
29
+ - Run categories with counts and descriptions
30
+ - Key patterns observed (multi-batch convergence, retry behavior, etc.)
31
+ - What worked well / what didn't from the run data
32
+ - This file MUST be written and verified before proceeding to Phase 3
33
+
34
+ Phase 3 — Confirm removal:
35
+ - In interactive mode, show the user what will be removed via a breakpoint
36
+ - In non-interactive mode (yolo), proceed with defaults
37
+ - In dry-run mode, stop here and show what would be removed
38
+
39
+ Phase 4 — Remove:
40
+ - Delete the terminal runs older than keep-days threshold
41
+ - Identify and remove orphaned process files not referenced by remaining runs
42
+ - Show remaining run count and disk usage after cleanup
@@ -156,7 +156,6 @@ If it exists:
156
156
  **Goal:** Inspect babysitter session files for health and detect runaway loops.
157
157
 
158
158
  - Search for session state files using Glob:
159
- - `plugins/babysitter/skills/babysit/state/*.md`
160
159
  - `.a5c/state/*.md`
161
160
  - `.a5c/state/*.json`
162
161
  - For each session state file found:
@@ -260,7 +259,7 @@ Mark as PASS if total size < 500MB and no files > 10MB. Mark as WARN if total si
260
259
 
261
260
  ### 10a. Hook Registration
262
261
 
263
- - 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.
262
+ - Locate the plugin root. Check for `CLAUDE_PLUGIN_ROOT` env var first, or search for a babysitter `hooks.json` by walking up from the current directory.
264
263
  - If found, read `hooks.json` and verify:
265
264
  - A `Stop` hook entry exists with a command referencing `babysitter-stop-hook.sh`.
266
265
  - A `SessionStart` hook entry exists with a command referencing `babysitter-session-start-hook.sh`.
@@ -315,7 +314,7 @@ If the stop hook shows NO evidence of execution (no log entries, no journal even
315
314
 
316
315
  Perform these diagnostic steps in order and report the first failure found:
317
316
 
318
- 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."
317
+ 1. **Plugin not installed**: Check if `CLAUDE_PLUGIN_ROOT` is set or if a babysitter plugin directory exists relative to the project root. If neither exists, report: "Plugin not installed — the babysitter plugin directory is missing."
319
318
 
320
319
  2. **Plugin not enabled**: Check for Claude settings files:
321
320
  - `~/.claude/settings.json` — look for `babysitter` in `enabledPlugins`.
@@ -362,13 +361,13 @@ Mark as FAIL if:
362
361
  - Parse the output and inspect the `resolvedFrom` field. Classify as follows:
363
362
  - `resolvedFrom: "pid-marker"` → mark as PASS ("Session ID derives from the live Claude Code ancestor process -- authoritative").
364
363
  - `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.
364
+ - `resolvedFrom: "env-var"` → mark as WARN ("`AGENT_SESSION_ID` is set without a corroborating PID marker. Likely stale from a prior Claude Code session -- see GitHub issue #130").
365
+ - Remediation: run `babysitter session:cleanup` and start a fresh Claude Code session, or `unset AGENT_SESSION_ID` before invoking babysitter.
367
366
  - `resolvedFrom: "none"` → mark as ERROR ("No session ID resolvable. Either no session-start hook fired, or the ancestor walk failed").
368
367
 
369
368
  **Env-var shadow check:**
370
369
  - 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").
370
+ - If `envVarPresent && !envVarMatches`, mark as WARN ("`AGENT_SESSION_ID` in env does not match the resolved session ID; a stale value is shadowing the authoritative one. Unset the env var").
372
371
 
373
372
  ---
374
373
 
@@ -390,7 +389,7 @@ Mark as FAIL if:
390
389
 
391
390
  - Enumerate files in `~/.a5c/` matching the pattern `current-session-*-pid-*`.
392
391
  - 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").
392
+ - 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 `AGENT_SESSION_ID` appropriately -- the PID marker handles this automatically").
394
393
  - Otherwise mark as PASS.
395
394
 
396
395
  ---
@@ -501,7 +500,7 @@ babysitter session:cleanup --dry-run # preview
501
500
  babysitter session:cleanup # apply
502
501
 
503
502
  # 2. Unset a stale env var
504
- unset BABYSITTER_SESSION_ID
503
+ unset AGENT_SESSION_ID
505
504
 
506
505
  # 3. Re-bind a run explicitly if needed
507
506
  babysitter session:resume --session-id <fresh-id> --state-dir ~/.a5c --run-id <runId> --runs-dir .a5c/runs