@a5c-ai/babysitter-github 5.0.1-staging.d73033a7 → 5.0.1-staging.daf8e165bc4a

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 (63) hide show
  1. package/README.md +33 -25
  2. package/bin/cli.js +14 -26
  3. package/bin/install-shared.js +398 -215
  4. package/bin/install.js +49 -89
  5. package/bin/uninstall.js +30 -60
  6. package/commands/blueprints.md +64 -0
  7. package/commands/call.md +11 -7
  8. package/commands/check-forbidden-markers.md +68 -0
  9. package/commands/cleanup.md +37 -9
  10. package/commands/contrib.md +31 -31
  11. package/commands/doctor.md +7 -8
  12. package/commands/forever.md +6 -6
  13. package/commands/help.md +246 -244
  14. package/commands/observe.md +17 -12
  15. package/commands/plan.md +17 -7
  16. package/commands/plugins.md +22 -255
  17. package/commands/project-install.md +10 -10
  18. package/commands/resume.md +8 -8
  19. package/commands/retrospect.md +55 -55
  20. package/commands/user-install.md +10 -10
  21. package/commands/yolo.md +11 -7
  22. package/hooks/babysitter-proxied-post-tool-use.ps1 +12 -0
  23. package/hooks/babysitter-proxied-post-tool-use.sh +3 -0
  24. package/hooks/babysitter-proxied-pre-compact.ps1 +12 -0
  25. package/hooks/babysitter-proxied-pre-compact.sh +3 -0
  26. package/hooks/babysitter-proxied-pre-tool-use.ps1 +12 -0
  27. package/hooks/babysitter-proxied-pre-tool-use.sh +3 -0
  28. package/hooks/babysitter-proxied-session-end.ps1 +10 -114
  29. package/hooks/babysitter-proxied-session-end.sh +2 -111
  30. package/hooks/babysitter-proxied-session-start.ps1 +10 -187
  31. package/hooks/babysitter-proxied-session-start.sh +6 -168
  32. package/hooks/babysitter-proxied-user-prompt-submitted.ps1 +10 -90
  33. package/hooks/babysitter-proxied-user-prompt-submitted.sh +2 -86
  34. package/hooks.json +33 -9
  35. package/package.json +20 -21
  36. package/plugin.json +7 -6
  37. package/scripts/create-release-tag.mjs +18 -0
  38. package/scripts/publish-from-tag.mjs +41 -0
  39. package/scripts/team-install.js +14 -84
  40. package/skills/babysit/SKILL.md +32 -46
  41. package/skills/blueprints/SKILL.md +66 -0
  42. package/skills/call/SKILL.md +5 -1
  43. package/skills/check-forbidden-markers/SKILL.md +69 -0
  44. package/skills/cleanup/SKILL.md +49 -0
  45. package/skills/contrib/SKILL.md +34 -0
  46. package/skills/doctor/SKILL.md +7 -8
  47. package/skills/forever/SKILL.md +8 -0
  48. package/skills/help/SKILL.md +13 -11
  49. package/skills/observe/SKILL.md +7 -2
  50. package/skills/plan/SKILL.md +11 -1
  51. package/skills/plugins/SKILL.md +24 -0
  52. package/skills/project-install/SKILL.md +18 -0
  53. package/skills/yolo/SKILL.md +12 -0
  54. package/versions.json +2 -1
  55. package/.github/plugin.json +0 -25
  56. package/hooks/proxied-hooks.json +0 -29
  57. package/hooks/session-end.ps1 +0 -69
  58. package/hooks/session-end.sh +0 -54
  59. package/hooks/session-start.ps1 +0 -111
  60. package/hooks/session-start.sh +0 -101
  61. package/hooks/user-prompt-submitted.ps1 +0 -52
  62. package/hooks/user-prompt-submitted.sh +0 -31
  63. package/scripts/sync-command-surfaces.js +0 -62
package/bin/install.js CHANGED
@@ -2,126 +2,86 @@
2
2
  'use strict';
3
3
 
4
4
  const path = require('path');
