@xenonbyte/da-vinci-workflow 0.1.13 → 0.1.15
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 +21 -1
- package/README.md +23 -1
- package/README.zh-CN.md +23 -1
- package/SKILL.md +15 -0
- package/commands/claude/dv/design.md +2 -0
- package/commands/claude/dv/verify.md +2 -0
- package/commands/codex/prompts/dv-design.md +2 -0
- package/commands/codex/prompts/dv-verify.md +1 -0
- package/commands/gemini/dv/design.toml +2 -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 +2 -0
- package/docs/prompt-presets/README.md +1 -0
- package/docs/prompt-presets/desktop-app.md +4 -0
- package/docs/prompt-presets/mobile-app.md +4 -0
- package/docs/prompt-presets/tablet-app.md +4 -0
- package/docs/prompt-presets/web-app.md +4 -0
- package/docs/visual-adapters.md +9 -0
- package/docs/visual-assist-presets/README.md +4 -2
- package/docs/visual-assist-presets/desktop-app.md +2 -0
- package/docs/visual-assist-presets/mobile-app.md +2 -0
- package/docs/visual-assist-presets/tablet-app.md +2 -0
- package/docs/visual-assist-presets/web-app.md +2 -0
- package/docs/workflow-examples.md +9 -4
- 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 +3 -0
- package/docs/zh-CN/prompt-presets/README.md +1 -0
- package/docs/zh-CN/prompt-presets/desktop-app.md +4 -0
- package/docs/zh-CN/prompt-presets/mobile-app.md +4 -0
- package/docs/zh-CN/prompt-presets/tablet-app.md +4 -0
- package/docs/zh-CN/prompt-presets/web-app.md +4 -0
- package/docs/zh-CN/visual-adapters.md +9 -0
- package/docs/zh-CN/visual-assist-presets/README.md +5 -3
- package/docs/zh-CN/visual-assist-presets/desktop-app.md +2 -0
- package/docs/zh-CN/visual-assist-presets/mobile-app.md +2 -0
- package/docs/zh-CN/visual-assist-presets/tablet-app.md +2 -0
- package/docs/zh-CN/visual-assist-presets/web-app.md +2 -0
- package/docs/zh-CN/workflow-examples.md +9 -4
- package/examples/greenfield-spec-markupflow/DA-VINCI.md +1 -0
- package/examples/greenfield-spec-markupflow/README.md +3 -0
- package/examples/greenfield-spec-markupflow/design-registry.md +3 -0
- package/examples/greenfield-spec-markupflow/pencil-design.md +4 -0
- package/lib/audit.js +348 -0
- package/lib/cli.js +47 -1
- package/lib/mcp-runtime-gate.js +342 -0
- package/package.json +3 -2
- package/references/artifact-templates.md +35 -3
- package/references/checkpoints.md +69 -1
- package/references/design-inputs.md +9 -1
- package/references/layout-hygiene.md +117 -0
- package/references/pencil-design-to-code.md +8 -0
- package/scripts/test-mcp-runtime-gate.js +199 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## v0.1.15 - 2026-03-27
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- 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
|
|
9
|
+
- `da-vinci audit` now distinguishes `integrity` and `completion` modes so mid-workflow sanity checks do not masquerade as terminal completion gates
|
|
10
|
+
- 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
|
|
11
|
+
- 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/`
|
|
12
|
+
- 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
|
|
13
|
+
- Pencil-operation guidance now treats repeated unsupported-property rollbacks on the same anchor surface as unstable progress instead of acceptable forward motion
|
|
14
|
+
|
|
15
|
+
## v0.1.14 - 2026-03-27
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- `references/layout-hygiene.md` as the central form-factor-specific layout hygiene gate for mobile, tablet, desktop, and web screenshot review
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- screenshot-review and design-checkpoint guidance now apply a resolved layout-hygiene profile per reviewed surface instead of relying on generic spacing checks alone
|
|
22
|
+
- design-input and artifact-template guidance now records the resolved layout-hygiene profile and blocker classes in `design-brief.md` and `pencil-design.md`
|
|
23
|
+
- visual-adapter docs now state explicitly that `Visual Assist` does not replace form-factor-specific layout hygiene
|
|
24
|
+
- prompt presets for mobile, tablet, desktop, and web now point to the form-factor-specific layout hygiene gate before screenshot review passes
|
|
25
|
+
- Chinese documentation now matches the new layout-hygiene guidance instead of mixing untranslated preset instructions
|
|
6
26
|
|
|
7
27
|
## v0.1.13 - 2026-03-27
|
|
8
28
|
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ 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.14`
|
|
31
31
|
|
|
32
32
|
Release highlights:
|
|
33
33
|
|
|
@@ -35,6 +35,7 @@ Release highlights:
|
|
|
35
35
|
- 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
36
|
- complex `redesign-from-code` runs now require a visual thesis, content plan, interaction thesis, and anchor-surface structural-delta notes before broad Pencil generation
|
|
37
37
|
- screenshot review is now documented as a binding gate; analysis that reports hierarchy, spacing, clarity, or inconsistency issues cannot be treated as an automatic pass
|
|
38
|
+
- form-factor-specific layout hygiene is now documented as a separate hard gate from `Visual Assist`, with blocker conditions for mobile, tablet, desktop, and web review
|
|
38
39
|
- `.da-vinci/designs/` is now documented more strictly as a `.pen`-only directory, and project-local `.pen` persistence must be verified as shell-visible immediately after the first Pencil write
|
|
39
40
|
- multi-surface redesign guidance now requires a shared primitive family to be defined from approved anchor surfaces before broad page expansion
|
|
40
41
|
- Pencil generation guidance now explicitly rejects web-only properties such as `flex` and `margin`
|
|
@@ -116,6 +117,7 @@ Recommended default:
|
|
|
116
117
|
- visual contract refinement
|
|
117
118
|
- page composition
|
|
118
119
|
- hierarchy and spacing
|
|
120
|
+
- anchor-surface composition
|
|
119
121
|
- Pencil design refinement
|
|
120
122
|
- Fallback:
|
|
121
123
|
- native-da-vinci
|
|
@@ -141,6 +143,7 @@ Quality-first redesign configuration:
|
|
|
141
143
|
- page composition
|
|
142
144
|
- hierarchy and spacing
|
|
143
145
|
- motion guidance
|
|
146
|
+
- anchor-surface composition
|
|
144
147
|
- Pencil design refinement
|
|
145
148
|
- Fallback:
|
|
146
149
|
- native-da-vinci
|
|
@@ -158,8 +161,10 @@ Selection rules:
|
|
|
158
161
|
|
|
159
162
|
- keep `ui-ux-pro-max` first for dense app and dashboard surfaces when the visual bar is moderate
|
|
160
163
|
- move `frontend-skill` to the first slot when art direction, composition quality, and premium visual hierarchy matter more
|
|
164
|
+
- write actual installed adapter names for the current environment instead of assuming cross-platform aliases
|
|
161
165
|
- when `Preferred adapters` are configured, the resolved primary adapter should actively lead the first design pass instead of being recorded only for traceability
|
|
162
166
|
- state the resolved primary adapter explicitly at runtime and name any requested adapters that are unavailable
|
|
167
|
+
- treat form-factor-specific layout hygiene as a separate hard gate from `Visual Assist`; adapter choice does not override mobile/tablet/desktop/web review failures
|
|
163
168
|
- do not assume cross-platform equivalence between near-name adapters
|
|
164
169
|
- write a visual thesis, content plan, and interaction thesis before the first anchor surface
|
|
165
170
|
- use Pencil guides as platform/buildability constraints, not as the main art-direction source
|
|
@@ -409,9 +414,26 @@ Useful commands:
|
|
|
409
414
|
```bash
|
|
410
415
|
da-vinci status
|
|
411
416
|
da-vinci validate-assets
|
|
417
|
+
da-vinci audit --mode integrity /abs/path/to/project
|
|
418
|
+
da-vinci audit --mode completion --change <change-id> /abs/path/to/project
|
|
412
419
|
da-vinci uninstall --platform codex,claude,gemini
|
|
413
420
|
```
|
|
414
421
|
|
|
422
|
+
`da-vinci audit` has two intended modes:
|
|
423
|
+
|
|
424
|
+
- `--mode integrity`: a mid-workflow filesystem-truth check for missing baseline artifacts, misplaced exports, polluted `.da-vinci/designs/`, and missing persisted `.pen` sources
|
|
425
|
+
- `--mode completion`: a strict pre-completion gate for one change scope; use `--change <change-id>` and treat any failure as blocking
|
|
426
|
+
|
|
427
|
+
Both modes check the most common workflow-integrity failures in a project:
|
|
428
|
+
|
|
429
|
+
- missing standard Da Vinci artifacts
|
|
430
|
+
- missing shell-visible project-local `.pen` sources
|
|
431
|
+
- pollution inside `.da-vinci/designs/`
|
|
432
|
+
- screenshot exports stored in the wrong place
|
|
433
|
+
- empty or partial change scaffolds
|
|
434
|
+
|
|
435
|
+
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.
|
|
436
|
+
|
|
415
437
|
Installation targets:
|
|
416
438
|
|
|
417
439
|
- Codex prompts: `~/.codex/prompts/`
|
package/README.zh-CN.md
CHANGED
|
@@ -29,7 +29,7 @@ Da Vinci 是一个把产品需求一路推进到结构化规格、Pencil 设计
|
|
|
29
29
|
|
|
30
30
|
最新已发布 npm 包:
|
|
31
31
|
|
|
32
|
-
- `@xenonbyte/da-vinci-workflow@0.1.
|
|
32
|
+
- `@xenonbyte/da-vinci-workflow@0.1.14`
|
|
33
33
|
|
|
34
34
|
已发布版本重点:
|
|
35
35
|
|
|
@@ -37,6 +37,7 @@ Da Vinci 是一个把产品需求一路推进到结构化规格、Pencil 设计
|
|
|
37
37
|
- `frontend-skill`、`frontend-design` 这类跨平台近名 adapter 现在明确视为不同能力源,除非当前环境真的解析到了它们
|
|
38
38
|
- 复杂 `redesign-from-code` 现在要求在大规模 Pencil 设计前先写 visual thesis、content plan、interaction thesis 和 anchor surface 的 structural-delta 说明
|
|
39
39
|
- screenshot review 现在被明确强调为硬闸门;只要分析指出 hierarchy、spacing、clarity 或 inconsistency 问题,就不能自动判通过
|
|
40
|
+
- form factor 专用的 layout hygiene 现在被定义成独立于 `Visual Assist` 的硬闸门,mobile、tablet、desktop、web 都有各自的 blocker 条件
|
|
40
41
|
- `.da-vinci/designs/` 现在更明确只用于放 `.pen` 文件,而且第一次 Pencil 写入后就要验证对应 `.pen` 已经成为 shell 可见文件
|
|
41
42
|
- 多 surface 重设计现在要求先从已通过的 anchor surface 中抽出 shared primitive family,再扩展更多页面
|
|
42
43
|
- Pencil 生成规则现在明确拒绝 `flex`、`margin` 这类 Web 属性
|
|
@@ -121,6 +122,7 @@ Da Vinci V2 支持四种模式:
|
|
|
121
122
|
- visual contract refinement
|
|
122
123
|
- page composition
|
|
123
124
|
- hierarchy and spacing
|
|
125
|
+
- anchor-surface composition
|
|
124
126
|
- Pencil design refinement
|
|
125
127
|
- Fallback:
|
|
126
128
|
- native-da-vinci
|
|
@@ -146,6 +148,7 @@ Da Vinci V2 支持四种模式:
|
|
|
146
148
|
- page composition
|
|
147
149
|
- hierarchy and spacing
|
|
148
150
|
- motion guidance
|
|
151
|
+
- anchor-surface composition
|
|
149
152
|
- Pencil design refinement
|
|
150
153
|
- Fallback:
|
|
151
154
|
- native-da-vinci
|
|
@@ -163,8 +166,10 @@ Da Vinci V2 支持四种模式:
|
|
|
163
166
|
|
|
164
167
|
- 高密度 app、dashboard、工具型界面,且视觉要求中等时,优先把 `ui-ux-pro-max` 放第一位
|
|
165
168
|
- 如果更重视 art direction、构图和高级感,就把 `frontend-skill` 放第一位
|
|
169
|
+
- `Preferred adapters` 里要写当前环境里真实存在的 adapter 名,不要默认套用跨平台别名
|
|
166
170
|
- 一旦配置了 `Preferred adapters`,解析出来的主 adapter 应该真正主导首轮设计,而不是只登记在工件里
|
|
167
171
|
- 运行时必须明确写出解析出来的主 adapter,以及哪些请求的 adapter 当前不可用
|
|
172
|
+
- form factor 专用的 layout hygiene 是独立于 `Visual Assist` 的硬闸门;adapter 选择不能覆盖 mobile、tablet、desktop、web 的版式失败条件
|
|
168
173
|
- 不要默认把跨平台的近名 adapter 当成同一个能力源
|
|
169
174
|
- 在第一个 anchor surface 之前,先写 visual thesis、content plan 和 interaction thesis
|
|
170
175
|
- Pencil 的 guide 只应该约束平台布局和可实现性,不应该替代主 adapter 成为设计方向来源
|
|
@@ -338,9 +343,26 @@ da-vinci install --platform codex,claude,gemini
|
|
|
338
343
|
```bash
|
|
339
344
|
da-vinci status
|
|
340
345
|
da-vinci validate-assets
|
|
346
|
+
da-vinci audit --mode integrity /abs/path/to/project
|
|
347
|
+
da-vinci audit --mode completion --change <change-id> /abs/path/to/project
|
|
341
348
|
da-vinci uninstall --platform codex,claude,gemini
|
|
342
349
|
```
|
|
343
350
|
|
|
351
|
+
`da-vinci audit` 现在有两种主要模式:
|
|
352
|
+
|
|
353
|
+
- `--mode integrity`:适合在工作进行中检查文件系统真相,比如基础工件缺失、导出路径错误、`.da-vinci/designs/` 被污染、项目内 `.pen` 没落盘
|
|
354
|
+
- `--mode completion`:适合在宣称完成前做严格检查;配合 `--change <change-id>` 使用,任何失败都应视为阻断
|
|
355
|
+
|
|
356
|
+
两种模式都会检查项目里最常见的工作流完整性问题:
|
|
357
|
+
|
|
358
|
+
- 标准 Da Vinci 工件缺失
|
|
359
|
+
- 项目内 shell 可见 `.pen` 设计源缺失
|
|
360
|
+
- `.da-vinci/designs/` 目录被污染
|
|
361
|
+
- 截图导出写到了错误位置
|
|
362
|
+
- change scaffold 只有空目录或只写了一半
|
|
363
|
+
|
|
364
|
+
当 Pencil MCP 可用时,Da Vinci 现在还要求在终态完成声明前,把 MCP runtime gate 结果记录到 `pencil-design.md`。这层 gate 负责检查 live editor/source convergence,与 filesystem audit 分工不同。
|
|
365
|
+
|
|
344
366
|
安装目标:
|
|
345
367
|
|
|
346
368
|
- Codex prompts:`~/.codex/prompts/`
|
package/SKILL.md
CHANGED
|
@@ -216,15 +216,24 @@ 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
|
|
225
229
|
- 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
|
|
230
|
+
- after the first successful Pencil write, run the MCP runtime gate when Pencil MCP is available and record the result in `pencil-design.md`
|
|
231
|
+
- 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
232
|
- use only Pencil-supported properties; do not emit web- or CSS-only layout properties such as `flex` or `margin`
|
|
233
|
+
- 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
|
|
227
234
|
- on complex redesigns, turn approved anchor surfaces into a small shared primitive family before broad page expansion
|
|
235
|
+
- apply the resolved form-factor-specific layout hygiene profile before passing screenshot review on any anchor surface or other approval candidate
|
|
236
|
+
- 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
|
|
228
237
|
- 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`
|
|
229
238
|
|
|
230
239
|
## Load References On Demand
|
|
@@ -235,6 +244,7 @@ Load only the reference that matches the current step:
|
|
|
235
244
|
- Read `references/artifact-templates.md` when creating or updating workflow artifacts
|
|
236
245
|
- Read `references/checkpoints.md` when running or reporting checkpoints
|
|
237
246
|
- Read `references/design-inputs.md` when collecting product form factor, style, and constraints
|
|
247
|
+
- Read `references/layout-hygiene.md` when screenshot review or the design checkpoint needs form-factor-specific layout hygiene rules
|
|
238
248
|
- Read `references/page-mapping.md` when defining project pages, Pencil pages, and route-to-screen bindings
|
|
239
249
|
- Read `references/pencil-design-to-code.md` when turning Pencil data into implementation
|
|
240
250
|
- Read `references/platform-adapters.md` when guiding users on Codex, Claude, or Gemini invocation patterns
|
|
@@ -571,6 +581,11 @@ When Pencil is available through MCP:
|
|
|
571
581
|
- Before mapping or implementation closes, verify both:
|
|
572
582
|
- the `.pen` path is readable through MCP
|
|
573
583
|
- the same path exists as a shell-visible file inside the project
|
|
584
|
+
- Before broad expansion or terminal completion, run the MCP runtime gate:
|
|
585
|
+
- evaluate source convergence from the active editor, registered `.pen` path, and shell-visible `.pen` file
|
|
586
|
+
- evaluate screen presence for claimed anchor and review target ids
|
|
587
|
+
- evaluate review execution for approved surfaces
|
|
588
|
+
- append the runtime gate result to `pencil-design.md`
|
|
574
589
|
|
|
575
590
|
When Pencil is not available:
|
|
576
591
|
|
|
@@ -18,3 +18,5 @@ Create or update:
|
|
|
18
18
|
- `pencil-design.md`
|
|
19
19
|
|
|
20
20
|
Run the `design checkpoint` before locking implementation tasks.
|
|
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
|
+
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,5 @@ 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
|
+
If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
|
|
16
|
+
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,6 @@ Create or update:
|
|
|
11
11
|
- `pencil-design.md`
|
|
12
12
|
|
|
13
13
|
Use Pencil-backed page coverage as the source of presentation truth.
|
|
14
|
+
If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
|
|
15
|
+
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
16
|
"""
|
|
@@ -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
|