@babylonjs-toolkit/agent 1.1.58 → 1.1.61

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
@@ -1,4 +1,4 @@
1
- # Babylon Toolkit Desktop Agent (1.1.58)
1
+ # Babylon Toolkit Desktop Agent (1.1.61)
2
2
 
3
3
  The desktop agent owns the entire pipeline end to end — frontend and UI design, gameplay code, shaders, generated art and audio, 3D models in headless Blender, whole game levels and prefabs in a terminal-driven Unity Editor, the interactive glTF export, the web build, the dev server, and visual QA by screenshotting both Unity and the running browser.
4
4
 
@@ -270,7 +270,7 @@ start without a spec:
270
270
  documents/<slug>_plan.md the plan (bt-plan)
271
271
  documents/<slug>_autopilot.md the run log (bt-execute)
272
272
  documents/<slug>_dashboard.js the dashboard's data, updated task by task
273
- documents/<slug>_live.js what is happening this minute, updated step by step
273
+ documents/<slug>_live.js what is happening this minute, updated step by step (git-ignored)
274
274
  snapshots/ meaningful snapshots of the build
275
275
  tests/ every test the plan's tasks write
276
276
  ```
@@ -283,7 +283,10 @@ minutes), and each task's result appears the moment it is built. An open tab kee
283
283
  re-reads its data in the background (every 10 s during a run, every 30 s otherwise) and refreshes
284
284
  only when something changed — a task result, a finished run, the next run starting, or a plan
285
285
  reopened because you added a task after it was complete (the dashboard drops back to *paused* and
286
- the After Action Report is revised when the new work is done). Phase by phase and task by task it shows what was actually done, files, tests,
286
+ the After Action Report is revised when the new work is done). A watchdog runs alongside every run:
287
+ when an agent has written nothing for 10 minutes it writes a heartbeat naming the latest file the work
288
+ changed (or warns that the run may be stalled), and it corrects a status that still names a finished
289
+ task — so the dashboard never sits silent or wrong while a long task is running. Phase by phase and task by task it shows what was actually done, files, tests,
287
290
  verifier verdicts, attempts, commits, decisions, deferrals and follow-ups. The snapshots tell the
288
291
  story of the build: **progressions** captured from the same camera each time a meaningful layer
289
292
  lands (a terrain: heightmap → textures → roads → trees → foliage → lighting), played back as a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs-toolkit/agent",
3
- "version": "1.1.58",
3
+ "version": "1.1.61",
4
4
  "description": "Installs the Babylon Toolkit Desktop Agent for Claude Code, Codex, GitHub Copilot, Gemini CLI and Antigravity.",
5
5
  "keywords": [
6
6
  "babylonjs",
@@ -33,6 +33,7 @@ Run tasks from a plan: build each one with its tests, have an independent verifi
33
33
 
34
34
  - **TIME MATTERS** — on by default; `--no-time-limit` turns it off. Treat the arguments as ending with `TIME MATTERS`: the user is waiting on this run, so finish quickly — follow the *Work fast* rules below to the letter, take the direct route to each task's Acceptance, and do not re-read what you already have. Begin every implementer and verifier prompt with `TIME MATTERS.` Print `⏱️ [bt-execute] TIME MATTERS` at the start (`--no-time-limit`: print `⏱️ [bt-execute] No time limit`, and do not add it). Speed never relaxes tests, the independent verifier, live checks, or "tick only on PASS".
35
35
  - **Scope.** Implement only the selected task(s). No "while I'm here" work on other tasks. Ambiguous, or blocked by an unfinished task → stop and tell the user *(auto-pilot: decide and log it)*.
36
+ - **Open the run before anything else.** The first actions of every run — before fetching docs, reading code, checking the repo or any other pre-flight work — are, in order: take the clock; append the `⏱ Run <n> start` line to the run log; sync the dashboard with the plan and set `status: "in-progress"` (*Run start* under *Feature folder and dashboard*); write the live file (`role: "orchestrator"`, `title: "Starting run <n> — <what you are checking first>"`); and launch the watchdog in the background (*Never let the dashboard go stale*). From then on the pre-flight work is narrated in the live file like any other step. Until the run is opened the dashboard still shows the last run's end state — a user who restarts a run and refreshes must see it running within a minute, not after the pre-flight is over.
36
37
  - **Read the docs once.** For Babylon work, if you have not read the Agent Reference this session, fetch it once — https://raw.githubusercontent.com/babylontoolkit/agent/main/reference.md — plus only the sub-documents the plan's tasks need. It is the authority for conventions and API. Fetch fails → stop and tell the user *(auto-pilot: retry 3×, then continue on what you know and log it)*. Read the plan's checklist and the parts of `SPEC.md` the tasks touch; re-read after a context compaction.
37
38
  - **SPEC.md** constrains how you build. If the code and SPEC.md disagree, stop and tell the user *(auto-pilot: decide which is right, fix SPEC.md in the same task, log it)*. When a task changes architecture, a system, a convention or a dependency, SPEC.md must end up matching — normally the plan's final `Update SPEC.md` task; if the plan has none, do it anyway; a new dependency is recorded in SPEC.md by the task that introduces it. Follow SPEC.md's "How to update this spec". **Write the product, never the procedure** — no capture protocols, tool lists, ledgers or gates: recorded there, they become a bar every later feature must clear.
38
39
  - **Say what you are doing** — one short line at each task and phase boundary, and before anything slow.
@@ -79,21 +80,27 @@ Every feature lives in one folder, created by bt-spec (or by bt-plan for a Quick
79
80
 
80
81
  `<slug>` is the folder name (the plan sits at `<slug>/documents/<slug>_plan.md`). **Legacy flat plan** (`.agents/specs/<slug>_plan.md`): run it where it is, keep its run log and the test paths its `Tests:` lines name, and still create `.agents/specs/<slug>/` for `dashboard.html`, `documents/<slug>_dashboard.js`, `documents/<slug>_live.js` and `snapshots/` — move nothing unless the user asks.
81
82
 
82
- **The dashboard.** `dashboard.html` is a fixed template; `documents/<slug>_dashboard.js` holds everything it shows. Both come from this skill's `templates/dashboard/` *(where skills load through a tool: `load_skill` + `read_skill_resource`; where they are files: the skills directory this skill was loaded from)*: `dashboard.html` copied with `{{slug}}` replaced — never otherwise edited — and `dashboard.template.js`, whose header comment is the data schema. bt-plan writes both in the `planned` state; if either is missing, create it now from the plan. A third file, `documents/<slug>_live.js` (from `live.template.js`), carries what is happening this minute.
83
+ **The dashboard.** `dashboard.html` is a fixed template; `documents/<slug>_dashboard.js` holds everything it shows. Both come from this skill's `templates/dashboard/` *(where skills load through a tool: `load_skill` + `read_skill_resource`; where they are files: the skills directory this skill was loaded from)*: `dashboard.html` copied with `{{slug}}` replaced — never otherwise edited — and the starter data `dashboard.template.js`. A third file, `documents/<slug>_live.js` (from `live.template.js`), carries what is happening this minute. **`data-schema.md` documents every field and the update recipe — read it once per run and put the parts a role writes into its brief.** bt-plan writes all three in the `planned` state; if any is missing, create it now from the plan.
83
84
 
84
- **Update per task, not per phase — the user watches this page instead of asking "what are you doing?"** Whoever is doing the work writes: the implementer while it builds, the verifier while it checks, you (the orchestrator) between them. Only one agent works at a time in this loop, so writes never collide; if you ever run subagents in parallel, they report back and you write. Every implementer and verifier brief carries the three paths and these rules. Every timestamp comes from the shell clock.
85
+ **Update per task, not per phase — the user watches this page instead of asking "what are you doing?"** Whoever is doing the work writes: the implementer while it builds, the verifier while it checks, you (the orchestrator) between them. Only one agent works at a time in this loop, so writes never collide; if you ever run subagents in parallel, they report back and you write. Every implementer and verifier brief carries the helper's exact command lines with the paths filled in, and these rules. Every timestamp comes from the local clock (the helper takes it for you).
86
+
87
+ **Never let the dashboard go stale — three guards, because an agent deep in a long task forgets to write:**
88
+
89
+ 1. **The watchdog.** At run start, launch `node <skills>/bt-execute/scripts/dashboard.mjs watch <feature-folder> --watch <your scratch folder>` in the background (add `--watch` for any other folder where the work leaves files — exports, logs, captures). Every minute it checks the live file: after 10 quiet minutes it writes a heartbeat naming the latest file that changed ("still working — latest activity: t19/gp3.log at 21:48"); after 30 minutes with no file change either it says the run may be stalled; and if the live file still names a finished task while another is in progress, it points it at the active task. It exits by itself when the status leaves `in-progress`. A heartbeat is a safety net, not a substitute — the agents' own writes say what is actually happening.
90
+ 2. **Hand-off writes.** Before you launch any implementer or verifier, set its task(s) `in-progress` (implementer) or `verifying` (verifier) and point the live file at it (`--task T19 --role implementer --activity "Implementer started on T19 — <its first step>" --reset`); when it returns, write what it reported. The live file must never still name the previous task while a new one is being worked on.
91
+ 3. **Long commands are narrated.** Before any command that may run more than a few minutes (a full test chain, an export or bake, a multi-race or multi-scene browser run), write a step saying what it is and roughly how long it takes; run it in the background where the host allows, and write a step at each milestone its output shows ("race 2 of 4 reached results"). A long run is exactly when the user is watching.
85
92
 
86
93
  - **The live file — at every meaningful step.** Rewrite `documents/<slug>_live.js` whole (it is small) when a task starts, at each milestone inside it, before anything slow (a build, an export, a bake, a capture, a test run), at each fix attempt, at the hand-over to the verifier and while it checks each task, and at the commit: the phase, the task, the role, one plain-language sentence on what is happening now, and the task's step log. Never let it go 15 minutes without a write during active work — the page flags a 20-minute silence. Between tasks, `task: ""` and a `title` (`Verifying phase 2`, `Committing phase 2`).
87
94
  - **The dashboard data — at every task boundary:** a task becomes `in-progress` when it starts; `built` the moment it is built and its tests are green — with its summary of what was actually done (and anything surprising), files, tests and snapshots filled in **right then**, not at the phase end; `verifying` while the verifier checks it; `done` when it passes (verifier result, attempts, commit, done time, its `DECISION` lines); back to `in-progress` with `attempts` + 1 on a FAIL. Each change also adds an `activity` line and refreshes `updatedAt`.
88
- - **Valid JavaScript, always.** Both files are loaded as scripts — one bad comma blanks the page. After every write, run `node --check <file>` where Node is available and fix it at once.
95
+ - **Every write goes through this skill's `scripts/dashboard.mjs` — never hand-edited.** Each data file is one `window.… =` prefix and one strict-JSON value (the prefix only lets a page opened from disk load it); the helper parses it, changes it, checks the shapes and writes it back atomically, so the page never sees a half-written or malformed file. Use it, not a one-off script of your own: `node <skills>/bt-execute/scripts/dashboard.mjs live <feature-folder> --task T7 --role implementer --activity "…" --step "…"` · `task <feature-folder> T7 --set '{"status":"built","summary":"…"}'` · `activity <feature-folder> "…"` · `status <feature-folder> in-progress` · `check <feature-folder>` (all options in the script's header). Only where Node cannot run, fall back to the parse-and-write-back recipe in `data-schema.md`. Keep each field its documented shape too — a list stays a list (`updates`, `snapshots`, `files`, `decisions`, `notes` …: append, never assign a string); a helper script you give subagents checks the shapes before it writes.
89
96
 
90
97
  On top of the per-task updates:
91
98
 
92
- - **Run start:** first **sync the dashboard with the plan file** — re-read its checklist and add any phase or task (including sub-tasks like `T3.1`) the dashboard lacks, in plan order, as `pending`, with an `updates` note on it (`Added to the plan after <the plan was complete / phase 2 ran> — <why, if the plan says>`); a task the plan no longer has is removed with an `activity` line saying so. Then `status: "in-progress"`, `runs` + 1, the run-log document link, an `activity` line, and the first live-file write.
99
+ - **Run start — the first thing the run does** (*Open the run before anything else*): **refresh `dashboard.html`** — copy it again from the template with `{{slug}}` replaced (it is never edited, so this is always safe, and it is how layout fixes reach dashboards created by older versions); then **sync the dashboard with the plan file** — re-read its checklist and add any phase or task (including sub-tasks like `T3.1`) the dashboard lacks, in plan order, as `pending`, with an `updates` note on it (`Added to the plan after <the plan was complete / phase 2 ran> — <why, if the plan says>`); a task the plan no longer has is removed with an `activity` line saying so. Then `status: "in-progress"`, `runs` + 1, the run-log document link, an `activity` line, the first live-file write, and the watchdog launched in the background. In a git repository, check `.gitignore` has `.agents/specs/*/documents/*_live.js` and append it once if not — the live file is never staged or committed; `<slug>_dashboard.js` and `snapshots/` are.
93
100
  - **Each phase, after its ticks and before its commit:** the phase's status, times and minutes (from its `⏱` line), its verifier result and a two-or-three-sentence summary of what it delivered; the phase-level snapshots (a progression spanning several tasks — below); `decisions`; `activeTime`; an `activity` line; and a current "so far" `outcome` headline.
94
101
  - **A deferral:** the task's `status: "deferred"` and `deferredReason`, an `activity` line.
95
102
  - **Run end — the After Action Report.** **decide the status by re-reading the plan file's checkboxes, never from memory:** `complete` when every task in the plan is `- [x]`; `incomplete` when every task is either ticked or marked ⏭️ DEFERRED; otherwise `paused` (the run covered only a slice, or tasks were added). The page refuses a `complete` it can see is false — it shows the plan as paused with a warning — but the plan file is the authority; never leave `in-progress` behind, because the status picks the page's top slot: `in-progress` shows *Current run activity* (the live file and the milestones), any other run-ended status shows the After Action Report in its place. Write `followUps` for a human, and `afterAction` — the whole plan's execution, start to finish: a one-sentence headline of what the plan delivered; two to four paragraphs on what was built, how it was proven and what surprised; highlights; and **one before/after for the plan as a whole** (`comparison`) — the plan-wide "before" frame beside a final "after" taken now from the same camera or viewport (the end-to-end check's session supplies it). Add the plan's key progression to `afterAction.snapshots` if one tells the story better than any single phase. The figures (tasks, tests, retries, time) are computed by the page — never type them in. A run that ends before the plan is finished writes it too; the page marks it *Interim* while `paused`, and the next run revises it with an `updates` entry. **A reopened plan** (tasks added after it was complete) works the same way: the run that finishes the added tasks rewrites the After Action Report to cover them, notes the change in its `updates` (`Revised — T7 added after completion: <why>`), and retakes the plan-wide "after" from the same camera so the comparison shows the plan as it now stands.
96
- - **`--verbose` — the same work, written up in depth.** It changes what is written, never what is done: tests, the verifier, live checks and snapshot captures are exactly as without it, and TIME MATTERS still holds (the extra cost is writing, not checking). Set `detail: "verbose"` at run start. Each task gets a `details` write-up (schema in `dashboard.template.js`), filled in by whoever has the facts, at the same per-task moments as everything else:
103
+ - **`--verbose` — the same work, written up in depth.** It changes what is written, never what is done: tests, the verifier, live checks and snapshot captures are exactly as without it, and TIME MATTERS still holds (the extra cost is writing, not checking). Set `detail: "verbose"` at run start. Each task gets a `details` write-up (fields in `data-schema.md`), filled in by whoever has the facts, at the same per-task moments as everything else:
97
104
  - **the implementer, when the task is built:** `approach` (how it was built, how the pieces fit together, why this way and not the alternatives it weighed); `changes` — every file touched, with what changed in it and why; `testCases` — every named case with its expected and actual result; `problems` — each failed attempt or dead end, with what failed, the root cause and the fix; `notes` for a future maintainer; `timing.build`;
98
105
  - **the verifier, while it checks:** `acceptance` — every Acceptance item with its verdict and the evidence it rests on (command output, the screenshot, the line read); `liveCheck` — what it looked at, on which engine, at what resolution, and how it judged it; `timing.verify`;
99
106
  - **you, at the tick and in the fix loop:** each fix round added to `problems`, `timing.fix`, and snapshot captions that say what to notice, not just what is shown.
@@ -0,0 +1,397 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Feature dashboard helper for bt-execute: the one way agents write a feature's dashboard data, plus the
4
+ * watchdog that keeps the live status honest while an agent is busy with a long task.
5
+ *
6
+ * Every write reads the data file, parses its strict JSON, changes it and writes it back atomically (a temp file
7
+ * renamed over the original), so the page can never load a half-written file and no hand edit can break it.
8
+ *
9
+ * node dashboard.mjs live <feature-folder> --task T19 --role implementer --activity "…" [--phase 7] [--step "…"]… [--reset] [--title "…"]
10
+ * node dashboard.mjs task <feature-folder> <task-id> --set '{"status":"built","summary":"…"}' [--note "why an earlier result changed" --by T21]
11
+ * node dashboard.mjs activity <feature-folder> "Phase 2 verified — T4–T6 PASS"
12
+ * node dashboard.mjs status <feature-folder> in-progress|paused|complete|incomplete
13
+ * node dashboard.mjs check <feature-folder>
14
+ * node dashboard.mjs watch <feature-folder> [--watch <folder>]… [--interval-seconds 60] [--quiet-minutes 10] [--stall-minutes 30] [--max-hours 12]
15
+ *
16
+ * <feature-folder> is .agents/specs/<slug>. Timestamps come from this machine's local clock.
17
+ */
18
+ import { existsSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from 'node:fs';
19
+ import { basename, join, relative } from 'node:path';
20
+
21
+ /** How many entries a task's live step log keeps. */
22
+ const MAXIMUM_LIVE_STEPS = 12;
23
+ /** Folders the watchdog never descends into when looking for signs of work. */
24
+ const IGNORED_FOLDERS = new Set(['node_modules', '.git', 'Library', 'Temp', 'Logs', 'obj', 'dist', 'build', '.cache', 'profile']);
25
+ /** How deep the watchdog looks inside each watched folder. */
26
+ const MAXIMUM_SCAN_DEPTH = 5;
27
+ /** Task fields that are always lists — appended to, never replaced by a string. */
28
+ const TASK_LIST_FIELDS = ['files', 'decisions', 'snapshots', 'updates'];
29
+ /** Task fields that are an object or null. */
30
+ const TASK_OBJECT_FIELDS = ['tests', 'details'];
31
+ /** Statuses that mean a task is being worked on right now. */
32
+ const ACTIVE_TASK_STATUSES = new Set(['in-progress', 'built', 'verifying']);
33
+
34
+ const [command, featureFolder, ...rest] = process.argv.slice(2);
35
+
36
+ /**
37
+ * Reads the paths of a feature folder's two data files.
38
+ * @param {string} folder The feature folder, `.agents/specs/<slug>`.
39
+ * @returns {{ slug: string, dashboardPath: string, livePath: string }}
40
+ */
41
+ function dataPaths(folder) {
42
+ const slug = basename(folder.replace(/[\\/]+$/, ''));
43
+ return {
44
+ slug,
45
+ dashboardPath: join(folder, 'documents', `${slug}_dashboard.js`),
46
+ livePath: join(folder, 'documents', `${slug}_live.js`),
47
+ };
48
+ }
49
+
50
+ /**
51
+ * Parses a data file: one `window.NAME =` prefix followed by a strict-JSON value.
52
+ * @param {string} path The data file.
53
+ * @returns {{ prefix: string, data: any }}
54
+ */
55
+ function readData(path) {
56
+ const text = readFileSync(path, 'utf8');
57
+ const separator = text.indexOf('=');
58
+ if (separator < 0) throw new Error(`${path} has no "window.… =" prefix`);
59
+ const body = text.slice(separator + 1).trim().replace(/;\s*$/, '');
60
+ return { prefix: text.slice(0, separator).trim(), data: JSON.parse(body) };
61
+ }
62
+
63
+ /**
64
+ * Writes a data file atomically: a temp file next to it, then renamed over it.
65
+ * @param {string} path The data file.
66
+ * @param {string} prefix Its `window.NAME` prefix.
67
+ * @param {any} data The value to write.
68
+ */
69
+ function writeData(path, prefix, data) {
70
+ const temporaryPath = `${path}.${process.pid}.tmp`;
71
+ writeFileSync(temporaryPath, `${prefix} = ${JSON.stringify(data, null, 2)};\n`, 'utf8');
72
+ renameSync(temporaryPath, path);
73
+ }
74
+
75
+ /**
76
+ * The local time as the dashboard expects it.
77
+ * @param {Date} [moment] Defaults to now.
78
+ * @returns {{ stamp: string, clock: string }} `YYYY-MM-DD HH:MM` and `HH:MM`.
79
+ */
80
+ function localTime(moment = new Date()) {
81
+ const pad = (value) => String(value).padStart(2, '0');
82
+ const clock = `${pad(moment.getHours())}:${pad(moment.getMinutes())}`;
83
+ return { stamp: `${moment.getFullYear()}-${pad(moment.getMonth() + 1)}-${pad(moment.getDate())} ${clock}`, clock };
84
+ }
85
+
86
+ /**
87
+ * Reads `--name value` options; names listed in `repeatable` collect every occurrence.
88
+ * @param {string[]} argumentList The remaining command-line arguments.
89
+ * @param {string[]} [repeatable] Option names that may appear more than once.
90
+ * @returns {{ options: Record<string, any>, positional: string[] }}
91
+ */
92
+ function parseOptions(argumentList, repeatable = []) {
93
+ const options = Object.fromEntries(repeatable.map((name) => [name, []]));
94
+ const positional = [];
95
+ for (let index = 0; index < argumentList.length; index += 1) {
96
+ const argument = argumentList[index];
97
+ if (!argument.startsWith('--')) {
98
+ positional.push(argument);
99
+ continue;
100
+ }
101
+ const name = argument.slice(2);
102
+ const next = argumentList[index + 1];
103
+ const value = next === undefined || next.startsWith('--') ? true : argumentList[++index];
104
+ if (repeatable.includes(name)) options[name].push(value);
105
+ else options[name] = value;
106
+ }
107
+ return { options, positional };
108
+ }
109
+
110
+ /**
111
+ * Rewrites the live status: what is happening this minute.
112
+ * @param {string} folder The feature folder.
113
+ * @param {string[]} argumentList Command options.
114
+ */
115
+ function writeLive(folder, argumentList) {
116
+ const { options } = parseOptions(argumentList, ['step']);
117
+ const { livePath } = dataPaths(folder);
118
+ const existing = existsSync(livePath) ? readData(livePath) : { prefix: 'window.FEATURE_LIVE', data: {} };
119
+ const live = existing.data;
120
+ const now = localTime();
121
+ const taskChanged = options.task !== undefined && options.task !== live.task;
122
+ const steps = options.reset || taskChanged ? [] : Array.isArray(live.steps) ? live.steps : [];
123
+ for (const step of options.step) steps.push({ at: now.clock, text: String(step) });
124
+ const updated = {
125
+ updatedAt: now.stamp,
126
+ phase: options.phase !== undefined ? Number(options.phase) : live.phase,
127
+ task: options.task !== undefined ? String(options.task) : live.task || '',
128
+ title: options.title !== undefined ? String(options.title) : options.task !== undefined ? '' : live.title || '',
129
+ role: options.role !== undefined ? String(options.role) : live.role || 'orchestrator',
130
+ activity: options.activity !== undefined ? String(options.activity) : live.activity || '',
131
+ steps: steps.slice(-MAXIMUM_LIVE_STEPS),
132
+ source: 'agent',
133
+ };
134
+ writeData(livePath, existing.prefix, updated);
135
+ }
136
+
137
+ /**
138
+ * Finds a task anywhere in the dashboard data.
139
+ * @param {any} dashboard The dashboard data.
140
+ * @param {string} taskId The task id, e.g. `T12.2`.
141
+ * @returns {any | undefined}
142
+ */
143
+ function findTask(dashboard, taskId) {
144
+ for (const phase of dashboard.phases || []) {
145
+ const task = (phase.tasks || []).find((candidate) => candidate.id === taskId);
146
+ if (task) return task;
147
+ }
148
+ return undefined;
149
+ }
150
+
151
+ /**
152
+ * Merges fields into one task, optionally recording why an earlier result changed.
153
+ * @param {string} folder The feature folder.
154
+ * @param {string[]} argumentList The task id and options.
155
+ */
156
+ function writeTask(folder, argumentList) {
157
+ const { options, positional } = parseOptions(argumentList);
158
+ const [taskId] = positional;
159
+ if (!taskId || typeof options.set !== 'string') throw new Error('usage: task <feature-folder> <task-id> --set \'{"status":"built"}\'');
160
+ const { dashboardPath } = dataPaths(folder);
161
+ const { prefix, data } = readData(dashboardPath);
162
+ const task = findTask(data, taskId);
163
+ if (!task) throw new Error(`task ${taskId} is not in ${dashboardPath} — sync the dashboard with the plan first`);
164
+ const changes = JSON.parse(options.set);
165
+ checkTaskShape(changes);
166
+ Object.assign(task, changes);
167
+ const now = localTime();
168
+ if (typeof options.note === 'string') {
169
+ task.updates = Array.isArray(task.updates) ? task.updates : [];
170
+ task.updates.push({ at: now.stamp, by: typeof options.by === 'string' ? options.by : taskId, note: options.note });
171
+ }
172
+ data.updatedAt = now.stamp;
173
+ writeData(dashboardPath, prefix, data);
174
+ }
175
+
176
+ /**
177
+ * Refuses a change that would give a task field the wrong shape (a list replaced by a string, …), which would
178
+ * break the page.
179
+ * @param {Record<string, any>} changes The fields about to be merged into a task.
180
+ */
181
+ function checkTaskShape(changes) {
182
+ for (const field of TASK_LIST_FIELDS) {
183
+ if (field in changes && !Array.isArray(changes[field])) throw new Error(`"${field}" must be a list — append to it, never assign a string`);
184
+ }
185
+ for (const field of TASK_OBJECT_FIELDS) {
186
+ const value = changes[field];
187
+ if (field in changes && value !== null && (typeof value !== 'object' || Array.isArray(value))) throw new Error(`"${field}" must be an object or null`);
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Appends one milestone to the activity log.
193
+ * @param {string} folder The feature folder.
194
+ * @param {string[]} argumentList The milestone text.
195
+ */
196
+ function writeActivity(folder, argumentList) {
197
+ const text = argumentList.join(' ').trim();
198
+ if (!text) throw new Error('usage: activity <feature-folder> "text"');
199
+ const { dashboardPath } = dataPaths(folder);
200
+ const { prefix, data } = readData(dashboardPath);
201
+ const now = localTime();
202
+ data.activity = Array.isArray(data.activity) ? data.activity : [];
203
+ data.activity.push({ at: now.stamp, text });
204
+ data.updatedAt = now.stamp;
205
+ writeData(dashboardPath, prefix, data);
206
+ }
207
+
208
+ /**
209
+ * Sets the dashboard's run status.
210
+ * @param {string} folder The feature folder.
211
+ * @param {string[]} argumentList The new status.
212
+ */
213
+ function writeStatus(folder, argumentList) {
214
+ const [status] = argumentList;
215
+ const allowed = ['planned', 'in-progress', 'paused', 'complete', 'incomplete'];
216
+ if (!allowed.includes(status)) throw new Error(`status must be one of: ${allowed.join(', ')}`);
217
+ const { dashboardPath } = dataPaths(folder);
218
+ const { prefix, data } = readData(dashboardPath);
219
+ data.status = status;
220
+ data.updatedAt = localTime().stamp;
221
+ writeData(dashboardPath, prefix, data);
222
+ }
223
+
224
+ /**
225
+ * Confirms both data files parse.
226
+ * @param {string} folder The feature folder.
227
+ */
228
+ function checkData(folder) {
229
+ const { dashboardPath, livePath } = dataPaths(folder);
230
+ readData(dashboardPath);
231
+ if (existsSync(livePath)) readData(livePath);
232
+ console.log(`ok: ${dashboardPath}${existsSync(livePath) ? ` and ${livePath}` : ''} parse`);
233
+ }
234
+
235
+ /**
236
+ * The most recently changed file under some folders, skipping dependency, build and cache folders.
237
+ * @param {string[]} roots Folders to search.
238
+ * @returns {{ path: string, modified: number } | null}
239
+ */
240
+ function latestChange(roots) {
241
+ let latest = null;
242
+ const visit = (folder, depth) => {
243
+ let entries;
244
+ try {
245
+ entries = readdirSync(folder, { withFileTypes: true });
246
+ } catch {
247
+ return;
248
+ }
249
+ for (const entry of entries) {
250
+ const path = join(folder, entry.name);
251
+ if (entry.isDirectory()) {
252
+ if (depth < MAXIMUM_SCAN_DEPTH && !IGNORED_FOLDERS.has(entry.name)) visit(path, depth + 1);
253
+ continue;
254
+ }
255
+ // The dashboard's own data files are written by agents and the watchdog itself — not a sign of work.
256
+ if (!entry.isFile() || entry.name.endsWith('.tmp') || /_(dashboard|live)\.js$/.test(entry.name)) continue;
257
+ try {
258
+ const modified = statSync(path).mtimeMs;
259
+ if (!latest || modified > latest.modified) latest = { path, modified };
260
+ } catch {
261
+ /* file vanished between listing and stat — ignore it */
262
+ }
263
+ }
264
+ };
265
+ roots.forEach((root) => visit(root, 0));
266
+ return latest;
267
+ }
268
+
269
+ /**
270
+ * The live file's last write as a Date, or null when it cannot be read.
271
+ * @param {string} stamp `YYYY-MM-DD HH:MM`.
272
+ * @returns {Date | null}
273
+ */
274
+ function parseStamp(stamp) {
275
+ const match = /^(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2})/.exec(String(stamp || ''));
276
+ if (!match) return null;
277
+ const [, year, month, day, hour, minute] = match.map(Number);
278
+ return new Date(year, month - 1, day, hour, minute);
279
+ }
280
+
281
+ /**
282
+ * The watchdog. While the dashboard says a run is in progress it checks the live status every interval:
283
+ * - the live status names a task that is already finished while another task is active → it points the live
284
+ * status at the active task (the agent working on it has not written yet);
285
+ * - nothing has been written for `quiet-minutes` → it writes a heartbeat naming the latest file that changed in
286
+ * the watched folders, so the page shows the work is alive and where;
287
+ * - no file has changed for `stall-minutes` either → the heartbeat says the run may be stalled.
288
+ * It exits by itself as soon as the dashboard status is anything but in-progress, or after `max-hours` (a run that
289
+ * was killed leaves the status at in-progress, and the watchdog must not outlive it forever).
290
+ * @param {string} folder The feature folder.
291
+ * @param {string[]} argumentList Watch options.
292
+ */
293
+ async function watch(folder, argumentList) {
294
+ const { options } = parseOptions(argumentList, ['watch']);
295
+ const intervalSeconds = Number(options['interval-seconds'] || 60);
296
+ const quietMinutes = Number(options['quiet-minutes'] || 10);
297
+ const stallMinutes = Number(options['stall-minutes'] || 30);
298
+ const stopAt = Date.now() + Number(options['max-hours'] || 12) * 3600000;
299
+ const roots = [folder, ...options.watch.map(String)];
300
+ const { dashboardPath, livePath } = dataPaths(folder);
301
+ const projectRoot = process.cwd();
302
+ console.log(`watchdog: watching ${roots.join(', ')} every ${intervalSeconds} s (quiet after ${quietMinutes} min, stalled after ${stallMinutes} min)`);
303
+
304
+ for (;;) {
305
+ if (Date.now() > stopAt) {
306
+ console.log('watchdog: reached its maximum lifetime — exiting');
307
+ return;
308
+ }
309
+ let dashboard;
310
+ try {
311
+ dashboard = readData(dashboardPath).data;
312
+ } catch {
313
+ dashboard = null; // caught mid-write or briefly missing — try again next round
314
+ }
315
+ if (dashboard && dashboard.status !== 'in-progress') {
316
+ console.log(`watchdog: dashboard status is "${dashboard.status}" — the run is over, exiting`);
317
+ return;
318
+ }
319
+ if (dashboard && existsSync(livePath)) {
320
+ try {
321
+ checkLive(dashboard, livePath, roots, projectRoot, quietMinutes, stallMinutes);
322
+ } catch (error) {
323
+ console.log(`watchdog: skipped a round — ${error.message}`);
324
+ }
325
+ }
326
+ await new Promise((resolve) => setTimeout(resolve, intervalSeconds * 1000));
327
+ }
328
+ }
329
+
330
+ /**
331
+ * One watchdog round (see `watch`).
332
+ * @param {any} dashboard The dashboard data.
333
+ * @param {string} livePath The live file.
334
+ * @param {string[]} roots Folders that show signs of work.
335
+ * @param {string} projectRoot Paths are reported relative to this.
336
+ * @param {number} quietMinutes Minutes without a live write before a heartbeat.
337
+ * @param {number} stallMinutes Minutes without any file change before the stall warning.
338
+ */
339
+ function checkLive(dashboard, livePath, roots, projectRoot, quietMinutes, stallMinutes) {
340
+ const { prefix, data: live } = readData(livePath);
341
+ const tasks = (dashboard.phases || []).flatMap((phase) => (phase.tasks || []).map((task) => ({ ...task, phaseNumber: phase.number })));
342
+ const liveTask = tasks.find((task) => task.id === live.task);
343
+ const activeTasks = tasks.filter((task) => ACTIVE_TASK_STATUSES.has(task.status));
344
+ const now = new Date();
345
+ const lastWrite = parseStamp(live.updatedAt);
346
+ const quietFor = lastWrite ? Math.floor((now - lastWrite) / 60000) : Infinity;
347
+ const pointsAtFinishedTask = liveTask && !ACTIVE_TASK_STATUSES.has(liveTask.status) && activeTasks.length > 0;
348
+ if (!pointsAtFinishedTask && quietFor < quietMinutes) return;
349
+
350
+ const change = latestChange(roots);
351
+ const changedAgo = change ? Math.floor((now - change.modified) / 60000) : Infinity;
352
+ const where = change ? `${relative(projectRoot, change.path) || change.path} at ${localTime(new Date(change.modified)).clock}` : 'no file changes found';
353
+ const clock = localTime(now).clock;
354
+ const steps = Array.isArray(live.steps) ? live.steps : [];
355
+ let task = live.task;
356
+ let activity;
357
+
358
+ if (pointsAtFinishedTask) {
359
+ const active = activeTasks[0];
360
+ task = active.id;
361
+ activity = `Working on ${active.id} — ${active.title}. The agent has not written its own status yet; latest activity: ${where}.`;
362
+ steps.length = 0;
363
+ steps.push({ at: clock, text: `Watchdog: the status still named ${live.task}, which is finished — ${active.id} is the task in progress.` });
364
+ } else if (changedAgo >= stallMinutes) {
365
+ activity = `No update for ${quietFor} min and no file has changed for ${changedAgo === Infinity ? 'the whole watch' : `${changedAgo} min`} — the run may be stalled or waiting on something.`;
366
+ steps.push({ at: clock, text: `Watchdog: possible stall — last file change: ${where}.` });
367
+ } else {
368
+ activity = `Still working — no update from the agent for ${quietFor} min; latest activity: ${where}.`;
369
+ steps.push({ at: clock, text: `Watchdog: still working — ${where}.` });
370
+ }
371
+
372
+ writeData(livePath, prefix, {
373
+ ...live,
374
+ updatedAt: localTime(now).stamp,
375
+ phase: pointsAtFinishedTask ? activeTasks[0].phaseNumber : live.phase,
376
+ task,
377
+ title: '',
378
+ role: pointsAtFinishedTask ? 'implementer' : live.role,
379
+ activity,
380
+ steps: steps.slice(-MAXIMUM_LIVE_STEPS),
381
+ source: 'watchdog',
382
+ });
383
+ console.log(`watchdog ${clock}: ${activity}`);
384
+ }
385
+
386
+ const commands = { live: writeLive, task: writeTask, activity: writeActivity, status: writeStatus, check: checkData, watch };
387
+
388
+ if (!commands[command] || !featureFolder) {
389
+ console.error('usage: node dashboard.mjs <live|task|activity|status|check|watch> <feature-folder> [options] — see the header of this file');
390
+ process.exit(2);
391
+ }
392
+ try {
393
+ await commands[command](featureFolder, rest);
394
+ } catch (error) {
395
+ console.error(`dashboard.mjs ${command}: ${error.message}`);
396
+ process.exit(1);
397
+ }
@@ -10,8 +10,8 @@
10
10
 
11
11
  This page is a fixed template: copy it to .agents/specs/<slug>/dashboard.html, replace {{slug}} below with the
12
12
  feature slug, and never hand-edit anything else. Everything shown comes from the data file
13
- documents/<slug>_dashboard.js (schema: bt-execute/templates/dashboard/dashboard.template.js) and, while a run
14
- is going, the live status in documents/<slug>_live.js (schema: live.template.js).
13
+ documents/<slug>_dashboard.js and, while a run is going, the live status in documents/<slug>_live.js —
14
+ both strict JSON behind a one-line `window.… =` prefix (fields and update recipe: data-schema.md).
15
15
  It opens straight from disk (file://) — no server, no build, no network.
16
16
  -->
17
17
  <style>
@@ -181,7 +181,7 @@
181
181
  font: 700 11.5px/1.4 var(--font-mono);
182
182
  letter-spacing: 0.08em;
183
183
  text-transform: uppercase;
184
- white-space: nowrap;
184
+ max-width: 100%;
185
185
  }
186
186
  .status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
187
187
  .status-done, .status-complete { color: var(--done); background: var(--done-soft); }
@@ -314,9 +314,6 @@
314
314
  margin-top: 7px;
315
315
  font: 500 11.5px/1.3 var(--font-mono);
316
316
  color: var(--text-muted);
317
- white-space: nowrap;
318
- overflow: hidden;
319
- text-overflow: ellipsis;
320
317
  }
321
318
 
322
319
  /* ---------- Summary ---------- */
@@ -495,9 +492,6 @@
495
492
  padding: 6px 8px 7px;
496
493
  font: 600 11.5px/1.3 var(--font-sans);
497
494
  color: var(--text-muted);
498
- white-space: nowrap;
499
- overflow: hidden;
500
- text-overflow: ellipsis;
501
495
  }
