@xenonbyte/da-vinci-workflow 0.2.2 → 0.2.4

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 (72) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +49 -14
  3. package/README.zh-CN.md +169 -14
  4. package/commands/claude/dv/breakdown.md +8 -0
  5. package/commands/claude/dv/build.md +16 -0
  6. package/commands/claude/dv/continue.md +4 -0
  7. package/commands/claude/dv/design.md +5 -2
  8. package/commands/claude/dv/tasks.md +14 -0
  9. package/commands/claude/dv/verify.md +11 -0
  10. package/commands/codex/prompts/dv-breakdown.md +8 -0
  11. package/commands/codex/prompts/dv-build.md +16 -0
  12. package/commands/codex/prompts/dv-continue.md +4 -0
  13. package/commands/codex/prompts/dv-design.md +5 -2
  14. package/commands/codex/prompts/dv-tasks.md +14 -0
  15. package/commands/codex/prompts/dv-verify.md +10 -0
  16. package/commands/gemini/dv/breakdown.toml +8 -0
  17. package/commands/gemini/dv/build.toml +16 -0
  18. package/commands/gemini/dv/continue.toml +4 -0
  19. package/commands/gemini/dv/design.toml +5 -2
  20. package/commands/gemini/dv/tasks.toml +14 -0
  21. package/commands/gemini/dv/verify.toml +10 -0
  22. package/commands/templates/dv-continue.shared.md +4 -0
  23. package/docs/discipline-and-orchestration-upgrade.md +83 -0
  24. package/docs/dv-command-reference.md +61 -2
  25. package/docs/execution-chain-migration.md +23 -0
  26. package/docs/execution-chain-plan.md +10 -3
  27. package/docs/mode-use-cases.md +2 -1
  28. package/docs/pencil-rendering-workflow.md +15 -12
  29. package/docs/prompt-entrypoints.md +5 -0
  30. package/docs/prompt-presets/README.md +1 -1
  31. package/docs/prompt-presets/desktop-app.md +3 -3
  32. package/docs/prompt-presets/mobile-app.md +3 -3
  33. package/docs/prompt-presets/tablet-app.md +3 -3
  34. package/docs/prompt-presets/web-app.md +3 -3
  35. package/docs/skill-usage.md +61 -38
  36. package/docs/workflow-examples.md +16 -13
  37. package/docs/workflow-overview.md +19 -0
  38. package/docs/zh-CN/dv-command-reference.md +59 -2
  39. package/docs/zh-CN/execution-chain-migration.md +23 -0
  40. package/docs/zh-CN/mode-use-cases.md +2 -1
  41. package/docs/zh-CN/pencil-rendering-workflow.md +15 -12
  42. package/docs/zh-CN/prompt-entrypoints.md +5 -0
  43. package/docs/zh-CN/prompt-presets/README.md +1 -1
  44. package/docs/zh-CN/prompt-presets/desktop-app.md +3 -3
  45. package/docs/zh-CN/prompt-presets/mobile-app.md +3 -3
  46. package/docs/zh-CN/prompt-presets/tablet-app.md +3 -3
  47. package/docs/zh-CN/prompt-presets/web-app.md +3 -3
  48. package/docs/zh-CN/skill-usage.md +61 -38
  49. package/docs/zh-CN/workflow-examples.md +15 -13
  50. package/docs/zh-CN/workflow-overview.md +19 -0
  51. package/examples/greenfield-spec-markupflow/.da-vinci/state/execution-signals/demo__lint-tasks.json +16 -0
  52. package/lib/audit-parsers.js +166 -10
  53. package/lib/audit.js +3 -26
  54. package/lib/cli.js +156 -2
  55. package/lib/design-source-registry.js +146 -0
  56. package/lib/execution-profile.js +143 -0
  57. package/lib/execution-signals.js +19 -1
  58. package/lib/lint-tasks.js +86 -2
  59. package/lib/planning-parsers.js +255 -18
  60. package/lib/save-current-design.js +790 -0
  61. package/lib/supervisor-review.js +3 -2
  62. package/lib/task-execution.js +160 -0
  63. package/lib/task-review.js +197 -0
  64. package/lib/verify.js +152 -1
  65. package/lib/workflow-bootstrap.js +2 -13
  66. package/lib/workflow-persisted-state.js +3 -1
  67. package/lib/workflow-state.js +503 -33
  68. package/lib/worktree-preflight.js +214 -0
  69. package/package.json +1 -1
  70. package/references/artifact-templates.md +56 -6
  71. package/tui/catalog.js +103 -0
  72. package/tui/index.js +2274 -418
@@ -14,3 +14,17 @@ Tasks must cover:
14
14
  - spec-backed behavior
15
15
  - Pencil-backed UI work
16
16
  - verification work
17
+
18
+ Task-plan discipline:
19
+ - each top-level task group should include exact file or code-area ownership targets
20
+ - include explicit verification commands, not only abstract verification wording
21
+ - include execution intent hints (`serial`, `bounded_parallel`, or `review_required`) and review intent
22
+ - include parseable discipline markers for design approval, plan self-review, and operator review acknowledgment
23
+
24
+ Before claiming implementation-ready task planning:
25
+ - re-check that the workflow is still in the `/dv:tasks` lane when route context is stale or unclear
26
+ - run the `task checkpoint`
27
+ - when shell access is available, run `da-vinci lint-tasks --project <path> [--change <id>]`
28
+ - if both `pencil-design.md` and `pencil-bindings.md` exist, run `da-vinci lint-bindings --project <path> [--change <id>]`
29
+ - treat command output as the gate; do not downgrade `BLOCK` or non-zero results into soft guidance
30
+ - do not hand off to `build` while task coverage or bindings readiness are still blocking
@@ -13,4 +13,14 @@ Check:
13
13
  - drift between artifacts and code
