@a5c-ai/babysitter-openclaw 5.0.1-staging.75c8fb21 → 5.0.1-staging.792ae5657ca6

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 (39) hide show
  1. package/README.md +17 -10
  2. package/bin/install-shared.cjs +1 -1
  3. package/commands/call.md +5 -1
  4. package/commands/cleanup.md +30 -8
  5. package/commands/doctor.md +2 -3
  6. package/commands/yolo.md +11 -7
  7. package/extensions/hooks/gateway-request-completed.ts +20 -0
  8. package/extensions/hooks/gateway-request-received.ts +20 -0
  9. package/extensions/hooks/{before-prompt-build.ts → gateway-request-routed.ts} +3 -3
  10. package/extensions/hooks/{session-end.ts → plugin-tool-after.ts} +3 -3
  11. package/extensions/hooks/{session-start.ts → plugin-tool-before.ts} +3 -3
  12. package/extensions/hooks/{agent-end.ts → plugin-turn-stop.ts} +3 -3
  13. package/hooks/{babysitter-proxied-session-end.js → babysitter-proxied-gateway-request-completed.js} +0 -0
  14. package/hooks/{babysitter-proxied-session-end.sh → babysitter-proxied-gateway-request-completed.sh} +0 -0
  15. package/hooks/{babysitter-proxied-session-start.js → babysitter-proxied-gateway-request-received.js} +0 -0
  16. package/hooks/{babysitter-proxied-session-start.sh → babysitter-proxied-gateway-request-received.sh} +0 -0
  17. package/hooks/{babysitter-proxied-before-prompt-build.js → babysitter-proxied-gateway-request-routed.js} +1 -1
  18. package/hooks/babysitter-proxied-gateway-request-routed.sh +3 -0
  19. package/hooks/babysitter-proxied-plugin-tool-after.js +24 -0
  20. package/hooks/babysitter-proxied-plugin-tool-after.sh +3 -0
  21. package/hooks/babysitter-proxied-plugin-tool-before.js +24 -0
  22. package/hooks/babysitter-proxied-plugin-tool-before.sh +3 -0
  23. package/hooks/{babysitter-proxied-agent-end.js → babysitter-proxied-plugin-turn-stop.js} +1 -1
  24. package/hooks.json +1 -24
  25. package/openclaw.plugin.json +7 -5
  26. package/package.json +5 -6
  27. package/plugin.json +1 -1
  28. package/scripts/create-release-tag.mjs +18 -0
  29. package/scripts/publish-from-tag.mjs +41 -0
  30. package/scripts/team-install.cjs +1 -1
  31. package/skills/call/SKILL.md +5 -1
  32. package/skills/cleanup/SKILL.md +30 -8
  33. package/skills/doctor/SKILL.md +2 -3
  34. package/skills/yolo/SKILL.md +5 -1
  35. package/versions.json +2 -2
  36. package/hooks/babysitter-proxied-agent-end.sh +0 -3
  37. package/hooks/babysitter-proxied-before-prompt-build.sh +0 -3
  38. package/scripts/sync-command-docs.cjs +0 -107
  39. /package/hooks/{babysitter-proxied-stop-hook.sh → babysitter-proxied-plugin-turn-stop.sh} +0 -0
package/README.md CHANGED
@@ -13,24 +13,31 @@ The SDK (`@a5c-ai/babysitter-sdk`) remains the single source of truth for orches
13
13
 
14
14
  ## Installation
15
15
 
16
- ### Primary: Babysitter Harness Install
16
+ Install the Babysitter CLI once:
17
17
 
18
18
  ```bash
19
- babysitter harness:install-plugin openclaw
19
+ npm install -g @a5c-ai/babysitter
20
20
  ```
21
21
 
22
- This installs the `@a5c-ai/babysitter-openclaw` npm package and registers it with OpenClaw.
22
+ ### Primary: Babysitter Harness Install
23
23
 
24
- ### Secondary: npm
24
+ Use the SDK helper for scriptable global or workspace installs. This is the canonical path used by the installer tests and resolves to `npx --yes @a5c-ai/babysitter-openclaw install ...` under the hood:
25
25
 
26
26
  ```bash
27
- npm install -g @a5c-ai/babysitter-openclaw
27
+ # Global install
28
+ babysitter harness:install-plugin openclaw
29
+
30
+ # Workspace install
31
+ babysitter harness:install-plugin openclaw --workspace /path/to/repo
28
32
  ```
29
33
 
