@mstar-harness/dsh 3.10.0 → 3.10.2

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.
@@ -42,25 +42,25 @@ Start a new Morning Star harness iteration. **Phase 1 is not complete until the
42
42
 
43
43
  | 宿主上下文 | 走哪条 |
44
44
  |------------|--------|
45
- | **Cursor Plan mode**(CreatePlan / Plan 会话活跃) | §0 Boot → **§P** — **先**空白 CreatePlan,再 **feedback-driven** 自主改同一份 plan;grill-me **仅**在用户明确结束反馈后、仍有阻塞疑问时;**Build 前不执行** Review 链 / commit / integration 分支 |
46
- | **其它**(Agent、OpenCode、非 Plan) | §0 Boot → §1–§6(Research → Explore → grill-me → Write → Review → branch) |
45
+ | **宿主 Plan mode**(Plan 会话活跃) | §0 Boot → **§P** — **先**空白 session plan,再 **feedback-driven** 自主改同一份 plan;grill-me **仅**在用户明确结束反馈后、仍有阻塞疑问时;**Build 前不执行** Review 链 / commit / integration 分支 |
46
+ | **其它**(非 Plan 会话) | §0 Boot → §1–§6(Research → Explore → grill-me → Write → Review → branch) |
47
47
 
48
48
  **Both paths converge at §6**(integration worktree)。Default → §7 auto-continue Phase 2→6;`pause` → command ends at §6.
49
49
 
50
50
  ## 0. Boot
51
51
 
52
- 按 **`mstar-iteration`** Load order 加载(`mstar-harness-core` → `mstar-roles` → `references/project-manager.md` → `mstar-iteration`(route map:start → **`references/phase-1-prepare.md`**)+ `mstar-phase-gates` + `mstar-dispatch-gates` + `mstar-conventions/artifacts` + `mstar-host` → active host reference)。Cursor Plan mode 另读 **`cursor-plan-mode-bridge.md`**(`mstar-iteration` Phase 1 in Plan mode)。完整 load list → **`mstar-roles`**。
52
+ 按 **`mstar-iteration`** Load order 加载(`mstar-harness-core` → `mstar-roles` → `references/project-manager.md` → `mstar-iteration`(route map:start → **`references/phase-1-prepare.md`**)+ `mstar-phase-gates` + `mstar-dispatch-gates` + `mstar-conventions/artifacts` + `mstar-host` → active host reference)。Plan 会话另读 **active host reference 的 plan-mode bridge**(`mstar-iteration` Phase 1 in Plan mode)。完整 load list → **`mstar-roles`**。
53
53
 
54
- **若 Cursor Plan mode 活跃 → 进入 §P;否则继续 §1。**
54
+ **若宿主 Plan mode 活跃 → 进入 §P;否则继续 §1。**
55
55
 
56
- ## P. Cursor Plan mode(Phase 1 scaffold → feedback loop → deferred grill → Build)
56
+ ## P. 宿主 Plan mode(Phase 1 scaffold → feedback loop → deferred grill → Build)
57
57
 
58
- Execute **`mstar-host/references/cursor-plan-mode-bridge.md`** § **"mstar-iteration Phase 1 in Plan mode"**(Detect / 语义 / Single CreatePlan URI(HARD)/ Research → Early CreatePlan → Feedback loop → Feedback-close deferred grill → Pre-Build / Build 全流程 SSOT)。
58
+ Execute **`mstar-host`** → active host 的 **plan-mode bridge**(其 "mstar-iteration Phase 1 in Plan mode" 等价节:Detect / 语义 / single session-plan(HARD,只允许一份)/ Research → early session plan → Feedback loop → Feedback-close deferred grill → Pre-Build / Build 全流程 SSOT)。
59
59
 
60
60
  Command-unique 补充(bridge 未枚举):
61
61
 
62
62
  - **空白脚手架字段**:Direction / Scope / Acceptance Criteria / Non-Goals / Delivery Branch Policy(`iteration_base_branch` / `spec_integration_branch` / `target_branch`)/ Plans / Feedback log / Deferred grill log
63
- - **Build 才勾的 todos**(顺序):`harness-init` → `finalize-compass-plans`(同一 CreatePlan 落成 compass + plans + `status.json` 登记 + 索引)→ review-edit-product-manager → review-edit-architect → review-edit-writing-specialist → `pm-lock` → `integration-branch`
63
+ - **Build 才勾的 todos**(顺序):`harness-init` → `finalize-compass-plans`(同一 session plan 落成 compass + plans + `status.json` 登记 + 索引)→ review-edit-product-manager → review-edit-architect → review-edit-writing-specialist → `pm-lock` → `integration-branch`
64
64
 
65
65
  ## 非 Plan 路径从这里继续 ↓
66
66
 
