@xenonbyte/da-vinci-workflow 0.1.15 → 0.1.17

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 (40) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/README.md +35 -1
  3. package/README.zh-CN.md +35 -1
  4. package/SKILL.md +18 -0
  5. package/commands/claude/dv/design.md +7 -0
  6. package/commands/codex/prompts/dv-design.md +7 -0
  7. package/commands/gemini/dv/design.toml +7 -0
  8. package/docs/mode-use-cases.md +5 -1
  9. package/docs/prompt-presets/README.md +3 -0
  10. package/docs/prompt-presets/desktop-app.md +16 -1
  11. package/docs/prompt-presets/mobile-app.md +16 -1
  12. package/docs/prompt-presets/tablet-app.md +16 -1
  13. package/docs/prompt-presets/web-app.md +16 -1
  14. package/docs/visual-assist-presets/README.md +5 -0
  15. package/docs/workflow-examples.md +22 -8
  16. package/docs/zh-CN/mode-use-cases.md +13 -4
  17. package/docs/zh-CN/prompt-presets/README.md +3 -0
  18. package/docs/zh-CN/prompt-presets/desktop-app.md +16 -1
  19. package/docs/zh-CN/prompt-presets/mobile-app.md +16 -1
  20. package/docs/zh-CN/prompt-presets/tablet-app.md +16 -1
  21. package/docs/zh-CN/prompt-presets/web-app.md +16 -1
  22. package/docs/zh-CN/visual-assist-presets/README.md +5 -0
  23. package/docs/zh-CN/workflow-examples.md +22 -8
  24. package/lib/audit.js +66 -2
  25. package/lib/cli.js +356 -1
  26. package/lib/mcp-runtime-gate.js +53 -1
  27. package/lib/pen-persistence.js +515 -0
  28. package/lib/pencil-lock.js +128 -0
  29. package/lib/pencil-preflight.js +438 -0
  30. package/lib/pencil-session.js +229 -0
  31. package/package.json +6 -2
  32. package/references/artifact-templates.md +2 -0
  33. package/references/checkpoints.md +14 -0
  34. package/references/pencil-design-to-code.md +15 -0
  35. package/scripts/fixtures/complex-sample.pen +295 -0
  36. package/scripts/test-mcp-runtime-gate.js +88 -0
  37. package/scripts/test-pen-persistence.js +250 -0
  38. package/scripts/test-pencil-preflight.js +153 -0
  39. package/scripts/test-pencil-session.js +152 -0
  40. package/scripts/test-persistence-flows.js +315 -0
package/CHANGELOG.md CHANGED
@@ -1,6 +1,22 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## v0.1.17 - 2026-03-28
4
+
5
+ ### Added
6
+ - `da-vinci preflight-pencil` as a static preflight for non-trivial Pencil `batch_design` payloads, catching common syntax and schema drift before they hit MCP
7
+ - `da-vinci write-pen` to atomically write a project-local `.pen` from MCP-readable node and variable snapshot data
8
+ - `da-vinci ensure-pen` to seed or verify a registered project-local `.pen` before live editing starts
9
+ - `da-vinci check-pen-sync` to compare a current live MCP snapshot payload against the persisted project-local `.pen`
10
+ - `da-vinci pencil-lock` to serialize Pencil MCP write access across multiple projects on the same machine
11
+ - `da-vinci pencil-session begin / persist / end / status` as the preferred session-level wrapper for seeded `.pen` ownership, persistence, sync checks, and lock release
12
+ - `scripts/test-pencil-session.js` and `scripts/test-persistence-flows.js` to cover session lifecycle plus new/existing/parallel project flows
13
+
14
+ ### Changed
15
+ - active Pencil guidance now requires smaller anchor-surface batches, micro-batch fallback after repeated rollbacks, and structured screenshot-review records instead of self-affirming prose
16
+ - design routes, prompt presets, workflow examples, and README guidance now call for `da-vinci audit --mode integrity <project-path>` immediately after the first successful Pencil write during active redesign work
17
+ - project-local `.pen` persistence now treats headless interactive `save()` as non-authoritative; redesign passes should seed the registered `.pen` before the first edit, then persist current live MCP snapshots back to that same path after material edits
18
+ - `da-vinci snapshot-pen` is now documented and treated as a disk-to-disk utility only, not as a live-edit persistence step
19
+ - completion audit now expects `.da-vinci/state/pencil-session.json` plus matching persisted snapshot hashes before completion can pass
4
20
 
5
21
  ## v0.1.15 - 2026-03-27
6
22
 
package/README.md CHANGED
@@ -27,10 +27,16 @@ This workflow is intended for:
27
27
 
28
28
  Latest published npm package:
29
29
 
30
- - `@xenonbyte/da-vinci-workflow@0.1.14`
30
+ - `@xenonbyte/da-vinci-workflow@0.1.16`
31
31
 
32
32
  Release highlights:
33
33
 
34
+ - project-local `.pen` persistence now uses an MCP-snapshot-to-disk path instead of relying on headless interactive `save()`
35
+ - redesign runs now seed a registered project-local `.pen` before the first Pencil edit and record persisted snapshot hashes for later sync checks
36
+ - `da-vinci write-pen` now atomically writes workflow-owned `.pen` files from MCP-readable node and variable payloads with optional reopen verification
37
+ - `da-vinci ensure-pen` now seeds or verifies a registered project-local `.pen` before live editing starts
38
+ - `da-vinci check-pen-sync` now compares a current live MCP snapshot payload against the persisted project-local `.pen`
39
+ - `da-vinci snapshot-pen` now serves only as a disk-to-disk utility for rebuilding an existing Pencil source and verifying reopen
34
40
  - visual-adapter execution now requires explicit runtime declaration of the resolved primary adapter and any unavailable requested adapters
35
41
  - cross-platform near-name adapters such as `frontend-skill` and `frontend-design` are now treated as distinct unless the current environment explicitly resolves them
36
42
  - complex `redesign-from-code` runs now require a visual thesis, content plan, interaction thesis, and anchor-surface structural-delta notes before broad Pencil generation
@@ -416,6 +422,7 @@ da-vinci status
416
422
  da-vinci validate-assets
417
423
  da-vinci audit --mode integrity /abs/path/to/project
418
424
  da-vinci audit --mode completion --change <change-id> /abs/path/to/project
