@mstar-harness/dsh 3.9.3 → 3.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,8 @@ protocol prose** (single canonical copy) → `mstar-engine-legacy/references/lea
9
9
  checklist** — do not invent alternate lease field names; do not re-state the
10
10
  full protocol here.
11
11
 
12
+ **Scoped primary route**(`/iteration-drive --assignment|--workflow/--plan|--resume`): this file is the **whole-iteration** execution checklist. On the scoped route every handwritten snapshot / register mutation below is replaced by a frozen `mstar plan …` state verb (which owns the same-host lock) → **`plan-scoped-pm.md`**. The §2.0 gates, per-plan loop, worktree layout and read-only validators still apply; the plan session's finish is a **handoff**, not `Done`.
13
+
12
14
  ## When it applies
13
15
 
14
16
  **Phase 2**(SKILL.md execute/resume route + `iteration-drive` / `iteration-loop`
@@ -54,12 +56,16 @@ starts at **Phase 2 entry**.
54
56
 
55
57
  SSOT = `{WORKFLOW_DIR}/<id>/snapshot.json` + `{PLAN_DIR}/`。todos 只追踪本轮下一步。
56
58
 
59
+ **Scoped route**:todos 是 **plan-local 任务列表**(本 plan 的 task / gate),**不**追加 `phase-3-*` / `phase-4-*` / `phase-5-*` / `phase-6-*`;scoped finish = handoff → **`plan-scoped-pm.md`** §4–§5。
60
+
57
61
  ## 2.2 Read backlog
58
62
 
59
63
  1. 读 `mstar-artifacts` + workflow snapshot(`{WORKFLOW_DIR}/<id>/snapshot.json`)与根 `status.json`
60
64
  2. 列出 snapshot 中 `status` ∈ `{Todo, InProgress, InReview, Blocked}` 的 plan(优先级:`InProgress` → `InReview` → `Todo` → unblock `Blocked`)
61
65
  3. 读 snapshot `branch.base` / `branch.target`,以及 plan `metadata.spec_integration_branch` / `merge_target` / `primary_spec` 链接
62
66
 
67
+ **Scoped route**:backlog **就是 `bind` 返回的那一行**(`--workflow/--plan` 从 `row.coordination.prepared.assignment_path` 解析)——**禁止**按「第一个未完成 plan」或整迭代优先级列表选择。
68
+
63
69
  ## 2.3 Branch anchors + integration branch + integration worktree(Phase 2 入口)
64
70
 
65
71
  **Branch anchors 解析顺序**(任一环节缺失则 STOP,**禁止**默认 `main`/`master`):
@@ -122,11 +128,31 @@ claim/release) **MUST** run inside a same-host exclusive write lock for the full
122
128
  read-check-replace-verify sequence. Engine writers acquire the lock
123
129
  automatically (`writeWorkflowSnapshot` / `registerWorkflow` use
124
130
  `<status-file dir>/.status-write.lockdir/` — for snapshots the lockdir lands
125
- inside `workflows/<id>/`); for manual edits prefer the engine-check commands
131
+ inside `workflows/<id>/`); when no engine writer is available, prefer the read-only engine-check commands
126
132
  (`mstar lease verify --workflow <id>`, `mstar worktree check`) over hand-rolled
127
- `flock`. The atomic-mkdir alternative (`.status-write.lockdir/` in the same
128
- directory as the file) remains the documented fallback. Do **not** invent a
129
- distributed CAS CLI.
133
+ `flock`, and never substitute them for a mutation verb. The atomic-mkdir alternative (`.status-write.lockdir/` in the same
134
+ directory as the file) remains the documented fallback for the whole-iteration
135
+ route when no engine writer exists. Do **not** invent a distributed CAS CLI.
136
+
137
+ **Scoped route (plan-scoped primary).** The lock is **available and required**
138
+ here too — but it is **not sufficient**, and the atomic-mkdir / hand-rolled
139
+ `flock` fallback above does **not** re-open a manual path on this route. The
140
+ lock is acquired **inside** the `mstar plan …` state verbs, which replace every
141
+ handwritten snapshot mutation:
142
+
143
+ | Snapshot mutation | Scoped call(owns the lock) |
144
+ | --- | --- |
145
+ | execution claim / resume | `mstar plan bind` |
146
+ | progress / residual rows | `mstar plan progress` / `residual-add` / `residual-close` |
147
+ | plan finish(no ownership change) | `mstar plan handoff` |
148
+ | ownership transfer | `mstar plan accept` / `return` |
149
+ | integration attempt + atomic completion | `mstar plan integration-start` → Git merge → `integration-accept` → `complete` |
150
+ | crash recovery | `mstar plan reconcile` |
151
+
152
+ Holding this lock, or passing the **read-only** validators (`mstar lease
153
+ verify` / `mstar worktree check` — still required), **does not** authorize a raw
154
+ snapshot write, `--force`, a takeover, or a manual lease release. Scoped route
155
+ details → **`plan-scoped-pm.md`**; field semantics → **`mstar-artifacts/references/status-and-residuals.md`**.
130
156
 
131
157
  **Cross-plan parallel hard gate:** Applies **whether or not** `Worktree mode: waived`.
132
158
  Lease-gated **cross-plan parallel** writable implement is allowed **only when**
@@ -155,7 +181,7 @@ mismatch → **STOP**.
155
181
 
156
182
  对每个本轮要推进的 active `plan_id`(可交错/并行,非强制 plan A 全 Done 再 plan B):
157
183
 
158
- 1. **Claim / resume — execution lease**(§2.0 #5 未 waive):按下方「Execution lease」claim/resume 规则——同 `holder` → resume(校验 `worktree_path` / `working_branch` 与 Assignment 一致);异 `holder` → **Blocked**;`InProgress` 无 lease → **STOP** 升级(孤儿恢复 → **`mstar-artifacts`**);verify 通过前 **禁止**可写派发
184
+ 1. **Claim / resume — execution lease**(§2.0 #5 未 waive):按下方「Execution lease」claim/resume 规则——同 `holder` → resume(校验 `worktree_path` / `working_branch` 与 Assignment 一致);异 `holder` → **Blocked**;`InProgress` 无 lease → **STOP** 升级(孤儿恢复 → **`mstar-artifacts`**);verify 通过前 **禁止**可写派发。**Scoped route**:fresh claim 的唯一入口是 `mstar plan bind`(`--assignment` / `--workflow --plan`)——同 plan 的第二个 fresh 形态 → `coordination.duplicate-holder`;续接只经 `mstar plan bind --resume`,且为**只读校验**(不重新获取 ownership、不重启执行、不改 revision;无自动 attach / fallback plan / TTL 夺取)。
159
185
  2. **Plan start — feature worktree + branch**:创建/校验 dedicated feature worktree(默认 `<repoRoot>/.worktrees/<plan-id>-<slug>`);Assignment 须含绝对 `Worktree path` + `Working branch`(与 lease 一致)。plan 内多可写并行轨 → **`mstar-branch-worktree`** **`references/parallel-writable-pre-dispatch.md`**
160
186
  3. **Implement → InReview**(产品编辑在 feature worktree;plans / snapshot / iterations / SDD 经 control root 绝对路径):
161
187
  - **默认 `Execution mode: sdd`**(多 task plan;hotfix 可 `inline`)。
@@ -167,9 +193,18 @@ mismatch → **STOP**.
167
193
  5. Dispatch **one** task reviewer subagent(brief + report + diff + Global Constraints)
168
194
  6. Fix loop 直至 review clean;append `{SDD_DIR}/progress.md`;更新 snapshot plan 行 / plan checkbox
169
195
  7. 放行已满足依赖的 next task;不等待无依赖任务,PM 独占共享 progress / snapshot 写入
170
- - 每次 Completion Report 后更新 snapshot(`workflows/<id>/snapshot.json`)+ 主 plan
171
- 4. **QC → QA gate**(plan 保持 **`InReview`**;**保留** `execution_lease`):per-plan 审查链 → **`mstar-sdd`**(L1–L2)+ **`mstar-review-qc/references/review-responsibility-boundaries.md`**(L3 tri / inline 单席;raw reports in `{SDD_DIR}/review/`,durable summary in main plan/snapshot)+ **`QA gate`**(`mandatory` → `qa-engineer`;`pm-acceptance` → PM checklist)。**禁止**在 integration merge 成功前设 `Done` 或删除 `execution_lease`。
172
- 5. **Plan complete — serial merge back**(§2.0 #5 未 waive):自 **integration worktree** claim/resume snapshot 顶层 `integration_merge_lease` → 将 plan feature branch 合并入 `spec_integration_branch`(仅 merge-lease holder;细则 → 下方「Integration merge lease」)→ 记录 merge commit 证据 → 释放 merge lease;**同轮**设 `Done` 并删除 `execution_lease`(此即 owner 的 lease 释放动作),并在**同一 locked update** 内把 `metadata.working_branch` / `metadata.worktree_path` 持久化到该 plan 行(归属生产者义务;语义唯一 home → `mstar-branch-worktree`「Worktree / branch cleanup」Ownership)。merge 失败:保持 `InReview` + 保留 lease,不得标 `Done`。merge 成功即打开该 plan 的**同轮 cleanup 资格**(timing lane 1 → 下方「Same-round plan cleanup」)。
196
+ - **整迭代路线**:每次 Completion Report 后更新 snapshot(`workflows/<id>/snapshot.json`)+ 主 plan。**Scoped route**:每次 Completion Report 后的 row 更新只经 `mstar plan progress --session <plan-session> --file <abs-json> --expect <revision>`(仅 `InProgress` / `InReview` / `Blocked` 子集;**禁止** `Todo` / `Done` / lease 删除);leaf 与 plan 会话**不得**直接写 snapshot / 根 register。
197
+ 4. **QC → QA gate**(plan 保持 **`InReview`**;**保留** `execution_lease`):per-plan 审查链 → **`mstar-sdd`**(L1–L2)+ **`mstar-review-qc/references/review-responsibility-boundaries.md`**(L3 tri / inline 单席;raw reports in `{SDD_DIR}/review/`,durable summary in main plan/snapshot)+ **`QA gate`**(`mandatory` → `qa-engineer`;`pm-acceptance` → PM checklist)。**禁止**在 integration merge 成功前设 `Done` 或删除 `execution_lease`。**Scoped route**:QA 证据齐备后的写点是 `mstar plan handoff --session <plan-session> --file <abs-json> --expect <revision>`,随后 **STOP**(row 保持 `InReview`、保留 lease)——`Done` 与 lease 释放不是 plan 会话的动作。
198
+ 5. **Plan complete — serial merge back**(§2.0 #5 未 waive;**整迭代路线**,语义未变 —— scoped route 见紧随其后的冻结序列,plan 会话不得执行本步骤):自 **integration worktree** claim/resume snapshot 顶层 `integration_merge_lease` → 将 plan feature branch 合并入 `spec_integration_branch`(仅 merge-lease holder;细则 → 下方「Integration merge lease」)→ 记录 merge commit 证据 → 释放 merge lease;**同轮**设 `Done` 并删除 `execution_lease`(此即 owner 的 lease 释放动作),并在**同一 locked update** 内把 `metadata.working_branch` / `metadata.worktree_path` 持久化到该 plan 行(归属生产者义务;语义唯一 home → `mstar-branch-worktree`「Worktree / branch cleanup」Ownership)。merge 失败:保持 `InReview` + 保留 lease,不得标 `Done`。merge 成功即打开该 plan 的**同轮 cleanup 资格**(timing lane 1 → 下方「Same-round plan cleanup」)。
199
+
200
+ **Scoped route(冻结调用序列 — 取代上面的手工步骤;仅 coordinator 席位执行)**:
201
+
202
+ 1. `mstar plan accept --session <coordinator-session> --plan <id> --handoff <id> --expect <revision>` — 所有权移交(`submitted → accepted`;**不是**合并验收,worktree/branch 不变)。
203
+ 2. `mstar plan integration-start --session <coordinator-session> --plan <id> --handoff <id> --expect <revision>` — 在干净、检出 `snapshot.branch.integration` 的 integration checkout 上固定 `base_sha` + source pin,且**先于** Git;拒绝外来 merge lease。
204
+ 3. **coordinator 显式执行唯一 Git 动作**(参数数组、字符串直传、不拼接 shell):`git -C <integration-worktree-path> merge --no-ff --no-edit <pinned-source-sha>` — 无 squash / rebase / 按分支名合并;CLI 状态动词**从不**代跑 merge。
205
+ 4. `mstar plan integration-accept …` → `mstar plan complete …` — 验证证据后**一次原子完成**:`status: Done`、保留 `metadata.working_branch` / `metadata.worktree_path` 与既有 track branches、删除该行 `execution_lease` **与** coordinator 的 `integration_merge_lease`。
206
+
207
+ **Plan 会话不执行以上任何一步**(`accept` / `integration-*` / `complete` 对 plan session 被拒绝)。失败恢复**只用** `mstar plan reconcile --session <coordinator-session> --plan <id> --handoff <id> --expect <revision>`:回退到 `accepted` + 释放本次 merge lease(`retry-ready`)/已具备唯一合并证据则补记证据并原子完成(`completed`,**不重复 merge**);`integrating` 且存在 `MERGE_HEAD`、冲突或脏树 → `coordination.integration-unresolved`,全部状态与 lease 保留;无法证明的图 → `coordination.integration-diverged`。**禁止**传调用方成功标志、**禁止**重复 merge。
173
208
  6. **Cross-plan 进度同步**:更新 `{ITERATION_DIR}/<iteration-id>/delivery-compass.md` 的 `## Plans` 表状态列
