@babylonjs-toolkit/agent 1.1.32 → 1.1.34

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.
@@ -1,356 +1,96 @@
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. 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. Plans are sized to the feature (task budget by spec size, phases, per-task verify level) so execution cost stays proportional. 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. Add `--parity` for numeric parity gates instead of the default functional proof. 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
 
7
- Create a detailed technical implmentation plan for the specified feature spec and save in the _specs folder as `<feature-name>_plan.md`. Always generate implmentation tasks or steps (prefer to call them tasks).
8
-
9
- Use the user’s message after the skill name as the `arguments`.
10
-
11
- ---
12
-
13
- # Invocation
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`.
14
8
 
15
9
  ```
16
- /bt-plan [--heavy] <feature-spec> <optional-brief>
17
- ```
18
- - **`<feature-spec>`** — the feature spec file to create a plan for. This is the *blueprint*.
19
- - **`<optional-brief>`** — the brief or instructions for generating the plan. This is the *variable*.
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:
22
- - **Both a spec file and a brief** → normal full planning.
23
- - **A spec file only** → normal full planning; the brief defaults to "Generate a detailed implementation plan".
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.
25
- - **Neither** → ask the user for at least a brief before starting.
26
-
27
- Example:
28
- ```
29
- /bt-plan → @feature_spec.md → "Generate a detailed implementation plan"
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
32
- ```
33
-
34
- ---
35
-
36
- ## Quick Plan mode (no feature spec file)
37
-
38
- > 🛑 **"Quick" refers ONLY to skipping the spec file — never to skipping steps, and NEVER to executing the plan.**
39
- > Quick Plan is still **PLANNING MODE**. It ends the moment `_specs/<feature-name>_plan.md` is written. Do **NOT** implement any task, do **NOT** edit application/source files, do **NOT** run builds or tests, and do **NOT** continue into the tasks you just wrote — not even the first one, not even if the tasks look small, obvious, or trivially automatable. The user executes tasks separately with the **bt-execute** skill, deliberately, with a clean context between steps. Auto-executing destroys that workflow.
40
-
41
- When invoked with a brief but **no feature spec file**, produce a plan from the brief. Do not stop to ask *for a spec file* — instead **interview the user** to build a **mini-spec** from their answers, then plan from that mini-spec exactly as you would from a real spec file. A spec is largely the product of that Q&A; skipping the file must not mean skipping the questions. Everything the skill would normally read from the feature spec is supplied by sensible defaults only as a **last-resort fallback** for anything left unanswered:
42
-
43
- | Normally from the spec | Quick Plan default |
44
- | --- | --- |
45
- | Feature name (for `<feature-name>_plan.md`) | Derive a short kebab-case name from the brief (e.g. "mute all game audio" → `mute-game-audio`). |
46
- | Full feature requirements | Use the brief itself as the requirements, expanded by the Step 1 codebase analysis. |
47
- | `spec_impact: yes/no` | **Infer** it from the Step 1 analysis: `yes` if the feature adds/changes a system, convention, dependency, or architectural decision; otherwise `no`. |
48
- | `Project Spec Alignment` section | Derive alignment directly from root `SPEC.md` + the analysis. |
49
- | `size: small/medium/large` | **Infer** it from the brief + analysis per *Size the plan to the feature*. |
50
-
51
- **The one and only difference in Quick Plan mode is operating without a spec file** — the interview produces a mini-spec that stands in for it. Everything else is identical to a normal run: Step 1's comprehensive codebase analysis (including reading root `SPEC.md`) runs in full, the plan document has the same structure, the SPEC.md write-back task is still appended when the inferred `spec_impact` is `yes`, and the run still **STOPS after writing the plan file**. Nothing about Quick Plan grants permission to implement.
52
-
53
- Emit one visible status line when this path is taken: `⚡ [bt-plan] Quick Plan mode — no feature spec file; interviewing, then planning from the brief`.
54
-
55
- ### Finishing a Quick Plan (hard stop)
56
-
57
- After writing `_specs/<feature-name>_plan.md`, **STOP**. Your final response must be a short summary of the plan plus the exact next-step hint below — and nothing else. Do not begin T1. Do not offer to "go ahead and start". If the user wants execution, they will invoke bt-execute themselves:
58
-
59
- ```
60
- Plan written to _specs/<feature-name>_plan.md — <n> tasks, estimated <total range> of agent time
61
- Run a single task with `bt-execute _specs/<feature-name>_plan.md T1`, or every task with `bt-execute _specs/<feature-name>_plan.md ALL` (add `--strict` for an adversarial verifier on every task).
62
- ```
63
-
64
- ### Interview before planning (Quick Plan)
65
-
66
- Because there is no spec, the clarifying questions the spec process would have asked are now **your** responsibility. After the Step 1 analysis (so your questions are grounded in the real codebase, not generic), and **before** writing the plan:
67
-
68
- - Ask the user a focused round of clarifying questions covering the things that most change the plan: scope and non-goals, target UX/behavior, edge cases, which existing systems/files it should integrate with, constraints, and — critically — anything ambiguous in the brief or where the codebase suggests more than one reasonable approach.
69
- - Prefer a small number of high-leverage questions (grouped, easy to answer) over interrogating the user. Do not ask about things the brief or codebase already make clear.
70
- - Only fall back to the defaults table for items the user leaves unanswered or explicitly says "you decide". Never silently pick a default when a quick question would materially improve the plan.
71
- - If the user declines to answer or says "just make the plan", proceed with the defaults and state which assumptions you made in the plan's Codebase Analysis section.
72
-
73
- The goal is the same as a spec: a plan optimized to what the user actually wants — reached by asking, not by guessing.
74
-
75
- ---
10
+ /bt-plan [--heavy] [--parity] <feature-spec> <optional-brief>
76
11
 
77
- ## Heavy Plan mode (`--heavy`)
78
-
79
- 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.
80
-
81
- 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`.
82
-
83
- ### Why: the plan is the memory
84
-
85
- 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.
86
-
87
- 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.
88
-
89
- **What a heavy plan must decide and record, rather than leave to be re-derived per task:**
90
-
91
- | Class | What the plan must record |
92
- | --- | --- |
93
- | Architecture | module boundaries, which layer owns what, dependency direction, where state lives, sync vs async, event vs call |
94
- | 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`") |
95
- | 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 |
96
- | Data shapes & state | schemas, field names + types, defaults, invariants, persistence format, migration behaviour |
97
- | Algorithms & formulas | pseudocode or real code for anything non-obvious: math, ordering, caching, retry, timing, physics tuning values |
98
- | Naming | the actual names of the new things (classes, functions, fields, files, CSS classes, events, test names) — chosen once, following the repo's conventions |
99
- | 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" |
100
- | Dependencies | exactly which packages/versions are added, or an explicit "no new dependencies" |
101
- | Sibling-skill behavioural config | every option of a sibling-skill pattern (e.g. 3D-Hero-Scroll `sweep`) with its value, not just its name |
102
- | Test design | the test file(s), the harness/pattern to copy, the named cases with expected outcomes, and the exact command to run |
103
- | Ordering & dependencies | which tasks depend on which; what must keep working between tasks (temporary shims, feature flags) and which later task removes them |
104
-
105
- **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`").
106
-
107
- **Self-contained tasks, sized to real work.** A task should fit in one fresh context: one clear outcome, everything it needs either in its own block or cited by name from the Decisions and Design Reference. Split a task when it would not fit in one sitting — not merely because it touches several files. *Size the plan to the feature* (task budget, no ceremony tasks, phases, `Verify level`, no brittle pins) applies to heavy plans too: every task and phase costs a verification round at execution time. Heavy mode fits whenever execution runs in fresh contexts or on a cheaper model than planning — any feature size. The task budget still follows the spec's `size`.
108
-
109
- **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.
110
-
111
- **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.
112
-
113
- ### Step 1 additions in Heavy Plan mode
114
-
115
- 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.
116
-
117
- ### Heavy plan document
118
-
119
- 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** (plus the `## Estimated execution time` section before the last). A plan missing any of them is invalid; do not produce one.
120
-
121
- **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.
122
-
123
- **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:
124
-
125
- ```markdown
126
- - **D3 — <decision, stated as a fact>.** <why: the deciding constraint, or the precedent in the codebase with file:line>
127
- Rejected: <alternative> (<why not>). Binds: T4, T7.
128
- ```
129
-
130
- 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.
131
-
132
- **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):
133
-
134
- - **File map** — a table of every file the feature creates, modifies, or deletes: `path | create/modify/delete | responsibility | touched by tasks`.
135
- - **Module boundaries** — what owns what, which direction dependencies point, where state lives. A short ASCII diagram is welcome where it clarifies flow.
136
- - **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.
137
- - **Data shapes & state** — schemas / type definitions, defaults, invariants, persistence format.
138
- - **Control flow** — the key sequences, numbered ("1. `onPointerDown` → 2. `#pick()` → 3. …"), including what happens on the failure branches.
139
- - **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").
140
- - **Error & edge-case policy** — one line per edge case: `when <X> → <Y>`.
141
- - **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`, …).
142
- - **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.
143
- - **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.
144
-
145
- **4. `## Tasks`** — the ordered checklist, numbered `T1`, `T2`, `T3` … in dependency order with GitHub-style checkboxes, grouped under `### Phase N — <name>` headings, each task implementable and verifiable 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.
146
-
147
- ```markdown
148
- ## Tasks
149
-
150
- - [ ] **T7** — <short imperative title>
151
- - Depends on: T3, T5 # required (write "none" for the first task)
152
- - Files: `src/foo.ts` (create), `src/bar.ts` (modify — `Bar.init()`), `src/old.ts` (delete) # required
153
- - Applies: D2, D5 · Design Reference › Interfaces › `FooService` · Conventions to mirror › debug drawing # required — what this task must stay consistent with
154
- - Steps: # required — numbered, concrete, one action each
155
- 1. In `src/bar.ts`, directly after the `import` block, add `import { FooService } from "./foo";`.
156
- 2. In `Bar.init()` (currently `src/bar.ts:41-58`), after the line `this.scene = scene;`, add `this.foo = new FooService(scene, { mode: "page" });`.
157
- 3. Create `src/foo.ts` with the code in **Code** below.
158
- 4. …
159
- - Code: # when the code is the decision: full or skeleton code, in the project's language
160
- ```ts
161
- export class FooService { … }
162
- ```
163
- - Do not: … # the tempting wrong turns: "do not add a second guard in pull()", "do not touch the metadata override"
164
- - 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
165
- - `constructs with page mode by default` → `service.mode === "page"`
166
- - `throws on a null scene` → rejects with `TypeError`
167
- - run: `npm test -- tests/foo.test.ts`
168
- - Acceptance: <observable, checkable statements — what is true when this task is done> # required
169
- - Verify: `npm test -- tests/foo.test.ts` → both named cases pass · `npx tsc --noEmit` → no errors · `grep -n "new FooService" src/bar.ts` → 1 hit # required — commands + expected output (never an absolute suite count)
170
- - Verify level: standard # required — `standard` or `live` (see Size the plan to the feature)
12
+ /bt-plan @_specs/mute-game-audio_spec.md
13
+ /bt-plan "add a settings toggle to mute all game audio" # no spec file → Quick Plan: short interview, then plan
14
+ /bt-plan --heavy @_specs/feature_spec.md # decision-complete plan for a long or cheaper-model run
15
+ /bt-plan --heavy --parity @_specs/feature_spec.md # numeric parity gates against the reference (slow)
171
16
  ```