425
+ da-vinci preflight-pencil --ops-file /abs/path/to/ops.txt
419
426
  da-vinci uninstall --platform codex,claude,gemini
420
427
  ```
421
428
 
@@ -432,7 +439,34 @@ Both modes check the most common workflow-integrity failures in a project:
432
439
  - screenshot exports stored in the wrong place
433
440
  - empty or partial change scaffolds
434
441
 
442
+ `da-vinci preflight-pencil` is a static guard for non-trivial `batch_design` payloads:
443
+
444
+ - catches JS-like syntax mistakes before they hit Pencil MCP
445
+ - flags common schema drift such as bad `padding`, invalid hex colors, `flex`, `margin`, and `overflow`
446
+ - warns when anchor-surface batches are too large and should be split before retrying
447
+
435
448
  When Pencil MCP is active, Da Vinci now also expects an MCP runtime gate record in `pencil-design.md` before terminal completion claims. That runtime gate checks live editor/source convergence separately from filesystem audit.
449
+ During active redesign work, prefer running `da-vinci audit --mode integrity <project-path>` immediately after the first successful Pencil write, then use `da-vinci preflight-pencil` plus smaller follow-up batches if the same anchor surface rolls back twice.
450
+
451
+ Project-local `.pen` persistence now has two supported paths:
452
+
453
+ - first-run path: seed the registered project-local `.pen` with `da-vinci ensure-pen --output <path> --verify-open`, open that exact path, then persist later MCP snapshot writes back to the same file
454
+ - resume path: if a registered project-local `.pen` already exists, reopen it for continuity, but after material live edits persist a fresh live MCP snapshot back to that same path and run `da-vinci check-pen-sync`
455
+
456
+ Persistence helpers:
457
+
458
+ - preferred wrapper:
459
+ - `da-vinci pencil-session begin --project <project-path> --pen <path>`
460
+ - `da-vinci pencil-session persist --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
461
+ - `da-vinci pencil-session end --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
462
+ - `da-vinci ensure-pen --output <path> --verify-open`
463
+ - `da-vinci write-pen --output <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version> --verify-open`
464
+ - `da-vinci check-pen-sync --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
465
+ - `da-vinci snapshot-pen --input <existing.pen> --output <target.pen> --verify-open` (disk-to-disk only)
466
+ - `da-vinci pencil-lock acquire --project <project-path>` / `da-vinci pencil-lock release --project <project-path>`
467
+
468
+ Do not treat headless interactive `save()` as authoritative persistence truth until the underlying Pencil behavior is proven reliable again.
469
+ Completion audit now also expects `.da-vinci/state/pencil-session.json` to reflect the latest persisted `.pen` hash, so autonomous runs should prefer the `pencil-session` wrapper.
436
470
 
437
471
  Installation targets:
438
472
 
package/README.zh-CN.md CHANGED
@@ -29,10 +29,16 @@ Da Vinci 是一个把产品需求一路推进到结构化规格、Pencil 设计
29
29
 
30
30
  最新已发布 npm 包:
31
31
 
32
- - `@xenonbyte/da-vinci-workflow@0.1.14`
32
+ - `@xenonbyte/da-vinci-workflow@0.1.16`
33
33
 
34
34
  已发布版本重点:
35
35
 
36
+ - 项目内 `.pen` 持久化现在改为“从 MCP 快照写回磁盘”的正式路径,不再依赖 headless interactive `save()`
37
+ - 重设计流程现在要求在第一次 Pencil 编辑前先 seed 一个登记好的项目内 `.pen`,并记录后续持久化快照 hash 以便做同步校验
38
+ - `da-vinci write-pen` 现在可以把 MCP 可读的节点和变量快照原子写成工作流管理的 `.pen` 文件,并可选地做 reopen 校验
39
+ - `da-vinci ensure-pen` 现在可以在 live 编辑开始前 seed 或校验登记好的项目内 `.pen`
40
+ - `da-vinci check-pen-sync` 现在可以把当前 live MCP 快照和已持久化的项目内 `.pen` 做同步比对
41
+ - `da-vinci snapshot-pen` 现在只作为 disk-to-disk 工具,用来从已有 Pencil 源重建规范化 `.pen` 并验证重新打开结果
36
42
  - visual adapter 的执行现在要求在运行时明确声明解析出来的主 adapter,以及哪些请求的 adapter 当前不可用
37
43
  - `frontend-skill`、`frontend-design` 这类跨平台近名 adapter 现在明确视为不同能力源,除非当前环境真的解析到了它们
38
44
  - 复杂 `redesign-from-code` 现在要求在大规模 Pencil 设计前先写 visual thesis、content plan、interaction thesis 和 anchor surface 的 structural-delta 说明
@@ -345,6 +351,7 @@ da-vinci status
345
351
  da-vinci validate-assets
346
352
  da-vinci audit --mode integrity /abs/path/to/project
347
353
  da-vinci audit --mode completion --change <change-id> /abs/path/to/project
354
+ da-vinci preflight-pencil --ops-file /abs/path/to/ops.txt
348
355
  da-vinci uninstall --platform codex,claude,gemini
