@babylonjs-toolkit/agent 1.1.10 → 1.1.12

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 CHANGED
@@ -124,7 +124,7 @@ happens to be named `bt-something` is safe.
124
124
  | Skill | Command | What it does |
125
125
  |-------|---------|--------------|
126
126
  | [`bt-spec`](skills/bt-spec/SKILL.md) | `/bt-spec` | Turn a short idea into a feature spec file on a new git branch. |
127
- | [`bt-plan`](skills/bt-plan/SKILL.md) | `/bt-plan` | Produce a detailed, task-checklist technical plan from a spec. |
127
+ | [`bt-plan`](skills/bt-plan/SKILL.md) | `/bt-plan` | Produce a detailed, task-checklist technical plan from a spec. Add `--heavy` for a decision-complete plan that keeps a long, fresh-context-per-task run cohesive. |
128
128
  | [`bt-execute`](skills/bt-execute/SKILL.md) | `/bt-execute` | Implement one task (or all remaining tasks) from a plan/spec. |
129
129
  | [`bt-convert`](skills/bt-convert/SKILL.md) | `/bt-convert` | Convert source code to Babylon Toolkit TypeScript. |
130
130
  | [`bt-copycat`](skills/bt-copycat/SKILL.md) | `/bt-copycat` | Re-create the specified website adapted to specified genre. |
@@ -140,6 +140,20 @@ the frontmatter `name` + `description` to decide when the skill applies. The `al
140
140
  line is honored by Claude Code (auto-approves those tools) and safely ignored by Codex and
141
141
  Copilot.
142
142
 
143
+ ### Heavy plans (`/bt-plan --heavy`)
144
+
145
+ A plan can hold 50+ tasks and run for days, with each task executed by `bt-execute` in a fresh
146
+ context. The only thing that survives between tasks is the plan file. `--heavy` makes `bt-plan`
147
+ write it as the feature's shared memory: a numbered `## Decisions` log (every choice, its
148
+ rationale, what was rejected, which tasks it binds), a `## Design Reference` (file map, interfaces
149
+ written as code, data shapes, algorithms with their constants, edge-case policy, verbatim
150
+ conventions to mirror, exact API usage, test strategy), and self-contained tasks that cite those
151
+ sections by name instead of relying on memory of earlier tasks. Before the plan is final, a fresh
152
+ read-only subagent audits it as a cold executor and every gap it finds is fixed. The result is
153
+ that task 40 uses the same names, shapes and patterns as task 3 — whichever session or day runs
154
+ it. Without the flag, `bt-plan` produces its standard plan; `bt-execute` runs either kind the
155
+ same way.
156
+
143
157
  ## Universal Installations
144
158
 
145
159
  Where each tool looks for GLOBAL skills (**Default Installation** — `~` = your home directory):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs-toolkit/agent",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "Installs the Babylon Toolkit agent skills and Agent Persona for Claude Code, Codex, GitHub Copilot, Gemini CLI and Antigravity.",