14
14
 
15
15
  Update `verification.md` when needed.
16
+ When shell access is available:
17
+ - run `da-vinci verify-bindings --project <path> [--change <id>]`
18
+ - run `da-vinci verify-implementation --project <path> [--change <id>]`
19
+ - run `da-vinci verify-structure --project <path> [--change <id>]`
20
+ - run `da-vinci verify-coverage --project <path> [--change <id>]`
21
+ - treat command output as the gate; do not downgrade `BLOCK` or `FAIL` into soft guidance
22
+ - if any verification surface is still `BLOCK` or `FAIL`, keep the workflow in verification and record the drift instead of claiming success
23
+ - require fresh verification evidence in `verify-coverage` and `workflow-status` before any terminal completion wording
24
+ - if task-review evidence is recorded, keep unresolved `WARN/BLOCK` task-review stages open instead of closing the task group
16
25
  If Pencil MCP is active and terminal completion is being considered, re-check the MCP runtime gate evidence before treating verification as complete.
26
+ Before any terminal completion claim, require `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
@@ -6,6 +6,14 @@ Use the Da Vinci workflow for this request.
6
6
 
7
7
  Action: `breakdown`
8
8
 
9
+ Before handing requirements off to design when shell access is available:
10
+ - run `da-vinci workflow-status --project <path> [--change <id>] --json`
11
+ - run `da-vinci next-step --project <path> [--change <id>]`
12
+ - run `da-vinci lint-spec --project <path> [--change <id>] --strict`
13
+ - treat command output as the gate; do not replace `BLOCK` or non-zero results with narrative judgment
14
+ - if the primary recommended route is still `/dv:breakdown`, keep refining `proposal.md` and specs instead of forcing design
15
+ - do not move to `/dv:design` until the command-backed checks stop blocking
16
+
9
17
  Focus on:
10
18
  - scope
11
19
  - pages
@@ -6,12 +6,28 @@ Use the Da Vinci workflow for this request.
6
6
 
7
7
  Action: `build`
8
8
 
9
+ Before broad implementation when shell access is available:
10
+ - run `da-vinci workflow-status --project <path> [--change <id>] --json`
11
+ - run `da-vinci next-step --project <path> [--change <id>]`
12
+ - if the primary recommended route is not `/dv:build`, stop and continue from that route instead of forcing implementation
13
+ - run `da-vinci lint-spec --project <path> [--change <id>]`
14
+ - run `da-vinci scope-check --project <path> [--change <id>]`
15
+ - if `tasks.md` exists, run `da-vinci lint-tasks --project <path> [--change <id>]`
16
+ - if both `pencil-design.md` and `pencil-bindings.md` exist, run `da-vinci lint-bindings --project <path> [--change <id>]`
17
+ - inspect `executionProfile` and discipline blockers from `da-vinci next-step --project <path> [--change <id>] --json`
18
+ - if profile mode is `bounded_parallel`, run `da-vinci worktree-preflight --project <path> [--change <id>]` and downgrade to serial unless isolation is ready or explicitly accepted
19
+ - treat command output as the gate; do not downgrade `BLOCK` or non-zero results into soft guidance
20
+ - treat any `BLOCK` or missing required planning/design artifact as a hard stop before broad implementation
21
+
9
22
  Implementation rules:
10
23
  - requirements decide behavior
11
24
  - Pencil decides presentation
12
25
  - run `execution checkpoint` after each top-level task group
26
+ - persist per-task implementer evidence via `da-vinci task-execution --project <path> --change <id> --task-group <id> --status <...> --summary <...>`
27
+ - persist ordered review evidence via `da-vinci task-review --project <path> --change <id> --task-group <id> --stage spec ...` then `--stage quality ...`
13
28
  - treat `BUILD SUCCESSFUL` as compile-only evidence, not workflow completion
14
29
  - do not report `design complete` or `workflow complete` while in-scope task groups remain unfinished
30
+ - do not use terminal completion wording without fresh verification evidence
15
31
  - before any terminal completion claim, require `da-vinci audit --mode completion --change <change-id> <project-path>` to pass
16
32
  - if completion audit fails, continue from the minimal unfinished stage instead of exiting
17
33
  """
@@ -22,15 +22,19 @@ Route discipline:
22
22
  - treat this route as prompt-first orchestration; do not assume a standalone CLI `continue` command exists
23
23
  - when shell access is available, run `da-vinci workflow-status --project <path> [--change <id>] --json` before deciding the primary continuation route
24
24
  - use `da-vinci next-step --project <path> [--change <id>]` as the first routing signal
25
+ - prefer `da-vinci next-step --project <path> [--change <id>] --json` when available so discipline markers, execution profile hints, and verification freshness are explicit
25
26
  - run `da-vinci scope-check --project <path> [--change <id>]` when page/state propagation looks ambiguous
26
27
  - do not restart discovery if the current artifacts already contain enough truth
27
28
  - determine route selection from artifact and checkpoint truth before reading contextual deltas
28
29
  - if workflow-status or next-step output is missing, stale, or unavailable, fall back to artifact scanning and checkpoint evidence
29
30
  - use contextual deltas as auxiliary recovery context only; they must not override route selection
30
31
  - if contextual deltas conflict with current artifacts, ignore them for routing and call out the conflict
32
+ - if design approval discipline markers are missing, malformed, or stale, keep routing in design/task refinement rather than promoting directly into implementation
31
33
  - do not default the user into `/dv:build` unless the project is clearly implementation-ready
32
34
  - if design artifacts exist but `tasks.md` does not, prefer a continuation prompt that moves into `/dv:tasks`
33
35
  - only prefer `/dv:build` once task generation and implementation readiness are already clear
34
36
  - do not route into `/dv:build` when any design gate is unresolved: missing shell-visible project-local `.pen`, active/unclosed Pencil session, runtime/design-source checkpoint still BLOCK, or required design-supervisor review still BLOCK/unaccepted
37
+ - if bounded-parallel execution is hinted, include `da-vinci worktree-preflight --project <path> [--change <id>]` before emitting a parallel implementation continuation prompt
38
+ - avoid terminal completion wording unless fresh verification evidence and completion audit requirements are explicit
35
39
  - continuation prompts should usually target the main workflow entry so Da Vinci can resume the full state machine
36
40
  """
@@ -13,10 +13,13 @@ Create or update:
13
13
  Use Pencil-backed page coverage as the source of presentation truth.
14
14
  Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
15
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
- Require the session wrapper commands on autonomous runs: `da-vinci pencil-session begin`, `da-vinci pencil-session persist`, and `da-vinci pencil-session end`.
16
+ Require the session wrapper commands on autonomous runs: `da-vinci pencil-session begin`, `da-vinci save-current-design`, and `da-vinci pencil-session end`.
17
17
  Before the first Pencil edit, require `da-vinci pencil-session begin` so the registered project-local `.pen` is seeded and locked before editing starts.
18
18
  When multiple `.pen` sources exist (for example an external backup), run `da-vinci check-pen-baseline --pen <project-pen> --baseline <other-pen>` before `pencil-session begin`. If hashes diverge, confirm source priority explicitly and sync the chosen source into the project-local `.pen` (for example `da-vinci sync-pen-source --from <preferred-source> --to <project-pen>`) before continuing edits.
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.
19
+ If a registered project-local `.pen` already exists, reopen it for continuity and use `da-vinci save-current-design --project <project-path>` after material edits.
20
+ Treat `saved`, `blocked`, and `unavailable` as distinct outcomes; never treat `unavailable` as a successful save.
21
+ Use the lower-level `pencil-session persist` payload path only when the high-level save bridge is unavailable.
22
+ The MVP guarantee is bound source-path safety (`registered .pen`, session `penPath`, and active editor path converge), not exact window-instance identity before MCP exposes stable window/editor identifiers.
20
23
  After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
21
24
  If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
22
25
  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.
@@ -10,4 +10,18 @@ Create or update:
10
10
  - `tasks.md`
11
11
 
12
12
  Tasks must cover spec behavior, Pencil-backed UI work, and verification.
13
+
14
+ Task-plan discipline:
15
+ - include exact file or code-area ownership targets per task group
16
+ - include explicit verification commands, not only abstract verification wording
17
+ - include execution intent hints (`serial`, `bounded_parallel`, or `review_required`) and review intent
18
+ - include parseable discipline markers for design approval, plan self-review, and operator review acknowledgment
19
+
20
+ Before claiming implementation-ready task planning:
21
+ - re-check that the workflow is still in the `/dv:tasks` lane when route context is stale or unclear
22
+ - run the `task checkpoint`
23
+ - when shell access is available, run `da-vinci lint-tasks --project <path> [--change <id>]`
24
+ - if both `pencil-design.md` and `pencil-bindings.md` exist, run `da-vinci lint-bindings --project <path> [--change <id>]`
25
+ - treat command output as the gate; do not downgrade `BLOCK` or non-zero results into soft guidance
26
+ - do not hand off to `build` while task coverage or bindings readiness are still blocking
13
27
  """
@@ -12,5 +12,15 @@ Check:
12
12
  - drift between artifacts and code
13
13
 
14
14
  Update `verification.md` when needed.
15
+ When shell access is available:
16
+ - run `da-vinci verify-bindings --project <path> [--change <id>]`
17
+ - run `da-vinci verify-implementation --project <path> [--change <id>]`
18
+ - run `da-vinci verify-structure --project <path> [--change <id>]`
19
+ - run `da-vinci verify-coverage --project <path> [--change <id>]`
20
+ - treat command output as the gate; do not downgrade `BLOCK` or `FAIL` into soft guidance
21
+ - if any verification surface is still `BLOCK` or `FAIL`, keep the workflow in verification and record the drift instead of claiming success
22
+ - require fresh verification evidence in `verify-coverage` and `workflow-status` before any terminal completion wording
23
+ - if task-review evidence is recorded, keep unresolved `WARN/BLOCK` task-review stages open instead of closing the task group
15
24
  If Pencil MCP is active and terminal completion is being considered, re-check the MCP runtime gate evidence before treating verification as complete.
25
+ Before any terminal completion claim, require `da-vinci audit --mode completion --change <change-id> <project-path>` to pass.
16
26
  """
@@ -20,14 +20,18 @@ Route discipline:
20
20
  - treat this route as prompt-first orchestration; do not assume a standalone CLI `continue` command exists
21
21
  - when shell access is available, run `da-vinci workflow-status --project <path> [--change <id>] --json` before deciding the primary continuation route
22
22
  - use `da-vinci next-step --project <path> [--change <id>]` as the first routing signal
23
+ - prefer `da-vinci next-step --project <path> [--change <id>] --json` when available so discipline markers, execution profile hints, and verification freshness are explicit
23
24
  - run `da-vinci scope-check --project <path> [--change <id>]` when page/state propagation looks ambiguous
24
25
  - do not restart discovery if the current artifacts already contain enough truth
25
26
  - determine route selection from artifact and checkpoint truth before reading contextual deltas
26
27
  - if workflow-status or next-step output is missing, stale, or unavailable, fall back to artifact scanning and checkpoint evidence
27
28
  - use contextual deltas as auxiliary recovery context only; they must not override route selection
28
29
  - if contextual deltas conflict with current artifacts, ignore them for routing and call out the conflict
30
+ - if design approval discipline markers are missing, malformed, or stale, keep routing in design/task refinement rather than promoting directly into implementation
29
31
  - do not default the user into `{{BUILD_ROUTE}}` unless the project is clearly implementation-ready
30
32
  - if design artifacts exist but `tasks.md` does not, prefer a continuation prompt that moves into `{{TASKS_ROUTE}}`
31
33
  - only prefer `{{BUILD_ROUTE}}` once task generation and implementation readiness are already clear
32
34
  - do not route into `{{BUILD_ROUTE}}` when any design gate is unresolved: missing shell-visible project-local `.pen`, active/unclosed Pencil session, runtime/design-source checkpoint still BLOCK, or required design-supervisor review still BLOCK/unaccepted
35
+ - if bounded-parallel execution is hinted, include `da-vinci worktree-preflight --project <path> [--change <id>]` before emitting a parallel implementation continuation prompt
36
+ - avoid terminal completion wording unless fresh verification evidence and completion audit requirements are explicit
33
37
  - continuation prompts should usually target the main workflow entry so Da Vinci can resume the full state machine
@@ -0,0 +1,83 @@
1
+ # Discipline And Orchestration Upgrade
2
+
3
+ This document explains the implemented `discipline-and-orchestration-upgrade` change and how to use its artifacts.
4
+
5
+ Status:
6
+
7
+ - completed (runtime surfaces and docs rolled out)
8
+ - tracking path: `openspec/changes/discipline-and-orchestration-upgrade/`
9
+
10
+ ## Purpose
11
+
12
+ This upgrade imports bounded ideas from external projects while preserving Da Vinci's core truth model.
13
+
14
+ Primary intent:
15
+
16
+ - improve execution discipline from `design` to `tasks` to `build` to `verify`
17
+ - improve task-plan quality and implementation review structure
18
+ - expose orchestration hints without allowing orchestration to override workflow truth
19
+
20
+ Core boundary:
21
+
22
+ - artifacts, checkpoints, execution signals, and `audit` remain workflow truth
23
+ - orchestration remains advisory or explicitly bounded
24
+
25
+ ## External Inspiration (Source-Tracked)
26
+
27
+ - `obra/superpowers`:
28
+ - design-first discipline
29
+ - plan-quality discipline
30
+ - two-stage implementation review
31
+ - verification-before-completion wording discipline
32
+ - optional worktree isolation practice
33
+ - `ruvnet/ruflo`:
34
+ - bounded orchestration profiles
35
+ - anti-drift execution patterns
36
+ - role and concurrency guidance
37
+
38
+ See exact source files in:
39
+
40
+ - `openspec/changes/discipline-and-orchestration-upgrade/README.md`
41
+
42
+ ## OpenSpec Structure
43
+
44
+ Use these files in order:
45
+
46
+ 1. `openspec/changes/discipline-and-orchestration-upgrade/proposal.md`
47
+ 2. `openspec/changes/discipline-and-orchestration-upgrade/design.md`
48
+ 3. `openspec/changes/discipline-and-orchestration-upgrade/specs/workflow-discipline/spec.md`
49
+ 4. `openspec/changes/discipline-and-orchestration-upgrade/specs/execution-orchestration/spec.md`
50
+ 5. `openspec/changes/discipline-and-orchestration-upgrade/specs/execution-evidence-and-isolation/spec.md`
51
+ 6. `openspec/changes/discipline-and-orchestration-upgrade/tasks.md`
52
+
53
+ ## Documentation Rollout Scope
54
+
55
+ During implementation of this upgrade, keep the following docs aligned:
56
+
57
+ - `README.md`
58
+ - `README.zh-CN.md`
59
+ - `docs/workflow-overview.md`
60
+ - `docs/dv-command-reference.md`
61
+ - `docs/skill-usage.md`
62
+ - `docs/prompt-entrypoints.md`
63
+ - `docs/zh-CN/workflow-overview.md`
64
+ - `docs/zh-CN/dv-command-reference.md`
65
+ - `docs/zh-CN/skill-usage.md`
66
+ - `docs/zh-CN/prompt-entrypoints.md`
67
+
68
+ Prompt and command assets that must stay aligned:
69
+
70
+ - `commands/codex/**`
71
+ - `commands/claude/**`
72
+ - `commands/gemini/**`
73
+
74
+ Maintainer rollout and source-trace checklist:
75
+
76
+ - `openspec/changes/discipline-and-orchestration-upgrade/docs-update-plan.md`
77
+
78
+ ## Documentation Guardrails
79
+
80
+ - Do not document planned behavior as already shipped behavior.
81
+ - Keep advisory vs blocking semantics explicit in operator docs.
82
+ - Keep completion-audit authority explicit; do not imply replacement by orchestration hints.
83
+ - When English operator docs are updated, update existing `docs/zh-CN` mirrors in the same rollout.
@@ -43,10 +43,11 @@ These commands do not replace route selection, but they support design execution
43
43
  - useful when the command surface is harder to remember than the workflow itself
44
44
  - `da-vinci workflow-status --project <path> [--change <id>] [--json]`
45
45
  - derives the current workflow stage from artifact and checkpoint truth
46
- - reports blockers, warnings, handoff-gate state, and one primary route recommendation
46
+ - reports blockers, warnings, handoff-gate state, discipline markers, execution profile hints, and verification-evidence freshness
47
47
  - keep this distinct from `audit`: route guidance is not completion truth
48
48
  - `da-vinci next-step --project <path> [--change <id>] [--json]`
49
49
  - provides a route-first continuation summary from the same derived workflow state
50
+ - JSON output includes `nextStep`, `executionProfile`, `worktreePreflight`, and discipline/freshness metadata for orchestration consumers
50
51
  - use this as the first continuation signal before free-form artifact scanning
51
52
  - `da-vinci lint-spec --project <path> [--change <id>] [--strict] [--json]`
52
53
  - validates Da Vinci runtime `spec.md` schema sections (`Behavior`, `States`, `Inputs`, `Outputs`, `Acceptance`, `Edge Cases`)
@@ -57,7 +58,7 @@ These commands do not replace route selection, but they support design execution
57
58
  - emits a machine-readable coverage matrix for pages and states
58
59
  - default behavior is advisory (`WARN` with zero exit); `--strict` upgrades findings to blocking
59
60
  - `da-vinci lint-tasks --project <path> [--change <id>] [--strict] [--json]`
60
- - validates top-level task groups, ordering, verification actions, and behavior-to-task coverage hints
61
+ - validates top-level task groups, ordering, discipline markers, execution-mode hints, file targets, verification commands, and behavior-to-task coverage hints
61
62
  - default behavior is advisory (`WARN` with zero exit); `--strict` upgrades findings to blocking
62
63
  - `da-vinci lint-bindings --project <path> [--change <id>] [--strict] [--json]`
63
64
  - validates implementation-to-Pencil mappings for parseability, source shape, and implementation landings
@@ -68,6 +69,15 @@ These commands do not replace route selection, but they support design execution
68
69
  - `da-vinci verify-bindings|verify-implementation|verify-structure|verify-coverage --project <path> [--change <id>] [--strict] [--json]`
69
70
  - verifies code landings, planned-state implementation evidence, and structural consistency against bindings
70
71
  - `verify-structure` reports whether checks used markup-backed analysis or heuristic fallback and exposes confidence
72
+ - `da-vinci task-execution --project <path> --change <id> --task-group <id> --status <DONE|DONE_WITH_CONCERNS|NEEDS_CONTEXT|BLOCKED> --summary <text> [--changed-files <csv>] [--test-evidence <csv>] [--concerns <csv>] [--blockers <csv>] [--json]`
73
+ - persists normalized implementer-status envelopes into execution signals
74
+ - use this to keep resume routing machine-readable when implementation is blocked or concerns remain
75
+ - `da-vinci task-review --project <path> --change <id> --task-group <id> --stage <spec|quality> --status <PASS|WARN|BLOCK> --summary <text> [--issues <csv>] [--reviewer <name>] [--write-verification] [--json]`
76
+ - persists ordered two-stage task review evidence (`spec` before `quality`)
77
+ - rejects out-of-order quality approval and can append evidence into `verification.md`
78
+ - `da-vinci worktree-preflight --project <path> [--change <id>] [--json]`
79
+ - runs advisory worktree isolation checks (`.worktrees/` or `worktrees/` ignore safety, dirty workspace, baseline test heuristics)
80
+ - does not replace route truth; use it to decide whether bounded-parallel execution should downgrade to serial
71
81
  - `da-vinci diff-spec --project <path> [--change <id>] [--from <sidecars-dir>] [--json]`
72
82
  - compares normalized planning sidecars and reports added/removed/modified requirement planning items
73
83
  - includes normalized spec deltas plus broader planning summaries (tasks/page-map/bindings) under one surface
@@ -99,6 +109,11 @@ These commands do not replace route selection, but they support design execution
99
109
  - `da-vinci sync-pen-source --from <preferred-source> --to <project-pen>`
100
110
  - copies the selected latest `.pen` source into the project-local `.pen` path and refreshes Da Vinci state metadata
101
111
  - use when external backup is the latest baseline and must be materialized before `pencil-session begin`
112
+ - `da-vinci save-current-design --project <path> [--json] [--continue-on-error]`
113
+ - runs the high-level bound-source save flow for guided design persistence
114
+ - requires convergence of registered `.pen`, session `penPath`, and active editor path before persistence
115
+ - returns one explicit outcome envelope: `saved`, `blocked`, or `unavailable`
116
+ - `blocked` means save-time source/lock/payload contracts failed; `unavailable` means MCP bridge/runtime capture was not reachable
102
117
 
103
118
  Use these utilities during `/dv:design`, especially before anchor-surface icon finalization.
104
119
 
@@ -172,6 +187,14 @@ For `overhaul-from-code`, this stage may also create:
172
187
 
173
188
  This is the behavior-truth shaping stage.
174
189
 
190
+ Breakdown-stage self-check:
191
+
192
+ - before handing requirements off to design, run `da-vinci workflow-status --project <path> [--change <id>] --json`
193
+ - run `da-vinci next-step --project <path> [--change <id>]`
194
+ - run `da-vinci lint-spec --project <path> [--change <id>] --strict`
195
+ - treat command output as the gate; do not replace `BLOCK` or non-zero results with narrative judgment
196
+ - if the primary recommended route is still `/dv:breakdown`, keep refining `proposal.md` and specs instead of forcing `/dv:design`
197
+
175
198
  ### `/dv:design`
176
199
 
177
200
  Use when:
@@ -210,6 +233,14 @@ This is the implementation-planning stage.
210
233
 
211
234
  It does not write code.
212
235
 
236
+ Task-stage self-check:
237
+
238
+ - run the `task checkpoint` before handing work off to implementation
239
+ - when shell access is available, run `da-vinci lint-tasks --project <path> [--change <id>]`
240
+ - if both `pencil-design.md` and `pencil-bindings.md` exist, run `da-vinci lint-bindings --project <path> [--change <id>]`
241
+ - treat command output as the gate; do not downgrade `BLOCK` or non-zero results into soft guidance
242
+ - do not promote `/dv:build` while task coverage or bindings readiness are still blocking
243
+
213
244
  ### `/dv:build`
214
245
 
215
246
  Use when:
@@ -225,6 +256,22 @@ Creates or updates:
225
256
 
226
257
  This is the execution stage.
227
258
 
259
+ Build-stage self-check:
260
+
261
+ - before broad implementation, run `da-vinci workflow-status --project <path> [--change <id>] --json`
262
+ - run `da-vinci next-step --project <path> [--change <id>]`
263
+ - if the primary recommended route is not `/dv:build`, stop and continue from that route instead of forcing implementation
264
+ - run `da-vinci lint-spec --project <path> [--change <id>]`
265
+ - run `da-vinci scope-check --project <path> [--change <id>]`
266
+ - if `tasks.md` exists, run `da-vinci lint-tasks --project <path> [--change <id>]`
267
+ - if both `pencil-design.md` and `pencil-bindings.md` exist, run `da-vinci lint-bindings --project <path> [--change <id>]`
268
+ - inspect `executionProfile` from `da-vinci next-step --project <path> [--change <id>] --json`
269
+ - if profile mode is `bounded_parallel`, run `da-vinci worktree-preflight --project <path> [--change <id>]` and downgrade to serial unless isolation is ready or explicitly accepted
270
+ - persist per-task implementer outcomes via `da-vinci task-execution ...` and keep unresolved concerns visible before closure
271
+ - run task review in order: `da-vinci task-review ... --stage spec ...` then `da-vinci task-review ... --stage quality ...`
272
+ - treat command output as the gate; do not downgrade `BLOCK` or non-zero results into soft guidance
273
+ - treat any `BLOCK` or missing required planning/design artifact as a hard stop before broad implementation
274
+
228
275
  Completion discipline:
229
276
 
230
277
  - treat `BUILD SUCCESSFUL` as compile-only evidence
@@ -245,6 +292,18 @@ Creates or updates:
245
292
 
246
293
  This is the truth-reconciliation stage.
247
294
 
295
+ Verify-stage self-check:
296
+
297
+ - when shell access is available, run `da-vinci verify-bindings --project <path> [--change <id>]`
298
+ - run `da-vinci verify-implementation --project <path> [--change <id>]`
299
+ - run `da-vinci verify-structure --project <path> [--change <id>]`
300
+ - run `da-vinci verify-coverage --project <path> [--change <id>]`
301
+ - treat command output as the gate; do not downgrade `BLOCK` or `FAIL` into soft guidance
302
+ - if any verification surface is still `BLOCK` or `FAIL`, keep the workflow in verification and record the drift instead of claiming success
303
+ - require fresh verification evidence in `verify-coverage` and `workflow-status` before terminal completion wording
304
+ - if task-review evidence is being recorded, keep unresolved `WARN/BLOCK` review stages open instead of closing the task group
305
+ - before terminal completion, require `da-vinci audit --mode completion --change <change-id> <project-path>` to pass
306
+
248
307
  ## State-Based Next-Step Rules
249
308
 
250
309
  These are the intended route recommendations.
@@ -44,3 +44,26 @@ If any check fails, Da Vinci falls back to derived state from artifacts and reco
44
44
  - no multi-framework expansion in the MVP
45
45
  - scaffold boundaries come from `pencil-bindings.md` mappings
46
46
  - verify scaffold output with `verify-bindings`, `verify-implementation`, and `verify-structure` before acceptance
47
+
48
+ ## 5. Planned Next Upgrade: Discipline And Orchestration
49
+
50
+ After execution-chain surfaces are enabled, the next planned upgrade is:
51
+
52
+ - `openspec/changes/discipline-and-orchestration-upgrade/`
53
+
54
+ This planned change adds:
55
+
56
+ - stronger handoff discipline before implementation
57
+ - stronger task-plan quality checks
58
+ - bounded orchestration hints tied to workflow state
59
+ - structured task execution and review evidence
60
+ - completion wording discipline backed by fresh verification evidence
61
+ - optional worktree preflight guidance
62
+
63
+ Important boundary:
64
+
65
+ - this does not replace artifact truth, checkpoint truth, or completion-audit authority
66
+
67
+ See:
68
+
69
+ - `docs/discipline-and-orchestration-upgrade.md`
@@ -1,5 +1,9 @@
1
1
  # Execution-Chain Upgrade Plan Notes
2
2
 
3
+ Historical planning note only.
4
+
5
+ Use `openspec/changes/execution-chain-upgrade-plan/tasks.md` as the canonical executable task breakdown for this upgrade. This file records the background planning decisions that shaped that OpenSpec change; it is not the source of truth for implementation sequencing or release signoff.
6
+
3
7
  This document records planning decisions required by the execution-chain upgrade.
4
8
 
5
9
  ## Phase 0 Pre-work Decisions
@@ -24,6 +28,7 @@ The workflow contract must own:
24
28
  - route dependencies
25
29
  - stage handoff gates
26
30
  - status vocabulary (`PASS/WARN/BLOCK`)
31
+ - audit-owned machine-parsed hard-gate fields from `DA-VINCI.md`, `.da-vinci/design-registry.md`, and `pencil-design.md`
27
32
 
28
33
  ### Compatibility boundaries
29
34
 
@@ -83,18 +88,18 @@ Re-baseline rule:
83
88
  ### Measurable DoD checks
84
89
 
85
90
  - Phase 0: inventory, parser ownership, schema boundaries, and test layers documented
86
- - Phase 1: workflow-status/next-step + prompt-first continue integration + contract tests green
91
+ - Phase 1: workflow-status/next-step + prompt-first continue integration + design-source/runtime/mapping-aware routing + contract tests green
87
92
  - Phase 2: lint/scope + deterministic sidecars + advisory/strict semantics tested
88
93
  - Phase 3: verify surfaces + task-group metadata + audit wiring tested
89
94
  - Phase 4a: persisted state + diff + compatibility hardening tested
90
95
  - Phase 4b: constrained scaffold MVP tested
91
- - Phase 4c: command-asset convergence + docs + release controls tested
96
+ - Phase 4c: command-asset convergence + docs + audit-aligned release controls tested
92
97
 
93
98
  ### First-release MVP scope
94
99
 
95
100
  In scope:
96
101
 
97
- - workflow-status/next-step
102
+ - workflow-status/next-step with design-source/runtime/mapping-aware route guards
98
103
  - lint-spec/lint-tasks/lint-bindings/scope-check
99
104
  - generate-sidecars + diff-spec
100
105
  - verify-bindings/verify-implementation/verify-structure/verify-coverage
@@ -121,5 +126,7 @@ Out of scope:
121
126
  ### Release criteria and fallback
122
127
 
123
128
  - release requires core + contracts + e2e lanes green
129
+ - completion or release-ready claims for shipped change scope must also pass `da-vinci audit --mode completion --change <change-id> <project-path>`
130
+ - CI green is necessary but not sufficient when workflow truth or completion semantics disagree with audit
124
131
  - stale persisted state always falls back to derived state
125
132
  - verify-structure unsupported cases must emit heuristic fallback with confidence
@@ -146,7 +146,8 @@ Generate DA-VINCI.md, proposal, specs, page map, Pencil-backed launch pages, bin
146
146
  8. create `pencil-design.md`
147
147
  - record the generated Pencil screens
148
148
  - require `da-vinci pencil-session begin` before the first Pencil edit so the registered `.pen` is seeded and locked up front
149
- - 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
149
+ - if a registered project-local `.pen` already exists, reopen it for continuity, then run `da-vinci save-current-design --project <project-path>` after material live edits
150
+ - treat `saved`, `blocked`, and `unavailable` as distinct outcomes; only fall back to low-level `pencil-session persist --nodes-file/--variables-file` when the high-level bridge is unavailable
150
151
  - keep screenshot exports under `.da-vinci/changes/<change-id>/exports/` rather than `.da-vinci/designs/`
151
152
 
152
153
  9. create `pencil-bindings.md`
@@ -29,7 +29,7 @@ PNG exports are review artifacts only. They are not the design source of truth.
29
29
  Da Vinci now requires the session wrapper on autonomous runs:
30
30
 
31
31
  - `da-vinci pencil-session begin`
32
- - `da-vinci pencil-session persist`
32
+ - `da-vinci save-current-design`
33
33
  - `da-vinci pencil-session end`
34
34
 
35
35
  This wrapper exists to make three things mandatory:
@@ -75,18 +75,21 @@ When resuming from existing artifacts:
75
75
 
76
76
  Da Vinci does not treat headless interactive `save()` as authoritative persistence truth.
77
77
 
78
- Instead, the persistence step is:
78
+ Instead, the primary persistence step is:
79
79
 
80
- 1. read MCP-readable node snapshot data
81
- 2. read MCP-readable variable snapshot data
82
- 3. write the project-local `.pen`
83
- 4. reopen-verify it
84
- 5. compare live snapshot and persisted snapshot hashes
80
+ 1. run `da-vinci save-current-design --project <project-path>`
81
+ 2. require one explicit result envelope: `saved`, `blocked`, or `unavailable`
82
+ 3. treat only `saved` as persisted success
83
+ 4. treat `blocked` as save-time source/lock/payload contract failure
84
+ 5. treat `unavailable` as MCP bridge/runtime capture absence (never as a successful save)
85
85
 
86
86
  Relevant commands:
87
87
 
88
- - `da-vinci write-pen`
89
- - `da-vinci check-pen-sync`
88
+ - high-level: `da-vinci save-current-design`
89
+ - low-level fallback: `da-vinci pencil-session persist`, `da-vinci write-pen`, `da-vinci check-pen-sync`
90
+
91
+ The MVP safety guarantee is source-path convergence only: registered `.pen`, session `penPath`, and active editor path must converge.
92
+ Exact window-instance identity remains out of scope until MCP exposes stable window/editor identifiers.
90
93
 
91
94
  `da-vinci snapshot-pen` is disk-to-disk only. It is not the live-edit persistence path.
92
95
 
@@ -251,7 +254,7 @@ Typical autonomous chain:
251
254
  1. `da-vinci pencil-session begin --project <project-path> --pen <path>`
252
255
  2. if external/secondary `.pen` files exist, run `da-vinci check-pen-baseline --pen <project-pen> --baseline <other-pen>` before edits; if diverged, sync the preferred source into `<project-pen>` first
253
256
  3. Pencil MCP edits
254
- 4. `da-vinci pencil-session persist --project <project-path> --pen <path> --nodes-file <nodes.json> --variables-file <vars.json> --version <version>`
257
+ 4. `da-vinci save-current-design --project <project-path>`
255
258
  5. screenshot review + layout hygiene
256
259
  6. design checkpoint
257
260
  7. design-supervisor review when configured
@@ -278,13 +281,13 @@ flowchart TD
278
281
  K -- No --> F
279
282
  K -- Yes --> L{Design-supervisor review configured?}
280
283
  L -- Yes --> M[Run design-supervisor review on screenshots plus theme inputs]
281
- L -- No --> N[pencil-session persist writes live MCP snapshot back to .pen]
284
+ L -- No --> N[save-current-design persists bound live snapshot back to .pen]
282
285
  M --> O{Require Supervisor Review?}
283
286
  O -- No --> N
284
287
  O -- Yes --> P{Review PASS or accepted WARN?}
285
288
  P -- No --> F
286
289
  P -- Yes --> N
287
- N --> Q[check-pen-sync verifies live hash equals persisted hash]
290
+ N --> Q[save-current-design returns saved or a terminal blocker/unavailable result]
288
291
  Q --> R{design-source checkpoint and runtime gate pass?}
289
292
  R -- No --> F
290
293
  R -- Yes --> S{More design work needed?}
@@ -66,13 +66,17 @@ Continuation precedence:
66
66
 
67
67
  - when shell access is available, run `da-vinci workflow-status --project <path> [--change <id>] --json` before route selection
68
68
  - use `da-vinci next-step --project <path> [--change <id>]` as the first continuation routing signal
69
+ - prefer reading `da-vinci next-step --project <path> [--change <id>] --json` when available so discipline marker state, execution-profile hints, and verification freshness are explicit
69
70
  - run `da-vinci lint-spec --project <path> [--change <id>]` when runtime spec quality is uncertain before routing into `build`
70
71
  - run `da-vinci scope-check --project <path> [--change <id>]` when page or state propagation across planning artifacts is uncertain
72
+ - run `da-vinci lint-tasks --project <path> [--change <id>]` before routing into `build` when task metadata quality is uncertain
71
73
  - run `da-vinci verify-bindings --project <path> [--change <id>]` and `da-vinci verify-coverage --project <path> [--change <id>]` before terminal completion routing
72
74
  - run `da-vinci diff-spec --project <path> [--change <id>]` after planning edits when continuation must reason about changed requirement slices
73
75
  - determine routing from artifact and checkpoint truth first
74
76
  - use contextual checkpoint deltas only as auxiliary recovery context
75
77
  - if contextual deltas conflict with current artifacts, ignore them for routing and note the conflict
78
+ - if design approval discipline markers are missing, malformed, or stale, keep routing in `design` or `tasks` and avoid direct promotion into `build`
79
+ - if bounded-parallel execution is hinted, run `da-vinci worktree-preflight --project <path> [--change <id>]` before emitting a parallel build continuation prompt
76
80
 
77
81
  ## Default Flow
78
82
 
@@ -93,6 +97,7 @@ State rule:
93
97
 
94
98
  - if design is done but `tasks.md` does not exist yet, the next recommended route should usually be `tasks`, not `build`
95
99
  - only recommend `build` as the primary next step once tasks and implementation readiness are already clear
100
+ - never include terminal completion wording unless fresh verification evidence is present and completion audit is explicitly required
96
101
 
97
102
  ## Platform Syntax
98
103
 
@@ -21,7 +21,7 @@ Recommended flow:
21
21
  4. copy both into your workflow setup
22
22
  5. tighten the prompt further only when the project has unusual truth sources or platform constraints
23
23
  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
24
- 7. for project-local `.pen` persistence on autonomous runs, require 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 truly cannot be used
24
+ 7. for project-local `.pen` persistence on autonomous runs, require prompts that drive `da-vinci pencil-session begin / save-current-design / end`; treat `saved`, `blocked`, and `unavailable` as distinct outcomes, and only fall back to lower-level payload persistence when high-level save is unavailable
25
25
 
26
26
  Available presets:
27
27
 
@@ -120,7 +120,7 @@ Before non-trivial `batch_design` calls, preflight the Pencil operations when sh
120
120
  If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
121
121
  Run `da-vinci audit --mode integrity <project-path>` after the first successful Pencil write before broad expansion continues.
122
122
  If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
123
- Require `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.
123
+ Require `da-vinci pencil-session begin --project <project-path> --pen <path>` before the first Pencil edit, then use `da-vinci save-current-design --project <project-path>` after material live edits. Treat `saved`, `blocked`, and `unavailable` as distinct outcomes; fall back to `pencil-session persist --nodes-file/--variables-file` only when the high-level save bridge is unavailable.
124
124
  Write exported screenshots under `.da-vinci/changes/<change-id>/exports/` only.
125
125
  Record screenshot review with explicit `PASS` / `WARN` / `BLOCK`, issue list, and revision outcome; "looks good" is not enough.
126
126
  If `DA-VINCI.md` configures `Design-supervisor reviewers`, run `design-supervisor review` after screenshot review, layout hygiene, and design checkpoint, using screenshots plus Pencil variables and the design theses as inputs. If `Require Supervisor Review: true`, treat missing, blocked, or unaccepted review results as blocking before broad expansion or terminal completion.
@@ -156,7 +156,7 @@ Design 1-3 anchor surfaces first, review screenshots, then expand.
156
156
  For each anchor surface, explain how the new composition differs structurally from the current layout and whether it is primarily HTML-referenced, partially HTML-referenced, or inferred.
157
157
 
158
158
  Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
159
- Require `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.
159
+ Require `da-vinci pencil-session begin --project <project-path> --pen <path>` before the first Pencil edit, then use `da-vinci save-current-design --project <project-path>` after material live edits. Treat `saved`, `blocked`, and `unavailable` as distinct outcomes.
160
160
  Run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
161
161
  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.
162
162
  Persist project-local Pencil files under .da-vinci/designs/.
@@ -191,7 +191,7 @@ Use the existing Da Vinci artifacts in this project.
191
191
  Do not restart discovery unless an artifact is missing or clearly wrong.
192
192
  Determine continuation routing from current artifact and checkpoint truth first, then use contextual checkpoint deltas only as auxiliary recovery notes.
193
193
  If a contextual delta conflicts with current artifacts, ignore that delta and record the conflict before continuing.
194
- Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth. If the resumed session will perform Pencil edits, require `da-vinci pencil-session begin --project <project-path> --pen <path>`, 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.
194
+ Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth. If the resumed session will perform Pencil edits, require `da-vinci pencil-session begin --project <project-path> --pen <path>`, then use `da-vinci save-current-design --project <project-path>` after material live edits. Treat `saved`, `blocked`, and `unavailable` as distinct outcomes; only fall back to lower-level payload persistence when the high-level save bridge is unavailable.
195
195
  If the redesign is complex, continue from the approved anchor surfaces instead of restarting broad scaffolding.
196
196
  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`.
197
197
  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.