349
356
  ```
350
357
 
@@ -361,7 +368,34 @@ da-vinci uninstall --platform codex,claude,gemini
361
368
  - 截图导出写到了错误位置
362
369
  - change scaffold 只有空目录或只写了一半
363
370
 
371
+ `da-vinci preflight-pencil` 是给非小型 `batch_design` 用的静态预检:
372
+
373
+ - 在发给 Pencil MCP 之前先抓出 JS-like 语法错误
374
+ - 直接标出常见 schema 漂移,比如错误 `padding`、非法 hex 颜色、`flex`、`margin`、`overflow`
375
+ - 当 anchor-surface 批次太大时给出拆批警告,避免继续大块回滚
376
+
364
377
  当 Pencil MCP 可用时,Da Vinci 现在还要求在终态完成声明前,把 MCP runtime gate 结果记录到 `pencil-design.md`。这层 gate 负责检查 live editor/source convergence,与 filesystem audit 分工不同。
378
+ 在重设计进行中,建议在第一次成功写入 Pencil 后立即运行 `da-vinci audit --mode integrity <project-path>`;如果同一个 anchor surface 连续回滚,则继续配合 `da-vinci preflight-pencil` 和更小的 follow-up batch。
379
+
380
+ 项目内 `.pen` 持久化现在分成两条受支持路径:
381
+
382
+ - 首次运行路径:先用 `da-vinci ensure-pen --output <path> --verify-open` seed 登记好的项目内 `.pen`,打开这个精确路径,然后把后续 MCP 快照持续写回同一个文件
383
+ - 继续迭代路径:如果项目里原本已有登记的 `.pen`,先打开它继续工作;但发生实质性 live edit 后,要把当前 live MCP 快照重新持久化回同一路径,并运行 `da-vinci check-pen-sync`
384
+
385
+ 推荐使用的持久化命令:
386
+
387
+ - 优先使用封装好的 session 命令:
388
+ - `da-vinci pencil-session begin --project <project-path> --pen <path>`
389
+ - `da-vinci pencil-session persist --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
390
+ - `da-vinci pencil-session end --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
391
+ - `da-vinci ensure-pen --output <path> --verify-open`
392
+ - `da-vinci write-pen --output <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version> --verify-open`
393
+ - `da-vinci check-pen-sync --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
394
+ - `da-vinci snapshot-pen --input <existing.pen> --output <target.pen> --verify-open`(仅限 disk-to-disk)
395
+ - `da-vinci pencil-lock acquire --project <project-path>` / `da-vinci pencil-lock release --project <project-path>`
396
+
397
+ 在 Pencil 底层 `save()` 语义再次被证明可靠之前,不要把 headless interactive `save()` 当作权威持久化真相。
398
+ completion audit 现在还会检查 `.da-vinci/state/pencil-session.json` 是否记录了最新的 `.pen` hash,所以自治运行优先走 `pencil-session` 封装。
365
399
 
366
400
  安装目标:
367
401
 
package/SKILL.md CHANGED
@@ -226,15 +226,33 @@ During active Pencil work:
226
226
  - do not begin anchor-surface generation until the required discovery and design-source artifacts exist in their standard locations for the active mode
227
227
  - keep `.da-vinci/designs/` reserved for project-local `.pen` files; do not write workflow markdown such as inventories, proposals, or checkpoints into that directory
228
228
  - on `redesign-from-code`, write a short structural-delta note for each anchor surface explaining how the new composition differs from the current XML or layout grouping
229
+ - when shell access is available, preflight non-trivial `batch_design` operation strings before sending them to Pencil
230
+ - prefer 12 or fewer operations on anchor-surface batches; if the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds
231
+ - do not rely on headless interactive `save()` as the persistence truth; when live MCP edits exist, persist project-local `.pen` files from MCP-readable document snapshots
232
+ - prefer the session wrapper commands:
233
+ `da-vinci pencil-session begin --project <project-path> --pen <path>`
234
+ `da-vinci pencil-session persist --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
235
+ `da-vinci pencil-session end --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
236
+ - before the first Pencil edit on a redesign pass, begin a Pencil session so the registered project-local `.pen` exists before editing and the global Pencil lock is held for that project
237
+ - acquire the global Pencil lock before MCP write operations on a project and release it after the write phase so two projects do not compete for the same active editor
238
+ - when a registered project-local `.pen` already exists, reopen it for continuity, but after material live edits persist a fresh MCP snapshot back to that same path instead of assuming live edits were flushed automatically
239
+ - `da-vinci snapshot-pen` is a disk-to-disk utility for rebuilding an existing `.pen`; do not use it as live-edit persistence
240
+ - use `da-vinci write-pen --output <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version> --verify-open` to atomically write the registered project-local `.pen` from MCP snapshot data
241
+ - after writing the project-local `.pen`, run `da-vinci check-pen-sync --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>` before treating the disk source as current
242
+ - completion audit expects a recorded Pencil session state under `.da-vinci/state/pencil-session.json`; do not bypass the session wrapper on autonomous runs
229
243
  - after the first successful Pencil write, verify that the registered project-local `.pen` path exists as a shell-visible file before treating the design source as persistent