174
209
  7. **Next plan / parallel wave** 从步骤 1 继续(可并行推进其他已 claim 的 plan;merge 仍排队串行)
175
210
 
@@ -189,7 +224,7 @@ mstar worktree cleanup --workflow <id> [--harness <path>] [--apply] [--worktree
189
224
 
190
225
  - 先 dry-run 看 `verdict | kind | ref | reason`(merge 刚完成 → 该 Done 行 eligible);`--apply` 才变更。lane 1 只清**本地面**(无 `--remote`;远端残留留给 Phase 6)。
191
226
  - 分支可能仍被该 Done-child worktree 检出 → apply 内部先移 worktree,再 re-probe / re-plan 删分支(**worktree 移除 ≠ 分支删除**;细则 → 契约本体)。
192
- - **lease 释放是手工 owner 动作、cleanup 范围外**:上方步骤 5 的 `Done` + `execution_lease` 删除就是 owner 释放动作;cleanup **从不**替 owner 释放任何 lease。standalone plan(无 integration)以 `branch.target` 为证据 base,且须**先 terminal close**。
227
+ - **lease 释放不在 cleanup 范围内,scoped route 也没有手工释放动作**:scoped route 由 coordinator 的 `mstar plan complete` 在**一次原子写入**中同时删除该行 `execution_lease` 与 `integration_merge_lease`;整迭代路线仍是步骤 5 的 owner 同轮 `Done` + 删 lease(未变)。cleanup **从不**替 owner 释放任何 lease,也**不**依赖已删除的 lease 判断归属(归属由保留的行 `metadata.working_branch` / `metadata.worktree_path` 与 track Assignments 追溯)。standalone plan(无 integration)以 `branch.target` 为证据 base,且须**先 terminal close**。
193
228
  - **禁止**为让 cleanup 通过而推进/终结父迭代或改 snapshot 状态;受保护行保持 `refuse` 是正确行为,不是失败。
194
229
 
195
230
  ## 2.5 Dispatch-first(implement 派发约束)
@@ -251,18 +286,47 @@ Lives on the snapshot plan row — `{WORKFLOW_DIR}/<id>/snapshot.json` → `plan
251
286
  6. Re-read and verify `holder`, `worktree_path`, `working_branch` match before
252
287
  any writable dispatch.
253
288
 
289
+ **Scoped route — fresh bind:** steps 1–6 are executed **inside** `mstar plan bind`
290
+ (`--assignment` / `--workflow --plan`) under its own lock — no handwritten
291
+ complete-file update and no hand-rolled atomic replace. A second **fresh** bind
292
+ on a row already held → `coordination.duplicate-holder` (with the active holder,
293
+ workflow and plan).
294
+
295
+ **Scoped route — `--resume`:** `mstar plan bind --resume` is **read-only** and is
296
+ the only continuation path for the original session: it validates the pinned
297
+ binding (the current session plus lease `worktree_path` / `working_branch`) and
298
+ continues — it never re-runs step 5, never re-acquires ownership, never restarts
299
+ execution and never changes the row revision. It may report handed-off /
300
+ accepted / completed context read-only, and a released lease is never
301
+ reacquired. Cross-primary references are **absolute control-root paths**
302
+ (`local://` is not a portable handoff address).
303
+
254
304
  ### Hold, release, override
255
305
 
256
306
  - Lease stays active across `InProgress` and `InReview` (including post-QC/QA
257
- ready-to-merge) unless released or transferred.
307
+ ready-to-merge) unless released or transferred. **Scoped route:** a plan
308
+ session's normal exit is `mstar plan handoff` — it **keeps** the lease and the
309
+ row stays `InReview`; a lease is never dropped at handoff.
258
310
  - Normal release: re-read the control snapshot under write lock; confirm stored `holder` matches