30
- The `postinstall` script registers the plugin globally. To install into a specific workspace:
34
+ This installs the `@a5c-ai/babysitter-openclaw` npm package and registers it with OpenClaw.
35
+
36
+ ### Secondary: Published package installer
31
37
 
32
38
  ```bash
33
- npx @a5c-ai/babysitter-openclaw install --workspace /path/to/repo
39
+ npx --yes @a5c-ai/babysitter-openclaw install --global
40
+ npx --yes @a5c-ai/babysitter-openclaw install --workspace /path/to/repo
34
41
  ```
35
42
 
36
43
  ### Verify Installation
@@ -42,7 +49,7 @@ babysitter harness:discover --json
42
49
  ### Removal
43
50
 
44
51
  ```bash
45
- npm uninstall -g @a5c-ai/babysitter-openclaw
52
+ npx --yes @a5c-ai/babysitter-openclaw uninstall --global
46
53
  ```
47
54
 
48
55
  ## Architecture
@@ -204,7 +211,7 @@ When the `babysitter` CLI is not available globally, hooks fall back to `npx -y
204
211
  ## Plugin Layout
205
212
 
206
213
  ```text
207
- plugins/babysitter-openclaw/
214
+ artifacts/generated-plugins/openclaw/
208
215
  |-- package.json # npm package manifest
209
216
  |-- plugin.json # Babysitter plugin manifest
210
217
  |-- openclaw.plugin.json # OpenClaw-native plugin manifest
@@ -262,7 +269,7 @@ npm install
262
269
  ### Running Tests
263
270
 