244
+ - after the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` when shell access is available before broad expansion continues
230
245
  - after the first successful Pencil write, run the MCP runtime gate when Pencil MCP is available and record the result in `pencil-design.md`
246
+ - if the workflow already has a registered `.pen`, do not send Pencil write operations with an empty `filePath`
231
247
  - do not treat an unnamed live editor such as `new` as a persisted project design source; reconcile it to the registered project-local `.pen` path before the design pass is considered traceable
232
248
  - use only Pencil-supported properties; do not emit web- or CSS-only layout properties such as `flex` or `margin`
233
249
  - if unsupported Pencil properties cause repeated rolled-back batches on the same anchor surface, treat that pass as unstable and fix the schema usage before expanding further
250
+ - after any rolled-back batch or structure-changing edit, refresh the live node structure before descendant-targeted follow-up operations; do not assume stale ids, bindings, or parent relationships are still valid
234
251
  - on complex redesigns, turn approved anchor surfaces into a small shared primitive family before broad page expansion
235
252
  - apply the resolved form-factor-specific layout hygiene profile before passing screenshot review on any anchor surface or other approval candidate
236
253
  - exported screenshots are review artifacts only; place them under `.da-vinci/changes/<change-id>/exports/` and never treat them as a substitute for the project-local `.pen` source
237
254
  - screenshot review is binding: if the review calls out hierarchy, spacing, clarity, inconsistency, or unresolved-placeholder issues, revise the screen before treating the checkpoint as `PASS`
255
+ - screenshot review must record an explicit `PASS`, `WARN`, or `BLOCK` plus the concrete issue list and revision outcome; phrases such as "looks good" do not count as review evidence
238
256
 
239
257
  ## Load References On Demand
240
258
 
@@ -18,5 +18,12 @@ Create or update:
18
18
  - `pencil-design.md`
19
19
 
20
20
  Run the `design checkpoint` before locking implementation tasks.
21
+ Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
22
+ If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
23
+ Prefer the session wrapper commands: `da-vinci pencil-session begin`, `da-vinci pencil-session persist`, and `da-vinci pencil-session end`.
24
+ Before the first Pencil edit, begin a Pencil session so the registered project-local `.pen` is seeded and locked before editing starts.
25
+ If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh live MCP snapshot back to that same path through `pencil-session persist` after material edits.
26
+ After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
21
27
  If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
28
+ Screenshot review must record an explicit `PASS`, `WARN`, or `BLOCK` plus the issue list and revision outcome; "looks good" is not a valid review record.
22
29
  Before reporting `design complete` or `workflow complete`, run `da-vinci audit --mode completion --change <change-id> <project-path>` and treat any failure as blocking.
@@ -12,5 +12,12 @@ Output should move the work toward:
12
12
  - `pencil-design.md`
13
13
 
14
14
  Use Pencil-backed structure as the design source when available.
15
+ Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
16
+ If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
17
+ Prefer the session wrapper commands: `da-vinci pencil-session begin`, `da-vinci pencil-session persist`, and `da-vinci pencil-session end`.
18
+ Before the first Pencil edit, begin a Pencil session so the registered project-local `.pen` is seeded and locked before editing starts.
19
+ If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh live MCP snapshot back to that same path through `pencil-session persist` after material edits.
20
+ After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
15
21
  If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
22
+ Screenshot review must record an explicit `PASS`, `WARN`, or `BLOCK` plus the issue list and revision outcome; "looks good" is not a valid review record.
16
23
  Before claiming `design complete` or `workflow complete`, run `da-vinci audit --mode completion --change <change-id> <project-path>` and treat any failure as blocking.
@@ -11,6 +11,13 @@ Create or update:
11
11
  - `pencil-design.md`
12
12
 
13
13
  Use Pencil-backed page coverage as the source of presentation truth.
14
+ Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
15
+ If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
16
+ Prefer the session wrapper commands: `da-vinci pencil-session begin`, `da-vinci pencil-session persist`, and `da-vinci pencil-session end`.
17
+ Before the first Pencil edit, begin a Pencil session so the registered project-local `.pen` is seeded and locked before editing starts.
18
+ If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh live MCP snapshot back to that same path through `pencil-session persist` after material edits.
19
+ After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
14
20
  If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
21
+ Screenshot review must record an explicit `PASS`, `WARN`, or `BLOCK` plus the issue list and revision outcome; "looks good" is not a valid review record.
15
22
  Before reporting `design complete` or `workflow complete`, run `da-vinci audit --mode completion --change <change-id> <project-path>` and treat any failure as blocking.
16
23
  """
@@ -138,7 +138,8 @@ Generate DA-VINCI.md, proposal, specs, page map, Pencil-backed launch pages, bin
138
138
 
139
139
  8. create `pencil-design.md`
140
140
  - record the generated Pencil screens
141
- - ensure the active design is materialized into the registered `.pen` path under `.da-vinci/designs/`
141
+ - prefer `da-vinci pencil-session begin` before the first Pencil edit so the registered `.pen` is seeded and locked up front
142
+ - if a registered project-local `.pen` already exists, reopen it for continuity but overwrite it from the current live MCP snapshot through `da-vinci pencil-session persist` after material live edits
142
143
  - keep screenshot exports under `.da-vinci/changes/<change-id>/exports/` rather than `.da-vinci/designs/`
143
144
 
144
145
  9. create `pencil-bindings.md`
@@ -355,8 +356,11 @@ Register the design sources, extract DA-VINCI.md from them, bind covered pages,
355
356
  - for complex products, get 1-3 anchor surfaces through screenshot review before expanding the rest of the redesign
356
357
  - for each anchor surface, explain briefly how the new composition differs from the current layout grouping
357
358
  - do not auto-pass screenshot review if the analysis reports hierarchy, spacing, clarity, inconsistency, or unresolved-placeholder issues
359
+ - do not record screenshot review as "looks good" without an explicit `PASS`, `WARN`, or `BLOCK`, issue list, and revision outcome
358
360
  - define a small shared primitive family from the approved anchor surfaces before broad page expansion
359
361
  - use only Pencil-supported properties; do not rely on web-only props such as `flex` or `margin`
362
+ - preflight non-trivial `batch_design` operation strings when shell access is available
363
+ - if the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds
360
364
 
361
365
  For redesign work:
362
366
 
@@ -13,6 +13,8 @@ Recommended flow:
13
13
  3. choose the prompt variant that matches project complexity and delivery intent
14
14
  4. copy both into your workflow setup
15
15
  5. tighten the prompt further only when the project has unusual truth sources or platform constraints
16
+ 6. when Pencil MCP is active, prefer the redesign prompts that explicitly require an MCP runtime gate plus a completion audit before terminal completion claims
17
+ 7. for project-local `.pen` persistence, prefer prompts that drive `da-vinci pencil-session begin / persist / end`; fall back to the lower-level `ensure-pen + write-pen + check-pen-sync` chain only when the wrapper cannot be used
16
18
 
17
19
  Available presets:
18
20
 
@@ -26,6 +28,7 @@ Design rule:
26
28
  - prompt presets define workflow intent, decomposition rules, and truth-source handling
27
29
  - visual-assist presets define UI-design helper preferences
28
30
  - form-factor-specific layout hygiene remains a separate hard gate that screenshot review must apply before a screen passes
31
+ - MCP runtime gate and `da-vinci audit --mode completion ...` remain workflow gates, not `Visual Assist` configuration
29
32
  - use both together for the strongest result
30
33
 
31
34
  Each scene preset should now include:
@@ -28,6 +28,9 @@ Existing code is the behavior source of truth, not the layout truth.
28
28
  Preserve current behavior, flows, integrations, and validation rules unless explicitly required otherwise.
29
29
  Inventory the current workspaces, dialogs, overlays, and important states before Pencil work.
30
30
  Use the Visual Assist preferences declared in DA-VINCI.md.
31
+ Before the first Pencil edit, prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` so the registered project-local `.pen` is seeded and the global Pencil lock is held; fall back to `da-vinci ensure-pen --output <path> --verify-open` only when the session wrapper cannot be used.
32
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
33
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
31
34
  Do not pass design checkpoint if the result is just a boxed-up recolor of the old UI or if workspace hierarchy remains unclear.
32
35
  Persist project-local Pencil files under .da-vinci/designs/.
33
36
  ```
@@ -48,8 +51,15 @@ Use Pencil guides only as workspace constraints, not as the design direction.
48
51
  Do not start with broad multi-screen scaffolding.
49
52
  Design 1-3 anchor surfaces first, review screenshots, then expand.
50
53
  Apply the form-factor-specific layout hygiene rules for desktop before passing screenshot review.
54
+ Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
55
+ If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
56
+ Run `da-vinci audit --mode integrity <project-path>` after the first successful Pencil write before broad expansion continues.
57
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
58
+ Prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` before the first Pencil edit, then use `da-vinci pencil-session persist --project <project-path> --pen <path> ...` after material live edits. Fall back to the lower-level `ensure-pen + write-pen + check-pen-sync` chain only when the session wrapper cannot be used.
51
59
  Write exported screenshots under `.da-vinci/changes/<change-id>/exports/` only.