5
5
  "keywords": [
6
6
  "babylonjs",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: bt-plan
3
- description: "The Babylon Toolkit Plan Skill creates the detailed technical plan for the specified feature spec file. Use when asked to plan or produce implementation tasks for an existing spec. Also supports a Quick Plan mode: when given only a brief (no spec file), it interviews the user to build a mini-spec and plans from that. Always planning-only — it writes the plan file and stops; execution is the separate bt-execute skill."
3
+ description: "The Babylon Toolkit Plan Skill creates the detailed technical plan for the specified feature spec file. Use when asked to plan or produce implementation tasks for an existing spec. Also supports a Quick Plan mode: when given only a brief (no spec file), it interviews the user to build a mini-spec and plans from that. Add `--heavy` for Heavy Plan mode: a decision-complete plan (numbered Decisions log, Design Reference with real interfaces and patterns, self-contained task blocks, cold-context audit) that keeps a long run of fresh-context tasks cohesive. Always planning-only — it writes the plan file and stops; execution is the separate bt-execute skill."
4
4
  allowed-tools: Read, Grep, Glob, Write, WebFetch(domain:raw.githubusercontent.com), Agent, Task
5
5
  ---
6
6
 
@@ -13,11 +13,12 @@ Use the user’s message after the skill name as the `arguments`.
13
13
  # Invocation
14
14
 
15
15
  ```
16
- /bt-plan <feature-spec> <optional-brief>
16
+ /bt-plan [--heavy] <feature-spec> <optional-brief>
17
17
  ```
18
18
  - **`<feature-spec>`** — the feature spec file to create a plan for. This is the *blueprint*.
19
19
  - **`<optional-brief>`** — the brief or instructions for generating the plan. This is the *variable*.
20
- - Never guess a file path or URL. Resolve the arguments as follows:
20
+ - **`--heavy`** *(optional flag)* — **Heavy Plan mode**: write the plan as the feature's complete shared memory (a numbered Decisions log, a Design Reference, self-contained task blocks) and audit it from a cold context before finalizing, so a long run of tasks executed in fresh contexts stays cohesive. See **Heavy Plan mode**. Without the flag, the plan is produced exactly as described in Step 2. The flag may appear anywhere in the arguments and is never part of the brief — **strip it first**, then resolve the rest below.
21
+ - Never guess a file path or URL. Resolve the (flag-stripped) arguments as follows:
21
22
  - **Both a spec file and a brief** → normal full planning.
22
23
  - **A spec file only** → normal full planning; the brief defaults to "Generate a detailed implementation plan".
23
24
  - **A brief only, no spec file** → **Quick Plan mode** (see below). Do not ask *for a spec file* — treat the brief as the feature request. But because there is no spec, **interview the user with clarifying questions** to pin down the requirements before finalizing the plan.
@@ -27,6 +28,7 @@ Example:
27
28
  ```
28
29
  /bt-plan → @feature_spec.md → "Generate a detailed implementation plan"
29
30
  /bt-plan → "add a settings toggle to mute all game audio" # no spec file → Quick Plan mode, automatically
31
+ /bt-plan --heavy @feature_spec.md # Heavy Plan mode: decision-complete plan for a long run
30
32
  ```
31
33
 
32
34
  ---
@@ -71,6 +73,131 @@ The goal is the same as a spec: a plan optimized to what the user actually wants
71
73
 
72
74
  ---
73
75
 
76
+ ## Heavy Plan mode (`--heavy`)
77
+
78
+ Run this mode **only when the `--heavy` flag is present**. Without it, nothing in this section applies and the plan is produced exactly as Step 2 describes.
79
+
80
+ Heavy Plan mode changes **only two things**: the structure of the plan document (Step 2 below is replaced by the *Heavy plan document* structure in this section) and one extra step before finalizing (the *cold-context audit*). Everything else — the argument rules, Quick Plan mode (yes, `--heavy` combines with a brief-only Quick Plan), the subagent and narration rules, the Agent Reference requirement, planning-only mode, and the full Step 1 analysis — runs unchanged. Emit one visible status line when this path is taken: `🏋️ [bt-plan] Heavy Plan mode — writing a decision-complete plan with a cold-context audit`.
81
+
82
+ ### Why: the plan is the memory
83
+
84
+ A long plan is not executed in one sitting. It can hold **fifty or more tasks**, run over **several days**, and each task is typically executed by **bt-execute in a fresh context** (`/clear` between tasks, new sessions, resumed runs). The only thing that survives from one task to the next is the plan file. Whatever is not written in it is gone: the executor of task 40 has never seen task 3, does not know what it decided, and will re-derive conventions from the codebase — possibly differently. Across a long run, that is how features drift: two naming styles, two error-handling patterns, a helper written twice, an interface that changed shape halfway through.
85
+
86
+ So a heavy plan is the **complete, shared memory** of the feature: every decision, every name, every signature, every pattern to mirror, written once, in one place, and cited from every task that depends on it. **The test:** could an engineer with a fresh context, who has never seen this repo or the earlier tasks, open task 40 and produce code consistent with tasks 1–39 — same names, same shapes, same conventions — using only the plan? If they would have to look at what earlier tasks produced and infer the pattern, the plan is not carrying the memory.
87
+
88
+ **What a heavy plan must decide and record, rather than leave to be re-derived per task:**
89
+
90
+ | Class | What the plan must record |
91
+ | --- | --- |
92
+ | Architecture | module boundaries, which layer owns what, dependency direction, where state lives, sync vs async, event vs call |
93
+ | File layout | every file created / modified / deleted, by exact path; each new file's responsibility; where in an existing file new code goes (an anchor: "after `foo()`", "inside the `switch` at `:412`") |
94
+ | Interfaces & contracts | full signatures of every new/changed function, class, type, interface, event name, message shape, config key, CLI flag, route — written as code, not prose, so every task types the same thing |
95
+ | Data shapes & state | schemas, field names + types, defaults, invariants, persistence format, migration behaviour |
96
+ | Algorithms & formulas | pseudocode or real code for anything non-obvious: math, ordering, caching, retry, timing, physics tuning values |
97
+ | Naming | the actual names of the new things (classes, functions, fields, files, CSS classes, events, test names) — chosen once, following the repo's conventions |
98
+ | Error & edge-case policy | for every edge case the spec lists (and every one the analysis found): the decided behaviour, written as "when X → do Y" |
99
+ | Dependencies | exactly which packages/versions are added, or an explicit "no new dependencies" |
100
+ | Sibling-skill behavioural config | every option of a sibling-skill pattern (e.g. 3D-Hero-Scroll `sweep`) with its value, not just its name |
101
+ | Test design | the test file(s), the harness/pattern to copy, the named cases with expected outcomes, and the exact command to run |
102
+ | Ordering & dependencies | which tasks depend on which; what must keep working between tasks (temporary shims, feature flags) and which later task removes them |
103
+
104
+ **Write the code when the code IS the decision.** This skill never edits source files, but a heavy plan may (and should) put code *inside the plan*: full signatures, type definitions, data schemas, the tricky 20-line algorithm, a config block, a test skeleton. When the shape of the code is the decision, prose is a lossy encoding of it — write the code once here, and every task that needs it copies the same thing. Leave to prose only the mechanical glue ("wire `X` into `Y`'s constructor the same way `Z` is at `:88`").
105
+
106
+ **Many small, self-contained tasks beat few large ones.** A task should fit in one fresh context: a handful of files, one clear outcome, everything it needs either in its own block or cited by name from the Decisions and Design Reference. Split a task whenever it grows past roughly ten steps, two hundred lines of new code, or four files.
107
+
108
+ **Do the API homework once, here.** When a task uses a Babylon Toolkit component or BabylonJS API, show the exact call the way the Agent Reference (or its sub-document) shows it, in the Design Reference › *API usage* section — so every task across the run uses the same API the same way instead of each fresh context rediscovering it. Fetch the relevant sub-documents during Step 1 and copy the correct usage into the plan.
109
+
110
+ **Ask now, while the whole feature is in view.** Anything ambiguous that Step 1 or the interview surfaces is resolved here, with the user if necessary — a question deferred to execution gets answered by whichever task happens to hit it, in isolation, without the context to answer it consistently.
111
+
112
+ ### Step 1 additions in Heavy Plan mode
113
+
114
+ The analysis is the same eight points; ask for **plan-grade detail** when running it. Exploration subagents (or you, on the sequential path) should return `file:line` references, the real signatures of the functions the feature will call or change, and verbatim snippets of the conventions to mirror (the actual pattern, ten to thirty lines, with its location) — not summaries like "uses a manager pattern". Also carry forward the feature spec's `Decisions` entries and note its `Open Questions` (each gets resolved in the plan's `## Decisions`), and establish the **test baseline** (command, current pass/fail state, which failures are pre-existing), so a task run days later can tell new failures from old ones.
115
+
116
+ ### Heavy plan document
117
+
118
+ Emit `✍️ [bt-plan] Writing draft _specs/<feature-name>_plan.md …` before writing, and `💾 [bt-plan] Draft written — _specs/<feature-name>_plan.md (<n> tasks)` once the file is saved. The document has **five required sections, in this order**. A plan missing any of them is invalid; do not produce one.
119
+
120
+ **1. `## Codebase Analysis`** — exactly as in Step 2 (the Step 1 findings with `file:line` citations and the SPEC.md alignment note), plus the **test baseline** and, in Quick Plan mode, the **interview answers** that stand in for the spec.
121
+
122
+ **2. `## Decisions`** — the feature-scoped decision log; the part of the plan that keeps task 40 consistent with task 3. One entry per decision, numbered `D1`, `D2`, … so tasks can cite them. Carry every entry from the feature spec's `Decisions` section forward (keep its wording, add the D-number), then add every decision *you* made while planning — architecture, layout, naming, algorithms, error policy, test strategy — using the table above as the checklist. Every entry has the same shape:
123
+
124
+ ```markdown
125
+ - **D3 — <decision, stated as a fact>.** <why: the deciding constraint, or the precedent in the codebase with file:line>
126
+ Rejected: <alternative> (<why not>). Binds: T4, T7.
127
+ ```
128
+
129
+ Resolve every `Open Question` from the spec here. An open question that survives into execution gets answered by one task in isolation and, days later, differently by another. If you genuinely cannot resolve one without the user, ask the user now, then record the answer. "TBD", "to be decided during implementation", "the implementer may choose" and similar phrases are forbidden anywhere in a heavy plan.
130
+
131
+ **3. `## Design Reference`** — the blueprint every task cites, where the shared names, shapes and code live so each task copies from one source instead of inventing its own. Use these sub-headings (omit one only if it truly does not apply, and say so in one line):
132
+
133
+ - **File map** — a table of every file the feature creates, modifies, or deletes: `path | create/modify/delete | responsibility | touched by tasks`.
134
+ - **Module boundaries** — what owns what, which direction dependencies point, where state lives. A short ASCII diagram is welcome where it clarifies flow.
135
+ - **Interfaces & contracts** — every new or changed function, class, type, interface, event, message, config key, or route, **written as code in the project's language** with full signatures, parameter types, return types and a one-line doc comment. These are the exact names every task will type.
136
+ - **Data shapes & state** — schemas / type definitions, defaults, invariants, persistence format.
137
+ - **Control flow** — the key sequences, numbered ("1. `onPointerDown` → 2. `#pick()` → 3. …"), including what happens on the failure branches.
138
+ - **Algorithms & formulas** — pseudocode or real code for anything non-obvious, with the constants and tuning values decided (`offset = max(halfWidth + 4, 18)`, not "a sensible offset").
139
+ - **Error & edge-case policy** — one line per edge case: `when <X> → <Y>`.
140
+ - **Conventions to mirror** — verbatim snippets of the repo's existing pattern with `file:line`, one per convention the feature must copy (component registration, debug-drawing pattern, test harness, styling tokens from `DESIGN.md`, …).
141
+ - **API usage** — for every Babylon Toolkit / BabylonJS / third-party API the feature calls, the exact call as the Agent Reference (or the library docs) shows it.
142
+ - **Test strategy** — the test file(s) to create or extend, the harness/pattern to copy (with `file:line`), how to run them, and the baseline to compare against.
143
+
144
+ **4. `## Tasks`** — the ordered checklist, numbered `T1`, `T2`, `T3` … in dependency order with GitHub-style checkboxes, each small enough to be implemented and verified on its own in a fresh context. Every task uses this block. Fields marked **required** must be present on every task; the others are omitted only when they genuinely have nothing to say.
145
+
146
+ ```markdown
147
+ ## Tasks
148
+
149
+ - [ ] **T7** — <short imperative title>
150
+ - Depends on: T3, T5 # required (write "none" for the first task)
151
+ - Files: `src/foo.ts` (create), `src/bar.ts` (modify — `Bar.init()`), `src/old.ts` (delete) # required
152
+ - Applies: D2, D5 · Design Reference › Interfaces › `FooService` · Conventions to mirror › debug drawing # required — what this task must stay consistent with
153
+ - Steps: # required — numbered, concrete, one action each
154
+ 1. In `src/bar.ts`, directly after the `import` block, add `import { FooService } from "./foo";`.
155
+ 2. In `Bar.init()` (currently `src/bar.ts:41-58`), after the line `this.scene = scene;`, add `this.foo = new FooService(scene, { mode: "page" });`.
156
+ 3. Create `src/foo.ts` with the code in **Code** below.
157
+ 4. …
158
+ - Code: # when the code is the decision: full or skeleton code, in the project's language
159
+ ```ts
160
+ export class FooService { … }
161
+ ```
162
+ - Do not: … # the tempting wrong turns: "do not add a second guard in pull()", "do not touch the metadata override"
163
+ - Tests: `tests/foo.test.ts` (create, copy harness from `tests/bar.test.ts:1-30`) — # required unless the task has no testable surface, in which case say so
164
+ - `constructs with page mode by default` → `service.mode === "page"`
165
+ - `throws on a null scene` → rejects with `TypeError`
166
+ - run: `npm test -- tests/foo.test.ts`
167
+ - Acceptance: <observable, checkable statements — what is true when this task is done> # required
168
+ - Verify: `npm test -- tests/foo.test.ts` → 2 passing · `npx tsc --noEmit` → no errors · `grep -n "new FooService" src/bar.ts` → 1 hit # required — commands + expected output
169
+ ```
170
+
171
+ Rules for heavy task blocks:
172
+
173
+ - **Every task is self-contained.** Its Steps plus the Decisions and Design Reference sections it cites on **Applies** are everything needed to do it. A task must never say "follow the pattern from T3" — T3's context is gone by then; say "follow Design Reference › Conventions to mirror › <name>" and put the pattern there, once.
174
+ - **Steps are instructions, not goals.** "Add validation" is a goal; "In `submit()` at `:120`, before the `fetch` call, add `if (!form.name) { setError('name', 'Required'); return; }`" is a step. Every step names the file, the anchor, and the change.
175
+ - **Anchors are real.** Every `file:line` and "after `<code>`" anchor comes from Step 1's reading of the actual file. Prefer code anchors ("after the line `this.scene = scene;`") to bare line numbers where lines are likely to shift during a long run — or give both.
176
+ - **Names, signatures and values come from the Design Reference.** If a step introduces a name that is not in the Design Reference, add it there first. That is what keeps the fortieth task's naming identical to the third's.
177
+ - **Acceptance is observable.** Something a verifier can check by running a command or inspecting a file: a test count, a grep result, a rendered behaviour ("PLAY auto-scrolls to the document bottom"), never "works correctly". Sibling-skill behaviours are asserted in observable terms exactly as Step 2 requires.
178
+ - **Verify gives the command and the expected output**, so a fresh context compares against a stated value rather than judging.
179
+ - **Keep the system working between tasks.** When a change spans tasks, say what temporary shim, flag, or compatibility write keeps the app running after each one, and which later task removes it — a resumed run may pause for days between them.
180
+
181
+ The **SPEC.md write-back task** is required under the same conditions as in Step 2 and is still the LAST task. In a heavy plan, **write the SPEC.md content in the task** — the exact paragraphs to merge into each current-state section and the exact Decisions entries to append (your `## Decisions` entries, promoted to project scope) — using the heavy task block (Steps that name each SPEC.md section and the text to insert, a **Code** block holding the exact markdown, a **Verify** of `grep -n "<distinctive phrase>" SPEC.md` → one hit each), so the write-back records what was planned rather than what one fresh context remembers at the end.
182
+
183
+ **5. `## How to execute this plan`** — the exact verbatim section from Step 2, unchanged.
184
+
185
+ ### Cold-context audit (required in Heavy Plan mode, before the plan is final)
186
+
187
+ The draft is not the plan. A plan written in one pass by the same mind that holds all the context always leaves gaps that mind cannot see — the "obvious" choice that was never written down, the name that was in your head but not on the page, the task that quietly assumes you remember an earlier one. Those gaps are exactly what a fresh context at task 40 will fill in differently. The audit finds them now.
188
+
189
+ Emit `🕵️ [bt-plan] Cold-context audit — reading the draft as a fresh executor …`. Then, if a subagent-spawning tool is available, launch **one read-only audit subagent** with a fresh context (it must NOT see your reasoning, only the files), and give it: the path of the draft plan, the repository root, and these instructions verbatim:
190
+
191
+ > You are a competent engineer with a fresh context. You have never seen this repository or this feature before, and you will execute one task at a time with no memory of the others. Read the plan at `<path>` in full. Then, for **every** task, check the plan against the actual codebase (read the files and anchors it names) and list every point where you would be **forced to decide, guess, look up, or infer** something the plan should have given you: a missing signature, name, value, file location or anchor; an anchor that does not match the real file; a step that states a goal instead of an instruction; a step that depends on knowing what an earlier task did rather than on the Design Reference; a name used in a task that is not defined in the Design Reference; a test case without an expected outcome; a Verify without an expected output; an edge case with no decided behaviour; an API call whose exact usage is not shown; any use of "TBD", "appropriate", "suitable", "as needed", "etc." or "the implementer may". Also flag any task that would not fit in one sitting or touches more than four files. Report as a list: `T<n> · step <k> · <what is missing> · <what you would have had to decide>`. Do not fix anything, do not write files, do not run builds or tests. Report "NO GAPS" only if you found none.
192
+
193
+ If no subagent tool is available, emit `➡️ [bt-plan] no subagent tool — self-auditing the draft` and perform the same read yourself, deliberately re-reading the plan top to bottom against the real files with the checklist above, one task at a time.
194
+
195
+ Emit `🧾 [bt-plan] Audit found <n> gaps across <m> tasks` (or `… found NO GAPS`). Then **resolve every reported gap by editing the plan** — add the missing decision to `## Decisions`, the missing code/signature/name to `## Design Reference`, the missing instruction to the task — and emit `🔧 [bt-plan] Resolved <n>/<n> gaps`. If the audit found more than a handful of gaps, run it **once more** on the revised plan (`🕵️ [bt-plan] Second audit pass …`); stop after the second pass regardless, and list any gap you chose not to resolve, with why, in the plan's Codebase Analysis. A gap the audit reports that you cannot resolve without the user is a question for the user — ask it now. Re-writing the plan file after the audit is the one case where this skill writes it more than once; it is still the only file this skill ever writes.
196
+
197
+ Finish with `💾 [bt-plan] Plan finalized — _specs/<feature-name>_plan.md (<n> tasks, <k> decisions)`, then report the number of tasks and decisions, the two or three most consequential decisions (with their D-numbers), anything you were unable to resolve, and the same next-step hint as Quick Plan mode. Then **STOP** — heavy or not, this skill never begins T1.
198
+
199
+ ---
200
+
74
201
  ## Subagents — invoking this skill IS the request