5
- const { spawnSync } = require('child_process');
6
- const {
7
- copyPluginBundle,
8
- ensureGlobalProcessLibrary,
9
- ensureMarketplaceEntry,
10
- getCopilotHome,
11
- getHomeMarketplacePath,
12
- getHomePluginRoot,
13
- installCloudAgentSurface,
14
- installCopilotSurface,
15
- warnWindowsHooks,
16
- } = require('./install-shared');
5
+ const shared = require('./install-shared');
17
6
 
18
7
  const PACKAGE_ROOT = path.resolve(__dirname, '..');
19
8
 
20
9
  function parseArgs(argv) {
21
- const args = {
22
- cloudAgent: false,
23
- workspace: process.cwd(),
24
- };
10
+ let workspace = null;
11
+ let cloudAgent = false;
25
12
 
26
13
  for (let i = 0; i < argv.length; i += 1) {
27
14
  const arg = argv[i];
28
15
  if (arg === '--cloud-agent') {
29
- args.cloudAgent = true;
16
+ cloudAgent = true;
30
17
  continue;
31
18
  }
32
19
  if (arg === '--workspace') {
33
20
  const next = argv[i + 1];
34
21
  if (next && !next.startsWith('-')) {
35
- args.workspace = path.resolve(next);
22
+ workspace = path.resolve(next);
36
23
  i += 1;
37
24
  } else {
38
- args.workspace = process.cwd();
25
+ workspace = process.cwd();
39
26
  }
40
27
  }
41
28
  }
42
29
 
43
- return args;
44
- }
45
-
46
- /**
47
- * Attempt to register the plugin via `copilot plugin install ./path`.
48
- * Falls back to manual config.json registration if the CLI is not available.
49
- */
50
- function registerViaCopilotCli(pluginRoot) {
51
- const result = spawnSync('copilot', ['plugin', 'install', pluginRoot], {
52
- stdio: ['ignore', 'pipe', 'pipe'],
53
- encoding: 'utf8',
54
- timeout: 30000,
55
- });
56
-
57
- if (result.status === 0) {
58
- console.log(`[babysitter] Registered plugin via 'copilot plugin install'`);
59
- return true;
60
- }
61
-
62
- // CLI not available or failed -- fall back to manual registration
63
- const stderr = (result.stderr || '').trim();
64
- if (result.error || stderr.includes('not found') || stderr.includes('not recognized')) {
65
- console.log(`[babysitter] Copilot CLI not found, using manual registration`);
66
- } else {
67
- console.warn(`[babysitter] 'copilot plugin install' failed: ${stderr || 'unknown error'}, using manual registration`);
68
- }
69
- return false;
30
+ return { cloudAgent, workspace };
70
31
  }
71
32
 