60
+ Record screenshot review with explicit `PASS` / `WARN` / `BLOCK`, issue list, and revision outcome; "looks good" is not enough.
52
61
  Do not report completion if the registered `.pen` source exists only in memory or only as exported PNGs.
62
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
53
63
  Do not pass design checkpoint if the result is a repeated placeholder scaffold, flat panel soup, or a recolor of the old desktop shell.
54
64
  Persist project-local Pencil files under .da-vinci/designs/.
55
65
  ```
@@ -66,6 +76,9 @@ Decompose complex screens into real design surfaces before Pencil work.
66
76
  Use the Visual Assist preferences declared in DA-VINCI.md.
67
77
  If the product is complex, design 1-3 anchor surfaces first, review screenshots, then expand.
68
78
  Stop after DA-VINCI.md, design-registry.md, page-map.md, proposal.md, specs, design.md, pencil-design.md, pencil-bindings.md, and tasks.md.
79
+ Before the first Pencil edit, prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` so the registered project-local `.pen` is seeded and locked; fall back to `da-vinci ensure-pen --output <path> --verify-open` only when the session wrapper cannot be used.
80
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
81
+ Before reporting `design complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
69
82
  Do not start code changes yet.
70
83
  ```
71
84
 
@@ -76,8 +89,10 @@ $da-vinci use continue for this existing desktop-product redesign workflow.
76
89
 
77
90
  Use the existing Da Vinci artifacts in this project.
78
91
  Do not restart discovery unless an artifact is missing or clearly wrong.
79
- Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth.
92
+ Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth. Prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` when resuming, then use `da-vinci pencil-session persist --project <project-path> --pen <path> ...` after material live edits; fall back to the lower-level `write-pen + check-pen-sync` path only when the session wrapper cannot be used.
80
93
  If the redesign is complex, continue from the approved anchor surfaces instead of restarting broad scaffolding.
94
+ If Pencil MCP is active and this session performs new Pencil writes, rerun the MCP runtime gate and record the refreshed result in `pencil-design.md`.
95
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
81
96
  Continue into the next unfinished stage and do not stop at tasks.md when the active intent is full-delivery.
82
97
  ```
83
98
 
@@ -28,6 +28,9 @@ Existing code is the behavior source of truth, not the layout truth.
28
28
  Preserve business logic, navigation, permissions, integrations, validations, and state transitions unless explicitly required otherwise.
29
29
  Inventory the current screens and important states before Pencil work.
30
30
  Use the Visual Assist preferences declared in DA-VINCI.md.
31
+ Before the first Pencil edit, prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` so the registered project-local `.pen` is seeded and the global Pencil lock is held; fall back to `da-vinci ensure-pen --output <path> --verify-open` only when the session wrapper cannot be used.
32
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
33
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
31
34
  Do not pass design checkpoint if the result is a skin-swap of the old UI, a generic card grid, or a weak mobile hierarchy.
32
35
  Persist project-local Pencil files under .da-vinci/designs/.
33
36
  ```
@@ -52,11 +55,18 @@ Design 1-3 anchor surfaces first, review screenshots, then expand.
52
55
  For each anchor surface, explain how the new composition differs structurally from the current layout.
53
56
  Do not treat screenshot analysis as an automatic pass if it reports hierarchy, spacing, clarity, or inconsistency issues.
54
57
  Apply the form-factor-specific layout hygiene rules for mobile before passing screenshot review.
58
+ Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
59
+ If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
55
60
  Use only Pencil-supported properties; do not use web-only props like flex or margin.
56
61
  Verify the registered project-local `.pen` file exists as a shell-visible file after the first Pencil write.
62
+ Run `da-vinci audit --mode integrity <project-path>` after that first successful Pencil write before broad expansion continues.
63
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
64
+ Prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` before the first Pencil edit, then use `da-vinci pencil-session persist --project <project-path> --pen <path> ...` after material live edits. Fall back to the lower-level `ensure-pen + write-pen + check-pen-sync` chain only when the session wrapper cannot be used.
57
65
  Keep non-`.pen` workflow artifacts out of `.da-vinci/designs/`.
58
66
  Write exported screenshots under `.da-vinci/changes/<change-id>/exports/` only.
67
+ Record screenshot review with explicit `PASS` / `WARN` / `BLOCK`, issue list, and revision outcome; "looks good" is not enough.
59
68
  Do not report completion if the registered `.pen` source exists only in memory or only as exported PNGs.
69
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
60
70
  Define shared primitives from the approved anchor surfaces before broad page expansion.
61
71
  Do not pass design checkpoint if the result is a skin-swap of the old UI, a generic card grid, repeated placeholder templates, or weak visual anchors.
62
72
  Persist project-local Pencil files under .da-vinci/designs/.
@@ -74,6 +84,9 @@ Decompose complex screens into real design surfaces before Pencil work.
74
84
  Use the Visual Assist preferences declared in DA-VINCI.md.
75
85
  If the app is complex, design 1-3 anchor surfaces first, review screenshots, then expand.
76
86
  Stop after DA-VINCI.md, design-registry.md, page-map.md, proposal.md, specs, design.md, pencil-design.md, pencil-bindings.md, and tasks.md.
87
+ Before the first Pencil edit, prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` so the registered project-local `.pen` is seeded and locked; fall back to `da-vinci ensure-pen --output <path> --verify-open` only when the session wrapper cannot be used.
88
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
89
+ Before reporting `design complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
77
90
  Do not start code changes yet.
78
91
  ```
79
92
 
@@ -84,8 +97,10 @@ $da-vinci use continue for this existing mobile-app redesign workflow.
84
97
 
85
98
  Use the existing Da Vinci artifacts in this project.
86
99
  Do not restart discovery unless an artifact is missing or clearly wrong.
87
- Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth.
100
+ Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth. Prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` when resuming, then use `da-vinci pencil-session persist --project <project-path> --pen <path> ...` after material live edits; fall back to the lower-level `write-pen + check-pen-sync` path only when the session wrapper cannot be used.
88
101
  If the redesign is complex, keep the anchor-first flow until the design checkpoint passes.
102
+ If Pencil MCP is active and this session performs new Pencil writes, rerun the MCP runtime gate and record the refreshed result in `pencil-design.md`.
103
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
89
104
  Continue into the next unfinished stage and do not stop at tasks.md when the active intent is full-delivery.
90
105
  ```