502
496
  .film-frame .film-step {
503
497
  position: absolute;
@@ -518,7 +512,7 @@
518
512
  .stage-caption .stage-note { color: var(--text-muted); font-size: 13.5px; }
519
513
 
520
514
  /* ---------- Phases ---------- */
521
- .phase { margin-top: 20px; overflow: hidden; }
515
+ .phase { margin-top: 20px; }
522
516
  .phase-head {
523
517
  display: grid;
524
518
  grid-template-columns: auto minmax(0, 1fr) auto;
@@ -604,6 +598,8 @@
604
598
  .live-steps time { font: 600 12px/1.6 var(--font-mono); color: var(--text-faint); }
605
599
  .live-steps li:last-child { color: var(--text); font-weight: 600; }
606
600
  .task-live { padding: 12px 14px; border-radius: var(--radius-small); background: var(--active-soft); }
601
+ .now-warning { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--failed); border-radius: 0 var(--radius-small) var(--radius-small) 0; background: var(--failed-soft); font-size: 13.5px; }
602
+ .tag.tag-watchdog { color: var(--updated); border-color: color-mix(in srgb, var(--updated) 45%, transparent); background: var(--updated-soft); letter-spacing: 0.06em; }
607
603
  .task-live .now-head { font-size: 10.5px; }
608
604
  .task-id { font: 700 13px/1 var(--font-mono); color: var(--text-muted); }
609
605
  .task-title { font-weight: 600; min-width: 0; }
@@ -639,11 +635,11 @@
639
635
  .detail-block p { margin: 0 0 8px; color: var(--text-muted); }
640
636
  .detail-block ul { margin: 0; padding-left: 18px; color: var(--text-muted); display: grid; gap: 4px; }
641
637
  .detail-scroll { overflow-x: auto; }
642
- .detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
643
- .detail-table th { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line-strong); font: 600 10.5px/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); white-space: nowrap; }
638
+ .detail-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; }
639
+ .detail-table th { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line-strong); font: 600 10.5px/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
644
640
  .detail-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
