@a5c-ai/babysitter-omp 0.1.0 → 0.1.1-staging.0dc03363

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 (61) hide show
  1. package/AGENTS.md +131 -0
  2. package/README.md +79 -36
  3. package/bin/cli.cjs +3 -11
  4. package/bin/install.cjs +25 -124
  5. package/bin/uninstall.cjs +9 -29
  6. package/commands/assimilate.md +37 -0
  7. package/commands/call.md +7 -0
  8. package/commands/cleanup.md +20 -0
  9. package/commands/contrib.md +33 -0
  10. package/commands/doctor.md +426 -0
  11. package/commands/forever.md +7 -0
  12. package/commands/help.md +244 -0
  13. package/commands/observe.md +12 -0
  14. package/commands/plan.md +7 -0
  15. package/commands/plugins.md +255 -0
  16. package/commands/project-install.md +17 -0
  17. package/commands/resume.md +8 -0
  18. package/commands/retrospect.md +55 -0
  19. package/commands/user-install.md +17 -0
  20. package/commands/yolo.md +7 -0
  21. package/extensions/index.ts +55 -0
  22. package/package.json +9 -7
  23. package/scripts/sync-command-docs.cjs +72 -81
  24. package/skills/assimilate/SKILL.md +38 -0
  25. package/skills/babysit/SKILL.md +36 -0
  26. package/skills/call/SKILL.md +8 -0
  27. package/skills/cleanup/SKILL.md +21 -0
  28. package/skills/contrib/SKILL.md +34 -0
  29. package/skills/doctor/SKILL.md +427 -0
  30. package/skills/forever/SKILL.md +8 -0
  31. package/skills/help/SKILL.md +245 -0
  32. package/skills/observe/SKILL.md +13 -0
  33. package/skills/plan/SKILL.md +8 -0
  34. package/skills/plugins/SKILL.md +257 -0
  35. package/skills/project-install/SKILL.md +18 -0
  36. package/skills/resume/SKILL.md +9 -0
  37. package/skills/retrospect/SKILL.md +56 -0
  38. package/skills/user-install/SKILL.md +18 -0
  39. package/skills/yolo/SKILL.md +8 -0
  40. package/versions.json +3 -0
  41. package/commands/babysitter-call.md +0 -12
  42. package/commands/babysitter-doctor.md +0 -10
  43. package/commands/babysitter-resume.md +0 -16
  44. package/commands/babysitter-status.md +0 -15
  45. package/extensions/babysitter/cli-wrapper.ts +0 -95
  46. package/extensions/babysitter/constants.ts +0 -77
  47. package/extensions/babysitter/custom-tools.ts +0 -208
  48. package/extensions/babysitter/effect-executor.ts +0 -362
  49. package/extensions/babysitter/guards.ts +0 -257
  50. package/extensions/babysitter/index.ts +0 -554
  51. package/extensions/babysitter/loop-driver.ts +0 -256
  52. package/extensions/babysitter/result-poster.ts +0 -115
  53. package/extensions/babysitter/sdk-bridge.ts +0 -243
  54. package/extensions/babysitter/session-binder.ts +0 -284
  55. package/extensions/babysitter/status-line.ts +0 -54
  56. package/extensions/babysitter/task-interceptor.ts +0 -82
  57. package/extensions/babysitter/todo-replacement.ts +0 -125
  58. package/extensions/babysitter/tool-renderer.ts +0 -263
  59. package/extensions/babysitter/tui-widgets.ts +0 -164
  60. package/extensions/babysitter/types.ts +0 -222
  61. package/skills/babysitter/SKILL.md +0 -45