259
311
  this session — mismatch → **Blocked**; then **delete** `execution_lease`
260
- (never `null` or tombstone).
312
+ (never `null` or tombstone). **Scoped route:** there is **no standalone
313
+ release verb** — release happens only inside a state verb: `mstar plan accept`
314
+ / `return` (ownership transfer) or `mstar plan complete` (deletes
315
+ `execution_lease` **and** the coordinator's `integration_merge_lease` in one
316
+ atomic write).
261
317
  - `Done` authority deletes `execution_lease` in the same update as `status: "Done"`
262
318
  — **only after** successful integration merge (when lease gate not waived).
319
+ **Scoped route:** that authority is the coordinator's `mstar plan complete`
320
+ (after `integration-accept`, whose pinned verified Git result proves the
321
+ merge); the plan session **cannot** set `Done` or delete a lease.
263
322
  - Override of another holder requires **explicit user instruction this turn** +
264
323
  audit note on snapshot plan `notes` / `notes.jsonl` (prior holder, new holder/release, user authorized).
324
+ **Scoped route:** there is **no** `--force`, takeover, or automatic abandonment
325
+ flag; an abandoned active owner needs explicit human recovery outside these
326
+ commands.
265
327
  - V1: **manual release only** — no `expires_at`, TTL, or heartbeat authority.
328
+ **Scoped route:** no pane-state, idle, TTL, or terminal-label basis for
329
+ releasing or stealing a lease.
266
330
 
267
331
  ### Orphan `InProgress` without lease
268
332
 
@@ -312,6 +376,13 @@ Lives top-level on the snapshot — `{WORKFLOW_DIR}/<id>/snapshot.json`.
312
376
  6. On conflict/failure: retain leases; plan stays **`InReview`** — do not set
313
377
  `Done`. Release merge lease only after the integration worktree is clean and known state.
314
378
 