645
- .detail-table td:first-child { min-width: 140px; }
646
- .verdict { padding: 2px 7px; border-radius: 5px; font: 700 11px/1.5 var(--font-mono); white-space: nowrap; }
641
+ .verdict-note { color: var(--text); }
642
+ .verdict { display: inline-block; max-width: 100%; padding: 2px 7px; border-radius: 5px; font: 700 11px/1.5 var(--font-mono); }
647
643
  .verdict-pass { color: var(--done); background: var(--done-soft); }
648
644
  .verdict-fail { color: var(--failed); background: var(--failed-soft); }
649
645
  .verdict-other { color: var(--text-muted); background: var(--pending-soft); }
@@ -666,7 +662,7 @@
666
662
  font: 700 10.5px/1.4 var(--font-mono);
667
663
  letter-spacing: 0.08em;
668
664
  text-transform: uppercase;
669
- white-space: nowrap;
665
+ max-width: 100%;
670
666
  }
671
667
  .updated-badge::before { content: "↻"; font-size: 12px; letter-spacing: 0; }
672
668
  .updated-badge.is-new { box-shadow: 0 0 0 3px var(--updated-soft); }
@@ -713,6 +709,15 @@
713
709
  .activity-log > summary { cursor: pointer; }
714
710
  .activity-log[open] > summary { margin-bottom: 8px; }