package/AGENTS.md ADDED
@@ -0,0 +1,131 @@
1
+ # Agent Instructions -- Babysitter Orchestration Plugin for oh-my-pi
2
+
3
+ This file governs agent behavior when the babysitter-pi plugin is active in an oh-my-pi session. Babysitter is the orchestration layer -- it drives multi-step workflows through process definitions, effects, and an iteration loop.
4
+
5
+ ---
6
+
7
+ ## 1. Session Start -- Auto-Initialization
8
+
9
+ Babysitter initializes automatically on every oh-my-pi session start. The session-binder extension:
10
+
11
+ 1. Binds the current pi session to the babysitter state directory (`.a5c/`).
12
+ 2. Checks for an active run by inspecting `.a5c/runs/` for pending tasks.
13
+ 3. If an active run exists, resumes from the first pending effect.
14
+ 4. If no run exists, proceeds with normal session behavior until a babysitter command is issued.
15
+
16
+ You do not need to initialize babysitter manually -- the plugin handles it.
17
+
18
+ ---
19
+
20
+ ## 2. Recognizing Babysitter Commands
21
+
22
+ When the user types a message starting with `/babysitter:` or `/babysitter`, treat it as a **slash command** and dispatch accordingly:
23
+
24
+ | Command | Description |
25
+ |---------|-------------|
26
+ | `/babysitter:call` | Start an orchestration run |
27
+ | `/babysitter:status` | Show current run status and pending effects |
28
+ | `/babysitter:resume` | Resume an existing run from where it left off |
29
+
30
+ Aliases:
31
+ - `/babysitter` (bare) = `/babysitter:call`
32
+
33
+ Load the corresponding skill from `skills/babysitter/SKILL.md` for detailed execution instructions.
34
+
35
+ ---
36
+
37
+ ## 3. Babysitter Orchestration Protocol
38
+
39
+ The core loop works as follows:
40
+
41
+ 1. **Create a run** -- A process definition (JS file) is loaded and a run is created under `.a5c/runs/<RUN_ID>/`.
42
+ 2. **Iterate** -- The SDK replays resolved effects, then throws when it encounters an unresolved effect. The iteration returns a list of **pending effects** (tasks to execute).
43
+ 3. **Execute effects** -- You execute each pending effect using the appropriate tool/action.
44
+ 4. **Post results** -- Report the outcome back to babysitter via the SDK bridge.
45
+ 5. **Repeat** -- The loop-driver triggers the next iteration automatically. Do NOT loop independently.
46
+
47
+ The plugin's loop-driver extension controls iteration flow. Complete one task, post the result, and the driver handles the rest.
48
+
49
+ ---
50
+
51
+ ## 4. Effect Types
52
+
53
+ When babysitter presents pending effects, identify the `kind` field and execute accordingly:
54
+
55
+ | Kind | Action |
56
+ |------|--------|
57
+ | `agent` | Build a prompt from the agent definition and execute as a sub-agent task |
58
+ | `skill` | Invoke the named skill with the provided parameters |
59
+ | `shell` | Execute the shell command and capture stdout/stderr/exit code |
60
+ | `breakpoint` | Pause execution and present the breakpoint message to the user for approval |
61
+ | `sleep` | Wait until the specified timestamp (handled by the runtime) |
62
+
63
+ For PI-family generated-process guidance, treat `agent`, `skill`, `shell`, `breakpoint`, and `sleep` as the active effect kinds. Do not present `node` as a generated PI-family effect kind.
64
+
65
+ ---
66
+
67
+ ## 5. Posting Results
68
+
69
+ After executing an effect, hand the outcome back to the Babysitter plugin/runtime bridge so the run state, journal, and pending-effect cache stay consistent.
70
+
71
+ Rules:
72
+ - Use the plugin-owned Babysitter bridge/command flow rather than inventing an alternate posting path.
73
+ - Complete one orchestration phase per harness turn, then let the loop-driver trigger the next phase.
74
+ - Do not abort the entire run on a single task failure -- return the effect outcome and let the orchestrator decide the next step.
75
+ - Keep low-level runtime mechanics in the command/extension implementation surface; this file is the behavioral contract for the active agent session.
76
+
77
+ ---
78
+
79
+ ## 6. Task Interception Notice
80
+
81
+ During an active babysitter run, the plugin's task-interceptor extension **intercepts built-in task and todo tools**. This means:
82
+
83
+ - Any task/todo creation is routed through babysitter's effect system instead of the default pi task manager.
84
+ - Do not attempt to use native task tools to track babysitter work -- they are redirected automatically.
85
+ - This interception is only active while a run is in progress. Normal tool behavior resumes after the run completes.
86
+
87
+ ---
88
+
89
+ ## 7. TUI Widgets
90
+
91
+ The babysitter-pi plugin renders TUI widgets showing run progress:
92
+
93
+ - **Status line** -- Current run ID, iteration count, and run state (running/waiting/completed/failed).
94
+ - **Effect queue** -- List of pending and completed effects with their status.
95
+ - **Progress indicator** -- Visual progress through the process definition.
96
+
97
+ These widgets update automatically as effects are resolved. No agent action is required to drive them.
98
+
99
+ ---
100
+
101
+ ## 8. Run Completion
102
+
103
+ When the orchestration run completes successfully, the SDK returns a completion proof. You MUST output it in the following format:
104
+
105
+ ```
106
+ <promise>PROOF_VALUE</promise>
107
+ ```
108
+
109
+ Where `PROOF_VALUE` is the exact proof string returned by the SDK. This signals to the wrapper and any upstream systems that the run finished with a verified result.
110
+
111
+ ---
112
+
113
+ ## 9. Directory Layout Reference
114
+
115
+ ```
116
+ .a5c/
117
+ runs/
118
+ <RUN_ID>/
119
+ run.json # Run metadata
120
+ inputs.json # Process inputs
121
+ journal/ # Append-only event log
122
+ 000001.<ulid>.json
123
+ tasks/
124
+ <EFFECT_ID>/
125
+ task.json # Task definition (created by orchestrator)
126
+ result.json # Task result (created after posting)
127
+ state/
128
+ state.json # Derived replay cache
129
+ ```
130
+
131
+ All paths are relative to the repository root.
package/README.md CHANGED
@@ -1,78 +1,121 @@
1
1
  # @a5c-ai/babysitter-omp