379
+ **Scoped route:** steps 1–6 are the **coordinator's** `mstar plan
380
+ integration-start` → explicit Git merge → `integration-accept` → `complete`
381
+ (§2.4 step 5). `integration-start` pins `base_sha` + the source pin **before**
382
+ Git runs and refuses a foreign merge lease; `reconcile` is the **only** recovery
383
+ verb (never a caller-supplied success flag, never a second merge). A plan
384
+ session can neither claim, resume, nor release this lease.
385
+
315
386
  Execution and merge leases may coexist; merge lease does not grant execution
316
387
  ownership for the source plan.
317
388
 
@@ -323,7 +394,7 @@ waives **only**:
323
394
  - Per-plan feature worktree defaults. The dedicated integration coordination
324
395
  checkout remains required; the primary checkout keeps its recorded branch
325
396
  and remains the process-SSOT holder via absolute control-root paths.
326
- - Snapshot lease claim/hold/release defaults (`plans[].execution_lease` and top-level `integration_merge_lease`)
397
+ - Snapshot lease claim/hold/release defaults (`plans[].execution_lease` and top-level `integration_merge_lease`) — **scoped route 不可豁免**:该路线本就不做手工 lease 写入(只经 `mstar plan …`),waiver 也不解除其 CLI 前置(CLI 缺失 → fail closed)
327
398
 
328
399
  It does **not** waive the **cross-plan parallel safety gate**. Under waiver,
329
400
  cross-plan **parallel writable** implement still requires same-host exclusive
@@ -0,0 +1,179 @@
1
+ # Plan-scoped primary PM (scoped `iteration-drive` route)
2
+
3
+ **Single home for the scoped route.** This file owns: accepted addressing forms, scoped boot, the plan-local driving loop, the scoped stop, and the coordinator command sequence. It does **not** own field/schema tables, executable flag syntax, or Assignment header templates.
4
+
5
+ - Command frontmatter/argument surface → **`commands/iteration-drive.md`**
6
+ - Executable flags, exit codes, JSON envelopes → **`docs/cli.md`**(CLI owner)
7
+ - `coordination` / session / handoff / revision fields and row/register ownership → **`mstar-artifacts/references/status-and-residuals.md`**(sole runtime schema home)
8
+ - Portable primary Assignment header → **`mstar-roles/references/project-manager/dispatch-and-assignment.md`**
9
+ - Dispatch mechanics, isolation gates → **`mstar-dispatch-gates`**, **`mstar-sdd`**, **`mstar-branch-worktree`**
10
+
11
+ No command aliases and no second vocabulary for the operations below.
12
+
13
+ ## 0. Route selection (before any whole-iteration boot)
14
+
15
+ | Invocation | Route |
16
+ |---|---|
17
+ | `/iteration-drive`(**no args**) | unchanged whole-iteration boot and Phase 2 → 3 → 4 → 5 → 6 route(`commands/iteration-drive.md`) |
18
+ | `/iteration-drive --assignment <abs.md>` \| `--workflow <id> --plan <id>` \| `--resume <abs-session.json>` | **this file** — scoped primary route |
19
+ | any other nonempty argument shape | **fail closed before boot and before claim**; never broaden to the whole-iteration route |
20
+
21
+ Scoped boot does **not** load `mstar-compound` or the Phase 3–6 detail files merely because whole-iteration boot does. A leaf executor that finds this command in its own Assignment is refused by the role boundary (`mstar-dispatch-gates`), never promoted to PM.
22
+
23
+ ## 1. Addressing forms (strict parse)
24
+
25
+ ```text
26
+ /iteration-drive --assignment <absolute-md-path>
27
+ /iteration-drive --workflow <id> --plan <id>
28
+ /iteration-drive --resume <absolute-session-json-path>
29
+ ```
30
+
31
+ - The first two are **fresh** addressing forms; the third explicitly **resumes** an already bound session.
32
+ - Fail **before any bind** on: duplicate flags, unknown flags, positional arguments, missing/blank values, mixed forms, partial `--workflow`/`--plan` pairs, and any path that is not absolute.
33
+ - Rejection is terminal for the turn: report the malformed form and the accepted forms. There is no fallback plan, no "first unfinished row", and no whole-iteration fallback.
34
+ - Both fresh forms resolve the **same** registered Assignment: `--workflow/--plan` reads `row.coordination.prepared.assignment_path`; it never selects the first unfinished row.
35
+
36
+ ## 2. Scoped boot
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).
39
+ 2. **Bind once**, matching the form exactly:
40
+
41
+ ```bash
42
+ mstar plan bind --assignment <absolute-md-path> [--json]
43
+ mstar plan bind --workflow <id> --plan <id> [--harness <absolute-path>] [--json]
44
+ mstar plan bind --resume <absolute-session-json-path> [--json]
45
+ mstar plan bind --coordinator --workflow <id> [--harness <absolute-path>] [--json] # coordinator seat only
46
+ ```
47
+
48
+ `bind` is the only operation without an external `--expect`: it reads, checks and claims atomically against current ownership. Fresh coordinator bind initializes the workflow's coordinator only when absent; a second fresh coordinator fails exactly like a duplicate plan holder. Plan fresh bind requires a row that was **prepared** by the coordinator.
49
+ 3. **Re-read with `show` and constrain the session to the returned scope**:
50
+
51
+ ```bash
52
+ mstar plan show --session <plan-session.json> [--json]
53
+ mstar plan show --session <coordinator-session.json> --plan <id> [--json]
54
+ ```
55
+
56
+ `show` returns the selected row, resolved scoped paths, `allowed_operations`, snapshot byte version and project-register byte version, and `revision`. It never returns an editable sibling snapshot. A plan session passes no `--plan`; a coordinator session requires it.
57
+ 4. **Constrain everything that follows to that scope**: loaded skills, dispatched child inputs, session backlog, goal text, session todos, STOP conditions, and every writable path.
58
+ 5. **Stale input stops.** If a later `show` reports the Assignment hash changed, the session/scope/holder no longer matches, or the revision is behind, stop and report — do not re-bind silently and do not fall back to generic iteration drive.
59
+
60
+ ## 3. Scope boundary (writable surface)
61
+
62
+ A scoped actor writes **only its own row and its registered project residual bucket**. Concretely:
63
+
64
+ | Permitted | Forbidden |
65
+ |---|---|
66
+ | row `coordination.*`(`prepared` / `progress` / `handoff`), row `status`, row `revision`, retained `metadata.working_branch` / `metadata.worktree_path` / `metadata.track_branches` | sibling rows, lifecycle anchors, snapshot `branch` / `integration_worktree_path` / `execution_policy`, `compass_ref` |
67
+ | `entries[<planId>]` in `projects/<project-id>/residuals.json` via `residual-add` / `residual-close` | other register buckets, the v2 root `status.json` register, shared indexes (`{KNOWLEDGE_DIR}` / `{ITERATION_DIR}`), iteration PR, Phase 3–6 |
68
+ | `progress` / `residual-add` / `residual-close` / `handoff`(plan session) | any raw `writeWorkflowSnapshot` / direct snapshot or register edit, `--force`, arbitrary holder input, takeover, a lease-release verb |
69
+
70
+ Field semantics, ownership and lock rules → **`mstar-artifacts/references/status-and-residuals.md`**(「Plan coordination」).
71
+
72
+ ## 4. Plan-local driving
73
+
74
+ Drive the bound plan with the **existing** SDD / gate machinery; scope is inherited by every child input.
75
+
76
+ 1. **Prepare gate**: the coordinator prepared this row (`mstar plan prepare`, §6). A plan session never prepares itself.
77
+ 2. **Implement**: `mstar sdd workspace` → `mstar sdd task-brief` → dispatch implementers → fresh L2 task reviewer(`mstar-sdd` § Per-task loop). `Execution mode: sdd` stays the default for multi-task plans.
78
+ 3. **Plan QC tri**: after all tasks, branch `review-package` → **N=3** tri-review(`mstar-review-qc`, `mstar-dispatch-gates`); then the `QA gate` from the Assignment (`mandatory` → `qa-engineer`; `pm-acceptance` → PM acceptance artifact).
79
+ 4. **Progress**(row status + summary + evidence paths):
80
+
81
+ ```bash
82
+ mstar plan progress --session <plan-session> --file <absolute-json-path> --expect <revision> [--json]
83
+ ```
84
+
85
+ Allowed transitions: `InProgress` → `InProgress|InReview|Blocked`; `Blocked` → `Blocked|InProgress`; `InReview` → `InReview|InProgress|Blocked` **before handoff**. Never `Todo`/`Done`, never lease removal.
86
+ 5. **Residuals**(findings cleanup mode from the Assignment):
87
+
88
+ ```bash
89
+ mstar plan residual-add --session <plan-session> --file <absolute-json-path> --expect <revision> --expect-register <version> [--json]
90
+ mstar plan residual-close --session <plan-session> --entry <id> --note <text> --expect <revision> --expect-register <version> [--json]
91
+ ```
92
+
93
+ Register ownership, entry provenance and the fail-loud validation handoff → **`mstar-artifacts/references/status-and-residuals.md`**.
94
+
95
+ **Backlog / goals / todos / STOP are plan-local**: the session backlog is this plan's tasks; goal text covers **this plan's** flow only(`mstar-host` § `/goal` directive); todos are the plan's task list, and no global phase entry(Phase 3/PR/compound)is seeded; the STOP is the handoff in §5, not plan `Done`.
96
+
97
+ ## 5. Finish = durable handoff(not `Done`)
98
+
99
+ When QC/QA evidence is complete and no child writer is active:
100
+
101
+ ```bash
102
+ mstar plan handoff --session <plan-session> --file <absolute-json-path> --expect <revision> [--json]
103
+ ```
104
+
105
+ - Requires row `InReview`, no active child writes, a clean feature worktree, `review_head === source_sha === feature branch HEAD === feature worktree HEAD`, and the QC/QA evidence pins.
106
+ - The handoff record is immutable; the plan keeps its `execution_lease` and stays **`InReview`**.
107
+ - **Then STOP the scoped session.** Handoff is the scoped finish line. Do **not** set `Done`, do **not** delete `execution_lease`, do **not** open Phase 3 / PR, do **not** run compound, and do **not** treat "last unfinished plan" as an exception that advances the iteration.
108
+ - A user asking to mark `Done` before integration is rejected: `Done` + lease release is the coordinator's atomic completion after a verified merge(§6).
109
+ - After handoff, further `progress` / `residual-*` mutations are rejected by the engine until a coordinator `return`; the session reports the handoff id and waits.
110
+
111
+ ## 6. Coordinator sequence(one coordinator seat per workflow)
112
+
113
+ ```bash
114
+ mstar plan prepare --session <coordinator-session> --plan <id> --assignment <absolute-md-path> --expect <revision> [--json]
115
+ mstar plan accept --session <coordinator-session> --plan <id> --handoff <id> --expect <revision> [--json]
116
+ mstar plan return --session <coordinator-session> --plan <id> --handoff <id> --reason <text> --expect <revision> [--json]
117
+ mstar plan integration-start --session <coordinator-session> --plan <id> --handoff <id> --expect <revision> [--json]
118
+ mstar plan integration-accept --session <coordinator-session> --plan <id> --handoff <id> --expect <revision> [--json]
119
+ mstar plan complete --session <coordinator-session> --plan <id> --handoff <id> --expect <revision> [--json]
120
+ mstar plan reconcile --session <coordinator-session> --plan <id> --handoff <id> --expect <revision> [--json]
121
+ ```
122
+
123
+ 1. **`prepare`** registers the reviewed Assignment on a `Todo`/`Blocked` row after checking path, branch, status and lock inputs and after dependency readiness. It is preparation, not a second business plan; dependency and task-readiness judgment stays PM's.
124
+ 2. **`accept`** is ownership transfer, not integration acceptance: `submitted → accepted`, `execution_lease.holder` moves to the coordinator while worktree/branch stay. No merge, no `Done`.
125
+ 3. **`return`** restores the original plan session as execution holder, sets `InProgress` and records the reason. It cannot return an un-reconciled integrating/merged/completed record: abort the Git merge, `reconcile` to `retry-ready`, then `return`.
126
+ 4. **`integration-start`** reads the clean recorded integration checkout on `snapshot.branch.integration`, refuses any foreign merge lease, and pins the integration HEAD as `base_sha` plus the source pin — all **before** Git runs. Retrying a started attempt is a no-op after a revision refresh; `base_sha` never moves.
127
+ 5. **Git merge is the coordinator's own explicit action**, the only Git mutation in this flow:
128
+
129
+ ```bash
130
+ git -C <integration-worktree-path> merge --no-ff --no-edit <pinned-source-sha>
131
+ ```
132
+
133
+ Argument-array invocation, never shell interpolation; no squash, no rebase, no moving branch-name merge. CLI state verbs never execute this merge.
134
+ 6. **`integration-accept`** records the observed verified result(`integrating → merged`)and keeps both leases and `InReview`. Then **`complete`** performs the single atomic completion: verified Git proof + evidence + findings gate → `status: Done`, retain `metadata.working_branch` / `metadata.worktree_path` / existing track branches, and delete the row `execution_lease` **and** the coordinator's `integration_merge_lease` in **one** snapshot write.
135
+ 7. **Crash recovery uses `reconcile` only** — never a caller-supplied success flag and never a second merge:
136
+
137
+ | Observed state | `reconcile` result |
138
+ |---|---|
139
+ | `integrating`; HEAD == base; clean; source not yet an ancestor | back to `accepted`, drop the attempt + this holder's merge lease, keep coordinator execution lease and `InReview`; outcome `retry-ready` |
140
+ | `integrating` or `merged`; source already ancestor, or unique exact merge proof is an ancestor of HEAD | record proof, apply the atomic completion; outcome `completed`; no duplicate merge |
141
+ | `integrating`; `MERGE_HEAD` / conflicts / dirty checkout | refuse `coordination.integration-unresolved`; all state and leases preserved; resolve or explicitly abort Git, then re-run |
142
+ | moved/missing branch, unexpected parent graph, multiple matching results, changed evidence | refuse `coordination.integration-diverged` / `coordination.evidence-stale`; no `Done`, no lease release |
143
+ | `completed`; proof still valid | read-only no-op `already-completed` |
144
+
145
+ 8. The coordinator — not the plan session — retains dependency release, compass / index / root projections, the iteration PR, and Phase 3–6.
146
+
147
+ ## 7. Revision protocol(`--expect`)
148
+
149
+ - `--expect` is the nonnegative row `coordination.revision` from `show`(absent coordination = 0)— **not** the snapshot `schema_version` or a date.
150
+ - Every mutating row verb requires it. A sibling row's mutation does not change this row's revision; same-row stale input fails `coordination.version-conflict`.
151
+ - After any successful changed row mutation the revision increments **once**; a no-op replay does not increment it. The precondition is still checked on replay, so a stale retry first refreshes with `show`.
152
+ - `bind` is the only exception(§2). Document/register byte versions are separate CAS values(`--expect-register`, `--expect-version`)and never substitute for the row revision.
153
+
154
+ ## 8. Sessions and credentials
155
+
156
+ - Fresh claims allocate a new session UUID; a holder is never derived from a plan id, Assignment path, PID or terminal label. Assignment identity is not session identity.
157
+ - Session envelopes are credentials/pointers, not a second process-SSOT copy. **Never pass a session path — coordinator or plan — into a child Assignment or child invocation.** Children receive the plan's `Worktree path`, `Working branch`, `Plan Path`, `SDD dir` and task-specific brief/report/diff paths only(`mstar-sdd/references/file-handoffs.md`).
158
+ - `--resume` validates the current session and lease and may report handed-off / accepted / completed context read-only. It never reacquires a released lease, never restarts execution, and never attaches to an active foreign holder automatically.
159
+ - A duplicate fresh entry for the same plan — by **either** address — fails with code `coordination.duplicate-holder` plus the active holder, workflow and plan. Only explicit `--resume` of the original session continues;no automatic attach, fallback plan, TTL/idle/pane-state theft.
160
+ - Cross-primary references are readable **absolute control-root filesystem paths**;`local://` is not a portable handoff address.
161
+ - Lost credentials or an abandoned active owner need explicit human recovery outside these commands. No `--force`, takeover or automatic abandonment flag exists.
162
+
163
+ ## 9. Evidence, STOP and failures
164
+
165
+ - Session todos and the final report stay **plan-scoped**: scoped checks / before-after pressure traces and the plan's own gates. Never claim whole-iteration evidence.
166
+ - STOP conditions: handoff submitted(§5), invalid input(§1), stale scope/revision(§2/§7), duplicate holder(§8), un-reconciled Git(§6.7), or a blocked dependency. Report the code, the holder, and the exact next command.
167
+ - Failures are reported from the CLI envelope(`ok:false` + `code`), never invented: exit 2 = invalid input shape, exit 1 = scope / ownership / revision / state / Git / path / lock rejection.
168
+
169
+ ## 10. Missing CLI = fail closed
170
+
171
+ The scoped route **requires** `mstar plan …`. Without it(engine/CLI absent or older than this contract):
172
+
173
+ - **Fail closed with install/upgrade guidance**(name `mstar plan` and the required version or feature).
174
+ - **Never** substitute raw snapshot/register edits, a prompt-only manual protocol, or the engine-absent legacy fallback for the scoped feature. `mstar-engine-legacy` does not provide it.
175
+ - Unscoped no-argument `iteration-drive` behavior is unchanged in that environment.
176
+
177
+ ## 11. Transport(optional)
178
+
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.
@@ -13,6 +13,8 @@ The concise gate summary remains in `references/project-manager.md`.
13
13
  - **Scope and stopping are explicit**: apply `mstar-harness-core` § 定向执行与验证边界. Give each leaf one result, owned paths/symbols, relevant inputs, named checks/selectors, and an evidence-based stopping condition. Reuse unaffected evidence; do not inject a suite merely because the repo exposes it. Independent ready assignments run concurrently after their dependency/isolation checks.
