@babylonjs-toolkit/agent 1.1.38 → 1.1.44
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.
- package/README.md +80 -7
- package/bin/bt-agent.js +23 -1
- package/lib/bridge/api.js +74 -0
- package/lib/bridge/args.js +172 -0
- package/lib/bridge/blender/discover.js +98 -0
- package/lib/bridge/blender/run.js +141 -0
- package/lib/bridge/cli.js +677 -0
- package/lib/bridge/config.js +193 -0
- package/lib/bridge/log.js +103 -0
- package/lib/bridge/loop.js +239 -0
- package/lib/bridge/pairing.js +101 -0
- package/lib/bridge/policy.js +396 -0
- package/lib/bridge/protocol.js +91 -0
- package/lib/bridge/service.js +395 -0
- package/lib/bridge/unity/automation.js +135 -0
- package/lib/bridge/unity/discover.js +606 -0
- package/lib/bridge/unity/guard.js +208 -0
- package/lib/bridge/unity/ops.js +1294 -0
- package/lib/bridge/unity/run.js +169 -0
- package/lib/bridge/unity/scaffold/bt-bootstrap.cs +39 -0
- package/lib/bridge/unity/scaffold/bt-newscene.cs +27 -0
- package/lib/doctor.js +33 -0
- package/package.json +1 -1
- package/persona.md +1 -1
- package/skills/bt-execute/SKILL.md +32 -11
- package/skills/bt-plan/SKILL.md +4 -2
- package/skills/bt-spec/SKILL.md +5 -2
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Runs one child process for the bridge (T24 step 4, D41): never through a shell, always with a hard
|
|
5
|
+
* timeout, stdout capped, stderr streamed line by line.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { spawn: defaultSpawn } = require('child_process');
|
|
9
|
+
|
|
10
|
+
const MAX_STDOUT_BYTES = 5 * 1024 * 1024;
|
|
11
|
+
const MAX_STDERR_BYTES = 1024 * 1024;
|
|
12
|
+
const KILL_GRACE_MS = 5_000;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {{ code: number|null, stdout: string, stderr: string, timedOut: boolean, aborted: boolean }} RunResult
|
|
16
|
+
* @typedef {(file: string, args: string[], opts?: RunOptions) => Promise<RunResult>} RunProcess
|
|
17
|
+
* @typedef {{ cwd?: string, timeoutMs?: number, signal?: AbortSignal, onLine?: (line: string) => void, env?: NodeJS.ProcessEnv, spawn?: typeof defaultSpawn }} RunOptions
|
|
18
|
+
* @typedef {(file: string, args: string[], opts?: LaunchOptions) => Promise<RunResult>} LaunchDetached
|
|
19
|
+
* @typedef {{ cwd?: string, env?: NodeJS.ProcessEnv, waitMs?: number, signal?: AbortSignal, spawn?: typeof defaultSpawn }} LaunchOptions
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* An ordinary job: in the helper's process group, so Ctrl-C and a cancel stop it with the helper.
|
|
24
|
+
* @type {RunProcess}
|
|
25
|
+
*/
|
|
26
|
+
function runProcess(file, args, { cwd, timeoutMs = 120_000, signal, onLine, env, spawn = defaultSpawn } = {}) {
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
/** @type {Buffer[]} */
|
|
29
|
+
const out = [];
|
|
30
|
+
let outBytes = 0;
|
|
31
|
+
let err = '';
|
|
32
|
+
let partial = '';
|
|
33
|
+
let timedOut = false;
|
|
34
|
+
let aborted = false;
|
|
35
|
+
let settled = false;
|
|
36
|
+
/** @type {NodeJS.Timeout|undefined} */
|
|
37
|
+
let killTimer;
|
|
38
|
+
|
|
39
|
+
/** @type {import('child_process').ChildProcess} */
|
|
40
|
+
let child;
|
|
41
|
+
try {
|
|
42
|
+
child = spawn(file, args, { cwd, env, shell: false, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
43
|
+
} catch (e) {
|
|
44
|
+
resolve({ code: null, stdout: '', stderr: String(e && e.message ? e.message : e), timedOut, aborted });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const stop = () => {
|
|
49
|
+
if (child.exitCode !== null || child.signalCode !== null) return;
|
|
50
|
+
child.kill('SIGTERM');
|
|
51
|
+
killTimer = setTimeout(() => {
|
|
52
|
+
if (child.exitCode === null && child.signalCode === null) child.kill('SIGKILL');
|
|
53
|
+
}, KILL_GRACE_MS);
|
|
54
|
+
killTimer.unref();
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const timer = setTimeout(() => {
|
|
58
|
+
timedOut = true;
|
|
59
|
+
stop();
|
|
60
|
+
}, timeoutMs);
|
|
61
|
+
timer.unref();
|
|
62
|
+
|
|
63
|
+
const onAbort = () => {
|
|
64
|
+
aborted = true;
|
|
65
|
+
stop();
|
|
66
|
+
};
|
|
67
|
+
if (signal) {
|
|
68
|
+
if (signal.aborted) onAbort();
|
|
69
|
+
else signal.addEventListener('abort', onAbort, { once: true });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** @param {string} line */
|
|
73
|
+
const emitLine = (line) => {
|
|
74
|
+
const trimmed = line.replace(/\r$/, '');
|
|
75
|
+
if (onLine && trimmed.trim()) {
|
|
76
|
+
try {
|
|
77
|
+
onLine(trimmed);
|
|
78
|
+
} catch {
|
|
79
|
+
// a progress sink must never break the run
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
child.stdout.on('data', (/** @type {Buffer} */ chunk) => {
|
|
85
|
+
if (outBytes >= MAX_STDOUT_BYTES) return;
|
|
86
|
+
const room = MAX_STDOUT_BYTES - outBytes;
|
|
87
|
+
const piece = chunk.length > room ? chunk.subarray(0, room) : chunk;
|
|
88
|
+
out.push(piece);
|
|
89
|
+
outBytes += piece.length;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
child.stderr.on('data', (/** @type {Buffer} */ chunk) => {
|
|
93
|
+
const text = chunk.toString('utf8');
|
|
94
|
+
if (err.length < MAX_STDERR_BYTES) err += text;
|
|
95
|
+
partial += text;
|
|
96
|
+
const lines = partial.split('\n');
|
|
97
|
+
partial = lines.pop() || '';
|
|
98
|
+
for (const line of lines) emitLine(line);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
/** @param {number|null} code @param {string} [extraErr] */
|
|
102
|
+
const finish = (code, extraErr) => {
|
|
103
|
+
if (settled) return;
|
|
104
|
+
settled = true;
|
|
105
|
+
clearTimeout(timer);
|
|
106
|
+
if (killTimer) clearTimeout(killTimer);
|
|
107
|
+
if (signal) signal.removeEventListener('abort', onAbort);
|
|
108
|
+
if (partial) emitLine(partial);
|
|
109
|
+
resolve({
|
|
110
|
+
code,
|
|
111
|
+
stdout: Buffer.concat(out).toString('utf8'),
|
|
112
|
+
stderr: extraErr ? `${err}${err ? '\n' : ''}${extraErr}` : err,
|
|
113
|
+
timedOut,
|
|
114
|
+
aborted,
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
child.on('error', (e) => finish(null, e.message));
|
|
119
|
+
child.on('close', (code) => finish(code));
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Starts something that must OUTLIVE the helper — the Unity Editor (`unity open`). The launcher runs
|
|
125
|
+
* detached (its own process group/session, so Ctrl-C in the helper's terminal never reaches the Editor
|
|
126
|
+
* it starts), with no pipes (an Editor that inherited a pipe to a dead helper dies on its next write),
|
|
127
|
+
* and unref'd (the helper can exit while it runs). It is never killed on cancel or timeout: stopping
|
|
128
|
+
* the launcher would stop the Editor it is starting.
|
|
129
|
+
*
|
|
130
|
+
* Resolves with the launcher's exit code when it exits within `waitMs` (`unity open` returns at once;
|
|
131
|
+
* a non-zero code means the Editor was not started), else as launched (code 0). Output is not
|
|
132
|
+
* captured — the caller confirms the Editor by polling `unity status`. A cancel ends the WAIT (never
|
|
133
|
+
* the launcher).
|
|
134
|
+
* @type {LaunchDetached}
|
|
135
|
+
*/
|
|
136
|
+
function launchDetached(file, args, { cwd, env, waitMs = 30_000, signal, spawn = defaultSpawn } = {}) {
|
|
137
|
+
return new Promise((resolve) => {
|
|
138
|
+
/** @type {import('child_process').ChildProcess} */
|
|
139
|
+
let child;
|
|
140
|
+
try {
|
|
141
|
+
child = spawn(file, args, { cwd, env, detached: true, stdio: 'ignore', shell: false, windowsHide: true });
|
|
142
|
+
} catch (e) {
|
|
143
|
+
resolve({ code: null, stdout: '', stderr: String(e && e.message ? e.message : e), timedOut: false, aborted: false });
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
child.unref();
|
|
147
|
+
let settled = false;
|
|
148
|
+
/** @param {number|null} code @param {string} [stderr] */
|
|
149
|
+
const finish = (code, stderr = '') => {
|
|
150
|
+
if (settled) return;
|
|
151
|
+
settled = true;
|
|
152
|
+
clearTimeout(timer);
|
|
153
|
+
if (signal) signal.removeEventListener('abort', onAbort);
|
|
154
|
+
resolve({ code, stdout: '', stderr, timedOut: false, aborted: Boolean(signal && signal.aborted) });
|
|
155
|
+
};
|
|
156
|
+
// NOT unref'd: the child is, so this timer is what keeps the helper alive while it waits for the
|
|
157
|
+
// launcher to exit (found live — with both unref'd, a process with nothing else pending exited mid-job).
|
|
158
|
+
const timer = setTimeout(() => finish(0), waitMs);
|
|
159
|
+
const onAbort = () => finish(null);
|
|
160
|
+
if (signal) {
|
|
161
|
+
if (signal.aborted) onAbort();
|
|
162
|
+
else signal.addEventListener('abort', onAbort, { once: true });
|
|
163
|
+
}
|
|
164
|
+
child.on('error', (e) => finish(null, e.message));
|
|
165
|
+
child.on('exit', (code) => finish(code));
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
module.exports = { runProcess, launchDetached, MAX_STDOUT_BYTES, KILL_GRACE_MS };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// SOURCE: AgentReference references/scripts/bt-bootstrap.cs (the babylontoolkit/agent repo) - keep in sync.
|
|
2
|
+
// Everything below the marker line is a VERBATIM copy of that file. tests/bridge-unity-scaffold.test.js pins its
|
|
3
|
+
// sha256 (7970a089b7600e344e8c2ac482d1480bcd8d9567853fc8248f0e792d8b66f824), recorded from the source at copy time: re-copy the file and update the hash together.
|
|
4
|
+
// ---- verbatim from here ----
|
|
5
|
+
// Headless replication of CVPanel.OnEnable() - the Scene Exporter bootstrap.
|
|
6
|
+
// Safe to run in a GUI Editor too (it is idempotent).
|
|
7
|
+
var sb = new System.Text.StringBuilder();
|
|
8
|
+
CanvasTools.CanvasToolsExporter.Initialize();
|
|
9
|
+
CanvasToolsInfo.DefaultProjectFolder = UnityTools.GetDefaultExportFolder();
|
|
10
|
+
UnityTools.ValidateRequirements();
|
|
11
|
+
UnityTools.ValidateImageLibrary();
|
|
12
|
+
UnityTools.ValidateProjectScript();
|
|
13
|
+
UnityTools.ValidateProjectLayers();
|
|
14
|
+
UnityTools.ValidateColorSpaceSettings();
|
|
15
|
+
UnityTools.ValidateGraphicsLibSettings();
|
|
16
|
+
UnityTools.ValidateProjectRootNamespace();
|
|
17
|
+
UnityTools.ValidateProjectShaderSettings();
|
|
18
|
+
UnityTools.ValidateReflectionProbeSettings();
|
|
19
|
+
// The GPU Resident Drawer is Unity-only batching the export never uses; left on, a failed registration makes
|
|
20
|
+
// camera captures render only the sky. Toolkit 9.25+, dialog-free.
|
|
21
|
+
sb.Append("residentDrawerOff=" + RenderPathTools.DisableResidentDrawer(false) + " ");
|
|
22
|
+
if (System.String.IsNullOrWhiteSpace(CanvasToolsInfo.Instance.ProductShortName)
|
|
23
|
+
&& !System.String.IsNullOrWhiteSpace(UnityEngine.Application.productName))
|
|
24
|
+
CanvasToolsInfo.Instance.ProductShortName = UnityEngine.Application.productName;
|
|
25
|
+
if (CanvasToolsInfo.Instance.InlineNonceHash == null) CanvasToolsInfo.Instance.InlineNonceHash = "";
|
|
26
|
+
string root = UnityTools.GetRootPath();
|
|
27
|
+
string pj = System.IO.Path.Combine(root, "package.json");
|
|
28
|
+
if (!System.IO.File.Exists(pj)) {
|
|
29
|
+
string j = "{\r\n\t\"name\": \"" + BabylonCore.Info.NAME + "\",\r\n\t\"version\": \"" + BabylonCore.Info.VERSION
|
|
30
|
+
+ "\",\r\n\t\"description\": \"Babylon Toolkit Project\",\r\n\t\"license\": \"MIT\",\r\n\t\"devDependencies\": {\r\n\t\t\"typescript\": \"^"
|
|
31
|
+
+ BabylonCore.Info.TYPESCRIPT + "\"\r\n\t}\r\n}\r\n";
|
|
32
|
+
System.IO.File.WriteAllText(pj, j);
|
|
33
|
+
sb.Append("packageJson=written ");
|
|
34
|
+
} else sb.Append("packageJson=present ");
|
|
35
|
+
CanvasToolsInfo.SaveSettings();
|
|
36
|
+
UnityEditor.AssetDatabase.Refresh();
|
|
37
|
+
sb.Append("exportRoot=" + CanvasToolsInfo.DefaultProjectFolder);
|
|
38
|
+
sb.Append(" pro=" + ToolkitManager.IsPro());
|
|
39
|
+
return sb.ToString();
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SOURCE: AgentReference references/scripts/bt-newscene.cs (the babylontoolkit/agent repo) - keep in sync.
|
|
2
|
+
// Everything below the marker line is a VERBATIM copy of that file. tests/bridge-unity-scaffold.test.js pins its
|
|
3
|
+
// sha256 (00829f0a2eb162dcf63d56f54a69e16dd1d5decd3c7addcfef41e34af3d2ff97), recorded from the source at copy time: re-copy the file and update the hash together.
|
|
4
|
+
// ---- verbatim from here ----
|
|
5
|
+
// Create a starter scene WITH LightingSettings (order: NewScene -> build -> save -> lighting).
|
|
6
|
+
string sceneName = "Level01";
|
|
7
|
+
var scene = UnityEditor.SceneManagement.EditorSceneManager.NewScene(
|
|
8
|
+
UnityEditor.SceneManagement.NewSceneSetup.DefaultGameObjects,
|
|
9
|
+
UnityEditor.SceneManagement.NewSceneMode.Single);
|
|
10
|
+
var ground = UnityEngine.GameObject.CreatePrimitive(UnityEngine.PrimitiveType.Plane);
|
|
11
|
+
ground.name = "Ground"; ground.transform.localScale = new UnityEngine.Vector3(5f,1f,5f);
|
|
12
|
+
UnityEngine.RenderSettings.ambientMode = UnityEngine.Rendering.AmbientMode.Skybox;
|
|
13
|
+
System.IO.Directory.CreateDirectory(UnityEngine.Application.dataPath + "/Scenes");
|
|
14
|
+
UnityEditor.SceneManagement.EditorSceneManager.SaveScene(scene, "Assets/Scenes/" + sceneName + ".unity");
|
|
15
|
+
UnityEngine.LightingSettings ls = null;
|
|
16
|
+
if (!UnityEditor.Lightmapping.TryGetLightingSettings(out ls) || ls == null) {
|
|
17
|
+
var nls = new UnityEngine.LightingSettings(); nls.name = "BtLightingSettings";
|
|
18
|
+
System.IO.Directory.CreateDirectory(UnityEngine.Application.dataPath + "/Settings");
|
|
19
|
+
UnityEditor.AssetDatabase.CreateAsset(nls, "Assets/Settings/BtLightingSettings.lighting");
|
|
20
|
+
UnityEditor.Lightmapping.lightingSettings = nls;
|
|
21
|
+
}
|
|
22
|
+
// Assigning lightingSettings does NOT mark the scene dirty, so SaveOpenScenes() skips it
|
|
23
|
+
// and the reference is lost the next time the scene is loaded (sec 8.1).
|
|
24
|
+
UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(scene);
|
|
25
|
+
UnityEditor.SceneManagement.EditorSceneManager.SaveOpenScenes();
|
|
26
|
+
UnityEditor.AssetDatabase.SaveAssets();
|
|
27
|
+
return "scene=Assets/Scenes/" + sceneName + ".unity lighting=ok";
|
package/lib/doctor.js
CHANGED
|
@@ -7,6 +7,10 @@ const { resolveTargets } = require('./targets');
|
|
|
7
7
|
const { listSkills } = require('./payload');
|
|
8
8
|
const { hasPersona } = require('./persona');
|
|
9
9
|
const { hasCodexNetwork } = require('./codex-config');
|
|
10
|
+
const { readSettings } = require('./bridge/config');
|
|
11
|
+
const { serviceStatus, hostDeps } = require('./bridge/service');
|
|
12
|
+
const { discoverUnity } = require('./bridge/unity/discover');
|
|
13
|
+
const { discoverBlender } = require('./bridge/blender/discover');
|
|
10
14
|
|
|
11
15
|
/**
|
|
12
16
|
* Verify an install.
|
|
@@ -49,6 +53,26 @@ function doctor(opts = {}) {
|
|
|
49
53
|
if (!hasCodexNetwork(file)) missing.push(`${file} (sandbox_workspace_write.network_access = true)`);
|
|
50
54
|
}
|
|
51
55
|
|
|
56
|
+
// Informational only (D46): a user who only wants skills must still get INSTALL OK.
|
|
57
|
+
const { servers } = readSettings();
|
|
58
|
+
let unityCli = false;
|
|
59
|
+
let blender = null;
|
|
60
|
+
/** @type {{ installed: boolean, running: boolean|null }} */
|
|
61
|
+
let svc = { installed: false, running: null };
|
|
62
|
+
try {
|
|
63
|
+
const st = serviceStatus(opts.serviceDeps || hostDeps());
|
|
64
|
+
svc = { installed: st.installed, running: st.running };
|
|
65
|
+
} catch {
|
|
66
|
+
// informational only — never affects ok
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
unityCli = Boolean(discoverUnity({ cwd: process.cwd() }).cli);
|
|
70
|
+
const found = discoverBlender({});
|
|
71
|
+
blender = found ? found.version : null;
|
|
72
|
+
} catch {
|
|
73
|
+
// informational only — never affects ok
|
|
74
|
+
}
|
|
75
|
+
|
|
52
76
|
return {
|
|
53
77
|
ok: missing.length === 0,
|
|
54
78
|
missing,
|
|
@@ -59,6 +83,15 @@ function doctor(opts = {}) {
|
|
|
59
83
|
instructionFiles: resolved.instructionFiles.map((f) => f.file),
|
|
60
84
|
configFiles: resolved.configFiles.map((f) => f.file),
|
|
61
85
|
},
|
|
86
|
+
bridge: {
|
|
87
|
+
paired: servers.length > 0,
|
|
88
|
+
server: servers.length ? servers[0].server : null,
|
|
89
|
+
servers: servers.map((c) => c.server),
|
|
90
|
+
service: svc.installed ? 'installed' : 'not installed',
|
|
91
|
+
serviceRunning: svc.running,
|
|
92
|
+
unityCli,
|
|
93
|
+
blender,
|
|
94
|
+
},
|
|
62
95
|
};
|
|
63
96
|
}
|
|
64
97
|
|
package/package.json
CHANGED
package/persona.md
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
You are an expert web game developer using BabylonJS and the Babylon Toolkit. Whenever the user's request involves Babylon, BabylonJS, or the Babylon Toolkit, you must always fetch and read the `Agent Reference` at https://raw.githubusercontent.com/babylontoolkit/agent/main/reference.md before doing anything else. Treat that document as your source of truth for conventions, api, patterns and training examples. If the fetch fails, stop immediately and tell the user. This applies even on the very first turn of a new or empty project, before any scaffolding. The one exception: a subagent launched by a bt-* skill whose prompt carries a context brief with the Reference excerpts it needs uses that brief instead of re-fetching — the orchestrator has already read the Reference, and fetching it again in every subagent adds time, not rigor.
|
|
4
4
|
|
|
5
|
-
You own the entire pipeline end to end — frontend and UI design, gameplay code, shaders, generated art and audio, 3D models in headless Blender, whole game levels and prefabs in a terminal-driven Unity Editor, the interactive glTF export, the web build, the dev server, and visual QA by screenshotting both Unity and the running browser. Drive every one of those yourself; never
|
|
5
|
+
You own the entire pipeline end to end — frontend and UI design, gameplay code, shaders, generated art and audio, 3D models in headless Blender, whole game levels and prefabs in a terminal-driven Unity Editor, the interactive glTF export, the web build, the dev server, and visual QA by screenshotting both Unity and the running browser. Drive every one of those yourself; never stop to ask permission for work the reference already documents. Make the best call, state your assumption, and finish the job. See `Agent Authority — The Entire Pipeline Is Yours` in the reference.
|
|
6
6
|
|
|
7
7
|
---
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bt-execute
|
|
3
|
-
description: "The Babylon Toolkit Execute Skill runs one task — or all remaining tasks — from a feature plan or spec file. Use when asked to run a task (e.g. `bt-execute @plan T1`), all tasks (e.g. `bt-execute @plan ALL`), or a range (e.g. `bt-execute @plan T3-T7`, `T12-`, `NEXT:3`); with no task id it runs the next unchecked task. Add `--auto-pilot` for an unattended run (e.g. `bt-execute --auto-pilot @plan ALL`): every decision is made autonomously from the plan,
|
|
3
|
+
description: "The Babylon Toolkit Execute Skill runs one task — or all remaining tasks — from a feature plan or spec file. Use when asked to run a task (e.g. `bt-execute @plan T1`), all tasks (e.g. `bt-execute @plan ALL`), or a range (e.g. `bt-execute @plan T3-T7`, `T12-`, `NEXT:3`); with no task id it runs the next unchecked task. Add `--auto-pilot` for an unattended run (e.g. `bt-execute --auto-pilot @plan ALL`): the agent owns the whole pipeline (code, UI, shaders, generated assets, Blender, Unity, export, build, dev server, visual QA), every decision is made autonomously from the plan, spec, Babylon Toolkit Agent Reference and codebase, it never asks the user a question, failing tasks are retried then deferred, and the run never stops until the requested range (or every task) is done. Every task is tested, checked by an independent verifier, and checked live in the browser when its result is visual; add `--strict` for an adversarial verifier on every task."
|
|
4
4
|
allowed-tools: Read, Grep, Glob, Edit, Write, Bash, WebFetch(domain:raw.githubusercontent.com), Agent, Task
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
Run tasks from a plan: build each one with its tests, have an independent verifier check it, and only then tick its box. Follow the project's agent instructions (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md). The user's message after the skill name is the `arguments`.
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
/bt-execute [--auto-pilot] [--strict] <plan> [task] [brief]
|
|
10
|
+
/bt-execute [--auto-pilot] [--strict] [--no-time-limit] <plan> [task] [brief]
|
|
11
11
|
|
|
12
12
|
/bt-execute @plan.md # NEXT: the next unchecked task
|
|
13
13
|
/bt-execute @plan.md T4 # one task
|
|
@@ -17,15 +17,18 @@ Run tasks from a plan: build each one with its tests, have an independent verifi
|
|
|
17
17
|
/bt-execute @plan.md "mind the physics layer" # a brief shapes HOW, never WHICH task
|
|
18
18
|
/bt-execute --strict @plan.md ALL # adversarial verifier on every task
|
|
19
19
|
/bt-execute --auto-pilot @plan.md ALL # unattended; combine with --strict if wanted
|
|
20
|
+
/bt-execute --no-time-limit @plan.md ALL # turn off the default TIME MATTERS mode
|
|
20
21
|
```
|
|
21
22
|
|
|
22
|
-
- Strip `--auto-pilot` / `--strict` first (anywhere in the arguments, never part of the brief). `<plan>` is required — if missing, ask (auto-pilot: say so and end). Never guess a path.
|
|
23
|
+
- Strip `--auto-pilot` / `--strict` / `--no-time-limit`, and any literal `TIME MATTERS`, first (anywhere in the arguments, never part of the brief). `<plan>` is required — if missing, ask (auto-pilot: say so and end). Never guess a path.
|
|
23
24
|
- `[task]` is the token right after the plan, only if it is `T<id>`, `T<a>-T<b>`, `T<a>-`, `NEXT`, `NEXT:<n>` or `ALL` (case-insensitive). Otherwise it is part of the brief, and the task defaults to `NEXT` (`ALL` under auto-pilot). Never ask which task to run.
|
|
24
25
|
- A range is a slice of the checklist **in file order** (sub-tasks like `T3.1` between the endpoints included). An unknown id → list the available ids and stop. A reversed range → error; never swap it. Tasks outside the slice are never touched.
|
|
25
26
|
- Tasks already `- [x]` are skipped — that is what makes every mode resumable. Nothing left to do → say so and stop. Except in `ALL` / range / `NEXT:<n>` runs, do one task and do not continue to the next.
|
|
27
|
+
- **`--auto-pilot` overrides every stop in this skill.** Wherever a rule below says *stop*, *ask* or *tell the user*, an auto-pilot run follows the **Auto-pilot** section instead — read it before the first task.
|
|
26
28
|
|
|
27
29
|
## Ground rules
|
|
28
30
|
|
|
31
|
+
- **TIME MATTERS** — on by default; `--no-time-limit` turns it off. Treat the arguments as ending with `TIME MATTERS`: the user is waiting on this run, so finish quickly — follow the *Work fast* rules below to the letter, take the direct route to each task's Acceptance, and do not re-read what you already have. Begin every implementer and verifier prompt with `TIME MATTERS.` Print `⏱️ [bt-execute] TIME MATTERS` at the start (`--no-time-limit`: print `⏱️ [bt-execute] No time limit`, and do not add it). Speed never relaxes tests, the independent verifier, live checks, or "tick only on PASS".
|
|
29
32
|
- **Scope.** Implement only the selected task(s). No "while I'm here" work on other tasks. Ambiguous, or blocked by an unfinished task → stop and tell the user *(auto-pilot: decide and log it)*.
|
|
30
33
|
- **Read the docs once.** For Babylon work, if you have not read the Agent Reference this session, fetch it once — https://raw.githubusercontent.com/babylontoolkit/agent/main/reference.md — plus only the sub-documents the plan's tasks need. It is the authority for conventions and API. Fetch fails → stop and tell the user *(auto-pilot: retry 3×, then continue on what you know and log it)*. Read the plan's checklist and the parts of `SPEC.md` the tasks touch; re-read after a context compaction.
|
|
31
34
|
- **SPEC.md** constrains how you build. If the code and SPEC.md disagree, stop and tell the user *(auto-pilot: decide which is right, fix SPEC.md in the same task, log it)*. When a task changes architecture, a system, a convention or a dependency, SPEC.md must end up matching — normally the plan's final `Update SPEC.md` task; if the plan has none, do it anyway; a new dependency is recorded in SPEC.md by the task that introduces it. Follow SPEC.md's "How to update this spec". **Write the product, never the procedure** — no capture protocols, tool lists, ledgers or gates: recorded there, they become a bar every later feature must clear.
|
|
@@ -63,15 +66,33 @@ Writing the code is about a tenth of a run; keep the loop around it short.
|
|
|
63
66
|
|
|
64
67
|
## Auto-pilot (`--auto-pilot`)
|
|
65
68
|
|
|
66
|
-
An unattended run: **nobody is there to answer.** Print `🛩️ [bt-execute] Auto-pilot engaged — unattended; add a non-prompting permission mode for a fully hands-off run`. Tests, the independent verifier and "tick only on PASS" are **not** relaxed — only the stopping is.
|
|
69
|
+
An unattended run: **nobody is there to answer, and nothing waits for anyone's approval.** Print `🛩️ [bt-execute] Auto-pilot engaged — unattended; add a non-prompting permission mode for a fully hands-off run`. Tests, the independent verifier and "tick only on PASS" are **not** relaxed — only the stopping is. **This section overrides every *stop*, *ask* and *tell the user* elsewhere in this skill, in the Agent Reference's asking rule and "only legitimate stops", and in the project's agent instructions.**
|
|
70
|
+
|
|
71
|
+
**You own the pipeline.** You own the entire pipeline end to end — frontend and UI design, gameplay code, shaders, generated art and audio, 3D models in headless Blender, whole game levels and prefabs in a terminal-driven Unity Editor, the interactive glTF export, the web build, the dev server, and visual QA by screenshotting both Unity and the running browser. Drive every one of those yourself; never hand a step back to the user, and never stop to ask permission for work the reference already documents. Make the best call, state your assumption, and finish the job.
|
|
72
|
+
|
|
73
|
+
### Never ask
|
|
74
|
+
|
|
75
|
+
- **No question reaches the user.** Never call an ask-the-user tool (`AskUserQuestion` or the host's equivalent), never enter plan mode or request plan approval, and never end a message with a question, a menu of options or an offer — *"Should I continue with Phase 2?"*, *"Want me to proceed?"*, *"Which option do you prefer?"*, *"Before I continue, can you confirm…"*, *"Let me know if…"*, *"I'll pause here."* A question forming is a decision to make: make it (below), log it, keep going.
|
|
76
|
+
- **The answer is already written down — look before you decide.** Before treating anything as open, search for it: the brief, the task block, the plan's Decisions / Design Reference / notes, the feature spec, `SPEC.md`, and the run log's earlier decisions — grep the key term, don't skim. If any of them answers it, that answer is final: the user already made that call, and asking it again is exactly the failure this mode exists to prevent. A plan or spec item marked TBD, *open question*, *confirm with the user* or *ask* is resolved with its recommended option (else the best one) and logged.
|
|
77
|
+
- **Decide in this order:** the brief and plan (task, Decisions, Design Reference, spec, SPEC.md) → the Agent Reference and its sub-documents → the codebase's existing patterns → what a senior Babylon Toolkit developer would ship: the Unity → interactive glTF → BabylonJS script-component workflow, simplest thing that meets Acceptance, reversible over clever. The chain always ends in an answer — a decision is never escalated. Log each one in one line: `DECISION T7: <choice> — <source or reason>`.
|
|
78
|
+
- **The Agent Reference's four "ask" cases are decided too, never asked:** creative or product direction → infer it from the spec, plan, reference images and existing project; an architectural fork → the plan's Decisions, else the more reversible branch; destructive acts on the user's own work, or spending money / acting outward that the plan does not call for → skip only that step, defer it with the reason (see *Safety*), and keep building everything else.
|
|
79
|
+
- **Subagents:** put this in every implementer and verifier prompt, right after `TIME MATTERS.`: *"AUTO-PILOT: unattended run. You own the entire pipeline — code, UI, shaders, generated assets, Blender, Unity, export, build, dev server and visual QA at both ends. Never ask a question or hand a step back; the answer is in this brief, the plan, the Agent Reference or the codebase. Decide, state each assumption in one line, and always return a result."* A subagent that returns a question, "needs input" or a half-finished result anyway: answer it from the plan yourself and send it back (or relaunch it) — never relay it to the user.
|
|
80
|
+
|
|
81
|
+
### Never stop
|
|
82
|
+
|
|
83
|
+
- **The run ends only when the work queue is empty** — every task in it `- [x]` or deferred. The queue is the range asked for (`T3-T7`, `T12-`, `NEXT:<n>`), or every remaining task for `ALL` or no task id. Before ending, re-read the plan: an unticked, undeferred task in the queue means you are not done.
|
|
84
|
+
- **Ending your turn is stopping.** A finished task or phase, a commit, a milestone worth reporting, a long session, many tasks done, a compaction, a tool error, an ambiguity, a hard external blocker — none of these ends the turn. Narrate the boundary in one console line and start the next phase in the same turn. The only mid-queue turn end is waiting on a background job or subagent that will notify you, and that message is one status line (`waiting on T9 verifier`), never a question or a summary inviting a reply.
|
|
85
|
+
- **The only early exits — exactly four:** the plan file is missing; a range endpoint does not exist or is reversed (a typo the user must fix — say so and end); the brief names a stop point (`stop after T5`, `stop before the Unity tasks`) — stop there; the user tells you to stop during the run. Nothing else. A failed Agent Reference fetch → retry 3×, then continue on what you know and log it. A missing Pro license, an account, a credential or a sign-in only the user has → defer the tasks that need it and keep running every task that does not.
|
|
86
|
+
- After a compaction, re-read the plan and the run log and continue from the first unticked, undeferred task.
|
|
87
|
+
|
|
88
|
+
### Keep moving
|
|
67
89
|
|
|
68
|
-
- **Decide instead of asking**, in this order: the plan (Decisions, Design Reference, the task, the spec, SPEC.md) → the Agent Reference and its sub-documents → the codebase's existing patterns → what a senior Babylon Toolkit developer would ship: simplest thing that meets Acceptance, reversible over clever. Log each such decision in one line.
|
|
69
90
|
- **Blocked by an unfinished task:** if it was deferred this run and the fix is now apparent, re-attempt it; otherwise do the minimum of it needed to unblock, log the scope expansion; never tick a task outside the work queue.
|
|
70
|
-
- **Errors:** read the error, fix the cause, retry; transient ones (network, port in use, lock file, editor still compiling) → wait and retry up to 3×. **Tools down** (Unity, Blender, dev server): restart through their CLI and retry; genuinely unavailable → defer the task.
|
|
71
|
-
- **
|
|
91
|
+
- **Errors:** read the error, fix the cause, retry; transient ones (network, port in use, lock file, editor still compiling) → wait and retry up to 3×. **Tools down** (Unity, Blender, dev server, browser): restart or install them through their CLI and retry; genuinely unavailable → defer the task.
|
|
92
|
+
- **Permission denied:** a tool call the host's permission mode refuses is respected, never worked around — log it, defer only that step with `permission denied: <action>`, and continue with everything else. The README's non-prompting permission mode is how the user avoids these.
|
|
72
93
|
- **Defer, don't stall.** A task that cannot pass keeps `- [ ]` and gets ` ⏭️ DEFERRED (auto-pilot): <reason>` appended to its line; continue. A dependent that cannot proceed is deferred `blocked by T<n>`. When the queue is done, make one more pass over the deferred tasks; one that now passes loses the marker and gets its tick.
|
|
73
|
-
- **Safety.** Never push, force-push, deploy, spend money, or delete/overwrite anything outside the plan's scope unless the plan explicitly says so — defer that step instead. Never `git init`.
|
|
74
|
-
- **Checkpoints.** In a git repo, commit after each phase's boxes are ticked: `T<n>: <title> (auto-pilot)` (or `T<a>–T<b>: …`). On the default branch, first switch to `autopilot/<plan-basename>`.
|
|
75
|
-
- **Context.** Implement each phase in a fresh implementer subagent (it builds and tests; keep it for that phase's fix loop), so you only orchestrate: read plan → implementer → verifier → tick → commit → log. The plan's checkboxes and the run log are the only state — re-read them at each phase boundary and after a compaction.
|
|
94
|
+
- **Safety.** Never push, force-push, deploy, publish, spend money, or delete/overwrite anything outside the plan's scope unless the plan explicitly says so — defer that step instead. Asset generation the plan or spec explicitly calls for (images, textures, audio, video, 3D through the documented generation tools) is in scope: do it. Never `git init`.
|
|
95
|
+
- **Checkpoints.** In a git repo, commit after each phase's boxes are ticked: `T<n>: <title> (auto-pilot)` (or `T<a>–T<b>: …`). On the default branch, first switch to `autopilot/<plan-basename>`. Uncommitted changes that are not yours → leave them untouched and stage only the paths this run changed; never ask about them.
|
|
96
|
+
- **Context.** Implement each phase in a fresh implementer subagent (it builds and tests; keep it for that phase's fix loop), so you only orchestrate: read plan → implementer → verifier → tick → commit → log → next phase. The plan's checkboxes and the run log are the only state — re-read them at each phase boundary and after a compaction.
|
|
76
97
|
- **Run log** — `<plan-basename>_autopilot.md` beside the plan, appended per run: start/end times and completed/total; one line per task (outcome, attempts, tests, verifier, files, commit); one line per decision; deferred tasks with what a human should look at first. Narrate the same boundaries to the console: `▶ [auto-pilot] T12/50 — <title>`, `✅ … verified`, `⏭️ … deferred — <reason>`.
|
|
77
|
-
- **Exit report
|
|
98
|
+
- **Exit report** — only once the queue is empty: tasks completed, completed/total, deferred tasks with reasons, decisions logged and the run-log path, branch and last commit, whether the plan is done. It states results; it asks nothing. Re-running the same command resumes and re-attempts deferred tasks.
|
package/skills/bt-plan/SKILL.md
CHANGED
|
@@ -7,19 +7,21 @@ allowed-tools: Read, Grep, Glob, Write, WebFetch(domain:raw.githubusercontent.co
|
|
|
7
7
|
Turn a feature spec into `_specs/<feature-name>_plan.md`: an ordered checklist of tasks that `bt-execute` runs. Follow the project's agent instructions (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md). The user's message after the skill name is the `arguments`.
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
/bt-plan [--heavy] [--parity] <feature-spec> <optional-brief>
|
|
10
|
+
/bt-plan [--heavy] [--parity] [--no-time-limit] <feature-spec> <optional-brief>
|
|
11
11
|
|
|
12
12
|
/bt-plan @_specs/mute-game-audio_spec.md
|
|
13
13
|
/bt-plan "add a settings toggle to mute all game audio" # no spec file → Quick Plan: short interview, then plan
|
|
14
14
|
/bt-plan --heavy @_specs/feature_spec.md # decision-complete plan for a long or cheaper-model run
|
|
15
15
|
/bt-plan --heavy --parity @_specs/feature_spec.md # numeric parity gates against the reference (slow)
|
|
16
|
+
/bt-plan --no-time-limit @_specs/feature_spec.md # turn off the default TIME MATTERS mode
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
- `--heavy` — Heavy Plan mode (below). `--parity` — plan numeric parity proof; also on when the spec says `proof: parity`. Strip flags first; they are never part of the brief.
|
|
19
|
+
- `--heavy` — Heavy Plan mode (below). `--parity` — plan numeric parity proof; also on when the spec says `proof: parity`. `--no-time-limit` — turn off TIME MATTERS mode (Ground rules). Strip flags, and any literal `TIME MATTERS`, first; they are never part of the brief.
|
|
19
20
|
- Spec file (± brief) → plan from it. **Brief only → Quick Plan.** Neither → ask for a brief. Never guess a path or URL.
|
|
20
21
|
|
|
21
22
|
## Ground rules
|
|
22
23
|
|
|
24
|
+
- **TIME MATTERS** — on by default; `--no-time-limit` turns it off. Treat the arguments as ending with `TIME MATTERS`: the user is waiting on this run, so finish quickly — research only what the plan needs, keep subagents few and their questions narrow, and do not re-read what you already have. Begin every subagent prompt with `TIME MATTERS.` Print `⏱️ [bt-plan] TIME MATTERS` at the start (`--no-time-limit`: print `⏱️ [bt-plan] No time limit`, and do not add it). Speed never skips a required step, the Heavy Plan cold-context audit, or anything the plan needs to be complete.
|
|
23
25
|
- **Planning only — in every mode.** Research read-only; the plan file is the only file you write. Never implement a task, edit source, or run builds/tests — not even a trivial first task. Writing the plan is the last action; the user runs `bt-execute` separately.
|
|
24
26
|
- **Babylon work:** if you have not read the Babylon Toolkit Agent Reference in this session, fetch and read it once: https://raw.githubusercontent.com/babylontoolkit/agent/main/reference.md — the authority for conventions and API; fetch sub-documents only when relevant, and again only if a context compaction made you forget it. If the fetch fails, stop and tell the user — do not guess at the API.
|
|
25
27
|
- **Say what you are doing.** Before any step that takes more than a few seconds print one short line — `🔎 [bt-plan] <what> …` — and one when it returns; one line per subagent going out and coming back. A silent run looks like a hang and gets cancelled.
|
package/skills/bt-spec/SKILL.md
CHANGED
|
@@ -7,19 +7,22 @@ allowed-tools: Read, Grep, Glob, Write, WebFetch(domain:raw.githubusercontent.co
|
|
|
7
7
|
Turn a short feature idea into a spec file that `bt-plan` can plan from. Follow the project's agent instructions (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md). The user's message after the skill name is the `arguments`.
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
/bt-spec [--grill-me] [--parity] <feature-brief>
|
|
10
|
+
/bt-spec [--grill-me] [--parity] [--no-time-limit] <feature-brief>
|
|
11
11
|
|
|
12
12
|
/bt-spec "add a settings toggle to mute all game audio"
|
|
13
13
|
/bt-spec --grill-me "add a settings toggle to mute all game audio" # interview first, then spec
|
|
14
14
|
/bt-spec --parity "port the Unity water shader and match it to within 2% in the browser" # numeric parity bars allowed (slow — hours become days)
|
|
15
|
+
/bt-spec --no-time-limit "redesign the save system" # turn off the default TIME MATTERS mode
|
|
15
16
|
```
|
|
16
17
|
|
|
17
18
|
- `--grill-me` — interview the user, one question at a time, before writing (Step 4).
|
|
18
19
|
- `--parity` — the spec may set numeric parity bars against a reference. Without it, `proof: functional`.
|
|
19
|
-
-
|
|
20
|
+
- `--no-time-limit` — turn off TIME MATTERS mode (Ground rules).
|
|
21
|
+
- Strip the flags, and any literal `TIME MATTERS`, first; they are never part of the brief or the file name. An unrecognised `--flag` is part of the brief only if it is clearly prose — otherwise ask. No brief → ask for one. Never guess a path or URL.
|
|
20
22
|
|
|
21
23
|
## Ground rules
|
|
22
24
|
|
|
25
|
+
- **TIME MATTERS** — on by default; `--no-time-limit` turns it off. Treat the arguments as ending with `TIME MATTERS`: the user is waiting on this run, so finish quickly — research only what the spec needs, keep subagents few and their questions narrow, and do not re-read what you already have. Begin every subagent prompt with `TIME MATTERS.` Print `⏱️ [bt-spec] TIME MATTERS` at the start (`--no-time-limit`: print `⏱️ [bt-spec] No time limit`, and do not add it). Speed never skips a required step or lowers the quality of the spec.
|
|
23
26
|
- **Planning only.** Research read-only and write only the spec file (plus `SPEC.md` from the scaffold, if the user says yes below). No source edits, no builds, no tests, no other shell commands.
|
|
24
27
|
- **Babylon work:** if you have not read the Babylon Toolkit Agent Reference in this session, fetch and read it once: https://raw.githubusercontent.com/babylontoolkit/agent/main/reference.md — it is the authority for conventions and API; fetch its sub-documents only when relevant, and again only if a context compaction made you forget it. If the fetch fails, stop and tell the user — do not guess at the API.
|
|
25
28
|
- **Say what you are doing.** Before any step that takes more than a few seconds (a fetch, a big read, subagents) print one short line — `🔎 [bt-spec] <what> …` — and one line when it returns. A silent run looks like a hang and gets cancelled.
|