viepilot 2.23.0 → 2.45.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +288 -0
  2. package/README.md +6 -6
  3. package/bin/viepilot.cjs +140 -1
  4. package/bin/vp-tools.cjs +204 -0
  5. package/docs/brainstorm/session-2026-04-20.md +261 -0
  6. package/docs/brainstorm/session-2026-04-24.md +131 -0
  7. package/docs/brainstorm/session-2026-04-25.md +109 -0
  8. package/docs/skills-reference.md +22 -0
  9. package/docs/user/features/adapters.md +2 -2
  10. package/docs/user/features/scaffold-first.md +62 -0
  11. package/docs/user/features/skill-registry.md +125 -0
  12. package/lib/adapters/antigravity.cjs +5 -4
  13. package/lib/domain-packs/ai-product.json +33 -0
  14. package/lib/domain-packs/data-science.json +33 -0
  15. package/lib/domain-packs/devops.json +33 -0
  16. package/lib/domain-packs/mobile.json +33 -0
  17. package/lib/domain-packs/web-saas.json +33 -0
  18. package/lib/skill-installer.cjs +274 -0
  19. package/lib/skill-registry.cjs +212 -0
  20. package/lib/viepilot-calibrate.cjs +279 -0
  21. package/lib/viepilot-persona.cjs +446 -0
  22. package/lib/viepilot-update.cjs +113 -0
  23. package/package.json +1 -1
  24. package/skills/vp-audit/SKILL.md +67 -9
  25. package/skills/vp-auto/SKILL.md +54 -0
  26. package/skills/vp-brainstorm/SKILL.md +124 -2
  27. package/skills/vp-crystallize/SKILL.md +82 -0
  28. package/skills/vp-debug/SKILL.md +37 -0
  29. package/skills/vp-design/SKILL.md +219 -0
  30. package/skills/vp-docs/SKILL.md +37 -0
  31. package/skills/vp-evolve/SKILL.md +69 -6
  32. package/skills/vp-info/SKILL.md +37 -0
  33. package/skills/vp-pause/SKILL.md +37 -0
  34. package/skills/vp-persona/SKILL.md +207 -0
  35. package/skills/vp-proposal/SKILL.md +37 -0
  36. package/skills/vp-request/SKILL.md +62 -6
  37. package/skills/vp-resume/SKILL.md +37 -0
  38. package/skills/vp-rollback/SKILL.md +61 -1
  39. package/skills/vp-skills/SKILL.md +311 -0
  40. package/skills/vp-status/SKILL.md +37 -0
  41. package/skills/vp-task/SKILL.md +37 -0
  42. package/skills/vp-ui-components/SKILL.md +37 -0
  43. package/skills/vp-update/SKILL.md +37 -0
  44. package/templates/phase/TASK.md +7 -0
  45. package/templates/project/PROJECT-CONTEXT.md +76 -0
  46. package/workflows/audit.md +131 -0
  47. package/workflows/autonomous.md +199 -0
  48. package/workflows/brainstorm.md +1172 -9
  49. package/workflows/crystallize.md +639 -3
  50. package/workflows/design.md +601 -0
  51. package/workflows/evolve.md +9 -0
  52. package/workflows/rollback.md +79 -10
@@ -32,6 +32,180 @@ If the user writes in a different language during the session, that takes preced
32
32
  If `~/.viepilot/config.json` is absent, default to `en` — do not fail.
33
33
  </step>
34
34
 
35
+ <step name="persona_domain_pack">
36
+ ## 0B. Persona Domain Pack Integration (ENH-073)
37
+
38
+ At session start, before presenting topics, run:
39
+ ```bash
40
+ node "$HOME/.claude/viepilot/bin/vp-tools.cjs" persona auto-switch
41
+ node "$HOME/.claude/viepilot/bin/vp-tools.cjs" persona context
42
+ ```
43
+
44
+ Store the result as `PERSONA_CONTEXT`. If command unavailable or errors → `PERSONA_CONTEXT = null`, continue silently.
45
+
46
+ **If `PERSONA_CONTEXT` is available:**
47
+ 1. Read `persona.domain` — load corresponding `lib/domain-packs/{domain}.json`
48
+ - If domain is array (merged persona): load all packs and union their fields
49
+ 2. Apply to topic list:
50
+ - Prepend `extra_topics` not already in template (injected before session topics)
51
+ - Reorder template topics by `topic_priority` (matching topics float to top)
52
+ - Remove topics whose id is in `persona.brainstorm.topic_skip`
53
+ 3. When phase discussion begins: suggest `phase_template.phases` from domain pack as default ordering
54
+ 4. When Architect Design Mode activates: add domain pack `architect_pages` to workspace
55
+ 5. If `persona.confidence < 0.6`: add inline note "(persona auto-detected, may be inaccurate — run /vp-persona to refine)" — not a blocking prompt
56
+
57
+ **Persona context is silently injected into the session — no banner, no AUQ.**
58
+ </step>
59
+
60
+ <step name="detect_embedded_domain">
61
+ ## 0C. Detect Embedded Domain (ENH-071)
62
+
63
+ Scan the user's **initial message** (and, on `--continue`, the prior session content) for embedded trigger keywords.
64
+
65
+ **MCU family keywords**: `STM32`, `ESP32`, `ESP8266`, `nRF52`, `nRF5`, `AVR`, `PIC`, `RISC-V`, `Cortex-M`, `RP2040`, `MSP430`, `SAM`, `SAMD`, `LPC`, `GD32`, `CH32`
66
+
67
+ **Concept keywords**: `firmware`, `bare-metal`, `microcontroller`, `embedded`, `GPIO`, `interrupt`, `HAL`, `bootloader`, `RTOS`, `FreeRTOS`, `Zephyr`, `ThreadX`, `ChibiOS`, `RT-Thread`, `linker`, `peripheral`, `UART`, `SPI`, `I2C`, `CAN`, `watchdog`, `flash memory`, `memory map`, `ISR`, `DMA`, `PWM`, `ADC`, `DAC`, `MCU`, `SoC`
68
+
69
+ **Activation rule**: `≥2` keyword matches (across both lists) → set `embedded_domain: true`
70
+
71
+ **Manual override**: `--domain embedded` flag → set `embedded_domain: true` unconditionally, regardless of keyword count.
72
+
73
+ **On first activation** — show one-time banner (then suppress for rest of session):
74
+
75
+ ```
76
+ 🔌 Embedded Domain Mode activated
77
+ Hardware topology, pin map, memory layout, RTOS scheduler,
78
+ protocol matrix, and power budget pages will be added to the
79
+ Architect workspace when relevant keywords are detected.
80
+ UI Direction web-UI suggestions are suppressed
81
+ (hardware display keywords route to hw-topology instead).
82
+ ```
83
+
84
+ **Embedded topic injections** (activate when `embedded_domain: true`):
85
+ - MCU/Toolchain sub-topic probes → added to tech-stack section (§ Gap 2)
86
+ - RTOS/Scheduling topic → added after architecture/components (§ Gap 3)
87
+ - Power Budget topic → triggered by battery/sleep/power keywords (§ Gap 7)
88
+ - Safety/Compliance topic → triggered by safety/watchdog/SIL/ASIL keywords (§ Gap 10)
89
+ - Firmware Phase Template → offered at phase assignment step (§ Gap 9)
90
+
91
+ ---
92
+
93
+ ### Embedded Topic Probes (ENH-071)
94
+
95
+ #### MCU/Toolchain Sub-Topic (Gap 2)
96
+ When `embedded_domain: true`, after general tech-stack questions, inject:
97
+
98
+ ```
99
+ 🔌 Embedded Toolchain — let's capture your hardware/toolchain choices:
100
+
101
+ 1. MCU/SoC family?
102
+ (STM32 / ESP32 / nRF52 / RISC-V / AVR / RP2040 / SAM / other)
103
+ 2. Toolchain?
104
+ (GCC-ARM / Clang / IAR Embedded Workbench / Keil MDK / other)
105
+ 3. Build system?
106
+ (CMake / Make / PlatformIO / West (Zephyr) / Arduino / other)
107
+ 4. Debug interface?
108
+ (SWD / JTAG / UART-bootloader / ESP ROM bootloader / other)
109
+ 5. Flasher/debugger tool?
110
+ (OpenOCD / J-Link / ST-Link / Black Magic Probe / esptool / other)
111
+ 6. SDK/HAL?
112
+ (STM32 HAL+LL / ESP-IDF / nRF5 SDK / Zephyr west / Arduino framework / vendor BSP / custom)
113
+ ```
114
+
115
+ → Store responses in `notes.md ## embedded_toolchain` YAML section.
116
+
117
+ #### RTOS/Scheduling Topic (Gap 3)
118
+ When `embedded_domain: true`, add as a brainstorm topic after architecture/components:
119
+
120
+ ```
121
+ 🔌 RTOS & Scheduling — describe your execution model:
122
+
123
+ 1. Execution model?
124
+ (bare-metal super-loop / bare-metal interrupt-driven / RTOS)
125
+ 2. If RTOS: which one?
126
+ (FreeRTOS / Zephyr / ThreadX (Azure RTOS) / RT-Thread / ChibiOS / other)
127
+ 3. Tasks/threads needed?
128
+ (for each: name, period or event-driven, priority 1–10, estimated stack KB)
129
+ 4. ISR table?
130
+ (interrupt source, handler function, priority level 0=highest)
131
+ 5. Shared resource protection?
132
+ (mutex / semaphore / critical section / taskENTER_CRITICAL / spinlock)
133
+ 6. Hard real-time constraints?
134
+ (any response-time budget in µs or ms?)
135
+ ```
136
+
137
+ → Store in `notes.md ## rtos_config` YAML section.
138
+
139
+ #### Power Budget Topic (Gap 7)
140
+ **Trigger**: battery / sleep / power / current / µA / mAh / Standby / Stop / Shutdown / Hibernate / IoT / LoRa keywords in session AND `embedded_domain: true`
141
+
142
+ ```
143
+ 🔋 Power Budget — capture power management requirements:
144
+
145
+ 1. Power supply?
146
+ (battery: chemistry + capacity mAh / USB / DC adapter / energy harvesting)
147
+ 2. Active mode target current? (mA)
148
+ 3. Sleep strategy: which MCU sleep mode?
149
+ (Stop / Standby / Shutdown / Hibernate / vendor-specific)
150
+ 4. Which peripherals stay active during sleep?
151
+ (RTC / LoRa / BLE / ADC / none)
152
+ 5. Wake-up sources?
153
+ (RTC timer / GPIO interrupt / UART wakeup / WDT)
154
+ 6. Target battery lifetime? (hours / days / months)
155
+ ```
156
+
157
+ → Store in `notes.md ## power_budget` YAML section.
158
+
159
+ #### Safety/Compliance Topic (Gap 10)
160
+ **Trigger**: safety / watchdog / fault / SIL / ASIL / IEC / ISO 26262 / DO-178 / EN 50128 / safety-critical keywords in session
161
+
162
+ ```
163
+ 🛡️ Safety & Compliance — capture safety requirements:
164
+
165
+ 1. Safety standard?
166
+ (IEC 61508 SIL 1–4 / ISO 26262 ASIL A–D / DO-178C / EN 50128 / none)
167
+ 2. Watchdog configuration?
168
+ (IWDG / WWDG / timeout value ms / pet strategy)
169
+ 3. Stack overflow detection?
170
+ (MPU / FreeRTOS stack check / canary / none)
171
+ 4. Fault handler strategy?
172
+ (HardFault / MemManage / BusFault → reset / safe state / log + continue)
173
+ 5. Safe state definition?
174
+ (what is the safe fallback on error detection?)
175
+ 6. Diagnostic coverage requirements? (if applicable)
176
+ ```
177
+
178
+ → Store in `notes.md ## safety_config` YAML section.
179
+
180
+ #### Firmware Phase Ordering Template (Gap 9)
181
+ When `embedded_domain: true`, at the **Phase Assignment** step, offer the standard firmware phase template before free-form phase entry:
182
+
183
+ ```
184
+ 🔌 Firmware Phase Template — suggested ordering for embedded projects
185
+ (customize: remove, merge, or rename phases as needed):
186
+
187
+ Phase 1: Board Bring-Up
188
+ (clock config, GPIO init, UART console, LED blink, JTAG/SWD verify)
189
+ Phase 2: Driver Layer
190
+ (all peripheral drivers from hw-topology: SPI, I2C, UART, CAN, ADC, PWM, etc.)
191
+ Phase 3: RTOS Configuration
192
+ (task creation, queues, semaphores, heap sizing, stack overflow detection)
193
+ Phase 4: Middleware & Protocols
194
+ (MQTT/BLE/LoRa stack, filesystem/NVS, OTA bootloader, custom protocols)
195
+ Phase 5: Application Logic
196
+ (state machines, business logic, data processing, sensor fusion)
197
+ Phase 6: Integration & System Test
198
+ (hardware-in-the-loop, timing verification, stress test, power measurement)
199
+ Phase 7: OTA & Production
200
+ (bootloader signing, provisioning flow, factory test jig, final firmware)
201
+
202
+ 1. Use this template (customize as needed)
203
+ 2. Enter phases manually
204
+ ```
205
+
206
+ → Store phases in `notes.md ## phases` with `domain: embedded` tag.
207
+ </step>
208
+
35
209
  <step name="detect_sessions">