72
33
  function main() {
73
- const args = parseArgs(process.argv.slice(2));
74
- const copilotHome = getCopilotHome();
75
- const pluginRoot = getHomePluginRoot();
76
- const marketplacePath = getHomeMarketplacePath();
34
+ const options = parseArgs(process.argv.slice(2));
77
35
 
78
- if (args.cloudAgent) {
79
- const active = ensureGlobalProcessLibrary(PACKAGE_ROOT);
80
- const installed = installCloudAgentSurface(PACKAGE_ROOT, args.workspace);
81
- console.log(`[babysitter] Installed Copilot cloud-agent support into ${args.workspace}`);
82
- console.log(`[babysitter] plugin bundle: ${installed.bundleRoot}`);
83
- console.log(`[babysitter] skills: ${path.join(args.workspace, '.github', 'skills')}`);
84
- console.log(`[babysitter] instructions: ${installed.copilotInstructionsPath}`);
85
- console.log(`[babysitter] agents: ${installed.agentsPath}`);
86
- if (installed.setupWorkflow.needsManualMerge) {
87
- console.warn(`[babysitter] Existing copilot-setup-steps workflow preserved: ${installed.setupWorkflow.workflowPath}`);
88
- console.warn(`[babysitter] Merge Babysitter setup steps from: ${installed.setupWorkflow.examplePath}`);
89
- } else {
90
- console.log(`[babysitter] setup workflow: ${installed.setupWorkflow.workflowPath}`);
36
+ if (options.cloudAgent) {
37
+ if (!options.workspace) {
38
+ console.error(`[${shared.PLUGIN_NAME}] Failed to install: --cloud-agent requires --workspace <path>.`);
39
+ process.exitCode = 1;
40
+ return;
41
+ }
42
+
43
+ try {
44
+ const installResult = shared.installCloudAgentSurface(PACKAGE_ROOT, options.workspace);
45
+ shared.ensureGlobalProcessLibrary(PACKAGE_ROOT);
46
+ console.log(`[${shared.PLUGIN_NAME}] Installed cloud-agent support into ${options.workspace}`);
47
+ if (installResult.setupWorkflow && installResult.setupWorkflow.examplePath) {
48
+ console.log(
49
+ `[${shared.PLUGIN_NAME}] Existing copilot setup workflow preserved; merge candidate written to ${installResult.setupWorkflow.examplePath}`,
50
+ );
51
+ }
52
+ return;
53
+ } catch (err) {
54
+ console.error(`[${shared.PLUGIN_NAME}] Failed to install cloud-agent support: ${err.message}`);
55
+ process.exitCode = 1;
56
+ return;
91
57
  }
92
- console.log(`[babysitter] process library: ${active.binding?.dir}`);
93
- console.log(`[babysitter] process library state: ${active.stateFile}`);
94
- console.log('[babysitter] Cloud-agent installation complete!');
95
- return;
96
58
  }
97
59
 
98
- console.log(`[babysitter] Installing plugin to ${pluginRoot}`);
60
+ const pluginRoot = shared.getHomePluginRoot();
61
+ const marketplacePath = shared.getHomeMarketplacePath();
99
62
 
100
- try {
101
- copyPluginBundle(PACKAGE_ROOT, pluginRoot);
102
- ensureMarketplaceEntry(marketplacePath, pluginRoot);
63
+ console.log(`[${shared.PLUGIN_NAME}] Installing plugin to ${pluginRoot}`);
103
64
 
104
- // Try native copilot CLI registration first; fall back to manual config.json
105
- if (!registerViaCopilotCli(pluginRoot)) {
106
- const { registerCopilotPlugin } = require('./install-shared');
107
- registerCopilotPlugin(pluginRoot);
65
+ try {
66
+ shared.copyPluginBundle(PACKAGE_ROOT, pluginRoot);
67
+ shared.ensureMarketplaceEntry(marketplacePath, pluginRoot);
68
+ if (typeof shared.registerCopilotPlugin === 'function') {
69
+ shared.registerCopilotPlugin(pluginRoot);
108
70
  }
109
-
110
- installCopilotSurface(PACKAGE_ROOT, copilotHome);
111
-
112
- const active = ensureGlobalProcessLibrary(PACKAGE_ROOT);
113
- console.log(`[babysitter] marketplace: ${marketplacePath}`);
114
- console.log(`[babysitter] copilot config: ${path.join(copilotHome, 'config.json')}`);
115
- console.log(`[babysitter] process library: ${active.binding?.dir}`);
116
- if (active.defaultSpec?.cloneDir) {
117
- console.log(`[babysitter] process library clone: ${active.defaultSpec.cloneDir}`);
71
+ if (typeof shared.installCopilotSurface === 'function' && typeof shared.getCopilotHome === 'function') {
72
+ shared.installCopilotSurface(PACKAGE_ROOT, shared.getCopilotHome());
73
+ }
74
+ if (typeof shared.warnWindowsHooks === 'function') {
75
+ shared.warnWindowsHooks();
76
+ }
77
+ if (typeof shared.harnessInstall === 'function') {
78
+ shared.harnessInstall(PACKAGE_ROOT, pluginRoot);
118
79
  }
119
- console.log(`[babysitter] process library state: ${active.stateFile}`);
120
- warnWindowsHooks();
121
- console.log('[babysitter] Installation complete!');
122
- console.log('[babysitter] Restart GitHub Copilot CLI to pick up the installed plugin and config changes.');
80
+ shared.runPostInstall && shared.runPostInstall(pluginRoot);
81
+ console.log(`[${shared.PLUGIN_NAME}] Installation complete!`);
82
+ console.log(`[${shared.PLUGIN_NAME}] Restart your IDE/CLI to pick up the plugin.`);
123
83
  } catch (err) {
124
- console.error(`[babysitter] Failed to install plugin: ${err.message}`);
84
+ console.error(`[${shared.PLUGIN_NAME}] Failed to install: ${err.message}`);
125
85
  process.exitCode = 1;
126
86
  }
127
87
  }
package/bin/uninstall.js CHANGED
@@ -1,76 +1,46 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
+ const path = require('path');
4
5
  const fs = require('fs');
5
- const { spawnSync } = require('child_process');
6
- const {
7
- deregisterCopilotPlugin,
8
- getCopilotHome,
9
- getHomeMarketplacePath,
10
- getHomePluginRoot,
11
- removeLegacyHooks,
12
- removeMarketplaceEntry,
13
- } = require('./install-shared');
14
-
15
- const PLUGIN_NAME = 'babysitter';
16
-
17
- /**
18
- * Attempt to unregister the plugin via `copilot plugin uninstall`.
19
- * Falls back to manual config.json cleanup if the CLI is not available.
20
- */
21
- function unregisterViaCopilotCli() {
22
- const result = spawnSync('copilot', ['plugin', 'uninstall', PLUGIN_NAME], {
23
- stdio: ['ignore', 'pipe', 'pipe'],
24
- encoding: 'utf8',
25
- timeout: 30000,
26
- });
27
-
28
- if (result.status === 0) {
29
- console.log(`[${PLUGIN_NAME}] Unregistered plugin via 'copilot plugin uninstall'`);
30
- return true;
31
- }
32
-
33
- // CLI not available or failed
34
- const stderr = (result.stderr || '').trim();
35
- if (result.error || stderr.includes('not found') || stderr.includes('not recognized')) {
36
- console.log(`[${PLUGIN_NAME}] Copilot CLI not found, using manual cleanup`);
37
- } else {
38
- console.warn(`[${PLUGIN_NAME}] 'copilot plugin uninstall' failed: ${stderr || 'unknown error'}, using manual cleanup`);
39
- }
40
- return false;
41
- }
6
+ const shared = require('./install-shared');
42
7
 
43
8
  function main() {
44
- const copilotHome = getCopilotHome();
45
- const pluginRoot = getHomePluginRoot();
46
- const marketplacePath = getHomeMarketplacePath();
47
- let removedPlugin = false;
48
-
49
- if (fs.existsSync(pluginRoot)) {
9
+ const pluginRoot = shared.getHomePluginRoot();
10
+ const marketplacePath = typeof shared.getHomeMarketplacePath === 'function'
11
+ ? shared.getHomeMarketplacePath()
12
+ : null;
13
+ const copilotHome = typeof shared.getCopilotHome === 'function'
14
+ ? shared.getCopilotHome()
15
+ : null;
16
+
17
+ if (!fs.existsSync(pluginRoot)) {
18
+ console.log(`[${shared.PLUGIN_NAME}] Plugin not installed at ${pluginRoot}`);
19
+ } else {
50
20
  try {
51
21
  fs.rmSync(pluginRoot, { recursive: true, force: true });
52
- console.log(`[${PLUGIN_NAME}] Removed ${pluginRoot}`);
53
- removedPlugin = true;
22
+ console.log(`[${shared.PLUGIN_NAME}] Uninstalled from ${pluginRoot}`);
54
23
  } catch (err) {
55
- console.warn(`[${PLUGIN_NAME}] Warning: Could not remove plugin directory ${pluginRoot}: ${err.message}`);
24
+ console.error(`[${shared.PLUGIN_NAME}] Failed to uninstall: ${err.message}`);
25
+ process.exitCode = 1;
26
+ return;
56
27
  }
57
28
  }
58
29
 
59
- removeMarketplaceEntry(marketplacePath);
60
-
61
- // Try native copilot CLI unregistration first; fall back to manual config.json
62
- if (!unregisterViaCopilotCli()) {
63
- deregisterCopilotPlugin(pluginRoot);
64
- }
65
-
66
- removeLegacyHooks(copilotHome);
67
-
68
- if (!removedPlugin) {
69
- console.log(`[${PLUGIN_NAME}] Plugin directory not found, config and hooks cleaned if present.`);
70
- return;
30
+ try {
31
+ if (typeof shared.deregisterCopilotPlugin === 'function') {
32
+ shared.deregisterCopilotPlugin(pluginRoot);
33
+ }
34
+ if (copilotHome && typeof shared.removeManagedHooks === 'function') {
35
+ shared.removeManagedHooks(copilotHome);
36
+ }
37
+ if (marketplacePath && typeof shared.removeMarketplaceEntry === 'function') {
38
+ shared.removeMarketplaceEntry(marketplacePath);
39
+ }
40
+ } catch (err) {
41
+ console.error(`[${shared.PLUGIN_NAME}] Failed to clean up uninstall state: ${err.message}`);
42
+ process.exitCode = 1;
71
43
  }
72
-
73
- console.log(`[${PLUGIN_NAME}] Restart GitHub Copilot CLI to complete uninstallation.`);
74
44
  }
75
45
 
76
46
  main();
@@ -0,0 +1,64 @@
1
+ ---
2
+ description: manage Babysitter blueprints. Use this command to list installed blueprints, browse marketplaces, install, update, uninstall, configure, or create a new blueprint.
3
+ argument-hint: Blueprint action and options.
4
+ ---
5
+
6
+ This command installs and manages Babysitter blueprints. A blueprint is a version-managed package of contextual instructions or deterministic Babysitter processes, not a conventional software plugin.
7
+
8
+ If the command is run without arguments, list installed blueprints with their name, version, marketplace, installation date, and last update date. Also list configured marketplaces and show how to add the default marketplace when none exist.
9
+
10
+ Blueprints can be installed at two scopes:
11
+
12
+ - **global** (`--global`): stored under `~/.a5c/`, available for all projects
13
+ - **project** (`--project`): stored under `<projectDir>/.a5c/`, project-specific
14
+
15
+ ## Marketplace Management
16
+
17
+ Marketplaces are git repositories containing a `marketplace.json` manifest and blueprint package directories. The SDK clones new marketplaces to `.a5c/blueprints/marketplaces/` for the selected scope and reads legacy `.a5c/marketplaces/` clones for compatibility.
18
+
19
+ ### Add a marketplace
20
+
21
+ ```bash
22
+ babysitter blueprint:add-marketplace --marketplace-url <url> [--marketplace-path <relative-path>] [--marketplace-branch <ref>] [--force] --global|--project [--json]
23
+ ```
24
+
25
+ ### Update a marketplace
26
+
27
+ ```bash
28
+ babysitter blueprint:update-marketplace --marketplace-name <name> [--marketplace-branch <ref>] --global|--project [--json]
29
+ ```
30
+
31
+ ### List blueprints in a marketplace
32
+
33
+ ```bash
34
+ babysitter blueprint:list-plugins --marketplace-name <name> --global|--project [--json]
35
+ ```
36
+
37
+ ## Blueprint Lifecycle
38
+
39
+ For `blueprint:install`, `blueprint:update`, `blueprint:configure`, and `blueprint:list-plugins`, the `--marketplace-name` flag is auto-detected when only one marketplace is cloned for the selected scope.
40
+
41
+ ```bash
42
+ babysitter blueprint:install --plugin-name <name> [--marketplace-name <mp>] --global|--project [--json]
43
+ babysitter blueprint:update --plugin-name <name> --marketplace-name <mp> --global|--project [--json]
44
+ babysitter blueprint:configure --plugin-name <name> --marketplace-name <mp> --global|--project [--json]
45
+ babysitter blueprint:uninstall --plugin-name <name> --marketplace-name <mp> --global|--project [--json]
46
+ ```
47
+
48
+ The `--plugin-name` flag is preserved for CLI compatibility with existing marketplace manifests. User-facing docs should call the installable a blueprint.
49
+
50
+ ## Registry Management
51
+
52
+ ```bash
53
+ babysitter blueprint:list-installed --global|--project [--json]
54
+ babysitter blueprint:update-registry --plugin-name <name> --plugin-version <ver> --marketplace-name <mp> --global|--project [--json]
55
+ babysitter blueprint:remove-from-registry --plugin-name <name> --global|--project [--json]
56
+ ```
57
+
58
+ ## Deprecated Aliases
59
+
60
+ The old `plugin:*` commands remain available as deprecated aliases for one release. Prefer `blueprint:*` in new docs, skills, and process instructions.
61
+
62
+ ## Agent Plugins Are Separate
63
+
64
+ Do not rename or reinterpret agent harness plugins while handling blueprints. `CLAUDE_PLUGIN_ROOT`, `PI_PLUGIN_ROOT`, `.claude/plugins/`, hooks-mux, extension-mux, and agent plugin manifests stay plugin-specific.
package/commands/call.md CHANGED
@@ -1,7 +1,11 @@
1
- ---
2
- description: Orchestrate a babysitter run. use this command to start babysitting a complex workflow.
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).
1
+ ---
2
+ description: Orchestrate a babysitter run. use this command to start babysitting a complex workflow.
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). 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
@@ -0,0 +1,68 @@
1
+ ---
2
+ description: Pre-deploy gate that scans built JS chunks for forbidden substring markers (saga-era / obsolete code paths) listed in a project-local forbidden-markers.txt
3
+ argument-hint: "[--markers-file <path>] [--chunks-dir <path>] [--json] Optional overrides; defaults are project-relative."
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). Compose the gate from the shared helper at `library/processes/shared/forbidden-markers-scanner.js` (issue #477).
8
+
9
+ ## What this gate does
10
+
11
+ Reads a list of literal substring markers from `scripts/forbidden-markers.txt` (blank lines and `#`-prefixed comments stripped) and greps every `.js` chunk under `.vercel/output/static/_next/static/chunks/` (Next.js / Vercel default; configurable) for any occurrence. Reports structured hits per `(marker, chunk)` pair with occurrence counts. Designed to chain between `vercel build --prod` and `vercel deploy --prod`.
12
+
13
+ Use this gate when a refactor or restart-from-baseline replaced load-bearing code paths and you need a structural guarantee the obsolete symbols never re-ship. Burned-in evidence: cookbook VI-9 / VI-12 near-miss revivals during the 2026-05 iOS-Safari saga; the prototype lives at `cookbook/scripts/check-no-forbidden.mjs` and shipped two upstream contributions before being generalized as this gate.
14
+
15
+ ## When to use
16
+
17
+ - **Pre-deploy.** Insert after build, before deploy. Block the deploy when `ok: false`.
18
+ - **Post-restart.** After a baseline rollback + step-by-step re-add, snapshot the saga-era markers in `forbidden-markers.txt` and let CI hold the line.
19
+ - **Post-refactor.** When old helper / handler / module names must not coexist with the new ones in the same bundle.
20
+
21
+ ## Expected config locations
22
+
23
+ - `scripts/forbidden-markers.txt` — one marker per line, `#` for comments. The list is the contract; the gate is mechanical. Commit this file to source control.
24
+ - `.vercel/output/static/_next/static/chunks/` — default scan target. Override for non-Vercel frameworks via the `--chunks-dir` flag or the `chunksDir` task input.
25
+
26
+ A missing markers file is a no-op (`ok: true`, `reason: 'missing-markers-file'`) — misconfiguration is never a deploy block. A missing chunks directory is likewise a no-op (`reason: 'missing-chunks-dir'`) so the gate is safe to chain into `check:all` before the build runs.
27
+
28
+ ## Exit semantics
29
+
30
+ | Reason | `ok` | Deploy decision |
31
+ |-------------------------|--------|--------------------------------|
32
+ | `missing-markers-file` | true | Pass (no gate active) |
33
+ | `missing-chunks-dir` | true | Pass (run before build) |
34
+ | `empty-markers` | true | Pass (list is empty) |
35
+ | `no-chunks` | true | Pass (nothing to scan) |
36
+ | `clean` | true | Pass — proceed to deploy |
37
+ | `hits` | false | **BLOCK** — surface hits, ask for triage |
38
+
39
+ For each hit, the gate emits `{ marker, chunk, count }` so the operator sees the exact marker string, the absolute chunk path, and the number of occurrences in that chunk. Multiple hits across chunks for the same marker are reported separately.
40
+
41
+ ## Programmatic surface
42
+
43
+ ```js
44
+ import { scanForbiddenMarkers, checkForbiddenMarkersTask } from '@a5c-ai/babysitter-library/processes/shared';
45
+
46
+ // Direct call:
47
+ const result = await scanForbiddenMarkers({
48
+ markersFile: 'scripts/forbidden-markers.txt',
49
+ chunksDir: '.vercel/output/static/_next/static/chunks',
50
+ });
51
+ if (!result.ok) {
52
+ // result.hits: Array<{ marker, chunk, count }>
53
+ // result.reason === 'hits'
54
+ process.exit(1);
55
+ }
56
+
57
+ // Or dispatched as a babysitter task:
58
+ const gate = await ctx.task(checkForbiddenMarkersTask, {
59
+ projectDir: '.',
60
+ // markersFile / chunksDir are inferred from projectDir if omitted
61
+ });
62
+ ```
63
+
64
+ ## Reference
65
+
66
+ - Issue: https://github.com/a5c-ai/babysitter/issues/477
67
+ - Helper module: `library/processes/shared/forbidden-markers-scanner.js`
68
+ - Origin (cookbook prototype): `cookbook/scripts/check-no-forbidden.mjs` (81 lines)
@@ -6,15 +6,43 @@ allowed-tools: Read, Grep, Write, Task, Bash, Edit, Grep, Glob, WebFetch, WebSea
6
6
 
7
7
  Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
8
8
 
9
- Create and run a cleanup process using the process at `skills\babysit\process\cradle\cleanup-runs.js/processes/cleanup-runs.js`.
9
+ Resolve the active process library with:
10
+
11
+ ```bash
12
+ babysitter process-library:active --json
13
+ ```
14
+
15
+ Read `binding.dir` from that JSON and create/run the cleanup process from `cradle/cleanup-runs.js#process` relative to that active library root. Do not use plugin-cache-relative cradle paths.
10
16
 
11
17
  Implementation notes (for the process):
12
18
  - 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
19
+
20
+ CRITICAL: The cleanup MUST follow this exact phase order. Do NOT delete any run before Phase 2 completes.
21
+
22
+ Phase 1 Scan:
23
+ - Scan .a5c/runs/ for all runs
24
+ - Classify each as terminal (completed/failed) or active (in-progress/created)
25
+ - Identify terminal runs older than the keep-days threshold as removal candidates
26
+ - Never mark active/in-progress runs for removal
27
+ - Count and report: total runs, terminal, active, removal candidates, disk usage
28
+
29
+ Phase 2 — Aggregate insights (BEFORE any deletion):
30
+ - For EVERY removal candidate, read its run.json and journal/ events
31
+ - Extract: processId, prompt, status, event count, created date, task summaries
32
+ - Group by process type and extract patterns (retry counts, convergence behavior, failure modes)
33
+ - Append a new dated section to docs/run-history-insights.md with:
34
+ - Summary statistics (runs removed, disk freed, runs retained)
35
+ - Run categories with counts and descriptions
36
+ - Key patterns observed (multi-batch convergence, retry behavior, etc.)
37
+ - What worked well / what didn't from the run data
38
+ - This file MUST be written and verified before proceeding to Phase 3
39
+
40
+ Phase 3 — Confirm removal:
41
+ - In interactive mode, show the user what will be removed via a breakpoint
42
+ - In non-interactive mode (yolo), proceed with defaults
43
+ - In dry-run mode, stop here and show what would be removed
44
+
45
+ Phase 4 — Remove:
46
+ - Delete the terminal runs older than keep-days threshold
47
+ - Identify and remove orphaned process files not referenced by remaining runs
48
+ - Show remaining run count and disk usage after cleanup
@@ -1,33 +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
-
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
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
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
33
  * If arguments are empty: use the `contribute.js` router process to show options and route accordingly
@@ -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
@@ -1,7 +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
-
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
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.