2
2
 
3
- Babysitter integration plugin for `oh-my-pi`. This package owns the
4
- oh-my-pi-specific install surface, command docs, and skill wiring while sharing
5
- compatible runtime internals with the upstream Pi-family.
3
+ Babysitter package for `oh-my-pi`.
6
4
 
7
- ## Integration Model
5
+ This is a thin oh-my-pi package:
8
6
 
9
- The oh-my-pi plugin keeps Babysitter as the orchestration layer for omp
10
- sessions:
11
-
12
- - session lifecycle hooks prepare and bind run state
13
- - omp commands start or resume runs
14
- - the harness advances one orchestration phase at a time
15
- - the plugin runtime records effect outcomes and updates the run state
16
- - completion requires the emitted `completionProof`
7
+ - `skills/` exposes Babysitter workflows through oh-my-pi's skill system
8
+ - `extensions/index.ts` adds lightweight slash-command aliases that forward to those skills
9
+ - the SDK remains responsible for orchestration, runs, tasks, and state
17
10
 
18
11
  ## Installation
19
12
 
20
- Install the published oh-my-pi plugin globally:
13
+ Recommended:
14
+
15
+ ```bash
16
+ omp plugin install @a5c-ai/babysitter-omp
17
+ ```
18
+
19
+ Verify the plugin is available:
21
20
 
22
21
  ```bash
23
- npx @a5c-ai/babysitter-omp install
22
+ babysitter harness:discover --json
24
23
  ```
25
24
 
26
- Install into a specific workspace instead of the user profile:
25
+ Development helper:
27
26
 
28
27
  ```bash
29
28
  npx @a5c-ai/babysitter-omp install --workspace /path/to/repo
30
29
  ```
31
30
 
32
- Or use the Babysitter SDK helper:
31
+ Removal:
33
32
 
34
33
  ```bash
35
- babysitter harness:install-plugin oh-my-pi
36
- babysitter harness:install-plugin oh-my-pi --workspace /path/to/repo
34
+ omp plugin uninstall @a5c-ai/babysitter-omp
37
35
  ```
38
36
 