14
14
  - **Review/QC rounds are quantitative, not adjectival**: a read-only review / QC dispatch states a `Budget` (expansion cap) and a `Return shape`, so the seat stops when its assigned questions are answered or the cap is reached, returns the verdict it has plus a truncated-coverage declaration, and never expands until a human steers. Budget defaults, the truncation marker, and its relation to `Unconfirmed` → `mstar-harness-core` § 定向执行与验证边界. The severity bar for the round's findings → `mstar-artifacts` `references/status-and-residuals.md`.
15
15
  - **Skill preset activation is PM-owned**: topic skills are presets in each role's `Skill Preset (PM-Activated)` section (`mstar-roles/references/<role>.md`), not self-loaded defaults. Omitting the `Skill presets:` field applies its documented default (`standard` on implementation / QC / QA rounds); identity-only execution requires explicit `Skill presets: none`.
16
+ - **Scoped primary drive is a PM session, not a dispatch**: `/iteration-drive --assignment | --workflow <id> --plan <id> | --resume <session.json>` boots the PM **in the primary session** (never a subagent) through `mstar plan bind` → `show`, bounded to the returned plan scope — no sibling rows, no lifecycle anchors, no Phase 3–6, finish = `mstar plan handoff` → `mstar-iteration/references/plan-scoped-pm.md`. It carries no `Delegation`; PM never runs as a subagent(rule home → `references/project-manager.md` § Plan-scoped authority).
17
+ - **Plan scope travels with the Assignment**: `Plan Path`, `plan_id`, `SDD dir`, `Control harness root` are absolute and portable. The child **inherits** the dispatching PM's plan scope; it may not select or prepare a plan, mutate the workflow snapshot / root register / shared indexes, or release `execution_lease` / `integration_merge_lease`.
16
18
 