715
711
 
712
+ /* ---------- Containment: nothing is ever wider than its card ---------- */
713
+ /* A single-column grid's column defaults to the width of its longest unbreakable line (a long path,
714
+ a hash), which pushes every paragraph in it past the card's edge. Size those columns to the card. */
715
+ .tasks, .task-body, .task-details, .highlights, .figures, .live-steps, .update-notes,
716
+ .detail-block ul, .aar-section ul { grid-template-columns: minmax(0, 1fr); }
717
+ .highlights li { grid-template-columns: 22px minmax(0, 1fr); }
718
+ /* Long paths, identifiers and URLs wrap wherever they must instead of running off the edge. */
719
+ .page, .masthead h1, .masthead .lede { overflow-wrap: anywhere; }
720
+
716
721
  /* ---------- Lightbox ---------- */
717
722
  .lightbox {
718
723
  position: fixed;
@@ -747,6 +752,12 @@
747
752
  .after-action { padding: 18px; }
748
753
  .after-action-columns { grid-template-columns: 1fr; }
749
754
  .route-label { display: none; }
755
+ /* Detail tables stack on phones: one block per row, each value under its column's label. */
756
+ .detail-table, .detail-table tbody, .detail-table tr, .detail-table td { display: block; width: 100%; }
757
+ .detail-table colgroup, .detail-table thead { display: none; }
758
+ .detail-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
759
+ .detail-table td { padding: 3px 0; border-bottom: 0; }
760
+ .detail-table td::before { content: attr(data-label); display: block; font: 600 10.5px/1.6 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
750
761
  }
751
762
  @media (prefers-reduced-motion: reduce) {
752
763
  *, *::before { animation: none !important; transition: none !important; }
@@ -772,6 +783,8 @@
772
783
  /** Seconds between refreshes of the "updated N min ago" labels. */
773
784
  const AGE_REFRESH_SECONDS = 30;
774
785
  const STATUS_ICONS = { done: '✓', 'in-progress': '◐', built: '◆', verifying: '⟳', pending: '○', deferred: '⏭', failed: '✕' };
786
+ /** Longest test or acceptance result still shown as a single badge; anything longer is wrapping text. */
787
+ const VERDICT_BADGE_MAX_LENGTH = 16;
775
788
  /** Where the Babylon Toolkit Desktop Agent, whose skills generate this dashboard, is published. */
776
789
  const SKILLS_DOWNLOAD_URL = 'https://www.npmjs.com/package/@babylonjs-toolkit/agent';
777
790
  /** Minutes without a live update before the Now banner warns that the run has gone quiet. */
@@ -808,8 +821,15 @@
808
821
  const storageKey = `dashboard:${report.feature && report.feature.slug ? report.feature.slug : location.pathname}`;
809
822
  const lastVisit = readStorage(localStorage, `${storageKey}:lastSeen`) || '';
810
823
 
811
- render();
812
- wireLightbox();
824
+ normalizeReport(report);
825
+ try {
826
+ render();
827
+ wireLightbox();
828
+ } catch (error) {
829
+ // A malformed field must never leave a blank page: say what broke, and keep checking for a repaired file.
830
+ console.error('Dashboard render failed', error);
831
+ renderBrokenData(error);
832
+ }
813
833
  wireAutoUpdate();
814
834
  restoreScroll();
815
835
  writeStorage(localStorage, `${storageKey}:lastSeen`, report.updatedAt || '');
@@ -1092,11 +1112,19 @@
1092
1112
  ].filter(Boolean).join(' · ');
1093
1113
  const title = task ? `${escapeHtml(task.id)} — ${escapeHtml(task.title || '')}` : escapeHtml(live.title || live.task || 'Between tasks');
1094
1114
  const age = describeAge(live.updatedAt);
1115
+ // The live status can lag: it may still name a finished task while the agent works on the next one.
1116
+ const activeTasks = allTasks.filter((candidate) => ['in-progress', 'built', 'verifying'].includes(candidate.status));
1117
+ const namesFinishedTask = task && !['in-progress', 'built', 'verifying'].includes(task.status) && activeTasks.length > 0;
1118
+ const lagWarning = namesFinishedTask
1119
+ ? `<p class="now-warning">This status still names ${escapeHtml(task.id)}, which is ${escapeHtml(STATUS_LABELS[task.status] || task.status).toLowerCase()}. ${escapeHtml(activeTasks.map((candidate) => candidate.id).join(', '))} ${activeTasks.length === 1 ? 'is' : 'are'} in progress — the agent has not written its own status yet.</p>`
1120
+ : '';
1121
+ const watchdogTag = live.source === 'watchdog' ? '<span class="tag tag-watchdog" title="Written by the watchdog because the agent has been quiet">watchdog</span>' : '';
1095
1122
  return `
1096
1123
  <div class="card now ${age.isStale ? 'is-stale' : ''}" aria-live="polite">
1097
- <div class="now-head"><span class="live-dot"></span>Now${heading ? ` · ${heading}` : ''}<span class="now-age" data-age="${escapeAttribute(live.updatedAt || '')}">${escapeHtml(age.text)}</span></div>
1124
+ <div class="now-head"><span class="live-dot"></span>Now${heading ? ` · ${heading}` : ''}${watchdogTag}<span class="now-age" data-age="${escapeAttribute(live.updatedAt || '')}">${escapeHtml(age.text)}</span></div>
1098
1125
  <a class="now-task" href="#task-${escapeAttribute(live.task || '')}">${title}</a>
1099
1126
  ${live.activity ? `<p class="now-activity">${formatInline(live.activity)}</p>` : ''}
1127
+ ${lagWarning}
1100
1128
  ${renderLiveSteps(NOW_STEP_COUNT)}
1101
1129
  </div>`;
1102
1130
  }
