@mstar-harness/dsh 3.10.1 → 3.10.3

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 (35) hide show
  1. package/dist/index.js +66 -5
  2. package/harness-agents/code-reviewer.md +25 -0
  3. package/harness-agents/qc-specialist-2.md +25 -0
  4. package/harness-agents/qc-specialist-3.md +25 -0
  5. package/harness-agents/qc-specialist.md +25 -0
  6. package/harness-skills/mstar-artifacts/SKILL.md +1 -1
  7. package/harness-skills/mstar-artifacts/references/plan-files-and-reports.md +7 -0
  8. package/harness-skills/mstar-artifacts/references/plan-quality-bar.md +5 -0
  9. package/harness-skills/mstar-artifacts/references/plan-workflow-lifecycle-contract.md +7 -0
  10. package/harness-skills/mstar-artifacts/references/status-and-residuals.md +9 -5
  11. package/harness-skills/mstar-artifacts/templates/plan.main.md +10 -0
  12. package/harness-skills/mstar-harness-core/SKILL.md +3 -2
  13. package/harness-skills/mstar-iteration/references/phase-1-prepare.md +1 -1
  14. package/harness-skills/mstar-iteration/references/plan-scoped-pm.md +1 -1
  15. package/harness-skills/mstar-roles/SKILL.md +9 -8
  16. package/harness-skills/mstar-roles/references/architect.md +1 -1
  17. package/harness-skills/mstar-roles/references/code-reviewer.md +9 -3
  18. package/harness-skills/mstar-roles/references/frontend-dev.md +1 -1
  19. package/harness-skills/mstar-roles/references/fullstack-dev-shared.md +1 -1
  20. package/harness-skills/mstar-roles/references/ops-engineer.md +1 -1
  21. package/harness-skills/mstar-roles/references/project-manager/plan-management.md +6 -0
  22. package/harness-skills/mstar-roles/references/project-manager.md +4 -3
  23. package/harness-skills/mstar-roles/references/prompt-engineer.md +1 -1
  24. package/harness-skills/mstar-roles/references/qa-engineer/acceptance-gate.md +25 -4
  25. package/harness-skills/mstar-roles/references/qa-engineer.md +29 -7
  26. package/harness-skills/mstar-roles/references/qc-specialist-shared.md +1 -1
  27. package/harness-skills/mstar-sdd/SKILL.md +5 -3
  28. package/harness-skills/mstar-sdd/references/file-handoffs.md +11 -5
  29. package/harness-skills/mstar-sdd/references/task-reviewer-prompt.md +18 -5
  30. package/harness-skills/mstar-use-cli/SKILL.md +165 -0
  31. package/harness-skills/mstar-use-cli/references/checks-and-lints.md +70 -0
  32. package/harness-skills/mstar-use-cli/references/plan-and-workflow.md +161 -0
  33. package/harness-skills/mstar-use-cli/references/preconditions.md +85 -0
  34. package/harness-skills/mstar-use-cli/references/status-and-registers.md +75 -0
  35. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1477,7 +1477,7 @@ function validatePlanProgress(value, what = "coordination.progress") {
1477
1477
  }
1478
1478
  return violations;
1479
1479
  }
1480
- function validatePlanHandoff(value, what = "coordination.handoff") {
1480
+ function validatePlanHandoff(value, what = "coordination.handoff", route = "integration") {
1481
1481
  if (!isPlainObject2(value))
1482
1482
  return [invalid("coordination.row.handoff-shape", `${what} must be an object`)];
1483
1483
  const allowed = [
@@ -1617,7 +1617,25 @@ function validatePlanHandoff(value, what = "coordination.handoff") {
1617
1617
  }
1618
1618
  }
1619
1619
  if ((value.state === "integrating" || value.state === "merged" || value.state === "completed") && value.integration === undefined) {
1620
- violations.push(invalid("coordination.row.handoff-field", `${what}.state ${String(value.state)} requires integration`));
1620
+ if (route === "standalone-development" && value.state === "completed") {
1621
+ if (value.completed_at === undefined) {
1622
+ violations.push(invalid("coordination.row.handoff-field", `${what}.state completed requires completed_at for a standalone handoff`));
1623
+ }
1624
+ if (!isNonEmptyString(value.accepted_at)) {
1625
+ violations.push(invalid("coordination.row.handoff-field", `${what}.accepted_at is required for a standalone completed handoff`));
1626
+ }
1627
+ if (!isNonEmptyString(value.accepted_by)) {
1628
+ violations.push(invalid("coordination.row.handoff-field", `${what}.accepted_by is required for a standalone completed handoff`));
1629
+ }
1630
+ if (value.qc === undefined) {
1631
+ violations.push(invalid("coordination.row.handoff-field", `${what}.qc is required for a standalone completed handoff`));
1632
+ }
1633
+ if (value.qa === undefined) {
1634
+ violations.push(invalid("coordination.row.handoff-field", `${what}.qa is required for a standalone completed handoff`));
1635
+ }
1636
+ } else {
1637
+ violations.push(invalid("coordination.row.handoff-field", `${what}.state ${String(value.state)} requires integration`));
1638
+ }
1621
1639
  }
1622
1640
  return violations;
1623
1641
  }
@@ -1653,7 +1671,7 @@ function validatePreparedCoordination(value, what = "coordination.prepared") {
1653
1671
  }
1654
1672
  return violations;
1655
1673
  }