39
- This package installs under:
37
+ ## Using Babysitter
38
+
39
+ Start oh-my-pi, then use the thin Babysitter entrypoints exposed by the plugin:
40
+
41
+ - `/babysit` or `/babysitter`
42
+ - `/call`
43
+ - `/plan`
44
+ - `/resume`
45
+ - `/doctor`
46
+ - `/yolo`
47
+
48
+ Each command forwards into oh-my-pi's native `/skill:<name>` flow. The
49
+ orchestration contract lives in the skills; the extension only provides
50
+ convenient aliases.
51
+
52
+ ## Commands And Skills
53
+
54
+ The package mirrors the canonical Babysitter command docs and exposes the core
55
+ `babysit` skill plus command-backed skills such as `call`, `doctor`, `plan`,
56
+ `resume`, and `yolo`.
57
+
58
+ The extension layer is intentionally thin. It only forwards slash commands to
59
+ oh-my-pi's built-in `/skill:<name>` flow; it does not implement a custom loop
60
+ driver, custom tools, or direct run mutation logic.
61
+
62
+ ## Plugin Layout
40
63
 
41
64
  ```text
42
- ~/.omp/plugins/babysitter
65
+ plugins/babysitter-omp/
66
+ |-- package.json
67
+ |-- versions.json
68
+ |-- extensions/
69
+ | `-- index.ts
70
+ |-- commands/
71
+ |-- skills/
72
+ |-- bin/
73
+ `-- scripts/
43
74
  ```
44
75
 
45
- If the workspace does not already have an active process-library binding, the
46
- installer bootstraps the shared global SDK process library automatically:
76
+ ## SDK Setup
77
+
78
+ Read the pinned SDK version from `versions.json` when you need a local CLI:
47
79
 
48
80
  ```bash
49
- babysitter process-library:active --json
81
+ PLUGIN_ROOT="${OMP_PLUGIN_ROOT:-$(pwd)}"
82
+ SDK_VERSION=$(node -e "try{const fs=require('fs');const path=require('path');const pluginRoot=process.env.OMP_PLUGIN_ROOT||process.env.PLUGIN_ROOT||process.cwd();const probes=[path.join(pluginRoot,'versions.json'),path.join(pluginRoot,'plugins','babysitter-omp','versions.json'),path.join(pluginRoot,'node_modules','@a5c-ai','babysitter-omp','versions.json'),path.join(process.cwd(),'node_modules','@a5c-ai','babysitter-omp','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')}")
83
+ CLI="npx -y @a5c-ai/babysitter-sdk@$SDK_VERSION"
50
84
  ```
51
85
 
52
- ## Commands
86
+ ## Marketplace And Distribution
87
+
88
+ oh-my-pi discovers this plugin through its native plugin system. Publish new
89
+ versions to npm under `@a5c-ai/babysitter-omp`, then users can install or
90
+ upgrade through `omp plugin install @a5c-ai/babysitter-omp`.
91
+
92
+ ## Upgrade And Uninstall
93
+
94
+ Upgrade by reinstalling the plugin:
53
95
 
54
- The plugin exposes oh-my-pi-facing Babysitter commands such as:
96
+ ```bash
97
+ omp plugin install @a5c-ai/babysitter-omp
98
+ ```
99
+
100
+ Remove it with:
55
101
 
56
- - `/babysitter:call`
57
- - `/babysitter:status`
58
- - `/babysitter:resume`
59
- - `/babysitter:doctor`
102
+ ```bash
103
+ omp plugin uninstall @a5c-ai/babysitter-omp
104
+ ```
60
105
 
61
106
  ## Troubleshooting
62
107
 
63
- - `babysitter harness:discover --json` is the supported way to verify whether
64
- `oh-my-pi` is installed from the current environment.
65
- - If discovery reports `oh-my-pi` as installed but a direct invocation fails,
66
- validate the current shell `PATH` first with `where omp` on Windows.
108
+ - Verify the harness with `babysitter harness:discover --json`.
109
+ - If `omp` is not available, check `where omp` on Windows or `which omp` on Unix.
110
+ - If commands do not appear, restart oh-my-pi after installation so it reloads plugin metadata.
111
+ - If the wrong SDK version is used, inspect `versions.json` inside the installed plugin root.
112
+ - Regenerate mirrored commands and command-backed skills with `npm run sync:commands`.
67
113
 