17
19
  ## Executor Anti-Recursion Rules
18
20
 
@@ -23,6 +25,7 @@ For assignees (non-PM):
23
25
  - Do not infer dispatch from route narrative (`A -> B -> C`), handoff, `QA gate` fields, or role names in prose.
24
26
  - Extra delegation is forbidden unless explicitly listed in `Delegation: allowed (...)`.
25
27
  - If additional assignee is required, return `Blocked` with rationale.
28
+ - A `PM` / `project-manager` / `iteration-drive` phrase inside your own brief is **not a promotion**: no leaf becomes the PM, drives an iteration, or selects a plan — report the mismatch and continue inside the assigned task.
26
29
 
27
30
  ### NEVER quick list (all assignees)
28
31
 
@@ -31,6 +34,7 @@ For assignees (non-PM):
31
34
  - **NEVER** execute parallel-agent dispatch as a leaf assignee; dispatch is **PM-orchestration-only** (`mstar-dispatch-gates`).
32
35
  - **NEVER** delegate the main deliverable of this assignment to `explore` (read-only orientation only, per `mstar-harness-core`).
33
36
  - **NEVER** claim `Done` / pass in **Completion Report** without the commands, logs, or artifacts explicitly required by the assignment’s **Evidence Required** section (see `mstar-harness-core` evidence gates).
