@mstar-harness/opencode 1.7.1 → 1.8.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 (51) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/harness-commands/codebase-audit.md +34 -0
  3. package/harness-commands/iteration-drive.md +17 -159
  4. package/harness-commands/iteration-loop.md +16 -194
  5. package/harness-commands/iteration-start.md +17 -183
  6. package/harness-skills/mstar-audit/SKILL.md +181 -0
  7. package/harness-skills/mstar-audit/references/audit-playbook.md +130 -0
  8. package/harness-skills/mstar-audit/references/finding-format.md +65 -0
  9. package/harness-skills/mstar-branch-worktree/SKILL.md +38 -27
  10. package/harness-skills/mstar-coding-behavior/SKILL.md +40 -114
  11. package/harness-skills/mstar-compound/SKILL.md +25 -197
  12. package/harness-skills/mstar-compound/references/compound-workflow.md +155 -0
  13. package/harness-skills/mstar-dispatch-gates/SKILL.md +3 -8
  14. package/harness-skills/mstar-harness-core/SKILL.md +3 -1
  15. package/harness-skills/mstar-host/references/_shared/host-role-binding-core.md +44 -0
  16. package/harness-skills/mstar-host/references/_shared/plan-mode-bridge-core.md +91 -0
  17. package/harness-skills/mstar-host/references/codex-plan-goal-mode-bridge.md +6 -11
  18. package/harness-skills/mstar-host/references/codex.md +1 -1
  19. package/harness-skills/mstar-host/references/cursor-plan-mode-bridge.md +9 -78
  20. package/harness-skills/mstar-host/references/cursor.md +3 -3
  21. package/harness-skills/mstar-host/references/kimi-plan-mode-bridge.md +5 -24
  22. package/harness-skills/mstar-host/references/kimi.md +5 -32
  23. package/harness-skills/mstar-host/references/omp-plan-mode-bridge.md +3 -13
  24. package/harness-skills/mstar-host/references/omp.md +5 -32
  25. package/harness-skills/mstar-host/references/opencode.md +1 -3
  26. package/harness-skills/mstar-host/references/zcode-plan-mode-bridge.md +5 -24
  27. package/harness-skills/mstar-host/references/zcode.md +5 -32
  28. package/harness-skills/mstar-iteration/SKILL.md +21 -211
  29. package/harness-skills/mstar-iteration/references/phase-3-iteration-close.md +95 -0
  30. package/harness-skills/mstar-iteration/references/phase-4-5-pr-delivery.md +81 -0
  31. package/harness-skills/mstar-iteration/references/phase5-helper-discovery.md +24 -0
  32. package/harness-skills/mstar-phase-gates/SKILL.md +2 -2
  33. package/harness-skills/mstar-plan-artifacts/references/plan-quality-bar.md +99 -0
  34. package/harness-skills/mstar-roles/SKILL.md +1 -1
  35. package/harness-skills/mstar-roles/references/_shared/leaf-executor-core.md +46 -0
  36. package/harness-skills/mstar-roles/references/architect.md +3 -23
  37. package/harness-skills/mstar-roles/references/frontend-dev.md +4 -24
  38. package/harness-skills/mstar-roles/references/fullstack-dev-shared.md +4 -24
  39. package/harness-skills/mstar-roles/references/ops-engineer.md +3 -23
  40. package/harness-skills/mstar-roles/references/product-manager.md +3 -23
  41. package/harness-skills/mstar-roles/references/project-manager/dispatch-and-assignment.md +5 -5
  42. package/harness-skills/mstar-roles/references/project-manager.md +4 -13
  43. package/harness-skills/mstar-roles/references/prompt-engineer.md +4 -23
  44. package/harness-skills/mstar-roles/references/qa-engineer.md +3 -22
  45. package/harness-skills/mstar-roles/references/qc-specialist/deep-review-lenses.md +16 -75
  46. package/harness-skills/mstar-roles/references/qc-specialist/reviewer-workflow.md +1 -1
  47. package/harness-skills/mstar-roles/references/qc-specialist-shared.md +4 -17
  48. package/harness-skills/mstar-roles/references/writing-specialist.md +4 -24
  49. package/harness-skills/mstar-sdd/SKILL.md +1 -0
  50. package/harness-skills/pm/SKILL.md +2 -0
  51. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mstar-branch-worktree
3
- description: "Morning Star business-repo Git feature branches, worktree isolation layers **L1** (iteration cross-plancontrol worktree + per-plan feature worktrees + `execution_lease`; under default gitignore, process harness SSOT via absolute control paths plans/iterations/status/sdd — while product edits stay on the feature worktree; do not waive worktree because feature lacks plans) and **L2** (within-plan — `references/parallel-writable-pre-dispatch.md`; N parallel Task invokes do NOT satisfy isolation), plan/Spec integration branches, and QC/QA checkout alignment (`Review cwd`, `Working branch`, `plan_id`, `Review range` / `Diff basis` must match verbatim across three QC reviewers and QA). Read when PM writes `Working branch` / `Branch policy`, iteration Phase 2 control vs feature worktree paths, dispatches ≥2 concurrent writable implement tracks on one repo, `Worktree isolation: required`, two or more writable streams touch one repo, dispatching QC tri-review or QA after merging to a single `HEAD`, dev/QA/ops before first `git commit`, or explaining worktree paths. Required for `project-manager` parallel implement or pre-QC orchestration; `fullstack-dev*` / `frontend-dev` / `qa-engineer` / `ops-engineer` on repo writes; `qc-specialist*` before review. Does not replace the state machine (`mstar-harness-core`)."
3
+ description: "Morning Star 业务仓 Git 功能分支、worktree 隔离(L1 plancontrol worktree + plan feature worktree + `execution_lease`,默认 gitignore 下经 control 绝对路径读写进程产物;L2 plan:`references/parallel-writable-pre-dispatch.md`,N invoke 隔离)、Spec 集成分支、QC/QA 检出对齐(`Review cwd` / `Working branch` / `plan_id` / `Review range` / `Diff basis` 三审 + QA 逐字相同)。Read when PM writes `Working branch` / `Branch policy`, iteration/parallel writable dispatch, or QC/QA checkout alignment is needed."
4
4
  ---
5
5
 
