@mstar-harness/opencode 1.8.9 → 2.0.1

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 (38) hide show
  1. package/CHANGELOG.md +30 -2
  2. package/README.md +10 -0
  3. package/dist/mstar.js +572 -0
  4. package/harness-commands/iteration-drive.md +17 -1
  5. package/harness-commands/iteration-loop.md +16 -0
  6. package/harness-commands/iteration-start.md +16 -0
  7. package/harness-skills/mstar-audit/SKILL.md +2 -0
  8. package/harness-skills/mstar-branch-worktree/SKILL.md +4 -0
  9. package/harness-skills/mstar-coding-behavior/SKILL.md +5 -0
  10. package/harness-skills/mstar-compound/SKILL.md +2 -0
  11. package/harness-skills/mstar-compound-refresh/SKILL.md +2 -0
  12. package/harness-skills/mstar-design-md/SKILL.md +2 -0
  13. package/harness-skills/mstar-design-md/templates/DESIGN.dark.md.template +5 -0
  14. package/harness-skills/mstar-design-md/templates/DESIGN.md.template +5 -0
  15. package/harness-skills/mstar-dispatch-gates/SKILL.md +6 -0
  16. package/harness-skills/mstar-host/SKILL.md +4 -0
  17. package/harness-skills/mstar-iteration/SKILL.md +12 -4
  18. package/harness-skills/mstar-iteration/references/phase-4-5-pr-delivery.md +2 -0
  19. package/harness-skills/mstar-phase-gates/SKILL.md +2 -0
  20. package/harness-skills/mstar-plan-artifacts/SKILL.md +13 -2
  21. package/harness-skills/mstar-plan-artifacts/references/plan-quality-bar.md +1 -1
  22. package/harness-skills/mstar-plan-artifacts/references/status-and-residuals.md +12 -13
  23. package/harness-skills/mstar-plan-artifacts/templates/README.md +1 -1
  24. package/harness-skills/mstar-plan-conventions/SKILL.md +9 -1
  25. package/harness-skills/mstar-plan-conventions/references/harness-bootstrap-and-agents-layering.md +1 -1
  26. package/harness-skills/mstar-review-qc/SKILL.md +2 -0
  27. package/harness-skills/mstar-roles/SKILL.md +2 -0
  28. package/harness-skills/mstar-roles/references/project-manager/dispatch-and-assignment.md +1 -1
  29. package/harness-skills/mstar-sdd/SKILL.md +18 -14
  30. package/harness-skills/mstar-sdd/references/file-handoffs.md +8 -8
  31. package/harness-skills/mstar-sdd/references/sticky-implementer-session.md +2 -2
  32. package/harness-skills/mstar-skill-authoring/SKILL.md +4 -0
  33. package/harness-skills/mstar-strategy/SKILL.md +2 -0
  34. package/package.json +6 -2
  35. package/harness-skills/mstar-plan-artifacts/scripts/tech-debt-rollup.sh +0 -115
  36. package/harness-skills/mstar-sdd/scripts/review-package +0 -43
  37. package/harness-skills/mstar-sdd/scripts/sdd-workspace +0 -90
  38. package/harness-skills/mstar-sdd/scripts/task-brief +0 -40