172
17
 
173
- Rules for heavy task blocks:
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
+ - Spec file (± brief) → plan from it. **Brief only → Quick Plan.** Neither → ask for a brief. Never guess a path or URL.
174
20
 
175
- - **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.
176
- - **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.
177
- - **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.
178
- - **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.
179
- - **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.
180
- - **Verify gives the command and the expected output**, so a fresh context compares against a stated value rather than judging. Expected outputs never pin absolute counts that later tasks change (total tests passed, suite sizes, ledger figures).
181
- - **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.
21
+ ## Ground rules
182
22
 
183
- 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.
23
+ - **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
+ - **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
+ - **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.
26
+ - **Subagents:** running this skill is the user's request to use them where it says so. Use whatever subagent tool your host provides (its name varies by host — e.g. `Agent` or `Task`); if there is none, work inline and say so. Tell exploration subagents they need not fetch the Agent Reference.
184
27
 
185
- **5. `## How to execute this plan`** — the exact verbatim section from Step 2, unchanged, preceded by the `## Estimated execution time` section from Step 2.
28
+ ## Step 1. Analyze (required before writing)
186
29
 
187
- ### Cold-context audit (required in Heavy Plan mode, before the plan is final)
30
+ 1. Read the feature spec in full, and `SPEC.md`'s headings, Architecture, Conventions and the systems the feature touches. The plan must conform to SPEC.md — **if it would conflict, stop and tell the user.** Verification procedures described in SPEC.md are tooling you may reuse, not a bar the plan must meet. Note the spec's `spec_impact`, `size` and `proof`.
31
+ 2. **Start from the spec's `## Research Notes`.** Spot-check that the paths exist, then research only what a plan needs beyond them: how the app is built and tested, the real conventions and the closest feature to mirror, the concrete files and integration points, available dependencies, constraints from the agent instructions.
32
+ 3. Size the research: `small` → inline; `medium` / `large` (or no Research Notes) → up to 3 **read-only** subagents returning findings and paths, not file dumps. Tell each one verbatim: *"Read-only: you may read, search and report. Do not edit or create files, and do not run builds, tests or any command that writes — not even into a build folder. If a fact needs a build or a test run to establish, report it as unknown and say which command would settle it."*
33
+ 4. Sibling-skill pattern (e.g. bt-design's 3D-Hero-Scroll): read that skill's reference **and templates** *(where skills load through a tool: `load_skill` + `read_skill_resource`, never a guessed path; where they are files: the skills directory this skill was loaded from, e.g. `~/.claude/skills/`, `~/.agents/skills/` or the project's equivalent)*. The plan **copies and configures the template engine — never re-implements it**; each behavioral option the spec records (e.g. `sweep: page`) becomes an Acceptance item stated in observable terms. Prefer copying and wiring the template as the first task, so later tasks only configure it.
34
+ 5. Too ambiguous to plan responsibly → ask the user. **Already built?** If the research shows some or all of the feature already exists, say so first and plan only what is missing (often just tests and the live check).
188
35
 
189
- 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.
36
+ **Quick Plan (no spec file):** after the analysis, ask a small round of high-leverage questions (scope, behavior, edge cases, which systems it touches); skip anything the brief or code already answers. Unanswered items fall back to: feature name from the brief (kebab-case); `spec_impact` and `size` inferred from the analysis; `proof: functional` unless `--parity`. List the assumptions in Codebase Analysis.
190
37
 
191
- 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:
38
+ ## Step 2. Rules for a good plan
192
39
 
193
- > 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, any micro-task that should be merged into its neighbour, any ceremony task (verification sweep, ledger/baseline opening) the brief did not ask for, and any Verify that pins an absolute count a later task will change. 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.
40
+ Execution time is mostly *how the work is proven*, not the code. Keep proof strong and cheap:
194
41
 
195
- 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.
42
+ 1. **Tasks are real units of work** — something a developer would commit on its own, with its tests. Guide: `small` 1–3 tasks, `medium` 3–8, `large` as needed. Merge tasks that touch the same code for the same purpose; split only when a task would not fit in one sitting. Going well past the guide needs a one-line reason in Codebase Analysis.
43
+ 2. **Phases.** Group tasks under `### Phase N — <name>`. bt-execute runs one independent verifier per phase. Small plan = one phase; otherwise 2–4 related tasks ending at a natural checkpoint.
44
+ 3. **`Verify level`** per task: `standard` (build, named tests, diff review) or `live` (needs the dev server, a browser, Unity or Blender to observe). Mark `live` whenever correctness shows only at runtime — rendering, UI, interaction, Unity↔Babylon parity. The last feature task carries one `live` end-to-end check of the whole feature when it has anything on screen — write it into that task's Acceptance, not as a separate task; a read-and-confirm check likewise belongs in the Acceptance of the task that made the change. bt-execute's verifier performs the live checks, and does all of a phase's live tasks in **one** session. So mark as many tasks `live` as truly need it, but never schedule a capture, screenshot or page session **per task** in the Steps — the phase gets one session covering all of them, and any second engine or full-resolution pass happens once, in the final end-to-end task. A plan with more planned looks than phases is the single most expensive mistake this skill can make. If a live check may be impossible where the plan runs (needs credentials, data or hardware), say in the task what to report instead.
45
+ 4. **Named tests** with expected outcomes for every task that has a testable surface. No probe suites, fuzzing or mutation testing unless the risk calls for it.
46
+ 5. **Functional proof by default:** unit tests; for anything on screen, one look per visual phase — the running result in the browser, judged against the spec and DESIGN.md, or beside a reference image when one exists (a mockup, the original site, the Unity view) — on one browser/engine at reduced resolution, with any second engine checked once in the final end-to-end task; cheap value fixtures sampled once from a reference implementation where there is one. Keep Acceptance to what a user of the feature would notice. **Numeric parity gates** (pixel thresholds, repeats, several engines) only under `--parity` / `proof: parity` or when the brief states a number — and then planned to run once per phase (iteration inside the phase uses the quick look), never loosened.
47
+ 6. **Proportional safety.** When the spec requires a safety outcome (nothing unfinished reaches the user's folders, the app keeps working between tasks), pick the cheapest mechanism that achieves it — normally a feature branch, a build output the user's folders do not read, and one copy across at the end after the live check. Version control is the archive. Add staged promotions, per-step archives or hash records only if the brief asks for them by name.
48
+ 7. **No ceremony.** No standalone "verification sweep / open the review / final check" tasks, and no ledgers, md5 or environment records, archives, checked-in capture trees, standing evidence suites, doc-integrity registration or staged promotions — unless the brief asks.
49
+ 8. **No brittle pins.** Never pin counts later tasks will change (tests passed, suite sizes, hashes). Say "the named tests pass, no new failures versus the baseline".
196
50
 
197
- 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 10 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.
51
+ ## Step 3. Write the plan
198
52
 
199
- Finish with `💾 [bt-plan] Plan finalized — _specs/<feature-name>_plan.md (<n> tasks, <k> decisions)`, then report the number of tasks and decisions, the estimated execution time, 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.
53
+ Print `✍️ [bt-plan] Writing _specs/<feature-name>_plan.md …`. The file has, in order:
200
54
 
201
- ---
202
-
203
- ## Subagents — invoking this skill IS the request
204
-
205
- 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.
206
-
207
- Downgrading is not a neutral choice. It removes the one property that makes the step worth running: independence. A verifier that is the same context which just wrote the code cannot adversarially check it — it re-confirms its own reasoning and reports PASS.
208
-
209
- The ONE legitimate reason to run inline is that you genuinely have **no** subagent-spawning tool. Check the tools you actually have — Claude Code exposes it as **`Agent`** (older builds name it `Task`); other hosts have their own equivalent. Never call a subagent tool you do not have. Use the exact fan-out / inline status strings this skill specifies for the *path-chosen* line (the progress-narration lines below carry a fixed prefix but free wording), and if you do run inline, state plainly that no subagent tool was available, never a policy.
210
-
211
- ## ⚠️ Progress narration — NEVER go silent
212
-
213
- The user is watching a terminal, not your reasoning. Research and analysis in this skill routinely take several minutes, and **a silent span of more than about 30 seconds is indistinguishable from a hang or a crash** — users cancel runs on exactly that basis, throwing away all the work done so far. Silence is therefore a failure of this skill, not a neutral default. Narrate continuously, in short one-line status updates, from the first action to the final summary.
214
-
215
- **Hard rules:**
216
-
217
- 1. **Announce before every long action.** Before any tool call that can take more than a few seconds — fetching the Agent Reference, reading `SPEC.md` / `DESIGN.md` / a sibling skill, launching subagents, a broad search — emit one visible line saying what you are about to do and why. Example: `🔎 [bt-plan] Reading SPEC.md and DESIGN.md to find the sections this feature must conform to …`
218
- 2. **Report after every result.** After each tool result, emit one line stating what you learned and what comes next, *before* the next tool call. The text between tool calls IS the progress display; a run of back-to-back tool calls with no text between them is a silent run.
219
- 3. **Subagents get a line each, going out and coming back.** When fanning out, print one line per subagent naming what it is investigating (`🚀 [bt-plan] Subagent 1/3 → mapping project structure, build + dependencies`). Prefer the host's background / non-blocking launch mode where it exists (Claude Code's `Agent` with `run_in_background: true`), so each completion returns control to you and you can report it: `✅ [bt-plan] Subagent 1/3 done — <one-line finding>`. Never block on all subagents in silence and then report them together.
220
- 4. **Waiting is also something to say.** If you are waiting on subagents with nothing else to do, say so once, naming what is still outstanding: `⏳ [bt-plan] Waiting on 2/3 research subagents (conventions to mirror, integration points) — typically 1–3 minutes …`. One line per wait, not repeated spam.
221
- 5. **Mark the phase transitions.** Emit a line when research starts, when it completes, and when drafting begins — e.g. `🧩 [bt-plan] Research complete — <n> findings synthesized` followed by a **3–6 bullet research summary** (the key findings, with file paths) so the user can see what the run is based on, then `✍️ [bt-plan] Drafting the document …`.
222
- 6. **Keep the lines short and uniform.** Format: `<emoji> [bt-plan] <what> — <detail>`. One line each. The prefix and emoji are fixed; the `<what>` / `<detail>` wording is yours. Do not dump findings, file contents, or tool output as progress — a status line says what happened, the document holds the detail.
223
- 7. **A silent gap may never span more than a single tool call.** If one tool call is itself long (a subagent, a large fetch), the line *preceding* it must say what it is and roughly how long it is expected to take.
224
-
225
- This applies to every phase of this skill — the Agent Reference fetch, `SPEC.md`/`DESIGN.md` reads, the fan-out research, sibling-skill reads, interviewing, and drafting. When in doubt, say what you are doing.
226
-
227
- ## ⚠️ Required Reading Before Any Babylon Work
228
-
229
- For any task involving Babylon, BabylonJS, or the Babylon Toolkit, first ensure you have already fetched and read the Babylon Toolkit Agent Reference in the current remembered session/context:
230
-
231
- https://raw.githubusercontent.com/babylontoolkit/agent/main/reference.md
232
-
233
- If you have not read it in this session/context, or you no longer remember it due to context loss/compaction, fetch and read it before scaffolding or writing code.
234
-
235
- Do not refetch the Agent Reference repeatedly during the same remembered session/context, including across spec, plan, and execute phases, if you are still aware of its contents.
236
-
237
- Treat the Agent Reference as the authority for conventions, API, and patterns. It routes to deeper docs. Fetch linked subpages only when they are relevant to the task, and do not refetch a subpage in the same remembered session/context unless you no longer remember it.
238
-
239
- If a required fetch fails, STOP and tell me. Do not guess at the API.
240
-
241
- ---
242
-
243
- ## Planning mode — do not implement
244
-
245
- This command runs in PLANNING MODE. Research read-only and produce ONLY the technical plan document. Do NOT implement the feature, edit any existing application/source files, or run build, test, or other shell commands. The only file you may create is the plan markdown in `_specs/`, named `<feature-name>_plan.md`.
246
-
247
- **This applies identically in Quick Plan mode.** Planning and execution are deliberately separate skills: `bt-plan` writes the plan, `bt-execute` runs it — one task at a time, with a clean context between tasks, at the user's discretion. Rolling straight from planning into implementation defeats the entire purpose of that split. Writing the plan file is the LAST action of this skill in every mode.
248
-
249
- ## Step 0. Confirm planning mode
250
-
251
- A trustworthy plan requires a thorough, read-only investigation of the codebase before any plan is written.
252
-
253
- - This skill is intended to run as a read-only planning pass. If you have been invoked in a mode that would modify source, begin your response with a short visible warning that you will only produce the plan document, then continue.
254
- - Either way, you MUST still perform the comprehensive analysis in Step 1 with full rigor. Never skip it.
255
-
256
- ## Step 1. Comprehensive project analysis (REQUIRED before any plan)
257
-
258
- This analysis can be **fanned out**. First check whether you actually have a subagent-spawning tool, and **emit one visible status line** so the user can see the path chosen — either `🔀 [bt-plan] subagent tool detected — fanning out analysis to N read-only subagents` or `➡️ [bt-plan] no subagent tool — analyzing sequentially`. If a subagent-spawning tool is available to you (e.g. Claude Code's `Agent`, Lovable's subagent tool, or your host's equivalent — check the tools you actually have; if there is none, or you are unsure, do the analysis yourself sequentially), launch up to 3 parallel **read-only** exploration subagents and divide the eight investigation points below among them (for example: one maps structure/build and dependencies; one extracts the real conventions and the closest existing feature to mirror; one lists integration points and constraints). Each subagent returns concise conclusions — findings and file paths, not file dumps — which you synthesize into the `## Codebase Analysis` section. Exploration subagents need not re-read the Agent Reference. Never call a subagent tool you do not actually have.
259
-
260
- **Narrate the whole step** (see *Progress narration — NEVER go silent* above). This is the step that most often runs for minutes, so it is where the rule matters most. The required cadence:
261
-
262
- - One `🚀 [bt-plan] Subagent i/N → <what it investigates>` line per subagent as it is launched, and prefer the background / non-blocking launch mode so completions return to you one at a time.
263
- - One `✅ [bt-plan] Subagent i/N done — <one-line finding>` line as each returns; a `⏳ [bt-plan] Waiting on …` line if you are idle with subagents still outstanding.
264
- - On the sequential path, one `🔎 [bt-plan] …` line before each read/search (each of the eight investigation points below) and one result line after it.
265
- - When everything is in: `🧩 [bt-plan] Analysis complete — <n> findings synthesized`, followed by a 3–6 bullet analysis summary (key findings with file paths), before moving on to the interview (Quick Plan) or Step 2.
55
+ **`## Codebase Analysis`** — what Step 1 found, citing real files; the SPEC.md sections the plan conforms to; `spec_impact`, `size`, `proof` (say which were inferred); Quick Plan assumptions.
266
56
 
267
- Before writing a single implementation step, investigate the actual codebase read-only. This is mandatory — do NOT generate any plan content until this analysis is complete. Read and search the repo to discover, not assume:
268
-
269
- 1. Read the referenced feature spec in full (from `_specs/` or the file named in `arguments`), **and read the project `SPEC.md` at the repository root in full.** SPEC.md is the source of truth for the durable architecture, systems, conventions, and decisions — the plan MUST conform to it. Note the feature spec's `spec_impact` field and its `Project Spec Alignment` section. **In Quick Plan mode there is no feature spec file** — treat the brief as the feature request, still read root `SPEC.md` in full, and *infer* the `spec_impact` and Project Spec Alignment from the analysis per the Quick Plan defaults table. If the plan you are about to write would conflict with SPEC.md (contradict a decision, cross a system boundary, break a convention), STOP and flag the conflict to the user before writing the plan; do not silently override the project spec.
270
- 2. Map the project: top-level structure, entry points, how the app is built and run (build scripts, test runner, package manifests).
271
- 3. Identify the conventions actually used in this repo: naming, file/folder organization, state management, styling, error handling, testing patterns.
272
- 4. Find the closest existing feature(s) or modules to the one being planned and study how they are implemented — the plan should follow these patterns.
273
- 5. List the concrete integration points the feature will touch: files, modules, APIs, data models, routes, config.
274
- 6. Note relevant dependencies already available (and their versions) versus anything new that would be required.
275
- 7. Capture any constraints from the project's agent instructions (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md) and the feature spec.
276
- 8. If the feature builds on a **sibling-skill pattern** (e.g. bt-design's 3D-Hero-Scroll), read that sub-skill's reference **and its templates**. *(How to read one: where skills are loaded with a tool — the Babylon Toolkit App Builder platform — call `load_skill('<name>')`, then fetch its references and templates with `read_skill_resource` using the paths the load returns, never a guessed path. Where skills are files on disk — Claude Code — read them from the same skills directory, `~/.claude/skills/` or the project's `.claude/skills/`. Skip the load for anything already in your context.)* The plan MUST **copy and configure the sub-skill's template engine — never re-implement it from memory**; re-implementation is exactly how documented behaviors (`sweep`, veiled cuts, the preload gate, HUD auto-hide, graceful degradation) silently get dropped. Turn every behavioral-config requirement the spec records (e.g. `sweep: page`) into a concrete task whose Acceptance asserts that behavior in observable terms.
277
-
278
- If the spec or codebase is too ambiguous to analyze responsibly, stop and ask the user rather than guessing.
279
-
280
- *(In Heavy Plan mode, also apply the **Step 1 additions** listed under *Heavy Plan mode* above.)*
281
-
282
- ## Size the plan to the feature (all modes)
283
-
284
- Execution cost is paid **per verification unit**, not per line of code: every phase bt-execute runs costs an implementer pass plus a fresh independent verifier. A plan that splits a one-hour feature into eight micro-tasks, adds bookkeeping tasks, and asks for live Unity/browser QA on each one turns an hour of work into a day. Rigor comes from good Acceptance, named tests and an independent verifier — not from the number of tasks. So:
285
-
286
- 1. **Read the size.** Take `size: small | medium | large` from the feature spec header. In Quick Plan mode (or for an older spec without it), infer it: **small** ≈ something a developer would do by hand in about 1–2 hours, touching one system; **medium** ≈ a day, a few systems; **large** ≈ multi-day, multi-system, or Unity/Blender/export pipeline work. Record it in Codebase Analysis.
287
- 2. **Task budget.** small → **1–3 tasks**; medium → **3–8**; large → as many as the work needs. Going over the budget needs a one-line reason in Codebase Analysis.
288
- 3. **A task is a meaningful unit of work** — a coherent change a developer would commit on its own, with its own tests. Merge tasks that edit the same file for the same purpose, or that cannot be tested apart (adding a constant and the code that uses it is ONE task). Split only when a task would not fit in one sitting.
289
- 4. **No ceremony tasks.** Do not write standalone "verification sweep", "confirm all callers", "open the review / ledger / baseline / archive" or "final check" tasks unless the brief asks for them. A read-and-confirm check belongs in the **Acceptance** of the task that made the change; the final end-to-end check belongs in the last phase's last task.
290
- 5. **Phases.** Group tasks under `### Phase N — <name>` headings inside `## Tasks`. bt-execute runs one independent verifier per phase, so a phase is "what should be checked together": a small plan is **one phase**; otherwise phases of 2–4 related tasks, ending where a checkpoint is natural (a working intermediate state, a UI becoming visible, the SPEC.md write-back).
291
- 6. **`Verify level` per task.** `standard` (default — build/typecheck, the named tests, diff review) or `live` (needs the dev server, a browser, or Unity/Blender to observe). Mark `live` whenever the task's Acceptance depends on runtime behavior — rendering, visuals, interaction, Unity↔Babylon parity; bt-execute runs live QA on such tasks even if unmarked. Whatever the per-task levels, the **last feature task** (before the SPEC.md write-back) carries one `live` **end-to-end check** of the whole feature when the feature has a rendered, exported or interactive surface — that is where "loaded in the browser, screenshotted, console clean" is verified, once.
292
- 7. **No brittle pins.** Never pin absolute counts that later tasks will change — total tests passed, suite sizes, ledger figures, file hashes of files later tasks edit. Say "the named tests pass and there are no new failures versus the baseline" instead. A pin that goes stale makes a correct task FAIL and costs a whole fix-loop round.
293
- 8. **Named tests, not exhaustive ones.** Each task with a testable surface names its test cases with expected outcomes. Cover the Acceptance and the edge cases the spec lists; do not ask for probe suites, fuzzing or mutation testing unless the feature's risk genuinely calls for it (say why).
294
-
295
- ## Step 2. Write the plan
296
-
297
- > **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.
298
-
299
- 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.
300
-
301
- 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.
302
-
303
- Then write the implementation as an ordered checklist of tasks, sized and grouped per *Size the plan to the feature* above. Use GitHub-style checkboxes so progress can be tracked directly in the file — one task per line, numbered T1, T2, T3 … in dependency order, grouped under phase headings:
57
+ **`## Tasks`**
304
58
 
305
59
  ```markdown
306
- ## Tasks
307
-
308
60
  ### Phase 1 — <name>
309
61
 
310
- - [ ] **T1** — <short task title>
311
- - Files: `path/one`, `path/two`
62
+ - [ ] **T1** — <short imperative title>
63
+ - Files: `path/one` (create), `path/two` (modify)
312
64
  - Details: <what to do>
313
- - Tests: <test file> — `<case>` → <expected outcome>; … (or "no testable surface — <why>")
314
- - Acceptance: <how to know it is done — observable, no absolute count pins>
65
+ - Tests: `<test file>` — `<case>` → <expected outcome>; … (or "no testable surface — <why>")
66
+ - Acceptance: <observable, checkable statements>
315
67
  - Verify level: standard
316
- - [ ] **T2** — <short task title>
317
- - Files: `...`
318
- - Details: <...>
319
- - Tests: <...>
320
- - Acceptance: <...; includes the end-to-end check of the whole feature if this is the last feature task>
321
- - Verify level: live
322
68
  ```
323
69
 
324
- When a task implements a **sibling-skill pattern**, its **Acceptance** must assert the skill-defined behavior in observable terms — e.g. for `sweep: page`, "PLAY auto-scrolls through to the document bottom and END jumps there", not merely "the hero renders". A plausible-looking result that dropped a documented behavior must fail acceptance. Prefer copying the sub-skill's template files as an early task (e.g. "T1 — copy + wire the 3D-Hero-Scroll engine") so later tasks only configure it.
325
-
326
- ### SPEC.md write-back task (required when the feature is spec-impacting)
327
-
328
- If the feature is spec-impacting (`spec_impact: yes`, or your analysis found it adds/changes a system, convention, dependency, or architectural decision), the plan MUST end with an explicit final task that updates the project spec, so the write-back is tracked and independently verified like any other task — never left as a soft afterthought:
70
+ **`Update SPEC.md` — the last task, when the feature is spec-impacting** — `spec_impact: yes`, or your analysis found it adds or changes a system, convention, dependency or architectural decision (otherwise state in Codebase Analysis that none is needed):
329
71
 
330
72
  ```markdown
331
73
  - [ ] **T<n>** — Update SPEC.md to match what was built
332
74
  - Files: `SPEC.md`
333
- - Details: Update the specific SPEC.md section(s) named in the feature spec's Project Spec Alignment — e.g. add/modify the affected Game System, record the new Convention or Decision (with rationale), and add any new Dependency + version. Follow SPEC.md's "How to update this spec" contract: **replace/merge** the current-state sections (Architecture, Game Systems, Conventions, Dependencies) — removing seed placeholders on first real content — and **append** to the Decisions log (never delete; supersede with a newer entry).
334
- - Acceptance: SPEC.md accurately describes the architecture/systems/conventions/dependencies as actually implemented by the tasks above; no section contradicts the shipped code; new dependencies are listed.
75
+ - Details: Update the sections named in the spec's Project Spec Alignment, following SPEC.md's "How to update this spec" (replace/merge current-state sections; append Decisions). Record the product only — never verification procedure, tool lists, ledgers or gates.
76
+ - Acceptance: SPEC.md matches what the tasks above shipped; new dependencies listed; nothing contradicts the code.
335
77
  - Verify level: standard
336
78
  ```
337
79
 
338
- Make this the LAST task so it captures the true final state. If the feature is genuinely not spec-impacting (`spec_impact: no`), omit this task, but state in the Codebase Analysis that no SPEC.md change is required.
80
+ **`## Estimated execution time`** — **agent time, computed from the measured rates below — never from how long a developer would take.** An agent writes a 500-line module with its tests in about ten minutes; what costs time is running things. Count, per phase:
339
81
 
340
- ### Estimated execution time (required, all modes)
341
-
342
- Directly **before** `## How to execute this plan`, write a `## Estimated execution time` section so the user knows up front whether this is hours or days of agent time. Estimate bt-execute's wall-clock time per phase, from what the phase actually does, using these calibration rates (Standard mode, one implementer + one independent verifier per phase):
343
-
344
- | Phase contents | Per phase |
82
+ | What the phase contains | Measured agent time |
345
83
  | --- | --- |
346
- | Code + Node/unit tests only | 15–25 min |
347
- | Adds a C#/native build, DLL rebuild or a full test chain | 30–45 min |
348
- | Adds Unity authoring / bake / export, or browser read-backs and screenshots | 45–90 min |
349
- | Visual / parity "fix until green" loop | 1–3 h |
84
+ | each code + unit-test task (any language) | 5–10 min |
85
+ | each task that also rebuilds a native/C# library or runs a full test chain — once per task, however many builds it runs | + 10–20 min |
86
+ | each Unity / Blender **Editor operation** — one authoring pass, one bake, one export, one capture (count a job that authors dozens of objects as 2–3) | + 15–30 min |
87
+ | each live look — one **scene × engine page session**, not one screenshot; a build that exists only to serve a look is already inside this rate | + 10–20 min |
88
+ | a visual "adjust until it looks right" loop — only where the plan says it expects to iterate on a picture | + 45–90 min |
89
+ | the phase's independent verifier (counts under Prove) | + 5–10 min |
350
90
 
351
- Write a small table (`Phase | Tasks | What makes it slow | Estimate`), then one **Total** line as a range in hours (and days if over ~16 h), including a 20–40 % allowance for fix loops, e.g. `**Total: ~5–8 h of unattended agent time (Standard mode); ~2–3× that with --strict.**` Name the single biggest uncertainty in one line. This is an estimate, not a pin: bt-execute never verifies against it.
91
+ Write a table `Phase | Tasks | Build | Prove | Estimate` (Build = code and tests; Prove = exports, captures, looks, adjust-until-right), then one **Total** = the sum plus 20–40 % for fix loops, in hours (days only if over ~16 h), the `--strict` multiplier (~2–3×), what would cut Prove if it exceeds Build, and the biggest uncertainty. If the total exceeds ~1 h per task, re-check it against the table. Usual causes: developer-hours thinking in the Build column; ceremony the brief did not ask for; or per-task captures that rule 5 says to batch. If the cost is load-bearing work the brief *did* ask for, say so in one line and keep the number. An estimate, never a pin.
352
92
 
353
- Finally, include this exact `## How to execute this plan` section verbatim in the document so the plan is self-describing no matter how it is later run:
93
+ **`## How to execute this plan`** — this text verbatim:
354
94
 
355
95
  ```markdown
356
96
  ## How to execute this plan
@@ -362,3 +102,24 @@ Each task above is a checkbox. To implement:
362
102
  - When a task is fully implemented and its **Acceptance** criteria are met, mark it complete by editing this file and changing that task's `- [ ]` to `- [x]`.
363
103
  - Stop and report if a task cannot be completed. Do NOT check a box for partial, skipped, or unverified work.
364
104
  ```
105
+
106
+ Then **stop**. Final message: a short summary, the estimated time, and:
107
+
108
+ ```
109
+ Plan written to _specs/<feature-name>_plan.md — <n> tasks, estimated <total range> of agent time
110
+ Run a single task with `bt-execute _specs/<feature-name>_plan.md T1`, or every task with `bt-execute _specs/<feature-name>_plan.md ALL` (add `--strict` for an adversarial verifier on every task).
111
+ ```
112
+
113
+ ## Heavy Plan mode (`--heavy`)
114
+
115
+ Use when the plan will be executed in fresh contexts, over days, or by a cheaper model than the one planning. The plan file is then the only memory that survives between tasks: **whatever it does not say, task 40 will re-decide differently from task 3.** So a heavy plan decides everything once, in one place, and every task cites it. Print `🏋️ [bt-plan] Heavy Plan mode`. Everything above still applies; the document gains two sections and richer task blocks. There is no limit on how much a heavy plan may say — write what the executor needs — but the number of tasks still follows the spec's `size`.
116
+
117
+ In Step 1, collect plan-grade detail: `file:line` references, the real signatures the feature calls or changes, verbatim 10–30-line snippets of the conventions to mirror, the exact API usage from the Agent Reference sub-documents, and the test baseline (command, current state, pre-existing failures). Carry the spec's Decisions forward and resolve every Open Question — with the user if needed. "TBD", "as appropriate", "the implementer may choose" are forbidden.
118
+
119
+ Sections, in order: `## Codebase Analysis` (plus the test baseline) · **`## Decisions`** · **`## Design Reference`** · `## Tasks` · `## Estimated execution time` · `## How to execute this plan`.
120
+
121
+ - **`## Decisions`** — numbered `D1, D2 …`, one per choice that binds more than one task or rejects a plausible alternative — architecture, file layout, naming, algorithms and constants, error policy, dependencies (exact packages and versions, or "no new dependencies"), sibling-skill option values, test strategy:
122
+ `- **D3 — <decision, stated as a fact>.** <why / precedent with file:line> Rejected: <alternative> (<why not>). Binds: T4, T7.`
123
+ - **`## Design Reference`** — the shared blueprint, written as code wherever the code *is* the decision: File map (path · create/modify/delete · responsibility · tasks) · Module boundaries · Interfaces & contracts (full signatures, in the project's language) · Data shapes & state · Control flow · Algorithms & formulas with their constants · Error & edge-case policy (`when X → Y`) · Conventions to mirror (verbatim, with `file:line`) · API usage · Test strategy. Omit a heading only if it truly does not apply.
124
+ - **Heavy task block** — adds to the standard block: `Depends on:` · `Applies:` (the D-numbers and Design Reference entries it must match) · `Steps:` numbered instructions, each naming the file, a real anchor (prefer quoted code over bare line numbers) and the change · `Code:` when the code is the decision · `Do not:` the tempting wrong turns · `Verify:` commands with expected output. `Depends on`, `Files`, `Applies`, `Steps`, `Tests`, `Acceptance`, `Verify` and `Verify level` are required on every heavy task. A task never says "like T3" — it cites the Design Reference; a name, signature or value a step introduces is added to the Design Reference first, so task 40 types what task 3 typed. Say what keeps the app working between tasks (shim, flag) and which task removes it. The `Update SPEC.md` task carries the exact text to write.
125
+ - **Cold-context audit (one pass).** After the draft, launch one fresh read-only subagent (or re-read it yourself) with: *"You have never seen this repo. For every task, check the plan against the real files and list each point where you would have to decide, guess or look something up: a missing signature, name, value or anchor; an anchor that does not match the file; a goal stated instead of an instruction; a dependence on remembering an earlier task; a name used in a task but not defined in the Design Reference; a test without an expected outcome; a Verify without an expected output; vague words ("appropriate", "as needed", "etc."); a task that would not fit in one sitting; an edge case with no decided behavior; an API call not shown. Also flag micro-tasks to merge, ceremony tasks nobody asked for, and pinned counts later tasks will change. Report `T<n> · step · what is missing`. Change nothing."* Fix every gap in the plan, ask the user what only they can answer, list any gap you chose not to resolve (with why) in Codebase Analysis, then finalize: `💾 [bt-plan] Plan finalized — <n> tasks, <k> decisions`, and report the two or three most consequential decisions and anything left unresolved.