@@ -1148,13 +1176,13 @@
1148
1176
  : '';
1149
1177
  const blocks = [
1150
1178
  detailBlock('Approach', paragraphs(details.approach)),
1151
- detailBlock('Changes by file', detailTable(['File', 'What changed and why'],
1179
+ detailBlock('Changes by file', detailTable(['File', 'What changed and why'], [34, 66],
1152
1180
  (details.changes || []).map((change) => [`<code>${escapeHtml(change.file || '')}</code>`, formatInline(change.change || '')]))),
1153
- detailBlock('Test cases', detailTable(['Case', 'Expected', 'Result'],
1181
+ detailBlock('Test cases', detailTable(['Case', 'Expected', 'Result'], [28, 36, 36],
1154
1182
  (details.testCases || []).map((testCase) => [formatInline(testCase.name || ''), formatInline(testCase.expected || ''), verdict(testCase.result)]))),
1155
- detailBlock('Acceptance', detailTable(['Criterion', 'Verdict', 'Evidence'],
1183
+ detailBlock('Acceptance', detailTable(['Criterion', 'Verdict', 'Evidence'], [32, 18, 50],
1156
1184
  (details.acceptance || []).map((item) => [formatInline(item.criterion || ''), verdict(item.result), formatInline(item.evidence || '')]))),
1157
- detailBlock('Problems &amp; fixes', detailTable(['Attempt', 'What failed', 'Root cause', 'Fix'],
1185
+ detailBlock('Problems &amp; fixes', detailTable(['Attempt', 'What failed', 'Root cause', 'Fix'], [10, 30, 30, 30],
1158
1186
  (details.problems || []).map((problem) => [escapeHtml(problem.attempt || ''), formatInline(problem.failed || ''), formatInline(problem.cause || ''), formatInline(problem.fix || '')]))),
1159
1187
  detailBlock('Live check', paragraphs(details.liveCheck)),
1160
1188
  detailBlock('Notes', (details.notes || []).length ? `<ul>${details.notes.map((note) => `<li>${formatInline(note)}</li>`).join('')}</ul>` : ''),
@@ -1184,18 +1212,35 @@
1184
1212
  return list.map((paragraph) => `<p>${formatInline(paragraph)}</p>`).join('');
1185
1213
  }
1186
1214
 
1187
- function detailTable(headings, rows) {
1215
+ /**
1216
+ * A verbose-detail table with fixed column shares, so no single long cell can widen its column and
1217
+ * squeeze the others. Each cell carries its heading as `data-label` for the stacked phone layout.
1218
+ */
1219
+ function detailTable(headings, columnPercents, rows) {
1188
1220
  if (!rows.length) return '';
1189
1221
  return `<div class="detail-scroll"><table class="detail-table">
1222
+ <colgroup>${columnPercents.map((percent) => `<col style="width:${percent}%">`).join('')}</colgroup>
1190
1223
  <thead><tr>${headings.map((heading) => `<th>${heading}</th>`).join('')}</tr></thead>
1191
- <tbody>${rows.map((cells) => `<tr>${cells.map((cell) => `<td>${cell}</td>`).join('')}</tr>`).join('')}</tbody>
1224
+ <tbody>${rows.map((cells) => `<tr>${cells.map((cell, index) => `<td data-label="${escapeAttribute(headings[index])}">${cell}</td>`).join('')}</tr>`).join('')}</tbody>
1192
1225
  </table></div>`;
1193
1226
  }
1194
1227
 
1228
+ /**
1229
+ * A test or acceptance result. "PASS" / "FAIL" lead with a coloured badge and any explanation follows as
1230
+ * normal wrapping text; a short other result is a neutral badge; a long one is plain text.
1231
+ */
1195
1232
  function verdict(result) {
1196
- const text = String(result || '');
1197
- const tone = /^pass/i.test(text) ? 'pass' : /^fail/i.test(text) ? 'fail' : 'other';
1198
- return text ? `<span class="verdict verdict-${tone}">${escapeHtml(text)}</span>` : '';
1233
+ const text = String(result || '').trim();
1234
+ if (!text) return '';
1235
+ const leading = /^(pass(?:ed)?|fail(?:ed)?)\b[\s:—–-]*/i.exec(text);
1236
+ if (leading) {
1237
+ const tone = /^pass/i.test(leading[1]) ? 'pass' : 'fail';
1238
+ const rest = text.slice(leading[0].length);
1239
+ return `<span class="verdict verdict-${tone}">${escapeHtml(leading[1].toUpperCase())}</span>${rest ? ` <span class="verdict-note">${formatInline(rest)}</span>` : ''}`;
1240
+ }
1241
+ return text.length <= VERDICT_BADGE_MAX_LENGTH
1242
+ ? `<span class="verdict verdict-other">${escapeHtml(text)}</span>`
1243
+ : `<span class="verdict-note">${formatInline(text)}</span>`;
1199
1244
  }
1200
1245
 
1201
1246
  function factRow(label, valueHtml) {
@@ -1378,6 +1423,79 @@
1378
1423
  </main>`;
1379
1424
  }
1380
1425
 
1426
+ /** Shown instead of a blank page when the data parses but a field has a shape the page cannot render. */
1427
+ function renderBrokenData(error) {
1428
+ appRoot.innerHTML = `
1429
+ <main class="page">
1430
+ <div class="card error-panel">
1431
+ <h2>The dashboard data could not be shown</h2>
1432
+ <p>A field in <code>documents/&lt;slug&gt;_dashboard.js</code> has an unexpected shape: ${escapeHtml(error && error.message ? error.message : String(error))}.
1433
+ This page keeps checking and redraws itself as soon as the file is repaired (open the browser console for details).</p>
1434
+ </div>
1435
+ </main>`;
1436
+ }
1437
+
1438
+ /* ===================== Data repair ===================== */
1439
+
1440
+ /**
1441
+ * Repairs the list fields a hand or script slip most often breaks, so one bad value cannot blank the page:
1442
+ * an update written as plain text becomes one update note, and any other non-list value becomes an empty list.
1443
+ */
1444
+ function normalizeReport(data) {
1445
+ const asList = (value) => (Array.isArray(value) ? value : []);
1446
+ const asUpdates = (value) => {
1447
+ if (typeof value === 'string' && value) return [{ note: value }];
1448
+ return asList(value).map((update) => (typeof update === 'string' ? { note: update } : update)).filter((update) => update && typeof update === 'object');
1449
+ };
1450
+ const repairSnapshots = (snapshots) => asList(snapshots)
1451
+ .filter((snapshot) => snapshot && typeof snapshot === 'object')
1452
+ .map((snapshot) => Object.assign(snapshot, { updates: asUpdates(snapshot.updates) }, snapshot.frames !== undefined ? { frames: asList(snapshot.frames) } : {}));
1453
+ data.phases = asList(data.phases);
1454
+ data.decisions = asList(data.decisions).map((decision) => Object.assign(decision, { updates: asUpdates(decision.updates) }));
1455
+ data.followUps = asList(data.followUps);
1456
+ data.activity = asList(data.activity);
1457
+ if (data.afterAction && typeof data.afterAction === 'object') {
1458
+ const afterAction = data.afterAction;
1459
+ afterAction.updates = asUpdates(afterAction.updates);
1460
+ afterAction.snapshots = repairSnapshots(afterAction.snapshots);
1461
+ ['body', 'highlights', 'sections'].forEach((key) => { if (afterAction[key] !== undefined) afterAction[key] = asList(afterAction[key]); });
1462
+ }
1463
+ data.phases.forEach((phase) => {
1464
+ phase.updates = asUpdates(phase.updates);
1465
+ phase.snapshots = repairSnapshots(phase.snapshots);
1466
+ phase.tasks = asList(phase.tasks);
1467
+ phase.tasks.forEach((task) => {
1468
+ task.updates = asUpdates(task.updates);
1469
+ task.snapshots = repairSnapshots(task.snapshots);
1470
+ task.files = typeof task.files === 'string' ? [task.files] : asList(task.files);
1471
+ task.decisions = typeof task.decisions === 'string' ? [task.decisions] : asList(task.decisions);
1472
+ if (task.tests !== null && typeof task.tests !== 'object') task.tests = null;
1473
+ if (task.details !== null && task.details !== undefined && typeof task.details !== 'object') task.details = null;
1474
+ if (task.details) repairDetails(task.details);
1475
+ });
1476
+ });
1477
+ if (data.afterAction && Array.isArray(data.afterAction.sections)) {
1478
+ data.afterAction.sections.forEach((section) => {
1479
+ if (section && typeof section === 'object' && section.items !== undefined) section.items = asTextList(section.items);
1480
+ });
1481
+ }
1482
+
1483
+ /** A verbose write-up: tables need lists of rows; notes may be one sentence or a list of them. */
1484
+ function repairDetails(details) {
1485
+ ['changes', 'testCases', 'acceptance', 'problems'].forEach((key) => {
1486
+ if (details[key] !== undefined) details[key] = asList(details[key]).filter((row) => row && typeof row === 'object');
1487
+ });
1488
+ if (details.notes !== undefined) details.notes = asTextList(details.notes);
1489
+ if (details.timing !== undefined && (details.timing === null || typeof details.timing !== 'object')) details.timing = null;
1490
+ }
1491
+
1492
+ /** One string becomes a one-item list; a list keeps only its non-empty entries. */
1493
+ function asTextList(value) {
1494
+ if (typeof value === 'string') return value ? [value] : [];
1495
+ return asList(value).filter((item) => item !== null && item !== undefined && item !== '');
1496
+ }
1497
+ }
1498
+
1381
1499
  /* ===================== Updated notifications ===================== */
1382
1500
 
1383
1501
  function updatedBadge(updates) {
@@ -1591,11 +1709,13 @@
1591
1709
  */
1592
1710
  function wireAutoUpdate() {
1593
1711
  const toggle = document.getElementById('live-toggle');
1594
- toggle.addEventListener('click', () => {
1595
- writeStorage(localStorage, `${storageKey}:live`, isLiveEnabled() ? 'off' : 'on');
1596
- toggle.setAttribute('aria-pressed', String(isLiveEnabled()));
1597
- toggle.textContent = autoUpdateLabel();
1598
- });
1712
+ if (toggle) {
1713
+ toggle.addEventListener('click', () => {
1714
+ writeStorage(localStorage, `${storageKey}:live`, isLiveEnabled() ? 'off' : 'on');
1715
+ toggle.setAttribute('aria-pressed', String(isLiveEnabled()));
1716
+ toggle.textContent = autoUpdateLabel();
1717
+ });
1718
+ }
1599
1719
  const dashboardSource = scriptSource('_dashboard.js');
1600
1720
  const liveSource = scriptSource('_live.js');
1601
1721
  const renderedFingerprint = fingerprint(report, live);
@@ -1,134 +1,81 @@
1
- /*
2
- * Feature Dashboard data — .agents/specs/<slug>/documents/<slug>_dashboard.js
3
- *
4
- * dashboard.html (copied from this template folder) renders everything from this one object. It is plain
5
- * JavaScript loaded with <script src>, so the page works opened straight from disk. Rules:
6
- * - Keep it valid JavaScript: one `window.FEATURE_DASHBOARD = { … };` assignment, JSON-style values.
7
- * - Paths (documents, snapshots) are relative to the feature folder: "snapshots/…", "documents/…".
8
- * - Every timestamp is local time from the shell, formatted "YYYY-MM-DD HH:MM" (the page orders and
9
- * flags "new since your last visit" by plain string comparison).
10
- * - Text fields may use `code` and **bold**; everything else is shown as plain text.
11
- * - Never silently rewrite an earlier phase, task, snapshot, decision or the After Action Report. Change it and append
12
- * an entry to its `updates` list: { at, by, note } — the page shows an "Updated" badge on it and lists
13
- * it under "Updates and revisions".
14
- *
15
- * Status values — report: planned | in-progress (a run is executing right now) | paused (a run ended, plan not
16
- * finished) | complete | incomplete (plan finished with deferrals)
17
- * Decide it from the plan file's checkboxes. The page only believes "complete" when every task here is done;
18
- * otherwise it shows the plan as paused with a warning. A task added to the plan after it was complete is
19
- * added here as "pending" (with an `updates` note) and the status becomes "paused".
20
- * The status picks the page's top slot: in-progress shows Current run activity (the live file + milestones);
21
- * paused / complete / incomplete show the After Action Report instead (paused marks it Interim).
22
- * phase: pending | in-progress | done | partial | deferred
23
- * task: pending | in-progress | built (awaiting the verifier) | verifying | done | deferred | failed
24
- *
25
- * Update cadence: per TASK, not per phase. A task's entry changes the moment it starts (in-progress), the moment
26
- * it is built (built — with its summary, files, tests and snapshots filled in right then), while the verifier
27
- * checks it (verifying) and when it passes (done — verifier, commit, done time). The minute-by-minute "what is
28
- * happening now" lives in the separate live file, documents/<slug>_live.js (schema: live.template.js).
29
- *
30
- * Snapshot shapes (any list of snapshots may mix them):
31
- * progression — the build told stage by stage, from the same camera, in the order it happened:
32
- * { title, caption, source, frames: [ { src, stage, caption, task, at }, … ], updates }
33
- * comparison — one change, side by side (drag slider):
34
- * { title, caption, source, before: { src, caption }, after: { src, caption }, updates }
35
- * still — one image that proves one thing:
36
- * { title, caption, source, src, updates }
37
- * `source` names where the image came from: "browser", "unity", "blender", "reference".
38
- */
39
1
  window.FEATURE_DASHBOARD = {
40
- schema: 1,
41
-
42
- feature: {
43
- title: "Feature Title",
44
- slug: "feature-slug",
45
- branch: "project/feature/feature-slug",
46
- origin: "spec", // "spec" (bt-spec) or "quick-plan" (bt-plan Quick Plan)
47
- size: "medium",
48
- proof: "functional",
49
- summary: "One paragraph: what this feature is and why it exists, in plain language."
2
+ "schema": 1,
3
+ "feature": {
4
+ "title": "Feature Title",
5
+ "slug": "feature-slug",
6
+ "branch": "project/feature/feature-slug",
7
+ "origin": "spec",
8
+ "size": "medium",
9
+ "proof": "functional",
10
+ "summary": "One paragraph: what this feature is and why it exists, in plain language."
50
11
  },
51
-
52
- documents: [
53
- { label: "Spec", path: "documents/feature-slug_spec.md" }, // omit for a Quick Plan
54
- { label: "Plan", path: "documents/feature-slug_plan.md" },
55
- { label: "Run log", path: "documents/feature-slug_autopilot.md" } // add once bt-execute has run
12
+ "documents": [
13
+ {
14
+ "label": "Spec",
15
+ "path": "documents/feature-slug_spec.md"
16
+ },
17
+ {
18
+ "label": "Plan",
19
+ "path": "documents/feature-slug_plan.md"
20
+ }
56
21
  ],
57
-
58
- status: "planned",
59
- detail: "normal", // "verbose" once any run used bt-execute --verbose (never set back)
60
- updatedAt: "2026-01-01 09:00",
61
- estimate: "3–6 h", // the plan's Total line
62
- activeTime: "", // from the run log's ⏱ lines, e.g. "2 h 10 min"
63
- runs: 0,
64
-
65
- // The After Action Report — the whole plan's execution, start to finish. Empty while planned; written by
66
- // bt-execute at the end of every run, and shown in the top slot once no run is executing ("Interim" while paused).
67
- afterAction: {
68
- writtenAt: "", // "YYYY-MM-DD HH:MM"
69
- headline: "", // one sentence: what the plan delivered
70
- body: [], // 2–4 paragraphs: what was built, how it was proven, what surprised
71
- highlights: [], // the results worth remembering
72
- // ONE before/after for the plan as a whole: "before" captured before T1 started, "after" at the end,
73
- // from the same camera or viewport. null when the plan has nothing to see.
74
- comparison: null, // { title, caption, source, before: { src, caption }, after: { src, caption } }
75
- snapshots: [], // optional: the plan's key progression, or the end-to-end proof
76
- // --verbose only: the full debrief, one card per section, in this order where they apply —
77
- // Architecture · Phase by phase · Problems and resolutions · Deviations from the plan · Known limitations ·
78
- // Lessons learned · Estimate vs actual · Recommended next steps
79
- sections: [], // { title, body: [paragraphs], items: [bullets] }
80
- updates: []
22
+ "status": "planned",
23
+ "detail": "normal",
24
+ "updatedAt": "2026-01-01 09:00",
25
+ "estimate": "3–6 h",
26
+ "activeTime": "",
27
+ "runs": 0,
28
+ "afterAction": {
29
+ "writtenAt": "",
30
+ "headline": "",
31
+ "body": [],
32
+ "highlights": [],
33
+ "comparison": null,
34
+ "snapshots": [],
35
+ "sections": [],
36
+ "updates": []
81
37
  },
82
-
83
- phases: [
38
+ "phases": [
84
39
  {
85
- number: 1,
86
- name: "Phase name from the plan",
87
- status: "pending",
88
- started: "", // "HH:MM" — from the ⏱ phase line
89
- finished: "",
90
- minutes: 0,
91
- summary: "", // what this phase delivered, in two or three sentences
92
- verifier: null, // { result: "PASS" | "FAIL → PASS on attempt 2", note: "…" }
93
- snapshots: [], // phase-level story: progressions spanning several tasks
94
- updates: [],
95
- tasks: [
40
+ "number": 1,
41
+ "name": "Phase name from the plan",
42
+ "status": "pending",
43
+ "started": "",
44
+ "finished": "",
45
+ "minutes": 0,
46
+ "summary": "",
47
+ "verifier": null,
48
+ "snapshots": [],
49
+ "updates": [],
50
+ "tasks": [
96
51
  {
97
- id: "T1",
98
- title: "Task title from the plan",
99
- kind: "code", // code | live | unity — the plan's estimate kind
100
- verifyLevel: "standard", // standard | live
101
- status: "pending",
102
- summary: "", // what was actually done, and anything surprising
103
- files: [],
104
- tests: null, // { passed: 4, failed: 0, files: [".agents/specs/<slug>/tests/…"], note: "" }
105
- verifier: "", // "PASS — independent subagent; live check in Chrome"
106
- attempts: 0,
107
- commit: "",
108
- doneAt: "",
109
- deferredReason: "",
110
- decisions: [], // "DECISION T1: … — source"
111
- snapshots: [], // this task's progression / comparisons / stills
112
- // --verbose only: the task's full write-up. Every field optional; the page shows what is present.
113
- details: null, // {
114
- // approach: ["how it was built, how the pieces fit, why this way and not the alternatives"],
115
- // changes: [{ file, change: "what changed in it and why" }],
116
- // testCases: [{ name, expected, result: "PASS" | "FAIL …" }],
117
- // acceptance: [{ criterion, result: "PASS" | "FAIL", evidence }],
118
- // problems: [{ attempt: "1", failed, cause, fix }],
119
- // liveCheck: "what was looked at, where, at what resolution, what was judged",
120
- // notes: ["anything a maintainer should know"],
121
- // timing: { build: 12, verify: 6, fix: 4 } // minutes
122
- // }
123
- updates: []
52
+ "id": "T1",
53
+ "title": "Task title from the plan",
54
+ "kind": "code",
55
+ "verifyLevel": "standard",
56
+ "status": "pending",
57
+ "summary": "",
58
+ "files": [],
59
+ "tests": null,
60
+ "verifier": "",
61
+ "attempts": 0,
62
+ "commit": "",
63
+ "doneAt": "",
64
+ "deferredReason": "",
65
+ "decisions": [],
66
+ "snapshots": [],
67
+ "details": null,
68
+ "updates": []
124
69
  }
125
70
  ]
126
71
  }
127
72
  ],
128
-
129
- decisions: [], // { id: "D1" | "T7", text, source, updates }
130
- followUps: [], // plain strings: what a human should look at next
131
- activity: [ // oldest first; the page shows newest first
132
- { at: "2026-01-01 09:00", text: "Plan written — 1 task in 1 phase, estimated 3–6 h." }
73
+ "decisions": [],
74
+ "followUps": [],
75
+ "activity": [
76
+ {
77
+ "at": "2026-01-01 09:00",
78
+ "text": "Plan written — 1 task in 1 phase, estimated 3–6 h."
79
+ }
133
80
  ]
134
81
  };
@@ -0,0 +1,193 @@
1
+ # Feature Dashboard data
2
+
3
+ `dashboard.html` renders everything from two data files in the feature folder's `documents/`:
4
+
5
+ | File | Holds | Written |
6
+ |---|---|---|
7
+ | `<slug>_dashboard.js` | the feature's record — status, phases, tasks and their results, decisions, snapshots, the After Action Report | at every task boundary (bt-plan creates it from `dashboard.template.js`) |
8
+ | `<slug>_live.js` | what is happening this minute — the current task, one sentence, its step log | at every meaningful step of a run (from `live.template.js`) |
9
+
10
+ They are **data, not code.** Each file is exactly one line of prefix and one strict-JSON value:
11
+
12
+ ```js
13
+ window.FEATURE_DASHBOARD = { "schema": 1, "status": "planned", … };
14
+ window.FEATURE_LIVE = { "updatedAt": "2026-01-01 09:00", … };
15
+ ```
16
+
17
+ The `window.… =` prefix exists only because a page opened from disk (`file://`) may load a neighbouring
18
+ `<script src>` but may not fetch a `.json` file. Everything after `=` and before the final `;` is strict
19
+ JSON — double-quoted keys and strings, no comments, no trailing commas — so any JSON parser can read it.
20
+ The status of the plan itself lives in the plan file's checkboxes; the dashboard mirrors it (see *Status*).
21
+
22
+ ## Updating a data file
23
+
24
+ Use bt-execute's helper — `node <skills>/bt-execute/scripts/dashboard.mjs live|task|activity|status|check|watch <feature-folder> …`
25
+ (every option is in its header). It parses, checks field shapes and writes atomically. Its `watch` command is the
26
+ watchdog that writes a heartbeat into the live file when an agent has been quiet for 10 minutes.
27
+
28
+ ### Fallback — parse, change, write back
29
+
30
+ Never edit the text by hand: one stray comma blanks the page. Read the file, parse the JSON, change the
31
+ fields, and write the whole file back. Every write then produces valid data by construction.
32
+
33
+ ```bash
34
+ python3 - "$DATA" <<'PY'
35
+ import json, pathlib, sys
36
+ path = pathlib.Path(sys.argv[1])
37
+ text = path.read_text(encoding="utf-8")
38
+ prefix, body = text.split("=", 1)
39
+ data = json.loads(body.strip().rstrip(";"))
40
+ # … change `data` here, e.g. data["status"] = "in-progress" …
41
+ path.write_text(prefix.strip() + " = " + json.dumps(data, indent=2, ensure_ascii=False) + ";\n", encoding="utf-8")
42
+ PY
43
+ ```
44
+
45
+ Node works the same way (`JSON.parse` / `JSON.stringify(data, null, 2)`). Where neither runs, write the
46
+ whole file from a complete JSON value, never a partial patch. `<slug>_live.js` is small — always write it whole.
47
+
48
+ **Keep every field its documented shape.** Valid JSON is not enough: a list field written as plain text
49
+ (`"updates": "note"` instead of `"updates": [{ "at", "by", "note" }]`) once blanked a dashboard mid-run. The
50
+ lists are `updates`, `snapshots`, `files`, `decisions`, `activity`, `followUps`, `phases`, `tasks`, a snapshot's
51
+ `frames`, and in `details` the tables `changes`, `testCases`, `acceptance`, `problems` and the list `notes`.
52
+ Add to a list (`.append(...)`), never assign a string to it, and when you give a helper script to subagents,
53
+ make it check these shapes before it writes. The page repairs the common slips on load (a text `updates`
54
+ becomes one note, a text `notes` a one-item list, any other non-list an empty list) and shows an error panel
55
+ instead of a blank page if something still cannot render — it keeps checking and redraws once the file is fixed.
56
+
57
+ ## Conventions
58
+
59
+ - **Paths** (documents, snapshots) are relative to the feature folder: `"snapshots/…"`, `"documents/…"`.
60
+ - **Timestamps** are local time from the shell, `"YYYY-MM-DD HH:MM"` (`date '+%Y-%m-%d %H:%M'`). The page
61
+ orders entries and flags "new since your last visit" by plain string comparison.
62
+ - **Text** may use `` `code` `` and `**bold**`; everything else is shown as plain text.
63
+ - **Updated notifications.** Never silently rewrite an earlier phase, task, snapshot, decision or the After
64
+ Action Report. Change it and append `{ "at", "by", "note" }` to its `updates` list — the page shows an
65
+ **Updated** badge on it and lists it under *Updates and revisions*.
66
+
67
+ ## Status
68
+
69
+ | Field | Values |
70
+ |---|---|
71
+ | `status` | `planned` · `in-progress` (a run is executing right now) · `paused` (a run ended, the plan is not finished) · `complete` · `incomplete` (finished with deferrals) |
72
+ | phase `status` | `pending` · `in-progress` · `done` · `partial` · `deferred` |
73
+ | task `status` | `pending` · `in-progress` · `built` (awaiting the verifier) · `verifying` · `done` · `deferred` · `failed` |
74
+
75
+ - Decide `status` from the plan file's checkboxes, never from memory. The page only believes `complete` when
76
+ every task here is `done`; otherwise it shows the plan as paused with a warning.
77
+ - A task added to the plan after it was complete is added here as `pending`, in plan order, with an `updates`
78
+ note saying why — and `complete` becomes `paused`.
79
+ - The status picks the page's top slot: `in-progress` shows *Current run activity* (the live file and the
80
+ milestones); `paused`, `complete` and `incomplete` show *The plan summary* (the After Action Report, marked
81
+ *Interim* while paused).
82
+ - **Cadence is per task.** A task's entry changes the moment it starts (`in-progress`), the moment it is built
83
+ (`built` — summary, files, tests and snapshots filled in right then), while the verifier checks it
84
+ (`verifying`) and when it passes (`done` — verifier, commit, done time).
85
+
86
+ ## `<slug>_dashboard.js` fields
87
+
88
+ Top level:
89
+
90
+ | Field | Meaning |
91
+ |---|---|
92
+ | `schema` | `1` |
93
+ | `feature` | `{ "title", "slug", "branch", "origin": "spec" \| "quick-plan", "size", "proof", "summary" }` — `summary` is one plain-language paragraph |
94
+ | `documents` | `[{ "label", "path" }]` — Spec (omitted for a Quick Plan), Plan, and Run log once bt-execute has run |
95
+ | `status` | see *Status* |
96
+ | `detail` | `"normal"`, or `"verbose"` once any run used `bt-execute --verbose` (never set back) |
97
+ | `updatedAt` | last write, `"YYYY-MM-DD HH:MM"` |
98
+ | `estimate` | the plan's Total line, e.g. `"3–6 h"` |
99
+ | `activeTime` | from the run log's `⏱` lines, e.g. `"2 h 10 min"` |
100
+ | `runs` | number of bt-execute runs so far |
101
+ | `afterAction` | the After Action Report (below) |
102
+ | `phases` | the plan's phases, each with its tasks (below) |
103
+ | `decisions` | `[{ "id": "D1" \| "T7", "text", "source", "updates" }]` |
104
+ | `followUps` | plain strings — what a human should look at next |
105
+ | `activity` | `[{ "at", "text" }]`, oldest first — the milestones (the page shows newest first) |
106
+
107
+ `afterAction` — empty while planned; written by bt-execute at the end of every run:
108
+
109
+ | Field | Meaning |
110
+ |---|---|
111
+ | `writtenAt` | `"YYYY-MM-DD HH:MM"` |
112
+ | `headline` | one sentence: what the plan delivered |
113
+ | `body` | 2–4 paragraphs: what was built, how it was proven, what surprised |
114
+ | `highlights` | the results worth remembering |
115
+ | `comparison` | ONE before/after for the plan as a whole — "before" captured before T1 started, "after" at the end, from the same camera or viewport: `{ "title", "caption", "source", "before": { "src", "caption" }, "after": { "src", "caption" } }`; `null` when the plan has nothing to see |
116
+ | `snapshots` | optional: the plan's key progression, or the end-to-end proof |
117
+ | `sections` | `--verbose` only: `[{ "title", "body": [paragraphs], "items": [bullets] }]`, in this order where they apply — Architecture · Phase by phase · Problems and resolutions · Deviations from the plan · Known limitations · Lessons learned · Estimate vs actual · Recommended next steps |
118
+ | `updates` | see *Updated notifications* |
119
+
120
+ Each phase:
121
+
122
+ | Field | Meaning |
123
+ |---|---|
124
+ | `number`, `name` | from the plan |
125
+ | `status` | see *Status* |
126
+ | `started`, `finished`, `minutes` | `"HH:MM"` and minutes, from the phase's `⏱` line |
127
+ | `summary` | what the phase delivered, in two or three sentences |
128
+ | `verifier` | `{ "result": "PASS" \| "FAIL → PASS on attempt 2", "note" }` or `null` |
129
+ | `snapshots` | phase-level story — progressions spanning several tasks |
130
+ | `tasks` | below |
131
+ | `updates` | see *Updated notifications* |
132
+
133
+ Each task:
134
+
135
+ | Field | Meaning |
136
+ |---|---|
137
+ | `id`, `title` | from the plan (`T1`, `T3.1` …) |
138
+ | `kind` | `code` · `live` · `unity` — the plan's estimate kind |
139
+ | `verifyLevel` | `standard` · `live` |
140
+ | `status` | see *Status* |
141
+ | `summary` | what was actually done, and anything surprising |
142
+ | `files` | paths changed |
143
+ | `tests` | `{ "passed", "failed", "files": [".agents/specs/<slug>/tests/…"], "note" }` or `null` |
144
+ | `verifier` | `"PASS — independent subagent; live check in Chrome"` |
145
+ | `attempts`, `commit`, `doneAt` | as recorded |
146
+ | `deferredReason` | why it was deferred, if it was |
147
+ | `decisions` | `"DECISION T1: … — source"` lines |
148
+ | `snapshots` | this task's progression, comparisons and stills |
149
+ | `details` | `--verbose` only, else `null` — see below |
150
+ | `updates` | see *Updated notifications* |
151
+
152
+ `details` (`--verbose`) — every field optional; the page shows what is present:
153
+
154
+ | Field | Meaning |
155
+ |---|---|
156
+ | `approach` | paragraphs: how it was built, how the pieces fit, why this way and not the alternatives |
157
+ | `changes` | `[{ "file", "change": "what changed in it and why" }]` |
158
+ | `testCases` | `[{ "name", "expected", "result": "PASS" \| "FAIL …" }]` |
159
+ | `acceptance` | `[{ "criterion", "result": "PASS" \| "FAIL", "evidence" }]` |
160
+ | `problems` | `[{ "attempt": "1", "failed", "cause", "fix" }]` |
161
+ | `liveCheck` | what was looked at, where, at what resolution, how it was judged |
162
+ | `notes` | `["…"]` — anything a maintainer should know, one string per point |
163
+ | `timing` | `{ "build": 12, "verify": 6, "fix": 4 }` — minutes |
164
+
165
+ ## Snapshot shapes
166
+
167
+ Any list of snapshots may mix them. `source` names where the image came from: `"browser"`, `"unity"`,
168
+ `"blender"`, `"reference"`.
169
+
170
+ | Shape | Use | Fields |
171
+ |---|---|---|
172
+ | progression | the build told stage by stage, from the same camera, in the order it happened | `{ "title", "caption", "source", "frames": [{ "src", "stage", "caption", "task", "at" }], "updates" }` |
173
+ | comparison | one change, side by side (drag slider) | `{ "title", "caption", "source", "before": { "src", "caption" }, "after": { "src", "caption" }, "updates" }` |
174
+ | still | one image that proves one thing | `{ "title", "caption", "source", "src", "updates" }` |
175
+
176
+ ## `<slug>_live.js` fields
177
+
178
+ "What are you doing right now?" — answered on the page without asking. Whoever is doing the work rewrites
179
+ this file whole: the implementer while it builds, the verifier while it checks, the orchestrator between them —
180
+ at every meaningful step (starting a task, each milestone inside it, before a build / export / bake / capture /
181
+ test run, a fix attempt, the hand-over to the verifier, the commit). A 20-minute silence shows as a warning.
182
+ The page shows it only while `status` is `in-progress`.
183
+
184
+ | Field | Meaning |
185
+ |---|---|
186
+ | `updatedAt` | `"YYYY-MM-DD HH:MM"` from the shell clock |
187
+ | `phase` | the current phase number |
188
+ | `task` | the task being worked on; `""` between tasks |
189
+ | `title` | only when there is no task: `"Verifying phase 1"`, `"Committing phase 1"` |
190
+ | `role` | `implementer` · `verifier` · `orchestrator` |
191
+ | `activity` | one plain-language sentence on what is happening this minute |
192
+ | `source` | `agent` (an agent wrote it) or `watchdog` (a heartbeat written because the agent was quiet — the page tags it) |
193
+ | `steps` | `[{ "at": "HH:MM", "text" }]` — the current task's log, oldest first; start fresh for each task, keep the last 12. Plain language a non-developer follows: "Painting the road mask from the spline", not "edit RoadNetwork.ts L120" |
@@ -1,25 +1,9 @@
1
- /*
2
- * Feature Dashboard live status — .agents/specs/<slug>/documents/<slug>_live.js
3
- *
4
- * "What are you doing right now?" — answered on the page without asking. Whoever is doing the work writes
5
- * this file: the implementer while it builds, the verifier while it checks, the orchestrator between them.
6
- * Rewrite the WHOLE file each time (it is small; never patch it in place) at every meaningful step:
7
- * starting a task, each milestone inside it, starting a build / export / capture / test run, a fix attempt,
8
- * handing over to the verifier, committing. A quiet gap of 20 minutes shows as a warning on the page.
9
- *
10
- * Rules: valid JavaScript, one assignment. `updatedAt` is the shell clock, "YYYY-MM-DD HH:MM".
11
- * `steps` is the current task's log, oldest first — start a fresh list when a new task starts; keep the
12
- * last 12. Plain language a non-developer understands: "Painting the road mask from the spline", not
13
- * "edit RoadNetwork.ts L120". The page shows it only while the dashboard's status is "in-progress".
14
- */
15
1
  window.FEATURE_LIVE = {
16
- updatedAt: "2026-01-01 09:00",
17
- phase: 1,
18
- task: "T1", // the task being worked on; "" between tasks
19
- title: "", // only when no task: e.g. "Verifying phase 1", "Committing phase 1"
20
- role: "implementer", // implementer | verifier | orchestrator
21
- activity: "One sentence: what is happening this minute.",
22
- steps: [
23
- { at: "09:00", text: "Started T1 — read the plan's task block and the files it touches." }
24
- ]
2
+ "updatedAt": "2026-01-01 09:00",
3
+ "phase": 1,
4
+ "task": "",
5
+ "title": "Plan written — waiting for bt-execute",
6
+ "role": "orchestrator",
7
+ "activity": "",
8
+ "steps": []
25
9
  };
@@ -22,7 +22,7 @@ Turn a feature spec into `.agents/specs/<slug>/documents/<slug>_plan.md`: an ord
22
22
  ## Ground rules
23
23
 
24
24
  - **TIME MATTERS** — on by default; `--no-time-limit` turns it off. Treat the arguments as ending with `TIME MATTERS`: the user is waiting on this run, so finish quickly — research only what the plan needs, keep subagents few and their questions narrow, and do not re-read what you already have. Begin every subagent prompt with `TIME MATTERS.` Print `⏱️ [bt-plan] TIME MATTERS` at the start (`--no-time-limit`: print `⏱️ [bt-plan] No time limit`, and do not add it). Speed never skips a required step, the Heavy Plan cold-context audit, or anything the plan needs to be complete.
25
- - **Planning only — in every mode.** Research read-only; the only files you write are the plan and the dashboard (`dashboard.html` and its data files) in the feature folder. 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.
25
+ - **Planning only — in every mode.** Research read-only; the only files you write are the plan and the dashboard (`dashboard.html` and its data files) in the feature folder, plus the one `.gitignore` line Step 4 names. 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.
26
26
  - **Babylon work:** if you have not read the Babylon Toolkit Agent Reference in this session, fetch and read it once: https://raw.githubusercontent.com/babylontoolkit/agent/main/reference.md — the authority for conventions and API; fetch sub-documents only when relevant, and again only if a context compaction made you forget it. If the fetch fails, stop and tell the user — do not guess at the API.
27
27
  - **Say what you are doing.** Before any step that takes more than a few seconds print one short line — `🔎 [bt-plan] <what> …` — and one when it returns; one line per subagent going out and coming back. A silent run looks like a hang and gets cancelled.
28
28
  - **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.
@@ -130,8 +130,9 @@ Each task above is a checkbox. To implement:
130
130
  Print `🗂️ [bt-plan] Writing the feature dashboard …`. From bt-execute's `templates/dashboard/` *(where skills load through a tool: `load_skill('bt-execute')` + `read_skill_resource`; where they are files: the sibling `bt-execute/` folder in the skills directory this skill was loaded from)*:
131
131
 
132
132
  - copy `dashboard.html` to `.agents/specs/<slug>/dashboard.html`, replacing `{{slug}}` with the slug and changing nothing else;
133
- - write `.agents/specs/<slug>/documents/<slug>_dashboard.js` following `dashboard.template.js` (its header comment is the schema): `feature` (title, slug, branch, `origin` `spec` or `quick-plan`, size, proof, a plain-language summary), `documents` (Spec — omitted for a Quick Plan — and Plan), `status: "planned"`, `updatedAt` from the shell clock (`date '+%Y-%m-%d %H:%M'`; with no shell, the current local time), `estimate` (the Total line), every phase and task from the plan as `pending` (id, title, kind from the estimate table, verify level), an empty `afterAction` and no snapshots, the plan's Decisions as `decisions` (Heavy Plan; otherwise the spec's), and one `activity` line: `Plan written — <n> tasks in <k> phases, estimated <range>`;
134
- - write `.agents/specs/<slug>/documents/<slug>_live.js` following `live.template.js`: no task, `role: "orchestrator"`, `title: "Plan written — waiting for bt-execute"`, no steps (bt-execute rewrites it at every step of a run).
133
+ - write `.agents/specs/<slug>/documents/<slug>_dashboard.js` from the starter `dashboard.template.js`, written whole as strict JSON behind its `window.FEATURE_DASHBOARD =` prefix — double-quoted keys, no comments, no trailing commas (`data-schema.md` documents every field): `feature` (title, slug, branch, `origin` `spec` or `quick-plan`, size, proof, a plain-language summary), `documents` (Spec — omitted for a Quick Plan — and Plan), `status: "planned"`, `updatedAt` from the shell clock (`date '+%Y-%m-%d %H:%M'`; with no shell, the current local time), `estimate` (the Total line), every phase and task from the plan as `pending` (id, title, kind from the estimate table, verify level), an empty `afterAction` and no snapshots, the plan's Decisions as `decisions` (Heavy Plan; otherwise the spec's), and one `activity` line: `Plan written — <n> tasks in <k> phases, estimated <range>`;
134
+ - write `.agents/specs/<slug>/documents/<slug>_live.js` from `live.template.js`, the same way (whole, strict JSON): no task, `role: "orchestrator"`, `title: "Plan written — waiting for bt-execute"`, no steps (bt-execute rewrites it at every step of a run).
135
+ - in a git repository, make sure `.gitignore` (at the repository root) contains the line `.agents/specs/*/documents/*_live.js` — append it once if missing. The live file is rewritten at every step of a run and is not history worth keeping; `<slug>_dashboard.js` is, and stays tracked. A live file git already tracks is left as it is.
135
136
 
136
137
  Re-planning an existing feature rewrites the data file's phases and tasks from the new plan but keeps the results of tasks already done, its `afterAction` and its `activity` history, adding a `Plan revised` line; new tasks are `pending` with an `updates` note, and a `complete` status becomes `paused`. If the template cannot be found, skip the dashboard and say so — bt-execute creates it on its first run.
137
138