75
202
 
76
203
  This skill's workflow depends on subagents. **Invoking it is the user's explicit request to use them**, so any host default of the form *"do not spawn subagents / do not call the agent tool unless the user asks for it"* is **ALREADY SATISFIED** — the user asked by running this command. Never silently downgrade to the inline path on that basis, and never stop to ask permission for it first.
@@ -148,8 +275,12 @@ Before writing a single implementation step, investigate the actual codebase rea
148
275
 
149
276
  If the spec or codebase is too ambiguous to analyze responsibly, stop and ask the user rather than guessing.
150
277
 
278
+ *(In Heavy Plan mode, also apply the **Step 1 additions** listed under *Heavy Plan mode* above.)*
279
+
151
280
  ## Step 2. Write the plan
152
281
 
282
+ > **Heavy Plan mode (`--heavy`):** the *Heavy plan document* structure and the *cold-context audit* under **Heavy Plan mode** above replace this step. The Codebase Analysis requirements, the SPEC.md write-back rules, and the verbatim `How to execute this plan` section below still apply unchanged inside that structure. Without the flag, follow this step exactly as written.
283
+
153
284
  Emit `✍️ [bt-plan] Writing _specs/<feature-name>_plan.md …` before writing, and `💾 [bt-plan] Plan written — _specs/<feature-name>_plan.md` once the file is saved.
154
285
 
155
286
  Only after Step 1 is complete, write the plan markdown to `_specs/` as `<feature-name>_plan.md`. The document MUST open with a `## Codebase Analysis` section that summarizes the findings from Step 1 (cite the real files/modules you inspected) — this is the evidence that the analysis happened. This section MUST include a short **SPEC.md alignment** note: which SPEC.md sections the plan conforms to, and whether the feature is spec-impacting (carry over the feature spec's `spec_impact`, or in Quick Plan mode the value you inferred, and say it was inferred). A plan without a grounded analysis section is invalid; do not produce one.