@xenonbyte/da-vinci-workflow 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -2
- package/README.md +41 -1
- package/README.zh-CN.md +42 -1
- package/SKILL.md +22 -0
- package/commands/claude/dv/design.md +8 -0
- package/commands/claude/dv/verify.md +2 -0
- package/commands/codex/prompts/dv-design.md +8 -0
- package/commands/codex/prompts/dv-verify.md +1 -0
- package/commands/gemini/dv/design.toml +8 -0
- package/commands/gemini/dv/verify.toml +1 -0
- package/docs/mcp-aware-gate-implementation.md +291 -0
- package/docs/mcp-aware-gate-tests.md +244 -0
- package/docs/mcp-aware-gate.md +246 -0
- package/docs/mode-use-cases.md +7 -1
- package/docs/prompt-presets/README.md +3 -0
- package/docs/prompt-presets/desktop-app.md +19 -1
- package/docs/prompt-presets/mobile-app.md +19 -1
- package/docs/prompt-presets/tablet-app.md +19 -1
- package/docs/prompt-presets/web-app.md +19 -1
- package/docs/visual-assist-presets/README.md +5 -0
- package/docs/workflow-examples.md +24 -5
- package/docs/zh-CN/mcp-aware-gate-implementation.md +290 -0
- package/docs/zh-CN/mcp-aware-gate-tests.md +244 -0
- package/docs/zh-CN/mcp-aware-gate.md +249 -0
- package/docs/zh-CN/mode-use-cases.md +15 -4
- package/docs/zh-CN/prompt-presets/README.md +3 -0
- package/docs/zh-CN/prompt-presets/desktop-app.md +19 -1
- package/docs/zh-CN/prompt-presets/mobile-app.md +19 -1
- package/docs/zh-CN/prompt-presets/tablet-app.md +19 -1
- package/docs/zh-CN/prompt-presets/web-app.md +19 -1
- package/docs/zh-CN/visual-assist-presets/README.md +5 -0
- package/docs/zh-CN/workflow-examples.md +24 -5
- package/lib/audit.js +348 -0
- package/lib/cli.js +142 -1
- package/lib/mcp-runtime-gate.js +342 -0
- package/lib/pen-persistence.js +326 -0
- package/lib/pencil-preflight.js +438 -0
- package/package.json +5 -2
- package/references/artifact-templates.md +28 -1
- package/references/checkpoints.md +75 -1
- package/references/design-inputs.md +2 -1
- package/references/pencil-design-to-code.md +16 -0
- package/scripts/fixtures/complex-sample.pen +295 -0
- package/scripts/test-mcp-runtime-gate.js +199 -0
- package/scripts/test-pen-persistence.js +110 -0
- package/scripts/test-pencil-preflight.js +153 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## v0.1.16 - 2026-03-28
|
|
4
4
|
|
|
5
|
-
|
|
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 snapshot-pen` to reopen an existing `.pen`, capture a fresh MCP-readable snapshot, and rewrite a canonical project-local `.pen` with reopen verification
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- 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
|
|
12
|
+
- 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
|
|
13
|
+
- project-local `.pen` persistence now treats headless interactive `save()` as non-authoritative; first-run sessions must persist the first approved live MCP snapshot, and resume sessions must overwrite the registered `.pen` from the current snapshot after material live edits
|
|
14
|
+
|
|
15
|
+
## v0.1.15 - 2026-03-27
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- MCP-aware runtime gate now has a first implementation slice: a pure evaluator, runtime-gate recording shape, and workflow hooks that require live source convergence checks before terminal completion claims
|
|
19
|
+
- `da-vinci audit` now distinguishes `integrity` and `completion` modes so mid-workflow sanity checks do not masquerade as terminal completion gates
|
|
20
|
+
- completion guidance now blocks terminal `design complete` or `workflow complete` claims unless the registered project-local `.pen` source is shell-visible, standard artifacts exist, and the completion gate passes
|
|
21
|
+
- design-source rules now reject unnamed live editors such as `new` as persisted project sources and explicitly block screenshot or markdown pollution inside `.da-vinci/designs/`
|
|
22
|
+
- prompt presets, workflow examples, and mode guides now state that screenshot exports belong under `.da-vinci/changes/<change-id>/exports/` and cannot replace the `.pen` source of truth
|
|
23
|
+
- Pencil-operation guidance now treats repeated unsupported-property rollbacks on the same anchor surface as unstable progress instead of acceptable forward motion
|
|
6
24
|
|
|
7
25
|
## v0.1.14 - 2026-03-27
|
|
8
26
|
|
package/README.md
CHANGED
|
@@ -27,10 +27,13 @@ This workflow is intended for:
|
|
|
27
27
|
|
|
28
28
|
Latest published npm package:
|
|
29
29
|
|
|
30
|
-
- `@xenonbyte/da-vinci-workflow@0.1.
|
|
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
|
+
- `da-vinci write-pen` now atomically writes workflow-owned `.pen` files from MCP-readable node and variable payloads with optional reopen verification
|
|
36
|
+
- `da-vinci snapshot-pen` now rebuilds a canonical local `.pen` from an existing Pencil source and verifies reopen with Pencil
|
|
34
37
|
- visual-adapter execution now requires explicit runtime declaration of the resolved primary adapter and any unavailable requested adapters
|
|
35
38
|
- 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
39
|
- complex `redesign-from-code` runs now require a visual thesis, content plan, interaction thesis, and anchor-surface structural-delta notes before broad Pencil generation
|
|
@@ -414,9 +417,46 @@ Useful commands:
|
|
|
414
417
|
```bash
|
|
415
418
|
da-vinci status
|
|
416
419
|
da-vinci validate-assets
|
|
420
|
+
da-vinci audit --mode integrity /abs/path/to/project
|
|
421
|
+
da-vinci audit --mode completion --change <change-id> /abs/path/to/project
|
|
422
|
+
da-vinci preflight-pencil --ops-file /abs/path/to/ops.txt
|
|
417
423
|
da-vinci uninstall --platform codex,claude,gemini
|
|
418
424
|
```
|
|
419
425
|
|
|
426
|
+
`da-vinci audit` has two intended modes:
|
|
427
|
+
|
|
428
|
+
- `--mode integrity`: a mid-workflow filesystem-truth check for missing baseline artifacts, misplaced exports, polluted `.da-vinci/designs/`, and missing persisted `.pen` sources
|
|
429
|
+
- `--mode completion`: a strict pre-completion gate for one change scope; use `--change <change-id>` and treat any failure as blocking
|
|
430
|
+
|
|
431
|
+
Both modes check the most common workflow-integrity failures in a project:
|
|
432
|
+
|
|
433
|
+
- missing standard Da Vinci artifacts
|
|
434
|
+
- missing shell-visible project-local `.pen` sources
|
|
435
|
+
- pollution inside `.da-vinci/designs/`
|
|
436
|
+
- screenshot exports stored in the wrong place
|
|
437
|
+
- empty or partial change scaffolds
|
|
438
|
+
|
|
439
|
+
`da-vinci preflight-pencil` is a static guard for non-trivial `batch_design` payloads:
|
|
440
|
+
|
|
441
|
+
- catches JS-like syntax mistakes before they hit Pencil MCP
|
|
442
|
+
- flags common schema drift such as bad `padding`, invalid hex colors, `flex`, `margin`, and `overflow`
|
|
443
|
+
- warns when anchor-surface batches are too large and should be split before retrying
|
|
444
|
+
|
|
445
|
+
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.
|
|
446
|
+
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.
|
|
447
|
+
|
|
448
|
+
Project-local `.pen` persistence now has two supported paths:
|
|
449
|
+
|
|
450
|
+
- first-run path: if no registered project-local `.pen` exists yet, let the first approved anchor surface happen in the live editor, then persist that approved MCP snapshot under `.da-vinci/designs/`
|
|
451
|
+
- resume path: if a registered project-local `.pen` already exists, reopen it for continuity, but after material live edits persist a fresh MCP snapshot back to the same path instead of assuming interactive `save()` flushed it
|
|
452
|
+
|
|
453
|
+
Persistence helpers:
|
|
454
|
+
|
|
455
|
+
- `da-vinci write-pen --output <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version> --verify-open`
|
|
456
|
+
- `da-vinci snapshot-pen --input <existing.pen> --output <target.pen> --verify-open`
|
|
457
|
+
|
|
458
|
+
Do not treat headless interactive `save()` as authoritative persistence truth until the underlying Pencil behavior is proven reliable again.
|
|
459
|
+
|
|
420
460
|
Installation targets:
|
|
421
461
|
|
|
422
462
|
- Codex prompts: `~/.codex/prompts/`
|
package/README.zh-CN.md
CHANGED
|
@@ -29,10 +29,13 @@ Da Vinci 是一个把产品需求一路推进到结构化规格、Pencil 设计
|
|
|
29
29
|
|
|
30
30
|
最新已发布 npm 包:
|
|
31
31
|
|
|
32
|
-
- `@xenonbyte/da-vinci-workflow@0.1.
|
|
32
|
+
- `@xenonbyte/da-vinci-workflow@0.1.16`
|
|
33
33
|
|
|
34
34
|
已发布版本重点:
|
|
35
35
|
|
|
36
|
+
- 项目内 `.pen` 持久化现在改为“从 MCP 快照写回磁盘”的正式路径,不再依赖 headless interactive `save()`
|
|
37
|
+
- `da-vinci write-pen` 现在可以把 MCP 可读的节点和变量快照原子写成工作流管理的 `.pen` 文件,并可选地做 reopen 校验
|
|
38
|
+
- `da-vinci snapshot-pen` 现在可以从现有 Pencil 源重建一个规范化的本地 `.pen`,并验证重新打开结果
|
|
36
39
|
- visual adapter 的执行现在要求在运行时明确声明解析出来的主 adapter,以及哪些请求的 adapter 当前不可用
|
|
37
40
|
- `frontend-skill`、`frontend-design` 这类跨平台近名 adapter 现在明确视为不同能力源,除非当前环境真的解析到了它们
|
|
38
41
|
- 复杂 `redesign-from-code` 现在要求在大规模 Pencil 设计前先写 visual thesis、content plan、interaction thesis 和 anchor surface 的 structural-delta 说明
|
|
@@ -343,9 +346,47 @@ da-vinci install --platform codex,claude,gemini
|
|
|
343
346
|
```bash
|
|
344
347
|
da-vinci status
|
|
345
348
|
da-vinci validate-assets
|
|
349
|
+
da-vinci audit --mode integrity /abs/path/to/project
|
|
350
|
+
da-vinci audit --mode completion --change <change-id> /abs/path/to/project
|
|
351
|
+
da-vinci preflight-pencil --ops-file /abs/path/to/ops.txt
|
|
346
352
|
da-vinci uninstall --platform codex,claude,gemini
|
|
347
353
|
```
|
|
348
354
|
|
|
355
|
+
`da-vinci audit` 现在有两种主要模式:
|
|
356
|
+
|
|
357
|
+
- `--mode integrity`:适合在工作进行中检查文件系统真相,比如基础工件缺失、导出路径错误、`.da-vinci/designs/` 被污染、项目内 `.pen` 没落盘
|
|
358
|
+
- `--mode completion`:适合在宣称完成前做严格检查;配合 `--change <change-id>` 使用,任何失败都应视为阻断
|
|
359
|
+
|
|
360
|
+
两种模式都会检查项目里最常见的工作流完整性问题:
|
|
361
|
+
|
|
362
|
+
- 标准 Da Vinci 工件缺失
|
|
363
|
+
- 项目内 shell 可见 `.pen` 设计源缺失
|
|
364
|
+
- `.da-vinci/designs/` 目录被污染
|
|
365
|
+
- 截图导出写到了错误位置
|
|
366
|
+
- change scaffold 只有空目录或只写了一半
|
|
367
|
+
|
|
368
|
+
`da-vinci preflight-pencil` 是给非小型 `batch_design` 用的静态预检:
|
|
369
|
+
|
|
370
|
+
- 在发给 Pencil MCP 之前先抓出 JS-like 语法错误
|
|
371
|
+
- 直接标出常见 schema 漂移,比如错误 `padding`、非法 hex 颜色、`flex`、`margin`、`overflow`
|
|
372
|
+
- 当 anchor-surface 批次太大时给出拆批警告,避免继续大块回滚
|
|
373
|
+
|
|
374
|
+
当 Pencil MCP 可用时,Da Vinci 现在还要求在终态完成声明前,把 MCP runtime gate 结果记录到 `pencil-design.md`。这层 gate 负责检查 live editor/source convergence,与 filesystem audit 分工不同。
|
|
375
|
+
在重设计进行中,建议在第一次成功写入 Pencil 后立即运行 `da-vinci audit --mode integrity <project-path>`;如果同一个 anchor surface 连续回滚,则继续配合 `da-vinci preflight-pencil` 和更小的 follow-up batch。
|
|
376
|
+
|
|
377
|
+
项目内 `.pen` 持久化现在分成两条受支持路径:
|
|
378
|
+
|
|
379
|
+
- 首次运行路径:如果当前还没有登记的项目内 `.pen`,先允许第一个通过审查的 anchor surface 在 live editor 里完成,然后把这个 MCP 快照持久化到 `.da-vinci/designs/`
|
|
380
|
+
- 继续迭代路径:如果项目里原本已有登记的 `.pen`,先打开它继续工作;但发生实质性 live edit 后,要把当前 MCP 快照重新持久化回同一路径,而不是假设 interactive `save()` 已经刷回磁盘
|
|
381
|
+
|
|
382
|
+
推荐使用的持久化命令:
|
|
383
|
+
|
|
384
|
+
- `da-vinci write-pen --output <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version> --verify-open`
|
|
385
|
+
- `da-vinci snapshot-pen --input <existing.pen> --output <target.pen> --verify-open`
|
|
386
|
+
|
|
387
|
+
在 Pencil 底层 `save()` 语义再次被证明可靠之前,不要把 headless interactive `save()` 当作权威持久化真相。
|
|
388
|
+
在重设计进行中,建议在第一次成功写入 Pencil 后立刻跑一次 `da-vinci audit --mode integrity <project-path>`;如果同一个 anchor surface 连续回滚两次,就配合 `da-vinci preflight-pencil` 改成更小的后续批次。
|
|
389
|
+
|
|
349
390
|
安装目标:
|
|
350
391
|
|
|
351
392
|
- Codex prompts:`~/.codex/prompts/`
|
package/SKILL.md
CHANGED
|
@@ -216,17 +216,34 @@ Default completion rule:
|
|
|
216
216
|
- if the request is `design-only`, stop after design artifacts and bindings
|
|
217
217
|
- otherwise assume `full-delivery` and continue through implementation and verification
|
|
218
218
|
|
|
219
|
+
Do not report `design complete`, `workflow complete`, or any equivalent terminal state unless the completion gate in `references/checkpoints.md` is satisfied.
|
|
220
|
+
When shell access is available, prefer `da-vinci audit --mode integrity <project-path>` during active workflow work and `da-vinci audit --mode completion --change <change-id> <project-path>` before any terminal completion claim.
|
|
221
|
+
|
|
219
222
|
## Pencil Generation Rules
|
|
220
223
|
|
|
221
224
|
During active Pencil work:
|
|
222
225
|
|
|
226
|
+
- do not begin anchor-surface generation until the required discovery and design-source artifacts exist in their standard locations for the active mode
|
|
223
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
|
|
224
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
|
+
- when no registered project-local `.pen` exists yet, let the first anchor work happen in the live editor, then persist the first complete MCP snapshot to the registered `.pen` path before broad expansion continues
|
|
233
|
+
- when a registered project-local `.pen` already exists, reopen it for continuity, but after material live edits persist a fresh MCP snapshot back to the same path instead of assuming live edits were flushed automatically
|
|
234
|
+
- 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
|
|
225
235
|
- 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
|
|
236
|
+
- after the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` when shell access is available before broad expansion continues
|
|
237
|
+
- after the first successful Pencil write, run the MCP runtime gate when Pencil MCP is available and record the result in `pencil-design.md`
|
|
238
|
+
- 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
|
|
226
239
|
- use only Pencil-supported properties; do not emit web- or CSS-only layout properties such as `flex` or `margin`
|
|
240
|
+
- 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
|
|
241
|
+
- 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
|
|
227
242
|
- on complex redesigns, turn approved anchor surfaces into a small shared primitive family before broad page expansion
|
|
228
243
|
- apply the resolved form-factor-specific layout hygiene profile before passing screenshot review on any anchor surface or other approval candidate
|
|
244
|
+
- 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
|
|
229
245
|
- 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`
|
|
246
|
+
- 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
|
|
230
247
|
|
|
231
248
|
## Load References On Demand
|
|
232
249
|
|
|
@@ -573,6 +590,11 @@ When Pencil is available through MCP:
|
|
|
573
590
|
- Before mapping or implementation closes, verify both:
|
|
574
591
|
- the `.pen` path is readable through MCP
|
|
575
592
|
- the same path exists as a shell-visible file inside the project
|
|
593
|
+
- Before broad expansion or terminal completion, run the MCP runtime gate:
|
|
594
|
+
- evaluate source convergence from the active editor, registered `.pen` path, and shell-visible `.pen` file
|
|
595
|
+
- evaluate screen presence for claimed anchor and review target ids
|
|
596
|
+
- evaluate review execution for approved surfaces
|
|
597
|
+
- append the runtime gate result to `pencil-design.md`
|
|
576
598
|
|
|
577
599
|
When Pencil is not available:
|
|
578
600
|
|
|
@@ -18,3 +18,11 @@ 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
|
+
If no registered project-local `.pen` exists yet, persist the first approved MCP snapshot under `.da-vinci/designs/` instead of relying on interactive `save()`.
|
|
24
|
+
If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh MCP snapshot back to that same path after material live edits.
|
|
25
|
+
After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
|
|
26
|
+
If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
|
|
27
|
+
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.
|
|
28
|
+
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,3 +12,11 @@ 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
|
+
If no registered project-local `.pen` exists yet, persist the first approved MCP snapshot under `.da-vinci/designs/` instead of relying on interactive `save()`.
|
|
18
|
+
If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh MCP snapshot back to that same path after material live edits.
|
|
19
|
+
After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
|
|
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.
|
|
22
|
+
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,4 +11,12 @@ 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
|
+
If no registered project-local `.pen` exists yet, persist the first approved MCP snapshot under `.da-vinci/designs/` instead of relying on interactive `save()`.
|
|
17
|
+
If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh MCP snapshot back to that same path after material live edits.
|
|
18
|
+
After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
|
|
19
|
+
If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
|
|
20
|
+
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.
|
|
21
|
+
Before reporting `design complete` or `workflow complete`, run `da-vinci audit --mode completion --change <change-id> <project-path>` and treat any failure as blocking.
|
|
14
22
|
"""
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# MCP-Aware Gate Implementation Design
|
|
2
|
+
|
|
3
|
+
This document turns the MCP-aware gate proposal into an implementation design.
|
|
4
|
+
|
|
5
|
+
It still does not commit to writing code.
|
|
6
|
+
|
|
7
|
+
## Scope
|
|
8
|
+
|
|
9
|
+
This design covers only the first implementation slice:
|
|
10
|
+
|
|
11
|
+
- runtime source convergence
|
|
12
|
+
- runtime screen presence
|
|
13
|
+
- runtime review execution
|
|
14
|
+
- completion blocking when runtime truth and filesystem truth diverge
|
|
15
|
+
|
|
16
|
+
It does not cover:
|
|
17
|
+
|
|
18
|
+
- automatic `.pen` reconstruction
|
|
19
|
+
- CLI access to live MCP state
|
|
20
|
+
- session persistence or transport work
|
|
21
|
+
|
|
22
|
+
## Design Goal
|
|
23
|
+
|
|
24
|
+
Add a narrow runtime checkpoint that can stop false completion claims caused by live-editor drift.
|
|
25
|
+
|
|
26
|
+
The gate should catch cases like:
|
|
27
|
+
|
|
28
|
+
- active editor is still `new`
|
|
29
|
+
- anchor screens exist only in the live session
|
|
30
|
+
- node ids used for screenshots do not exist in the current editor
|
|
31
|
+
- the workflow claims completion before runtime state and filesystem state converge
|
|
32
|
+
|
|
33
|
+
## Existing Constraints
|
|
34
|
+
|
|
35
|
+
The current architecture already provides:
|
|
36
|
+
|
|
37
|
+
- filesystem `audit`
|
|
38
|
+
- checkpoint rules in `references/checkpoints.md`
|
|
39
|
+
- artifact expectations in `design-registry.md` and `pencil-design.md`
|
|
40
|
+
- MCP access to active editor state and screen nodes
|
|
41
|
+
|
|
42
|
+
The current architecture does not provide:
|
|
43
|
+
|
|
44
|
+
- a CLI bridge to MCP runtime state
|
|
45
|
+
- a stable session id outside the active agent context
|
|
46
|
+
|
|
47
|
+
That means the MCP-aware gate must be executed inside the agent workflow while MCP tools are live.
|
|
48
|
+
|
|
49
|
+
## Implementation Placement
|
|
50
|
+
|
|
51
|
+
### Primary insertion points
|
|
52
|
+
|
|
53
|
+
1. After the first successful Pencil write in a design pass.
|
|
54
|
+
2. Before any terminal `design complete` or `workflow complete` claim.
|
|
55
|
+
|
|
56
|
+
### Secondary insertion point
|
|
57
|
+
|
|
58
|
+
3. Before broad expansion beyond approved anchor surfaces when the design pass depends on screenshot-reviewed anchors.
|
|
59
|
+
|
|
60
|
+
### Why these points
|
|
61
|
+
|
|
62
|
+
- after first write: catches `new`-editor drift early
|
|
63
|
+
- before completion: catches false success claims
|
|
64
|
+
- before broad expansion: prevents weak runtime state from spreading into more screens
|
|
65
|
+
|
|
66
|
+
## Owning Workflow Stage
|
|
67
|
+
|
|
68
|
+
The runtime gate should be owned by the design phase, not the CLI.
|
|
69
|
+
|
|
70
|
+
That means:
|
|
71
|
+
|
|
72
|
+
- design routes should execute it while Pencil MCP is available
|
|
73
|
+
- verify routes may re-check it if design completion is being claimed
|
|
74
|
+
- build routes should not become the primary owner of runtime gate logic
|
|
75
|
+
|
|
76
|
+
## Input Sources
|
|
77
|
+
|
|
78
|
+
### MCP inputs
|
|
79
|
+
|
|
80
|
+
Required:
|
|
81
|
+
|
|
82
|
+
- active editor state
|
|
83
|
+
- top-level nodes
|
|
84
|
+
- targeted node reads for claimed anchor surfaces
|
|
85
|
+
|
|
86
|
+
Expected MCP operations:
|
|
87
|
+
|
|
88
|
+
- `pencil.get_editor_state`
|
|
89
|
+
- `pencil.batch_get`
|
|
90
|
+
|
|
91
|
+
### Filesystem inputs
|
|
92
|
+
|
|
93
|
+
Required:
|
|
94
|
+
|
|
95
|
+
- shell-visible `.pen` existence
|
|
96
|
+
- registered `.pen` path from `design-registry.md`
|
|
97
|
+
- declared reviewed screens and screenshot targets from `pencil-design.md`
|
|
98
|
+
|
|
99
|
+
Expected shell or file reads:
|
|
100
|
+
|
|
101
|
+
- read `design-registry.md`
|
|
102
|
+
- read `pencil-design.md`
|
|
103
|
+
- check registered `.pen` path on disk
|
|
104
|
+
|
|
105
|
+
## Runtime Snapshot Model
|
|
106
|
+
|
|
107
|
+
The runtime gate should build one structured snapshot in memory:
|
|
108
|
+
|
|
109
|
+
```md
|
|
110
|
+
runtime snapshot
|
|
111
|
+
- activeEditor
|
|
112
|
+
- topLevelScreenIds
|
|
113
|
+
- topLevelScreenNames
|
|
114
|
+
- registeredPenPath
|
|
115
|
+
- shellVisiblePenExists
|
|
116
|
+
- claimedAnchorIds
|
|
117
|
+
- claimedReviewedScreenIds
|
|
118
|
+
- reviewTargets
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The evaluator should only depend on this snapshot.
|
|
122
|
+
|
|
123
|
+
That keeps the implementation testable without needing a real live Pencil session for every case.
|
|
124
|
+
|
|
125
|
+
## Evaluation Stages
|
|
126
|
+
|
|
127
|
+
### Stage 1: Source Convergence
|
|
128
|
+
|
|
129
|
+
Checks:
|
|
130
|
+
|
|
131
|
+
- active editor is not `new`
|
|
132
|
+
- registered `.pen` path exists in `design-registry.md`
|
|
133
|
+
- registered `.pen` path exists on disk
|
|
134
|
+
- active editor and registered source do not obviously diverge
|
|
135
|
+
|
|
136
|
+
Result rules:
|
|
137
|
+
|
|
138
|
+
- `PASS`: runtime source and registered source converge
|
|
139
|
+
- `WARN`: no new live edits happened yet, or a documented deferred baseline is still being used
|
|
140
|
+
- `BLOCK`: runtime source is unnamed, missing, or diverged
|
|
141
|
+
|
|
142
|
+
### Stage 2: Screen Presence
|
|
143
|
+
|
|
144
|
+
Checks:
|
|
145
|
+
|
|
146
|
+
- claimed anchor ids exist in live MCP state
|
|
147
|
+
- claimed reviewed screens exist in live MCP state
|
|
148
|
+
- screenshot targets resolve in the active document
|
|
149
|
+
|
|
150
|
+
Result rules:
|
|
151
|
+
|
|
152
|
+
- `PASS`: claimed design output is traceable to live editor nodes
|
|
153
|
+
- `WARN`: screen naming drift exists but ids are still traceable
|
|
154
|
+
- `BLOCK`: claimed screens or targets do not resolve
|
|
155
|
+
|
|
156
|
+
### Stage 3: Review Execution
|
|
157
|
+
|
|
158
|
+
Checks:
|
|
159
|
+
|
|
160
|
+
- each approved anchor has a reviewed screen id or screenshot target
|
|
161
|
+
- runtime review records align with the current live editor
|
|
162
|
+
- review blockers were not ignored
|
|
163
|
+
|
|
164
|
+
Result rules:
|
|
165
|
+
|
|
166
|
+
- `PASS`: runtime review is credible
|
|
167
|
+
- `WARN`: review exists but requires follow-up before expansion
|
|
168
|
+
- `BLOCK`: approval claim is unsupported by runtime evidence
|
|
169
|
+
|
|
170
|
+
## Recording Strategy
|
|
171
|
+
|
|
172
|
+
Do not introduce a new artifact family.
|
|
173
|
+
|
|
174
|
+
Append a structured section to `pencil-design.md`:
|
|
175
|
+
|
|
176
|
+
```md
|
|
177
|
+
## MCP Runtime Gate
|
|
178
|
+
- Time:
|
|
179
|
+
- Active editor:
|
|
180
|
+
- Registered `.pen` path:
|
|
181
|
+
- Shell-visible `.pen` path:
|
|
182
|
+
- Claimed anchor ids:
|
|
183
|
+
- Reviewed screen ids:
|
|
184
|
+
- Source convergence: PASS | WARN | BLOCK
|
|
185
|
+
- Screen presence: PASS | WARN | BLOCK
|
|
186
|
+
- Review execution: PASS | WARN | BLOCK
|
|
187
|
+
- Final runtime gate status: PASS | WARN | BLOCK
|
|
188
|
+
- Notes:
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Why `pencil-design.md`
|
|
192
|
+
|
|
193
|
+
- it already records source path, screens, screenshots, and design notes
|
|
194
|
+
- it is the closest existing artifact to runtime design truth
|
|
195
|
+
- it avoids scattering checkpoint state across ad hoc files
|
|
196
|
+
|
|
197
|
+
## Failure Handling
|
|
198
|
+
|
|
199
|
+
When runtime gate returns `BLOCK`:
|
|
200
|
+
|
|
201
|
+
- do not continue to broad multi-screen expansion
|
|
202
|
+
- do not claim design completion
|
|
203
|
+
- do not claim workflow completion
|
|
204
|
+
- record the mismatch explicitly in `pencil-design.md`
|
|
205
|
+
|
|
206
|
+
When runtime gate returns `WARN`:
|
|
207
|
+
|
|
208
|
+
- allow continuation only when the warning does not create source ambiguity
|
|
209
|
+
- do not allow terminal completion unless the warning is explicitly resolved or accepted by the workflow rules
|
|
210
|
+
|
|
211
|
+
## Interaction With Filesystem Audit
|
|
212
|
+
|
|
213
|
+
The runtime gate should run first.
|
|
214
|
+
|
|
215
|
+
Then:
|
|
216
|
+
|
|
217
|
+
- if runtime gate is `BLOCK`, stop immediately
|
|
218
|
+
- if runtime gate is `PASS` or acceptable `WARN`, run filesystem completion audit before terminal completion
|
|
219
|
+
|
|
220
|
+
That yields this order:
|
|
221
|
+
|
|
222
|
+
1. runtime gate
|
|
223
|
+
2. filesystem completion audit
|
|
224
|
+
3. completion claim
|
|
225
|
+
|
|
226
|
+
## Minimal Pseudoflow
|
|
227
|
+
|
|
228
|
+
```md
|
|
229
|
+
1. perform first successful Pencil write
|
|
230
|
+
2. read active editor via MCP
|
|
231
|
+
3. read claimed anchor ids from `pencil-design.md`
|
|
232
|
+
4. read registered `.pen` path from `design-registry.md`
|
|
233
|
+
5. check shell-visible `.pen`
|
|
234
|
+
6. read live nodes for claimed anchors
|
|
235
|
+
7. evaluate source convergence
|
|
236
|
+
8. evaluate screen presence
|
|
237
|
+
9. evaluate review execution when relevant
|
|
238
|
+
10. append runtime gate results to `pencil-design.md`
|
|
239
|
+
11. if terminal completion is being claimed, run filesystem completion audit
|
|
240
|
+
12. only report completion if both layers pass
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Boundary Decisions
|
|
244
|
+
|
|
245
|
+
### When Pencil MCP is unavailable
|
|
246
|
+
|
|
247
|
+
Do not try to emulate runtime gate.
|
|
248
|
+
|
|
249
|
+
Instead:
|
|
250
|
+
|
|
251
|
+
- record that MCP runtime gate could not run
|
|
252
|
+
- fall back to filesystem audit plus documented constraints
|
|
253
|
+
- do not describe the runtime gate as passed
|
|
254
|
+
|
|
255
|
+
### When no anchor ids are recorded yet
|
|
256
|
+
|
|
257
|
+
The runtime gate may run a reduced source-convergence-only check after the first Pencil write.
|
|
258
|
+
|
|
259
|
+
It should not pretend screen-presence or review-execution checks were completed.
|
|
260
|
+
|
|
261
|
+
### When no new Pencil edits happened
|
|
262
|
+
|
|
263
|
+
Use `WARN` or skip runtime gate rather than fabricating a pass.
|
|
264
|
+
|
|
265
|
+
## Non-Functional Requirements
|
|
266
|
+
|
|
267
|
+
The first implementation should be:
|
|
268
|
+
|
|
269
|
+
- deterministic
|
|
270
|
+
- append-only in artifact recording
|
|
271
|
+
- easy to unit-test from a runtime snapshot object
|
|
272
|
+
- independent from CLI transport changes
|
|
273
|
+
|
|
274
|
+
## Implementation Steps
|
|
275
|
+
|
|
276
|
+
Recommended order:
|
|
277
|
+
|
|
278
|
+
1. define a runtime snapshot shape
|
|
279
|
+
2. define a pure evaluator over that snapshot
|
|
280
|
+
3. add a writer that appends runtime gate results to `pencil-design.md`
|
|
281
|
+
4. call the gate from design-phase runtime checkpoints
|
|
282
|
+
5. wire terminal completion to require both runtime gate and filesystem completion audit
|
|
283
|
+
|
|
284
|
+
## Deferred Work
|
|
285
|
+
|
|
286
|
+
Do not include these in the first implementation:
|
|
287
|
+
|
|
288
|
+
- auto-repair of editor/source mismatch
|
|
289
|
+
- multi-session state reconciliation
|
|
290
|
+
- CLI-facing live runtime commands
|
|
291
|
+
- generalized checkpoint orchestration engine
|