68
114
  ## Tests
69
115
 
70
116
  ```bash
71
117
  cd plugins/babysitter-omp
72
118
  npm test
73
- npm run test:integration
74
- npm run test:harness
75
- npm run test:tui
76
119
  ```
77
120
 
78
121
  ## License
package/bin/cli.cjs CHANGED
@@ -12,7 +12,7 @@ function printUsage() {
12
12
  ' babysitter-omp install [--global]',
13
13
  ' babysitter-omp install --workspace [path]',
14
14
  ' babysitter-omp uninstall [--global]',
15
- ' babysitter-omp uninstall --workspace [path]',
15
+ ' babysitter-omp uninstall',
16
16
  ].join('\n'));
17
17
  }
18
18
 
@@ -23,11 +23,9 @@ function parseArgs(argv) {
23
23
  const arg = argv[i];
24
24
  if (arg === '--workspace') {
25
25
  const next = argv[i + 1];
26
+ workspace = next && !next.startsWith('-') ? path.resolve(next) : process.cwd();
26
27
  if (next && !next.startsWith('-')) {
27
- workspace = path.resolve(next);
28
28
  i += 1;
29
- } else {
30
- workspace = process.cwd();
31
29
  }
32
30
  continue;
33
31
  }
@@ -65,13 +63,7 @@ function main() {
65
63
  }
66
64
 
67
65
  const parsed = parseArgs(rest);
68
- const args = [];
69
- if (parsed.workspace) {
70
- args.push('--workspace', parsed.workspace);
71
- } else {
72
- args.push('--global');
73
- }
74
-
66
+ const args = parsed.workspace ? ['--workspace', parsed.workspace] : ['--global'];
75
67
  runNodeScript(path.join(PACKAGE_ROOT, 'bin', `${command}.cjs`), args);
76
68
  }
77
69
 
package/bin/install.cjs CHANGED
@@ -2,143 +2,44 @@
2
2
  'use strict';
3
3
 
4
4
  const fs = require('fs');
5
- const os = require('os');
6
5
  const path = require('path');
7
6
  const { spawnSync } = require('child_process');
8
7
 
9
8
  const PACKAGE_ROOT = path.resolve(__dirname, '..');
10
- const INSTALL_ENTRIES = [
11
- { source: 'package.json', required: true },
12
- { source: 'extensions', required: true },
13
- { source: 'skills', required: true },
14
- { source: 'commands', required: true },
15
- { source: 'scripts', required: true },
16
- ];
9
+ const PACKAGE_JSON = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, 'package.json'), 'utf8'));
17
10
 