6
6
  ## Load order(必读顺序)
@@ -174,31 +174,42 @@ Default process artifacts (`plans/`, `iterations/`, `status.json`, `sdd/`, `note
174
174
 
175
175
  **QC / QA 与 feature**:开发常在 **feature 分支的 worktree** 中完成;进入 **QC 三审**与随后的 **QA 验证**时,PM 须在 Assignment 中写明 **`Review cwd` / `Worktree path`**、**`Working branch`**、**`plan_id`**(无 plan 流程时 `N/A` + 不可歧义 **Feature / scope label**)与 **`Review range` / `Diff basis`**;**三份 QC Assignment 与 QA Assignment 中 `plan_id` 与 `Review range` / `Diff basis` 须逐字相同**,保证三票审 **同一 plan/feature 与同一 diff 范围**。
176
176
 
177
- ## 多 worktree 并行开发与 QC / QA 的门禁衔接(强制;避免误派)
178
-
179
- - **语义区分(必须理解)**:开发阶段可以存在 **多个** `Worktree path`(每条约流一条检出目录);**一轮**正式 QC 三审及与之 **逐字对齐** 的 QA 验证,在 harness 中仍只对应 **一套** `Review cwd` / `Worktree path` + **`Working branch`** + **`Review range` / `Diff basis`**(三票 QC 与 QA **共用且逐字相同**)。**不要**把「多个开发 worktree」误解成「QC 应轮流进多个目录各审一半」。
180
- - **默认编排:先建 plan 集成分支,再挂各 worktree(PM)**:在 **同仓**、**同一 plan** 且 **≥2 条可写并行轨** 时,按下列顺序编排可最大幅度降低 QC/QA 误用单一开发目录的风险。**不是唯一合法 Git 拓扑**;若采用其它拓扑,仍须满足本节下文 **强制**条款(派发前 worktree 隔离 + 派 QC 前 **单一**待审 `HEAD` + 一套对齐字段)。
181
- 1. **先起集成分支(再挂 worktree)**:在派发各轨 **实现** Assignment 之前,PM 与用户确认 **`Branch policy`**,并建立 **plan 集成分支**(Assignment 使用 **`Working branch: create <plan-integration-branch> from <base>`** 或等价明确写法;`<base>` 必须是 PM 明确记录的 base,例如 root `metadata.iteration_base_branch`、现有 feature 分支、远程跟踪分支或团队既定主线,**不得**未授权假设)。**分支名由 PM 指定**;下文 **`feature/<plan-id>-integrate`**、**`integrate/<plan-id>`** 仅为命名示例,**非强制**。**多 `plan_id` 同源一条 `primary_spec`(Spec 文档)时**:该集成分支在计划语义上即 **Spec 集成分支**;各 Plan 的 feature 线 merge 回此线,**全部 Plans 完成后** 向显式 `target_branch` **走 PR**(见 `mstar-plan-conventions` SKILL.md「Spec 驱动的分支模型」)。
182
- 2. **再挂各轨 worktree**:为每条并行轨分配 **独立** `git worktree` + **`Worktree path`**;各轨 **`Working branch`** 一般为 **从集成分支出** 的 topic 分支(`create <topic-i> from <plan-integration-branch>`)或 PM 书面约定的等价结构(例如从同一 `<base>` 出 topic、但 **书面指定** 合并时 **以集成分支为靶**)。**禁止**承接方擅自把未授权功能提交直接堆在 `main`/`master`。
183
- 3. **进 QC 之前**:将全部 **须同一轮三审覆盖** 的提交 **merge / rebase / cherry-pick**(以 PM 指定的团队方式)**归并**到 **同一条** PM 将作为 QC **`Working branch`** 的分支的 **`HEAD`**(**通常即 plan 集成分支**;若 PM 已将集成分支重命名或快进为最终 `feature/*`,以 Assignment 为准)。**在此**解决冲突;**勿**在 QC Assignment 仍指向「只含部分轨」的旧 `HEAD` 时派三审。
184
- 4. **QC / QA 的 `Working branch` 与合并主线**:派发 QC 三审与对齐的 QA 时,**`Working branch`** **即为**上一步 **已含全部待审提交** 的那条分支(常见为 plan 集成分支)。**`Review range` / `Diff basis`** 通常相对 **尚未合并 feature 的**显式目标或 base 参照(例如 `merge-base: <target_branch-or-base-ref>` + `tip: HEAD`),审查的是 **「feature 线 vs 目标线」** 的差异;**默认不要求**在 QC **通过前** 已把该分支 merge 进目标分支(除非 **`Branch policy`** 或用户明确约定 trunk 式例外)。
185
- 5. **本推荐不适用时**:单轨、多仓库、或 plan 已 **拆 scope / 多轮增量三审**(见 `mstar-plan-conventions`)— 仍须 **逐轮**满足 **强制**条款:每轮 QC 对应 **一条**快照、**一套**逐字相同的 `plan_id` + `Review range` / `Diff basis`。
186
- - **单一待审 Git 快照(派 QC 前置条件)**:若本 plan 下曾有多条 **可写** 并行轨落在 **同一业务仓** 且其成果分布在 **不同分支**、或 **未互相合并进同一条分支的 `HEAD`**,则在派发 **QC 三审**(及同范围的 QA)**之前**,**必须**先在 Git 中完成 **归并**(merge / rebase / 按团队约定的集成方式),使 **全部**待审提交都出现在 **同一条** PM 指定的 **`Working branch`** 的 **`HEAD`** 上;**然后**再填写 **一个** `Review cwd`(可为该分支上新开的只读审查 worktree)与 **一个** 可复现的 **`Review range` / `Diff basis`**。**禁止**仅填写并行轨 **A** 的开发用 `Worktree path` 作为 `Review cwd`,却期望审查覆盖仍只存在于并行轨 **B** 的分支或提交上的变更(在该变更 **未进入** A 所检出分支的 `HEAD` 时,这在 Git 上不可复现,属 **Assignment 错误**)。
187
- - **不应合并为一次审时的做法**:若两轨 **有意**保持独立可合并单元(例如两条独立 PR),**不得**共用 **同一套** `plan_id` + **`Review range` / `Diff basis`** 假装「一轮三审覆盖全部」。应 **拆分 scope**:分轮次审查、不同 **`Feature / scope label`**、不同 `plan_id`、或按 `mstar-plan-conventions` 写明的 **显式增量三审** 例外,使每轮 QC 各对应 **一条**分支快照与 **一套**对齐字段。
188
- - **同分支多目录的例外**:若所有并行轨 **始终**在同一条已授权的 **`Working branch`** 上协作(每流仅目录不同、提交已互相 `pull`/推送收敛),则任一该分支的检出目录在 **更新到含全部提交的 `HEAD`** 后,均可作为 `Review cwd`;**不得**使用仍停留在旧提交的 worktree 路径。
189
-
190
- ## QC 三审、QA 验证与 feature 检出上下文(强制)
191
-
192
- 开发在 **feature 分支**上完成(往往在 **独立 worktree** 中实现)后,**QC 审查与 QA 验证针对的都是这份 feature**,而不是 `main` 或任意未对齐的默认 cwd。
193
-
194
- - **`project-manager`** 分派 **QC** 时须在 Assignment 写明与待审实现一致的 **`Working branch`**,并写明 **`Review cwd` / `Worktree path`**:**优先**沿用开发 **Completion Report** 中回报的业务仓 **实现检出路径**(即「该 feature worktree」)**当且仅当**该路径上的检出分支 **`HEAD` 已包含本轮待审的全部提交**(含曾发生在其他并行 worktree、现已归并到该分支的变更)。否则 **必须**改用 **集成完成后的** `Working branch` 与对应检出路径(或在该分支上 **另开** 审查专用 worktree)。若开发未用 worktree,则写明单一明确的业务仓根路径。若审查需与开发目录 **物理分离** 但仍审 **同一分支**,可指示在 **`Working branch`** **另加** 一个 worktree 专供审查(只读使用业务仓)。**多流并行开发**时的前置归并、**推荐默认编排(plan 集成分支先行)** 与误派禁令见上一小节。
195
- - **三票审同一功能(强制对齐)**:分派 **QC 三审**时,除上述字段外,**必须**在 **三份 Assignment 中逐字写入相同**的 **`plan_id`** 与 **`Review range` / `Diff basis`**:
196
- - **`plan_id`**:与 `{SDD_DIR}` `<plan-id>` 段、主 **Plan Path**、`status.json.plans[].id` 一致;无 `{PLAN_DIR}` 流程时写 **`plan_id: N/A`**,并另给一行 **`Feature / scope label`**(不可歧义,足以与并行其它 feature 区分)。
197
- - **`Review range` / `Diff basis`**:明确本次审查所针对的 **diff/提交范围**(例如 `merge-base: <target_branch-or-base-ref>` + `tip: HEAD`;或 `rev-range: <full-40>..<full-40>`;或一句 `equivalent to: git diff <merge-base>...HEAD`,以团队可复现为准)。**三名 reviewer 的 Assignment 间该字段必须完全一致**;**`qa-engineer`** 验证同一 feature 时 **复用同一 `plan_id` 与同一 `Review range` / `Diff basis`**。**热修 / QC 单审**路径也须含 **同一组字段**,仅承接方份数为 1。
198
- - **三审并行**时,三名 reviewer **共用同一组 `Review cwd` / `Worktree path` + `Working branch` + `plan_id` + `Review range` / `Diff basis`**(对业务仓 **只读 diff 审查**);**一般不必**为每位 reviewer 各开一个 worktree,除非宿主或执行环境要求进程级隔离。
199
- - **并行 QC 禁止**在共享检出上跑 **test / build / install / lint / typecheck** 等会争用缓存或锁的命令(否则 peer QC 易 `Blocked`)。L3 默认手段:`git diff` / `git log` / `git show` / Read / Grep。运行时验证留给 **L1 证据** **`qa-engineer`(L4)** `mstar-review-qc/references/review-responsibility-boundaries.md`。
200
- - QC **报告落盘**默认仅限 Assignment 指定的 `{SDD_DIR}/review/`;上述约定保证 `git diff`、`git log` 与所读文件与 **待合并 feature** 一致。PM 另行提交主 plan gate summary / `status.json` residual changes as durable artifacts。
201
- - **`project-manager`** 分派 **`qa-engineer`** 时(仅 **`QA gate: mandatory`**),Assignment 须与 QC **逐字相同**的 **`Review cwd` / `Worktree path`**、**`Working branch`**、**`plan_id`**、**`Review range` / `Diff basis`**(QC 已写清则 QA 照抄)。**`qa-engineer`** 执行业务仓命令前须核对检出与分支;Report-only 且无路径依赖时,回报须说明验证环境,否则 `Blocked`。
202
- - **QA 与同仓其他可写角色并发**提交测试代码,仍须遵守上文「同仓并发写入」的 **worktree** 规则(可为 QA 单开一条写入 worktree,**同一 `Working branch`**,由 PM Assignment 写明)。
177
+ ## QC / QA 检出对齐与多 worktree 门禁衔接(强制;避免误派)
178
+
179
+ ### 对齐字段契约(canonical)
180
+
181
+ 分派 **QC 三审** 与对齐的 **QA 验证** 时,PM **必须**在 Assignment 写明与待审实现一致的 **`Review cwd` / `Worktree path`**、**`Working branch`**、**`plan_id`**、**`Review range` / `Diff basis`**。开发在 **feature 分支**(往往在独立 worktree 中)完成后,QC/QA 针对的都是这份 feature,不是 `main` 或任意未对齐默认 cwd。
182
+
183
+ - **`Review cwd` / `Worktree path`**:**优先**沿用开发 Completion Report 回报的业务仓实现检出路径(该 feature worktree)**当且仅当**该路径检出分支 `HEAD` 已含本轮待审全部提交(含曾发生在其他并行 worktree、现已归并到该分支的变更)。否则**必须**改用集成完成后的 `Working branch` 与对应检出路径(或在该分支上**另开**只读审查 worktree)。开发未用 worktree 写明单一业务仓根路径。
184
+ - **`Working branch`**:含全部待审提交的那条分支(常见 plan 集成分支)。
185
+ - **`plan_id`**:与 `{SDD_DIR}` `<plan-id>` 段、主 Plan Path、`status.json.plans[].id` 一致;无 `{PLAN_DIR}` 流程时写 **`plan_id: N/A`** + 一行 **`Feature / scope label`**(不可歧义,足以与并行其它 feature 区分)。
186
+ - **`Review range` / `Diff basis`**:审查的 diff/提交范围(例如 `merge-base: <target_branch-or-base-ref>` + `tip: HEAD`;或 `rev-range: <full-40>..<full-40>`;或一句 `equivalent to: git diff <merge-base>...HEAD`,以团队可复现为准)。
187
+ - **逐字对齐(强制)**:三份 QC Assignment QA Assignment 间 **`plan_id`** **`Review range` / `Diff basis`**(连同 `Review cwd` / `Working branch`)**必须完全相同**;**`qa-engineer`** 验证同一 feature 时**复用同一组字段**。**热修 / QC 单审**路径也须含**同一组字段**,仅承接方份数为 1。
188
+ - 三审并行时三名 reviewer **共用同一组**字段(对业务仓**只读 diff 审查**);一般不必为每位 reviewer 各开 worktree,除非宿主/环境要求进程级隔离。
189
+
190
+ ### worktree 并行 单一待审快照(派 QC 前置)
191
+
192
+ **语义区分(必须理解)**:开发阶段可存在 **多个** `Worktree path`(每条流一条检出目录);**一轮**正式 QC 三审 + 对齐 QA 只对应 **一套**对齐字段(上文)。**不要**把「多个开发 worktree」误解成「QC 应轮流进多个目录各审一半」。
193
+
194
+ **单一待审 Git 快照(派 QC 前置条件)**:若本 plan 下多条**可写**并行轨落在**同一业务仓**且成果分布在**不同分支**、或**未合并进同一条分支 `HEAD`**,则派发 QC 三审(及同范围 QA)**之前**,**必须**先在 Git 完成**归并**(merge / rebase / 按团队集成方式),使**全部**待审提交出现在同一条 PM 指定的 **`Working branch`** `HEAD` 上;然后填 **一个** `Review cwd`(可为该分支上新开的只读审查 worktree)+ **一个**可复现的 **`Review range` / `Diff basis`**。**禁止**仅填并行轨 **A** 的开发用 `Worktree path` `Review cwd`,却期望审查覆盖仍只存在于并行轨 **B** 分支或提交上的变更(该变更**未进入**轨 A 所检出分支 `HEAD` 时,Git 上不可复现,属 **Assignment 错误**)。
195
+
196
+ **推荐默认编排(plan 集成分支先行)**——同仓、同一 plan、**≥2 条可写并行轨**时降低 QC/QA 误用单一开发目录风险。**不是唯一合法 Git 拓扑**;其它拓扑仍须满足上文对齐字段 + 本节**强制**条款(派发前 worktree 隔离 + QC 前**单一**待审 `HEAD` + 一套对齐字段):
197
+
198
+ 1. **先起集成分支(再挂 worktree)**:派发各轨**实现** Assignment 前,PM 与用户确认 **`Branch policy`**,建立 **plan 集成分支**(Assignment 用 **`Working branch: create <plan-integration-branch> from <base>`** 或等价明确写法;`<base>` 必须 PM 明确记录,例如 root `metadata.iteration_base_branch`、现有 feature 分支、远程跟踪分支或团队既定主线,**不得**未授权假设)。**分支名由 PM 指定**(`feature/<plan-id>-integrate`、`integrate/<plan-id>` 仅为命名示例,**非强制**)。**多 `plan_id` 同源一条 `primary_spec`(Spec 文档)时**:该集成分支语义即 **Spec 集成分支**;各 Plan feature 线 merge 回此线,**全部 Plans 完成后**向显式 `target_branch` **走 PR**(见 `mstar-plan-conventions` SKILL.md「Spec 驱动的分支模型」)。
199
+ 2. **再挂各轨 worktree**:每条并行轨分配**独立** `git worktree` + **`Worktree path`**;各轨 `Working branch` 一般为**从集成分支出**的 topic 分支(`create <topic-i> from <plan-integration-branch>`)或 PM 书面约定等价结构(例如从同一 `<base>` topic、但**书面指定**合并时**以集成分支为靶**)。**禁止**承接方擅自把未授权功能提交直接堆在 `main`/`master`。
200
+ 3. **进 QC 之前**:将全部**须同一轮三审覆盖**的提交**归并**(merge / rebase / cherry-pick,以 PM 指定团队方式)到同一条将作 QC **`Working branch`** 的分支 **`HEAD`**(**通常即 plan 集成分支**;PM 已重命名/快进为最终 `feature/*` 则以 Assignment 为准)。**在此**解决冲突;**勿**在 QC Assignment 仍指向「只含部分轨」旧 `HEAD` 时派三审。
201
+ 4. **QC/QA `Working branch` 与合并主线**:`Working branch` 即上一步**已含全部待审提交**的那条分支(常见 plan 集成分支)。`Review range` / `Diff basis` 通常相对**尚未合并 feature 的**显式目标/base 参照(例如 `merge-base: <target_branch-or-base-ref>` + `tip: HEAD`),审的是 **「feature 线 vs 目标线」** 差异;**默认不要求** QC **通过前**已把该分支 merge 进目标分支(除非 **`Branch policy`** 或用户明确 trunk 式例外)。
202
+ 5. **本推荐不适用时**:单轨、多仓库、或 plan 已**拆 scope / 多轮增量三审**(见 `mstar-plan-conventions`)— 仍须**逐轮**满足**强制**条款:每轮 QC 对应**一条**快照、**一套**逐字相同的 `plan_id` + `Review range` / `Diff basis`。
203
+
204
+ **不应合并为一次审时**:若两轨**有意**保持独立可合并单元(例如两条独立 PR),**不得**共用**同一套** `plan_id` + `Review range` / `Diff basis` 假装「一轮三审覆盖全部」。应**拆分 scope**:分轮次审查、不同 **`Feature / scope label`**、不同 `plan_id`、或按 `mstar-plan-conventions` 写明的**显式增量三审**例外,使每轮 QC 各对应**一条**分支快照与**一套**对齐字段。
205
+
206
+ **同分支多目录例外**:若所有并行轨**始终**在同一条已授权 **`Working branch`** 上协作(每流仅目录不同、提交已互相 `pull`/推送收敛),则任一该分支检出目录在**更新到含全部提交 `HEAD`** 后均可作 `Review cwd`;**不得**使用仍停留在旧提交的 worktree 路径。
207
+
208
+ ### QC / QA 执行约束
209
+
210
+ - **并行 QC 禁止**在共享检出跑 **test / build / install / lint / typecheck** 等争用缓存或锁的命令(否则 peer QC 易 `Blocked`)。L3 默认手段:`git diff` / `git log` / `git show` / Read / Grep。运行时验证留给 **L1 证据**与 **`qa-engineer`(L4)** — 见 `mstar-review-qc/references/review-responsibility-boundaries.md`。
211
+ - QC **报告落盘**默认仅限 Assignment 指定的 `{SDD_DIR}/review/`;上述约定保证 `git diff`、`git log` 与所读文件与**待合并 feature** 一致。PM 另行提交主 plan gate summary / `status.json` residual changes as durable artifacts。
212
+ - **`qa-engineer`**(仅 **`QA gate: mandatory`**)Assignment 用 QC 逐字相同的对齐字段(QC 已写清则 QA 照抄);执行业务仓命令前须核对检出与分支;Report-only 且无路径依赖时回报须说明验证环境,否则 `Blocked`。
213
+ - 若 **QA 与同仓其他可写角色并发**提交测试代码,仍须遵守上文「同仓并发写入」**worktree** 规则(可为 QA 单开一条写入 worktree,**同一 `Working branch`**,由 PM 在 Assignment 写明)。
203
214
 
204
215
  派发前清单与常见反模式 → **`references/parallel-writable-pre-dispatch.md`**。
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mstar-coding-behavior
3
- description: Morning Star (启明星) 跨角色通用编码行为准则 —— Think Before Coding(先读懂再改、显式假设、不静默猜测、读 imports/test/项目模式)、Simplicity First(YAGNI 优先不写代码、The Ladder 决策层级含依赖评估、删除优于添加、简洁优于聪明、5 项具名反模式速查、`simplify:` 标记天花板与升级路径、最小耐久切片)、Surgical Changes(改动可追溯、Bug 修根因先 grep 所有调用点、不顺手重构、不 piggyback)、Debugging(读完整报错与栈追踪、先复现、一步一测、根因分析、Bug 修复前先写复现测试、卡住时坦白)、Review Feedback Handling(先核实反馈再改、逐项处理、可用证据反驳错误建议)、Goal-Driven Execution(非平凡逻辑必留一个可运行检查、模糊请求转可验证结果、测行为不测实现、已有测试前后对比、不能测试说理由、Step verify 微模板、分批留 roadmap)、Communication(说做了什么及为什么、标记顾虑、精确表达不确定性、不解释已知的、commit message 质量)。任何实现、调试、重构、审查任务都应优先 Read 本 skill;`@fullstack-dev` / `@frontend-dev` / `@fullstack-dev-2` / `@architect` / `@qa-engineer` / `@ops-engineer` / `@prompt-engineer` 动手前必读;QC 审查员核对变更是否只做了该做的手术时必读。本 skill 不覆盖分支门禁、QC/QA 路由、Assignment 权限、Done 所有权等不变量(那些以 `mstar-harness-core` 为准)。
3
+ description: Morning Star 跨角色通用编码行为准则 —— 任何实现、调试、重构、审查任务动手前必读。约束 Think Before Coding(先读懂再改、显式假设、不静默猜测)、Simplicity First(YAGNIThe Ladder、`simplify:` 标记、最小耐久切片)、Surgical Changes(改动可追溯、Bug 修根因先 grep 所有调用点、不 piggyback)、Debugging(先复现、一步一测、修前写复现测试)、Review Feedback Handling(先核实再改、证据反驳)、Goal-Driven Execution(非平凡逻辑留可运行检查、Step→verify)、Communication。`@fullstack-dev*` / `@frontend-dev` / `@architect` / `@qa-engineer` / `@ops-engineer` / `@prompt-engineer` 必读;QC 核对手术范围时必读。不覆盖分支门禁、QC/QA 路由、Assignment 权限。
4
4
  ---
5
5
 
6
6
  ## Load order(必读顺序)
@@ -9,55 +9,29 @@ description: Morning Star (启明星) 跨角色通用编码行为准则 —— T
9
9
 
10
10
  **摘要**:`mstar-harness-core` — 不变量与门禁;本 skill — 实现与审查时的工程习惯,不替代 harness。
11
11
 
12
- # Morning Star Coding Behavior Guidelines
13
-
14
- This skill captures lightweight, host-agnostic coding behavior principles that reduce common agent mistakes. It complements the other Morning Star skills and does not override stage gates or role routing.
15
-
16
- Priority remains (同 `mstar-harness-core` SKILL.md「信息源优先级」):
12
+ Priority remains(同 `mstar-harness-core`「信息源优先级」):① 当轮用户显式指令 项目 `AGENTS.md` / `CLAUDE.md` ③ `mstar-harness-core` ④ 其它 `mstar-*`(含本 skill)⑤ `mstar-roles` 角色正文。
17
13
 
18
- 1. User explicit instruction
19
- 2. Project `AGENTS.md` / `CLAUDE.md`
20
- 3. `mstar-harness-core` skill(global entry & SSOT)
21
- 4. Other `mstar-*` skills(含本 skill)
22
- 5. Role prompts in `mstar-roles` skill
14
+ **Scope**:适用于非平凡编码/调试/重构/审查任务;trivial one-liner 用判断、保持低开销。定义执行行为,不定义分支策略或门禁所有权。
23
15
 
24
- ## Scope
16
+ # Morning Star Coding Behavior Guidelines
25
17
 
26
- - Applies to non-trivial coding, debugging, refactoring, and review tasks.
27
- - For trivial one-liners, use judgment and keep overhead minimal.
28
- - This skill defines execution behavior, not branch policy or gate ownership.
18
+ Lightweight, host-agnostic coding-behavior principles that reduce common agent mistakes. Complements other Morning Star skills; does not override stage gates or role routing.
29
19
 
30
20
  ## 1) Think Before Coding
31
21
 
32
- Core idea: do not silently choose an interpretation when ambiguity exists.
33
-
34
- - State assumptions explicitly before implementation when uncertainty is material.
35
- - If there are multiple plausible interpretations, present options and ask for confirmation.
36
- - Surface key tradeoffs when they affect scope, risk, or maintainability.
37
- - If critical context is missing, pause and clarify instead of guessing.
22
+ Do not silently choose an interpretation when ambiguity exists. State assumptions explicitly when material; if multiple plausible interpretations exist, present options and ask. Surface tradeoffs affecting scope/risk/maintainability. If critical context is missing, pause and clarify instead of guessing.
38
23
 
39
- Quick check:
40
-
41
- - Can another reviewer see what assumptions were made?
42
- - If assumptions are wrong, will the user detect it before large edits happen?
24
+ Quick check: can another reviewer see the assumptions made? If assumptions are wrong, will the user detect it before large edits happen?
43
25
 
44
26
  **Never lazy about understanding.** Shorten the solution, never the reading. Read the task and every file the change touches fully first; trace the actual flow end to end. A small diff in the wrong place is not efficiency — it is a second bug shipped with confidence.
45
27
 
46
- **Read before you write.** Before generating code in an existing project:
47
-
48
- - Inspect the imports at the top of each file you are about to modify. They tell you which libraries the project actually uses — do not introduce a different library for the same purpose.
49
- - Look at nearby test files. They document expected behavior more precisely than comments or your own assumptions.
50
- - Follow existing project patterns. If there is a convention for API routes, file structure, or error handling, match it. Do not silently introduce a different pattern.
51
- - If you cannot find a precedent for something, say so. "I do not see a pattern for X in the codebase — should I follow approach Y?" is always better than guessing.
52
- - If you are not 100% sure a method signature or parameter exists, check the actual source code or docs before using it. Confidently calling a non-existent API is one of the costliest agent mistakes — it may compile, then fail at runtime.
28
+ **Read before you write.** Before generating code in an existing project: inspect imports (which libraries the project actually uses — do not introduce a different library for the same purpose); look at nearby tests (they document expected behavior more precisely than comments); follow existing patterns (API routes, file structure, error handling — match it, do not silently introduce a different one). If no precedent exists, say so and ask. If not 100% sure a signature/parameter exists, check source/docs before using it — confidently calling a non-existent API may compile then fail at runtime.
53
29
 
54
- The failure mode: you generate "correct" code that is alien to the codebase it lives in. It works but looks like a different person wrote it. The human then has to either rewrite it to match or live with inconsistency forever.
30
+ The failure mode: "correct" code that is alien to the codebase works but looks like a different person wrote it, forcing a rewrite or permanent inconsistency.
55
31
 
56
32
  ## 2) Simplicity First
57
33
 
58
- Core idea: implement the smallest durable slice that satisfies the request and acceptance criteria.
59
-
60
- **Question the need (YAGNI).** Before writing code, ask: does this task need code at all? Can the goal be achieved by deletion, reusing existing logic, or a configuration change? If a path requires no code, take it and explain in one line.
34
+ Implement the smallest durable slice that satisfies the request and acceptance criteria.
61
35
 
62
36
  **The Ladder.** A reflex hierarchy for every decision — stop at the first rung that holds:
63
37
 
@@ -65,20 +39,15 @@ Core idea: implement the smallest durable slice that satisfies the request and a
65
39
  2. **Already in this codebase?** A helper, util, type, or pattern that already lives here → reuse it. Look before you write.
66
40
  3. **Stdlib / built-in covers it?** Use it.
67
41
  4. **Native platform feature covers it?** CSS over JS, DB constraint over app code, OS primitive over a library.
68
- 5. **Already-installed dependency solves it?** Use it. Never add a new dependency for what a few lines of code can do. When a new dependency appears necessary, evaluate: (a) can this be done with what is already in the project? (b) can the standard library do it? (c) is the package maintained (check last commit date and issue tracker) and reasonably sized? If you add it, state why in one sentence — silently adding packages is not acceptable.
42
+ 5. **Already-installed dependency solves it?** Use it. Never add a new dependency for what a few lines can do. When a new dependency appears necessary, evaluate: (a) can this be done with what is already in the project? (b) can the standard library do it? (c) is the package maintained (check last commit date and issue tracker) and reasonably sized? If you add it, state why in one sentence — silently adding packages is not acceptable.
69
43
  6. **Can it be one line?** One line.
70
44
  7. **Only then:** the minimum durable code that works.
71
45
 
72
- The ladder runs after understanding, not instead of it. Two rungs work → take the higher one and move on.
46
+ The ladder runs after understanding, not instead of it. Two rungs work → take the higher one.
73
47
 
74
- **Deletion over addition. Boring over clever.** Removing unnecessary code is a feature. Cleverness is what someone decodes at 3am — prefer a boring, obvious solution that a tired reviewer can verify in seconds.
48
+ **Deletion over addition. Boring over clever.** Removing unnecessary code is a feature; cleverness is what someone decodes at 3am — prefer a boring, obvious solution a tired reviewer verifies in seconds. Do not add unrequested features/flags/configurability; avoid new abstractions for single-use logic; prefer straightforward local fixes over framework-level reshaping **only when they fit the target design**; reject speculative error handling for impossible paths unless required by project policy.
75
49
 
76
- - Do not add features, flags, or configurability that were not requested.
77
- - Avoid introducing new abstractions for single-use logic.
78
- - Prefer straightforward local fixes over framework-level reshaping **only when they fit the target design**.
79
- - Reject speculative error handling for impossible paths unless required by project policy.
80
-
81
- **Simplification markers.** When a deliberate shortcut has a known ceiling (global lock, O(n²) scan, naive heuristic), mark it with a `simplify:` comment that names the ceiling and the upgrade path:
50
+ **Simplification markers.** When a deliberate shortcut has a known ceiling (global lock, O(n²) scan, naive heuristic), mark it with a `simplify:` comment naming the ceiling and the upgrade path:
82
51
 
83
52
  ```text
84
53
  // simplify: global lock on cache misses. Replace with per-key lock if throughput matters.
@@ -87,66 +56,43 @@ The ladder runs after understanding, not instead of it. Two rungs work → take
87
56
  This signals intent — the simplicity is deliberate, not an oversight — and gives the next person the upgrade path without research.
88
57
 
89
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.
90
- - If a workaround is unavoidable, label it as `simplify:` / `temporary`, explain why, and record the removal path in the plan/status artifact before claiming the task is complete.
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.
91
60
 
92
61
  **Simplicity anti-patterns — stop and reconsider when you spot these:**
93
62
 
94
63
  | Anti-pattern | Signal |
95
64
  |---|---|
96
- | **Premature abstraction** | You are writing a class / interface / strategy pattern where a single function suffices. |
97
- | **Speculative error handling** | You are wrapping code in try/catch for errors that cannot happen. |
98
- | **Unnecessary configurability** | You are making a value configurable (env var, parameter) that will never change. Hardcode it until there is a real reason not to. |
99
- | **Dead flexibility** | You have an interface with one implementation, or a generic type with one instantiation — cost with zero benefit until a second use exists. |
100
- | **"In case we need to"** | Your justification for abstraction includes a guess about future requirements. "In case we need to" is not a requirement — it is a guess, and guesses about the future are usually wrong. |
101
-
102
- Default rule:
65
+ | **Premature abstraction** | Writing a class/interface/strategy where a single function suffices. |
66
+ | **Speculative error handling** | Wrapping code in try/catch for errors that cannot happen. |
67
+ | **Unnecessary configurability** | Making a value configurable (env var, parameter) that will never change. Hardcode it until there is a real reason not to. |
68
+ | **Dead flexibility** | An interface with one implementation, or a generic type with one instantiation — cost with zero benefit until a second use exists. |
69
+ | **"In case we need to"** | Justification for abstraction includes a guess about future requirements. "In case we need to" is a guess, and guesses about the future are usually wrong. |
103
70
 
104
- - If 200 lines can be 50 with the same behavior, clarity, and durable architecture, prefer the smaller solution.
105
-
106
- Durability check:
107
-
108
- - Can this slice be extended by the next batch without undoing its core shape?
109
- - Are deferred items captured in an existing roadmap / task board / residual tracker, not just mentioned in chat?
110
- - Would a reviewer understand whether this is the final approach, a staged slice, or a deliberate simplification?
71
+ **Durability check**: can this slice be extended by the next batch without undoing its core shape? Are deferred items captured in an existing roadmap/task board/residual tracker (not just chat)? Would a reviewer understand whether this is the final approach, a staged slice, or a deliberate simplification?
111
72
 
112
73
  ## 3) Surgical Changes
113
74
 
114
- Core idea: every changed line should be traceable to the task.
115
-
116
- - Touch only files and regions needed for the requested outcome.
117
- - Do not opportunistically refactor adjacent code.
118
- - Match existing style and patterns unless a change is explicitly requested.
119
- - Remove only artifacts made unused by your own change.
120
- - If unrelated issues are found, report them separately instead of piggyback editing.
75
+ Every changed line should be traceable to the task. Touch only files/regions needed for the requested outcome; do not opportunistically refactor adjacent code; match existing style unless a change is explicitly requested; remove only artifacts made unused by your own change; report unrelated issues separately instead of piggyback editing.
121
76
 
122
- Traceability test:
123
-
124
- - Each hunk should map to a user requirement, acceptance criterion, or required fix-up.
77
+ **Traceability test**: each hunk maps to a user requirement, acceptance criterion, or required fix-up.
125
78
 
126
79
  **Bug fix = root cause, not symptom.** A bug report names a symptom, not the cause. Before editing, grep every caller of the function or code path you are about to touch. The fix belongs where all callers route through — one guard in the shared function is smaller than a guard in every caller. Patching only the path the ticket names leaves every sibling caller still broken. Fix it once, at the narrowest shared point.
127
80
 
128
81
  ## 4) Debugging
129
82
 
130
- Core idea: when something does not work, investigate. Do not guess.
83
+ When something does not work, investigate; do not guess.
131
84
 
132
- - **Read the error message entirely** including the full stack trace. A `TypeError` can mean a hundred different things; the message and trace tell you which one.
133
- - **Reproduce before fixing.** If you cannot reproduce the problem, you cannot verify your fix. "I think this should fix it" is gambling, not debugging.
134
- - **Change one thing at a time.** Changing three things and seeing the bug disappear tells you nothing about which change fixed it — or what new bugs the other two introduced. Change one, test, change the next, test.
135
- - **Fix the root cause, not the symptom.** If a value is unexpectedly null, do not just add a null check and move on. Figure out why it is null. The null check might prevent a crash, but the underlying bug will manifest differently later. Before patching, grep every caller of the affected code path and fix at the narrowest shared point (see Surgical Changes · Bug fix = root cause).
136
- - **Write a reproduction test before fixing a bug.** Before changing any code, write a minimal test that reproduces the reported behavior. Run it — watch it fail. Then apply the fix. Run it — watch it pass. This is the only way to prove you fixed the actual problem and did not merely suppress symptoms.
137
- - **Run existing tests before and after your changes.** If tests passed before and fail after, you broke something. If tests were already failing before, say so — do not let your changes get blamed for pre-existing failures.
138
- - **If you are stuck, say so.** "I have tried X and Y and neither worked. Here is what I am seeing. I think the issue might be Z but I am not sure." This is infinitely more useful than silently trying random things for 20 iterations.
85
+ - **Read the error message entirely**, including the full stack trace a `TypeError` can mean a hundred things; the message and trace tell you which one.
86
+ - **Reproduce before fixing.** If you cannot reproduce, you cannot verify. "I think this should fix it" is gambling.
87
+ - **Change one thing at a time.** Changing three things and seeing the bug disappear tells you nothing about which change fixed it — or what new bugs the other two introduced.
88
+ - **Fix the root cause, not the symptom.** If a value is unexpectedly null, do not just add a null check figure out why it is null (see Surgical Changes · bug=root-cause).
89
+ - **Write a reproduction test before fixing a bug.** Minimal test reproducing the reported behavior watch it fail apply fix watch it pass. The only way to prove you fixed the actual problem, not merely suppressed symptoms.
90
+ - **Run existing tests before and after changes.** If they passed before and fail after, you broke something. If they were already failing, say so.
91
+ - **If stuck, say so.** "I tried X and Y; neither worked. I'm seeing Z. I think it might be W but am not sure" is infinitely more useful than silently trying random things for 20 iterations.
139
92
 
140
93
  ## 5) Goal-Driven Execution
141
94
 
142
- Core idea: convert vague requests into verifiable outcomes and iterate until verified.
143
-
144
- - Define concrete success criteria before major edits.
145
- - For multi-step tasks, use brief `Step -> verify` checkpoints.
146
- - For split delivery, maintain a durable roadmap: current slice, later slices, dependencies, owner/trigger, and completion condition.
147
- - Prefer evidence-backed completion claims (tests, command output, reproducible checks).
148
- - If verification fails, loop on diagnosis and fix before declaring completion.
149
- - Do not finish with "next plan / later / follow-up" only in prose. If the work is not fully complete, the remaining work must be written to the plan/status artifact or the task must report `Partial` / `Blocked`.
95
+ Convert vague requests into verifiable outcomes and iterate until verified. Define concrete success criteria before major edits; use brief `Step -> verify` checkpoints for multi-step tasks; for split delivery, maintain a durable roadmap (current slice, later slices, dependencies, owner/trigger, completion condition); prefer evidence-backed completion (tests, command output, reproducible checks). If verification fails, loop on diagnosis and fix before declaring completion. Do not finish with "next plan / later / follow-up" only in prose — remaining work must be written to the plan/status artifact or the task reports `Partial` / `Blocked`.
150
96
 
151
97
  **Minimal check for non-trivial logic.** Any non-trivial change (a branch, a loop, a parser, a data transformation, a money or security path) must leave behind ONE runnable check — the smallest thing that fails if the logic breaks. An inline self-check, a quick `assert`-based demo, or one minimal test. No frameworks, no fixtures, no per-function suites unless asked. Trivial one-liners need none — YAGNI applies to tests too.
152
98
 
@@ -157,27 +103,13 @@ Micro template:
157
103
  Verify: [specific check]
158
104
  2. [Step]
159
105
  Verify: [specific check]
160
- 3. [Step]
161
- Verify: [specific check]
162
106
  ```
163
107
 
164
- **Verification discipline:**
165
-
166
- - **Test behavior, not implementation.** A test that checks whether a constructor sets properties is worthless. A test that checks whether validation actually rejects bad input is valuable. Focus on the interesting cases.
167
- - **If you cannot write a test, say why.** "I cannot easily test this because the database calls are tightly coupled to the business logic" is useful information that may signal a need for restructuring. Do not skip testing without an explanation.
108
+ **Verification discipline**: test behavior, not implementation (a test checking whether a constructor sets properties is worthless; one checking whether validation rejects bad input is valuable — focus on interesting cases). If you cannot write a test, say why ("I cannot easily test this because the database calls are tightly coupled to the business logic" may signal a need for restructuring — do not skip testing without an explanation).
168
109
 
169
110
  ## 6) Review Feedback Handling
170
111
 
171
- Core idea: review feedback is technical input, not an order to perform unverified edits.
172
-
173
- When receiving code review, QA, CI, or human feedback:
174
-
175
- 1. Read all feedback before editing.
176
- 2. Clarify ambiguous items before partial implementation.
177
- 3. Verify each suggestion against codebase reality.
178
- 4. Apply technically correct feedback one item at a time.
179
- 5. Test each fix individually where practical.
180
- 6. Push back with evidence when feedback is incorrect, obsolete, risky, out of scope, or violates YAGNI.
112
+ Review feedback is technical input, not an order to perform unverified edits. When receiving code review, QA, CI, or human feedback: read all feedback before editing; clarify ambiguous items before partial implementation; verify each suggestion against codebase reality; apply technically correct feedback one item at a time; test each fix individually where practical; push back with evidence when feedback is incorrect, obsolete, risky, out of scope, or violates YAGNI.
181
113
 
182
114
  Feedback priority:
183
115
 
@@ -192,22 +124,16 @@ Do not perform agreement. State the technical action, the verification result, o
192
124
 
193
125
  ## 7) Communication
194
126
 
195
- Core idea: how you communicate about code matters as much as the code itself.
196
-
197
- - **Say what you did and why.** Do not just dump a code block. "I moved the validation into a separate function because it was duplicated in three places and this makes it testable independently"now the reviewer understands the change without reading every line.
198
- - **Flag concerns proactively.** If you implemented what was asked but see a problem, say so. "This works but it makes a database call per item if the list grows large this will be slow. Want me to batch it?" saves hours later.
199
- - **Be precise about uncertainty.** "I am not sure if this library supports streaming responses" is useful. "I think this should work" is not. Tell the reviewer exactly what to verify.
200
- - **Match your explanation to context.** If they asked for a REST endpoint, do not explain what REST is. If they asked for a database index, do not explain what indexes do.
201
- - **Write specific commit messages.** "Fix bug" is useless. "Fix null pointer in user lookup when email contains uppercase chars" tells the next person exactly what happened.
127
+ - **Say what you did and why** — not just a code dump ("moved validation into a separate function because it was duplicated in three places and this makes it testable independently").
128
+ - **Flag concerns proactively** ("this works but makes a DB call per item — if the list grows large this will be slow; want me to batch it?").
129
+ - **Be precise about uncertainty** ("I'm not sure if this library supports streaming responses" is useful; "I think this should work" is nottell the reviewer exactly what to verify).
130
+ - **Match explanation to context** do not explain REST to someone who asked for a REST endpoint, or indexes to someone who asked for an index.
131
+ - **Write specific commit messages** "Fix null pointer in user lookup when email contains uppercase chars", not "Fix bug".
202
132
 
203
133
  ## Integration Notes
204
134
 
205
135
  - **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.
206
- - This skill must not be used to bypass:
207
- - branch constraints,
208
- - QC/QA gate definitions,
209
- - assignment authority,
210
- - `Done` ownership rules.
136
+ - This skill must not be used to bypass branch constraints, QC/QA gate definitions, assignment authority, or `Done` ownership rules.
211
137
 
212
138
  ## Anti-Bloat Rule for Prompt Maintenance
213
139