36
210
  ## 1. Detect Previous Sessions
37
211
 
@@ -80,6 +254,86 @@ If the user chooses to continue:
80
254
  5. If the session already has a **`## Phases`** section: briefly summarize existing phases; all subsequent updates must **merge** into that section (no silent deletion) unless the user explicitly requests narrowing/expanding scope.
81
255
  </step>
82
256
 
257
+ <step name="upgrade_gap_detection">
258
+ ### Step 3B: Upgrade Gap Detection (ENH-067)
259
+
260
+ **Runs immediately after step 3 (Load Context) when user is continuing an existing session.**
261
+
262
+ #### Trigger conditions — ALL must be true:
263
+ - Session `workflow_version` is absent **OR** older than current ViePilot version
264
+ - Session `upgrade_supplement_version` is absent **OR** older than current ViePilot version
265
+ - (Prevents re-surfacing already-supplemented topics on subsequent opens)
266
+
267
+ Resolve current ViePilot version: `node bin/vp-tools.cjs info` → `version` field.
268
+
269
+ #### Gap computation — version threshold table:
270
+
271
+ | Introduced in | Topic | Detection heuristic (false-positive guard) |
272
+ |--------------|-------|---------------------------------------------|
273
+ | v2.32.0 | Topic 6: Admin & Governance (ENH-063) | session has no `## Admin` section AND no `admin:` YAML block |
274
+ | v2.33.0 | Topic 7: Content Management (ENH-065) | session has no `## Content` section AND no `content_types:` YAML block |
275
+ | v2.34.0 | Topic 8: User Data Management (ENH-066) | session has no `## User Data` section AND no `profile_fields:` YAML block |
276
+
277
+ Always cross-check: even if the version threshold says a topic should be missing, confirm it
278
+ is actually absent from the session file before listing it as a gap. This avoids false positives
279
+ for users who added content manually or partially covered the topic under a different heading.
280
+
281
+ #### Upgrade banner
282
+
283
+ **Claude Code (terminal) — REQUIRED:**
284
+ ```
285
+ question: "🔄 Upgrade gap detected — session was created with ViePilot v{old}, current is v{new}.\nMissing topics: {comma-separated list}. Discuss these gaps now?"
286
+ header: "Upgrade"
287
+ options:
288
+ - label: "Yes — discuss now (Recommended)"
289
+ description: "Run Q&A for missing topics inline; append ## Upgrade supplement to session"
290
+ - label: "Remind me at /save"
291
+ description: "Continue session normally; re-surface gap at /save"
292
+ - label: "Skip"
293
+ description: "Ignore gaps for this session"
294
+ ```
295
+
296
+ **Text fallback (Cursor / Codex / other):**
297
+ ```
298
+ 🔄 Upgrade gap detected (v{old} → v{new})
299
+ Missing topics: {list}
300
+
301
+ 1. Discuss gaps now (Recommended)
302
+ 2. Remind me at /save
303
+ 3. Skip
304
+ ```
305
+
306
+ #### On "Yes — discuss now"
307
+
308
+ Run only the Q&A sub-questions for each missing topic (re-use the relevant topic block from
309
+ **Topics Template** in step 4). After completing Q&A for all missing topics, append the results
310
+ to the session file under a clearly delimited section:
311
+
312
+ ```markdown
313
+ ## Upgrade supplement (v{old} → v{new})
314
+ *Added {YYYY-MM-DD} after upgrading ViePilot to v{new}*
315
+
316
+ ### Topic 6: Admin & Governance [include only if this topic was missing]
317
+ {Q&A results using Admin & Governance topic format}
318
+
319
+ ### Topic 7: Content Management [include only if this topic was missing]
320
+ {Q&A results using Content Management topic format}
321
+
322
+ ### Topic 8: User Data Management [include only if this topic was missing]
323
+ {Q&A results using User Data Management topic format}
324
+ ```
325
+
326
+ After appending:
327
+ 1. Set `upgrade_supplement_version: "{current}"` in the session's `## Session Info` block
328
+ 2. Suggest: "Supplement complete — run `/vp-crystallize --upgrade` to patch your project artifacts"
329
+
330
+ #### On "Remind at /save"
331
+ Store the pending gap list. Re-surface the same AUQ at `/save` before writing the session file.
332
+
333
+ #### On "Skip"
334
+ Proceed normally. Do **not** set `upgrade_supplement_version` — gap will re-surface on next open.
335
+ </step>
336
+
83
337
  <step name="brainstorm_mode">
84
338
  ## 4. Brainstorm Mode
85
339
 
@@ -117,7 +371,54 @@ Suggested topics to brainstorm:
117
371
  - Monitoring
118
372
  - Scaling
119
373
 