18
11
  function parseArgs(argv) {
19
- const args = {
20
- workspace: null,
21
- };
12
+ let workspace = null;
22
13
  for (let i = 2; i < argv.length; i += 1) {
23
- if (argv[i] === '--workspace' && argv[i + 1]) {
24
- args.workspace = path.resolve(argv[++i]);
25
- } else if (argv[i] === '--global') {
26
- args.workspace = null;
27
- } else {
28
- throw new Error(`unknown argument: ${argv[i]}`);
14
+ const arg = argv[i];
15
+ if (arg === '--workspace') {
16
+ const next = argv[i + 1];
17
+ workspace = next && !next.startsWith('-') ? path.resolve(argv[++i]) : process.cwd();
18
+ continue;
29
19
  }
30
- }
31
- return args;
32
- }
33
-
34
- function getGlobalStateDir() {
35
- if (process.env.BABYSITTER_GLOBAL_STATE_DIR) {
36
- return path.resolve(process.env.BABYSITTER_GLOBAL_STATE_DIR);
37
- }
38
- return path.join(os.homedir(), '.a5c');
39
- }
40
-
41
- function getPluginRoot(args) {
42
- const base = args.workspace ? path.resolve(args.workspace) : os.homedir();
43
- return path.join(base, '.omp', 'plugins', 'babysitter');
44
- }
45
-
46
- function copyRecursive(src, dest) {
47
- const stat = fs.statSync(src);
48
- if (stat.isDirectory()) {
49
- fs.mkdirSync(dest, { recursive: true });
50
- for (const entry of fs.readdirSync(src)) {
51
- if (['node_modules', '.git', 'test', '.gitignore', 'state'].includes(entry)) continue;
52
- copyRecursive(path.join(src, entry), path.join(dest, entry));
20
+ if (arg === '--global') {
21
+ workspace = null;
22
+ continue;
53
23
  }
54
- return;
55
- }
56
- fs.mkdirSync(path.dirname(dest), { recursive: true });
57
- fs.copyFileSync(src, dest);
58
- }
59
-
60
- function resolveBabysitterCommand(packageRoot) {
61
- if (process.env.BABYSITTER_SDK_CLI) {
62
- return {
63
- command: process.execPath,
64
- argsPrefix: [path.resolve(process.env.BABYSITTER_SDK_CLI)],
65
- };
66
- }
67
- try {
68
- return {
69
- command: process.execPath,
70
- argsPrefix: [
71
- require.resolve('@a5c-ai/babysitter-sdk/dist/cli/main.js', {
72
- paths: [packageRoot],
73
- }),
74
- ],
75
- };
76
- } catch {
77
- return {
78
- command: 'babysitter',
79
- argsPrefix: [],
80
- };
24
+ throw new Error(`unknown argument: ${arg}`);
81
25
  }
82
- }
83
-
84
- function runBabysitterCli(packageRoot, cliArgs) {
85
- const resolved = resolveBabysitterCommand(packageRoot);
86
- const result = spawnSync(resolved.command, [...resolved.argsPrefix, ...cliArgs], {
87
- cwd: packageRoot,
88
- stdio: ['ignore', 'pipe', 'pipe'],
89
- encoding: 'utf8',
90
- env: process.env,
91
- });
92
- if (result.status !== 0) {
93
- const stderr = (result.stderr || '').trim();
94
- const stdout = (result.stdout || '').trim();
95
- throw new Error(
96
- `babysitter ${cliArgs.join(' ')} failed` +
97
- (stderr ? `: ${stderr}` : stdout ? `: ${stdout}` : ''),
98
- );
99
- }
100
- return result.stdout;
101
- }
102
-
103
- function ensureGlobalProcessLibrary() {
104
- const active = JSON.parse(
105
- runBabysitterCli(
106
- PACKAGE_ROOT,
107
- ['process-library:active', '--state-dir', getGlobalStateDir(), '--json'],
108
- ),
109
- );
110
- console.log(`[babysitter] process library: ${active.binding?.dir}`);
111
- }
112
-
113
- function installEntry(pluginRoot, entry) {
114
- const src = path.join(PACKAGE_ROOT, entry.source);
115
- const dest = path.join(pluginRoot, entry.source);
116
- if (!fs.existsSync(src)) {
117
- if (entry.required) throw new Error(`required install payload is missing: ${src}`);
118
- return;
119
- }
120
- copyRecursive(src, dest);
121
- console.log(`[babysitter] ${entry.source}${fs.statSync(src).isDirectory() ? '/' : ''}`);
26
+ return { workspace };
122
27
  }
123
28
 
124
29
  function main() {
125
- const args = parseArgs(process.argv);
126
- const pluginRoot = getPluginRoot(args);
127
- console.log(`[babysitter] Installing oh-my-pi plugin to ${pluginRoot}`);
128
-
129
- try {
130
- fs.rmSync(pluginRoot, { recursive: true, force: true });
131
- fs.mkdirSync(pluginRoot, { recursive: true });
132
- for (const entry of INSTALL_ENTRIES) {
133
- installEntry(pluginRoot, entry);
134
- }
135
- fs.mkdirSync(path.join(pluginRoot, 'state'), { recursive: true });
136
- ensureGlobalProcessLibrary();
137
- console.log('[babysitter] Installation complete!');
138
- } catch (err) {
139
- console.error(`[babysitter] Failed to install plugin files: ${err.message}`);
140
- process.exitCode = 1;
141
- }
30
+ const { workspace } = parseArgs(process.argv);
31
+ const result = workspace
32
+ ? spawnSync('omp', ['plugin', 'link', path.resolve(workspace, 'plugins', 'babysitter-omp')], {
33
+ cwd: workspace,
34
+ stdio: 'inherit',
35
+ env: process.env,
36
+ })
37
+ : spawnSync('omp', ['plugin', 'install', `${PACKAGE_JSON.name}@${PACKAGE_JSON.version}`], {
38
+ cwd: process.cwd(),
39
+ stdio: 'inherit',
40
+ env: process.env,
41
+ });
42
+ process.exitCode = result.status ?? 1;
142
43
  }
143
44
 
144
45
  main();
package/bin/uninstall.cjs CHANGED
@@ -2,39 +2,19 @@
2
2
  'use strict';
3
3
 
4
4
  const fs = require('fs');
5
- const os = require('os');
6
5
  const path = require('path');
6
+ const { spawnSync } = require('child_process');
7
7
 
8
- function parseArgs(argv) {
9
- const args = {
10
- workspace: null,
11
- };
12
- for (let i = 2; i < argv.length; i += 1) {
13
- if (argv[i] === '--workspace' && argv[i + 1]) {
14
- args.workspace = path.resolve(argv[++i]);
15
- } else if (argv[i] === '--global') {
16
- args.workspace = null;
17
- } else {
18
- throw new Error(`unknown argument: ${argv[i]}`);
19
- }
20
- }
21
- return args;
22
- }
23
-
24
- function getPluginRoot(args) {
25
- const base = args.workspace ? path.resolve(args.workspace) : os.homedir();
26
- return path.join(base, '.omp', 'plugins', 'babysitter');
27
- }
8
+ const PACKAGE_ROOT = path.resolve(__dirname, '..');
9
+ const PACKAGE_JSON = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, 'package.json'), 'utf8'));
28
10
 