91
106
 
@@ -28,6 +28,9 @@ Existing code is the behavior source of truth, not the layout truth.
28
28
  Preserve current behavior, permissions, integrations, validations, and state transitions unless explicitly required otherwise.
29
29
  Inventory the current tablet surfaces and important states before Pencil work.
30
30
  Use the Visual Assist preferences declared in DA-VINCI.md.
31
+ Before the first Pencil edit, prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` so the registered project-local `.pen` is seeded and the global Pencil lock is held; fall back to `da-vinci ensure-pen --output <path> --verify-open` only when the session wrapper cannot be used.
32
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
33
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
31
34
  Do not pass design checkpoint if the result ignores tablet-scale composition or collapses into a stretched phone layout.
32
35
  Persist project-local Pencil files under .da-vinci/designs/.
33
36
  ```
@@ -48,8 +51,15 @@ Use Pencil guides only as tablet-layout constraints, not as the design direction
48
51
  Do not start with broad multi-screen scaffolding.
49
52
  Design 1-3 anchor surfaces first, review screenshots, then expand.
50
53
  Apply the form-factor-specific layout hygiene rules for tablet before passing screenshot review.
54
+ Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
55
+ If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
56
+ Run `da-vinci audit --mode integrity <project-path>` after the first successful Pencil write before broad expansion continues.
57
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
58
+ Prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` before the first Pencil edit, then use `da-vinci pencil-session persist --project <project-path> --pen <path> ...` after material live edits. Fall back to the lower-level `ensure-pen + write-pen + check-pen-sync` chain only when the session wrapper cannot be used.
51
59
  Write exported screenshots under `.da-vinci/changes/<change-id>/exports/` only.
60
+ Record screenshot review with explicit `PASS` / `WARN` / `BLOCK`, issue list, and revision outcome; "looks good" is not enough.
52
61
  Do not report completion if the registered `.pen` source exists only in memory or only as exported PNGs.
62
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
53
63
  Do not pass design checkpoint if the result collapses into a stretched phone layout, repeated placeholders, or weak multi-region hierarchy.
54
64
  Persist project-local Pencil files under .da-vinci/designs/.
55
65
  ```
@@ -66,6 +76,9 @@ Decompose complex pages into real design surfaces before Pencil work.
66
76
  Use the Visual Assist preferences declared in DA-VINCI.md.
67
77
  If the product is complex, design 1-3 anchor surfaces first, review screenshots, then expand.
68
78
  Stop after DA-VINCI.md, design-registry.md, page-map.md, proposal.md, specs, design.md, pencil-design.md, pencil-bindings.md, and tasks.md.
79
+ Before the first Pencil edit, prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` so the registered project-local `.pen` is seeded and locked; fall back to `da-vinci ensure-pen --output <path> --verify-open` only when the session wrapper cannot be used.
80
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
81
+ Before reporting `design complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
69
82
  Do not start code changes yet.
70
83
  ```
71
84
 
@@ -76,8 +89,10 @@ $da-vinci use continue for this existing tablet-product redesign workflow.
76
89
 
77
90
  Use the existing Da Vinci artifacts in this project.
78
91
  Do not restart discovery unless an artifact is missing or clearly wrong.
79
- Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth.
92
+ Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth. Prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` when resuming, then use `da-vinci pencil-session persist --project <project-path> --pen <path> ...` after material live edits; fall back to the lower-level `write-pen + check-pen-sync` path only when the session wrapper cannot be used.
80
93
  If the redesign is complex, continue from the approved anchor surfaces instead of restarting broad scaffolding.
94
+ If Pencil MCP is active and this session performs new Pencil writes, rerun the MCP runtime gate and record the refreshed result in `pencil-design.md`.
95
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
81
96
  Continue into the next unfinished stage and do not stop at tasks.md when the active intent is full-delivery.
82
97
  ```
83
98
 
@@ -28,6 +28,9 @@ Existing code is the behavior source of truth, not the layout truth.
28
28
  Preserve current business logic, routes, permissions, integrations, validations, and state transitions unless explicitly required otherwise.
29
29
  Inventory the current product surfaces and important states before Pencil work.
30
30
  Use the Visual Assist preferences declared in DA-VINCI.md.
31
+ Before the first Pencil edit, prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` so the registered project-local `.pen` is seeded and the global Pencil lock is held; fall back to `da-vinci ensure-pen --output <path> --verify-open` only when the session wrapper cannot be used.
32
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
33
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
31
34
  Do not pass design checkpoint if the result is a generic SaaS card grid or a recolor of the old interface.
32
35
  Persist project-local Pencil files under .da-vinci/designs/.
33
36
  ```
@@ -49,8 +52,15 @@ Use Pencil guides only as responsive layout constraints, not as the design direc
49
52
  Do not start with broad multi-screen scaffolding.
50
53
  Design 1-3 anchor surfaces first, review screenshots, then expand.
51
54
  Apply the form-factor-specific layout hygiene rules for web before passing screenshot review.
55
+ Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
56
+ If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
57
+ Run `da-vinci audit --mode integrity <project-path>` after the first successful Pencil write before broad expansion continues.
58
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
59
+ Prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` before the first Pencil edit, then use `da-vinci pencil-session persist --project <project-path> --pen <path> ...` after material live edits. Fall back to the lower-level `ensure-pen + write-pen + check-pen-sync` chain only when the session wrapper cannot be used.
52
60
  Write exported screenshots under `.da-vinci/changes/<change-id>/exports/` only.
61
+ Record screenshot review with explicit `PASS` / `WARN` / `BLOCK`, issue list, and revision outcome; "looks good" is not enough.
53
62
  Do not report completion if the registered `.pen` source exists only in memory or only as exported PNGs.
63
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
54
64
  Do not pass design checkpoint if the result is a generic SaaS card grid, repeated placeholder scaffolds, or a recolor of the old interface.
55
65
  Persist project-local Pencil files under .da-vinci/designs/.