120
- 6. **Phase assignment (ENH-030):** during brainstorm, each feature/capability is assigned to a specific **phase** — Phase 1, Phase 2, Phase 3... Do not use MVP/Post-MVP/Future tiers. If the user has not stated a phase, ask: “Which phase would you like to assign this feature to?”
374
+ 6. **Admin & Governance**
375
+ - Who are the admin personas? (super-admin, org-admin, ops team, support agent)
376
+ - User & Role management? (invite users, deactivate, RBAC/ABAC, permission matrix)
377
+ - Monitoring dashboard? (system health, error rates, latency, active users, SLA targets)
378
+ - Audit log requirements? (which actions must be tracked? retention period? compliance?)
379
+ - Billing & subscription management? (plans, invoices, upgrade/downgrade, payment history)
380
+ - Rate limiting / quota per tier? (API call limits, storage quotas, feature limits)
381
+ - Feature flags / runtime configuration? (kill switches, A/B toggles, env settings)
382
+ - Reporting & data export? (business metrics, usage analytics, CSV/Excel export)
383
+ - Notification management? (email/push templates, delivery log, unsubscribe management)
384
+
385
+ 7. **Admin Entity Management** (ENH-068)
386
+ - Which DB entities / domain objects need admin CRUD interfaces? (e.g., products, orders, categories, tenants, campaigns, bookings…)
387
+ - For each entity: which operations are needed? (Create / Read / Update / Delete / List)
388
+ - **List view** requirements: columns displayed, default sort, pagination style (offset vs. cursor), search & filter fields, range filters (date, price), multi-select filters
389
+ - **Bulk actions**: bulk delete, bulk status change, bulk export — which entities need these?
390
+ - **Create/Edit form**: required vs. optional fields, validation rules, nested relation fields (e.g., product → category), rich text / file upload fields, inline vs. separate page, auto-save / draft mode needed?
391
+ - **Delete semantics**: hard delete vs. soft delete (`is_deleted` / `deleted_at`); cascade rules for related records; restore / undelete capability needed?
392
+ - **Import / Export**: CSV/XLSX import for bulk seeding (e.g., product catalog); export filtered data from list views to CSV/XLSX/JSON; import validation error reporting
393
+ - **Audit trail per entity**: which entities need change history (actor + timestamp + field diff)? Separate audit table vs. event-sourced approach; surfaced in admin UI or log-only?
394
+ - **Admin ownership scoping**: are entities scoped per tenant/org (multi-tenant)? Can org_admin see only their org's data while super_admin sees all?
395
+ - **Read-only vs. editable entities**: which entities are system-generated (read-only in admin) vs. admin/user-generated (editable)?
396
+
397
+ 8. **Content Management**
398
+ - What types of content exist in this system? (articles, products, pages, media, courses, listings, FAQs...)
399
+ - Who creates content? (admin only, verified users, any user, API import)
400
+ - Content lifecycle? (draft → review → published → archived)
401
+ - Rich text or structured fields? (WYSIWYG, markdown, JSON schema, headless CMS API)
402
+ - Media management? (image upload, video, file attachments, CDN, storage limits per plan)
403
+ - Taxonomy & organization? (categories, tags, collections, folders, hierarchical tree)
404
+ - Multi-language / localization? (which locales, translation workflow, fallback strategy)
405
+ - Search & filtering? (full-text search, faceted filters, sort options, relevance tuning)
406
+ - Content versioning / history? (rollback, diff view, scheduled publish, expiry)
407
+ - SEO fields? (slug, meta title, meta description, OG image, canonical URL, sitemap)
408
+
409
+ 9. **User Data Management**
410
+ - What user data does the system store? (profile, preferences, history, uploads)
411
+ - Profile management? (edit name/avatar/email/password, delete account)
412
+ - Notification preferences? (email, push, SMS — per channel and frequency)
413
+ - Privacy & data controls? (view my data, export data, right-to-erasure / GDPR delete)
414
+ - Activity history? (login history, action log, what user can see about themselves)
415
+ - Connected accounts / integrations? (OAuth providers, third-party app connections, revoke access)
416
+ - Session & device management? (active sessions list, sign out all devices)
417
+ - Two-factor authentication? (TOTP, SMS, backup codes)
418
+ - Consent management? (cookie consent, marketing opt-in, terms acceptance log)
419
+ - Data retention policy? (how long data is kept, anonymization after deletion)
420
+
421
+ 10. **Phase assignment (ENH-030):** during brainstorm, each feature/capability is assigned to a specific **phase** — Phase 1, Phase 2, Phase 3... Do not use MVP/Post-MVP/Future tiers. If the user has not stated a phase, ask: “Which phase would you like to assign this feature to?”
121
422
 
122
423
  ### Interactive Q&A
123
424
  For each topic:
@@ -127,6 +428,46 @@ For each topic:
127
428
  4. Suggest alternatives if needed
128
429
  5. Record decisions
129
430
 