@@ -31,7 +31,7 @@ Execute **`mstar-iteration` §2.6**(Continuous execution SSOT:自 Phase 2
31
31
  | 禁止(PM 线程) | 必须 |
32
32
  |-----------------|------|
33
33
  | Write/Edit/Shell 产品代码、写测试、跑 QC 审查(Phase 2) | 每条 implement/QC/QA Assignment ⇒ **1 次 `Task`** |
34
- | **多 task plan 用 inline 大包派发**(整份 plan / T1–Tn 贴进一个 dev Assignment) | **SDD**:`mstar-sdd` per-task 循环 — `task-brief` → implementer → `review-package` → task reviewer → `progress.md` |
34
+ | **多 task plan 用 inline 大包派发**(整份 plan / T1–Tn 贴进一个 dev Assignment) | **SDD**:`mstar-sdd` per-task 循环 — `mstar sdd task-brief` → implementer → `mstar sdd review-package` → task reviewer → `progress.md` |
35
35
  | 只写 Assignment 就进入下一 gate | 同轮 dispatch:`Subagent invokes issued: N`(N = Assignment 条数) |
36
36
  | 最后一个 plan `Done` 后直接开 PR / 汇报结束 | **Phase 3 → 4 → 5** 顺序执行 |
37
37
  | Phase 4 开 PR 后停止 | Phase 5 loop 至 merge-ready;**禁止**未过 §5.5 就结束会话 |
@@ -64,6 +64,22 @@ Execute **`mstar-iteration` §2.6**(Continuous execution SSOT:自 Phase 2
64
64
 
65
65
  **Continuous execution applies**(上节)。Execute **`mstar-iteration` § Phase 2** exactly:§2.0 前置五道闸(含 branch metadata #4 + control-worktree/lease #5)→ §2.1 session todos → §2.2 read backlog(`status.json` + branch metadata)→ §2.3 integration branch + control worktree(record `metadata.control_worktree_path`;status/SDD via control path)→ §2.4 per-plan loop(**lease-gated parallel** across plan IDs unless `Plan parallelism: serial`;claim/resume `execution_lease`;feature worktree;**SDD** per-task 串行;QC full tri-review **N=3** + QA;serial merge via `integration_merge_lease`;cross-plan sync → compass)→ §2.5 dispatch-first → §2.6 push 纪律。全部 plan `Done` → **STOP**(Phase flow)→ 打印 `## Phase 3: iteration-close`;**不得**进入 Phase 4。
66
66
 
67
+ **Assignment preflight**(`mstar-harness` bin 未安装时静默跳过): 在每次 implement/QC/QA 派发前(**SDD** 下为最新 `{SDD_DIR}/task-N-brief.md` 或临时写盘的 Assignment),若本机装有 CLI,校验最新 Assignment。模式由迭代 compass frontmatter 的 `enforcement` 键决定(Slice 5):
68
+
69
+ - **默认(compass 无 `enforcement: hard`)— 可选 warn-only**:exit 1 仅提示,不阻断派发(Slice 3 行为不变):
70
+
71
+ ```bash
72
+ command -v mstar-harness >/dev/null 2>&1 && mstar-harness dispatch validate "<latest-assignment-file>"
73
+ ```
74
+
75
+ - **`enforcement: hard`(迭代 compass frontmatter 声明)— fail-fast**:校验失败即 `exit 1` 阻断派发(bin 缺失仍静默跳过):
76
+
77
+ ```bash
78
+ if command -v mstar-harness >/dev/null 2>&1; then mstar-harness dispatch validate "<latest-assignment-file>" || exit 1; fi
79
+ ```
80
+
81
+ > 路径必须加引号且替换为具体文件(如最新 `{SDD_DIR}/task-N-brief.md`,勿留尖括号)——agent 代入的路径不得进入 shell 无引号展开(qc2 W-2)。
82
+
67
83
  ## Phase 3: iteration-close
68
84
 
69
85
  当 **every** plan 为 `Done`:
@@ -116,6 +116,22 @@ Per **`mstar-iteration` §2.3**(`git fetch` → `git checkout -b <spec_integra
116
116
 
117
117
  Delegate to **`iteration-drive`**(Phase 2 → **`mstar-iteration` §2**、Phase 3 → **§3** + `references/phase-3-iteration-close.md`、Phase 4/5 → **§4–§5** + `references/phase-4-5-pr-delivery.md`、Phase 5 helper discovery → `mstar-iteration/references/phase5-helper-discovery.md`)。
118
118
 
119
+ **Assignment preflight**(`mstar-harness` bin 未安装时静默跳过): 每次 implement/QC/QA 派发前校验最新 Assignment(**SDD** 下为最新 `{SDD_DIR}/task-N-brief.md` 或临时写盘的 Assignment),同 `iteration-drive`。模式由迭代 compass frontmatter 的 `enforcement` 键决定(Slice 5):
120
+
121
+ - **默认(compass 无 `enforcement: hard`)— 可选 warn-only**:exit 1 仅提示,不阻断派发(Slice 3 行为不变):
122
+
123
+ ```bash
124
+ command -v mstar-harness >/dev/null 2>&1 && mstar-harness dispatch validate "<latest-assignment-file>"
125
+ ```
126
+
127
+ - **`enforcement: hard`(迭代 compass frontmatter 声明)— fail-fast**:校验失败即 `exit 1` 阻断派发(bin 缺失仍静默跳过):
128
+
129
+ ```bash
130
+ if command -v mstar-harness >/dev/null 2>&1; then mstar-harness dispatch validate "<latest-assignment-file>" || exit 1; fi
131
+ ```
132
+
133
+ > 路径必须加引号且替换为具体文件(如最新 `{SDD_DIR}/task-N-brief.md`,勿留尖括号)——agent 代入的路径不得进入 shell 无引号展开(qc2 W-2)。
134
+
119
135
  **Loop 特有**:Phase 5 push cadence(HARD)→ **`mstar-iteration` §5.1a**;exit checklist → **`mstar-iteration` §5.2**(`references/phase-4-5-pr-delivery.md` §5.2)。
120
136
 
121
137
  **Then** report: iteration id, locked direction + scale, plans completed, compound summary, PR link, merge-ready evidence.
@@ -82,6 +82,22 @@ Produce harness artifacts per **`mstar-iteration` §1.3–§1.5**(template: `m
82
82
 
83
83
  Execute **`mstar-iteration` §1.6**(SSOT):顺序 `product-manager` → `architect` → `writing-specialist` → PM lock(**禁止**并行三角色;OpenCode plain role id — `mstar-host/references/opencode.md` § Role-mention hygiene);**禁止** `{KNOWLEDGE_DIR}/` 新增;writing-specialist specs corpus hygiene(`iteration-artifact-boundaries.md` + `iteration-corpus-hygiene.md`)。Tool rule → **`mstar-dispatch-gates`** specialist review-and-edit(每角色 1 invoke,等磁盘修订返回)。Exception: user explicitly waives subagent dispatch ("PM-only review").
84
84
 
85
+ **Assignment preflight**(`mstar-harness` bin 未安装时静默跳过): 在每次角色 invoke 前,若本机装有 CLI,校验最新落盘的 Assignment(临时写盘或既有 brief)。模式由迭代 compass frontmatter 的 `enforcement` 键决定(Slice 5):
86
+
87
+ - **默认(compass 无 `enforcement: hard`)— 可选 warn-only**:exit 1 仅提示,不阻断派发(Slice 3 行为不变):
88
+
89
+ ```bash
90
+ command -v mstar-harness >/dev/null 2>&1 && mstar-harness dispatch validate "<latest-assignment-file>"
91
+ ```
92
+
93
+ - **`enforcement: hard`(迭代 compass frontmatter 声明)— fail-fast**:校验失败即 `exit 1` 阻断派发(bin 缺失仍静默跳过):
94
+
95
+ ```bash
96
+ if command -v mstar-harness >/dev/null 2>&1; then mstar-harness dispatch validate "<latest-assignment-file>" || exit 1; fi
97
+ ```
98
+
99
+ > 路径必须加引号且替换为具体文件(如最新 `{SDD_DIR}/task-N-brief.md`,勿留尖括号)——agent 代入的路径不得进入 shell 无引号展开(qc2 W-2)。
100
+
85
101
  **Prepare gate (per plan in compass)**:
86
102
 
87
103
  - [ ] specify / clarify / plan = done on each plan file
@@ -156,6 +156,8 @@ Follow `plan.main.md` template + **plan-quality-bar**. Additional audit-specific
156
156
  - **Planned at**: commit `<short SHA>`, <YYYY-MM-DD>
157
157
  ```
158
158
 
159
+ > **Engine check (when available):** run `mstar audit scaffold <findings-file> [--dir <out-dir>]` (or `import { scaffoldAuditPlan, validateAuditStatusBlocks, redactSecrets } from "@mstar-harness/engine"` in a host hook) to scaffold the `audit-<date>/` plan directory (numbered plan files + README index) from findings, validate the audit Status blocks above, and redact credentials from audit excerpts. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
160
+
159
161
  ## Handoff to execution
160
162
 
161
163
  Audit plans are **input candidates** for the normal Prepare → Execute flow. The audit skill does not execute them.
@@ -153,6 +153,8 @@ Default process artifacts (`plans/`, `iterations/`, `status.json`, `sdd/`, `note
153
153
  2. **Feature worktree (per plan)** — one distinct sibling directory per active `plan_id`, e.g. `<repo-parent>/worktrees/<plan-id>` or team `.worktrees/<plan-id>`; Assignment **`Worktree path`** must match lease `worktree_path`.
154
154
  3. **L2 track worktrees (within-plan)** — additional distinct directories per parallel implement track under the **same** plan (see **`references/parallel-writable-pre-dispatch.md`**), each with its own PM-approved **`Working branch`**.
155
155
 
156
+ > **Engine check (when available):** run `mstar worktree check <plan-id>` (L1) / `mstar worktree check --l2 --tracks <json>` (L2) (or `import { l1PreDispatchCheck, l2PreDispatchCheck, assertControlVsFeaturePath, assertBranchAlignment } from "@mstar-harness/engine"` in a host hook) to verify the L1/L2 isolation rules above (lease worktree ≠ control path; checked-out branch matches `Working branch`). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
157
+
156
158
  ## 同仓并发写入与 Git worktree(强制)
157
159
 
158
160
  **首要场景是开发阶段(L2;迭代多 plan 时另见上文 L1)**:多条可写流 **并发** 改 **同一仓库** 时,用 worktree 做 **写入侧目录隔离**。派发前清单 → **`references/parallel-writable-pre-dispatch.md`**。下列规则针对该类开发并发;**QC / QA 阶段的检出约定**见下一小节。
@@ -187,6 +189,8 @@ Default process artifacts (`plans/`, `iterations/`, `status.json`, `sdd/`, `note
187
189
  - **逐字对齐(强制)**:三份 QC Assignment 与 QA Assignment 间 **`plan_id`** 与 **`Review range` / `Diff basis`**(连同 `Review cwd` / `Working branch`)**必须完全相同**;**`qa-engineer`** 验证同一 feature 时**复用同一组字段**。**热修 / QC 单审**路径也须含**同一组字段**,仅承接方份数为 1。
188
190
  - 三审并行时三名 reviewer **共用同一组**字段(对业务仓**只读 diff 审查**);一般不必为每位 reviewer 各开 worktree,除非宿主/环境要求进程级隔离。
189
191
 
192
+ > **Engine check (when available):** import `assertQcAlignment` / `singleReviewSnapshot` from `@mstar-harness/engine` in a host hook to assert the QC/QA alignment fields above (byte-identical `plan_id` + `Review range` / `Diff basis` across tri + QA; single review snapshot before dispatch). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
193
+
190
194
  ### 多 worktree 并行 → 单一待审快照(派 QC 前置)
191
195
 
192
196
  **语义区分(必须理解)**:开发阶段可存在 **多个** `Worktree path`(每条流一条检出目录);**一轮**正式 QC 三审 + 对齐 QA 只对应 **一套**对齐字段(上文)。**不要**把「多个开发 worktree」误解成「QC 应轮流进多个目录各审一半」。
@@ -58,6 +58,8 @@ This signals intent — the simplicity is deliberate, not an oversight — and g
58
58
  - Do not confuse "minimum" with "temporary." A small implementation must still align with the long-term target state, stable interfaces, and known follow-up plan.
59
59
  - If a workaround is unavoidable, label it `simplify:` / `temporary`, explain why, and record the removal path in the plan/status artifact before claiming the task complete.
60
60
 
61
+ > **Engine check (when available):** run `mstar lint <target>` (or `import { findSimplifyMarkers, findTemporaryMarkers } from "@mstar-harness/engine"` in a host hook) to check the marker convention above — every `simplify:` / `temporary` comment is reported, and `temporary` markers without a recorded plan/status removal path are violations. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
62
+
61
63
  **Simplicity anti-patterns — stop and reconsider when you spot these:**
62
64
 
63
65
  | Anti-pattern | Signal |
@@ -133,6 +135,9 @@ Do not perform agreement. State the technical action, the verification result, o
133
135
  ## Integration Notes
134
136
 
135
137
  - **SDD implementer reports** (`mstar-sdd`): completion evidence must include TDD triple — test file(s), command, output — in `task-N-report.md`; fix rounds add the same for new/changed tests.
138
+
139
+ > **Engine check (when available):** run `mstar lint <task-N-report.md>` (or `import { assertSddTddTriple } from "@mstar-harness/engine"` in a host hook) to assert the TDD triple above — test file(s), runnable command, and output evidence must all be present in the report. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
140
+
136
141
  - This skill must not be used to bypass branch constraints, QC/QA gate definitions, assignment authority, or `Done` ownership rules.
137
142
 
138
143
  ## Anti-Bloat Rule for Prompt Maintenance
@@ -83,6 +83,8 @@ In Cursor, Full mode dispatches subagents via Task tool. PM selects mode.
83
83
  6. **Indexes** — `{KNOWLEDGE_DIR}/README.md` 加行(Document / Source Plan / Description / Status);可选 `status.json` `knowledge_refs`。**iteration-close gate**:每篇新 doc 必须 Phase 6
84
84
  7. **Refresh trigger** — 新知识暗示旧 doc 过时 → 推荐 `/pm compound-refresh <scope>`(不自动跑,仅 flag)
85
85
 
86
+ > **Engine check (when available):** run `mstar compound validate <doc-path> [--knowledge-dir <dir>]` (or `import { validateSchemaYaml, assertIndexRows } from "@mstar-harness/engine"` in a host hook) to validate the frontmatter against `references/schema.yaml` (Phase 3 Write) and assert every doc has its `{KNOWLEDGE_DIR}/README.md` index row (Phase 6 Indexes). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
87
+
86
88
  ## Support files
87
89
 
88
90
  读 `references/compound-workflow.md`(Q1–Q8 + Phase 1–7)、`references/schema.yaml`(frontmatter)、`references/category-mapping.md`(track/path 映射)、`references/concepts-vocabulary.md`(CONCEPTS.md 规则)、`assets/resolution-template.md`(track 正文结构)。
@@ -17,6 +17,8 @@ Knowledge documents in `{KNOWLEDGE_DIR}` age. Code changes, conventions evolve,
17
17
 
18
18
  **SSOT**: `mstar-plan-conventions/references/artifact-storage-paths.md`。本 skill 仅操作 `{HARNESS_DIR}/knowledge/**/*.md` + `{HARNESS_DIR}/knowledge/README.md` + `<repo-root>/CONCEPTS.md` + `{HARNESS_DIR}/status.json`(引用更新)。**禁止**操作 `docs/`、`{PLAN_DIR}/`、`{ITERATION_DIR}/`、`{SPECS_DIR}/`。
19
19
 
20
+ > **Engine check (when available):** run `mstar compound validate <doc-path> --knowledge-dir <dir>` (or `import { scopeGuard, compoundRefreshScope } from "@mstar-harness/engine"` in a host hook) to resolve the allowed scope above (`{HARNESS_DIR}/knowledge/**`, `knowledge/README.md`, `<repo-root>/CONCEPTS.md`, `{HARNESS_DIR}/status.json`) and guard every write against it. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
21
+
20
22
  ## When to use
21
23
 
22
24
  | Trigger | Example |
@@ -129,6 +129,8 @@ gray-1000: #000 gray-1000: #eee
129
129
  - Token names are the **SSOT interface** — consumers reference tokens by name, not raw values
130
130
  - `references/design-md-spec.md` § Light/Dark rules defines the contract
131
131
 
132
+ > **Engine check (when available):** run `mstar design-md validate <dir>` (or `import { validateDesignTokenFrontmatter, assertLightDarkParity, completenessLevel } from "@mstar-harness/engine"` in a host hook) to validate the token frontmatter schema above, the light/dark parity of `DESIGN.dark.md` (same token names, different values), and the achieved completeness level. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
133
+
132
134
  ## References
133
135
 
134
136
  - `references/design-md-spec.md` — normative spec: section definitions, token naming conventions, light/dark contract
@@ -148,16 +148,19 @@ typography:
148
148
  # fontSize: 24px
149
149
  # fontWeight: 400
150
150
  # lineHeight: 36px
151
+ # letterSpacing: 0
151
152
  # copy-20:
152
153
  # fontFamily: "[font-family]"
153
154
  # fontSize: 20px
154
155
  # fontWeight: 400
155
156
  # lineHeight: 36px
157
+ # letterSpacing: 0
156
158
  # copy-14:
157
159
  # fontFamily: "[font-family]"
158
160
  # fontSize: 14px
159
161
  # fontWeight: 400
160
162
  # lineHeight: 20px
163
+ # letterSpacing: 0
161
164
 
162
165
  # ── Headings ──
163
166
  # Level 1 — at minimum one heading token (REQUIRED)
@@ -200,11 +203,13 @@ typography:
200
203
  # fontSize: 14px
201
204
  # fontWeight: 400
202
205
  # lineHeight: 20px
206
+ # letterSpacing: 0
203
207
  # button-14:
204
208
  # fontFamily: "[font-family]"
205
209
  # fontSize: 14px
206
210
  # fontWeight: 500
207
211
  # lineHeight: 20px
212
+ # letterSpacing: 0
208
213
 
209
214
  spacing:
210
215
  base: 4px
@@ -153,16 +153,19 @@ typography:
153
153
  # fontSize: 24px
154
154
  # fontWeight: 400
155
155
  # lineHeight: 36px
156
+ # letterSpacing: 0
156
157
  # copy-20:
157
158
  # fontFamily: "[font-family]"
158
159
  # fontSize: 20px
159
160
  # fontWeight: 400
160
161
  # lineHeight: 36px
162
+ # letterSpacing: 0
161
163
  # copy-14:
162
164
  # fontFamily: "[font-family]"
163
165
  # fontSize: 14px
164
166
  # fontWeight: 400
165
167
  # lineHeight: 20px
168
+ # letterSpacing: 0
166
169
 
167
170
  # ── Headings ──
168
171
  # Level 1 — at minimum one heading token (REQUIRED)
@@ -205,6 +208,7 @@ typography:
205
208
  # fontSize: 14px
206
209
  # fontWeight: 400
207
210
  # lineHeight: 20px
211
+ # letterSpacing: 0
208
212
 
209
213
  # LEVEL2_PLACEHOLDER: button typography — uncomment and fill
210
214
  # button-14:
@@ -212,6 +216,7 @@ typography:
212
216
  # fontSize: 14px
213
217
  # fontWeight: 500
214
218
  # lineHeight: 20px
219
+ # letterSpacing: 0
215
220
 
216
221
  spacing:
217
222
  base: 4px
@@ -66,6 +66,8 @@ description: Morning Star 派发与委派门禁 —— 仅 PM 可增派 subagent
66
66
 
67
67
  在支持具名角色 / Task 的宿主上,`## Assignment` **正文不会**拉起子会话。PM 须在**同一条 assistant 消息**(或宿主等价机制)发出与 Assignment **条数一致**的 invoke / Task;仅打印 Markdown = **分派未完成**。**几条 Assignment ⇒ 几次 tool 调用**(默认同消息并行)。
68
68
 
69
+ > **Engine check (when available):** run `mstar dispatch validate <assignment-file> [--branch <branch>]` (or `import { validateAssignmentFields, assertDefaultBranchProtected } from "@mstar-harness/engine"` in a host hook) to validate the Assignment field contract and the default-branch gate (normative default-branch prose: **`mstar-branch-worktree`** SKILL.md § "Git 功能分支门禁(业务仓库)" — this skill covers dispatch mechanics only). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
70
+
69
71
  ## SDD implement 波次(PM only)
70
72
 
71
73
  When **`Execution mode: sdd`** (`mstar-sdd`):
@@ -76,6 +78,8 @@ When **`Execution mode: sdd`** (`mstar-sdd`):
76
78
  - Record per-task BASE SHA; use `review-package` for diffs — **never `HEAD~1`**.
77
79
  - After all tasks: branch `review-package` in `{SDD_DIR}/review/` → **mandatory tri-review N=3** when `Execution mode: sdd`; **N=1** only for `inline` / explicit single override.
78
80
 
81
+ > **Engine check (when available):** run `mstar review seats <assignment-file> [--mode sdd|inline|targeted] [--reviewers <role1,role2,...>]` (or `import { executionModeToN, assertTriIdentity } from "@mstar-harness/engine"` in a host hook) to map `Execution mode` to its QC seat count N and assert tri identity for the QC tri above. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
82
+
79
83
  ## 并行规则(摘要)
80
84
 
81
85
  **两条独立门禁(均须满足,不可互相替代)**:
@@ -93,6 +97,8 @@ When **`Execution mode: sdd`** (`mstar-sdd`):
93
97
  - **Plan QC tri** after SDD task loop(`Execution mode: sdd`);**单席**仅 `inline` / hotfix。共用 `Review cwd` / `Working branch` / `plan_id` / `Review range`(**`mstar-branch-worktree`**)。
94
98
  - **Tri 同消息规则**:plan QC tri(SDD 或 Assignment 显式 `QC mode: full tri-review`)时三席 **同一条消息**、**同一套** scope 字段。
95
99
 
100
+ > **Engine check (when available):** run `mstar worktree check <plan-id>` (L1) / `mstar worktree check --l2 --tracks <json>` (L2) (or `import { l1PreDispatchCheck, l2PreDispatchCheck } from "@mstar-harness/engine"` in a host hook) to verify the 同仓写隔离 gate above (per-track feature worktree, branch alignment) before parallel dispatch. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
101
+
96
102
  ## Specialist review-and-edit dispatch
97
103
 
98
104
  当 PM 派发**文档编辑类**专业角色(如 product-manager、architect、writing-specialist)直接修订 harness 产物时:
@@ -37,6 +37,8 @@ Detect from **session tool shapes and available commands** — not from plugin m
37
37
 
38
38
  Order matters: check `cursor` → `opencode` → `omp` → `kimi` → `zcode` → `codex`. `subagent_type` (Cursor) vs `subagent` (OpenCode) vs `agent`/`tasks[]` (omp) is the sharpest split among the Task-based hosts.
39
39
 
40
+ > **Engine check (when available):** run `mstar host detect --signals <comma-list>` (or `import { detectHost } from "@mstar-harness/engine"` in a host hook) to resolve the detection table above from session tool shapes (prints the host id, or `ambiguous` to fall back on the table + judgment). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
41
+
40
42
  ## Parallel dispatch (invoke-capable hosts)
41
43
 
42
44
  When PM dispatches **N >= 2** concurrent assignees (QC tri-review, dual-track implement, etc.) and the host exposes actual invoke / Task / subagent tools, read **`references/parallel-dispatch.md`** in the dispatch round (shared with `mstar-dispatch-gates`). Without a callable invoke tool when dispatch is required → **`Blocked`**; Assignment Markdown alone is not dispatch.
@@ -55,6 +57,8 @@ Docs name assets as skill **`<name>`** → `scripts/…` / `references/…`. **R
55
57
 
56
58
  Authoring convention: **`mstar-skill-authoring`** § Skill-relative script and asset paths. Per-host URI / mount detail: `references/<host>.md`.
57
59
 
60
+ > **Engine check (when available):** import `resolveSkillRoot` from `@mstar-harness/engine` in a host hook to resolve the loaded skill root per the table above (no CLI form yet). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
61
+
58
62
  ## Conflict order
59
63
 
60
64
  1. User explicit instructions (this turn)
@@ -45,6 +45,8 @@ Phase 5: PR merge-ready loop —— 至 mergeable + CI 全绿 + reviews resolved
45
45
  | **→ 迭代交付完成** | §5.5 exit checklist 全 `[x]` | PR mergeable;required CI 全绿;reviews resolved | Phase 4 开 PR 即宣称完成 |
46
46
  | **iteration-start → integration branch** | §1.6 Review & Edit chain | 三角色按序 invoke;**specs** 为主产出;**禁止** start 链向 `{KNOWLEDGE_DIR}/` 新增;writing-specialist corpus hygiene + compass `status: locked` | PM 代做专业编辑;并行三角色;product/architect 写 knowledge;临时笔记进 specs |
47
47
 
48
+ > **Engine check (when available):** run `mstar iteration gate --status <status.json> --compass <delivery-compass.md>` (or `import { evaluatePhaseGate } from "@mstar-harness/engine"` in a host hook) to evaluate the transition gate above. On `fail` (gate-blocking violations) -> do not proceed; fix and re-run. Note: during the Phase-3 window (`transition: phase-3-close`) the gate exits 1 until the §3.4 close items (`status: completed` + `end_date`) are written — that exit-1 is the expected "close work pending" signal (the exit checklist gates Phase 4, not the Phase-3 entry; qc2 F-003), so proceed with Phase 3 per the table below. Skill text below remains authoritative when the runtime is absent.
49
+
48
50
  **误判信号**:对话里出现 compound 摘要、roadmap 更新、或「所有 plan 已完成」但 **未** 打印 §3.1 / §3.5 checklist → 视为 **Phase 3 未执行**,回到 §3.0。
49
51
 
50
52
  **per-plan 状态 SSOT**:`{HARNESS_DIR}/status.json`(per-plan Todo/InProgress/InReview/Done)。
@@ -156,6 +158,8 @@ plans: []
156
158
  | target_branch | <PR target> |
157
159
  ```
158
160
 
161
+ > **Engine check (when available):** import `validateCompassFrontmatter` from `@mstar-harness/engine` in a host hook to validate the compass frontmatter above (no CLI form yet). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
162
+
159
163
  ### 1.4 更新索引
160
164
 
161
165
  在 `{ITERATION_DIR}/README.md` 中添加**一行**(首次创建时建立表头;**一行 = 一次迭代**,不拆 compass/workspace 双行):
@@ -164,6 +168,8 @@ plans: []
164
168
  |-----------|------|-------------|--------|
165
169
  | `<iteration-id>` | [`<iteration-id>/`](<iteration-id>/) | `<简短描述>` | `active` |
166
170
 
171
+ > **Engine check (when available):** import `assertIndexRowObligations` from `@mstar-harness/engine` in a host hook to assert the index-row obligations above (no CLI form yet). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
172
+
167
173
  ### 1.5 登记到 status.json(formal iteration 必填)
168
174
 
169
175
  iteration 正式全流程**必须**写入 `{HARNESS_DIR}/status.json`:
@@ -220,6 +226,8 @@ Phase 1 与 §1.6 须遵守 **`references/iteration-artifact-boundaries.md`**(
220
226
  4. **Branch metadata gate**:root `metadata.iteration_base_branch`、`metadata.target_branch` 已登记,且至少一条 active plan 有 `metadata.spec_integration_branch`(或可从 compass 同轮 backfill)。**缺失 → STOP**,不得用 `main`/`master` 补位。
221
227
  5. **Control-worktree + lease defaults**(iteration 命令;可被 `Worktree mode: waived` 豁免):除非本轮 Assignment 显式 `Worktree mode: waived`(或等价用户指令),Phase 2 **必须**在入口建立 control worktree、经 control 路径读写默认 gitignored 的 harness 进程产物(`status.json`、`{PLAN_DIR}`、`{ITERATION_DIR}`、`{SDD_DIR}` 等),并在可写派发前 claim `plans[].execution_lease` / `integration_merge_lease`。可写 Assignment 须含绝对 feature **`Worktree path`** + 绝对 control 系 **`Plan Path`** / **`SDD dir`**(见 **`mstar-branch-worktree`**「Harness path SSOT under default gitignore」)。**禁止**因 feature worktree 在默认 gitignore 下看不到 plans 而推断 `Worktree mode: waived`。`Plan parallelism: serial` **不** waive 本闸——仅强制跨 plan **implement** 串行调度;control worktree + lease 仍须满足。**跨 plan 并行安全闸**(**不可**被 `Worktree mode: waived` 豁免):跨 plan **并行可写 implement** 须满足下列之一——(a) coordination 路径(control 或 waived 时主 checkout `{HARNESS_DIR}/status.json`)上 **same-host 独占写锁可用且每次 status/协调变更持锁**;(b) 默认 **`Plan parallelism: serial`**(**waived 时尤其优先默认串行**;**无 flock / 无共享锁时只触发本条,不豁免 worktree**);(c) 用户本轮显式 `Cross-host lease race: accepted`(或等价)+ `plans[].notes` 审计。**禁止**将 `Worktree mode: waived` 当作跨主机无锁并行的授权。细则 → **`references/phase-2-worktree-lease.md`**。
222
228
 
229
+ > **Engine check (when available):** run `mstar lease verify <plan-id>` (or `import { validateExecutionLease } from "@mstar-harness/engine"` in a host hook — `validateIntegrationMergeLease` is import-only; no CLI form yet). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
230
+
223
231
  任一 false → **stop**。Phase 1 / Prepare 未完成 → 先完成 Phase 1 或 per-plan Prepare,再进入本 Phase。
224
232
 
225
233
  ### 2.1 Session todos(派发前设护栏)
@@ -288,10 +296,10 @@ SSOT = `{HARNESS_DIR}/status.json` + `{PLAN_DIR}/`。todos 只追踪本轮下一
288
296
  3. **Implement → InReview**(`§ 2.5`;产品编辑在 feature worktree;plans / status / iterations / SDD 经 control 绝对路径):
289
297
  - **默认 `Execution mode: sdd`**(多 task plan;hotfix 可 `inline`)。
290
298
  - PM 载入 **`mstar-sdd`** 后,按 plan task 顺序 **串行** per-task 循环(**不是**一次派发 dev 做全部 tasks):
291
- 1. skill **`mstar-sdd`** → `scripts/sdd-workspace <plan-id>` → `{SDD_DIR}`
292
- 2. `scripts/task-brief <plan-file> N` → `{SDD_DIR}/task-N-brief.md`;记录 `BASE_SHA`
299
+ 1. `mstar sdd workspace <plan-id>` → `{SDD_DIR}`
300
+ 2. `mstar sdd task-brief <plan-file> N` → `{SDD_DIR}/task-N-brief.md`;记录 `BASE_SHA`
293
301
  3. Dispatch **one** implementer subagent(`references/implementer-prompt.md`:brief 路径 + report 路径 + `Model tier`;**禁止**贴整份 plan)
294
- 4. Implementer `DONE` → `scripts/review-package BASE HEAD` → task diff 文件
302
+ 4. Implementer `DONE` → `mstar sdd review-package BASE HEAD` → task diff 文件
295
303
  5. Dispatch **one** task reviewer subagent(brief + report + diff + Global Constraints)
296
304
  6. Fix loop 直至 review clean;append `{SDD_DIR}/progress.md`;更新 `status.json` / plan checkbox
297
305
  7. Next task
@@ -320,7 +328,7 @@ SSOT = `{HARNESS_DIR}/status.json` + `{PLAN_DIR}/`。todos 只追踪本轮下一
320
328
  | 文件交接 | brief / report / diff / `progress.md` 在 `{SDD_DIR}`;dispatch prompt **只给路径**,不贴 plan 全文或 task 历史 |
321
329
  | Assignment 字段 | 每个 implement dispatch 须含 `Execution mode: sdd`、`SDD dir`、`Model tier`;§2.0 #5 未 waive 时还须含绝对 `Worktree path` + verified `execution_lease`;**禁止**省略 `Model tier` |
322
330
  | 大包 inline | **禁止**把 T1–Tn 或整份 plan 写进 **一个** `fullstack-dev` leaf Assignment 冒充 SDD |
323
- | 分支 diff | 全部 task 完成后 skill **`mstar-sdd`** → `scripts/review-package MERGE_BASE HEAD` → `{SDD_DIR}/review/` branch diff → plan QC tri(N=3) |
331
+ | 分支 diff | 全部 task 完成后 `mstar sdd review-package MERGE_BASE HEAD` → `{SDD_DIR}/review/` branch diff → plan QC tri(N=3) |
324
332
 
325
333
  Iteration Phase 2 附加:
326
334
 
@@ -47,6 +47,8 @@
47
47
 
48
48
  **顺序记忆**:`observe findings → fix locally early → wait until CI + review wave idle → push batch → wait new wave → repeat`。
49
49
 
50
+ > **Engine check (when available):** run `mstar iteration push-cadence [--ci-running] [--review-wave]` (or `import { pushCadenceProbe } from "@mstar-harness/engine"` in a host hook) to probe the push gate above. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
51
+
50
52
  ### 5.1 Loop(repeat until §5.5 exit)
51
53
 
52
54
  1. **Status** — PR mergeable?required CI?unresolved review threads?**任一 CI/AI review 是否仍在跑?**
@@ -74,6 +74,8 @@ per-plan 门禁通过后,PM 在**迭代层面**管理以下活动(不计入
74
74
 
75
75
  per-plan Done 是 per-plan 的闭环终点;compound 是迭代级收口活动,不影响 per-plan 状态判定。
76
76
 
77
+ > **Engine check (when available):** run `mstar iteration gate --status <status.json> --compass <delivery-compass.md>` (or `import { evaluatePhaseGate } from "@mstar-harness/engine"` in a host hook) to evaluate the iteration phase-transition gate (Phase 2 → 3 → 4) when iteration-level activities above are reached — per-plan Prepare/Execute gate judgment stays prompt. On `fail` (gate-blocking violations) -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
78
+
77
79
  ## Plan 目录与审查证据(启用 `{PLAN_DIR}` 时)
78
80
 
79
81
  - 进入 `InReview` 后,QC/QA 原始过程报告默认落入 `{SDD_DIR}/review/`(**SDD 默认 tri** `qc1`…`qc-consolidated`;**inline** 单席 `qc.md`)。**fix 后默认 targeted re-review**。SDD per-task review 在 implement 波次内完成(`mstar-sdd` task reviewer)。PM 将 durable gate summary 回写主 plan / `status.json`,而不是把 raw reports 作为默认 git 产物。
@@ -17,7 +17,7 @@ description: "Morning Star plan harness artifacts — `{PLAN_DIR}` main plans an
17
17
  | Done row compaction Profile A/B | `references/done-compaction.md` |
18
18
  | `status.json`, residual severity, lifecycle, `jq` | `references/status-and-residuals.md` |
19
19
  | Empty-repo `status.json` / `notes.json` / Profile B `plans-done.json` templates | `templates/status.empty.json`, `templates/notes.empty.json`, `templates/plans-done.empty.json` (`templates/README.md`) |
20
- | Tech-debt rollup (read-only) | `scripts/tech-debt-rollup.sh` |
20
+ | Tech-debt rollup (read-only) | engine `techDebtRollup` import (no CLI form; see `references/status-and-residuals.md`) |
21
21
 
22
22
  **Out of scope:** branch and QC/QA checkout alignment → **`mstar-branch-worktree`**; leaf QC checklist and verdict → **`mstar-roles/references/qc-specialist/`**; PM QC orchestration → **`mstar-review-qc`**; `{HARNESS_DIR}` discovery and init → **`mstar-plan-conventions`**.
23
23
 
@@ -25,11 +25,22 @@ description: "Morning Star plan harness artifacts — `{PLAN_DIR}` main plans an
25
25
 
26
26
  - **`{HARNESS_DIR}/status.json`**: `plans[]` row status + root **`residual_findings[<plan-id>]`** (open list **SSOT**).
27
27
  - **Canonical**: register new findings only at root `residual_findings`; **`metadata.residual_findings`** is legacy read-only — **do not** dual-write.
28
+
29
+ > **Engine check (when available):** run `mstar status validate <path>` (or `import { validateStatus } from "@mstar-harness/engine"` in a host hook). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
30
+
28
31
  - **Lifecycle**: open → verified close → **`archived/residuals/<plan-id>.json`**; machine **`severity`** enum in reference.
32
+
33
+ > **Engine check (when available):** run `mstar status archive-residuals <plan-id>` (or `import { archiveResiduals } from "@mstar-harness/engine"` in a host hook). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
34
+
29
35
  - **Findings cleanup**: Assignment **`Findings cleanup: zero-residual | allow-residual`** (+ optional `metadata.findings_cleanup`); iteration Phase 2 defaults to **`zero-residual`** → **`references/status-and-residuals.md`** (“Findings cleanup modes”).
30
- - **`notes.json`**, optional **`tech_debt_summary`** (rollup view; compute via **`scripts/tech-debt-rollup.sh`**).
36
+
37
+ > **Engine check (when available):** import `findingsCleanupGate` from `@mstar-harness/engine` in a host hook to enforce the cleanup mode above. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
38
+
39
+ - **`notes.json`**, optional **`tech_debt_summary`** (rollup view; compute via engine `techDebtRollup` — **`references/status-and-residuals.md`**).
31
40
  - **Iteration Phase 2 leases** (`metadata.control_worktree_path`, `plans[].execution_lease`, `metadata.integration_merge_lease`): claim-before-`InProgress`, resume vs steal, orphan recovery → **`references/status-and-residuals.md`** (“Iteration execution leases”).
32
41
 
42
+ > **Engine check (when available):** run `mstar lease verify <plan-id>` (or `import { validateExecutionLease } from "@mstar-harness/engine"` in a host hook — `validateIntegrationMergeLease` is import-only; no CLI form yet). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
43
+
33
44
  Field semantics, severity mapping, findings cleanup modes, archive flow, and `jq` examples → **`references/status-and-residuals.md`**.
34
45
 
35
46
  **Templates (this skill):** `templates/status.empty.json`, `templates/notes.empty.json` — copy into `{HARNESS_DIR}/` (`templates/README.md`).
@@ -90,7 +90,7 @@ ALL must hold — commands and expected results, not prose:
90
90
  | Plan source | Applies |
91
91
  |-------------|---------|
92
92
  | PM/architect Prepare | Full bar before `plan(locked)` |
93
- | SDD task-brief (extracted from plan) | Inherits from plan; task-brief script carries excerpts forward |
93
+ | SDD task-brief (extracted from plan) | Inherits from plan; `mstar sdd task-brief` carries excerpts forward |
94
94
  | Audit-generated plan (`mstar-audit`) | Full bar — audit plans are the most context-isolated |
95
95
  | Hotfix (`inline`) | Relaxed — see `mstar-phase-gates` hotfix exception |
96
96
 
@@ -213,7 +213,7 @@ Legacy string `plans[].notes` is OK; new repos should use arrays with time + eve
213
213
  | `target_branch` | string | Final PR target after iteration-close; required for formal iterations |
214
214
  | `notes` | array | **Legacy** — prefer **`{HARNESS_DIR}/notes.json`** |
215
215
  | `residual_findings_history` | object | **Legacy** — prefer **`archived/residuals/<plan-id>.json`** |
216
- | `tech_debt_summary` | object | Optional rollup over open R#; maintain via script (below) |
216
+ | `tech_debt_summary` | object | Optional rollup over open R#; maintain via engine rollup (below) |
217
217
  | `control_worktree_path` | absolute path string | Iteration Phase 2: canonical **repository root** (not `{HARNESS_DIR}`) checked out to active `spec_integration_branch`; coordination + serial merge cwd |
218
218
  | `integration_merge_lease` | object | While one integration merge is owned; **absent** = unclaimed. Writers **delete** the key on release — never write `null` or tombstone objects |
219
219
 
@@ -453,7 +453,7 @@ Archive file shape (append to `entries`):
453
453
 
454
454
  - Each archived entry needs **`archived_at`** (`YYYY-MM-DD`).
455
455
  - Closed records live in archive + durable plan summaries; raw review bundles are ephemeral and not part of the long-term open list.
456
- - After batch archive/close, **refresh `tech_debt_summary`** (script below).
456
+ - After batch archive/close, **refresh `tech_debt_summary`** (engine rollup below).
457
457
 
458
458
  ### Short in-place close (transition only)
459
459
 
@@ -475,8 +475,7 @@ Prefer **`archived/residuals/`**; migrate and delete history key when possible.
475
475
  # Replace .mstar with your resolved {HARNESS_DIR}; legacy projects may use .agents.
476
476
  jq '.residual_findings["01-data-infrastructure"] // .metadata.residual_findings["01-data-infrastructure"]' .mstar/status.json
477
477
  jq '.entries[] | select(.id == "R1")' .mstar/archived/residuals/01-data-infrastructure.json
478
- # skill mstar-plan-artifacts scripts/tech-debt-rollup.sh (not a consumer cwd path)
479
- bash <mstar-plan-artifacts>/scripts/tech-debt-rollup.sh .mstar/status.json
478
+ # Engine rollup (read-only, no CLI form): import { techDebtRollup } from "@mstar-harness/engine" in a host hook
480
479
  ```
481
480
 
482
481
  (`//` right-hand side = legacy read path.)
@@ -506,21 +505,21 @@ Append-only log for merge closure, batch archive, `tech_debt_summary` refresh, e
506
505
 
507
506
  **Role:** Cross-plan aggregate over **open** R# in root **`residual_findings`** (and legacy read path if present). Does **not** replace per-entry SSOT.
508
507
 
509
- **Compute (canonical):** run the read-only script (do **not** hand-count):
508
+ **Compute (canonical):** engine import (do **not** hand-count):
510
509
 
511
- ```bash
512
- # Resolve from skill mstar-plan-artifacts scripts/tech-debt-rollup.sh
513
- # Pass path to status.json if not .mstar/status.json
514
- bash <mstar-plan-artifacts>/scripts/tech-debt-rollup.sh .mstar/status.json
510
+ ```ts
511
+ // Engine check (when available) pass status.json path if not .mstar/status.json
512
+ import { techDebtRollup } from "@mstar-harness/engine";
513
+ const rollup = techDebtRollup(".mstar/status.json"); // { computed, stored, checks, overall }
515
514
  ```
516
515
 
517
516
  - Prints computed `total_open`, `by_severity`, `by_target`, `by_plan`.
518
517
  - Prints **PASS** / **DRIFT** vs stored `metadata.tech_debt_summary`.
519
- - Script **does not write** `status.json` — PM copies computed values into `metadata.tech_debt_summary` after DRIFT or milestone refresh.
518
+ - The engine call **does not write** `status.json` — PM copies computed values into `metadata.tech_debt_summary` after DRIFT or milestone refresh.
520
519
 
521
520
  **When to refresh:** after QC waves, batch archive of resolved items, or release freeze. Optional `notes.json` entry: “refreshed tech_debt_summary”.
522
521
 
523
- **Recommended stored shape** (`cross_cutting` optional; script does not compute `cross_cutting` — maintain manually if used):
522
+ **Recommended stored shape** (`cross_cutting` optional; engine does not compute `cross_cutting` — maintain manually if used):
524
523
 
525
524
  ```json
526
525
  {
@@ -549,11 +548,11 @@ bash <mstar-plan-artifacts>/scripts/tech-debt-rollup.sh .mstar/status.json
549
548
 
550
549
  ## Pre-merge: `status.json` should match reality
551
550
 
552
- Before merge/PR, **`@project-manager`** (or delegate) should verify: `plans[].status`, `metadata.gates`, root **`residual_findings`** (no accidental dual-write), **`tech_debt_summary`** (if used — run script), **`notes.json`** (if used), vs review/CI.
551
+ Before merge/PR, **`@project-manager`** (or delegate) should verify: `plans[].status`, `metadata.gates`, root **`residual_findings`** (no accidental dual-write), **`tech_debt_summary`** (if used — run engine rollup), **`notes.json`** (if used), vs review/CI.
553
552
 
554
553
  **Common gaps:**
555
554
 
556
- - R# added/closed but **`tech_debt_summary` not refreshed** (script shows DRIFT).
555
+ - R# added/closed but **`tech_debt_summary` not refreshed** (engine rollup shows DRIFT).
557
556
  - Finding only in **`plans[].notes`** or chat, not in **`residual_findings[<plan-id>]`**.
558
557
  - Major milestone with no **`notes.json`** entry when team uses program timeline.
559
558
 
@@ -1,6 +1,6 @@
1
1
  # Plan harness file templates
2
2
 
3
- Copy these into `{HARNESS_DIR}` when bootstrapping a project. Path symbols (`{HARNESS_DIR}`, `{PLAN_DIR}`, …) → **`mstar-plan-conventions`**. Field semantics and residual lifecycle → **`mstar-plan-artifacts/references/status-and-residuals.md`**. Optional rollup: **`../scripts/tech-debt-rollup.sh`** (read-only; see that reference).
3
+ Copy these into `{HARNESS_DIR}` when bootstrapping a project. Path symbols (`{HARNESS_DIR}`, `{PLAN_DIR}`, …) → **`mstar-plan-conventions`**. Field semantics and residual lifecycle → **`mstar-plan-artifacts/references/status-and-residuals.md`**. Optional rollup: engine `techDebtRollup` import (read-only; see that reference).
4
4
 
5
5
  | File | Copy to | Notes |
6
6
  |------|---------|--------|
@@ -25,6 +25,8 @@ description: Morning Star (启明星) harness 计划目录约定 —— `{HARNES
25
25
  | `{KNOWLEDGE_DIR}` | `{HARNESS_DIR}/knowledge/` |
26
26
  | `{SPECS_DIR}` | `{HARNESS_DIR}/specs/`(默认);解析见下文「`{SPECS_DIR}` 解析」 |
27
27
 
28
+ > **Engine check (when available):** import `resolveHarnessDir` / `resolvePlanDir` / `resolveSddDir` / `resolveIterationDir` / `resolveSpecsDir` from `@mstar-harness/engine` in a host hook — or run `mstar path resolve [path]` (`--json` for machine output) to print the resolved dirs — to confirm the resolution below. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
29
+
28
30
  ### `{HARNESS_DIR}` 解析顺序(找到即停)
29
31
 
30
32
  1. `.mstar/` → `{HARNESS_DIR}=.mstar/`, `{PLAN_DIR}=.mstar/plans/`
@@ -46,6 +48,8 @@ description: Morning Star (启明星) harness 计划目录约定 —— `{HARNES
46
48
 
47
49
  **Legacy(仅兼容读)**:若以上皆无内容,但 `{HARNESS_DIR}/designs/` 或仓库根 `designs/` **非空**,可作 `{SPECS_DIR}` 使用;init 时**不**新建 `designs/`。
48
50
 
51
+ > **Engine check (when available):** import `resolveSpecsDir` from `@mstar-harness/engine` in a host hook — or run `mstar path resolve` (prints the resolved specs dir) — to confirm the candidate order (empty-dir-as-absent included). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
52
+
49
53
  可选项目选择:部分 spoke 仓库另跟踪 `{HARNESS_DIR}/roadmap.md` — **非**默认 tracked;仅在项目 opt-in 时提及。
50
54
 
51
55
  ## 内容边界(摘要)
@@ -65,7 +69,7 @@ description: Morning Star (启明星) harness 计划目录约定 —— `{HARNES
65
69
  PM 在需要持久化追踪时:
66
70
 
67
71
  1. 建 `.mstar/`、`plans/`、`status.json`(空模板见 **`mstar-plan-artifacts/templates/status.empty.json`**)
68
- 2. 可选 `notes.json`(模板 **`mstar-plan-artifacts/templates/notes.empty.json`**)、`knowledge/`、`iterations/`、`{HARNESS_DIR}/specs/`、`sdd/`(空目录占位;运行时 per-plan 子目录由 skill **`mstar-sdd`** → `scripts/sdd-workspace` 创建)
72
+ 2. 可选 `notes.json`(模板 **`mstar-plan-artifacts/templates/notes.empty.json`**)、`knowledge/`、`iterations/`、`{HARNESS_DIR}/specs/`、`sdd/`(空目录占位;运行时 per-plan 子目录由 **`mstar-sdd`** → `mstar sdd workspace <plan-id>` 创建)
69
73
  3. 项目根 `.gitignore` 追加 Morning Star **进程产物**忽略集(见下文「Git 跟踪策略」)— CLI `init` 可自动添加
70
74
  4. Git:**进程本地、结果共享** — 默认跟踪 `{HARNESS_DIR}/AGENTS.md`、`{KNOWLEDGE_DIR}/**`、`{SPECS_DIR}/**`;`plans/`、`iterations/`、`status.json` 等为**本地会话 SSOT**,默认 gitignored。跨 clone 持久 handoff = knowledge + specs + `{HARNESS_DIR}/AGENTS.md`(及根 `CONCEPTS.md` / `STRATEGY.md` 若使用);须跨 clone 的 residual 须提升(compound)或写入 tracked results — **勿**默认 `git add` `status.json` / `plans/`。
71
75
 
@@ -122,6 +126,8 @@ Legacy `.agents/` 等价:
122
126
  # Tracked (results): .agents/AGENTS.md, .agents/knowledge/, .agents/specs/
123
127
  ```
124
128
 
129
+ > **Engine check (when available):** import `emitGitignoreSnippet` / `validateGitignore` from `@mstar-harness/engine` in a host hook to emit or validate the canonical snippet above. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
130
+
125
131
  ## Spec 驱动的分支模型(多 Plan · 同一 Spec)
126
132
 
127
133
  - **Iteration base branch**:创建 Spec/iteration 集成分支的祖先分支或 ref;必须显式记录,不能默认 `main` / `master`。
@@ -137,6 +143,8 @@ Legacy `.agents/` 等价:
137
143
 
138
144
  Plans are written to **`{PLAN_DIR}`** when persistent plan tracking is enabled. Do not introduce external default plan directories.
139
145
 
146
+ > **Engine check (when available):** import `assertPlanWritingPath` from `@mstar-harness/engine` in a host hook to enforce the gate above. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
147
+
140
148
  ## 状态与权限(摘要)
141
149
 
142
150
  `Todo` | `InProgress` | `InReview` | `Blocked` | `Done` — **`Done` 仅 PM 或 QA**。字段与 residual → **`mstar-plan-artifacts`**。主 plan checkbox → **`mstar-plan-artifacts`**。
@@ -14,7 +14,7 @@
14
14
 
15
15
  1. 创建 `{HARNESS_DIR}`(推荐 `.mstar/`)与 `{PLAN_DIR}`(推荐 `.mstar/plans/`)。
16
16
  2. 初始化 `status.json`:从 **`mstar-plan-artifacts/templates/status.empty.json`** 复制;residual canonical 见 **`mstar-plan-artifacts` SKILL.md**;字段与生命周期见 **`mstar-plan-artifacts/references/status-and-residuals.md`**。
17
- 3. 初始化可选 `notes.json`(**`mstar-plan-artifacts/templates/notes.empty.json`**);`sdd/` 空目录占位(per-plan 子目录由 skill **`mstar-sdd`** → `scripts/sdd-workspace` 创建)。
17
+ 3. 初始化可选 `notes.json`(**`mstar-plan-artifacts/templates/notes.empty.json`**);`sdd/` 空目录占位(per-plan 子目录由 **`mstar-sdd`** → `mstar sdd workspace <plan-id>` 创建)。
18
18
  4. 项目根 `.gitignore` 追加 Morning Star **进程产物**忽略集(canonical snippet → `mstar-plan-conventions` SKILL.md「Git 跟踪策略」;legacy `.agents/` 有等价表)。
19
19
  5. **Profile B**(统一 Done 压缩)时另建 `{HARNESS_DIR}/archived/plans/` 与 `archived/plans-done.json`(自 **`mstar-plan-artifacts/templates/plans-done.empty.json`** 复制;schema 仅 `{ "plans": [] }`,见 **`mstar-plan-artifacts/references/done-compaction.md`**)。
20
20
  6. 可选:创建 `{ITERATION_DIR}`(`iterations/` + `README.md`)与 `{KNOWLEDGE_DIR}`(`knowledge/` + `README.md`);`{HARNESS_DIR}/specs/`(解析后的 `{SPECS_DIR}` 默认落点);内容边界见 `mstar-plan-conventions` SKILL.md 与 `references/knowledge-and-designs.md`。
@@ -24,6 +24,8 @@ description: "Morning Star QC orchestration — **SDD mandatory plan QC tri-revi
24
24
  - **After `Request Changes` (default)**:**Targeted re-review** — PM dispatches only seats that **raised** blocking findings; each updates **the same** `{SDD_DIR}/review/qcN.md` (`## Revalidation`, update verdict). **Do not** spawn `qcN-rev2.md` for targeted re-review. Naming → **`mstar-plan-artifacts/references/plan-files-and-reports.md`** § QC 三审触发时机.
25
25
  - **Full tri re-review (exception)**:Assignment **`QC re-review: full tri-review`** → new basenames (`qc1-rev2.md` …); PM marks **active wave** in consolidated decision.
26
26
 
27
+ > **Engine check (when available):** run `mstar review seats <assignment-file> [--mode sdd|inline|targeted] [--reviewers <role1,role2,...>]` (or `import { executionModeToN, assertTriIdentity } from "@mstar-harness/engine"` in a host hook) to map `Execution mode` to its QC seat count N above and assert tri identity. On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
28
+
27
29
  ## 三审身份与模型独立性门禁(PM 强制)
28
30
 
29
31
  在 PM 发出 **initial** QC 三审后、进入汇总前:
@@ -74,6 +74,8 @@ Role `references/*.md` files include explicit **`NEVER`** sections (anti-recursi
74
74
 
75
75
  PM consolidated (tri mode): `{SDD_DIR}/review/qc-consolidated.md` (same folder; no `<plan-id>` basename prefix) + durable main-plan summary. Naming SSOT: `mstar-plan-artifacts/references/plan-files-and-reports.md`.
76
76
 
77
+ > **Engine check (when available):** import `validateRoleMapping` / `lintLoadOrder` from `@mstar-harness/engine` in a host hook to validate the mapping and parameter tables above against the on-disk `references/*.md` layout (shared families included) and lint the load-order declarations (no CLI form yet). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
78
+
77
79
  ## Maintenance Rules
78
80
 
79
81
  - Edit behavior in `references/*.md`.
@@ -137,7 +137,7 @@ When `metadata.control_worktree_path` is set and worktree mode is **not** waived
137
137
  | **`Worktree path`** | Absolute **feature** checkout (`execution_lease.worktree_path`) — product/source edits only |
138
138
  | **`Control harness root`** | Absolute `<control_worktree_path>/{HARNESS_DIR}` |
139
139
  | **`Plan Path`** | Absolute under control harness (not relative from feature cwd) |
140
- | **`SDD dir`** | Absolute under control harness; run skill **`mstar-sdd`** `scripts/sdd-workspace` with `MSTAR_CONTROL_ROOT=<control_worktree_path>` when cwd is the feature tree |
140
+ | **`SDD dir`** | Absolute under control harness; run `mstar sdd workspace <plan-id>` with `MSTAR_CONTROL_ROOT=<control_worktree_path>` when cwd is the feature tree |
141
141
 
142
142
  Do **not** waive worktree because default-gitignored `plans/` are missing under the feature checkout — see `mstar-branch-worktree` 「Harness path SSOT under default gitignore」.
143
143
  ## Completion Report Template