56
66
  ```
@@ -67,6 +77,9 @@ Decompose complex pages into real design surfaces before Pencil work.
67
77
  Use the Visual Assist preferences declared in DA-VINCI.md.
68
78
  If the product is complex, design 1-3 anchor surfaces first, review screenshots, then expand.
69
79
  Stop after DA-VINCI.md, design-registry.md, page-map.md, proposal.md, specs, design.md, pencil-design.md, pencil-bindings.md, and tasks.md.
80
+ Before the first Pencil edit, prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` so the registered project-local `.pen` is seeded and locked; fall back to `da-vinci ensure-pen --output <path> --verify-open` only when the session wrapper cannot be used.
81
+ If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
82
+ Before reporting `design complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
70
83
  Do not start code changes yet.
71
84
  ```
72
85
 
@@ -77,8 +90,10 @@ $da-vinci use continue for this existing web-product redesign workflow.
77
90
 
78
91
  Use the existing Da Vinci artifacts in this project.
79
92
  Do not restart discovery unless an artifact is missing or clearly wrong.
80
- Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth.
93
+ Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth. Prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` when resuming, then use `da-vinci pencil-session persist --project <project-path> --pen <path> ...` after material live edits; fall back to the lower-level `write-pen + check-pen-sync` path only when the session wrapper cannot be used.
81
94
  If the redesign is complex, continue from the approved anchor surfaces instead of restarting broad scaffolding.
95
+ If Pencil MCP is active and this session performs new Pencil writes, rerun the MCP runtime gate and record the refreshed result in `pencil-design.md`.
96
+ Before reporting `design complete` or `workflow complete`, require both the MCP runtime gate and `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
82
97
  Continue into the next unfinished stage and do not stop at tasks.md when the active intent is full-delivery.
83
98
  ```
84
99
 
@@ -13,6 +13,11 @@ Use them together with:
13
13
 
14
14
  - `docs/prompt-presets/`
15
15
 
16
+ These presets do not carry workflow completion gates by themselves:
17
+
18
+ - keep MCP runtime gate requirements in the workflow prompt/checkpoint layer
19
+ - keep `da-vinci audit --mode completion ...` in the workflow prompt/checkpoint layer
20
+
16
21
  If the project is design-critical or previous outputs were weak, generic, or too close to the old UI:
17
22
 
18
23
  - keep the same preset family
@@ -82,14 +82,20 @@ Expected flow:
82
82
  6. rebuild or refine `page-map.md`, including subpages, overlays, and materially different states
83
83
  7. write the visual thesis, content plan, interaction thesis, and structural-delta notes for the anchor surfaces
84
84
  8. create new or updated Pencil pages from fresh composition rather than a recolor of the old UI, preferring persistence under `.da-vinci/designs/`
85
- 9. verify the registered project-local `.pen` path becomes shell-visible immediately after the first successful Pencil write
86
- 10. if Pencil MCP is active, run the MCP runtime gate and record it in `pencil-design.md`
87
- 11. run `design-source checkpoint` to confirm the registered project-local `.pen` path, the active Pencil source, and the shell-visible file all agree
88
- 12. export screenshots only under `.da-vinci/changes/<change-id>/exports/`, never into `.da-vinci/designs/`
89
- 13. bind routes and pages to Pencil screens
90
- 14. generate tasks aligned to the redesign slices
91
- 15. run `da-vinci audit --mode completion --change <change-id> <project-path>` before any terminal completion claim
92
- 16. build and verify only after the completion gate can eventually pass
85
+ 9. preflight non-trivial `batch_design` operation strings before sending them to Pencil, and keep anchor-surface batches small
86
+ 10. if the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds
87
+ 11. prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` before the first Pencil edit so the registered `.pen` is seeded and the global Pencil lock is held
88
+ 12. during live design work, prefer `da-vinci pencil-session persist --project <project-path> --pen <path> ...` after material edits, then end with `da-vinci pencil-session end ...`
89
+ 13. verify the registered project-local `.pen` path becomes shell-visible immediately after the first successful Pencil write
90
+ 14. run `da-vinci audit --mode integrity <project-path>` immediately after that first successful write
91
+ 15. if Pencil MCP is active, run the MCP runtime gate and record it in `pencil-design.md`
92
+ 16. run `design-source checkpoint` to confirm the registered project-local `.pen` path, the active Pencil source, and the shell-visible file all agree
93
+ 17. export screenshots only under `.da-vinci/changes/<change-id>/exports/`, never into `.da-vinci/designs/`
94
+ 18. record screenshot review with explicit `PASS` / `WARN` / `BLOCK`, issue list, and revision outcome before broad expansion
95
+ 19. bind routes and pages to Pencil screens
96
+ 20. generate tasks aligned to the redesign slices
97
+ 21. run `da-vinci audit --mode completion --change <change-id> <project-path>` before any terminal completion claim
98
+ 22. build and verify only after the completion gate can eventually pass
93
99
 
94
100
  ### Complex Android example
95
101
 
@@ -107,10 +113,16 @@ Do not start with broad multi-screen scaffolding.
107
113
  Design 1-3 anchor surfaces first, review screenshots, then expand.
108
114
  For each anchor surface, explain how the new composition differs structurally from the current layout.
109
115
  Do not treat screenshot analysis as an automatic pass if it reports hierarchy, spacing, clarity, or inconsistency issues.
116
+ Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
117
+ If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
110
118
  Use only Pencil-supported properties; do not use web-only props like flex or margin.
119
+ Prefer `da-vinci pencil-session begin --project <project-path> --pen <path>` before the first Pencil edit.
120
+ If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh live MCP snapshot back to that same path through `da-vinci pencil-session persist`.
111
121
  Verify the registered project-local `.pen` file exists as a shell-visible file after the first Pencil write.
122
+ Run `da-vinci audit --mode integrity <project-path>` after that first successful Pencil write before broad expansion continues.
112
123
  Keep `.da-vinci/designs/` reserved for `.pen` files only.
113
124
  Write exported screenshots under `.da-vinci/changes/<change-id>/exports/` only.
125
+ Record screenshot review with explicit `PASS` / `WARN` / `BLOCK`, issue list, and revision outcome; "looks good" is not enough.
114
126
  Do not report completion if the `.pen` source exists only in memory or only as exported PNGs.
115
127
  Do not pass design checkpoint if the result is just a skin-swap of the old UI.