431
+ ### Mid-session Structured Choice Rule (BUG-022)
432
+
433
+ When presenting a decision with **≥2 discrete named options** during Q&A (e.g. "Hero first
434
+ or Features section?", "lean into multi-adapter or persona angle?", any numbered choice set),
435
+ use adapter-aware prompts:
436
+
437
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion`. AUQ spec:
438
+ > - question: "{The direction/decision question}"
439
+ > - header: "{short label, ≤12 chars}"
440
+ > - options: one entry per discrete choice (2–4 options per AUQ call)
441
+ > - multiSelect: false (unless user explicitly wants multi-select)
442
+ > **Cursor / Codex / Antigravity / Copilot:** present as plain numbered list.
443
+
444
+ **Exempt from AUQ** (remain plain conversational text):
445
+ - Open-ended questions with no discrete choices ("Anything else you'd like to add?")
446
+ - Follow-up clarification questions ("Tell me more about X")
447
+ - Questions where the expected answer is a free-form description
448
+
449
+ **AUQ per decision, not per topic:** One AUQ call per structured decision point.
450
+ Do not bundle multiple unrelated decisions into a single AUQ call.
451
+
452
+ ### Mid-session Transition Prompt Rule (BUG-023)
453
+
454
+ When the AI offers **session-flow choices** at a section or topic boundary — after presenting
455
+ a table, completing an analysis, or finishing a discussion topic — use adapter-aware prompts:
456
+
457
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion`. Canonical AUQ spec:
458
+ > - question: "What would you like to do next?"
459
+ > - header: "Next step"
460
+ > - options (vary by context; always ≥2):
461
+ > - label: "Save session → /vp-crystallize", description: "Generate implementation specs"
462
+ > - label: "Update UI Direction artifacts", description: "Update index.html/notes.md now"
463
+ > - label: "Continue discussing", description: "Explore another section or topic"
464
+ > - multiSelect: false
465
+ > **Cursor / Codex / Antigravity / Copilot:** present as plain numbered list.
466
+
467
+ **Scope:** session-FLOW control choices only — distinct from BUG-022 (Q&A content/direction
468
+ decisions during Q&A). Triggered when offering: save/crystallize, update artifacts, or
469
+ continue/discuss more. NOT triggered for content questions about what to build or design.
470
+
130
471
  ### Landing Page Deep-Dive (activated contextually)
131
472
  If the user is brainstorming a landing page / homepage / marketing page:
132
473
 
@@ -182,6 +523,118 @@ If the user is brainstorming a project with UI/UX or requests a visual design:
182
523
  - Update HTML/CSS direction directly
183
524
  - Record decision + rationale in `notes.md` (single source of truth for design intent)
184
525
 
526
+ ### Design Token Extraction (ENH-076)
527
+
528
+ **Trigger:** UI Direction Mode active (`--ui` flag) OR ≥2 design keywords detected in session:
529
+ `color` / `font` / `brand` / `spacing` / `typography` / `palette` / `theme` / `style`
530
+
531
+ **Extraction process:**
532
+ During Q&A, AI tracks design decisions and maps them to a TOKEN_MAP:
533
+ - Color mentions → `tokens.colors.*` (primary, surface, accent, error, success, warning)
534
+ - Font/typeface mentions → `tokens.typography.fontFamily`, `fontSize`
535
+ - Size/scale/rhythm mentions → `tokens.spacing.base`, `tokens.spacing.scale`
536
+ - Roundness/corner mentions → `tokens.rounded.*` (sm/md/lg/full)
537
+
538
+ **Output — `.viepilot/ui-direction/{session-id}/design.md`** (Design.MD v1 spec):
539
+ ```yaml
540
+ ---
541
+ name: "{project-name}"
542
+ description: "{one-line brand description from session}"
543
+ colors:
544
+ primary: "{hex}"
545
+ surface: "{hex}"
546
+ accent: "{hex}"
547
+ typography:
548
+ fontFamily: "{font}, sans-serif"
549
+ fontSize:
550
+ base: 16
551
+ spacing:
552
+ base: 8
553
+ scale: [4, 8, 16, 24, 32, 48]
554
+ rounded:
555
+ sm: 4px
556
+ md: 8px
557
+ ---
558
+
559
+ ## Overview
560
+ {Brand personality extracted from session}
561
+
562
+ ## Colors
563
+ {Color rationale from session decisions}
564
+
565
+ ## Typography
566
+ {Font rationale from session decisions}
567
+ ```
568
+
569
+ **notes.md section added** (append to session notes.md):
570
+ ```yaml
571
+ ## design_tokens
572
+ colors:
573
+ primary: "{hex}"
574
+ typography:
575
+ fontFamily: "{font}"
576
+ spacing_base: 8
577
+ design_md_path: .viepilot/ui-direction/{session-id}/design.md
578
+ design_md_generated: true
579
+ ```
580
+
581
+ **After generation:** Show inline summary:
582
+ ```
583
+ 🎨 Design.MD generated: primary={hex} | font={font} | spacing={n}px
584
+ Path: .viepilot/ui-direction/{session-id}/design.md
585
+ ```
586
+
587
+ **Incremental updates:** If user refines a color or font later in the session, update
588
+ `design.md` and `notes.md ## design_tokens` in place (same as how `index.html` is updated
589
+ incrementally as design decisions evolve).
590
+
591
+ ### Skill Registry Integration (FEAT-020)
592
+
593
+ **Trigger**: UI Direction Mode is active (at least one HTML file being generated or updated).
594
+
595
+ **Step — Load registry:**
596
+ ```bash
597
+ node ~/.claude/viepilot/bin/vp-tools.cjs get-registry 2>/dev/null \
598
+ || node ~/.cursor/viepilot/bin/vp-tools.cjs get-registry 2>/dev/null \
599
+ || cat ~/.viepilot/skill-registry.json 2>/dev/null
600
+ ```
601
+ Parse JSON output → extract `skills[]`.
602
+ If output is `null` or command fails: skip silently — no warning, no prompt
603
+
604
+ **Step — Match skills to UI signals:**
605
+ Map brainstorm UI signal keywords to capability tags:
606
+
607
+ | UI Signal keywords | Capability match |
608
+ |-------------------|-----------------|
609
+ | `component`, `layout`, `screen`, `page`, `UI`, `UX` | `ui-generation`, `component-design` |
610
+ | `responsive`, `mobile`, `grid` | `responsive-layout` |
611
+ | `design`, `theme`, `color`, `typography` | `design-system`, `design-tokens` |
612
+ | `form`, `button`, `input`, `modal` | `component-design` |
613
+
614
+ For each registered skill: if `skill.capabilities` intersects matched capability tags → skill is **active**.
615
+
616
+ **Step — Silent apply:**
617
+ - For each active skill: prepend `skill.best_practices[]` to the context used for HTML generation
618
+ - **No banner, no prompt, no mention to user** — best practices blend into generated output
619
+ - This is background-only, like Background UI Extraction (ENH-026)
620
+
621
+ **Step — Record in notes.md:**
622
+ After the session's first UI artifact is generated (or updated), append to `notes.md`:
623
+
624
+ ```yaml
625
+ ## skills_used
626
+ - id: frontend-design
627
+ version: null
628
+ trigger: ui-generation signal
629
+ applied_at: brainstorm-session
630
+ best_practices_applied:
631
+ - Mobile-first
632
+ - Design tokens
633
+ ```
634
+
635
+ If `## skills_used` already exists: merge (add new skills, update applied_at).
636
+ If no skills matched or registry absent: omit `## skills_used` section.
637
+
185
638
  **Required hook (multi-page only)**
186
639
 
187
640
  When the `pages/` directory exists or any `pages/*.html` is added / renamed / removed:
@@ -196,6 +649,84 @@ When the `pages/` directory exists or any `pages/*.html` is added / renamed / re
196
649
  - adjustments according to product objectives
197
650
  4. Keep the prototype at a directional description level; do not force production-ready code at the brainstorm stage.
198
651
 
652
+ ### Recommended Breakdown Ordering (ENH-061)
653
+
654
+ For sessions that produce both system architecture and UI/UX artifacts, follow this sequence to ensure complete idea→architect+UI breakdown:
655
+
656
+ ```
657
+ Step 1: Free idea collection
658
+ → Explore the problem space; no structure required yet
659
+
660
+ Step 2: Scope lock + Phase assignment (existing)
661
+ → Assign all features to Phase 1 / Phase 2 / Phase 3...
662
+ → Fill ## Phases in session draft
663
+
664
+ Step 2B: Workspace Mode Selection (BUG-018)
665
+ → After scope lock, before any design workspace is created
666
+ → AUQ: Both / Architect only / UI Direction only / Neither
667
+
668
+ Step 3: Feature → Coverage mapping (ENH-061)
669
+ → For each Phase 1 feature: name the architect component AND UI screen
670
+ → Output: ## Coverage matrix in notes.md
671
+
672
+ Step 4: Architect Design (existing — only when Step 2B selects Both or Architect only)
673
+ → Fill architect workspace per coverage matrix
674
+ → Use /vp-brainstorm --architect or let heuristics fire
675
+
676
+ Step 5: Architect → UI sync (ENH-061 — arch_to_ui_sync)
677
+ → After architect edits: check which architectural decisions impact UI screens
678
+ → Prompt user to update UI Direction accordingly
679
+
680
+ Step 6: UI Direction (existing — only when Step 2B selects Both or UI Direction only)
681
+ → Fill UI workspace per coverage matrix + arch feedback
682
+ → Use /vp-brainstorm --ui or proactive 🎨 banner
683
+
684
+ Step 7: Completeness gate (ENH-061)
685
+ → Validate: every Phase 1 feature has ≥1 coverage (architect OR UI)
686
+ → Warn on any feature with no coverage in both modes
687
+
688
+ Step 8: /save → /vp-crystallize (existing)
689
+ ```
690
+
691
+ > **Note**: Steps 3–7 are optional for simple or early-stage sessions. The flow is recommended when a session produces both Architect Design and UI Direction artifacts.
692
+
693
+ ### Step 2B: Workspace Mode Selection (BUG-018)
694
+
695
+ Runs **after scope lock** (`## Phases` in session draft is populated) and **before any design workspace is created**.
696
+
697
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion` tool:
698
+ > - question: `"Scope locked. Which design workspaces would you like to activate for this session?"`
699
+ > - header: `"Workspaces"`
700
+ > - options:
701
+ > - `{ label: "Both Architect + UI Direction (Recommended)", description: "Full coverage: architecture HTML workspace + UI prototype direction per ENH-061 Breakdown Ordering" }`
702
+ > - `{ label: "Architect Design only (🏗️)", description: "System architecture, data-flow, ERD, APIs, decisions HTML workspace" }`
703
+ > - `{ label: "UI Direction only (🎨)", description: "HTML prototype direction for screens/pages" }`
704
+ > - `{ label: "Neither — text-only", description: "Continue as text brainstorm, activate workspaces manually later with --architect or --ui" }`
705
+ > - multiSelect: false
706
+ >
707
+ > **Text fallback (Cursor/Codex/Copilot/Antigravity):**
708
+ > ```
709
+ > Scope locked. Which design workspaces would you like to activate?
710
+ > 1. Both Architect + UI Direction (Recommended) — full coverage per ENH-061
711
+ > 2. Architect Design only (🏗️) — HTML architecture workspace
712
+ > 3. UI Direction only (🎨) — HTML prototype direction
713
+ > 4. Neither — text-only, activate manually later
714
+ > ```
715
+
716
+ **On selection:**
717
+ - **"Both"**: activate Architect Mode (Step 4) → arch_to_ui_sync (Step 5) → UI Direction (Step 6) — in that order
718
+ - **"Architect Design only"**: activate Architect Mode (Step 4), skip Step 6
719
+ - **"UI Direction only"**: skip Architect (Step 4), activate UI Direction (Step 6) directly
720
+ - **"Neither"**: skip both Steps 4 and 6; user can activate later with `--architect` / `--ui` flag
721
+
722
+ **Guard rule (BUG-018 fix):**
723
+ - Architect auto-activate heuristic (≥3 components / ≥1 stack mention) **MUST NOT fire independently** once Step 2B runs.
724
+ - If heuristic fires **before** scope lock: save the signal, defer prompt until Step 2B.
725
+ - If user selects **"Neither"** or **"UI Direction only"** at Step 2B: suppress Architect auto-activate for the remainder of this session.
726
+ - If user selects **"Architect Design only"** or **"Both"**: heuristic is redundant — workspace activates per selection, no second prompt.
727
+
728
+ ---
729
+
199
730
  ### Architect Design Mode (FEAT-011)
200
731
 
201
732
  Brainstorm system architecture with live HTML generation — a visual workspace for the user to review, edit, and present before running `/vp-crystallize`.
@@ -240,6 +771,9 @@ Activate Architect Design Mode so I can create an HTML visualization?
240
771
  sequence-diagram.html # Per-scenario sequences (sequenceDiagram) — ENH-029
241
772
  deployment.html # Infra, environments, CI/CD pipeline — ENH-029
242
773
  apis.html # Service API listing & design decisions — ENH-029
774
+ admin.html # Admin & governance capabilities — actor flow, role hierarchy, key operations, audit schema (ENH-063)
775
+ content.html # Content types, lifecycle state machine, creator roles, taxonomy, media/SEO schema (ENH-065)
776
+ user-data.html # User-owned data controls — profile fields, privacy rights, session management, 2FA, consent schema (ENH-066)
243
777
  style.css # Shared: dark/light CSS vars, .updated highlight, Mermaid container, responsive nav
244
778
  notes.md # Machine-readable YAML (see schema below)
245
779
  ```
@@ -263,6 +797,367 @@ Activate Architect Design Mode so I can create an HTML visualization?
263
797
  | `architecture.html` | Component structure + C4 system context + external integrations |
264
798
  | `deployment.html` | Infrastructure, environments, ops concerns, CI/CD pipeline |
265
799
  | `apis.html` | API endpoint design, HTTP methods, request/response contracts |
800
+ | `admin.html` | Admin personas, role hierarchy, key admin operations (CRUD users, billing management, audit log schema), access control model |
801
+ | `entity-mgmt.html` | Admin entity CRUD matrix: entity name, admin ops (C/R/U/D), soft delete flag, bulk actions, audit trail, multi-tenant scope; import/export summary table (ENH-068) |
802
+ | `content.html` | Content types, lifecycle states, creator permission matrix, taxonomy tree, media storage config, SEO field schema |
803
+ | `user-data.html` | User-owned data: profile field list, privacy rights matrix (export/erasure), connected OAuth providers, session/device management, 2FA config, consent log schema |
804
+ | `design.html` | Design system visual reference: color swatches grid, typography scale table, spacing grid, border-radius samples, component token table (ENH-076) |
805
+
806
+ **design.html trigger:** Architect Mode active AND (`design.md` present in session dir OR `## design_tokens` in `notes.md`).
807
+
808
+ **design.html content sections:**
809
+
810
+ 1. **Color Palette** — swatch grid: colored square + hex value + semantic label, grouped as Brand (primary/accent) | Neutral (surface/muted) | Semantic (error/success/warning)
811
+ 2. **Typography Scale** — table: Level | Font Family | Size | Weight | Line Height | Example text (H1 → H2 → H3 → Body → Caption → Code)
812
+ 3. **Spacing Grid** — visual row of boxes with increasing widths (4px, 8px, 16px, 24px, 32px, 48px), labeled spacing-1 through spacing-12
813
+ 4. **Shape / Border Radius** — 4 visual boxes showing sharp/subtle/rounded/pill radii with CSS var labels (`--rounded-sm` → `--rounded-full`)
814
+ 5. **Component Tokens** — table: Component | Token | Value (rendered only if `components:` section exists in design.md)
815
+
816
+ **Sync rule:** When `notes.md ## design_tokens` is updated (e.g. via new UI direction keywords), regenerate `design.html` sections — same incremental update pattern as other Architect pages.
817
+
818
+ **Hub nav:** Add `<a href="design.html">🎨 Design System</a>` to `index.html` nav when `design.html` is created. Update `## Pages inventory` in `notes.md`.
819
+
820
+ **Format:** Pure HTML + inline `<style>`, no external CSS/JS dependencies — consistent with all other Architect workspace pages.
821
+
822
+ #### Admin & Governance Detection (ENH-063)
823
+
824
+ **Trigger keywords** (case-insensitive, Vietnamese or English):
825
+ > `admin`, `administrator`, `back-office`, `quản trị`, `quản lý người dùng`, `user management`, `role`, `permission`, `phân quyền`, `monitor`, `monitoring`, `giám sát`, `audit log`, `audit trail`, `nhật ký`, `billing`, `subscription`, `gói cước`, `thanh toán`, `rate limit`, `quota`, `feature flag`, `feature toggle`, `report`, `reporting`, `báo cáo`, `analytics`, `phân tích`, `SLA`, `compliance`, `GDPR`, `SOC2`, `alert`, `cảnh báo`, `health check`, `observability`
826
+
827
+ **Early-session detection:**
828
+ At session start, scan initial message for admin keywords. If **≥1 keyword** found → show proactive banner:
829
+
830
+ > **Adapter-aware prompt:**
831
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion` tool. AUQ spec:
832
+ > - question: "I noticed your project may involve admin or governance capabilities. Should we discuss Admin & Governance (Topic 6)?"
833
+ > - header: "Admin & Governance"
834
+ > - options: [{ label: "Yes — explore admin panel, user management, monitoring, audit logs", description: "Recommended for multi-user/SaaS projects" }, { label: "Not needed — single-user or admin-free project", description: "" }, { label: "Later — add to notes, continue current topic", description: "" }]
835
+ >
836
+ > **Text fallback:**
837
+ > ```
838
+ > 🔐 I noticed your project may involve admin or governance capabilities.
839
+ > Should we discuss Admin & Governance (Topic 6)?
840
+ >
841
+ > 1. Yes — explore admin panel, user management, monitoring, audit logs (Recommended for multi-user/SaaS)
842
+ > 2. Not needed — single-user or admin-free project
843
+ > 3. Later — add to notes, continue current topic
844
+ > ```
845
+
846
+ **During-session detection:**
847
+ When **≥2 unique admin keywords** detected → surface confirmation:
848
+
849
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion`:
850
+ > - question: "Admin/governance signals detected in this session. Would you like to cover Admin & Governance (Topic 6)?"
851
+ > - options: [{ label: "Yes — switch to / add admin topic", description: "" }, { label: "Note in background (no topic switch)", description: "" }, { label: "Skip for this session", description: "" }]
852
+ >
853
+ > **Text fallback:** `🔐 Admin/governance signals detected. Cover Admin & Governance (Topic 6)? 1. Yes 2. Note in background 3. Skip`
854
+
855
+ **Admin coverage gate before /save:**
856
+ Before writing session file, check:
857
+ - Project has multi-user signals (`role`, `team`, `organization`) OR
858
+ - SaaS/paid product signals (`subscription`, `billing`, `plan`) OR
859
+ - Compliance signals (`audit`, `GDPR`, `SOC2`)
860
+
861
+ If ANY detected AND `## admin` YAML section not present in notes.md:
862
+
863
+ > **Text fallback:**
864
+ > ```
865
+ > ⚠️ Admin gap detected: project has multi-user/SaaS/compliance signals but Admin & Governance was not covered.
866
+ > 1. Add admin topic now (go to Topic 6)
867
+ > 2. Add note to backlog (".viepilot/requests/ENH-admin-tbd.md")
868
+ > 3. Dismiss — skip admin for this session
869
+ > ```
870
+ > (Non-blocking — user can dismiss)
871
+
872
+ **admin.html trigger:** admin keyword detected in session AND Architect Mode is active → create/update `admin.html`.
873
+
874
+ #### Content Management Detection (ENH-065)
875
+
876
+ **Trigger keywords** (case-insensitive, Vietnamese or English):
877
+ > `article`, `blog`, `post`, `product`, `catalog`, `listing`, `page`, `landing page`, `content`, `nội dung`, `bài viết`, `sản phẩm`, `danh mục`, `CMS`, `headless`, `media`, `upload`, `image`, `video`, `category`, `tag`, `taxonomy`, `search`, `SEO`, `slug`, `WYSIWYG`, `markdown`, `template`, `course`, `lesson`, `knowledge base`, `FAQ`, `documentation`, `docs`
878
+
879
+ **Early-session detection:**
880
+ At session start, scan initial message for content keywords. If **≥1 keyword** found → show proactive banner:
881
+
882
+ > **Adapter-aware prompt:**
883
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion` tool. AUQ spec:
884
+ > - question: "I noticed your project may involve content management capabilities. Should we discuss Content Management (Topic 7)?"
885
+ > - header: "Content Mgmt"
886
+ > - options: [{ label: "Yes — explore content types, lifecycle, media, search, SEO", description: "Recommended for blogs, eCommerce, SaaS, LMS, marketplace" }, { label: "Not needed — no content layer in this project", description: "" }, { label: "Later — add to notes, continue current topic", description: "" }]
887
+ >
888
+ > **Text fallback:**
889
+ > ```
890
+ > 🗂️ I noticed your project may involve content management capabilities.
891
+ > Should we discuss Content Management (Topic 7)?
892
+ >
893
+ > 1. Yes — explore content types, lifecycle, media, search, SEO (Recommended for blogs, eCommerce, SaaS, LMS, marketplace)
894
+ > 2. Not needed — no content layer in this project
895
+ > 3. Later — add to notes, continue current topic
896
+ > ```
897
+
898
+ **During-session detection:**
899
+ When **≥2 unique content keywords** detected → surface confirmation:
900
+
901
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion`:
902
+ > - question: "Content management signals detected in this session. Would you like to cover Content Management (Topic 7)?"
903
+ > - options: [{ label: "Yes — switch to / add content topic", description: "" }, { label: "Note in background (no topic switch)", description: "" }, { label: "Skip for this session", description: "" }]
904
+ >
905
+ > **Text fallback:** `🗂️ Content management signals detected. Cover Content Management (Topic 7)? 1. Yes 2. Note in background 3. Skip`
906
+
907
+ **Content coverage gate before /save:**
908
+ Before writing session file, check:
909
+ - Project has content-type signals (`article`, `product`, `post`, `page`, `listing`, `course`) OR
910
+ - Media signals (`upload`, `image`, `video`, `media`, `CDN`) OR
911
+ - SEO/search signals (`SEO`, `slug`, `search`, `facets`)
912
+
913
+ If ANY detected AND `## content` YAML section not present in notes.md:
914
+
915
+ > **Text fallback:**
916
+ > ```
917
+ > ⚠️ Content gap detected: project has content-type/media/SEO signals but Content Management was not covered.
918
+ > 1. Add content topic now (go to Topic 7)
919
+ > 2. Add note to backlog (".viepilot/requests/ENH-content-tbd.md")
920
+ > 3. Dismiss — skip content management for this session
921
+ > ```
922
+ > (Non-blocking — user can dismiss)
923
+
924
+ **content.html trigger:** content keyword detected in session AND Architect Mode is active → create/update `content.html`.
925
+
926
+ #### User Data Management Detection (ENH-066)
927
+
928
+ **Trigger keywords** (case-insensitive, Vietnamese or English):
929
+ > `profile`, `account`, `settings`, `preferences`, `notification`, `privacy`, `GDPR`, `data export`, `delete account`, `logout`, `session`, `device`, `2FA`, `two-factor`, `OAuth`, `login history`, `user data`, `personal data`, `tài khoản`, `hồ sơ`, `cài đặt`, `thông báo`, `quyền riêng tư`, `lịch sử`, `xóa tài khoản`, `đăng xuất`, `consent`, `cookie`
930
+
931
+ **Early-session detection:**
932
+ At session start, scan initial message for user data keywords. If **≥1 keyword** found → show proactive banner:
933
+
934
+ > **Adapter-aware prompt:**
935
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion` tool. AUQ spec:
936
+ > - question: "I noticed your project may involve user data management capabilities. Should we discuss User Data Management (Topic 8)?"
937
+ > - header: "User Data"
938
+ > - options: [{ label: "Yes — explore profile, privacy controls, 2FA, sessions", description: "Recommended for B2C apps, SaaS, apps with GDPR requirements" }, { label: "Not needed — no user data layer in this project", description: "" }, { label: "Later — add to notes, continue current topic", description: "" }]
939
+ >
940
+ > **Text fallback:**
941
+ > ```
942
+ > 👤 I noticed your project may involve user data management capabilities.
943
+ > Should we discuss User Data Management (Topic 8)?
944
+ >
945
+ > 1. Yes — explore profile, privacy controls, 2FA, sessions (Recommended for B2C apps, SaaS, GDPR)
946
+ > 2. Not needed — no user data layer in this project
947
+ > 3. Later — add to notes, continue current topic
948
+ > ```
949
+
950
+ **During-session detection:**
951
+ When **≥2 unique user data keywords** detected → surface confirmation:
952
+
953
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion`:
954
+ > - question: "User data management signals detected in this session. Would you like to cover User Data Management (Topic 8)?"
955
+ > - options: [{ label: "Yes — switch to / add user data topic", description: "" }, { label: "Note in background (no topic switch)", description: "" }, { label: "Skip for this session", description: "" }]
956
+ >
957
+ > **Text fallback:** `👤 User data management signals detected. Cover User Data Management (Topic 8)? 1. Yes 2. Note in background 3. Skip`
958
+
959
+ **User data coverage gate before /save:**
960
+ Before writing session file, check:
961
+ - Project has user-account signals (`profile`, `account`, `settings`, `login`) OR
962
+ - Privacy signals (`GDPR`, `privacy`, `data export`, `delete account`) OR
963
+ - Auth/session signals (`2FA`, `session`, `OAuth`, `connected accounts`)
964
+
965
+ If ANY detected AND `## user_data` YAML section not present in notes.md:
966
+
967
+ > **Text fallback:**
968
+ > ```
969
+ > ⚠️ User data gap detected: project has user-account/privacy/auth signals but User Data Management was not covered.
970
+ > 1. Add user data topic now (go to Topic 8)
971
+ > 2. Add note to backlog (".viepilot/requests/ENH-user-data-tbd.md")
972
+ > 3. Dismiss — skip user data management for this session
973
+ > ```
974
+ > (Non-blocking — user can dismiss)
975
+
976
+ **user-data.html trigger:** user data keyword detected in session AND Architect Mode is active → create/update `user-data.html`.
977
+
978
+ #### Admin Entity Management Detection (ENH-068)
979
+
980
+ **Trigger keywords** (case-insensitive, Vietnamese or English):
981
+ > `CRUD`, `entity`, `table`, `manage`, `list view`, `admin panel`, `data management`, `import`, `export`, `bulk`, `soft delete`, `audit trail`, `quản lý dữ liệu`, `bảng dữ liệu`, `danh sách`, `thêm sửa xóa`
982
+
983
+ **Early-session detection:**
984
+ At session start, scan initial message for entity management keywords. If **≥1 keyword** found → show proactive banner:
985
+
986
+ > **Adapter-aware prompt:**
987
+ > **Claude Code (terminal) — REQUIRED:** Call `AskUserQuestion` tool. AUQ spec:
988
+ > - question: "I noticed your project may involve admin data management. Should we discuss Admin Entity Management (Topic 7)?"
989
+ > - header: "Entity Mgmt"
990
+ > - options: [{ label: "Yes — explore CRUD, list views, bulk ops, import/export, audit trail", description: "Recommended for projects with DB entities managed via admin panel" }, { label: "Not needed — no admin CRUD interface in this project", description: "" }, { label: "Later — add to notes, continue current topic", description: "" }]
991
+ >
992
+ > **Text fallback:**
993
+ > ```
994
+ > 🗄️ I noticed your project may involve admin data management.
995
+ > Should we discuss Admin Entity Management (Topic 7)?
996
+ >
997
+ > 1. Yes — explore CRUD, list views, bulk ops, import/export, audit trail (Recommended)
998
+ > 2. Not needed — no admin CRUD interface in this project
999
+ > 3. Later — add to notes, continue current topic
1000
+ > ```
1001
+
1002
+ **During-session detection:**
1003
+ Maintain a running count of unique entity management keywords encountered during the session.
1004
+ At ≥2 unique keywords → show soft prompt at next topic boundary (same format as above).
1005
+ Does not interrupt mid-topic conversation.
1006
+
1007
+ **Coverage gate before /save:**
1008
+
1009
+ If `## erd` YAML is present in architect `notes.md` OR `erd.html` is in the workspace
1010
+ AND session has no `## Admin Entity Management` / `## entity_mgmt` coverage:
1011
+
1012
+ > **Claude Code (terminal):** AUQ:
1013
+ > - question: "🗄️ Entity management gap — your project has DB entities defined but admin CRUD coverage was not discussed. Add now?"
1014
+ > - options: [{ label: "Add entity management topic now", description: "Go to Topic 7" }, { label: "Add note to backlog", description: "Log as .viepilot/requests/ENH-entity-mgmt-tbd.md" }, { label: "Dismiss", description: "Skip entity management for this session" }]
1015
+ >
1016
+ > **Text fallback:**
1017
+ > ```
1018
+ > 🗄️ Entity management gap — your project has DB entities but no admin CRUD coverage defined.
1019
+ > 1. Add entity management topic now (go to Topic 7)
1020
+ > 2. Add note to backlog (".viepilot/requests/ENH-entity-mgmt-tbd.md")
1021
+ > 3. Dismiss — skip entity management for this session
1022
+ > ```
1023
+ > (Non-blocking — user can dismiss)
1024
+
1025
+ **entity-mgmt.html trigger:** entity management keyword detected in session AND Architect Mode is active → create/update `entity-mgmt.html`.
1026
+
1027
+ ---
1028
+
1029
+ #### Embedded Domain Architect Pages (ENH-071 Gaps 1, 4, 5, 8)
1030
+
1031
+ All 6 pages below are only created when **`embedded_domain: true`** AND Architect Mode is active. Each page follows the standard workspace pattern: create HTML in `.viepilot/architect/{session-id}/`, link in `index.html` nav under an **Embedded** section, update `## Pages inventory` in `notes.md`.
1032
+
1033
+ ---
1034
+
1035
+ ##### `hw-topology.html` — Hardware Topology (Gap 1)
1036
+
1037
+ **Trigger**: Always created when `embedded_domain: true` AND Architect Mode activates.
1038
+
1039
+ **Content**:
1040
+ - Mermaid `graph TD` block diagram: MCU node connected to external ICs/sensors/actuators via labeled bus arrows (bus type + speed on arrow label)
1041
+ - Component table: Part | Type | Interface | Bus Speed | Notes
1042
+ - Power rails table: Rail | Source | Voltage | Max current (mA)
1043
+
1044
+ **notes.md YAML section**:
1045
+ ```yaml
1046
+ ## hw_topology
1047
+ mcu:
1048
+ family: "" # e.g. STM32F4, ESP32-S3
1049
+ core: "" # e.g. Cortex-M4 @168MHz
1050
+ flash_kb: 0
1051
+ ram_kb: 0
1052
+ peripherals: [] # on-chip peripherals: [{ name, type, instance }]
1053
+ external_ics: [] # [{ name, type, interface, bus_speed, notes }]
1054
+ buses: [] # [{ type: SPI|I2C|UART|CAN|USB, speed, devices: [] }]
1055
+ power_rails: [] # [{ rail, source, voltage_v, max_ma }]
1056
+ ```
1057
+
1058
+ ---
1059
+
1060
+ ##### `pin-map.html` — GPIO/Pin Assignment (Gap 4)
1061
+
1062
+ **Trigger**: GPIO / pin / pinout / assignment / alternate function keywords AND `embedded_domain: true` OR when `hw-topology.html` is created (auto-companion).
1063
+
1064
+ **Content**:
1065
+ - Pin assignment table: Pin# | GPIO Name | Alt Function | Peripheral | Direction (IN/OUT/AF) | Pull (Up/Down/None) | Voltage Level | Notes
1066
+ - Conflict detection: if two rows share the same GPIO name with conflicting functions → highlight row in red and note conflict
1067
+
1068
+ **notes.md YAML section**:
1069
+ ```yaml
1070
+ ## pin_map
1071
+ pins: [] # [{ pin_num, gpio_name, function, peripheral, direction, pull, voltage_v, notes }]
1072
+ conflicts: [] # auto-detected: [{ gpio_name, conflicting_functions: [] }]
1073
+ ```
1074
+
1075
+ ---
1076
+
1077
+ ##### `memory-layout.html` — Memory Partitioning (Gap 5)
1078
+
1079
+ **Trigger**: flash / RAM / memory / linker / bootloader / OTA / partition / NVS / EEPROM keywords AND `embedded_domain: true`.
1080
+
1081
+ **Content**:
1082
+ - Flash regions table: Region | Start Address | Size (KB) | Usage | Notes
1083
+ - RAM regions table: Region | Start Address | Size (KB) | Usage | Notes
1084
+ - Linker constraint notes: stack size, heap size, section alignment, placement constraints
1085
+ - OTA layout diagram (simple text diagram) when OTA mentioned
1086
+
1087
+ **notes.md YAML section**:
1088
+ ```yaml
1089
+ ## memory_layout
1090
+ flash_total_kb: 0
1091
+ ram_total_kb: 0
1092
+ flash_regions: [] # [{ name, start_hex, size_kb, usage, notes }]
1093
+ ram_regions: [] # [{ name, start_hex, size_kb, usage, notes }]
1094
+ linker_notes: ""
1095
+ ```
1096
+
1097
+ ---
1098
+
1099
+ ##### `protocol-matrix.html` — Communication Protocol Matrix (Gap 8)
1100
+
1101
+ **Trigger**: CAN / I2C / SPI / UART / RS-485 / BLE / Wi-Fi / LoRa / LoRaWAN / MQTT / Modbus / CANopen / USB / Zigbee keywords AND `embedded_domain: true`.
1102
+
1103
+ **Content** (distinct from `apis.html` which covers HTTP REST):
1104
+ - Bus protocol table: Protocol | Role (master/slave/both) | Speed | Topology | Connected Devices | Notes
1105
+ - Wireless/external table: Protocol | Role | Endpoint/Broker | QoS/Notes
1106
+ - Note at top: "Embedded bus & wireless protocols — see `apis.html` for HTTP REST endpoints (if applicable)"
1107
+
1108
+ **notes.md YAML section**:
1109
+ ```yaml
1110
+ ## protocols
1111
+ bus_protocols: [] # [{ name, role, speed, topology, devices: [], notes }]
1112
+ wireless: [] # [{ protocol, role, endpoint, notes }]
1113
+ ```
1114
+
1115
+ **Coexistence rule**: If the project also has a cloud API (HTTP/REST), both `protocol-matrix.html` AND `apis.html` exist in the workspace — they are separate artifacts.
1116
+
1117
+ ---
1118
+
1119
+ ##### `rtos-scheduler.html` — RTOS & Task Scheduler (Gap 3 visual)
1120
+
1121
+ **Trigger**: RTOS / FreeRTOS / Zephyr / ThreadX / task / scheduler / semaphore / queue / ISR / interrupt priority keywords AND `embedded_domain: true`.
1122
+
1123
+ **Content**:
1124
+ - Task table: Task Name | Priority | Period or Event | Stack KB | State | Notes
1125
+ - ISR table: Interrupt Source | Handler Function | Priority | Shared Resources | Notes
1126
+ - Mermaid `stateDiagram-v2` for key task state transitions (only if ≤5 tasks — omit if larger)
1127
+ - Shared resource matrix: Resource | Protected by | Tasks using it
1128
+
1129
+ **notes.md**: uses `## rtos_config` section written by Task 106.1 probes (no new section — extends same YAML).
1130
+
1131
+ ---
1132
+
1133
+ ##### `power-budget.html` — Power Budget (Gap 7 visual)
1134
+
1135
+ **Trigger**: battery / sleep / power / current / µA / mAh / Standby / Stop / Shutdown / Hibernate / LoRa / IoT keywords AND `embedded_domain: true`.
1136
+
1137
+ **Content**:
1138
+ - Power modes table: Mode | MCU state | Active peripherals | Typical current (µA/mA) | Wake-up sources
1139
+ - Battery life estimate: Duty cycle % | Avg current (mA) | Capacity (mAh) | Runtime (days) formula
1140
+ - Power rail summary (linked from `hw-topology` if available)
1141
+
1142
+ **notes.md**: uses `## power_budget` section written by Task 106.1 probes (no new section — extends same YAML).
1143
+
1144
+ ---
1145
+
1146
+ #### Embedded Workspace Layout (ENH-071)
1147
+
1148
+ When `embedded_domain: true` and Architect Mode is active, the `index.html` hub includes an **Embedded** nav section after the standard pages:
1149
+
1150
+ ```html
1151
+ <!-- Embedded section (only shown when embedded_domain: true) -->
1152
+ <a href="hw-topology.html">🔌 HW Topology</a>
1153
+ <a href="pin-map.html">📌 Pin Map</a>
1154
+ <a href="memory-layout.html">🗺️ Memory Layout</a>
1155
+ <a href="protocol-matrix.html">📡 Protocol Matrix</a>
1156
+ <a href="rtos-scheduler.html">⏱️ RTOS Scheduler</a>
1157
+ <a href="power-budget.html">🔋 Power Budget</a>
1158
+ ```
1159
+
1160
+ Pages are only linked when they have been created (missing pages are omitted from nav).
266
1161
 
267
1162
  #### Sequence trigger keywords (ENH-029)
268
1163
  When the user mentions: `scenario`, `step by step`, `login flow`, `checkout flow`, `detailed interaction`, `sequence`, `interaction diagram` → update `sequence-diagram.html` + update `notes.md ## sequences` section.
@@ -400,6 +1295,104 @@ design_decisions:
400
1295
  choice: "{JWT / Session / OAuth2 / API Key}"
401
1296
  rationale: "{rationale}"
402
1297
 
1298
+ ## admin
1299
+ admin_personas:
1300
+ - id: super_admin
1301
+ capabilities: [user_management, billing, system_config, audit_log_view]
1302
+ - id: org_admin
1303
+ capabilities: [invite_users, role_assign, reporting]
1304
+ capabilities:
1305
+ - id: user_management
1306
+ required: yes
1307
+ phase: 2
1308
+ notes: invite, deactivate, RBAC
1309
+ - id: audit_log
1310
+ required: yes
1311
+ phase: 3
1312
+ notes: all write ops, 90-day retention
1313
+ - id: monitoring_dashboard
1314
+ required: optional
1315
+ phase: 3
1316
+ notes: error rate, latency, active users
1317
+ - id: billing_management
1318
+ required: no
1319
+ phase: ~
1320
+ notes: not in scope
1321
+
1322
+ ## content
1323
+ content_types:
1324
+ - id: article
1325
+ created_by: [admin, author]
1326
+ lifecycle: [draft, review, published, archived]
1327
+ fields: [title, body_rich_text, slug, tags, seo_meta]
1328
+ phase: 2
1329
+ - id: product
1330
+ created_by: [admin]
1331
+ lifecycle: [draft, published, discontinued]
1332
+ fields: [name, description, price, images, category]
1333
+ phase: 1
1334
+ media:
1335
+ storage: S3 # S3 | GCS | Azure Blob | local
1336
+ cdn: CloudFront
1337
+ types: [image, pdf]
1338
+ max_size_mb: 10
1339
+ localization:
1340
+ locales: [en]
1341
+ fallback: en
1342
+ search:
1343
+ engine: postgres_fts # postgres_fts | Elasticsearch | Algolia | Typesense
1344
+ full_text: yes
1345
+ facets: [category, tags]
1346
+
1347
+ ## user_data
1348
+ profile_fields:
1349
+ - name
1350
+ - email
1351
+ - avatar_url
1352
+ - timezone
1353
+ - locale
1354
+ settings_categories:
1355
+ - id: notifications
1356
+ channels: [email, push, in_app]
1357
+ frequency: [immediately, daily_digest, weekly]
1358
+ - id: privacy
1359
+ fields: [data_visibility, analytics_opt_out]
1360
+ privacy_rights:
1361
+ data_export: yes
1362
+ right_to_erasure: yes
1363
+ data_retention_days: 730
1364
+ connected_accounts:
1365
+ - provider: google
1366
+ scope: [email, profile]
1367
+ - provider: github
1368
+ scope: [read:user, user:email]
1369
+ session_management:
1370
+ multi_session: yes
1371
+ show_active_devices: yes
1372
+ force_logout_all: yes
1373
+ two_factor:
1374
+ totp: yes
1375
+ sms: no
1376
+ backup_codes: yes
1377
+
1378
+ ## entity_mgmt
1379
+ entities:
1380
+ - name: product
1381
+ admin_crud: [create, read, update, delete]
1382
+ soft_delete: yes
1383
+ bulk_actions: [export, status_change]
1384
+ audit_trail: yes
1385
+ scoped_by: org
1386
+ - name: order
1387
+ admin_crud: [read, update]
1388
+ soft_delete: no
1389
+ bulk_actions: [export]
1390
+ audit_trail: yes
1391
+ scoped_by: org
1392
+ import_export:
1393
+ csv_import: [product]
1394
+ csv_export: [product, order, user]
1395
+
403
1396
  ## architect_sync
404
1397
  - synced_at: "{ISO datetime}"
405
1398
  source_session: "{ui-direction session-id}"
@@ -420,9 +1413,45 @@ When the assistant detects any keyword (case-insensitive, Vietnamese or English)
420
1413
 
421
1414
  > `màu`, `màu sắc`, `color`, `layout`, `màn hình`, `screen`, `page`, `trang`, `button`, `nút`, `form`, `biểu mẫu`, `mobile`, `responsive`, `giao diện`, `UI`, `UX`, `design`, `dashboard`, `sidebar`, `header`, `footer`, `modal`, `popup`, `icon`, `theme`, `typography`, `font`, `spacing`, `grid`, `card`, `component`, `hero`, `banner`
422
1415
 
1416
+ #### Embedded Domain UI Suppression (ENH-071 Gap 6)
1417
+
1418
+ **Before adding any keyword to the UI buffer**, check if `embedded_domain: true`.
1419
+
1420
+ If `embedded_domain: true` AND keyword is a display/screen word (`display`, `screen`, `LCD`, `OLED`, `TFT`, `touch`):
1421
+
1422
+ 1. Check for **hardware context counter-keywords** in the same message or nearby context:
1423
+ - Hardware indicators: `GPIO`, `SPI`, `I2C`, `driver`, `framebuffer`, `ILI9341`, `SSD1306`, `ST7789`, `HX8357`, `RA8875`, `E-Ink`, `EPD`, `7-segment`, `LVGL`, `u8g2`, `resolution`, `pixel`, `backlight`, `contrast`, `init sequence`
1424
+
1425
+ 2. **If hardware context confirmed**:
1426
+ - Do NOT add to `ui_idea_buffer[]`
1427
+ - Add as peripheral to `hw_topology_buffer[]` instead: `{ type: "display", interface: "SPI/I2C/parallel", part: "{detected_part_if_any}" }`
1428
+ - Log silently: "Display keyword suppressed from UI Direction → added to hw-topology peripherals"
1429
+
1430
+ 3. **If ambiguous** (no hardware counter-keywords, could be web dashboard):
1431
+ - Add to `ui_idea_buffer[]` normally with note: `"context: may be hardware display — verify"`
1432
+
1433
+ 4. **Early-session UI Direction banner (ENH-060) suppression**:
1434
+ - If `embedded_domain: true` AND all accumulated display signals have hardware context → **suppress** the `🎨 UI Direction Mode?` banner entirely
1435
+ - Replace with a one-time note: `"Hardware displays detected — will appear in hw-topology page"`
1436
+ - If signals are mixed (some hardware, some ambiguous) → show banner but prepend: `"⚠️ Embedded context detected — confirm if this is a web/mobile UI or hardware display"`
1437
+
1438
+ #### Early-session detection (ENH-060)
1439
+ At the very start of a brainstorm session, scan the user's **initial message** for UI/UX signal keywords. If **≥1 keyword** is found AND `embedded_domain` is NOT active, show the proactive activation banner **immediately** (before topic selection):
1440
+
1441
+ ```
1442
+ 🎨 I noticed your project involves UI/UX design.
1443
+ Would you like to activate UI Direction Mode? I can generate an HTML prototype direction alongside our brainstorm.
1444
+
1445
+ 1. Yes — activate UI Direction Mode (create .viepilot/ui-direction/{session-id}/)
1446
+ 2. Save ideas to notes only (background, no HTML yet)
1447
+ 3. No — continue brainstorm without UI Direction
1448
+ ```
1449
+
1450
+ This mirrors **Architect Design Mode** which proactively banners when system architecture heuristics fire.
1451
+
423
1452
  #### Threshold & accumulation rule
424
1453
  - **Count unique keyword occurrences** during the ongoing session.
425
- - When **≥3 unique signal occurrences** are reached: begin **silent accumulation** — record UI ideas into a `ui_idea_buffer[]` in the session context.
1454
+ - When **≥1 signal occurrence** is detected: begin **silent accumulation** — record UI ideas into a `ui_idea_buffer[]` in the session context.
426
1455
  - **Non-blocking**: does not interrupt the main conversation, does not ask for user confirmation immediately.
427
1456
  - Each buffer entry records: keyword trigger, utterance context (short summary ≤20 words).
428
1457
 
@@ -430,19 +1459,19 @@ When the assistant detects any keyword (case-insensitive, Vietnamese or English)
430
1459
  Display a confirmation dialogue when any of the following conditions occur:
431
1460
  - (a) **Topic ends** — user types `/topic` to switch to a new topic or says "next"
432
1461
  - (b) **User types `/save` or `/review`**
433
- - (c) **≥5 signals accumulated** in the buffer
1462
+ - (c) **≥2 unique signals accumulated** in the buffer
434
1463
 
435
1464
  #### Confirmation dialogue template
436
1465
  ```
437
- 💡 I detected some UI ideas in this session:
1466
+ 🎨 I noticed UI/UX design ideas in this session:
438
1467
  - {idea 1 extracted from buffer}
439
1468
  - {idea 2 extracted from buffer}
440
1469
  ...
441
1470
 
442
- What would you like to do?
443
- 1. Save to .viepilot/ui-direction/{session-id}/notes.md (background extraction)
444
- 2. Save + activate UI Direction Mode to generate HTML direction
445
- 3. Discard and continue brainstorming
1471
+ Would you like to activate UI Direction Mode?
1472
+ 1. Save to .viepilot/ui-direction/{session-id}/notes.md (background, no HTML yet)
1473
+ 2. Save + activate UI Direction Mode (create .viepilot/ui-direction/{session-id}/, generate HTML direction)
1474
+ 3. No — discard and continue brainstorming
446
1475
  ```
447
1476
 
448
1477
  **Option 1**: Write `## Background extracted ideas` to `.viepilot/ui-direction/{session-id}/notes.md` (create file/directory if not yet present). Clear buffer. Continue.
@@ -604,6 +1633,8 @@ Before writing the session file, validate phase assignment completeness:
604
1633
  CHECK 1: Does session draft contain a non-empty ## Phases section?
605
1634
  CHECK 2: Does Phase 1 have at least one feature/capability assigned?
606
1635
  CHECK 3: Are there any features listed outside a phase (unassigned)?
1636
+ CHECK 4 (ENH-061): If both Architect workspace AND UI Direction workspace are active —
1637
+ does ## Coverage in notes.md have any Phase 1 feature with "none yet" in BOTH columns?
607
1638
  ```
608
1639
 
609
1640
  **Gate condition:**
@@ -625,8 +1656,40 @@ CHECK 3: Are there any features listed outside a phase (unassigned)?
625
1656
  > ⚠️ Exploratory session — no phase assignments yet.
626
1657
  > Run /vp-brainstorm to continue and assign features to phases before /vp-crystallize.
627
1658
  ```
1659
+ - If CHECK 4 fires (both workspaces active + uncovered Phase 1 features): **non-blocking warning**:
1660
+ ```
1661
+ ⚠️ Coverage gap detected — these Phase 1 features have no Architect or UI coverage:
1662
+ - {feature name}
1663
+ Consider running /sync-ui or adding these features to a workspace before /vp-crystallize.
1664
+ Proceed with save? (yes / skip coverage for now)
1665
+ ```
628
1666
  - If brownfield stub session (`IS_BROWNFIELD=true`): **skip this gate** — brownfield stubs intentionally have no phases.
629
- - If all checks pass → proceed to file write below.
1667
+ - If all checks pass → proceed to Feature → Coverage Mapping check, then file write.
1668
+
1669
+ ### Feature → Coverage Mapping (ENH-061)
1670
+
1671
+ **Trigger**: After phase assignment checks pass and before file write. Runs when the session has BOTH Architect workspace AND UI Direction workspace active, or when `## Coverage` already exists in notes.md.
1672
+
1673
+ For each feature/capability listed under **Phase 1** in the session draft, identify:
1674
+ - **Architect coverage**: which architect page handles this? (`architecture`, `data-flow`, `erd`, `apis`, `tech-stack`, `decisions`, `user-use-cases`, `sequence-diagram`, `deployment`, or `none yet`)
1675
+ - **UI coverage**: which UI screen/page handles this? (page slug, `index.html`, or `none yet`)
1676
+
1677
+ Output a `## Coverage` section in `notes.md`:
1678
+
1679
+ ```markdown
1680
+ ## Coverage
1681
+ | Feature | Architect page | UI screen |
1682
+ |---------|---------------|-----------|
1683
+ | User authentication | architecture, apis | login.html, register.html |
1684
+ | Dashboard overview | data-flow | dashboard.html |
1685
+ | Notification system | architecture | none yet |
1686
+ ```
1687
+
1688
+ **Warning rules (non-blocking)**:
1689
+ - If a Phase 1 feature has `none yet` in **both** columns:
1690
+ `⚠️ Feature "{name}" has no coverage in Architect or UI Direction. Consider adding it to a workspace before /vp-crystallize.`
1691
+ - If Architect workspace exists but coverage matrix is empty: suggest running coverage mapping.
1692
+ - User can dismiss with "skip coverage" or "fill in later" — does **not** block save.
630
1693
 
631
1694
  Create/update file: `docs/brainstorm/session-{YYYY-MM-DD}.md`
632
1695
 
@@ -637,6 +1700,12 @@ Create/update file: `docs/brainstorm/session-{YYYY-MM-DD}.md`
637
1700
  - **Date**: {full date}
638
1701
  - **Participants**: User, Claude
639
1702
  - **Status**: In Progress | Completed
1703
+ - **workflow_version**: {viepilot_semver}
1704
+ - **upgrade_supplement_version**: {viepilot_semver_after_supplement | ""}
1705
+
1706
+ <!-- workflow_version: set from `node bin/vp-tools.cjs info` → version field at session create/save time. -->
1707
+ <!-- upgrade_supplement_version: empty on first save; set to current version after gap-detection supplement -->
1708
+ <!-- completes (ENH-067 idempotency guard — prevents re-surfacing already-supplemented topics on next open). -->
640
1709
 
641
1710
  ## Phases
642
1711
 
@@ -742,6 +1811,99 @@ git push
742
1811
  ```
743
1812
  </step>
744
1813
 
1814
+ <step name="arch_to_ui_sync">
1815
+ ## 6C. Architect → UI Direction Sync (ENH-061)
1816
+
1817
+ Bridges the gap from **Architect Design** → **UI Direction** — the reverse of `architect_delta_sync` (ENH-034, which syncs UI → Architect).
1818
+
1819
+ When the architect workspace is updated (any page edit during the session), scan the changed content for decisions that carry **UI implications**:
1820
+
1821
+ ### Architectural decisions that trigger UI updates
1822
+
1823
+ | Architect signal | UI implication to check |
1824
+ |-----------------|------------------------|
1825
+ | Async / event-driven flow | Loading states, optimistic updates, error handling screens |
1826
+ | API pagination | Pagination component, empty state, scroll-to-load |
1827
+ | Auth roles / permissions | Conditional UI rendering, role-specific screens |
1828
+ | Rate limiting / quota | Warning banners, upgrade prompts, disabled states |
1829
+ | Real-time → polling fallback | Refresh indicators, stale data warnings |
1830
+ | File size / type constraints | Upload validation, error messages, progress indicators |
1831
+ | Third-party OAuth / SSO | Redirect flow, consent screen, token expiry handling |
1832
+ | Error codes from APIs | Error state screens, retry affordances |
1833
+ | Data constraints (max length, required fields) | Form validation UI, helper text |
1834
+
1835
+ ### Trigger conditions
1836
+ `arch_to_ui_sync` fires when:
1837
+ - The user edits any architect workspace page during an active brainstorm session that also has a UI Direction workspace
1838
+ - User types `/sync-ui` (manual trigger, parallel to `/sync-arch`)
1839
+ - After `/review-arch` if changes were applied
1840
+
1841
+ ### Output format
1842
+ ```
1843
+ 🎨 Architect → UI sync — detected implications:
1844
+
1845
+ From `data-flow.html` (async notification queue):
1846
+ → UI may need: notification badge with unread count, real-time update indicator, empty state
1847
+ → Affected screens: dashboard.html (not yet modeled in UI Direction)
1848
+
1849
+ Update UI Direction to reflect these decisions?
1850
+ 1. Yes — open UI Direction and address these screens/states now
1851
+ 2. Note it in notes.md (## arch_to_ui_sync) for later
1852
+ 3. Skip — already handled
1853
+ ```
1854
+
1855
+ ### Manual command
1856
+ `/sync-ui` — manually trigger arch_to_ui_sync from the current architect session state. If no UI Direction workspace is active, suggest activating it first.
1857
+
1858
+ When `/sync-ui` is used and no implications are found:
1859
+ `✓ No UI Direction implications detected from current architect changes.`
1860
+
1861
+ ### notes.md record
1862
+ Append to `notes.md` when action is taken:
1863
+ ```yaml
1864
+ ## arch_to_ui_sync
1865
+ - architect_page: data-flow.html
1866
+ decision: async notification queue
1867
+ ui_implication: unread count badge, empty state, real-time update indicator
1868
+ status: noted | addressed | skipped
1869
+ date: {YYYY-MM-DD}
1870
+ ```
1871
+
1872
+ ### Cross-workspace HUB links (ENH-064)
1873
+
1874
+ When BOTH architect AND ui-direction workspaces are active in the same session:
1875
+ After `arch_to_ui_sync` completes (or when both workspaces first become active together):
1876
+
1877
+ **Update Architect `index.html`** — add to nav/header section:
1878
+ ```html
1879
+ <div class="cross-workspace-link">
1880
+ <a href="../../ui-direction/{session-id}/index.html" target="_blank">
1881
+ 🎨 View UI Direction workspace
1882
+ </a>
1883
+ </div>
1884
+ ```
1885
+
1886
+ **Update UI Direction `index.html`** — add to nav/header section:
1887
+ ```html
1888
+ <div class="cross-workspace-link">
1889
+ <a href="../../architect/{session-id}/index.html" target="_blank">
1890
+ 🏗️ View Architect workspace
1891
+ </a>
1892
+ </div>
1893
+ ```
1894
+
1895
+ **Trigger conditions:**
1896
+ - After arch_to_ui_sync fires (ENH-061)
1897
+ - When BUG-018 Step 2B selection is "Both" and both workspaces are created
1898
+ - Manual: user types `/sync-links`
1899
+
1900
+ **Relative path calculation:**
1901
+ - From `.viepilot/architect/{session-id}/index.html` → `../../ui-direction/{session-id}/index.html`
1902
+ - From `.viepilot/ui-direction/{session-id}/index.html` → `../../architect/{session-id}/index.html`
1903
+ - Use the same `{session-id}` (same date YYYY-MM-DD) for cross-linking.
1904
+
1905
+ </step>
1906
+
745
1907
  <step name="architect_delta_sync">
746
1908
  ## 6B. Architect Delta Sync (ENH-034)
747
1909
 
@@ -899,6 +2061,7 @@ User can use the following commands during a brainstorm session:
899
2061
  - `/research ui` — alias of `/research-ui`
900
2062
  - `/review-arch` — Architect Mode: output summary table of decisions + open_questions from `notes.md`, confirm before continuing (FEAT-011)
901
2063
  - `/sync-arch` — Architect Delta Sync (ENH-034): manually trigger architect HTML sync from current UI brainstorm session; scans session for architect gaps → updates relevant architect workspace pages
2064
+ - `/sync-ui` — Architect → UI Direction Sync (ENH-061): manually trigger arch_to_ui_sync; scans architect workspace for decisions that carry UI implications and prompts UI Direction updates
902
2065
  - `/hooks-install` — Install the brainstorm staleness hook (FEAT-012): runs `vp-tools hooks install`; one-time setup per machine; auto-marks stale architect items after each AI response
903
2066
  </commands>
904
2067