@@ -74,7 +74,7 @@ Scope **2–4** candidates targeting **product completeness**(default to defer
74
74
 
75
75
  ## 3. Lock Direction — bundled `grill-me`
76
76
 
77
- > **非 Plan 路径**。Cursor Plan mode 用 §P feedback loop + deferred grill(主路径不是 grill)。
77
+ > **非 Plan 路径**。Plan mode 用 §P feedback loop + deferred grill(主路径不是 grill)。
78
78
 
79
79
  **Direction lock mode: `interactive`**(`mstar-iteration/references/phase-1-prepare.md` §1.2 默认;本命令不使用 `autonomous`)。This command bundles a **non-`mstar-*`** skill at `skills/grill-me/SKILL.md` — **only this command step** references it.
80
80
 
@@ -86,7 +86,7 @@ Produce harness artifacts per **`mstar-iteration/references/phase-1-prepare.md`
86
86
 
87
87
  ## 5. Review & Edit Chain(HARD GATE — do not commit before this)
88
88
 
89
- Execute **`mstar-iteration/references/phase-1-prepare.md` §1.6**(SSOT):顺序 `product-manager` → `architect` → `writing-specialist` → PM lock(**禁止**并行三 roles;OpenCode plain role id — `mstar-host/references/opencode.md`);**禁止** `{KNOWLEDGE_DIR}/` 新增;writing-specialist corpus hygiene(`iteration-artifact-boundaries.md` + `iteration-corpus-hygiene.md`)。Tool rule → **`mstar-dispatch-gates`** specialist review-and-edit(每 role 1 invoke,等磁盘修订返回)。Exception: user explicitly waives subagent dispatch ("PM-only review").
89
+ Execute **`mstar-iteration/references/phase-1-prepare.md` §1.6**(SSOT):顺序 `product-manager` → `architect` → `writing-specialist` → PM lock(**禁止**并行三 roles;角色名提及写法 → active host reference);**禁止** `{KNOWLEDGE_DIR}/` 新增;writing-specialist corpus hygiene(`iteration-artifact-boundaries.md` + `iteration-corpus-hygiene.md`)。Tool rule → **`mstar-dispatch-gates`** specialist review-and-edit(每 role 1 invoke,等磁盘修订返回)。Exception: user explicitly waives subagent dispatch ("PM-only review").
90
90
 
91
91
  **Assignment preflight**:每次 invoke 前按 **`mstar-iteration/references/command-shared-invariants.md`** 执行(warn-only + `enforcement: hard` fail-fast;bin 缺失静默跳过)。
92
92
 
@@ -105,11 +105,15 @@ PM must print this block before §6; all `[ ]` must be `[x]`:
105
105
  - [ ] product-manager / architect / writing-specialist invokes completed — 编辑 compass / plans / specs / **`<iteration-id>/` package**;**未**向 `{KNOWLEDGE_DIR}/` 新增
106
106
  - [ ] PM final lock: compass `status: locked`; Prepare gates pass (blocked plans documented)
107
107
  - [ ] Branch policy locked: `iteration_base_branch` / `spec_integration_branch` / `target_branch` recorded in compass / `status.json`
108
- - [ ] **THEN**: transfer reviewed changes + commit + push `iteration/<iteration-id>` **in the integration worktree** (never the primary checkout)
108
+ - [ ] **THEN**(§6 按 §2.3 checklist step 7 执行):已 review 的本轮改动在该 integration checkout 上 commit,`iteration/<iteration-id>` 已 push —— never the primary checkout
109
109
 
110
110
  ## 6. Integration Branch
111
111
 
112
- Per **`mstar-iteration/references/phase-2-worktree-lease.md` §2.3**:create the **integration worktree** — a dedicated linked checkout **distinct from the primary checkout**(`git worktree add <path> -b <spec_integration_branch> <iteration_base_branch>`;primary 分支**不**切换);register `iteration_base_branch` / `spec_integration_branch` / `target_branch` in compass frontmatter **and** `status.json` metadata;record the observed primary branch as **`Main worktree branch`** in the main plan header;**transfer only the reviewed §5 changes** into the integration worktree, commit there, then restore the primary checkout's corresponding uncommitted docs without switching its branch(Phase-1 bounded exception → `phase-1-prepare.md` §1.6;**不得**搬运无关用户改动);push。**STOP** if `iteration_base_branch` / `target_branch` missing — never default `main`/`master`.
112
+ **Call site — do not restate the sequence.** Execute **`mstar-iteration/references/phase-2-worktree-lease.md` §2.3**「Integration worktree (Phase 2 entry) + control root」checklist **steps 1–7** —— 该 checklist 是该序列的**唯一 home**。本命令另记两件 command 层事实:register `iteration_base_branch` / `spec_integration_branch` / `target_branch` in compass frontmatter **and** `status.json` metadata;record the observed primary branch as **`Main worktree branch`** in the main plan header。**STOP** if `iteration_base_branch` / `target_branch` missing — never default `main`/`master`。
113
+
114
+ **Phase 1 完成 anchor(pointer only — 本命令不承载 marker)**:checklist **step 7** 走完后必须执行 `phase-1-lock` 的 host 动作 —— 其 marker 与触发条件由 **`mstar-iteration/references/phase-2-worktree-lease.md` §2.3**「Integration worktree (Phase 2 entry) + control root」checklist tail 承载。
115
+
116
+ **Parenthetical**:本处引用的 §2.3 是 **Phase 1** 步骤 —— 它**不**触发 `phase-2-entry` anchor(后者只在 Phase 2 execute/resume entry、即 §2.4 之前触发);Phase 2 resume 再次走到 §2.3 时 `phase-1-lock` 已在 Phase 1 完成,不再重复调用。
113
117
 
114
118
  ---
115
119
 
@@ -85,6 +85,10 @@ Each task fits **one focused implementer round** — the round closes the task's
85
85
  - **Split strategies** — apply the review split shapes (`mstar-audit/references/pr-review.md` § Sizing & change shape) to task boundaries, each slice with explicit interfaces and independent proof: stack · by file group · horizontal (shared code first) · vertical (full-stack slices). They shape task boundaries; PR line-count thresholds stay review-owned.
86
86
  - **Verification is not the shock absorber** — **Budget pressure MUST NOT shorten or waive any assigned scoped verification.** If the round cannot close, stop and report for split/re-dispatch instead of cutting checks.
87
87
 
88
+ ### 8. Engine lifecycle ownership
89
+
90
+ **Who advances this row's engine state, at which step, and what evidence records each transition?** The plan answers it explicitly: the scoped verb sequence it will be driven through, the delivery-tail evidence order (`compound` disposition → PR identity → verified merge, recorded **after** the row is `Done`), and — when the snapshot declares no integration anchors — that the row stops at an accepted handoff rather than promising a terminal state it cannot reach. Semantics → `mstar-artifacts/references/plan-workflow-lifecycle-contract.md`; PM step sequence → `mstar-roles/references/project-manager/plan-management.md`.
91
+
88
92
  ## Relationship to existing plan elements
89
93
 
90
94
  | This quality bar | Existing mstar element |
@@ -96,6 +100,7 @@ Each task fits **one focused implementer round** — the round closes the task's
96
100
  | Drift check | SDD `BASE_SHA` — generalized to all plans |
97
101
  | Done criteria | `plan.main.md` per-step checkboxes — elevated to machine-checkable |
98
102
  | Task shape / session fit | `plan.main.md` per-task **Effort (agent-oriented)** / **Split point** slots + `mstar-phase-gates` capacity quick-check — one-round Files-plus-gates closure per task |
103
+ | Engine lifecycle ownership | `plan.main.md` **Engine lifecycle** block — scoped verb sequence, delivery-tail evidence order, and the no-integration-anchors conditional |
99
104
 
100
105
  ## When to apply
101
106
 
@@ -16,6 +16,16 @@
16
16
 
17
17
  [Project requirements — version floors, naming, exact values — copied verbatim from spec. Every task includes them. Verification scope follows `mstar-harness-core` § 定向执行与验证边界: only changed behavior and direct contracts; no local full suites without explicit user permission. Never assign real-browser/device/installed-deployment E2E evidence as a task or a gate of a development plan; each layer proves itself with its own unit/integration tests. Real-environment verification lives only in a separately requested `mstar-e2e` workflow, whose named scenarios are that workflow's own plan rows.]
18
18
 
19
+ ## Engine lifecycle
20
+
21
+ Who advances this plan row's engine state, and what records each transition:
22
+
23
+ - **Scoped sequence** — one engine verb per transition; never a hand-edited snapshot: `bind --coordinator` → `prepare` → `bind` → `progress` → `handoff` → `accept` → `integration-start` → Git merge → `integration-accept` → `complete`.
24
+ - **Evidence order** — `compound` disposition, PR identity and merge evidence are recorded **after** the row is `Done`; the engine refuses those writes while any plan row is not `Done`. The delivery tail runs on a completed row, never ahead of it.
25
+ - **Snapshot declares no integration anchors** → the row cannot reach `Done` today: stop at a submitted/accepted handoff, report the blockage to the coordinator, and never fabricate a terminal state (`Done`, `completed`, PR identity, merge record).
26
+
27
+ Semantics and failure behavior → `mstar-artifacts/references/plan-workflow-lifecycle-contract.md`; PM step sequence → `mstar-roles/references/project-manager/plan-management.md`.
28
+
19
29
  ---
20
30
 
21
31
  ### Task 1: [Component Name]
@@ -21,7 +21,7 @@ description: Morning Star 派发与委派门禁 —— 仅 PM 可增派 subagent
21
21
 
22
22
  **共享红线**(doc-level 并行拆分 ≠ N 个 subagent;Handoff / 路由措辞 / 角色提及 ≠ invoke;工具可用 ≠ 授权;仅 PM 可分派;非 `Delegation: allowed` 不得调用同角色 / 兄弟角色)以 **`mstar-roles/references/_shared/leaf-executor-core.md`**「Shared anti-recursion NEVER」+「Non-Recursive Dispatch Rule (shared shape)」为唯一权威清单(standard preset 下已随角色 ref 在上下文中;explicit `none` 下该 leaf 边界仍可达)。本节保留 dispatch 专属条目:
23
23
 
24
- - **NEVER** 在本会话内调用 Task / subagent,且其 `subagent_type` **等于**你当前的 **`Execute as`** 角色 id(同角色递归)。
24
+ - **NEVER** 在本会话内调用 Task / subagent,且其角色绑定字段**等于**你当前的 **`Execute as`** 角色 id(同角色递归)。
25
25
  - **DO NOT** 在 Assignment 缺少 `Execute as` / `Delegation` / `Who runs this turn` 时自行「补齐」为 PM;缺字段时按 **leaf executor** 解释:亲自完成或 **`Blocked`**。
26
26
  - **DO NOT** 用「Assignment 太长 / 像编排稿」当作分派依据;先交付本会话任务再回报,分派由 PM 下一轮决定。
27
27
 
@@ -29,12 +29,12 @@ description: Morning Star 派发与委派门禁 —— 仅 PM 可增派 subagent
29
29
 
30
30
  1. 我此刻的 **`Execute as`** 是什么?
31
31
  2. Assignment 是否写了 **`Delegation: allowed (...)`**?没有 → **禁止**任何 Task / subagent。
32
- 3. 下一动作是不是「Task / subagent_type=…」?是 → 停手,改为 Read / Write / Shell / Edit,或 **`Blocked`**。
32
+ 3. 下一动作是不是「发起一次带角色绑定字段的 invoke」?是 → 停手,改为 Read / Write / Shell / Edit,或 **`Blocked`**。
33
33
  4. 命中任一 NEVER → 写 `## Blocked — recursive dispatch refused (<which NEVER>)` 回报 PM,**不**继续 invoke。
34
34
 
35
35
  **Assignment 顶部反模式块**:每个 PM Assignment 开头均有 **`**You are a leaf executor. You MUST NOT:**`** 块(含 IDENTITY + CAPABILITY BOUNDARY + prohibitions),PM 按此 Assignment 的角色+上下文定制反模式清单。leaf executor 收到 Assignment 后须 **首先** 阅读该块;命中任一条 → **停止**(亲自完成或 `Blocked`)。详见 **`mstar-roles/references/project-manager/dispatch-and-assignment.md`**。
36
36
 
37
- > **Engine 执行范围(caller-scoped,#156)**:engine `antiRecursionPrecheck` 比较的是**派发方自身角色**(caller)与新 Assignment 的 `Execute as`(target)。只有 **dsh**(Config `dispatchBinding`)能观察派发方身份并在 engine 层硬执行(含 `callerRequired` 空绑定 fail-closed);omp / OpenCode / Cursor 的角色绑定字段是**派发目标**——目标 == `Execute as` 正是 C5 合规派发模式——这些宿主上红线保持 prompt 级约束(本节),engine 不做判定。
37
+ > **Engine 执行范围(caller-scoped,#156)**:engine `antiRecursionPrecheck` 比较的是**派发方自身角色**(caller)与新 Assignment 的 `Execute as`(target)。能否在 engine 层做这个判定取决于宿主是否向 engine 提供派发方身份(dispatcher binding):**提供方**在 hard enforcement 下真正硬执行(含 caller 空绑定 fail-closed);**不提供方**的角色绑定字段携带的是**派发目标**——目标 == `Execute as` 正是 C5 合规派发模式——这些宿主上红线保持 prompt 级约束(本节),engine 不做判定。当前宿主属于哪一类、字段名与 fail-closed 细节 → 当前宿主的 **`mstar-host` reference**(角色绑定字段 / engine 判定范围两行)。
38
38
 
39
39
  ## Plan 作用域与 credential 不下发(preflight 强制)
40
40
 
@@ -42,14 +42,14 @@ description: Morning Star 派发与委派门禁 —— 仅 PM 可增派 subagent
42
42
 
43
43
  - **子 Assignment 继承父 plan 作用域**:`plan_id` + 绝对 `Plan Path`(L1 另含 `SDD dir` / `Control harness root`)逐字下发。child **不得**自选或新建 plan、写 workflow snapshot / root register / 共享索引、释放 `execution_lease` / `integration_merge_lease`。缺失、相对路径或暗示「child 自行选 plan」= **派发未完成**(`mstar-roles/references/project-manager/dispatch-and-assignment.md` § Assignment Template `Plan scope`)。
44
44
  - **credential 不下发 leaf**:session JSON 路径、`mstar plan --session` 写凭据、`--expect <revision>` 等**只由派发方(PM/coordinator)持有**。leaf 拿到 session 路径或写凭据即视为越权 → 停止并回报(`mstar-iteration/references/plan-scoped-pm.md` §8)。
45
- - **`project-manager` 不是派发目标**:PM 是 primary-session 角色,无 subagent shell(规则家 → `mstar-roles/references/project-manager.md` § Plan-scoped authority;宿主派发面 → `mstar-host/references/omp.md` § C5);scoped primary drive(`/iteration-drive --assignment | --workflow --plan | --resume`)在**主会话**启动 PM,不是 subagent。任何 `Execute as: project-manager` 的 invoke = 派发缺陷。
45
+ - **`project-manager` 不是派发目标**:PM 是 primary-session 角色,无 subagent shell(规则家 → `mstar-roles/references/project-manager.md` § Plan-scoped authority;宿主派发面 → 当前宿主的 **`mstar-host` reference**(角色绑定 / 派发小节));scoped primary drive(`/iteration-drive --assignment | --workflow --plan | --resume`)在**主会话**启动 PM,不是 subagent。任何 `Execute as: project-manager` 的 invoke = 派发缺陷。
46
46
 
47
47
  ## 调度防串扰(强制;leaf executor 已在上方读过反递归红线,此处为完整规则供 PM/对照用)
48
48
 
49
49
  - 只有 **`project-manager`** 可以决定增加/并行 subagent;承接方**默认不得二次分派**。
50
- - **`Execute as: <role-id>`** = 承接方**亲自**完成本单,**不是**再起同名 subagent 或嵌套同 `subagent_type` 的 Task(禁止**递归误派**)。
50
+ - **`Execute as: <role-id>`** = 承接方**亲自**完成本单,**不是**再起同名 subagent 或嵌套同角色绑定字段的 Task(禁止**递归误派**)。
51
51
  - 额外代理仅以 **`Delegation: allowed (...)`** 为准;未显式写时视为 **`Delegation: forbidden`**。
52
- - Assignment 正文中的 role 引用:默认 **plain id**(`product-manager`);OpenCode 见 **`mstar-host/references/opencode.md`** § Role-mention hygiene。
52
+ - Assignment 正文中的 role 引用:默认 **plain id**(`product-manager`)。个别宿主会把堆叠的角色提及扩写成系统行——该宿主的 mention hygiene 规则见其 **`mstar-host` reference**。
53
53
  - 承接方若判断必须增加 subagent,应先回报 **`Blocked`** 请 PM 重分派。
54
54
  - Per-task informal review, when PM explicitly allows it, must not use `qc-specialist*`; use `code-reviewer` (generic fallback only when the role agent is absent on the host) or PM-marked informal `qa-engineer`. Formal QC remains `mstar-review-qc`.
55
55
 
@@ -64,7 +64,7 @@ description: Morning Star 派发与委派门禁 —— 仅 PM 可增派 subagent
64
64
  - **QC 单席(例外)**:`Execution mode: inline`(hotfix 等),或 Assignment 显式 `QC mode: single` / `QC mode: single — override: <reason>` → `qc-specialist` ×1,`N=1`,写 `{SDD_DIR}/review/qc.md`。
65
65
  - **QC targeted re-review**:Assignment 含 **`QC re-review: targeted — reviewers: …`** 时,**N** = 所列席位数(1–3),同条消息发满 **N**。
66
66
  - **先自检再发送**:发送前核对「Assignment 条数 = 本条消息中的实际 **派发** 调用条数」。
67
- - **先自检字段再发送(与 count 同级门禁)**:核对**每条** invoke 都携带与 **`Execute as`** 匹配的角色绑定字段——omp **`agent`** / Cursor **`subagent_type`** / OpenCode **`subagent`** / Kimi·ZCode **`subagent_type`**;宿主列以 **`mstar-host`** §Detect active host 的 tool-shape 检测为准(禁以 config 路径/仓库内容判定)。**漏写或取默认通用值**(omp 漏 `agent` ⇒ 自动回退 generic `task`,无报错)= **派发未完成**,与 paste-only(零 invoke)**同等级**:当场补齐重发,不得进入下一 gate。**N=1 顺序链(Review & Edit)不豁免**——count 门在 N=1 恒过,**字段门是唯一保护**。
67
+ - **先自检字段再发送(与 count 同级门禁)**:核对**每条** invoke 都携带与 **`Execute as`** 匹配的角色绑定字段——**字段名以当前宿主的 `mstar-host` reference 为准**(共享文本不假定任何宿主的字段名);宿主判定以 **`mstar-host`** §Detect active host 的 tool-shape 检测为准(禁以 config 路径/仓库内容判定)。**漏写或取默认通用值**(部分宿主会**静默回退 generic worker**、无报错)= **派发未完成**,与 paste-only(零 invoke)**同等级**:当场补齐重发,不得进入下一 gate。**N=1 顺序链(Review & Edit)不豁免**——count 门在 N=1 恒过,**字段门是唯一保护**。
68
68
  - **前置步骤与派发回合分离(防串行 rollout)**:为派发准备的 **`bash` / `read` / `glob` / `grep`**(如 `merge-base`、`Review range`、`git rev-parse`)**不计入** `N` 次派发;可在上一条仅含准备的消息完成。准备完成后,**下一条派发消息**须**一次性**含 **`N` 次** Task / subagent invoke。**禁止**先发 `1` 次、等返回再补发其余 `N-1` 次。
69
69
  - **未齐不发(emit zero until batch-ready)**:宿主支持批调用且需并发 `N≥2` 而当前 payload 只齐 `1` 条时,本条应发 **`0` 条派发 invoke`**(可继续 read/bash 补齐),**禁止**「先发一个顶一下」;`N` 份 payload 就绪后**单次消息发满 `N`**。见 **`mstar-host`** → `references/parallel-dispatch.md`(具备 invoke / Task / subagent 工具的宿主共用)。
70
70
 
@@ -128,7 +128,7 @@ When **`Execution mode: sdd`** (`mstar-sdd`):
128
128
  - Review-and-edit 链未完成即 commit integration 分支;PM 代做专业角色编辑而不 invoke。
129
129
  - Phase 1 review-and-edit 链三角色并行派发,或未等上一角色返回即派发下一角色。
130
130
  - Assignment 已写、invoke 为零(paste-only)却进入下一 gate。
131
- - Task/subagent item 漏写角色绑定字段(omp 漏 `agent` / Cursor 漏 `subagent_type` / OpenCode 漏 `subagent`)⇒ **静默回退 generic worker**,却因 count=N 通过而误判「派发完成」;属 paste-only 同级的 **dispatch-incomplete**。N=1 顺序 Review-&-Edit 链最易在此漏字段。
131
+ - Task/subagent item 漏写角色绑定字段(字段名与静默回退行为以当前宿主的 `mstar-host` reference 为准)⇒ **静默回退 generic worker**,却因 count=N 通过而误判「派发完成」;属 paste-only 同级的 **dispatch-incomplete**。N=1 顺序 Review-&-Edit 链最易在此漏字段。
132
132
 
133
133
  ## Workflow
134
134
 
@@ -47,7 +47,7 @@ description: Morning Star (启明星) harness **生命周期 / 授权语义权
47
47
  | **实现/审查/运维** | 本 skill + `mstar-coding-behavior` + 角色 ref | 有 git 写:`mstar-branch-worktree`;有 plan 路径:`mstar-conventions`;**PM** 派 QC 前:`mstar-review-qc`;**`qc-specialist*`**:`mstar-roles` → `references/qc-specialist/`;`qa-engineer`:`references/qa-engineer/`;改 status/residual:`mstar-artifacts`;UI:`mstar-design-md`;知识库:`mstar-compound`(PM) |
48
48
  | **leaf 承接方** | 上栏 + **`mstar-dispatch-gates`**(反递归节) | — |
49
49
 
50
- Routing eval(Cursor 插件内回归用,**非**运行时必读)→ `.cursor/skills/mstar-routing-eval/`。
50
+ Routing eval(宿主插件内回归用,**非**运行时必读)→ `.cursor/skills/mstar-routing-eval/`。
51
51
 
52
52
  ## 状态机
53
53
 
@@ -114,20 +114,12 @@ PM 在 Assignment 写 **`Task category`**(主类 + 可选 `secondary`):
114
114
 
115
115
  ## 宿主 `mstar-host`
116
116
 
117
- Read **`mstar-host`** after this skill; detect host per its table, then Read the matching reference.
118
-
119
- | 宿主 | 要点 |
120
- |------|------|
121
- | OpenCode | `question`、**task tool**(**subagent** 参数)→ `references/opencode.md` |
122
- | Cursor | Task 并行 QC;Plan 双写 → `references/cursor.md` · `cursor-plan-mode-bridge.md` |
123
- | Codex | plugin skills、sandbox/apply_patch/tool discovery;无 invoke 工具时不声称 subagent dispatch → `references/codex.md` |
124
- | Kimi | `Agent`/`AgentSwarm`(仅 `coder`/`explore`/`plan`);角色绑定在 prompt(C5b);Plan 双写 → `references/kimi.md` · `kimi-plan-mode-bridge.md` |
125
- | 其它 | 同 `mstar-host` skill;按工具信号选 reference |
117
+ Read **`mstar-host`** after this skill; it detects the active host and routes to the matching reference — host names, tool shapes and per-host entry details live only there(本表不重复维护)。
126
118
 
127
119
  ## 版本对齐(CLI ↔ host 插件)
128
120
 
129
121
  - 全局 CLI 与已安装的宿主插件**独立升级**;版本漂移是已知故障源(skills/commands 与 CLI 预期不再匹配)。
130
- - 检查:`mstar-harness doctor --target <host>`(全部宿主已实现:opencode / cursor / codex / zcode / omp / dsh / kimi)。
122
+ - 检查:`mstar-harness doctor --target <host>`(各宿主 target 名 = `mstar-host` 检测表中该宿主的 id;已实现的宿主以 `mstar-host` 与 CLI `--help` 为准)。
131
123
  - **CLI 较新** → 提示用户更新宿主插件;**插件较新** → 提示用户更新全局 CLI(`npm i -g @mstar-harness/cli@latest`)。
132
124
  - 触发纪律:harness 行为异常/疑似过期、已知新版本发布后、或用户要求时运行——**不是**每个会话都跑。
133
125
 
@@ -64,7 +64,40 @@ Goal text is a session-level objective only: `{HARNESS_DIR}` / `{PLAN_DIR}` / `s
64
64
 
65
65
  At **every phase transition** (Prepare → Execute → InReview waves → Phase 3 close → Phase 4 PR → Phase 5 merge-ready → Phase 6 post-merge; likewise per-plan gate crossings), the PM refreshes the host session `todo` list **before the next action or dispatch**: close only the finished phase's **completed** entries, preserve any still-pending gate or future-phase item, and append the next phase's entries. Scoped primary sessions project only their assigned plan through handoff — never global Phase 3–6 tasks (`mstar-iteration` `references/command-shared-invariants.md` § Session todos; `references/phase-2-worktree-lease.md` §2.1).
66
66
 
67
- `todo` entries are a projection, not SSOT: they reflect existing snapshot phase / plan states and named plan/gate evidence, and cannot authorize or invent a state transition. Snapshot and plan artifacts remain the state authorities; this is freshness discipline, not a new host hook, tool, or deterministic enforcement mechanism.
67
+ `todo` entries are a projection, not SSOT: they reflect existing snapshot phase / plan states and named plan/gate evidence, and cannot authorize or invent a state transition. Snapshot and plan artifacts remain the state authorities; this is freshness discipline, not a new host hook anchor, tool, or deterministic enforcement mechanism.
68
+
69
+ ## Host hooks (anchor contract)
70
+
71
+ Shared lifecycle skills name **host-agnostic anchors** — named moments at which the active host obliges the PM to run a host-defined coordinator action. The anchor vocabulary is frozen and carries no host identity: tool names, exact parameters, prerequisites, refusal codes, native settings and auto-trigger scope live **only** in `references/<host>.md`.
72
+
73
+ | Anchor | Moment |
74
+ |--------|--------|
75
+ | `iteration-entry` | first preparation action of a new iteration — reached only once the workflow is registered and its id known |
76
+ | `phase-1-lock` | Phase 1 completion — once the integration worktree exists, the reviewed changes are committed there and that branch is pushed (the PM lock alone is not the moment) |
77
+ | `phase-2-entry` | the Phase 2 execute/resume entry — after the §2.0 gates, before the per-plan loop; **not** the Phase-1-reused integration-worktree step |
78
+ | `rescheduling-checkpoint` | each `Rescheduling checkpoint` re-evaluation |
79
+
80
+ **Execution rule.** At each anchor the PM executes whatever the **active host reference** declares under its own `## Host hooks` section for that anchor. A host reference that declares nothing for an anchor means **no-op**: never invent an action, never substitute another host's declaration, and never treat an absent declaration as permission to skip the anchor's shared step.
81
+
82
+ **Marker form.** A shared file that owns an anchor carries a comment marker plus a one-line pointer — neither names a host or a tool:
83
+
84
+ ```markdown
85
+ <!-- host-hook: <anchor> -->
86
+ > Execute the active host reference's `## Host hooks` declaration for `<anchor>`; this file defines no host action.
87
+ ```
88
+
89
+ Carrier locations — the four markers in the shared corpus (all four live under `skills/`, never in `commands/`):
90
+
91
+ | File | Location | Anchor |
92
+ |------|----------|--------|
93
+ | `mstar-iteration/references/phase-1-prepare.md` | §1.5 tail, after the v2 status registration (the workflow id exists there) | `iteration-entry` |
94
+ | `mstar-iteration/references/phase-2-worktree-lease.md` | §2.3 「Integration worktree (Phase 2 entry) + control root」 checklist tail, after step 7 (transfer + commit + push) — the Phase 1 route reaches it through `iteration-start` §6, which carries a pointer only | `phase-1-lock` |
95
+ | `mstar-iteration/references/phase-2-worktree-lease.md` | immediately before the `## 2.4 Per-plan loop` heading (the Phase 2 execute/resume entry; §2.3 is the Phase-1-reused step and triggers nothing) | `phase-2-entry` |
96
+ | `mstar-iteration/references/phase-2-worktree-lease.md` | `### Rescheduling checkpoint` | `rescheduling-checkpoint` (the five frozen reason names are handed off verbatim) |
97
+
98
+ **Prohibition (shared text — incremental rule).** **New or modified** shared-layer text — everything under `skills/**` except `skills/mstar-host/**`, plus `commands/**` — MUST NOT introduce a host name (`omp`, `oh-my-pi`, `dsh`, `OpenCode`, `Cursor`, `Codex`, `Kimi`, `ZCode`), a host tool/field name (`subagent`, `subagent_type`, `tasks[]`, `ask`, `hub`), a native settings key (`modelHandoff`, `phase2PlanInstances`, `maxPlanInstances`), or an extension file name. Capability phrasing ("when the host exposes an invoke tool") is the only permitted form for new text; host names belong to this skill and `references/<host>.md`.
99
+
100
+ **Enforcement surface.** The check applies to **the files a change touches**, never to the whole corpus: shared text that already violates the rule and is not part of the current change is **out of scope of the rule's enforcement** and is cleared in batches under roadmap goal **`host-seam-corpus-cleanup`** (`{PROJECT_DIR}/_default/roadmap.md`). Until that cleanup completes, a whole-tree grep over shared text is **not** a valid assertion for this rule — judge a change on the shared-layer text it adds or edits.
68
101
 
69
102
  ## Resolve loaded skill root
70
103
 
@@ -67,6 +67,9 @@ When Assignment has **`SDD implementer session: sticky`** (`mstar-sdd/references
67
67
 
68
68
  Cursor PM dispatch = **`Task`** with `subagent_type` matching the Assignment `Execute as` role. Flat JSON field shape → **Task invoke schema (Cursor)** below.
69
69
 
70
+ **Role-binding field:** **`subagent_type`** (flat sibling of `prompt`) — must equal the Assignment `Execute as`.
71
+ **Engine scope (#156):** Cursor exposes no dispatcher identity, so the caller-scoped `antiRecursionPrecheck` leg is **skipped** on this host — the binding field carries the **spawn target**, and target == `Execute as` is the compliant C5 pattern — and the red line stays **prompt-level** (`mstar-dispatch-gates` § 承接方反递归红线). Caller-side hard enforcement exists only where the host declares a dispatcher binding (`dsh.md`).
72
+
70
73
  - **1 Assignment ⇒ 1 Task**; parallel batches ⇒ **N Tasks in one message** → **`parallel-dispatch.md`** (`mstar-dispatch-gates`).
71
74
  - Paste-only: Assignment Markdown **does not** start work; PM thread **must not** implement, review, or edit specialist deliverables by loading another role reference in the same session (`Acting as role: …` is **not** dispatch) → **`parallel-dispatch.md`** § Paste-only failure.
72
75
  - No callable `Task` / subagent for required work → **`Blocked`** — report to user; do not substitute in-thread execution.
@@ -321,6 +321,12 @@ assignees = N `subagent` calls = N independent delegations** (dispatch-gate
321
321
  dispatched Assignment). Paste-only Assignment without an invoke is **not**
322
322
  dispatch.
323
323
 
324
+ **Role-binding field:** none — binding is **prompt-only** on dsh (the tool has
325
+ no role field; the header region of the Assignment body is what the gate and
326
+ the role-persona channel read, so `Execute as` / `Act as` + skill load must be
327
+ in the prompt). A dispatch that drops those lines has no field to fall back on
328
+ — it is a bare delegation.
329
+
324
330
  **Execution: concurrent dispatch REQUIRES background mode.** The `subagent`
325
331
  tool does **not** declare `isConcurrencySafe` → fail-closed `exclusive`
326
332
  classification, so same-message invokes are issued one-at-a-time (the next
@@ -489,6 +495,15 @@ The dsh web client resolves slash commands against a client-side lexicon driven
489
495
  enforcement with no binding, the plugin logs the absence AND every
490
496
  Assignment-shaped dispatch fails closed (`dispatch.anti-recursion.
491
497
  empty-binding` → deny) until the binding is set.
498
+ - **Caller-scoped engine enforcement (the dsh-only half of issue #156).** That
499
+ binding is what makes the precheck real here: with a declared dispatcher
500
+ identity the engine compares the **dispatching seat's own role** against the
501
+ Assignment `Execute as` and hard-enforces it (`callerRequired` — an unset
502
+ binding fails closed, never skipped). Hosts whose reference declares **no**
503
+ dispatcher binding expose only the **spawn target** in their role-binding
504
+ field — and target == `Execute as` is the compliant C5 pattern — so there the
505
+ leg is skipped and the red line stays **prompt-level**
506
+ (`mstar-dispatch-gates` § 承接方反递归红线).
492
507
 
493
508
  ## Files, shell, and approvals
494
509
 
@@ -61,6 +61,9 @@ Morning Star role ids (`project-manager`, `fullstack-dev`, `qc-specialist`, …)
61
61
 
62
62
  Role-binding contract + Assignment template → **`_shared/host-role-binding-core.md`** (C5/C5b). Kimi-specific invoke shapes, same turn:
63
63
 
64
+ **Role-binding field:** **`subagent_type`** — but on Kimi it selects a **built-in** type (`coder` / `explore` / `plan`), not the role, so the role itself travels in the prompt (C5b).
65
+ **Engine scope (#156):** no engine dispatch gate observes caller identity here (the binding field carries a **built-in invoke type**, not the dispatching seat), so this red line stays **prompt-level** (`mstar-dispatch-gates` § 承接方反递归红线). Caller-side hard enforcement exists only where the host declares a dispatcher binding (`dsh.md`).
66
+
64
67
  ```text
65
68
  Agent(
66
69
  subagent_type: "coder",
@@ -79,6 +79,8 @@ Single-task shorthand may exist depending on host version — always match the l
79
79
 
80
80
  **Envelope-first**: write `agent` + `name` as the first fields of each `tasks[]` entry, before the long `task` body — the body crowds them out and `agent` gets silently dropped (omp defaults to generic `task`, no error). SSOT → `parallel-dispatch.md` § Mandatory order.
81
81
 
82
+ **Role-binding field (single home)**: OMP binds the dispatched role through the `tasks[]` entry field **`agent`** — `agent: "<Execute as role-id>"`, in the batch shape `task(context: "…", tasks: [{name, agent, task}])`. This field name is omp's; no other host's invoke tool uses it. A round that writes the role only in the prompt body has set no binding.
83
+
82
84
  ## Role agents (C5 — hard constraint)
83
85
 
84
86
  **Live `task` tool schema is SSOT every session.** Exact `agent` names vary by omp version and which `agents/*.md` were discovered after plugin install/link. Read the tool's Available Agents list before dispatch — do not invent names; do not hard-code stale tables over the live list.
@@ -233,7 +235,7 @@ A second extension entry from this package: `extensions/model-handoff.js` (manif
233
235
  | Scope | That panel lists **user-scope** installs; a project-scope npm install has no native row (host limitation, documented rather than worked around). Use the user-scope path — never double-install or add a private settings parser/UI. |
234
236
  | Supported entries | `/iteration-start`, `/iteration-loop`, and a natural-language / skill-driven start (`skill-start`) as labelled from the host's own `input` event. `/iteration-drive` in any form never arms — the scoped-plan route only restores the session's existing binding, and a start call after it is refused `scoped-plan-route`. |
235
237
  | Inert contexts | Ordinary chat, unrelated commands, leaf/subagent sessions (host `session_init` marker), plan-scoped PM sessions, other hosts, and an iteration whose coordinator never armed. |
236
- | PM binding | Tool `mstar_model_handoff`: the PM's **first preparation action** of a new iteration (`{operation:"start", workflowId:"<id>"}`) and the completion checkpoint (`{operation:"phase1-complete", …}`). Session identity, cwd, entry route, task-session state and coordinator authority are host-derived from the ledger, the workflow's own session envelopes and the root register; the call carries an explicit workflow id and nothing else. |
238
+ | PM binding | Tool `mstar_model_handoff`, executed at two host hook anchors — **`iteration-entry`** (`{operation:"start"}`) and **`phase-1-lock`** (`{operation:"phase1-complete"}`). Exact parameters, prerequisites, refusal codes and required-vs-optional per anchor → **§ Host hooks** below. Session identity, cwd, entry route, task-session state and coordinator authority are host-derived from the ledger, the workflow's own session envelopes and the root register. |
237
239
  | Ownership | One explicitly named workflow and control root own the coordinator. Missing, foreign or ambiguous ownership fails closed — no `workflows[0]`, latest-mtime, unique-new-row or "most recent" inference, and a concurrent sibling iteration stays untouched. Only the bound coordinator session changes model; role mappings, other sessions, subagents, goal objective and workflow snapshot status are never written. |
238
240
  | Full readiness | Fire requires the sequential specialist returns for that iteration, PM-confirmed Prepare gates for every registered plan with `compass status: locked`, a distinct same-repository integration checkout on its recorded branch, and a remote tip equal to the validated integration HEAD. `evaluatePhaseGate` is a later-phase gate and is never readiness evidence; a draft compass, a lock alone, a missing checkout or an unpushed commit is not ready. |
239
241
  | Cancellation | While pending, an unowned model change — history or live model — cancels the not-yet-executed switch, and the arm's own transition can never cancel it. Cancellation is deliberately conservative (it can also catch another extension's change; there is no exact user-selection event), and it never clears the saved preference. Navigation arriving during an invoked action is refused immediately; navigation arriving first fences the action instead of letting it start. |
@@ -263,11 +265,13 @@ Phase 2 only. Ordinary sessions, leaf/subagent sessions, scoped-plan PM sessions
263
265
 
264
266
  Not a user activation command: nothing is spawned, merged, leased or written to engine state by the tool, and no session/flag/goal/prose can substitute for the calls below.
265
267
 
266
- 1. **`bind`** — the coordinator's **first Phase-2 host action**, independent of any setting or model handoff, and also required on a no-argument `/iteration-drive` resume: `{operation:"bind", workflowId, coordinatorSessionPath}`. Authority is derived host-side from the session envelope plus the named snapshot, never from the call: it re-reads the engine coordinator/session identity, the workflow id, the control harness root, the accepted phase (`phase-2-execute`; an unknown/missing phase is disabled) and the checkout root (main worktree or the recorded integration worktree), and it rejects leaf/`session_init` sessions, foreign workflows, scoped-plan PM sessions and terminal workflows. It records a session **identity pointer** only — this is plugin observation binding, not engine `plan bind`, and it writes no engine credential.
267
- 2. **`checkpoint`** — acknowledge that PM ran the shared scheduling procedure against the sample taken at that moment: `{operation:"checkpoint", reason, decision, note}`, `reason` ∈ `before-wait | result-settled | dependency-changed | ownership-changed | capacity-changed`, `decision` ∈ `dispatched | wait | blocked`. The runtime attaches the sampled key; the caller cannot choose or reset it. `blocked` suppresses advisory continuation until a new explicit user turn or a later checkpoint clears it — never a timer or incidental snapshot churn. A checkpoint carries a decision and note, never a ready list.
268
+ 1. **`bind`** — the **`phase-2-entry`** anchor (→ **§ Host hooks**): the coordinator's **Phase 2 execute/resume entry** (immediately before the per-plan loop, after the §2.0 gates; §2.3's Phase-1-reused integration-worktree step is not this anchor), independent of any setting or model handoff, and also required on a no-argument `/iteration-drive` resume. Call shape, authority derivation, the rejection set and its refusal codes live in that section.
269
+ 2. **`checkpoint`** — the **`rescheduling-checkpoint`** anchor (→ **§ Host hooks**): acknowledge that PM ran the shared scheduling procedure against the sample taken at that moment, with `reason` from the five frozen names and `decision` ∈ `dispatched | wait | blocked`. The runtime attaches the sampled key; the caller cannot choose or reset it. `blocked` suppresses advisory continuation until a new explicit user turn or a later checkpoint clears it — never a timer or incidental snapshot churn. A checkpoint carries a decision and note, never a ready list.
268
270
  3. **`reserve-launch`** — `{operation:"reserve-launch", planId, transport:"herdr"|"tmux", skill:{name,source}, capability:{executable,version,target}}`. Admission additionally requires the enabled opt-in, a valid latest capacity, a coordinator-prepared row with no plan binding/lease/handoff, the identical prepared Assignment hash, an existing canonical **distinct** feature worktree on its assigned branch, and the transport prerequisites. Only `applied:true` authorizes a side effect; an identical duplicate returns the recorded intent with `applied:false` and authorizes nothing, while a different live intent/binding for that plan refuses. Intents are journaled at `<workflow dir>/omp-launches.json` — a plugin-owned transport journal, never a lifecycle register.
269
271
  4. **`record-launch`** — one transition per observed step, each recorded **before** its matching side effect: `{operation:"record-launch", intentId, observation, target?, evidencePath}` with `observation` ∈ `starting | created | submitting | submitted | refused | uncertain`. Strict forward order `reserved → starting → created → submitting → submitted`; `starting` permits pane creation, `created` (which **requires the returned opaque target**) permits starting OMP in it, `submitting` permits the single scoped prompt. Only a newly persisted transition reports `applied:true`; PM acts only on that. `refused` is legal only for an observed failure that provably precedes any process/prompt side effect; from `submitting` onward a lost outcome is `uncertain`, which is terminal. A recorded target is never re-pointed, and settings/capacity/ownership are re-read before each side-effecting transition.
270
272
 
273
+ Refusal codes for `reserve-launch` / `record-launch` — **not** anchor-triggered (the optional extra-primary path carries no shared anchor moment, so these belong to no anchor row): `launch.invalid-request`, `launch.session-denied`, `launch.phase-inactive`, `launch.snapshot-unreadable`, `launch.journal-corrupt`, `launch.plan-not-found`, `launch.plan-unavailable`, `launch.plan-not-prepared`, `launch.plan-occupied`, `launch.prepared-hash-drift`, `launch.worktree-unavailable`, `launch.capability-unavailable`, `launch.settings-disabled`, `launch.settings-invalid`, `launch.settings-read-failed`, `launch.capacity-exceeded`, `launch.intent-not-found`, `launch.transition-invalid`, plus the shared `tool-error`. Every one is a visible refusal that authorizes nothing; success codes are `reserved` / `recorded`, and `replayed` (`applied:false`) for an identical duplicate that likewise authorizes no side effect.
274
+
271
275
  ### Optional transport (skill-driven — no compiled bridge)
272
276
 
273
277
  Every prerequisite is required and checked per launch: the **corresponding optional skill actually present in the catalog and read** (the `herdr` skill today; a tmux skill only if one truly exists — binary existence is not skill availability), the CLI executable available, and this session actually inside the matching managed environment (`HERDR_ENV=1`; `TMUX` set for tmux). Two managed environments visible at once is a visible refusal, not a focus-based choice. A missing prerequisite is a **visible no-op**: no process start, no silently substituted plan, native background scheduling intact, never a fabricated success. This never becomes a mandatory load-order dependency of the standalone `mstar-*` skill set.
@@ -280,6 +284,81 @@ Every prerequisite is required and checked per launch: the **corresponding optio
280
284
 
281
285
  **Evidence boundary**: this transport guidance is supported by **simulated** scripted skill/CLI observation traces (PM action sequences scored for command order, prepared cwd, non-focus creation, credential absence, opaque-target reuse, stopping on uncertainty and no blind resend) — not by a native end-to-end Herdr/tmux run, not by any probe of user terminals, and not by a real OMP child process.
282
286
 
287
+ ## Host hooks
288
+
289
+ The four **host hook anchors** — `iteration-entry`, `phase-1-lock`, `phase-2-entry`, `rescheduling-checkpoint` — are defined host-agnostically in `mstar-host` § `## Host hooks (anchor contract)`. Shared skills carry only the marker `<!-- host-hook: <anchor> -->` plus a one-line pointer and declare no host action; **this section is the OMP declaration for all four**. When the shared step carrying an anchor is reached, the PM executes the call declared here. Tool names, parameters, refusal codes and settings keys for these two mechanisms live in this file and nowhere else.
290
+
291
+ Carrier moments — where the PM meets the marker:
292
+
293
+ | Anchor | Shared carrier |
294
+ |---|---|
295
+ | `iteration-entry` | `mstar-iteration/references/phase-1-prepare.md` §1.5 (tail, after the workflow is registered to the v2 status surface and its id is known) |
296
+ | `phase-1-lock` | `mstar-iteration/references/phase-2-worktree-lease.md` §2.3 (`## Integration worktree (Phase 2 entry) + control root` checklist tail — after the integration checkout is recorded, the reviewed changes are committed there and that branch is pushed; the Phase 1 route reaches it through `iteration-start` §6, which carries a pointer only) |
297
+ | `phase-2-entry` | `mstar-iteration/references/phase-2-worktree-lease.md` immediately before the `## 2.4 Per-plan loop` heading (the Phase 2 execute/resume entry after the §2.0 gates) |
298
+ | `rescheduling-checkpoint` | `mstar-iteration/references/phase-2-worktree-lease.md` §2.4 (`### Rescheduling checkpoint`) |
299
+
300
+ ### Auto-trigger boundary — the diagnosed failure mode
301
+
302
+ Neither extension ever arms, binds or checkpoints by itself:
303
+
304
+ - `extensions/model-handoff.js` observes the host `input` event only to **label** the entry route (`/iteration-start`, `/iteration-loop`, `skill-start`) — "It never authorizes anything". Arming happens **only** inside the `mstar_model_handoff {operation:"start"}` handler, and the authority for it is derived host/engine-side (task-session ledger, the workflow's own session envelopes, the root register), never from the call.
305
+ - `extensions/phase2-orchestration.js` emits its bounded advisory **only after** a recorded `bind`; `{operation:"checkpoint"}` likewise requires a live binding.
306
+
307
+ Enabling `modelHandoff` or `phase2PlanInstances` in `/settings` **never retro-arms or retro-binds** an iteration already under way (the preference is re-read at entry *and* again at fire time), and disabling it suppresses the action without terminalizing the binding. A coordinator that never calls therefore produces **no state and no signal at all** — not a refusal, not a warning, not a log line. That silence is the failure mode this anchor contract fixes: both mechanisms shipped with zero PM call sites in the load chain, so every anchor below is an explicit **required** call, never something the host does for the PM.
308
+
309
+ ### Anchor declarations
310
+
311
+ | Anchor | Call (exact) | When | Prerequisite | Required |
312
+ |---|---|---|---|---|
313
+ | `iteration-entry` | `mstar_model_handoff {operation:"start", workflowId}` | once the workflow is registered and its id is known — the PM's first preparation action that can name it (`phase-1-prepare.md` §1.5 tail); never before the register step | native `modelHandoff` enabled; an explicitly named workflow id; this session is that workflow's coordinator | **required** — the call itself is unconditional; the arm inside it is conditional |
314
+ | `phase-1-lock` | `mstar_model_handoff {operation:"phase1-complete", workflowId, coordinatorSessionPath, mainWorktreeBranch, reviews[], plans[]}` | Phase 1 completion — after the integration checkout exists, the reviewed changes are committed there and that branch is pushed (§2.3 integration-worktree checklist tail); the compass/PM lock alone is **not** ready and not the moment | a `pending` binding from `iteration-entry` **and** the four Phase-1 readiness facts | **required** — never a silent skip |
315
+ | `phase-2-entry` | `mstar_phase2 {operation:"bind", workflowId, coordinatorSessionPath}` | the **Phase 2 execute/resume entry** — immediately before the per-plan loop (§2.4), after the §2.0 gates; also required on a no-argument `/iteration-drive` resume. **Not** the Phase-1-reused integration-worktree step (§2.3), which triggers nothing | accepted phase `phase-2-execute`; a `coordinator`-role session envelope; the caller's checkout = main worktree or the recorded integration worktree | **required** |
316
+ | `rescheduling-checkpoint` | `mstar_phase2 {operation:"checkpoint", reason, decision, note}` | **one call per** `Rescheduling checkpoint` re-evaluation (§2.4), including every settle notification | a live `phase-2-entry` binding in this session | **required** per re-evaluation — never batched, never skipped |
317
+
318
+ #### `iteration-entry` — `mstar_model_handoff {operation:"start", workflowId}`
319
+
320
+ - **Exact parameters**: `workflowId` (string, required) — the only field a caller supplies that matters here; `coordinatorSessionPath` / `mainWorktreeBranch` are accepted by the schema but unused on this path. Authority, entry route, intent and task-session state are host-derived, never call-declared.
321
+ - **When**: once the workflow is registered to the v2 status surface and its **id is known** (`mstar-iteration/references/phase-1-prepare.md` §1.5 tail) — the PM's first preparation action that can name it. Never at the head of §1.1: the id does not exist yet, and the id must name a registered workflow so its coordinator envelope exists.
322
+ - **Required or optional**: **required** and unconditional — make the call even when the preference is off, because `preference-off` is then the expected non-fatal answer and its absence from the ledger is what makes the silence undiagnosable. One call per iteration; a second arm of the same workflow is refused.
323
+ - **No-op refusals** (visible in the tool result, **nothing changed**, model unchanged — not failures to fix beyond the stated cause): `preference-off` (not an error) · `already-bound` · `suspended` (state `none`; a navigation is in flight, retry in a moment) · `in-flight` / `arm-in-flight` (a previous handoff action is still running).
324
+ - **Authority refusals** (this session is not the iteration coordinator — fix the session, not the call; no model action, no binding written): `task-session` (leaf/subagent session, or a session with no id) · `scoped-plan-route` (the last observed entry was the scoped-plan PM route, which restores a binding and never arms a new one) · `plan-pm-session` · `coordinator-elsewhere` (this session coordinates another workflow, or the workflow belongs to another session) · `envelope-invalid` · `register-invalid` (unreadable or invalid v2 root register / workflow snapshot).
325
+ - **Visible arm failures** (reported as failures; **no automatic retry**): `settings-read-failed` · `record-failed` · `slow-unresolved` · `slow-selection-failed` · `slow-selection-refused` · `arm-evidence-conflict`.
326
+ - **Host-level**: `tool-error` (the tool threw without touching model, ledger or engine state).
327
+ - **Success code**: `armed` (state `pending`) — the coordinator holds it until `phase-1-lock` fires or the handoff is cancelled.
328
+
329
+ #### `phase-1-lock` — `mstar_model_handoff {operation:"phase1-complete", workflowId, coordinatorSessionPath, mainWorktreeBranch, reviews[], plans[]}`
330
+
331
+ - **Exact parameters**: `workflowId` (must equal the bound workflow) · `coordinatorSessionPath` (non-empty string) · `mainWorktreeBranch` (string — the recorded integration branch) · `reviews[]` — **exactly three ordered specialist returns** · `plans[]` — **at least one** bound-plan evidence entry. A missing or wrong-length input is refused, never inferred.
332
+ - **When**: Phase 1 completion — **after** the integration worktree exists (recorded `integration_worktree_path`), the reviewed changes are committed on that checkout and `spec_integration_branch` is pushed: the tail of the §2.3 integration-worktree checklist, whose **step 7** performs that transfer + commit + push (Phase 1 reaches it through `iteration-start` §6). The compass/PM lock alone is **not** the moment — it leaves readiness items 3–4 unmet, so `not-ready` returns, the binding stays `pending`, and no later marker retries it. The call is made once, on the Phase 1 route; a Phase 2 resume that walks the same section must not repeat it — the binding is already terminal, so a repeat call returns `not-pending` (flagged as an error, since no `pending` binding exists any more) and is not required.
333
+ - **Required or optional**: **required**, and never a silent skip — every refusal lands in the tool result, and every state transition additionally as a durable session notice.
334
+ - **Readiness prerequisite (all four, re-checked at fire time)**: the sequential specialist returns for that iteration; the PM-confirmed Prepare gate for every registered plan with `compass status: locked`; a distinct same-repository integration checkout on its recorded branch; a remote tip equal to the validated integration HEAD. `evaluatePhaseGate` is a later-phase gate and is never readiness evidence; a draft compass, a lock alone, a missing checkout or an unpushed commit is not ready.
335
+ - **Refusals that leave the binding `pending`** (fix the stated cause and call again — **nothing was switched**): `not-ready` (carries `codes[]` naming the unmet readiness facts; not an error) · `preference-off` (`modelHandoff` off at fire time; not an error) · `settings-read-failed` (read once before and once after the readiness work) · `suspended` · `in-flight` · `record-failed` · `not-pending` (no binding — run `iteration-entry` first) · `binding-mismatch` (the call names a different workflow) · `invalid-completion-input` (the evidence shape above).
336
+ - **Terminal refusals** (**no retry**; the session keeps the model it actually has): `cancelled` (an unowned model change arrived while pending; not an error) · `target-unresolved` (`handoffTarget` unresolvable) · `switch-refused` / `switch-threw` (the host refused the selection).
337
+ - **Host-level**: `tool-error`. **Success code**: `handed_off` (state `handed_off`, with the actual model reported).
338
+
339
+ #### `phase-2-entry` — `mstar_phase2 {operation:"bind", workflowId, coordinatorSessionPath}`
340
+
341
+ - **Exact parameters**: `workflowId` (must match both the session envelope and the workflow snapshot id) and `coordinatorSessionPath` (the coordinator's own session envelope). The request object is strict — nothing else is accepted, and authority is derived host-side, never from the call: host session id, control harness root, accepted phase and checkout root are all re-read.
342
+ - **When**: the **Phase 2 execute/resume entry** — immediately before the per-plan loop (`## 2.4 Per-plan loop`), after the §2.0 gates and after §2.3's branch/worktree resolution; also required on a no-argument `/iteration-drive` resume. It is explicitly **not** the Phase-1-reused integration-worktree step: Phase 1's `iteration-start` §6 walks §2.3 to create the integration checkout, and that step triggers no anchor (`phase-2-entry` fires only on the Phase 2 route, and `phase-1-lock` fires once at that checklist's tail).
343
+ - **Required or optional**: **required**. It records a session **identity pointer** only — plugin observation binding, not engine `plan bind` — and writes no engine credential and no engine state.
344
+ - **Prerequisite**: the snapshot's accepted phase is `phase-2-execute` (an unknown or missing phase disables the observation) · the envelope role is `coordinator` · the caller's checkout is the main worktree or the recorded integration worktree.
345
+ - **Refusals** (visible; **nothing bound**):
346
+ - `phase2.task-session` — a leaf/subagent (`session_init`) session, or a session with no id.
347
+ - `phase2.plan-pm-session` — a scoped-plan PM envelope: a scoped-plan PM never binds the Phase-2 observation.
348
+ - `phase2.envelope-unreadable` · `phase2.workflow-mismatch` (envelope or snapshot names another workflow) · `phase2.harness-unresolvable` · `phase2.snapshot-unreadable` · `phase2.workflow-terminal` · `phase2.coordinator-mismatch` (the snapshot is bound to a different coordinator envelope) · `phase2.scope-mismatch` (the caller's checkout is neither the main worktree nor the integration worktree) · `phase2.record-failed` · `tool-error`.
349
+ - **Non-failure**: `already-bound` (`applied:false`) — an identical re-bind is idempotent, the pointer is unchanged, and the call is safe to repeat. **Success code**: `bound` (`applied:true`).
350
+ - The tool's other two operations — `reserve-launch` / `record-launch` — are **not** anchor-triggered; their codes are in § Phase-2 plan instances above.
351
+
352
+ #### `rescheduling-checkpoint` — `mstar_phase2 {operation:"checkpoint", reason, decision, note}`
353
+
354
+ - **Exact parameters**: `reason` — **one of the five frozen names, verbatim**: `before-wait`, `result-settled`, `dependency-changed`, `ownership-changed`, `capacity-changed` · `decision` ∈ `dispatched | wait | blocked` · `note` (string, required). The argument schema is a strict union: any other value is rejected before anything is written. The runtime attaches the sampled observation key — the caller cannot choose or reset it.
355
+ - **When**: **one call per** re-evaluation of the shared `Rescheduling checkpoint` (`mstar-iteration/references/phase-2-worktree-lease.md` §2.4) — a call acknowledges that PM ran the shared scheduling procedure against the sample taken at that moment.
356
+ - **Required or optional**: **required** per re-evaluation — never batched into the next one, never skipped because "nothing changed". A checkpoint carries a decision and a note, never a ready list.
357
+ - **Prerequisite**: a live `phase-2-entry` binding in this session; the ownership probe is re-run on every call.
358
+ - **Refusals** (visible; **no checkpoint recorded**, advisory state unchanged): `phase2.not-bound` (run `phase-2-entry` first) · `phase2.record-failed` · `tool-error`, plus the ownership-probe codes shared with `bind`: `phase2.envelope-unreadable` · `phase2.ownership-drift` (the envelope or snapshot no longer belongs to the bound session — re-run `bind`) · `phase2.harness-unresolvable` · `phase2.snapshot-unreadable` · `phase2.workflow-mismatch` · `phase2.workflow-terminal` · `phase2.phase-inactive` (the workflow left `phase-2-execute`). Both stale codes mark the local binding not-current and tell the PM to re-run `{operation:"bind"}` before relying on this session.
359
+ - **Success code**: `recorded` (with the returned `observationKey` and `blocked` flag; `blocked` suppresses advisory continuation until a new explicit user turn or a later checkpoint — never a timer or incidental snapshot churn).
360
+ - **Not checkpoint refusals** — the advisory path's own sample refusals are `phase2.snapshot-unavailable` (a `null` snapshot means "unavailable", never "no jobs") and `phase2.settings-read-failed` / `phase2.invalid-settings` (the native settings read failed, or a present-but-malformed key fails visibly).
361
+
283
362
  ## Files, shell, and approvals
284
363
 
285
364
  - Prefer host search/edit tools over shell find/sed when available.
@@ -28,6 +28,9 @@ Harness **dispatch** on OpenCode = **one or more `task` tool calls**, each with
28
28
  | `Execute as: <role-id>` | **`subagent`** on **task tool** = same agent id |
29
29
  | Parallel batch **N** | **N task tool** calls in **one assistant message** when the host allows (`parallel-dispatch.md`) |
30
30
 
31
+ **Role-binding field:** **`subagent`** on the **task tool** (singular — there is no batch array here); it must equal the Assignment `Execute as`.
32
+ **Engine scope (#156):** OpenCode exposes no dispatcher identity, so the caller-scoped `antiRecursionPrecheck` leg is **skipped** on this host — the binding field carries the **spawn target**, and target == `Execute as` is the compliant C5 pattern — and the red line stays **prompt-level** (`mstar-dispatch-gates` § 承接方反递归红线). Caller-side hard enforcement exists only where the host declares a dispatcher binding (`dsh.md`).
33
+
31
34
  PM workflow: finalize Assignment → **call task tool** with **subagent** + generated prompt → wait for subagent Completion Report → update plan / status.
32
35
 
33
36
  **SDD sticky implementer:** if the task tool exposes **resume** / agent id, follow **`mstar-sdd/references/sticky-implementer-session.md`** and the active host reference. If resume is **not** available, use **micro-batch** (2–3 tasks, one invoke) or **`SDD implementer session: fresh`** per task — do not assume sticky without host support.
@@ -69,6 +69,9 @@ ZCode C5/C5b SSOT is **this file** — do **not** load `_shared/host-role-bindin
69
69
 
70
70
  Paste-only Assignment **without** an invoke call is **not** dispatch. Anti-recursion NEVER: leaf executors are already `Execute as` — no recursive invoke of the same role; Assignment wins (`Delegation: forbidden` unless stated). Independent ready implementers may run concurrently after isolation; scheduling → **`parallel-dispatch.md`** § SDD implement.
71
71
 
72
+ **Role-binding field:** **`subagent_type`** — the bare Morning Star role id per C5 (`general-purpose` / `Explore` fallbacks); the thin role shell still needs the C5b prompt binding above.
73
+ **Engine scope (#156):** no engine dispatch gate observes caller identity here (the binding field carries the **invoke target**, not the dispatching seat), so this red line stays **prompt-level** (`mstar-dispatch-gates` § 承接方反递归红线). Caller-side hard enforcement exists only where the host declares a dispatcher binding (`dsh.md`).
74
+
72
75
  ZCode invoke shape (same turn):
73
76
 
74
77
  ```text
@@ -126,6 +126,11 @@ compass frontmatter 的 `iteration_base_branch` / `target_branch` **必须与**
126
126
 
127
127
  **中途增减范围(已存在且仍在 Prepare 的 workflow)**:用户/产品批准的范围扩张**不得**手改受保护状态。先以 `mstar plan bind --coordinator --workflow <id>` 建立该 workflow 的 coordinator 会话,再经受守卫入口 `mstar workflow show-prepare` 读取快照与 compass 两个字节版本,并以 `mstar workflow amend-prepare` 追加已批准的 Todo 行、登记已 review 的 integration checkout 与 `plan_parallelism`(仅 Prepare 且无执行所有权时可用;无 force/replace/init 通道)。守卫与字段权威 → **`mstar-artifacts`** `references/status-and-residuals.md`「Prepare workflow amendment」;forms / exit codes → `docs/cli.md` § `mstar-harness workflow`。
128
128
 
129
+ <!-- host-hook: iteration-entry -->
130
+ > Execute the active host reference's `## Host hooks` declaration for `iteration-entry`; this file defines no host action.
131
+ >
132
+ > 本 anchor 只在 workflow 已登记到 v2 状态面(本条完成)**且其 id 已知**之后执行 —— 登记之前没有可用的 workflow id。
133
+
129
134
  ## 1.5.5 产物边界(specs · iterations · knowledge)
130
135
 
131
136
  Phase 1 与 §1.6 须遵守 **`references/iteration-artifact-boundaries.md`**(HARD):
@@ -150,10 +155,12 @@ Phase 1 与 §1.6 须遵守 **`references/iteration-artifact-boundaries.md`**(
150
155
  2. **writing-specialist** 完成 **corpus hygiene**:仅本轮修改的 `{SPECS_DIR}/` / iteration package 与直接相关 knowledge 引用;错放迁回 **`<iteration-id>/`** package;细则 → **`iteration-corpus-hygiene.md`**、**`iteration-artifact-boundaries.md`**
151
156
  3. PM 将 compass `status` 设为 `locked`,并确认各 plan 的 Prepare gate(specify / clarify / plan)
152
157
 
153
- **顺序理由**:产品范围与优先级 → 架构与长期契约(specs)→ 行文、规格库卫生与错放纠正(在 PM/architect 定稿后核对受影响文档)。本共享产物链存在真实依赖;独立文档可按 ownership 隔离并行。早期全局探索的既有结果复用,不因每次编辑重新扫全库。OpenCode:plain role id — **`mstar-host/references/opencode.md`** § Role-mention hygiene。
158
+ **顺序理由**:产品范围与优先级 → 架构与长期契约(specs)→ 行文、规格库卫生与错放纠正(在 PM/architect 定稿后核对受影响文档)。本共享产物链存在真实依赖;独立文档可按 ownership 隔离并行。早期全局探索的既有结果复用,不因每次编辑重新扫全库。角色名写法(role id 提及 hygiene)→ active host reference(**`mstar-host`** → `references/<host>.md`)。
154
159
 
155
160
  **完成证据** = 磁盘上的 compass / plans / specs / iteration 文档修订 + specs(与既有 knowledge)卫生/归档(如有)+ 索引与 metadata 更新 + compass `status: locked`。**不**要求单独的迭代审查报告——迭代审查的 SSOT 是被编辑的文档本身,无 per-plan QC 式审计链。
156
161
 
157
- **Uncommitted-docs exception(bounded — Phase 1 only)**:Review & Edit 链的文档编辑(compass / plans / specs / `<iteration-id>/` package)可以**未提交**状态落在主 checkout(control root = 主 worktree)——这是 worktree 默认在 Phase 1 的唯一例外,主 checkout 分支**不**切换、不产生 feature commit。**§6 创建 integration worktree 后**:只把**已 review 的本轮文档改动** transfer 到 integration worktree 并在其上 commit(tracked results 写在目标分支所在的检出),随后恢复主 checkout 上对应的未提交文档改动(不切分支);**禁止**搬运主 checkout 上无关的既有用户改动。
162
+ **Uncommitted-docs exception(bounded — Phase 1 only)**:Review & Edit 链的文档编辑(compass / plans / specs / `<iteration-id>/` package)可以**未提交**状态落在主 checkout(control root = 主 worktree)——这是 worktree 默认在 Phase 1 的唯一例外,主 checkout 分支**不**切换、不产生 feature commit。该例外在 **§6 的 integration-worktree 步骤**结束,其 transfer / commit / restore 序列的**唯一 home** 是 **`phase-2-worktree-lease.md` §2.3 checklist step 7**:只搬运**已 review 的本轮文档改动**,commit 落在 integration checkout,主 checkout 上对应的未提交改动随后恢复(不切分支);**禁止**搬运主 checkout 上无关的既有用户改动。
158
163
 
159
164
  **反模式**:PM 线程代替三角色完成全部编辑而不 invoke;或将本链三角色并行派发 —— 见 **`mstar-roles/references/_shared/leaf-executor-core.md`**「Shared anti-recursion NEVER」。
165
+
166
+ **Phase 1 完成 anchor(`phase-1-lock`)不在本文件触发**:compass `status: locked` 只是它的前置之一 —— 它只在 integration worktree 已建立(并记录 `integration_worktree_path`)、已 review 的改动在该 checkout 上 commit、且 `spec_integration_branch` 已 push 之后才执行,因此其 marker 由 **`phase-2-worktree-lease.md` §2.3**「Integration worktree (Phase 2 entry) + control root」checklist tail 承载(Phase 1 路线经 `iteration-start` §6 走到该 checklist)。
@@ -22,7 +22,7 @@ serial cross-plan **implement** scheduling while the worktree + lease gates rema
22
22
  required.
23
23
 
24
24
  Phase 1 Review & Edit may edit uncommitted docs on the primary checkout under the Prepare policy (bounded exception; the main worktree never switches branch). The integration-worktree + lease gate
25
- starts at **Phase 2 entry**.
25
+ starts at **Phase 2 entry** — Phase 1 did walk §2.3's integration-worktree checklist once at its end (`iteration-start` §6, which carries the `phase-1-lock` marker), but the gate those steps guard opens only when Phase 2's per-plan loop begins.
26
26
 
27
27
  **Phase scope**:本参考仅约束 **Phase 2**(含 serial integration merge 与「control root / integration worktree 禁止产品编辑 / 每 plan feature worktree」)。**Phase 5** PR merge-ready 修复同样 **不**直接在 integration checkout 上改——产品修复走独立 fix feature worktree,review 后 merge 回 integration worktree → **`phase-4-5-pr-delivery.md`** §5.0。
28
28
 
@@ -46,13 +46,11 @@ starts at **Phase 2 entry**.
46
46
 
47
47
  ## 2.1 Session todos(派发前设护栏)
48
48
 
49
- 每个 plan wave 启动前设定 host todos,防止范围漂移:
49
+ 每个 plan wave 启动前设定 host session todos,防止范围漂移(具体 todo / plan UI 工具名 → active host reference):
50
50
 
51
- | Host | 工具 | 最小集合 |
52
- |------|------|---------|
53
- | **Cursor** | `TodoWrite` / CreatePlan todos | 当前 `plan_id`;下一批 gates(implement/QC/**QA gate**);分支 checkpoint;**仅剩 1 个非 Done plan 时追加 `phase-3-iteration-close`**(open 直至 §3.5);Phase 4 后 **`phase-5-pr-merge-ready`**(open 直至 §5.5) |
54
- | **Codex** | `update_plan` / Goal UI | 同上 |
55
- | **OpenCode** | host todo/plan UI(如有) | 同上 |
51
+ | 宿主会话 | 工具 | 最小集合 |
52
+ |----------|------|---------|
53
+ | 任意宿主(有 session todo / plan UI 时) | 宿主自身的 session todo / plan UI | 当前 `plan_id`;下一批 gates(implement/QC/**QA gate**);分支 checkpoint;**仅剩 1 个非 Done plan 时追加 `phase-3-iteration-close`**(open 直至 §3.5);Phase 4 后 **`phase-5-pr-merge-ready`**(open 直至 §5.5) |
56
54
 
57
55
  SSOT = `{WORKFLOW_DIR}/<id>/snapshot.json` + `{PLAN_DIR}/`。todos 只追踪本轮下一步。
58
56
 
@@ -70,6 +68,8 @@ Phase/gate 转换时按 **`mstar-host`**「Phase-transition todo refresh (host-a
70
68
 
71
69
  ## 2.3 Branch anchors + integration branch + integration worktree(Phase 2 入口)
72
70
 
71
+ 本节的 integration-worktree checklist **也被 Phase 1 路线复用**(`iteration-start` §6)—— 在该路线上它承载 `phase-1-lock` marker,且**不**触发 `phase-2-entry`。
72
+
73
73
  **Branch anchors 解析顺序**(任一环节缺失则 STOP,**禁止**默认 `main`/`master`):
74
74
 
75
75
  1. workflow snapshot → `branch.base`(`iteration_base_branch`)、`branch.target`(`target_branch`)、`branch.integration`(`spec_integration_branch`);plan 行 → `metadata.spec_integration_branch`
@@ -114,6 +114,22 @@ Phase/gate 转换时按 **`mstar-host`**「Phase-transition todo refresh (host-a
114
114
  - plans SSOT: `<main-repo-root>/{PLAN_DIR}/`
115
115
  - iterations SSOT: `<main-repo-root>/{ITERATION_DIR}/`
116
116
  - SDD tree: `<main-repo-root>/{HARNESS_DIR}/sdd/<plan-id>/`
117
+ 7. **Phase 1 route — publish.** Transfer only the reviewed Phase 1 changes into
118
+ this integration checkout, commit them there and push `spec_integration_branch`:
119
+ the changes come **from** the primary checkout, while the commit and the push
120
+ happen **in the integration worktree**; afterwards restore the primary
121
+ checkout's corresponding uncommitted docs without switching its branch
122
+ (Phase-1 bounded exception → `phase-1-prepare.md` §1.6; never carry unrelated
123
+ user changes).
124
+ **Every Phase 2 entry — first execute and resume alike, including the first
125
+ entry after an auto-continued Phase 1 (which has already published) — never
126
+ publishes again**: verify the checkout instead (branch =
127
+ `spec_integration_branch`, clean tree, remote tip already equal to the live
128
+ integration HEAD), do **not** re-publish, and do **not** repeat the
129
+ `phase-1-lock` anchor below — its binding is terminal by then (repeat-call
130
+ semantics and refusal codes → active host reference). On the Phase 1 route the
131
+ anchor instead requires that pushed remote tip to equal the live integration
132
+ HEAD, so it must not be executed before this step's publish.
117
133
 
118
134
  All sessions MUST reread the **control-root copy** of the workflow snapshot immediately before
119
135
  claim, release, transfer, plan-status transition, or merge-lease mutation.
@@ -123,6 +139,11 @@ claim, release, transfer, plan-status transition, or merge-lease mutation.
123
139
  control **`Plan Path`** / **`SDD dir`** in Assignments
124
140
  (`mstar-branch-worktree` 「Harness path SSOT under default gitignore」).
125
141
 
142
+ <!-- host-hook: phase-1-lock -->
143
+ > Execute the active host reference's `## Host hooks` declaration for `phase-1-lock`; this file defines no host action.
144
+ >
145
+ > **`phase-1-lock` 恰好触发一次**:只在 **Phase 1 路线**、且在 checklist **step 7 的 publish**(transfer → commit → push `spec_integration_branch`)之后 —— 该 anchor 的就绪合取要求已 push 的 remote tip 等于 live integration HEAD,因此**不得**在 step 7 之前执行。此后任何**再次走过 §2.3 的路线**(Phase 2 entry 首次 execute 或 resume,包括 auto-continue 进入的第一次 Phase 2 entry)都**不**触发它:那时 binding 已 terminal,也**不**需要重新调用(精确的重复调用语义与拒绝码 → active host reference)。
146
+
126
147
  ### Same-host exclusive write lock
127
148
 
128
149
  All control-path lease mutations (claim, release, transfer, merge-lease
@@ -177,15 +198,23 @@ mismatch → **STOP**.
177
198
 
178
199
  > **Lease Engine-check:** canonical callout lives in `mstar-artifacts` `SKILL.md`(Engine-check lease 行)— this file carries the execution checklist only.
179
200
 
201
+ <!-- host-hook: phase-2-entry -->
202
+ > Execute the active host reference's `## Host hooks` declaration for `phase-2-entry`; this file defines no host action.
203
+ >
204
+ > 这是 **Phase 2 execute/resume entry**:§2.0 五道闸与 §2.3 的 branch / worktree 解析之后的第一个 Phase 2 动作,位于 per-plan loop 之前。Phase 1 的 `iteration-start` §6 只**复用** §2.3 的 integration-worktree 步骤,**不**触发本 anchor。
205
+
180
206
  ## 2.4 Per-plan loop(直到全部 Done)
181
207
 
182
208
  **跨 plan 默认**(**无论** `Worktree mode: waived`):**不同 `plan_id` 可并行 implement** 须满足 §2.0 #5 跨 plan 并行安全闸——(a) coordination 路径 same-host 独占写锁可用且每次 status/协调变更持锁,或 (b) **`Plan parallelism: serial`**(waived 时默认),或 (c) 用户本轮 `Cross-host lease race: accepted` + audit `notes`;否则 Assignment 仍写并行 → **Blocked**。**merge 入 `spec_integration_branch` 仍串行**(snapshot 顶层 `integration_merge_lease`;waived 时无 merge lease 仍须串行 merge)。未 waive 时 **禁止**无 verified `execution_lease` 的跨 plan 可写派发。
183
209
 
184
210
  ### Rescheduling checkpoint(主动调度检查点)
185
211
 
212
+ <!-- host-hook: rescheduling-checkpoint -->
213
+ > Execute the active host reference's `## Host hooks` declaration for `rescheduling-checkpoint`; this file defines no host action.
214
+
186
215
  Phase 2 缺的不是新调度器,而是一个**具名的重新评估时刻** —— `Rescheduling checkpoint` 就是它。本文件是 procedure 的**唯一 home**:**不**新增 scheduler / DAG / 第二 ready-state register,判断仍由 PM 按下列步骤做出,结果只落在 PM 正常 transcript / ledger。
187
216
 
188
- **五个冻结 reason**(checkpoint 触发词;OMP 侧 `mstar_phase2` checkpoint receipt 消费**同一词汇**,但只记录「已按本 procedure 评估」的事实 + decision/reason —— 它**不**推断依赖就绪、**不**选择派发;**禁止**自造同义词):
217
+ **五个冻结 reason**(checkpoint 触发词;宿主若在 `rescheduling-checkpoint` 锚点声明 receipt,消费的是**同一词汇** —— 该 receipt 只记录「已按本 procedure 评估」的事实 + decision/reason,**不**推断依赖就绪、**不**选择派发;**禁止**自造同义词 —— 锚点契约 → **`mstar-host`**「Host hooks (anchor contract)」):
189
218
 
190
219
  | reason | 触发时刻 |
191
220
  | --- | --- |
@@ -35,7 +35,7 @@ Scoped boot does **not** load `mstar-compound` or the Phase 3–6 detail files m
35
35
 
36
36
  ## 2. Scoped boot
37
37
 
38
- 1. **Load PM identity in the current primary session**: `mstar-harness-core` → `mstar-roles` → `references/project-manager.md`. No PM subagent is spawned or dispatched for any address form — PM runs in the **primary session** on every host(rule home → `mstar-roles/references/project-manager.md` § Plan-scoped authority;omp dispatch surface → `mstar-host/references/omp.md` § C5).
38
+ 1. **Load PM identity in the current primary session**: `mstar-harness-core` → `mstar-roles` → `references/project-manager.md`. No PM subagent is spawned or dispatched for any address form — PM runs in the **primary session** on every host(rule home → `mstar-roles/references/project-manager.md` § Plan-scoped authority;dispatch surface → the active host reference(`mstar-host`)§ C5).
39
39
  2. **Bind once**, matching the form exactly:
40
40
 
41
41
  ```bash
@@ -178,4 +178,4 @@ The scoped route **requires** `mstar plan …`. Without it(engine/CLI absent o
178
178
 
179
179
  Herdr / tmux (or any multiplexer) is only a way to open a terminal. It is **not** a prerequisite, dependency, ownership signal or session identity. Nothing in this route reads pane state, TTL or terminal labels to decide ownership.
180
180
 
181
- On **omp** only, the optional skill-driven extra-primary launch protocol — native `phase2PlanInstances` opt-in, the `mstar_phase2` bind/checkpoint/reserve/record calls, non-focus pane creation at the prepared worktree, the absolute `--assignment` submission and terminal uncertainty handling — is documented in **`mstar-host` → `references/omp.md` § Phase-2 plan instances**. It is optional there too and adds no load-order dependency here.
181
+ Where the active host reference declares an optional skill-driven extra-primary launch protocol (its native opt-in, its bind/checkpoint/reserve/record calls, non-focus pane creation at the prepared worktree, the absolute `--assignment` submission and terminal uncertainty handling), **`mstar-host`** → that reference's Phase-2 section is the only home for those calls; this file defines none of them. The protocol stays optional there too and adds no load-order dependency here.
@@ -54,6 +54,7 @@ If legacy plan directories already exist, reuse them; avoid dual-structure dupli
54
54
  ```
55
55
  The declaration is one-time (a second one, even with the same kind, is refused) and refuses a terminal snapshot; a supplied `--branch-source`/`--branch-target` fills a MISSING anchor or restates the registered one — a value conflicting with an anchor the snapshot already carries is refused (the registered anchor is the delivery identity, never overwritten); delivery evidence itself is recorded with `mstar workflow evidence --workflow <id> --file <payload.json>` (PR identity recorded once; `head`/`target` must be the registered `branch.source`/`branch.target`).
56
56
  - Delivery tail (standalone `development` plans, after Done): compound disposition (`created` / `updated` / reasoned `skipped`; review → **`mstar-compound`**) on the delivery branch before the PR head is finalized → submit PR with its identity (repo / head / target) recorded → merge-ready declared (resumable milestone; workflow stays registered) → PM-verified merge (provider evidence; never the close verb) → common close reusing the post-merge-close ordering (`mstar-iteration/references/phase-6-post-merge-close.md`). Stage semantics and failure behavior → frozen contract `mstar-artifacts/references/plan-workflow-lifecycle-contract.md`.
57
+ - **Merge-ready precondition — standalone `development` plans only.** Before merge-ready is declared, run the read-only close-state gate and record its output with the milestone (`mstar iteration gate --phase 6 --workflow <id> [--harness <absolute-path>]`; same implementation as the close's delivery-evidence consultation, no `--compass`). Pre-merge the snapshot is still `running`, so `PHASE6_NOT_TERMINAL` / `PHASE6_ROOT_ENTRY_PRESENT` are the expected readings and the recorded note says so; any other code (`PHASE6_INVALID_SNAPSHOT`, `PHASE6_INVALID_ROOT`) is a real defect to clear before merge-ready. Iteration workflows are unaffected — they keep their own Phase 4/5 exit checklist (`mstar-iteration/references/phase-4-5-pr-delivery.md` §5.2).
57
58
 
58
59
  ## PM Plan / Status NEVER
59
60
 
@@ -4,11 +4,12 @@ Before any non-trivial PM action, read in order:
4
4
 
5
5
  1. `mstar-harness-core` (entry, state machine, Task category, skill index)
6
6
  2. `mstar-dispatch-gates` + `mstar-phase-gates` (dispatch + Prepare/Execute gates)
7
- 3. Host adapter: `mstar-host` (detect host; Read `references/opencode.md`, `cursor.md`, or `codex.md`)
7
+ 3. Host adapter: **`mstar-host`** (detect the active host; then Read the reference that detection resolves to)
8
8
  4. `mstar-conventions` (path discovery, init, Spec branch summary)
9
- 5. `mstar-review-qc` (same coordination round, **before** any QC dispatch)
10
- 6. **`mstar-sdd`** when implement uses **`Execution mode: sdd`**
11
- 7. **On demand:** `mstar-branch-worktree` (parallel implement, QC/QA checkout); `mstar-artifacts` (`status.json` v2 root, workflow snapshots, R#); `mstar-artifacts` (InReview waves, review bundle naming)
9
+ 5. Plan lifecycle authority — `references/project-manager/plan-management.md` + **`mstar-artifacts`** `references/plan-workflow-lifecycle-contract.md`: who advances the plan row's engine state, the scoped verb sequence, and the evidence each transition records — read **before the first implement dispatch**, not first at close
10
+ 6. `mstar-review-qc` (same coordination round, **before** any QC dispatch)
11
+ 7. **`mstar-sdd`** when implement uses **`Execution mode: sdd`**
12
+ 8. **On demand:** `mstar-branch-worktree` (parallel implement, QC/QA checkout); `mstar-artifacts` (`status.json` v2 root, workflow snapshots, R#); `mstar-artifacts` (InReview waves, review bundle naming)
12
13
 
13
14
  **Not required:** `mstar-coding-behavior` (orchestration-only PM work).
14
15
 
@@ -29,7 +30,7 @@ Detailed procedures are moved to `references/project-manager/*.md`.
29
30
 
30
31
  ### Plan-scoped authority (bounded)
31
32
 
32
- - **PM never runs as a subagent**(**single home for this rule** — `mstar-dispatch-gates` § Plan 作用域与 credential 不下发, `project-manager/dispatch-and-assignment.md` and `mstar-iteration/references/plan-scoped-pm.md` §2 point here). PM is the **primary-session** seat on every host: no `project-manager` **subagent shell** ships in any tracked shell surface(`agents/*.md`, `codex/agents/*.toml`), and the only PM shell in the tree is OpenCode's **`mode: primary`** seat `packages/opencode/agents/project-manager.md` — a primary seat, **not** a `task` dispatch target(host dispatch surface → `mstar-host/references/omp.md` § C5: on omp no agent shell for PM ships, `mode: primary` is OpenCode-only). A **leaf** that receives `pm` / `project-manager` / `iteration-drive` wording (role name, handoff prose, `QA gate` field, routing table, multi-track narrative) is **not** being promoted: the leaf stays inside its own task, reports the mismatch, and does **not** dispatch, invoke, or absorb PM scope (`mstar-dispatch-gates` § role boundary / anti-recursion).
33
+ - **PM never runs as a subagent**(**single home for this rule** — `mstar-dispatch-gates` § Plan 作用域与 credential 不下发, `project-manager/dispatch-and-assignment.md` and `mstar-iteration/references/plan-scoped-pm.md` §2 point here). PM is the **primary-session** seat on every host: no `project-manager` **subagent shell** ships in any tracked shell surface, and no host's role-binding field may ever target `project-manager` — a primary seat is not a dispatch target(per-host seat / shell forms → the active `mstar-host` reference, role-binding and dispatch section). A **leaf** that receives `pm` / `project-manager` / `iteration-drive` wording (role name, handoff prose, `QA gate` field, routing table, multi-track narrative) is **not** being promoted: the leaf stays inside its own task, reports the mismatch, and does **not** dispatch, invoke, or absorb PM scope (`mstar-dispatch-gates` § role boundary / anti-recursion).
33
34
  - **Scope is inherited, never self-expanded.** Every child Assignment inherits its parent's plan scope. A child may not select or prepare a plan, mutate the workflow snapshot / root register / shared indexes, release leases, or open PR / close phases — only its own task and its declared write paths.
34
35
  - **Scoped primary drive**(`/iteration-drive --assignment|--workflow/--plan|--resume`)runs **in the primary session** (never as a subagent): `mstar plan bind` → `show`, then the session is bounded to that plan's writable surface — no sibling rows, no lifecycle anchors, no Phase 3–6, and its finish is a **handoff**, not `Done` → **`mstar-iteration/references/plan-scoped-pm.md`**.
35
36
 
@@ -101,7 +102,7 @@ Detailed conflict priority and dev allocation:
101
102
 
102
103
  ## Host Dispatch Rule (Critical)
103
104
 
104
- In invoke-based hosts (OpenCode / Cursor Task / Codex with callable multi-agent tools):
105
+ In invoke-based hosts (any host whose active reference exposes a callable invoke / delegation tool):
105
106
 
106
107
  - Assignment markdown alone is not dispatch.
107
108
  - Each independent Assignment needs one matching invoke.
@@ -110,7 +111,7 @@ In invoke-based hosts (OpenCode / Cursor Task / Codex with callable multi-agent
110
111
 
111
112
  Host invoke/dispatch details: `mstar-host` → active host reference and `references/parallel-dispatch.md`.
112
113
 
113
- **dsh:** mstar **stops arming** a goal — dsh progress is the native workflow (workflow snapshot phases + dispatch gates + **subagent settle notifications**), never a `/goal` objective or goal round loop. Phase 2 progression is the **`Rescheduling checkpoint`** (a settle notification is a `result-settled` one): dispatch the ready independent work before any wait; waiting is right when a dispatched child already owns that work — **never** a duplicate unit of work against the same worktree. Procedure → `mstar-iteration` `references/phase-2-worktree-lease.md` §2.4; rule → `mstar-host` → `references/dsh.md`.
114
+ **Native-workflow hosts:** when the active host reference declares a native workflow driver instead of a goal loop, iteration progress is that workflow (workflow snapshot phases + dispatch gates + child **settle notifications**), never a goal-round loop. Phase 2 progression is then the **`Rescheduling checkpoint`** (a child settle is a `result-settled` one): dispatch the ready independent work before any wait; waiting is right when a dispatched child already owns that work — **never** a duplicate unit of work against the same worktree. Procedure → `mstar-iteration` `references/phase-2-worktree-lease.md` §2.4; host declaration and its per-step rules → the active `mstar-host` reference.
114
115
  Dispatch mechanics and templates:
115
116
  `references/project-manager/dispatch-and-assignment.md`.
116
117
 
@@ -156,11 +157,13 @@ If any item below matches, fix the dispatch/plan state or mark `Blocked`—do **
156
157
 
157
158
  ### PM entry sessions
158
159
 
159
- | Entry | Next reads |
160
+ Entry spellings differ per host — the active `mstar-host` reference owns them (its PM entry / skill loading section: command form, skill invocation form, session auto-load behavior). This table carries the routing only.
161
+
162
+ | Entry surface | Next reads |
160
163
  |-------|------------|
161
- | **`/pm`** or **`pm` skill** (Codex, Cursor; OpenCode when no command) | This shim → **`project-manager.md`** § Required Reading + topic skills on demand |
162
- | **Cursor / OpenCode** host iteration `commands/` | Command Boot + **`project-manager.md`** — iteration lifecycle only; **not** required for ordinary per-plan PM |
163
- | **OpenCode** (no command, not `/pm`) | `project-manager` + `mstar-host` → `opencode.md` |
164
+ | Host ships a **`/pm`** command or exposes this **`pm`** skill | This shim → **`project-manager.md`** § Required Reading + topic skills on demand |
165
+ | Host iteration `commands/` (where shipped) | Command Boot + **`project-manager.md`** — iteration lifecycle only; **not** required for ordinary per-plan PM |
166
+ | Host with no command entry | `project-manager` + `mstar-host` → the active host reference |
164
167
  | **`/iteration-drive --assignment` / `--workflow --plan` / `--resume`**(scoped primary) | **`mstar-iteration/references/plan-scoped-pm.md`** — bind → `show` → constrain to the returned scope; finish = handoff; coordinator sequence for accept/integration/complete |
165
168
 
166
169
  **Dispatch-first**, iteration branch policy(`iteration_base_branch` / `spec_integration_branch` / `target_branch`), Autonomous Execute → **`mstar-iteration/references/phase-2-worktree-lease.md`**;Phase 2 的 **`Rescheduling checkpoint`**(何时重新评估可派发 work、五个冻结 reason、wait reason)→ 该文件 §2.4。Routing, gates, Task Board, QC, templates → this file + topic `mstar-*` skills.
@@ -301,7 +304,7 @@ Minimum invariants:
301
304
  - User conversation follows user language.
302
305
  - PM Assignment body can be Chinese by default.
303
306
  - Technical artifacts/reports/code/config/commit messages default to English unless user asks otherwise.
304
- - Keep **all role references** as plain role id (no `@`) in Assignment body — including `Execute as`, routing narrative, `QA gate`, and anti-pattern examples. Host invoke uses task tool `subagent` matching `Execute as` per `mstar-host` (OpenCode: `opencode.md` § Role-mention hygiene).
307
+ - Keep **all role references** as plain role id (no `@`) in Assignment body — including `Execute as`, routing narrative, `QA gate`, and anti-pattern examples. On an invoke-based host the Assignment role reaches that host's role-binding field (field name and mention hygiene → the active `mstar-host` reference).
305
308
 
306
309
  ---
307
310
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pm
3
- description: "PM entry shim — force project-manager orchestration when user invokes /pm or this skill (Codex, Cursor, OpenCode, Kimi, ZCode, and omp). General per-plan PM work: this skill + project-manager.md. Formal iteration lifecycle: mstar-iteration (host commands/ may orchestrate Phase 1–5). Boot, routing, dispatch SSOT → mstar-roles/references/project-manager.md and topic mstar-* skills — not here."
3
+ description: "PM entry shim — force project-manager orchestration when the user invokes /pm or this skill. General per-plan PM work: this skill + project-manager.md. Formal iteration lifecycle: mstar-iteration (host commands/ may orchestrate Phase 1–5). Boot, routing, dispatch SSOT → mstar-roles/references/project-manager.md and topic mstar-* skills — not here. Host entry spelling → the active mstar-host reference."
4
4
  ---
5
5
 
6
6
  # PM (entry shim)
@@ -9,14 +9,13 @@ description: "PM entry shim — force project-manager orchestration when user in
9
9
 
10
10
  ## Host entry
11
11
 
12
- | Host | Use |
12
+ Entry spelling differs per host; the **active `mstar-host` reference** owns it (command form, skill invocation form, session auto-load behaviour, iteration command names). This table keeps the routing only.
13
+
14
+ | Entry surface | Use |
13
15
  |------|-----|
14
- | **Codex** | **`/pm`** or this skill → **`project-manager`** for the session |
15
- | **Cursor** | **`/pm`** or this skill → general PM orchestration (single-plan, hotfix, QC waves, dispatch) **without** starting an iteration. Formal iteration → host **`commands/`** + **`mstar-iteration`** |
16
- | **OpenCode** | Same as Cursor when no command: **`project-manager`** via `mstar-roles` → `references/project-manager.md` |
17
- | **Kimi** | **`/skill:pm`** or this skill → **`project-manager`**; iteration → plugin **`commands/`** (`/morning-star-harness:iteration-*`) |
18
- | **ZCode** | **`/morning-star-harness:pm`** or **`/skill:pm`** → **`project-manager`** (no session auto-load) |
19
- | **omp** | **`/skill:pm`** or this skill → **`project-manager`**; iteration → **`/iteration-start`** · **`/iteration-drive`** · **`/iteration-loop`** (filename commands) |
16
+ | Host ships a **`/pm`** command or exposes this **`pm`** skill | → **`project-manager`** for the session (general PM orchestration: single-plan, hotfix, QC waves, dispatch) |
17
+ | Host with no command entry | Same route: **`project-manager`** via `mstar-roles` → `references/project-manager.md` |
18
+ | Formal iteration (host **`commands/`** where shipped) | Phase 1–5 sequencing by the host commands — **without** an iteration the shim still serves ordinary per-plan PM |
20
19
 
21
20
  **Iteration lifecycle** (optional): host `commands/` may sequence Phase 1–5; semantics SSOT → **`mstar-iteration`**. Not required for ordinary PM work.
22
21
 
@@ -24,7 +23,7 @@ description: "PM entry shim — force project-manager orchestration when user in
24
23
 
25
24
  **Codebase audit** (optional): `/codebase-audit` command → **`mstar-audit`** — read-only codebase survey producing prioritized, self-contained improvement plans. Output feeds iteration-start §1 Research or normal Prepare → Execute. Dispatched by PM under `Task category: audit`.
26
25
 
27
- Detect host → **`mstar-host`** → `references/codex.md` | `cursor.md` | `opencode.md` | `kimi.md` | `zcode.md` | `omp.md`.
26
+ Detect host → **`mstar-host`** → the reference that detection resolves to (per-host entry, tool shapes and plan-mode bridges live only there).
28
27
 
29
28
  ## Read next (in order)
30
29
 
@@ -36,7 +35,7 @@ Detect host → **`mstar-host`** → `references/codex.md` | `cursor.md` | `open
36
35
 
37
36
  1. **Delegate** — PM does not implement, QC, or QA in-thread (`project-manager.md` Execution Boundary; hotfix → `mstar-phase-gates`).
38
37
  2. **Dispatch** — when host has invoke/Task tools: **1 Assignment ⇒ 1 invoke** (`mstar-dispatch-gates`). Markdown alone is not dispatch.
39
- 3. **SSOT** — iteration lifecycle → **`mstar-iteration`**; Cursor Plan mode → **`mstar-host/references/cursor-plan-mode-bridge.md`**.
38
+ 3. **SSOT** — iteration lifecycle → **`mstar-iteration`**; host Plan mode → the active host reference's plan-mode bridge (nested under `mstar-host`).
40
39
  4. **Autonomous Execute push** — multi-plan iteration Phase 2–5: continuously dispatch implement → QC → QA → Done through merge-ready exit without routine yes/no prompts; **Blocked** only on true conflicts or metadata gaps → **`mstar-iteration` §2.6**.
41
40
 
42
41
  Conflict: user instructions → project `AGENTS.md` / `CLAUDE.md` → `mstar-harness-core` → this file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mstar-harness/dsh",
3
- "version": "3.10.0",
3
+ "version": "3.10.2",
4
4
  "description": "Morning Star harness dsh (DeepSeek Harness) cordis function plugin — in-process engine gates (status/dispatch/lease) with hard refusal channels.",
5
5
  "keywords": [
6
6
  "dsh",