29
11
  function main() {
30
- const args = parseArgs(process.argv);
31
- const pluginRoot = getPluginRoot(args);
32
- if (!fs.existsSync(pluginRoot)) {
33
- console.log('[babysitter] Nothing to uninstall.');
34
- return;
35
- }
36
- fs.rmSync(pluginRoot, { recursive: true, force: true });
37
- console.log(`[babysitter] Removed ${pluginRoot}`);
12
+ const result = spawnSync('omp', ['plugin', 'uninstall', PACKAGE_JSON.name], {
13
+ cwd: process.cwd(),
14
+ stdio: 'inherit',
15
+ env: process.env,
16
+ });
17
+ process.exitCode = result.status ?? 1;
38
18
  }
39
19
 
40
20
  main();
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Assimilate an external methodology, harness, or specification into babysitter process definitions with skills and agents.
3
+ argument-hint: Target to assimilate (e.g. repo URL, harness name, or spec path)
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
+ Use the assimilation domain processes from the active process library to convert external sources into well-defined babysitter process definitions with accompanying skills/ and agents/ directories.
10
+
11
+ If the workspace does not already have an active process-library binding, initialize it first through the shared global SDK binding:
12
+
13
+ ```bash
14
+ babysitter process-library:active --json
15
+ ```
16
+
17
+ Run the process after formalizing it.
18
+
19
+ Available assimilation workflows:
20
+ - **methodology-assimilation** (`specializations/meta/assimilation/workflows/methodology-assimilation`) - Learns an external methodology from its repo and converts procedural instructions, commands, and manual flows into babysitter processes with refactored skills and agents. Supports output as methodology or specialization.
21
+ - **harness integration** (`specializations/meta/assimilation/harness/*`) - Integrates babysitter SDK with a specific AI coding harness (generic, codex, opencode, gemini-cli, openclaw, antigravity).
22
+
23
+ During the interview phase, determine which assimilation workflow to use based on the user's target:
24
+ - If the target is a **repo URL or methodology name** then use the methodology-assimilation workflow.
25
+ - If the target is a **harness name** (e.g. codex, opencode, antigravity) then use the matching harness process.
26
+ - If the target is a **specification or other source** then adapt the methodology-assimilation workflow for the spec format.
27
+ - If unclear, ask the user to clarify the assimilation target and type.
28
+
29
+ ## After Assimilation: Contribute Back
30
+
31
+ After successfully assimilating a methodology or harness integration, prompt the user to share it with the community. The assimilated process definitions, skills, and agents could benefit other babysitter users:
32
+
33
+ - **Completed a methodology assimilation**: `/babysitter:contrib library contribution: assimilated [methodology-name] into babysitter process definitions`
34
+ - **Completed a harness integration**: `/babysitter:contrib library contribution: [harness-name] harness integration`
35
+ - **Hit issues during assimilation** (e.g. unsupported patterns, missing SDK features): `/babysitter:contrib bug report: assimilation of [target] failed because [description]` or `/babysitter:contrib feature request: [what the SDK needs to support]`
36
+
37
+ Even just reporting that an assimilation didn't work well helps improve babysitter for everyone.
@@ -0,0 +1,7 @@
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).
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: Clean up .a5c/runs and .a5c/processes directories. Aggregates insights from completed/failed runs into docs/run-history-insights.md, then removes old run data and orphaned process files.
3
+ argument-hint: "[--dry-run] [--keep-days N] Optional flags. --dry-run shows what would be removed without deleting. --keep-days N keeps runs newer than N days (default 7)."
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
+ Create and run a cleanup process using the process at `skills\babysit\process\cradle\cleanup-runs.js/processes/cleanup-runs.js`.
10
+
11
+ Implementation notes (for the process):
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
@@ -0,0 +1,33 @@
1
+ ---
2
+ description: Submit feedback or contribute to babysitter project
3
+ argument-hint: Specific instructions for the run.
4
+ allowed-tools: Read, Grep, Write, Task, Bash, Edit, Grep, Glob, WebFetch, WebSearch, Search, AskUserQuestion, TodoWrite, TodoRead, Skill, BashOutput, KillShell, MultiEdit, LS
5
+ ---
6
+
7
+ Invoke the babysitter:babysit skill (using the Skill tool) and follow its instructions (SKILL.md).
8
+
9
+ ## Process Routing
10
+
11
+ Contribution processes live under the active process library's `cradle/` directory. Resolve the active library root with `babysitter process-library:active --json` and route based on arguments:
12
+
13
+ ### Issue-based (opens a GitHub issue in a5c-ai/babysitter)
14
+ * **Bug report** → `cradle/bug-report.js#process` — Report a bug in the SDK, CLI, process library, etc.
15
+ * **Feature request** → `cradle/feature-request.js#process` — Request a new feature or enhancement
16
+ * **Documentation question** → `cradle/documentation-question.js#process` — Ask about undocumented behavior or missing docs
17
+
18
+ ### PR-based (forks repo, creates branch, submits PR to a5c-ai/babysitter)
19
+ * **Bugfix** → `cradle/bugfix.js#process` — User already has the fix for a bug
20
+ * **Feature implementation** → `cradle/feature-implementation-contribute.js#process` — User already has a feature implementation
21
+ * **Harness integration** → `cradle/feature-harness-integration-contribute.js#process` — User has a harness (CI/CD, IDE, editor) integration
22
+ * **Library contribution** → `cradle/library-contribution.js#process` — New or improved process/skill/subagent for the library
23
+ * **Documentation answer** → `cradle/documentation-contribute-answer.js#process` — User has an answer for an unanswered docs question
24
+
25
+ ### Router (when arguments are empty or general)
26
+ * **Contribute** → `cradle/contribute.js#process` — Explains contribution types and routes to the specific process
27
+
28
+ ## Contribution Rules
29
+
30
+ * PR-based contributions: fork the babysitter repo (a5c-ai/babysitter) for the user, ask to star if not already starred, perform changes, submit PR
31
+ * Issue-based contributions: gather details, search for duplicates, review, then open an issue in a5c-ai/babysitter
32
+ * Add breakpoints (permissions) before ALL gh actions (fork, star, submit PR/issue) to allow user review and cancellation
33
+ * If arguments are empty: use the `contribute.js` router process to show options and route accordingly