264
271
  ```bash
265
- cd plugins/babysitter-openclaw
272
+ cd artifacts/generated-plugins/openclaw
266
273
  npm test
267
274
  npm run test:integration
268
275
  npm run test:packaged-install
@@ -104,7 +104,7 @@ function ensureMarketplaceEntry(marketplacePath, pluginRoot) {
104
104
  name: PLUGIN_NAME,
105
105
  source: relSource,
106
106
  description: "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval",
107
- version: "5.0.0",
107
+ version: "5.0.1-staging.792ae5657ca6",
108
108
  author: { name: "a5c.ai" },
109
109
  };
110
110
  if (idx >= 0) marketplace.plugins[idx] = entry;
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`.
package/commands/yolo.md CHANGED
@@ -1,7 +1,11 @@
1
- ---
2
- description: Orchestrate a babysitter run. use this command to start babysitting a complex workflow in a non-interactive mode, without any user interaction or breakpoints in the 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 without any user interaction or breakpoints in the run.
1
+ ---
2
+ description: Orchestrate a babysitter run. use this command to start babysitting a complex workflow in a non-interactive mode, without any user interaction or breakpoints in the 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
+ Start the Babysitter run directly through the CLI, without any user interaction or breakpoints. Do not invoke the Skill tool and do not run an instructions-only command. In Claude Code, use Bash to run `babysitter harness:yolo --harness claude-code --workspace "$PWD" --prompt "<user arguments>" --json`; in Codex, run `babysitter harness:yolo --harness codex --workspace "$PWD" --prompt "<user arguments>" --json`; in other harnesses, use the same command with that harness id. Replace `<user arguments>` with the arguments shown below, wait for the command to finish, and treat the CLI completion proof as the result.
8
+
9
+ User arguments for this command:
10
+
11
+ $ARGUMENTS
@@ -0,0 +1,20 @@
1
+ /**
2
+ * OpenClaw gateway.request.completed hook — delegates to shell script.
3
+ */
4
+ import { execFileSync } from "node:child_process";
5
+ import { resolve, dirname } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ const PLUGIN_ROOT = resolve(__dirname, "../..");
10
+
11
+ export async function gatewayRequestCompletedHandler(context: Record<string, unknown>): Promise<void> {
12
+ try {
13
+ execFileSync("bash", [resolve(PLUGIN_ROOT, "hooks/babysitter-proxied-gateway-request-completed.sh")], {
14
+ input: JSON.stringify(context),
15
+ stdio: ["pipe", "pipe", "pipe"],
16
+ timeout: 30000,
17
+ env: { ...process.env, ADAPTER_NAME: "openclaw", PLUGIN_ROOT },
18
+ });
19
+ } catch { /* best-effort */ }
20
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * OpenClaw gateway.request.received hook — delegates to shell script.
3
+ */
4
+ import { execFileSync } from "node:child_process";
5
+ import { resolve, dirname } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ const PLUGIN_ROOT = resolve(__dirname, "../..");
10
+
11
+ export async function gatewayRequestReceivedHandler(context: Record<string, unknown>): Promise<void> {
12
+ try {
13
+ execFileSync("bash", [resolve(PLUGIN_ROOT, "hooks/babysitter-proxied-gateway-request-received.sh")], {
14
+ input: JSON.stringify(context),
15
+ stdio: ["pipe", "pipe", "pipe"],
16
+ timeout: 30000,
17
+ env: { ...process.env, ADAPTER_NAME: "openclaw", PLUGIN_ROOT },
18
+ });
19
+ } catch { /* best-effort */ }
20
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OpenClaw before_prompt_build hook — delegates to shell script.
2
+ * OpenClaw gateway.request.routed hook — delegates to shell script.
3
3
  */
4
4
  import { execFileSync } from "node:child_process";
5
5
  import { resolve, dirname } from "node:path";
@@ -8,9 +8,9 @@ import { fileURLToPath } from "node:url";
8
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
9
  const PLUGIN_ROOT = resolve(__dirname, "../..");
10
10
 
11
- export async function beforePromptBuildHandler(context: Record<string, unknown>): Promise<void> {
11
+ export async function gatewayRequestRoutedHandler(context: Record<string, unknown>): Promise<void> {
12
12
  try {
13
- execFileSync("bash", [resolve(PLUGIN_ROOT, "hooks/babysitter-proxied-before-prompt-build.sh")], {
13
+ execFileSync("bash", [resolve(PLUGIN_ROOT, "hooks/babysitter-proxied-gateway-request-routed.sh")], {
14
14
  input: JSON.stringify(context),
15
15
  stdio: ["pipe", "pipe", "pipe"],
16
16
  timeout: 30000,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OpenClaw session_end hook — delegates to shell script.
2
+ * OpenClaw plugin.tool.after hook — delegates to shell script.
3
3
  */
4
4
  import { execFileSync } from "node:child_process";
5
5
  import { resolve, dirname } from "node:path";
@@ -8,9 +8,9 @@ import { fileURLToPath } from "node:url";
8
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
9
  const PLUGIN_ROOT = resolve(__dirname, "../..");
10
10
 
11
- export async function sessionEndHandler(context: Record<string, unknown>): Promise<void> {
11
+ export async function pluginToolAfterHandler(context: Record<string, unknown>): Promise<void> {
12
12
  try {
13
- execFileSync("bash", [resolve(PLUGIN_ROOT, "hooks/babysitter-proxied-session-end.sh")], {
13
+ execFileSync("bash", [resolve(PLUGIN_ROOT, "hooks/babysitter-proxied-plugin-tool-after.sh")], {
14
14
  input: JSON.stringify(context),
15
15
  stdio: ["pipe", "pipe", "pipe"],
16
16
  timeout: 30000,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OpenClaw session_start hook — delegates to shell script.
2
+ * OpenClaw plugin.tool.before hook — delegates to shell script.
3
3
  */
4
4
  import { execFileSync } from "node:child_process";
5
5
  import { resolve, dirname } from "node:path";
@@ -8,9 +8,9 @@ import { fileURLToPath } from "node:url";
8
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
9
  const PLUGIN_ROOT = resolve(__dirname, "../..");
10
10
 
11
- export async function sessionStartHandler(context: Record<string, unknown>): Promise<void> {
11
+ export async function pluginToolBeforeHandler(context: Record<string, unknown>): Promise<void> {
12
12
  try {
13
- execFileSync("bash", [resolve(PLUGIN_ROOT, "hooks/babysitter-proxied-session-start.sh")], {
13
+ execFileSync("bash", [resolve(PLUGIN_ROOT, "hooks/babysitter-proxied-plugin-tool-before.sh")], {
14
14
  input: JSON.stringify(context),
15
15
  stdio: ["pipe", "pipe", "pipe"],
16
16
  timeout: 30000,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OpenClaw agent_end hook — delegates to shell script.
2
+ * OpenClaw plugin.turn.stop hook — delegates to shell script.
3
3
  */
4
4
  import { execFileSync } from "node:child_process";
5
5
  import { resolve, dirname } from "node:path";
@@ -8,9 +8,9 @@ import { fileURLToPath } from "node:url";
8
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
9
  const PLUGIN_ROOT = resolve(__dirname, "../..");
10
10
 
11
- export async function agentEndHandler(context: Record<string, unknown>): Promise<void> {
11
+ export async function pluginTurnStopHandler(context: Record<string, unknown>): Promise<void> {
12
12
  try {
13
- execFileSync("bash", [resolve(PLUGIN_ROOT, "hooks/babysitter-proxied-agent-end.sh")], {
13
+ execFileSync("bash", [resolve(PLUGIN_ROOT, "hooks/babysitter-proxied-plugin-turn-stop.sh")], {
14
14
  input: JSON.stringify(context),
15
15
  stdio: ["pipe", "pipe", "pipe"],
16
16
  timeout: 30000,
@@ -8,7 +8,7 @@ var PLUGIN_ROOT = process.env.PLUGIN_ROOT || process.env.PLUGIN_ROOT || path.res
8
8
  var stdin = "";
9
9
  try { stdin = readFileSync(0, "utf8"); } catch {}
10
10
  try {
11
- var result = execSync("bash " + JSON.stringify(path.join(PLUGIN_ROOT, "hooks/before-prompt-build.sh")), {
11
+ var result = execSync("bash " + JSON.stringify(path.join(PLUGIN_ROOT, "hooks/user-prompt-submit.sh")), {
12
12
  input: stdin,
13
13
  stdio: ["pipe", "pipe", "pipe"],
14
14
  timeout: 30000,
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ babysitter hook:run --harness unified --hook-type user-prompt-submit --json
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var execSync = require("child_process").execSync;
4
+ var path = require("path");
5
+ var readFileSync = require("fs").readFileSync;
6
+
7
+ var PLUGIN_ROOT = process.env.PLUGIN_ROOT || process.env.PLUGIN_ROOT || path.resolve(__dirname, "..");
8
+ var stdin = "";
9
+ try { stdin = readFileSync(0, "utf8"); } catch {}
10
+ try {
11
+ var result = execSync("bash " + JSON.stringify(path.join(PLUGIN_ROOT, "hooks/post-tool-use.sh")), {
12
+ input: stdin,
13
+ stdio: ["pipe", "pipe", "pipe"],
14
+ timeout: 30000,
15
+ env: Object.assign({}, process.env, {
16
+ HOOK_TYPE: process.env.HOOK_TYPE || "",
17
+ ADAPTER_NAME: process.env.ADAPTER_NAME || "openclaw",
18
+ PLUGIN_ROOT: PLUGIN_ROOT
19
+ })
20
+ });
21
+ process.stdout.write(result);
22
+ } catch (e) {
23
+ process.stdout.write("{}\n");
24
+ }
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ babysitter hook:run --harness unified --hook-type post-tool-use --json
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var execSync = require("child_process").execSync;
4
+ var path = require("path");
5
+ var readFileSync = require("fs").readFileSync;
6
+
7
+ var PLUGIN_ROOT = process.env.PLUGIN_ROOT || process.env.PLUGIN_ROOT || path.resolve(__dirname, "..");
8
+ var stdin = "";
9
+ try { stdin = readFileSync(0, "utf8"); } catch {}
10
+ try {
11
+ var result = execSync("bash " + JSON.stringify(path.join(PLUGIN_ROOT, "hooks/pre-tool-use.sh")), {
12
+ input: stdin,
13
+ stdio: ["pipe", "pipe", "pipe"],
14
+ timeout: 30000,
15
+ env: Object.assign({}, process.env, {
16
+ HOOK_TYPE: process.env.HOOK_TYPE || "",
17
+ ADAPTER_NAME: process.env.ADAPTER_NAME || "openclaw",
18
+ PLUGIN_ROOT: PLUGIN_ROOT
19
+ })
20
+ });
21
+ process.stdout.write(result);
22
+ } catch (e) {
23
+ process.stdout.write("{}\n");
24
+ }
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ babysitter hook:run --harness unified --hook-type pre-tool-use --json
@@ -8,7 +8,7 @@ var PLUGIN_ROOT = process.env.PLUGIN_ROOT || process.env.PLUGIN_ROOT || path.res
8
8
  var stdin = "";
9
9
  try { stdin = readFileSync(0, "utf8"); } catch {}
10
10
  try {
11
- var result = execSync("bash " + JSON.stringify(path.join(PLUGIN_ROOT, "hooks/after-agent.sh")), {
11
+ var result = execSync("bash " + JSON.stringify(path.join(PLUGIN_ROOT, "hooks/stop.sh")), {
12
12
  input: stdin,
13
13
  stdio: ["pipe", "pipe", "pipe"],
14
14
  timeout: 30000,
package/hooks.json CHANGED
@@ -1,27 +1,4 @@
1
1
  {
2
2
  "description": "babysitter plugin hooks for OpenClaw",
3
- "hooks": {
4
- "SessionStart": [
5
- {
6
- "matcher": "*",
7
- "hooks": [
8
- {
9
- "type": "command",
10
- "command": "./hooks/babysitter-proxied-session-start.sh"
11
- }
12
- ]
13
- }
14
- ],
15
- "Stop": [
16
- {
17
- "matcher": "*",
18
- "hooks": [
19
- {
20
- "type": "command",
21
- "command": "./hooks/babysitter-proxied-stop-hook.sh"
22
- }
23
- ]
24
- }
25
- ]
26
- }
3
+ "hooks": {}
27
4
  }
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "babysitter",
3
- "version": "5.0.1-staging.75c8fb21",
3
+ "version": "5.0.1-staging.792ae5657ca6",
4
4
  "description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval",
5
5
  "entrypoint": "extensions/index.ts",
6
6
  "hooks": {
7
- "session_start": "extensions/hooks/session-start.ts",
8
- "agent_end": "extensions/hooks/agent-end.ts",
9
- "session_end": "extensions/hooks/session-end.ts",
10
- "before_prompt_build": "extensions/hooks/before-prompt-build.ts"
7
+ "gateway.request.received": "extensions/hooks/gateway-request-received.ts",
8
+ "plugin.turn.stop": "extensions/hooks/plugin-turn-stop.ts",
9
+ "gateway.request.routed": "extensions/hooks/gateway-request-routed.ts",
10
+ "plugin.tool.before": "extensions/hooks/plugin-tool-before.ts",
11
+ "plugin.tool.after": "extensions/hooks/plugin-tool-after.ts",
12
+ "gateway.request.completed": "extensions/hooks/gateway-request-completed.ts"
11
13
  },
12
14
  "capabilities": [
13
15
  "orchestration",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a5c-ai/babysitter-openclaw",
3
- "version": "5.0.1-staging.75c8fb21",
3
+ "version": "5.0.1-staging.792ae5657ca6",
4
4
  "type": "module",
5
5
  "description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval",
6
6
  "openclaw": {
@@ -22,7 +22,7 @@
22
22
  "sdk-integration"
23
23
  ],
24
24
  "dependencies": {
25
- "@a5c-ai/babysitter-sdk": "5.0.1-staging.75c8fb21"
25
+ "@a5c-ai/babysitter-sdk": "5.0.1-staging.792ae5657ca6"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "openclaw": "*"
@@ -60,11 +60,10 @@
60
60
  },
61
61
  "repository": {
62
62
  "type": "git",
63
- "url": "git+https://github.com/a5c-ai/babysitter.git",
64
- "directory": "plugins/babysitter-openclaw"
63
+ "url": "git+https://github.com/a5c-ai/babysitter-openclaw.git"
65
64
  },
66
- "homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-openclaw#readme",
65
+ "homepage": "https://github.com/a5c-ai/babysitter-openclaw#readme",
67
66
  "bugs": {
68
- "url": "https://github.com/a5c-ai/babysitter/issues"
67
+ "url": "https://github.com/a5c-ai/babysitter-openclaw/issues"
69
68
  }
70
69
  }
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babysitter",
3
- "version": "5.0.1-staging.75c8fb21",
3
+ "version": "5.0.1-staging.792ae5657ca6",
4
4
  "description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval",
5
5
  "author": "a5c.ai",
6
6
  "license": "MIT",
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'node:child_process';
3
+ import { existsSync, readFileSync } from 'node:fs';
4
+
5
+ function run(command, args) {
6
+ const result = spawnSync(command, args, { encoding: 'utf8', stdio: 'inherit' });
7
+ if (result.status !== 0) process.exit(result.status || 1);
8
+ }
9
+
10
+ const branch = process.env.GITHUB_REF_NAME || 'develop';
11
+ const sha = (process.env.GITHUB_SHA || '').slice(0, 12);
12
+ const version = existsSync('package.json') ? JSON.parse(readFileSync('package.json', 'utf8')).version : JSON.parse(readFileSync('versions.json', 'utf8')).sdkVersion;
13
+ const normalized = String(version).replace(/[^0-9A-Za-z._-]/g, '-');
14
+ const tag = 'release/' + branch + '/v' + normalized + '-' + sha;
15
+ run('git', ['config', 'user.name', 'github-actions[bot]']);
16
+ run('git', ['config', 'user.email', 'github-actions[bot]@users.noreply.github.com']);
17
+ run('git', ['tag', tag]);
18
+ run('git', ['push', 'origin', tag]);
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'node:child_process';
3
+ import { readFileSync } from 'node:fs';
4
+
5
+ function run(command, args, options = {}) {
6
+ const result = spawnSync(command, args, { stdio: options.stdio || 'inherit', encoding: options.encoding });
7
+ if (result.status !== 0 && !options.allowFailure) process.exit(result.status || 1);
8
+ return result;
9
+ }
10
+
11
+ function npmView(packageSpec) {
12
+ return run('npm', ['view', packageSpec, 'version'], { allowFailure: true, stdio: 'pipe', encoding: 'utf8' }).status === 0;
13
+ }
14
+
15
+ const pkg = JSON.parse(readFileSync('package.json', 'utf8'));
16
+ const ref = process.env.GITHUB_REF_NAME || '';
17
+ const branch = ref.split('/')[1] || 'develop';
18
+ const tag = branch === 'main' ? 'latest' : branch;
19
+
20
+ if (!process.env.NODE_AUTH_TOKEN) {
21
+ console.log('NODE_AUTH_TOKEN is not configured; skipping npm publish.');
22
+ process.exit(0);
23
+ }
24
+
25
+ if (npmView(pkg.name + '@' + pkg.version)) {
26
+ console.log(pkg.name + '@' + pkg.version + ' already exists; ensuring dist-tag ' + tag + '.');
27
+ run('npm', ['dist-tag', 'add', pkg.name + '@' + pkg.version, tag], { allowFailure: true });
28
+ process.exit(0);
29
+ }
30
+
31
+ for (const field of ['dependencies', 'peerDependencies', 'optionalDependencies']) {
32
+ for (const [name, version] of Object.entries(pkg[field] || {})) {
33
+ if (!name.startsWith('@a5c-ai/') || version.startsWith('^') || version.startsWith('~') || version === '*' || version.startsWith('workspace:')) continue;
34
+ if (!npmView(name + '@' + version)) {
35
+ console.log('Required internal dependency ' + name + '@' + version + ' is not published yet; skipping npm publish.');
36
+ process.exit(0);
37
+ }
38
+ }
39
+ }
40
+
41
+ run('npm', ['publish', '--access', 'public', '--tag', tag]);
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var path = require('path');
5
- var shared = require('../bin/install-shared');
5
+ var shared = require('../bin/install-shared.cjs');
6
6
 
7
7
  var workspace = process.cwd();
8
8
  for (var i = 0; i < process.argv.length; i++) {
@@ -5,4 +5,8 @@ description: Orchestrate a babysitter run. use this command to start babysitting
5
5
 
6
6
  # call
7
7
 
8
- Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
8
+ 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.
9
+
10
+ User arguments for this command:
11
+
12
+ $ARGUMENTS
@@ -11,11 +11,33 @@ Create and run a cleanup process using the process at `skills\babysit\process\cr
11
11
 
12
12
  Implementation notes (for the process):
13
13
  - Parse arguments for `--dry-run` flag (if present, set dryRun: true in inputs) and `--keep-days N` (default: 7)
14
- - The process scans .a5c/runs/ for completed/failed runs, aggregates insights, writes summaries, then removes old data
15
- - Always show the user what will be removed before removing (in interactive mode via breakpoints)
16
- - In non-interactive mode (yolo), proceed with cleanup using defaults
17
- - The insights file goes to docs/run-history-insights.md
18
- - Only remove terminal runs (completed/failed) older than the keep-days threshold
19
- - Never remove active/in-progress runs
20
- - Remove orphaned process files not referenced by remaining runs
21
- - After cleanup, show remaining run count and disk usage
14
+
15
+ CRITICAL: The cleanup MUST follow this exact phase order. Do NOT delete any run before Phase 2 completes.
16
+
17
+ Phase 1 — Scan:
18
+ - Scan .a5c/runs/ for all runs
19
+ - Classify each as terminal (completed/failed) or active (in-progress/created)
20
+ - Identify terminal runs older than the keep-days threshold as removal candidates
21
+ - Never mark active/in-progress runs for removal
22
+ - Count and report: total runs, terminal, active, removal candidates, disk usage
23
+
24
+ Phase 2 — Aggregate insights (BEFORE any deletion):
25
+ - For EVERY removal candidate, read its run.json and journal/ events
26
+ - Extract: processId, prompt, status, event count, created date, task summaries
27
+ - Group by process type and extract patterns (retry counts, convergence behavior, failure modes)
28
+ - Append a new dated section to docs/run-history-insights.md with:
29
+ - Summary statistics (runs removed, disk freed, runs retained)
30
+ - Run categories with counts and descriptions
31
+ - Key patterns observed (multi-batch convergence, retry behavior, etc.)
32
+ - What worked well / what didn't from the run data
33
+ - This file MUST be written and verified before proceeding to Phase 3
34
+
35
+ Phase 3 — Confirm removal:
36
+ - In interactive mode, show the user what will be removed via a breakpoint
37
+ - In non-interactive mode (yolo), proceed with defaults
38
+ - In dry-run mode, stop here and show what would be removed
39
+
40
+ Phase 4 — Remove:
41
+ - Delete the terminal runs older than keep-days threshold
42
+ - Identify and remove orphaned process files not referenced by remaining runs
43
+ - Show remaining run count and disk usage after cleanup
@@ -157,7 +157,6 @@ If it exists:
157
157
  **Goal:** Inspect babysitter session files for health and detect runaway loops.
158
158
 
159
159
  - Search for session state files using Glob:
160
- - `plugins/babysitter/skills/babysit/state/*.md`
161
160
  - `.a5c/state/*.md`
162
161
  - `.a5c/state/*.json`
163
162
  - For each session state file found:
@@ -261,7 +260,7 @@ Mark as PASS if total size < 500MB and no files > 10MB. Mark as WARN if total si
261
260
 
262
261
  ### 10a. Hook Registration
263
262
 
264
- - 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.
263
+ - 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.
265
264
  - If found, read `hooks.json` and verify:
266
265
  - A `Stop` hook entry exists with a command referencing `babysitter-stop-hook.sh`.
267
266
  - A `SessionStart` hook entry exists with a command referencing `babysitter-session-start-hook.sh`.
@@ -316,7 +315,7 @@ If the stop hook shows NO evidence of execution (no log entries, no journal even
316
315
 
317
316
  Perform these diagnostic steps in order and report the first failure found:
318
317
 
319
- 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."
318
+ 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."
320
319
 
321
320
  2. **Plugin not enabled**: Check for Claude settings files:
322
321
  - `~/.claude/settings.json` — look for `babysitter` in `enabledPlugins`.
@@ -5,4 +5,8 @@ description: Orchestrate a babysitter run. use this command to start babysitting
5
5
 
6
6
  # yolo
7
7
 
8
- Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md). but without any user interaction or breakpoints in the run.
8
+ Start the Babysitter run directly through the CLI, without any user interaction or breakpoints. Do not invoke the Skill tool and do not run an instructions-only command. In Claude Code, use Bash to run `babysitter harness:yolo --harness claude-code --workspace "$PWD" --prompt "<user arguments>" --json`; in Codex, run `babysitter harness:yolo --harness codex --workspace "$PWD" --prompt "<user arguments>" --json`; in other harnesses, use the same command with that harness id. Replace `<user arguments>` with the arguments shown below, wait for the command to finish, and treat the CLI completion proof as the result.
9
+
10
+ User arguments for this command:
11
+
12
+ $ARGUMENTS
package/versions.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "sdkVersion": "5.0.1-staging.75c8fb21",
3
- "extensionVersion": "5.0.0"
2
+ "sdkVersion": "5.0.1-staging.792ae5657ca6",
3
+ "extensionVersion": "5.0.1-staging.792ae5657ca6"
4
4
  }
@@ -1,3 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- babysitter hook:run --harness unified --hook-type after-agent --json
@@ -1,3 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- babysitter hook:run --harness unified --hook-type before-prompt-build --json
@@ -1,107 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const {
5
- listMarkdownBasenames,
6
- reportCheckResult,
7
- syncCommandMirrors,
8
- syncSkillsFromCommands,
9
- writeFileIfChanged,
10
- } = require('../../../scripts/plugin-command-sync-lib.cjs');
11
-
12
- const PACKAGE_ROOT = path.resolve(__dirname, '..');
13
- const REPO_ROOT = path.resolve(PACKAGE_ROOT, '..', '..');
14
- const ROOT_COMMANDS = path.join(REPO_ROOT, 'plugins', 'babysitter', 'commands');
15
- const COMMANDS_ROOT = path.join(PACKAGE_ROOT, 'commands');
16
- const SKILLS_ROOT = path.join(PACKAGE_ROOT, 'skills');
17
- const LABEL = 'babysitter-openclaw sync';
18
-
19
- const BABYSIT_SKILL = `---
20
- name: babysit
21
- description: Orchestrate via @babysitter. Use this skill when asked to babysit a run, orchestrate a process or whenever it is called explicitly. (babysit, babysitter, orchestrate, orchestrate a run, workflow, etc.)
22
- ---
23
-
24
- # babysit
25
-
26
- Orchestrate \`.a5c/runs/<runId>/\` through iterative execution.
27
-
28
- ## Dependencies
29
-
30
- ### Babysitter SDK and CLI
31
-
32
- Read the SDK version from \`versions.json\` to ensure version compatibility:
33
-
34
- \`\`\`bash
35
- PLUGIN_ROOT="\${OPENCLAW_PLUGIN_ROOT:-\$(pwd)}"
36
- SDK_VERSION=$(node -e "try{const fs=require('fs');const path=require('path');const pluginRoot=process.env.OPENCLAW_PLUGIN_ROOT||process.env.PLUGIN_ROOT||process.cwd();const probes=[path.join(pluginRoot,'versions.json'),path.join(pluginRoot,'plugins','babysitter-openclaw','versions.json'),path.join(pluginRoot,'node_modules','@a5c-ai','babysitter-openclaw','versions.json'),path.join(process.cwd(),'node_modules','@a5c-ai','babysitter-openclaw','versions.json')];for(const probe of probes){if(fs.existsSync(probe)){console.log(JSON.parse(fs.readFileSync(probe,'utf8')).sdkVersion||'latest');process.exit(0)}}console.log('latest')}catch{console.log('latest')}")
37
- npm i -g @a5c-ai/babysitter-sdk@$SDK_VERSION
38
- CLI="npx -y @a5c-ai/babysitter-sdk@$SDK_VERSION"
39
- \`\`\`
40
-
41
- ## Instructions
42
-
43
- Run the following command to get full orchestration instructions:
44
-
45
- \`\`\`bash
46
- babysitter instructions:babysit-skill --harness openclaw --interactive
47
- \`\`\`
48
-
49
- For non-interactive mode:
50
-
51
- \`\`\`bash
52
- babysitter instructions:babysit-skill --harness openclaw --no-interactive
53
- \`\`\`
54
-
55
- Follow the instructions returned by the command above to orchestrate the run.
56
- `;
57
-
58
- function getCommandNames() {
59
- return listMarkdownBasenames(ROOT_COMMANDS);
60
- }
61
-
62
- function main() {
63
- const check = process.argv.includes('--check');
64
- const commandNames = getCommandNames();
65
- const mirrorResult = syncCommandMirrors({
66
- label: LABEL,
67
- sourceRoot: ROOT_COMMANDS,
68
- targetRoot: COMMANDS_ROOT,
69
- names: commandNames,
70
- check,
71
- cwd: PACKAGE_ROOT,
72
- });
73
- const skillsResult = syncSkillsFromCommands({
74
- label: LABEL,
75
- sourceRoot: COMMANDS_ROOT,
76
- skillsRoot: SKILLS_ROOT,
77
- names: commandNames,
78
- check,
79
- cwd: PACKAGE_ROOT,
80
- });
81
-
82
- const babysitSkillPath = path.join(SKILLS_ROOT, 'babysit', 'SKILL.md');
83
- if (check) {
84
- const fs = require('fs');
85
- const stale = [...mirrorResult.stale, ...skillsResult.stale];
86
- const current = fs.existsSync(babysitSkillPath)
87
- ? fs.readFileSync(babysitSkillPath, 'utf8')
88
- : null;
89
- if (current !== BABYSIT_SKILL) {
90
- stale.push(path.relative(PACKAGE_ROOT, babysitSkillPath));
91
- }
92
- reportCheckResult(LABEL, stale);
93
- return;
94
- }
95
-
96
- const babysitUpdated = writeFileIfChanged(babysitSkillPath, BABYSIT_SKILL) ? 1 : 0;
97
- const updated = mirrorResult.updated + skillsResult.updated + babysitUpdated;
98
-
99
- if (updated === 0) {
100
- console.log(`[${LABEL}] no openclaw command or skill changes were needed.`);
101
- return;
102
- }
103
-
104
- console.log(`[${LABEL}] updated ${updated} openclaw command/skill file(s).`);
105
- }
106
-
107
- main();