116
128
  ```
@@ -148,6 +160,8 @@ Use the visual-adapter preferences declared in DA-VINCI.md.
148
160
  If frontend-skill is available, use it as the primary visual adapter.
149
161
  If it is unavailable, fall back to native Da Vinci design rules and continue.
150
162
  Persist project-local Pencil files under .da-vinci/designs/.
163
+ If no registered project-local `.pen` exists yet, seed it there before the first Pencil edit and keep subsequent live edits bound to that exact path.
164
+ If a registered project-local `.pen` already exists, reopen it for continuity but overwrite it from the current MCP snapshot after material live edits.
151
165
  ```
152
166
 
153
167
  ## Cross-mode rule
@@ -91,7 +91,8 @@ Da Vinci 应该:
91
91
  - 优先登记 `.da-vinci/designs/` 下的本地 `.pen` 路径
92
92
  7. 生成 `design.md`
93
93
  8. 生成 `pencil-design.md`
94
- - 确保当前设计真正落到登记好的 `.da-vinci/designs/` 路径
94
+ - 如果一开始还没有登记的项目内 `.pen`,先在登记好的 `.da-vinci/designs/` 路径 seed 一个 `.pen` 再开始第一次 Pencil 编辑
95
+ - 如果项目里原本已有 `.pen`,继续设计时先打开它,但发生实质性 live edit 后要把当前 MCP 快照重新覆盖写回同一路径
95
96
  9. 生成 `pencil-bindings.md`
96
97
  10. 生成 `tasks.md`
97
98
  11. 进入实现
@@ -112,7 +113,8 @@ Da Vinci 应该:
112
113
  5. 生成 `specs/<capability>/spec.md`
113
114
  6. 生成 `page-map.md`
114
115
  7. 继续到设计、绑定、任务和实现
115
- - 把当前设计真正落到登记好的 `.da-vinci/designs/` 路径
116
+ - 如果一开始还没有登记的项目内 `.pen`,先在登记好的 `.da-vinci/designs/` 路径 seed 一个 `.pen` 再开始第一次 Pencil 编辑
117
+ - 如果项目里原本已有 `.pen`,继续设计时先打开它,但发生实质性 live edit 后要把当前 MCP 快照重新覆盖写回同一路径
116
118
 
117
119
  ## 3. `redesign-from-code`
118
120
 
@@ -138,7 +140,8 @@ Da Vinci 应该:
138
140
  - 在大规模 anchor 设计前,先写 visual thesis、content plan、interaction thesis 和 structural-delta 说明
139
141
  - 先做 1 到 3 个 anchor surface,再扩展更多页面
140
142
  - 首轮设计由解析出来的主 visual adapter 主导
141
- - 把新的 Pencil 基线真正落到登记好的 `.da-vinci/designs/` 路径
143
+ - 如果一开始还没有登记的项目内 `.pen`,先在登记好的 `.da-vinci/designs/` 路径 seed 一个 `.pen` 再开始第一次 Pencil 编辑
144
+ - 如果项目里原本已有 `.pen`,继续设计时先打开它,但发生实质性 live edit 后要把当前 MCP 快照重新覆盖写回同一路径
142
145
  - 在第一次成功写入 Pencil 后,立即验证登记的 `.pen` 路径已经成为 shell 可见文件
143
146
  - 截图导出必须写到 `.da-vinci/changes/<change-id>/exports/`,不能写进 `.da-vinci/designs/`
144
147
  9. 生成 `pencil-bindings.md`
@@ -159,11 +162,16 @@ Da Vinci 应该:
159
162
  - 对复杂产品,先把 1 到 3 个 anchor surface 做到通过截图审查,再扩展其他页面
160
163
  - 对每个 anchor surface,都要说明“新的构图与当前布局结构相比具体改了什么”
161
164
  - 只要截图分析指出 hierarchy、spacing、clarity、inconsistency 或 unresolved placeholder 问题,就不能自动判通过
165
+ - 不要把截图审查写成“看起来很好”;必须记录明确的 `PASS` / `WARN` / `BLOCK`、问题列表和是否回改
162
166
  - 在扩展更多页面前,先从已通过的 anchor surface 中抽出一组 shared primitives
163
167
  - 只使用 Pencil 支持的属性,不要继续使用 `flex`、`margin` 这类 Web/CSS 属性
168
+ - 在发送非小型 `batch_design` 之前,如果有 shell 能力,先对 Pencil operations 做 preflight
169
+ - 如果同一个 anchor surface 连续两次回滚,就切到每批不超过 6 个操作的微批次,直到拿到干净的 schema-safe pass
164
170
  - 一个实现页如果包含多个 Fragment、多个 tab、多个状态或多个 overlay,应该拆成多个设计 surface
165
171
  - `design-registry.md` 里的首选 `.pen` 路径由工作流自动维护,不应该依赖用户手工填写
166
172
  - 不要因为当前 Pencil 里正好打开了一个文档,就直接在那个文档上继续做重设计
173
+ - 不要把 interactive `save()` 当作可靠的持久化真相;应先 seed 项目内 `.pen`,然后从当前 MCP 可读快照重建并覆盖它,并通过 `da-vinci check-pen-sync` 做同步校验
174
+ - 如果支持 CLI,优先走 `da-vinci pencil-session begin / persist / end`,不要再手拼 `ensure-pen + write-pen + lock`
167
175
  - 如果 Pencil MCP 没有自动把登记路径的 `.pen` 文件落到磁盘,就应该先补写这个项目内文件,再把 mapping 或 implementation 视为完成
168
176
  - `.da-vinci/designs/` 应该只作为 `.pen` 目录使用,不应该混入 inventory、proposal 之类的 markdown
169
177
  - 截图 PNG 只是审查产物,不能替代登记好的 `.pen` 设计源
@@ -183,7 +191,8 @@ Da Vinci 应该:
183
191
  4. 复用或更新 `design-registry.md`
184
192
  - 如果已有项目内 `.pen` 文件,优先登记 `.da-vinci/designs/` 下的路径
185
193
  5. 生成 `pencil-design.md` 增量
186
- - 把更新后的 `.pen` 文件真正落到登记好的 `.da-vinci/designs/` 路径
194
+ - 优先通过 `da-vinci pencil-session begin` 开始这轮设计,让登记路径先 seed 好并拿到锁
195
+ - 如果项目里原本已有 `.pen`,继续设计时先打开它,但发生实质性 live edit 后优先通过 `da-vinci pencil-session persist` 把当前 MCP 快照重新覆盖写回同一路径
187
196
  6. 更新 `pencil-bindings.md`
188
197
  7. 生成 `tasks.md`
189
198
  8. 进入实现