1656
- function validateRowCoordination(value, what = "coordination") {
1674
+ function validateRowCoordination(value, what = "coordination", route = "integration") {
1657
1675
  if (!isPlainObject2(value))
1658
1676
  return [invalid("coordination.row.shape", `${what} must be an object`)];
1659
1677
  const allowed = ["revision", "prepared", "session", "progress", "handoff"];
@@ -1672,7 +1690,7 @@ function validateRowCoordination(value, what = "coordination") {
1672
1690
  if (value.progress !== undefined)
1673
1691
  violations.push(...validatePlanProgress(value.progress, `${what}.progress`));
1674
1692
  if (value.handoff !== undefined)
1675
- violations.push(...validatePlanHandoff(value.handoff, `${what}.handoff`));
1693
+ violations.push(...validatePlanHandoff(value.handoff, `${what}.handoff`, route));
1676
1694
  if (value.handoff !== undefined && value.session === undefined) {
1677
1695
  violations.push(invalid("coordination.row.handoff-field", `${what}.handoff requires a bound plan session`));
1678
1696
  }
@@ -1974,6 +1992,45 @@ var WORKFLOW_TERMINAL_STATUSES = ["completed", "failed", "stopped"];
1974
1992
  var WORKFLOW_LIFECYCLE_TYPES = ["plan", "iteration"];
1975
1993
  var WORKFLOW_DELIVERY_KINDS = ["development", "verification/report-only"];
1976
1994
  var WORKFLOW_COMPOUND_OUTCOMES = ["created", "updated", "skipped"];
1995
+ function isStandaloneDevelopmentWorkflow(snapshot) {
1996
+ return snapshot.type === "plan" && snapshot.delivery_kind === "development" && Array.isArray(snapshot.plans) && snapshot.plans.length === 1;
1997
+ }
1998
+ function rowValidationRoute(snapshot, row) {
1999
+ if (isStandaloneDevelopmentWorkflow(snapshot) && snapshot.plans[0]?.id === row.id) {
2000
+ return "standalone-development";
2001
+ }
2002
+ return "integration";
2003
+ }
2004
+ function validateStandaloneCompletedCoherence(snapshot, row) {
2005
+ const violations = [];
2006
+ if (!isStandaloneDevelopmentWorkflow(snapshot) || row.id !== snapshot.plans[0]?.id)
2007
+ return violations;
2008
+ const coordination = row.coordination;
2009
+ if (!isPlainObject2(coordination) || !isPlainObject2(coordination.handoff))
2010
+ return violations;
2011
+ const handoff = coordination.handoff;
2012
+ if (handoff.state !== "completed" || handoff.integration !== undefined)
2013
+ return violations;
2014
+ if (row.status !== "Done") {
2015
+ violations.push(violation3("high", "coordination.row.handoff-field", `standalone completed handoff requires row ${String(row.id)} to be Done`));
2016
+ }
2017
+ if (row.execution_lease !== undefined) {
2018
+ violations.push(violation3("high", "coordination.row.handoff-field", `standalone completed handoff requires no execution lease on row ${String(row.id)}`));
2019
+ }
2020
+ if (snapshot.integration_merge_lease !== undefined) {
2021
+ violations.push(violation3("high", "coordination.row.handoff-field", "standalone completed handoff requires no integration_merge_lease on the snapshot"));
2022
+ }
2023
+ const source = snapshot.branch?.source;
2024
+ const target = snapshot.branch?.target;
2025
+ if (!isNonEmptyString(source) || !isNonEmptyString(target)) {
2026
+ violations.push(violation3("high", "coordination.row.handoff-field", "standalone completed handoff requires nonblank branch.source and branch.target"));
2027
+ } else {
2028
+ if (handoff.source_branch !== source) {
2029
+ violations.push(violation3("high", "coordination.row.handoff-field", `standalone completed handoff source_branch ${String(handoff.source_branch)} must equal branch.source ${source}`));
2030
+ }
2031
+ }
2032
+ return violations;
2033
+ }
1977
2034
  function violation3(severity, code, message, fix) {
1978
2035
  return { ok: false, severity, code, message, fix };
1979
2036
  }
@@ -2084,13 +2141,17 @@ function validateWorkflowSnapshot(doc) {
2084
2141
  } else if (!Array.isArray(doc.plans)) {
2085
2142
  violations.push(violation3("high", "workflow.snapshot.invalid-plans", "plans must be an array of legacy plan rows"));
2086
2143
  } else {
2144
+ const snapshotDoc = doc;
2087
2145
  for (const row of doc.plans) {
2088
2146
  violations.push(...validatePlanRow(row).violations);
2089
2147
  if (isPlainObject2(row) && row.execution_lease !== undefined) {
2090
2148
  violations.push(...validateExecutionLease(row.execution_lease).violations);
2091
2149
  }
2092
2150
  if (isPlainObject2(row) && row.coordination !== undefined) {
2093
- violations.push(...validateRowCoordination(row.coordination, `plans[${String(row.id)}].coordination`));
2151
+ const planRow = row;
2152
+ const route = rowValidationRoute(snapshotDoc, planRow);
2153
+ violations.push(...validateRowCoordination(row.coordination, `plans[${String(row.id)}].coordination`, route));
2154
+ violations.push(...validateStandaloneCompletedCoherence(snapshotDoc, planRow));
2094
2155
  }
2095
2156
  }
2096
2157
  }
@@ -48,6 +48,31 @@ permission:
48
48
  "cloc*": allow
49
49
  "scc*": allow
50
50
  "tokei*": allow
51
+ # Morning Star read-only validators (skills require machine-checked gates)
52
+ "mstar qc validate-report": allow
53
+ "mstar qc validate-report *": allow
54
+ "mstar-harness qc validate-report": allow
55
+ "mstar-harness qc validate-report *": allow
56
+ "mstar lint": allow
57
+ "mstar lint *": allow
58
+ "mstar-harness lint": allow
59
+ "mstar-harness lint *": allow
60
+ "mstar dispatch validate": allow
61
+ "mstar dispatch validate *": allow
62
+ "mstar-harness dispatch validate": allow
63
+ "mstar-harness dispatch validate *": allow
64
+ "mstar worktree qc-alignment": allow
65
+ "mstar worktree qc-alignment *": allow
66
+ "mstar-harness worktree qc-alignment": allow
67
+ "mstar-harness worktree qc-alignment *": allow
68
+ "mstar status validate": allow
69
+ "mstar status validate *": allow
70
+ "mstar-harness status validate": allow
71
+ "mstar-harness status validate *": allow
72
+ "mstar lease verify": allow
73
+ "mstar lease verify *": allow
74
+ "mstar-harness lease verify": allow
75
+ "mstar-harness lease verify *": allow
51
76
  # Audit read-only checks (matches mstar-audit Hard Rule 2)
52
77
  # Deny mutating variants before the exact read-only allows
53
78
  "npm audit fix*": deny
@@ -36,6 +36,31 @@ permission:
36
36
  "cloc*": allow
37
37
  "scc*": allow
38
38
  "tokei*": allow
39
+ # Morning Star read-only validators (skills require machine-checked gates)
40
+ "mstar qc validate-report": allow
41
+ "mstar qc validate-report *": allow
42
+ "mstar-harness qc validate-report": allow
43
+ "mstar-harness qc validate-report *": allow
44
+ "mstar lint": allow
45
+ "mstar lint *": allow
46
+ "mstar-harness lint": allow
47
+ "mstar-harness lint *": allow
48
+ "mstar dispatch validate": allow
49
+ "mstar dispatch validate *": allow
50
+ "mstar-harness dispatch validate": allow
51
+ "mstar-harness dispatch validate *": allow
52
+ "mstar worktree qc-alignment": allow
53
+ "mstar worktree qc-alignment *": allow
54
+ "mstar-harness worktree qc-alignment": allow
55
+ "mstar-harness worktree qc-alignment *": allow
56
+ "mstar status validate": allow
57
+ "mstar status validate *": allow
58
+ "mstar-harness status validate": allow
59
+ "mstar-harness status validate *": allow
60
+ "mstar lease verify": allow
61
+ "mstar lease verify *": allow
62
+ "mstar-harness lease verify": allow
63
+ "mstar-harness lease verify *": allow
39
64
  task:
40
65
  "*": deny
41
66
  explore: allow
@@ -36,6 +36,31 @@ permission:
36
36
  "cloc*": allow
37
37
  "scc*": allow
38
38
  "tokei*": allow
39
+ # Morning Star read-only validators (skills require machine-checked gates)
40
+ "mstar qc validate-report": allow
41
+ "mstar qc validate-report *": allow
42
+ "mstar-harness qc validate-report": allow
43
+ "mstar-harness qc validate-report *": allow
44
+ "mstar lint": allow
45
+ "mstar lint *": allow
46
+ "mstar-harness lint": allow
47
+ "mstar-harness lint *": allow
48
+ "mstar dispatch validate": allow
49
+ "mstar dispatch validate *": allow
50
+ "mstar-harness dispatch validate": allow
51
+ "mstar-harness dispatch validate *": allow
52
+ "mstar worktree qc-alignment": allow
53
+ "mstar worktree qc-alignment *": allow
54
+ "mstar-harness worktree qc-alignment": allow
55
+ "mstar-harness worktree qc-alignment *": allow
56
+ "mstar status validate": allow
57
+ "mstar status validate *": allow
58
+ "mstar-harness status validate": allow
59
+ "mstar-harness status validate *": allow
60
+ "mstar lease verify": allow
61
+ "mstar lease verify *": allow
62
+ "mstar-harness lease verify": allow
63
+ "mstar-harness lease verify *": allow
39
64
  task:
40
65
  "*": deny
41
66
  explore: allow
@@ -36,6 +36,31 @@ permission:
36
36
  "cloc*": allow
37
37
  "scc*": allow
38
38
  "tokei*": allow
39
+ # Morning Star read-only validators (skills require machine-checked gates)
40
+ "mstar qc validate-report": allow
41
+ "mstar qc validate-report *": allow
42
+ "mstar-harness qc validate-report": allow
43
+ "mstar-harness qc validate-report *": allow
44
+ "mstar lint": allow
45
+ "mstar lint *": allow
46
+ "mstar-harness lint": allow
47
+ "mstar-harness lint *": allow
48
+ "mstar dispatch validate": allow
49
+ "mstar dispatch validate *": allow
50
+ "mstar-harness dispatch validate": allow
51
+ "mstar-harness dispatch validate *": allow
52
+ "mstar worktree qc-alignment": allow
53
+ "mstar worktree qc-alignment *": allow
54
+ "mstar-harness worktree qc-alignment": allow
55
+ "mstar-harness worktree qc-alignment *": allow
56
+ "mstar status validate": allow
57
+ "mstar status validate *": allow
58
+ "mstar-harness status validate": allow
59
+ "mstar-harness status validate *": allow
60
+ "mstar lease verify": allow
61
+ "mstar lease verify *": allow
62
+ "mstar-harness lease verify": allow
63
+ "mstar-harness lease verify *": allow
39
64
  task:
40
65
  "*": deny
41
66
  explore: allow
@@ -39,7 +39,7 @@ description: "Morning Star plan harness artifacts — `{PLAN_DIR}` main plans an
39
39
 
40
40
  - **`{WORKFLOW_DIR}/<id>/notes.jsonl`**: per-workflow append-only notes ledger (runtime); snapshot plan-row `notes` is the legacy verbatim copy. **Tech-debt rollup**: `mstar status tech-debt <project-dir>` over the project registers — **`references/status-and-residuals.md`**.
41
41
  - **Iteration Phase 2 leases** (snapshot: `integration_worktree_path`, `plans[].execution_lease`, top-level `integration_merge_lease`): field semantics → **`references/status-and-residuals.md`** (“Iteration execution leases”); Phase 2 execution checklist → **`mstar-iteration`** `references/phase-2-worktree-lease.md`; full protocol prose (single copy) → **`mstar-engine-legacy`** `references/lease-protocol.md`.
42
- - **Plan-scoped coordination is a domain-call surface**: plan-row `coordination` block (`prepared` / `revision` / `duplicate-holder`), session JSON, handoff record, and `--expect <revision>` semantics have their **single runtime home** in **`references/status-and-residuals.md`**; flag shapes and exit codes → `docs/cli.md`; route semantics → **`mstar-iteration`** `references/plan-scoped-pm.md`. Every plan-row mutation goes through the verbs (`mstar plan bind | show | prepare | progress | residual-add | residual-close | handoff | accept | return | integration-start | integration-accept | complete | reconcile`) — hand-editing snapshot rows or the register outside those verbs is **not** an authorized path.
42
+ - **Plan-scoped coordination is a domain-call surface**: plan-row `coordination` block (`prepared` / `revision` / `duplicate-holder`), session JSON, handoff record, and `--expect <revision>` semantics have their **single runtime home** in **`references/status-and-residuals.md`**; flag shapes and exit codes → **`mstar-use-cli`**; route semantics → **`mstar-iteration`** `references/plan-scoped-pm.md`. Every plan-row mutation goes through the verbs (`mstar plan bind | show | prepare | progress | residual-add | residual-close | handoff | accept | return | integration-start | integration-accept | complete | reconcile`) — hand-editing snapshot rows or the register outside those verbs is **not** an authorized path.
43
43
 
44
44
  > **Engine check (when available):** run `mstar lease verify --workflow <id> [--plan <plan-id>]` or `mstar lease verify-integration --workflow <id>` (or import `validateExecutionLease` / `validateIntegrationMergeLease` from `@mstar-harness/engine` in a host hook) to validate the iteration leases above on the workflow snapshot (execution_lease / integration_merge_lease). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
45
45
 
@@ -20,7 +20,12 @@ QC/QA 原始过程报告默认是 **ephemeral review bundle**,置于 `{SDD_DIR
20
20
  | QC 单席报告(**`inline` / hotfix 例外**) | `qc.md` |
21
21
  | QC 汇总结论(tri 模式) | `qc-consolidated.md` |
22
22
  | QA 验收报告(`QA gate: mandatory`) | `qa.md`(或 Assignment 指定的同目录 basename) |
23
+ | L2 task review 报告(**`Execution mode: sdd`,每个已完成 task**) | `../task-N-review.md` |
24
+ | Implementer 报告(**`Execution mode: sdd`**) | `../task-N-report.md` |
23
25
 
26
+ 后两行的 `../` 是**必需**前缀:这两份 artifact 落在 `{SDD_DIR}` 根,**不在** review bundle 内。按上表表头解析,`../task-N-review.md` = **`{SDD_DIR}/task-N-review.md`**,`../task-N-report.md` = **`{SDD_DIR}/task-N-report.md`**;漏掉该前缀(即让它们落在 `{SDD_DIR}/review/` 下)就是错误解析。两者由不同角色写、互不覆盖:implementer 始终写 `task-N-report.md` —— 它是 L2 的**输入**,永不被 L2 覆盖,也不能充当独立审查;fresh L2 task reviewer 始终写 `task-N-review.md`(`Execution mode: sdd` 下每个已完成 task 都必有,不是可选、也不是只留在对话里)。**不存在**接受任一 basename 的 fallback。
27
+
28
+ Mandatory QA always writes `${SDD_DIR}/review/qa.md` (or the Assignment's explicit same-directory basename) with its AC → evidence → result mapping; report-only is a mode, not a condition for mandatory report landing.
24
29
 
25
30
  ## SDD 运行时(不入 reports)
26
31
 
@@ -41,10 +46,12 @@ Raw bundle files may disappear after the working context is gone. Before Done, P
41
46
  - `Review range / Diff basis`
42
47
  - `Review bundle`: `{SDD_DIR}/review/`
43
48
  - `QC inputs`: `qc1.md` / `qc2.md` / `qc3.md` or `qc.md`
49
+ - `Task reviews`: compact per completed task — task number + review range + earned `Task quality` + report pointer (`task-N-review.md` → `{SDD_DIR}/task-N-review.md`); required for handoff once `{SDD_DIR}` is unavailable. The L2 report file lives at the SDD root (outside `{SDD_DIR}/review/`); bundle cleanup removes only the ephemeral `review/` artifacts. The pointer names the L2 report, never the implementer's `task-N-report.md`
44
50
  - `Blocking result`: fixed / none / deferred with reason
45
51
  - `Residual findings`: each open R# — id + short title + severity + tracking location (register `entries[<plan-id>]`) + owner/target + blocker-defer flag (`N/A — none open` when none)
46
52
  - Main plan `## QA Gate Summary` when QA applies:
47
53
  - `QA gate` / `QA mode`
54
+ - acceptance trace: compact AC → evidence → result mapping + coverage/gap disclosure + exact report pointer (`qa.md` → `{SDD_DIR}/review/qa.md`)
48
55
  - evidence reused vs newly run checks
49
56
  - related R# closure recommendations
50
57
  - `{PROJECT_DIR}/<id>/residuals.json` (default `{HARNESS_DIR}/projects/<id>/`): open R# machine SSOT — `entries[<plan-id>]`.
@@ -85,6 +85,10 @@ Each task fits **one focused implementer round** — the round closes the task's
85
85
  - **Split strategies** — apply the review split shapes (`mstar-audit/references/pr-review.md` § Sizing & change shape) to task boundaries, each slice with explicit interfaces and independent proof: stack · by file group · horizontal (shared code first) · vertical (full-stack slices). They shape task boundaries; PR line-count thresholds stay review-owned.
86
86
  - **Verification is not the shock absorber** — **Budget pressure MUST NOT shorten or waive any assigned scoped verification.** If the round cannot close, stop and report for split/re-dispatch instead of cutting checks.
87
87
 
88
+ ### 8. Engine lifecycle ownership
89
+
90
+ **Who advances this row's engine state, at which step, and what evidence records each transition?** The plan answers it explicitly: the scoped verb sequence it will be driven through, the delivery-tail evidence order (`compound` disposition → PR identity → verified merge, recorded **after** the row is `Done`), and — when the snapshot declares no integration anchors — that the row stops at an accepted handoff rather than promising a terminal state it cannot reach. Semantics → `mstar-artifacts/references/plan-workflow-lifecycle-contract.md`; PM step sequence → `mstar-roles/references/project-manager/plan-management.md`.
91
+
88
92
  ## Relationship to existing plan elements
89
93
 
90
94
  | This quality bar | Existing mstar element |
@@ -96,6 +100,7 @@ Each task fits **one focused implementer round** — the round closes the task's
96
100
  | Drift check | SDD `BASE_SHA` — generalized to all plans |
97
101
  | Done criteria | `plan.main.md` per-step checkboxes — elevated to machine-checkable |
98
102
  | Task shape / session fit | `plan.main.md` per-task **Effort (agent-oriented)** / **Split point** slots + `mstar-phase-gates` capacity quick-check — one-round Files-plus-gates closure per task |
103
+ | Engine lifecycle ownership | `plan.main.md` **Engine lifecycle** block — scoped verb sequence, delivery-tail evidence order, and the no-integration-anchors conditional |
99
104
 
100
105
  ## When to apply
101
106
 
@@ -113,3 +113,10 @@ The direction and reason columns record the reasoning behind each answer; the an
113
113
  - No silent completion anywhere. Every stage transition records its evidence; failure renders the workflow blocked/active, never implicitly done.
114
114
  - No cleanup authorization is implied by lifecycle completion: worktree/branch deletion stays explicit and ownership/merge-guarded, exactly as the existing post-merge-close contract requires.
115
115
  - Close never releases leases, and terminal `failed`/`stopped` states are never rewritten as `completed` (§5).
116
+
117
+ > Amendment 2026-09-17 (recorded at PM lock): **legacy delivery-source correction.**
118
+ >
119
+ > Legacy source correction is a distinct coordinator-owned domain operation for a running, single-row standalone development workflow whose registered source erroneously equals its target. It derives the replacement source only from that row's already-accepted, evidence-pinned handoff and verifies the source Git ref/commit. Under the existing snapshot lock and expected row revision it may replace only `branch.source`, advance that row's coordination revision and update snapshot `updated_at`. All PR/merge evidence, statuses, leases, timestamps other than `updated_at`, target and handoff pins remain unchanged. It cannot record Done, delivery success or remote merge. Missing proof, foreign authority, terminal state, a nonmatching legacy shape, or a repeat after correction refuses without writes. Future registrations must name the true delivery source; this is not their normal lifecycle step.
120
+ >
121
+ > This extends §4a (registration is an authorized domain operation) with a bounded repair for pre-existing snapshots only, and leaves §5 (failure and abandonment) and the Binding negatives above untouched.
122
+
@@ -375,7 +375,7 @@ These are **full-protocol prose** — the single canonical copy lives in **`msta
375
375
 
376
376
  ## Plan-scoped coordination (bind / revision / session / handoff) — sole runtime field home
377
377
 
378
- The scoped route(`/iteration-drive --assignment | --workflow <id> --plan <id> | --resume <session.json>` → `mstar plan …`)keeps **one process authority**: the same workflow snapshot (`workflows/<id>/snapshot.json`) and the same root `status.json` — no per-plan snapshot clone, database, daemon or second status copy. This section is the **single runtime home** for the coordination / session / handoff / revision fields; command flags and exit codes → `docs/cli.md`; route semantics → **`mstar-iteration`** `references/plan-scoped-pm.md`; engine API shapes → `packages/engine/src/coordination.ts`.
378
+ The scoped route(`/iteration-drive --assignment | --workflow <id> --plan <id> | --resume <session.json>` → `mstar plan …`)keeps **one process authority**: the same workflow snapshot (`workflows/<id>/snapshot.json`) and the same root `status.json` — no per-plan snapshot clone, database, daemon or second status copy. This section is the **single runtime home** for the coordination / session / handoff / revision fields; command flags and exit codes → **`mstar-use-cli`**; route semantics → **`mstar-iteration`** `references/plan-scoped-pm.md`; engine API shapes → `packages/engine/src/coordination.ts`.
379
379
 
380
380
  ### Snapshot fields
381
381
 
@@ -407,12 +407,16 @@ The scoped route(`/iteration-drive --assignment | --workflow <id> --plan <id>
407
407
 
408
408
  | Actor | May write |
409
409
  | --- | --- |
410
- | coordinator — `mstar plan prepare · accept · return · integration-start · integration-accept · complete · reconcile` | selected row `coordination.prepared` and handoff transitions, `status`, both coordination leases, `Done` |
410
+ | coordinator — `mstar plan prepare · accept · return · integration-start · integration-accept · complete · repair-delivery-source · reconcile` | selected row `coordination.prepared` and handoff transitions, `status`, coordination leases, `Done` (route-specific) |
411
411
  | plan session — `mstar plan progress · residual-add · residual-close · handoff` | its own row `status` + `coordination.progress`, `metadata.track_branches`, its `entries[<planId>]` register bucket, and the handoff record |
412
412
  | anyone else | nothing scoped — sibling rows, lifecycle anchors, root register, `execution_policy`, `compass_ref`, shared indexes, the iteration PR and Phase 3–6 stay on the coordinator / global route |
413
413
 
414
- - **State machine:** `Todo → InProgress` (bind) → `InReview` (handoff; lease kept) → `accepted` → `integrating` → `merged` → `completed` ⇒ `Done`. `progress` allows only `InProgress → InProgress | InReview | Blocked`, `Blocked → Blocked | InProgress`, and `InReview → InReview | InProgress | Blocked` **before** handoff — never `Todo` / `Done` / lease removal. After handoff, all scoped progress/residual mutations are rejected until `return`.
415
- - **`complete` is the one atomic write** that sets `Done` (with verified Git proof and the findings gate), retains row `metadata.working_branch` / `metadata.worktree_path` and existing `track_branches`, and deletes the row `execution_lease` plus the coordinator's `integration_merge_lease`. `accept` is ownership transfer only — no merge, no `Done`; `integration-accept` keeps both leases and `InReview` until `complete`.
414
+ - **State machine:** `Todo → InProgress` (bind) → `InReview` (handoff; lease kept) → `accepted` → (`integrating` → `merged` on the **iteration route only`) → `completed` ⇒ `Done`. `progress` allows only `InProgress → InProgress | InReview | Blocked`, `Blocked → Blocked | InProgress`, and `InReview → InReview | InProgress | Blocked` **before** handoff — never `Todo` / `Done` / lease removal. After handoff, all scoped progress/residual mutations are rejected until `return`.
415
+ - **Two completion routes (engine-selected):**
416
+ - **Iteration** (`type: iteration`, or any workflow that is not standalone development): after `accept`, `integration-start` → coordinator merge → `integration-accept` → `complete`. `complete` is the one atomic write that sets `Done`, completes the handoff, and deletes the row `execution_lease` plus the coordinator's `integration_merge_lease`. `accept` is ownership transfer only — no merge, no `Done`; `integration-accept` keeps both leases and `InReview` until `complete`.
417
+ - **Standalone development** (`type: plan`, `delivery_kind: development`, exactly one owned row): after `accept`, `complete` directly from the accepted handoff with no integration record or merge lease. `complete` sets `Done`, completes the handoff, retains cleanup metadata, deletes only the row `execution_lease`, and leaves the workflow `running` until ordinary delivery evidence and terminal close. Integration verbs refuse this route; missing integration anchors never select it.
418
+ - **Legacy delivery-source repair:** `repair-delivery-source` is coordinator-only, not a normal lifecycle step, and applies only to the pre-fix legacy shape `branch.source === branch.target` with an accepted handoff naming a different source. Under the row revision lock it may replace only `branch.source` (derived from the sealed handoff), advance `coordination.revision`, and update snapshot `updated_at`. It never records `Done`, changes delivery/merge evidence, statuses, leases, or handoff pins, and refuses a second application once aligned. Future registrations must record the true delivery source; `workflow evidence --declare-kind --branch-source` cannot amend an already-registered anchor.
419
+ - **Reconcile:** iteration route observes Git in the recorded integration checkout (`completed` / `retry-ready` / `already-completed`); standalone route only replays an already-completed row as byte-identical `already-completed` — it never manufactures `Done` from Git truth alone.
416
420
  - **Legacy helpers refuse coordinated keys:** `appendProjectRegisterEntries` / `closeProjectRegisterEntry` / backlog next-free-key and `persist` replacements reject an existing coordinated plan bucket with `coordination.scoped-writer-required` (directing the caller to `residual-add` / `residual-close`), and hand writes to protected snapshot / register / root targets are refused with `coordination.direct-write-refused`. Root and global lifecycle operations stay on the existing coordinator route and are never `mutatePlanCoordination` targets.
417
421
  - Read-only validators (`mstar lease verify`, `mstar lease verify-integration`, `mstar worktree check`, `mstar status validate`) remain **checks** — never mutation substitutes.
418
422
 
@@ -432,7 +436,7 @@ Reconciliation observes **Git ancestry / HEAD facts** in the recorded repository
432
436
 
433
437
  **Both byte tokens, always.** The amendment carries the current raw-byte SHA-256 of the **snapshot bytes** and of the workflow's reviewed **compass Markdown bytes** (`sha256:<64 lowercase hex>`, read from the read-only `show-prepare`); both are required even on the first amendment, and neither is a per-plan `coordination.revision`. The compass token binds the reviewed declaration: the resulting plan-id **set** must equal the compass `plans:` list exactly, and its `spec_integration_branch` / `integration_worktree_path` declarations must agree with what the call would leave recorded. The compass is re-read immediately before the single atomic commit.
434
438
 
435
- **Refusals are mutation-free.** `coordination.prepare-amendment.{stale, invalid-patch, not-prepare, execution-started, duplicate-plan, invalid-plan, compass-mismatch, invalid-worktree}` (`coordination-write.ts`), plus the existing auth/scope errors; when each fires, the exact exit code and payload → `docs/cli.md` § `mstar-harness workflow`. The protected snapshot, root register, other workflows and the compass stay byte-identical.
439
+ **Refusals are mutation-free.** `coordination.prepare-amendment.{stale, invalid-patch, not-prepare, execution-started, duplicate-plan, invalid-plan, compass-mismatch, invalid-worktree}` (`coordination-write.ts`), plus the existing auth/scope errors; when each fires, the exact exit code and payload → **`mstar-use-cli`** `references/plan-and-workflow.md`. The protected snapshot, root register, other workflows and the compass stay byte-identical.
436
440
 
437
441
  **Prepare-only, no force.** Recovery from a `stale` token is re-read `show-prepare` → review again → retry with the fresh tokens. There is no force, no replacement snapshot, no reset and no hand-editing workaround for a workflow that has left Prepare or already owns execution.
438
442
 
@@ -16,6 +16,16 @@
16
16
 
17
17
  [Project requirements — version floors, naming, exact values — copied verbatim from spec. Every task includes them. Verification scope follows `mstar-harness-core` § 定向执行与验证边界: only changed behavior and direct contracts; no local full suites without explicit user permission. Never assign real-browser/device/installed-deployment E2E evidence as a task or a gate of a development plan; each layer proves itself with its own unit/integration tests. Real-environment verification lives only in a separately requested `mstar-e2e` workflow, whose named scenarios are that workflow's own plan rows.]
18
18
 
19
+ ## Engine lifecycle
20
+
21
+ Who advances this plan row's engine state, and what records each transition:
22
+
23
+ - **Scoped sequence** — one engine verb per transition; never a hand-edited snapshot: `bind --coordinator` → `prepare` → `bind` → `progress` → `handoff` → `accept` → `integration-start` → Git merge → `integration-accept` → `complete`.
24
+ - **Evidence order** — `compound` disposition, PR identity and merge evidence are recorded **after** the row is `Done`; the engine refuses those writes while any plan row is not `Done`. The delivery tail runs on a completed row, never ahead of it.
25
+ - **Snapshot declares no integration anchors** → the row cannot reach `Done` today: stop at a submitted/accepted handoff, report the blockage to the coordinator, and never fabricate a terminal state (`Done`, `completed`, PR identity, merge record).
26
+
27
+ Semantics and failure behavior → `mstar-artifacts/references/plan-workflow-lifecycle-contract.md`; PM step sequence → `mstar-roles/references/project-manager/plan-management.md`.
28
+
19
29
  ---
20
30
 
21
31
  ### Task 1: [Component Name]
@@ -43,8 +43,8 @@ description: Morning Star (启明星) harness **生命周期 / 授权语义权
43
43
  | 角色 | 始终 | 按任务追加(典型) |
44
44
  |------|------|-------------------|
45
45
  | **全部** | 加载选择 → **`mstar-roles`**(hub § Load Order;本 skill = 生命周期/授权权威,`mstar-roles` hub bootstrap 是 core-first 的唯一例外) | — |
46
- | **`@project-manager`** | 本 skill | `mstar-dispatch-gates`、`mstar-phase-gates`、`mstar-conventions`、`mstar-roles`;implement 波次 `mstar-sdd`;派 QC 前 `mstar-review-qc`;并行/审查 `mstar-branch-worktree`;plan/status/review bundle `mstar-artifacts`;UI 类 plan Prepare 阶段 `mstar-design-md`(DESIGN.md 门禁);新建/大改 skill 时 `mstar-skill-authoring`;迭代管理 `mstar-iteration`(Phase 1–5);战略性工作 `mstar-strategy`;`audit` 类请求 `mstar-audit`(执行归 `@code-reviewer`)。**不**读 `mstar-coding-behavior` |
47
- | **实现/审查/运维** | 本 skill + `mstar-coding-behavior` + 角色 ref | 有 git 写:`mstar-branch-worktree`;有 plan 路径:`mstar-conventions`;**PM** 派 QC 前:`mstar-review-qc`;**`qc-specialist*`**:`mstar-roles` → `references/qc-specialist/`;`qa-engineer`:`references/qa-engineer/`;改 status/residual:`mstar-artifacts`;UI:`mstar-design-md`;知识库:`mstar-compound`(PM) |
46
+ | **`@project-manager`** | 本 skill | `mstar-dispatch-gates`、`mstar-phase-gates`、`mstar-conventions`、`mstar-roles`;implement 波次 `mstar-sdd`;派 QC 前 `mstar-review-qc`;并行/审查 `mstar-branch-worktree`;plan/status/review bundle `mstar-artifacts`;UI 类 plan Prepare 阶段 `mstar-design-md`(DESIGN.md 门禁);新建/大改 skill 时 `mstar-skill-authoring`;迭代管理 `mstar-iteration`(Phase 1–5);战略性工作 `mstar-strategy`;`audit` 类请求 `mstar-audit`(执行归 `@code-reviewer`);跑/解读 CLI 命令时 `mstar-use-cli`。**不**读 `mstar-coding-behavior` |
47
+ | **实现/审查/运维** | 本 skill + `mstar-coding-behavior` + 角色 ref | 有 git 写:`mstar-branch-worktree`;有 plan 路径:`mstar-conventions`;**PM** 派 QC 前:`mstar-review-qc`;**`qc-specialist*`**:`mstar-roles` → `references/qc-specialist/`;`qa-engineer`:`references/qa-engineer/`;改 status/residual:`mstar-artifacts`;UI:`mstar-design-md`;知识库:`mstar-compound`(PM);跑/解读 CLI 命令时(各 leaf 角色按任务):`mstar-use-cli` |
48
48
  | **leaf 承接方** | 上栏 + **`mstar-dispatch-gates`**(反递归节) | — |
49
49
 
50
50
  Routing eval(宿主插件内回归用,**非**运行时必读)→ `.cursor/skills/mstar-routing-eval/`。
@@ -91,6 +91,7 @@ PM 在 Assignment 写 **`Task category`**(主类 + 可选 `secondary`):
91
91
  | Skill | 职责 |
92
92
  |-------|------|
93
93
  | `mstar-harness-core` | 本文件:入口、状态机、Task category、explore、索引、护栏 |
94
+ | `mstar-use-cli` | CLI 契约(agent 面向):任务→命令族索引、前置条件阶梯、两条协议序列、退出码 0 / 1 / 2 与稳定拒绝码读法;flags 一律以命令自身 `--help` 为准 |
94
95
  | `mstar-phase-gates` | per-plan 双阶段门禁:Prepare/Execute、意图门禁、hotfix、可验证编辑 |
95
96
  | `mstar-iteration` | 迭代管理:Phase 1–5(start / Autonomous Execute / iteration-close / PR delivery / PR merge-ready loop) |
96
97
  | `mstar-dispatch-gates` | 派发、Delegation、反递归、依赖与隔离驱动并行、SDD 路径 plan QC 强制 tri |
@@ -124,7 +124,7 @@ iteration 正式全流程**必须**登记 `{HARNESS_DIR}/status.json`(v2 根
124
124
 
125
125
  compass frontmatter 的 `iteration_base_branch` / `target_branch` **必须与** snapshot `branch` 一致;若仅写在 compass 而 snapshot 缺失,Phase 2 §2.3 同轮 backfill。
126
126
 
127
- **中途增减范围(已存在且仍在 Prepare 的 workflow)**:用户/产品批准的范围扩张**不得**手改受保护状态。先以 `mstar plan bind --coordinator --workflow <id>` 建立该 workflow 的 coordinator 会话,再经受守卫入口 `mstar workflow show-prepare` 读取快照与 compass 两个字节版本,并以 `mstar workflow amend-prepare` 追加已批准的 Todo 行、登记已 review 的 integration checkout 与 `plan_parallelism`(仅 Prepare 且无执行所有权时可用;无 force/replace/init 通道)。守卫与字段权威 → **`mstar-artifacts`** `references/status-and-residuals.md`「Prepare workflow amendment」;forms / exit codes → `docs/cli.md` § `mstar-harness workflow`。
127
+ **中途增减范围(已存在且仍在 Prepare 的 workflow)**:用户/产品批准的范围扩张**不得**手改受保护状态。先以 `mstar plan bind --coordinator --workflow <id>` 建立该 workflow 的 coordinator 会话,再经受守卫入口 `mstar workflow show-prepare` 读取快照与 compass 两个字节版本,并以 `mstar workflow amend-prepare` 追加已批准的 Todo 行、登记已 review 的 integration checkout 与 `plan_parallelism`(仅 Prepare 且无执行所有权时可用;无 force/replace/init 通道)。守卫与字段权威 → **`mstar-artifacts`** `references/status-and-residuals.md`「Prepare workflow amendment」;forms / exit codes → **`mstar-use-cli`** `references/plan-and-workflow.md`。
128
128
 
129
129
  <!-- host-hook: iteration-entry -->
130
130
  > Execute the active host reference's `## Host hooks` declaration for `iteration-entry`; this file defines no host action.
@@ -3,7 +3,7 @@
3
3
  **Single home for the scoped route.** This file owns: accepted addressing forms, scoped boot, the plan-local driving loop, the scoped stop, and the coordinator command sequence. It does **not** own field/schema tables, executable flag syntax, or Assignment header templates.
4
4
 
5
5
  - Command frontmatter/argument surface → **`commands/iteration-drive.md`**
6
- - Executable flags, exit codes, JSON envelopes → **`docs/cli.md`**(CLI owner)
6
+ - Executable flags, exit codes, JSON envelopes → **`mstar-use-cli`**(CLI owner)
7
7
  - `coordination` / session / handoff / revision fields and row/register ownership → **`mstar-artifacts/references/status-and-residuals.md`**(sole runtime schema home)
8
8
  - Portable primary Assignment header → **`mstar-roles/references/project-manager/dispatch-and-assignment.md`**
9
9
  - Dispatch mechanics, isolation gates → **`mstar-dispatch-gates`**, **`mstar-sdd`**, **`mstar-branch-worktree`**
@@ -43,14 +43,15 @@ PM-owned activation; the omission / `none` / named-preset / resume / unknown-pre
43
43
 
44
44
  | Role | Preset menu |
45
45
  | --- | --- |
46
- | `project-manager` | `mstar-dispatch-gates`, `mstar-phase-gates`, `mstar-conventions`, `mstar-roles` ref; + `references/project-manager/qa-trigger-matrix.md` for QA gate tiers; + `mstar-review-qc` before QC; + `mstar-branch-worktree` / `mstar-artifacts` as the round requires; + `mstar-skill-authoring` for skill work; + `mstar-iteration` for iteration lifecycle (start/drive/close); + `mstar-strategy` for strategic alignment; + `mstar-compound` / `mstar-compound-refresh` pre-loaded by `mstar-iteration` § iteration-close |
47
- | `fullstack-dev*`, `frontend-dev` | `mstar-coding-behavior`, `mstar-dispatch-gates`, `mstar-branch-worktree` (if repo writes); plan path symbols from `mstar-conventions` (minimal); `mstar-design-md` when implementing styled UI |
48
- | `qc-specialist*` | Presets: `mstar-branch-worktree`, `mstar-artifacts` (review bundle paths); `mstar-design-md` when reviewing UI. Role-owned (never gated): `references/qc-specialist/` workflow/checklist/template (+ lenses on demand) |
49
- | `qa-engineer` | Presets: `mstar-branch-worktree`, `mstar-artifacts` (closing R#); `mstar-design-md` when verifying visual output. Role-owned (never gated): `references/qa-engineer/acceptance-gate.md` |
50
- | `architect`, `product-manager` | `mstar-phase-gates` (Prepare), `mstar-artifacts` (knowledge/specs); `mstar-design-md` (creator + design intent); `mstar-strategy` (STRATEGY.md creation/maintenance) |
51
- | `code-reviewer` | `mstar-sdd` (per-task review mode); `mstar-audit` (audit mode: full workflow); `mstar-conventions` (paths); `mstar-artifacts` (plan-quality-bar for audit plans) |
52
- | `ops-engineer` | `mstar-coding-behavior`, `mstar-branch-worktree` |
53
- | `prompt-engineer` | All topic skills when editing harness text |
46
+ | `project-manager` | `mstar-dispatch-gates`, `mstar-phase-gates`, `mstar-conventions`, `mstar-roles` ref; + `references/project-manager/qa-trigger-matrix.md` for QA gate tiers; + `mstar-review-qc` before QC; + `mstar-branch-worktree` / `mstar-artifacts` as the round requires; + `mstar-skill-authoring` for skill work; + `mstar-iteration` for iteration lifecycle (start/drive/close); + `mstar-strategy` for strategic alignment; + `mstar-use-cli` when the round runs or interprets CLI commands; + `mstar-compound` / `mstar-compound-refresh` pre-loaded by `mstar-iteration` § iteration-close |
47
+ | `fullstack-dev*`, `frontend-dev` | `mstar-coding-behavior`, `mstar-dispatch-gates`, `mstar-branch-worktree` (if repo writes); plan path symbols from `mstar-conventions` (minimal); `mstar-design-md` when implementing styled UI; `mstar-use-cli` when the round runs or interprets CLI commands |
48
+ | `qc-specialist*` | Presets: `mstar-branch-worktree`, `mstar-artifacts` (review bundle paths); `mstar-design-md` when reviewing UI; `mstar-use-cli` when the round runs or interprets CLI commands. Role-owned (never gated): `references/qc-specialist/` workflow/checklist/template (+ lenses on demand) |
49
+ | `qa-engineer` | Presets: `mstar-branch-worktree`, `mstar-artifacts` (closing R#); `mstar-design-md` when verifying visual output; `mstar-use-cli` when the round runs or interprets CLI commands. Role-owned (never gated): `references/qa-engineer/acceptance-gate.md` |
50
+ | `architect` | `mstar-phase-gates` (Prepare), `mstar-artifacts` (knowledge/specs); `mstar-design-md` (creator + design intent); `mstar-strategy` (STRATEGY.md creation/maintenance); `mstar-use-cli` when the round runs or interprets CLI commands |
51
+ | `product-manager` | `mstar-phase-gates` (Prepare), `mstar-artifacts` (knowledge/specs); `mstar-design-md` (creator + design intent); `mstar-strategy` (STRATEGY.md creation/maintenance) |
52
+ | `code-reviewer` | `mstar-sdd` (per-task review mode); `mstar-audit` (audit mode: full workflow); `mstar-conventions` (paths); `mstar-artifacts` (plan-quality-bar for audit plans); `mstar-use-cli` when the round runs or interprets CLI commands |
53
+ | `ops-engineer` | `mstar-coding-behavior`, `mstar-branch-worktree`; `mstar-use-cli` when the round runs or interprets CLI commands |
54
+ | `prompt-engineer` | All topic skills when editing harness text; `mstar-use-cli` when the round runs or interprets CLI commands |
54
55
 
55
56
  Use skill names (not absolute filesystem paths) in role references.
56
57
 
@@ -97,7 +97,7 @@ Topic skills below are **presets activated by PM**, not unconditional role depen
97
97
 
98
98
  1. `mstar-harness-core` → `mstar-dispatch-gates` → `mstar-phase-gates` (Prepare: specify/clarify/plan) → `mstar-conventions` (`{PLAN_DIR}`, plan-writing path)
99
99
  2. Typically: `mstar-artifacts` (specs, **`{ITERATION_DIR}/<id>/` package**); `mstar-coding-behavior`. Boundaries → **`mstar-iteration/references/iteration-artifact-boundaries.md`**
100
- 3. On demand: `mstar-branch-worktree` (committing architecture docs to the business repo); `mstar-design-md` (plan involves UI work / design tokens — read DESIGN.md for design specs)
100
+ 3. On demand: `mstar-branch-worktree` (committing architecture docs to the business repo); `mstar-design-md` (plan involves UI work / design tokens — read DESIGN.md for design specs); `mstar-use-cli` (round runs or interprets CLI commands — resolving a plan path, validating a coordination document)
101
101
  4. Host: `mstar-host` (detect; `references/opencode.md` | `cursor.md` | `codex.md`)
102
102
 
103
103
  ## Completion Report
@@ -23,13 +23,19 @@ Layering anchor: `mstar-review-qc/references/review-responsibility-boundaries.md
23
23
  ## Mode A — SDD Task Reviewer (default)
24
24
 
25
25
  - **Inputs:** task brief path, implementer report path, task diff file path, Global Constraints (verbatim).
26
+ - **Output:** `REPORT_FILE` = `${SDD_DIR}/task-N-review.md` — always written for a completed task under `Execution mode: sdd`, and the only file this mode writes. The implementer's `task-N-report.md` is an input you read and never write; this output is L2 only, never formal QC (`{SDD_DIR}/review/qcN.md`) or QA.
26
27
  - **Behavior:** diff-first. Spec compliance first, then code quality. Read the diff once; do not re-run git; do not mutate the checkout; do not re-run the full test suite.
27
28
  - **Discipline:** fresh per task (no sticky resume); never pre-judge the verdict.
28
29
  - **Template SSOT:** `skills/mstar-sdd/references/task-reviewer-prompt.md`.
29
30
 
30
31
  ### Output (Mode A)
31
32
 
33
+ Written to `REPORT_FILE` (`${SDD_DIR}/task-N-review.md`):
34
+
32
35
  ```
36
+ ## Scope # only when a bound actually stopped expansion; a complete review omits this section and its label
37
+ - `- Truncated coverage: <budget reached; specific interfaces/files left unexamined>`
38
+
33
39
  ### Spec Compliance
34
40
  - ✅ Spec compliant | ❌ Issues found (file:line)
35
41
  - ⚠️ Cannot verify from diff: [items for PM to check]
@@ -43,7 +49,7 @@ Layering anchor: `mstar-review-qc/references/review-responsibility-boundaries.md
43
49
  **Task quality:** Approved | Needs fixes
44
50
  ```
45
51
 
46
- `⚠️ Cannot verify from diff` items do not block other findings — PM resolves them before marking the task complete.
52
+ `⚠️ Cannot verify from diff` items do not block other findings — PM resolves them before marking the task complete. A budget stop keeps the `Task quality` earned for reviewed scope and is never relabelled `Unconfirmed`; PM reads this report and cannot mark the whole task complete while the assigned review scope remains uncovered.
47
53
 
48
54
  ### Issue severity (Mode A)
49
55
 
@@ -99,7 +105,7 @@ Follow the `pr` variant output shape in **`references/pr-review.md`** § Output
99
105
 
100
106
  If any item below matches, **stop** and return `Blocked` to `project-manager` instead of improvising:
101
107
 
102
- - **NEVER** modify product code — report issues, do not fix them. The only files you create are review reports under `{SDD_DIR}` (Mode A), plans under `{PLAN_DIR}/audit-<date>/` (Mode B), or **evidence files under `{PROJECT_DIR}/<project-id>/reports/pr-review/`** (Mode C — path SSOT `references/pr-review.md` § Local report archive; gitignored, never the reviewed worktree).
108
+ - **NEVER** modify product code — report issues, do not fix them. The only files you create are review reports at `${SDD_DIR}/task-N-review.md` (Mode A), plans under `{PLAN_DIR}/audit-<date>/` (Mode B), or **evidence files under `{PROJECT_DIR}/<project-id>/reports/pr-review/`** (Mode C — path SSOT `references/pr-review.md` § Local report archive; gitignored, never the reviewed worktree).
103
109
  - **NEVER** execute tests or builds (no test running, no re-runs) — trust implementer evidence; missing runtime evidence is a ⚠️ (`Cannot verify`) item for PM/QA to resolve, never executed by the reviewer.
104
110
  - **NEVER** occupy a QC seat — you are not `qc-specialist*`; L2 review is not a formal QC gate and `assertTriIdentity` / QC single-seat / targeted re-review semantics are untouched.
105
111
  - Shared anti-recursion NEVER bullets (doc-level parallelism ≠ N subagents; Handoff / routing prose ≠ invoke; tool exposure ≠ delegation; PM-only parallel dispatch; no same-role / sibling spawn without `Delegation: allowed (...)`): **`references/_shared/leaf-executor-core.md`**「Shared anti-recursion NEVER」.
@@ -128,7 +134,7 @@ Topic skills below are **presets activated by PM**, not unconditional role depen
128
134
  - Mode A (SDD task reviewer): `mstar-sdd` → `references/task-reviewer-prompt.md`, `references/file-handoffs.md`
129
135
  - Mode B (audit executor): `mstar-audit` SKILL.md (common core) + `references/codebase-audit.md`
130
136
  - Mode C (PR review): `mstar-audit` SKILL.md + `references/pr-review.md` + `mstar-branch-worktree` (worktree isolation)
131
- 3. Paths: `mstar-conventions`; add `mstar-artifacts` (plan-quality-bar) when writing audit plans
137
+ 3. Paths: `mstar-conventions`; add `mstar-artifacts` (plan-quality-bar) when writing audit plans; add `mstar-use-cli` when the round runs or interprets CLI commands (audit plan scaffold/promote, PR-review helpers, reading a refusal code)
132
138
  4. Host: `mstar-host` (detect; active host reference)
133
139
 
134
140
  ## Completion Report
@@ -58,7 +58,7 @@ Topic skills below are **presets activated by PM**, not unconditional role depen
58
58
 
59
59
  1. `mstar-harness-core` → `mstar-coding-behavior` → `mstar-dispatch-gates`
60
60
  2. Typically: `mstar-conventions` (paths + spec metadata)
61
- 3. On demand: `mstar-branch-worktree` (repo writes); `mstar-phase-gates` (Execute / hotfix when referenced in assignment); `mstar-design-md` (styled UI — read DESIGN.md tokens before writing components)
61
+ 3. On demand: `mstar-branch-worktree` (repo writes); `mstar-phase-gates` (Execute / hotfix when referenced in assignment); `mstar-design-md` (styled UI — read DESIGN.md tokens before writing components); `mstar-use-cli` (task must run or interpret CLI commands — path resolution, a verification command, reading a refusal or exit code)
62
62
  4. Host: `mstar-host` (detect; `references/opencode.md` | `cursor.md` | `codex.md`)
63
63
 
64
64
  ## Completion Report
@@ -77,7 +77,7 @@ Topic skills below are **presets activated by PM**, not unconditional role depen
77
77
 
78
78
  1. `mstar-harness-core` → `mstar-coding-behavior` → `mstar-dispatch-gates` (leaf anti-recursion before any Task/subagent)
79
79
  2. Typically: `mstar-conventions` (path symbols + `metadata.primary_spec` / `spec_refs`)
80
- 3. On demand: `mstar-branch-worktree` (repo writes, `Working branch`); `mstar-phase-gates` (Execute / hotfix sections when gate fields are in the assignment); `mstar-design-md` (task includes UI implementation — read DESIGN.md for design tokens)
80
+ 3. On demand: `mstar-branch-worktree` (repo writes, `Working branch`); `mstar-phase-gates` (Execute / hotfix sections when gate fields are in the assignment); `mstar-design-md` (task includes UI implementation — read DESIGN.md for design tokens); `mstar-use-cli` (task must run or interpret CLI commands — SDD evidence capture, path resolution, reading a refusal or exit code)
81
81
  4. Host: `mstar-host` (detect; `references/opencode.md` | `cursor.md` | `codex.md`)
82
82
 
83
83
  ## Completion Report
@@ -63,7 +63,7 @@ Topic skills below are **presets activated by PM**, not unconditional role depen
63
63
 
64
64
  1. `mstar-harness-core` → `mstar-coding-behavior` → `mstar-dispatch-gates` → `mstar-branch-worktree` (repo writes, production-touching branches)
65
65
  2. Typically: `mstar-conventions` (paths)
66
- 3. On demand: `mstar-phase-gates` (hotfix compressed path when assignment says hotfix)
66
+ 3. On demand: `mstar-phase-gates` (hotfix compressed path when assignment says hotfix); `mstar-use-cli` (round runs or interprets CLI commands — worktree/lease checks, reading a refusal code)
67
67
  4. Host: `mstar-host` (detect; `references/opencode.md` | `cursor.md` | `codex.md`)
68
68
 
69
69
  ## Completion Report
@@ -53,7 +53,13 @@ If legacy plan directories already exist, reuse them; avoid dual-structure dupli
53
53
  [--branch-source <branch> --branch-target <branch> | --completion-policy <text>] [--session <path>]
54
54
  ```
55
55
  The declaration is one-time (a second one, even with the same kind, is refused) and refuses a terminal snapshot; a supplied `--branch-source`/`--branch-target` fills a MISSING anchor or restates the registered one — a value conflicting with an anchor the snapshot already carries is refused (the registered anchor is the delivery identity, never overwritten); delivery evidence itself is recorded with `mstar workflow evidence --workflow <id> --file <payload.json>` (PR identity recorded once; `head`/`target` must be the registered `branch.source`/`branch.target`).
56
+ - **Row completion routes (engine-selected):** after `accept`, the coordinator follows one of two routes — never inferred from missing integration anchors.
57
+ - **Iteration** (`type: iteration`, or any non-standalone workflow): `integration-start` → coordinator merge in the recorded integration checkout → `integration-accept` → `complete`. `complete` sets the row `Done`, completes the handoff, and releases the row `execution_lease` and the workflow `integration_merge_lease`.
58
+ - **Standalone development** (`type: plan`, `delivery_kind: development`, exactly one owned row): `complete` directly from the accepted handoff with no integration verbs. `complete` sets `Done`, completes the handoff, retains cleanup metadata, releases only the row `execution_lease`, and leaves the workflow `running` until the delivery tail and `status workflow-close`.
59
+ - **Legacy delivery-source repair (not a normal step):** `mstar plan repair-delivery-source` applies only when a pre-fix snapshot registered `branch.source === branch.target` while the accepted handoff names the true feature branch. It replaces only `branch.source` under the row revision lock, derived from the sealed handoff — no user-supplied branch, no `Done`, no delivery-evidence rewrite. Continue with ordinary `complete` after repair. Future registrations must record the true delivery source at `workflow register` time; `workflow evidence --declare-kind --branch-source` cannot amend an already-registered anchor (one-time kind declaration only).
60
+
56
61
  - Delivery tail (standalone `development` plans, after Done): compound disposition (`created` / `updated` / reasoned `skipped`; review → **`mstar-compound`**) on the delivery branch before the PR head is finalized → submit PR with its identity (repo / head / target) recorded → merge-ready declared (resumable milestone; workflow stays registered) → PM-verified merge (provider evidence; never the close verb) → common close reusing the post-merge-close ordering (`mstar-iteration/references/phase-6-post-merge-close.md`). Stage semantics and failure behavior → frozen contract `mstar-artifacts/references/plan-workflow-lifecycle-contract.md`.
62
+ - **Merge-ready precondition — standalone `development` plans only.** Before merge-ready is declared, run the read-only close-state gate and record its output with the milestone (`mstar iteration gate --phase 6 --workflow <id> [--harness <absolute-path>]`; same implementation as the close's delivery-evidence consultation, no `--compass`). Pre-merge the snapshot is still `running`, so `PHASE6_NOT_TERMINAL` / `PHASE6_ROOT_ENTRY_PRESENT` are the expected readings and the recorded note says so; any other code (`PHASE6_INVALID_SNAPSHOT`, `PHASE6_INVALID_ROOT`) is a real defect to clear before merge-ready. Iteration workflows are unaffected — they keep their own Phase 4/5 exit checklist (`mstar-iteration/references/phase-4-5-pr-delivery.md` §5.2).
57
63
 
58
64
  ## PM Plan / Status NEVER
59
65
 
@@ -6,9 +6,10 @@ Before any non-trivial PM action, read in order:
6
6
  2. `mstar-dispatch-gates` + `mstar-phase-gates` (dispatch + Prepare/Execute gates)
7
7
  3. Host adapter: **`mstar-host`** (detect the active host; then Read the reference that detection resolves to)
8
8
  4. `mstar-conventions` (path discovery, init, Spec branch summary)
9
- 5. `mstar-review-qc` (same coordination round, **before** any QC dispatch)
10
- 6. **`mstar-sdd`** when implement uses **`Execution mode: sdd`**
11
- 7. **On demand:** `mstar-branch-worktree` (parallel implement, QC/QA checkout); `mstar-artifacts` (`status.json` v2 root, workflow snapshots, R#); `mstar-artifacts` (InReview waves, review bundle naming)
9
+ 5. Plan lifecycle authority — `references/project-manager/plan-management.md` + **`mstar-artifacts`** `references/plan-workflow-lifecycle-contract.md`: who advances the plan row's engine state, the scoped verb sequence, and the evidence each transition records — read **before the first implement dispatch**, not first at close
10
+ 6. `mstar-review-qc` (same coordination round, **before** any QC dispatch)
11
+ 7. **`mstar-sdd`** when implement uses **`Execution mode: sdd`**
12
+ 8. **On demand:** `mstar-branch-worktree` (parallel implement, QC/QA checkout); `mstar-artifacts` (`status.json` v2 root, workflow snapshots, R#); `mstar-artifacts` (InReview waves, review bundle naming)
12
13
 
13
14
  **Not required:** `mstar-coding-behavior` (orchestration-only PM work).
14
15
 
@@ -53,7 +53,7 @@ Topic skills below are **presets activated by PM**, not unconditional role depen
53
53
  1. `mstar-harness-core` → `mstar-dispatch-gates`
54
54
  2. Harness-text editing trigger (activation implies): read **all** topic skills you touch — at minimum `mstar-phase-gates`, `mstar-conventions`, `mstar-artifacts`, `mstar-branch-worktree`, `mstar-review-qc`, `mstar-coding-behavior`, plus host adapters — so prompts stay aligned with SSOT and do not re-duplicate rules
55
55
  3. New skill / major skill rewrite / trigger-description change (activation implies): MUST read `mstar-skill-authoring` before editing
56
- 4. Typically: `mstar-conventions` (path symbols in examples)
56
+ 4. Typically: `mstar-conventions` (path symbols in examples); `mstar-use-cli` (round runs or interprets CLI commands — the roles / skill lints this role invokes, reading a validator's exit code)
57
57
  5. Host: `mstar-host` (detect; `references/opencode.md` | `cursor.md` | `codex.md`)
58
58
 
59
59
  ## Completion Report