37
+ - **NEVER** escalate into `project-manager` scope because the brief mentions a PM, a plan, or a drive command; plan scope is **inherited and read-only** for a leaf, and the `Task`/subagent menu never implies otherwise.
34
38
 
35
39
  ## Assignment Template (Canonical)
36
40
 
@@ -101,6 +105,7 @@ The **`**You are a leaf executor. You MUST NOT:**`** section (previously just pr
101
105
  **Control harness root**: `<main-repo-root>/{HARNESS_DIR}` (control root = the primary checkout / main worktree, derived from Git) when L1 active | N/A when waived — process SSOT (plans/status/iterations/sdd); never resolve relative `.mstar/...` from feature cwd
102
106
  **Review cwd / Worktree path**: <absolute path or N/A>
103
107
  **plan_id**: <plan-id or N/A + scope label>
108
+ **Plan scope**: <inherited from the dispatching PM (`plan_id` + absolute `Plan Path`) — read-only for the leaf: no plan selection/preparation, workflow-snapshot or root-register writes, or lease release> | N/A
104
109
  **Review range / Diff basis**: <reproducible basis; merge-base = `metadata.target_branch` or PM-specified ref — not assumed `origin/main`>
105
110
  **Worktree path**: <absolute feature implementer path when L1/L2 isolation used; default `<repoRoot>/.worktrees/<plan-id>-<slug>` (L2 tracks: `<track-slug>`); must ≠ the main worktree (control root) ≠ `integration_worktree_path`>
106
111
  **Main worktree branch**: <recorded residency branch of the primary checkout (main worktree), from the main plan header — passed unchanged; never a lifecycle-owned branch>
@@ -207,6 +212,8 @@ Do **not** waive worktree because default-gitignored `plans/` are missing under
207
212
  For host behavior details (dispatch turn shape, paste-only failure mode, invoke-count discipline),
208
213
  read `mstar-host` → the active host reference and `references/parallel-dispatch.md` as host SSOT for dispatch.
209
214
 
215
+ The **scoped primary route** never appears as a subagent invoke on any host: `/iteration-drive` with a scope flag boots the PM in the **primary session** — PM never runs as a subagent(rule home → `references/project-manager.md` § Plan-scoped authority)— so an Assignment whose `Execute as` is `project-manager` is a dispatch defect, not a target (`mstar-iteration/references/plan-scoped-pm.md` §2).
216
+
210
217
  ## SDD vs inline implement Assignment(PM)
211
218
 
212
219
  | Mode | Who loads `mstar-sdd` | Assignment shape |
@@ -27,6 +27,12 @@ Detailed procedures are moved to `references/project-manager/*.md`.
27
27
  - Subagents report to you; you own route selection, dispatch, gate decisions, and closure.
28
28
  - Default mode is delegate-first.
29
29
 
30
+ ### Plan-scoped authority (bounded)
31
+
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
+ - **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
+ - **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
+
30
36
  ---
31
37
 
32
38
  ## PM Execution Boundary
@@ -89,7 +95,7 @@ Detailed conflict priority and dev allocation:
89
95
  - Runtime/behavior change requires a recorded **`QA gate`** decision by default (`mandatory` or `pm-acceptance` per `qa-trigger-matrix.md`).
90
96
  - Report-only QA may skip QC tri-review only when no implementation/test/config artifact is committed.
91
97
  - Product-docs-only and tech-spec-only can skip QC tri-review only with explicit `QC: skipped — <reason>`.
92
- - Plan `Done` sign-off authority: `project-manager` or `qa-engineer` only.
98
+ - Plan `Done` sign-off authority: `project-manager` or `qa-engineer` only. On the scoped route `Done` is written **only** through the coordinator's `mstar plan complete` (one atomic write after a pinned, verified Git merge) — a plan session never sets it.
93
99
 
94
100
  ---
95
101
 
@@ -128,6 +134,8 @@ If any item below matches, fix the dispatch/plan state or mark `Blocked`—do **
128
134
  - **NEVER** mark plan `Done` on runtime/behavior change without `QA gate: mandatory` fulfilled or completed PM acceptance checklist (`qa-trigger-matrix.md`).
129
135
  - **NEVER** run tests/repro in the PM orchestration thread to substitute for `QA gate: mandatory` dispatch.
130
136
  - **NEVER** let non-PM/non-QA roles mark plan `Done`.
137
+ - **NEVER** dispatch from a leaf or promote a leaf into PM/coordinator scope: PM/iteration-drive wording (or `Delegation: forbidden`) reaching a child is a **boundary**, not an invitation — report the mismatch and stay inside the assigned task (`mstar-dispatch-gates` § 承接方反递归).
138
+ - **NEVER** exceed plan scope as a scoped PM/session: no sibling rows, lifecycle anchors, `execution_policy`, `compass_ref`, root `status.json` / shared-index writes, and no `execution_lease` / `integration_merge_lease` release. Finish = `mstar plan handoff`; `Done` + lease deletion belong to the coordinator's `mstar plan complete` (`mstar-iteration/references/plan-scoped-pm.md` §3–§5).
131
139
  - **NEVER** accept “temporary workaround”, “follow-up later”, “next plan”, or “split into batches” as narrative-only scope management. If work is deferred or staged, write the roadmap/tracking location before implement GO or Done.
132
140
  - **NEVER** perform specialist document edits in the PM thread when host invoke is required — that is `dispatch incomplete` (`mstar-dispatch-gates`, `mstar-iteration/references/phase-1-prepare.md` §1.6).
133
141
  - **NEVER** mark the last plan `Done` and then create a PR or declare the iteration complete without **`## Phase 3: iteration-close`** and `mstar-iteration/references/phase-3-iteration-close.md` §3.1–§3.5 checklists.
@@ -154,6 +162,7 @@ If any item below matches, fix the dispatch/plan state or mark `Blocked`—do **
154
162
  | **`/pm`** or **`pm` skill** (Codex, Cursor; OpenCode when no command) | This shim → **`project-manager.md`** § Required Reading + topic skills on demand |
155
163
  | **Cursor / OpenCode** host iteration `commands/` | Command Boot + **`project-manager.md`** — iteration lifecycle only; **not** required for ordinary per-plan PM |
156
164
  | **OpenCode** (no command, not `/pm`) | `project-manager` + `mstar-host` → `opencode.md` |
165
+ | **`/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 |
157
166
 
158
167
  **Dispatch-first**, iteration branch policy(`iteration_base_branch` / `spec_integration_branch` / `target_branch`), Autonomous Execute → **`mstar-iteration/references/phase-2-worktree-lease.md`**. Routing, gates, Task Board, QC, templates → this file + topic `mstar-*` skills.
159
168
 
@@ -42,6 +42,8 @@ Batch all findings for the human in one message. If clean, proceed silently.
42
42
 
43
43
  Dispatch independent ready tasks concurrently after L2 worktree isolation. Keep one canonical per-plan `{SDD_DIR}`. PM alone writes its `context.json`, `progress.md` and workflow snapshot; prepare context-dependent helper outputs serially. Each writable track has its own worktree/branch and immutable task-specific absolute brief/report/diff paths. Artifact subdirectories are namespaces inside that SDD root, never a second SDD root. Parallel leaves use the supplied paths directly and do not invoke shared-context helpers or read mutable context to choose their checkout; never share a writable session or `implementer-session.json`. Use **fresh** implementers for parallel tasks. Serialize only actual dependencies, overlapping write ownership, one sticky session, and integration merges; state the dependency when serializing. A task reviewer may run alongside an unrelated ready implementer. PM alone reconciles reports into the shared `progress.md` and workflow snapshot.
44
44
 
45
+ **Scope and credential boundary:** each task brief carries the **inherited plan scope** (plan id + absolute `SDD dir` / brief / report / diff paths) — a leaf never selects or prepares a plan, writes the workflow snapshot / root register / shared indexes, or releases leases. Session JSON, `mstar plan --session` write credentials, and `--expect <revision>` stay with the PM/coordinator and are **never** handed to an implementer or reviewer (`mstar-iteration/references/plan-scoped-pm.md` §8).
46
+
45
47
  **Dependent-task readiness:** review approval alone does not make a prerequisite available. PM serially integrates the reviewed prerequisite commits, then creates or updates the idle dependent worktree from that integrated state before recording its `BASE_SHA` and dispatching. For each required reviewed commit, record `git -C "$FEATURE_CWD" merge-base --is-ancestor <prerequisite-sha> <BASE_SHA>` with exit 0; a missing commit blocks only that dependent task. Do not move an active task's base; independent ready tasks continue concurrently.
46
48
 
47
49
  ## Per-task loop (PM only · Workflow)
@@ -55,7 +57,7 @@ Dispatch independent ready tasks concurrently after L2 worktree isolation. Keep
55
57
  5. On `DONE`: `mstar sdd review-package BASE HEAD` → diff file
56
58
  6. Dispatch **fresh** task reviewer — role **`code-reviewer`** (L2; **not** `qc-specialist*`; host fallback generic + C5b → `mstar-host` C5) — brief, report, diff, Global Constraints — `references/task-reviewer-prompt.md` — **never** sticky resume for reviewers
57
59
  7. Fix loop for Critical/Important; re-review until approved
58
- 8. Append `progress.md`; update the workflow snapshot plan row (`workflows/<id>/snapshot.json` → `plans[]`) `task_commits[]` and `implementer-session.json` `last_task` if sticky
60
+ 8. Append `progress.md`; record ledger progress through the **domain call** (`mstar plan progress --session <session.json> --file <absolute-json-path> --expect <revision>` on the scoped route; direct snapshot edit only on a non-scoped legacy route where the CLI is absent) plus `implementer-session.json` `last_task` if sticky — snapshot/revision semantics → `mstar-artifacts` `references/status-and-residuals.md`; scoped route → `mstar-iteration/references/plan-scoped-pm.md` §4/§7
59
61
  9. Release dependent tasks only after reviewed prerequisite commits are present in their assigned base, per Dependent-task readiness above; independent ready tasks need not wait
60
62
 
61
63
  **Never** dispatch parallel writers without isolated worktrees and disjoint ownership. Merge their outputs serially before producing the plan review-package.
@@ -35,6 +35,7 @@ PM runs context-dependent `mstar sdd workspace`, `task-brief`, and `review-packa
35
35
  - Interfaces / decisions brief cannot know
36
36
  - Absolute report path: `$SDD_DIR/task-N-report.md`
37
37
  - Absolute control root, feature cwd, branch and plan paths, plus task-specific brief/report/diff paths fixed for this dispatch; the context path is PM coordination metadata, not a leaf checkout selector
38
+ - **Inherited plan scope, no credentials**: the handoff restates the inherited plan id + absolute paths and nothing more — a leaf neither selects a plan nor writes the workflow snapshot / root register / leases. Session JSON, `mstar plan --session` write credentials and `--expect <revision>` are PM/coordinator-only and **never** appear in a leaf prompt (`mstar-iteration/references/plan-scoped-pm.md` §8)
38
39
  - `Model tier` → host-specific model (required)
39
40
  - **`SDD implementer session`**: `fresh` (new subagent) or `sticky` (resume — see **`sticky-implementer-session.md`**)
40
41
 
@@ -20,6 +20,8 @@ description: "PM entry shim — force project-manager orchestration when user in
20
20
 
21
21
  **Iteration lifecycle** (optional): host `commands/` may sequence Phase 1–5; semantics SSOT → **`mstar-iteration`**. Not required for ordinary PM work.
22
22
 
23
+ **Scoped drive** (optional): `/iteration-drive --assignment <abs.md>` | `--workflow <id> --plan <id>` | `--resume <session.json>` (no args = unchanged whole-iteration route) — the PM boots **in the primary session**, binds one plan (`mstar plan bind` → `show`) and is bounded to that plan's scope; finish is a handoff, not `Done` → **`mstar-iteration`** `references/plan-scoped-pm.md`. Any other non-empty argument form fails closed.
24
+
23
25
  **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`.
24
26
 
25
27
  Detect host → **`mstar-host`** → `references/codex.md` | `cursor.md` | `opencode.md` | `kimi.md` | `zcode.md` | `omp.md`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mstar-harness/dsh",
3
- "version": "3.9.3",
3
+ "version": "3.9.4",
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",