@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.
- package/dist/index.js +631 -334
- package/harness-commands/iteration-drive.md +16 -2
- package/harness-skills/mstar-artifacts/SKILL.md +6 -4
- package/harness-skills/mstar-artifacts/references/status-and-residuals.md +61 -9
- package/harness-skills/mstar-branch-worktree/SKILL.md +5 -4
- package/harness-skills/mstar-dispatch-gates/SKILL.md +10 -1
- package/harness-skills/mstar-host/SKILL.md +1 -0
- package/harness-skills/mstar-host/references/codex.md +1 -1
- package/harness-skills/mstar-host/references/dsh.md +6 -0
- package/harness-skills/mstar-host/references/omp.md +1 -1
- package/harness-skills/mstar-iteration/SKILL.md +12 -0
- package/harness-skills/mstar-iteration/references/command-shared-invariants.md +4 -0
- package/harness-skills/mstar-iteration/references/phase-2-worktree-lease.md +83 -12
- package/harness-skills/mstar-iteration/references/plan-scoped-pm.md +179 -0
- package/harness-skills/mstar-roles/references/project-manager/dispatch-and-assignment.md +7 -0
- package/harness-skills/mstar-roles/references/project-manager.md +10 -1
- package/harness-skills/mstar-sdd/SKILL.md +3 -1
- package/harness-skills/mstar-sdd/references/file-handoffs.md +1 -0
- package/harness-skills/pm/SKILL.md +2 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: iteration-drive
|
|
3
3
|
description: Drive the active iteration to completion — Phase 2 Autonomous Execute, Phase 3 iteration-close, Phase 4 Create PR, Phase 5 PR merge-ready loop (prefer babysit/*-babysit; optional greploop when repo has it; else CI fallback) until mergeable, then Phase 6 post-merge close once the PR is verified merged. Not Done until Phase 6 close completes.
|
|
4
4
|
agent: project-manager
|
|
5
|
-
input: "[no args]"
|
|
5
|
+
input: "[no args] | --assignment <absolute-md-path> | --workflow <id> --plan <id> | --resume <absolute-session-json-path>"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Drive Iteration
|
|
@@ -15,14 +15,28 @@ Drive the active Morning Star iteration forward. **Boot loads skills; this comma
|
|
|
15
15
|
|
|
16
16
|
**Done 定义**:Phase 5 §5.5 exit checklist 全 `[x]` **且** PR merged 后 Phase 6 §6.1–§6.4 完成。**Phase 3 close ≠ Done;Phase 4 开 PR ≠ Done;§5.5 exit / PR merged ≠ Done。**
|
|
17
17
|
|
|
18
|
+
**Scoped route 的 Done 边界**:plan 会话的 finish 是 **durable handoff**(plan 保持 `InReview`、保留 `execution_lease`);`status: Done` 与两个 lease 的删除由 **coordinator** 在验证 Git 合并后**同一次** snapshot 写入中完成。Phase 3–6 与 PR 仍归 coordinator → **`references/plan-scoped-pm.md`** §5–§6。
|
|
19
|
+
|
|
18
20
|
## 共享 invariants / preflight / todos / STOP
|
|
19
21
|
|
|
20
|
-
Phase 2–5 共享内容(PM invariants、assignment preflight、session todos、continuous-execution STOP)→ **`mstar-iteration/references/command-shared-invariants.md`**(SSOT
|
|
22
|
+
Phase 2–5 共享内容(PM invariants、assignment preflight、session todos、continuous-execution STOP)→ **`mstar-iteration/references/command-shared-invariants.md`**(SSOT;不在本命令重复)。**Scoped route(下节)例外**:其 session todos / STOP 为 plan-local,不 seed 全局 phase 条目 → **`references/plan-scoped-pm.md`**。
|
|
23
|
+
|
|
24
|
+
## Route(先于 Boot 判定)
|
|
25
|
+
|
|
26
|
+
| 调用形态 | 走向 |
|
|
27
|
+
|---|---|
|
|
28
|
+
| **无参数** | 下方 Boot → Phase 2 → 3 → 4 → 5 → 6(**语义不变**) |
|
|
29
|
+
| `--assignment <绝对 md 路径>` / `--workflow <id> --plan <id>` / `--resume <绝对 session json 路径>` | **scoped route** → **`mstar-iteration/references/plan-scoped-pm.md`**(scoped boot 先于全局 boot;不加载 compound / Phase 3–6 detail) |
|
|
30
|
+
| 其他任何非空参数形态(重复 flag、未知 flag、位置参数、缺值/空值、混用形态、半对 `--workflow`/`--plan`) | **fail closed**:在 bind 与 boot 之前停止并报告接受的形态;**禁止**回落为整迭代路线 |
|
|
31
|
+
|
|
32
|
+
**Leaf 边界**:leaf executor 收到本命令 → 角色边界拒绝(`mstar-dispatch-gates`),**不得**晋升为 PM 或递归分派。
|
|
21
33
|
|
|
22
34
|
## Boot
|
|
23
35
|
|
|
24
36
|
按 **`mstar-iteration`** Load order 加载(`mstar-harness-core` → `mstar-roles` → `references/project-manager.md` → `mstar-iteration`(按当前 Phase 查 route map,只加载一行 detail)+ `command-shared-invariants.md` → `mstar-compound` → `mstar-dispatch-gates` + host reference → **`mstar-sdd`**(first implement dispatch 前)→ `mstar-review-qc`(first QC 前)→ `mstar-artifacts` / `mstar-conventions` / `mstar-branch-worktree` → **`mstar-iteration/references/phase-2-worktree-lease.md`**)。完整 load list → **`mstar-roles`**。
|
|
25
37
|
|
|
38
|
+
**Scoped route 例外**:先按 **`references/plan-scoped-pm.md`** §2 建立 primary PM identity → 一次 `mstar plan bind` → `show` 并把会话约束到返回的 scope,再按本条加载;**不**加载 `mstar-compound`,也**不**加载 Phase 3–6 detail(scoped boot ≠ 整迭代 boot)。
|
|
39
|
+
|
|
26
40
|
## Phase 2: Autonomous Execute
|
|
27
41
|
|
|
28
42
|
Execute **`mstar-iteration/references/phase-2-worktree-lease.md`** §2.0–§2.5 exactly(§2.0 五道闸 → §2.1 session todos → §2.2 backlog → §2.3 integration branch + control worktree → §2.4 per-plan loop(lease-gated;SDD independent ready tasks parallel with isolation;changed-scope QC tri N=3 + unit-only QA;serial merge)→ §2.5 dispatch-first;§2.6 push 纪律 → main skill `## 2.6`)。全部 plan `Done` → **STOP** → 打印 `## Phase 3: iteration-close`。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mstar-artifacts
|
|
3
|
-
description: "Morning Star plan harness artifacts — `{PLAN_DIR}` main plans and durable review summaries, `{SDD_DIR}/review/` ephemeral QC/QA bundles, `{KNOWLEDGE_DIR}` / `{ITERATION_DIR}` indexes, plus `{HARNESS_DIR}/status.json` (v2 root register) / `{WORKFLOW_DIR}/<id>/snapshot.json` (plan rows + leases) and `{PROJECT_DIR}/<id>/residuals.json` (residual register; severity SSOT, open/close lifecycle). Read when writing plans or QC/QA review bundles, maintaining knowledge/iteration indexes, reading or writing status/snapshot/register, or mapping QC severity to JSON. Required for `@project-manager` on status, residuals, and InReview/QC waves; `@qc-specialist*` before writing review bundle reports; `@qa-engineer` before closing R# when `QA gate: mandatory`. Verdict rules: leaf → `mstar-roles/references/qc-specialist/report-template.md`; PM → `mstar-review-qc`."
|
|
3
|
+
description: "Morning Star plan harness artifacts — `{PLAN_DIR}` main plans and durable review summaries, `{SDD_DIR}/review/` ephemeral QC/QA bundles, `{KNOWLEDGE_DIR}` / `{ITERATION_DIR}` indexes, plus `{HARNESS_DIR}/status.json` (v2 root register) / `{WORKFLOW_DIR}/<id>/snapshot.json` (plan rows + leases + plan-scoped `coordination`/session/handoff/revision semantics) and `{PROJECT_DIR}/<id>/residuals.json` (residual register; severity SSOT, open/close lifecycle). Read when writing plans or QC/QA review bundles, maintaining knowledge/iteration indexes, reading or writing status/snapshot/register, or mapping QC severity to JSON. Required for `@project-manager` on status, residuals, and InReview/QC waves; `@qc-specialist*` before writing review bundle reports; `@qa-engineer` before closing R# when `QA gate: mandatory`. Verdict rules: leaf → `mstar-roles/references/qc-specialist/report-template.md`; PM → `mstar-review-qc`."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## Load order
|
|
@@ -14,7 +14,7 @@ description: "Morning Star plan harness artifacts — `{PLAN_DIR}` main plans an
|
|
|
14
14
|
| Main plan, review bundle naming, durable summaries, QC waves, residual and plan index order | `references/plan-files-and-reports.md` |
|
|
15
15
|
| Plan template (Global Constraints, Interfaces) | `templates/plan.main.md` |
|
|
16
16
|
| knowledge / iterations / specs boundaries and indexes | `references/knowledge-and-designs.md` |
|
|
17
|
-
| `status.json` (v2 root), workflow snapshots, project register, residual severity / lifecycle, engine-check queries | `references/status-and-residuals.md` |
|
|
17
|
+
| `status.json` (v2 root), workflow snapshots, plan-scoped `coordination` / session / handoff / revision schema, project register, residual severity / lifecycle, engine-check queries | `references/status-and-residuals.md` |
|
|
18
18
|
| Empty-repo `status.json` template | `templates/status.empty.json` (`templates/README.md`) |
|
|
19
19
|
| Tech-debt rollup (read-only) | `mstar status tech-debt [path]` (engine `techDebtRollup`; see `references/status-and-residuals.md`) |
|
|
20
20
|
|
|
@@ -38,6 +38,7 @@ description: "Morning Star plan harness artifacts — `{PLAN_DIR}` main plans an
|
|
|
38
38
|
|
|
39
39
|
- **`{WORKFLOW_DIR}/<id>/notes.jsonl`**: per-workflow append-only notes ledger (runtime); snapshot plan-row `notes` is the legacy verbatim copy. **Tech-debt rollup**: `mstar status tech-debt <project-dir>` over the project registers — **`references/status-and-residuals.md`**.
|
|
40
40
|
- **Iteration Phase 2 leases** (snapshot: `integration_worktree_path`, `plans[].execution_lease`, top-level `integration_merge_lease`): field semantics → **`references/status-and-residuals.md`** (“Iteration execution leases”); Phase 2 execution checklist → **`mstar-iteration`** `references/phase-2-worktree-lease.md`; full protocol prose (single copy) → **`mstar-engine-legacy`** `references/lease-protocol.md`.
|
|
41
|
+
- **Plan-scoped coordination is a domain-call surface**: plan-row `coordination` block (`prepared` / `revision` / `duplicate-holder`), session JSON, handoff record, and `--expect <revision>` semantics have their **single runtime home** in **`references/status-and-residuals.md`**; flag shapes and exit codes → `docs/cli.md`; route semantics → **`mstar-iteration`** `references/plan-scoped-pm.md`. Every plan-row mutation goes through the verbs (`mstar plan bind | show | prepare | progress | residual-add | residual-close | handoff | accept | return | integration-start | integration-accept | complete | reconcile`) — hand-editing snapshot rows or the register outside those verbs is **not** an authorized path.
|
|
41
42
|
|
|
42
43
|
> **Engine check (when available):** run `mstar lease verify --workflow <id> [--plan <plan-id>]` or `mstar lease verify-integration --workflow <id>` (or import `validateExecutionLease` / `validateIntegrationMergeLease` from `@mstar-harness/engine` in a host hook) to validate the iteration leases above on the workflow snapshot (execution_lease / integration_merge_lease). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
|
|
43
44
|
|
|
@@ -47,13 +48,14 @@ Field semantics, severity mapping, findings cleanup modes, archive flow, and `jq
|
|
|
47
48
|
|
|
48
49
|
## Workflow
|
|
49
50
|
|
|
50
|
-
产物生命周期主链:主 plan 落盘 `{PLAN_DIR}`(命名见 `references/plan-files-and-reports.md`)→
|
|
51
|
+
产物生命周期主链:主 plan 落盘 `{PLAN_DIR}`(命名见 `references/plan-files-and-reports.md`)→ 实现推进时经 **domain call** 更新 workflow snapshot 的 `plans[]` 行(scoped 路线:`mstar plan progress | handoff | complete --session <session.json> [--expect <revision>]`;直接文件编辑仅限 CLI 缺失的 legacy 路线),根 `status.json` `workflows[]` 的登记/注销由生命周期动词负责(如 `mstar status workflow-close`)→ 审查波次产出 `{SDD_DIR}/review/` bundle(raw QC/QA reports)+ durable gate summary 回写主 plan / snapshot → 关闭后 residual **in place** close in the project register(`projects/<id>/residuals.json`)。索引(`{KNOWLEDGE_DIR}` / `{ITERATION_DIR}` / `{PLAN_DIR}`)随产物更新。
|
|
51
52
|
|
|
52
53
|
## Decision Rules
|
|
53
54
|
|
|
54
55
|
- residual **severity** 是机器字段 SSOT(`references/status-and-residuals.md`);每条新 finding 只登记 project register(`projects/<id>/residuals.json` → `entries[<plan-id>]`),v1 根级 `residual_findings` 仅 legacy 只读,**禁止**双写。
|
|
55
56
|
- **`Findings cleanup: zero-residual`** 默认(迭代 Phase 2):可修 findings 当轮 fix → re-review 清干净;仅真 blocker 可 defer 且须 Durable Roadmap。
|
|
56
57
|
- 登记前必须过 `validateResidual` / `validateProjectRegister` / `validateStatus`(fail-loud handoff);malformed → reject + rewrite。
|
|
58
|
+
- **计划行 / register 只经 domain call 修改**:scoped 路线使用 `mstar plan …` 动词(带 `--session` 与 `--expect`),手写 snapshot / register 会被拒(`coordination.direct-write-refused` / `coordination.scoped-writer-required`);只读校验器(`mstar lease verify` / `mstar worktree check`)是检查而非修改替代。
|
|
57
59
|
|
|
58
60
|
## Evidence
|
|
59
61
|
|
|
@@ -62,5 +64,5 @@ Field semantics, severity mapping, findings cleanup modes, archive flow, and `jq
|
|
|
62
64
|
## References
|
|
63
65
|
|
|
64
66
|
- `references/plan-files-and-reports.md` — 主 plan / review bundle 命名、QC 波次、durable summaries
|
|
65
|
-
- `references/status-and-residuals.md` — `status.json` (v2), workflow snapshots, project register, residual severity / lifecycle / engine-check queries
|
|
67
|
+
- `references/status-and-residuals.md` — `status.json` (v2), workflow snapshots, plan-scoped coordination (bind / revision / session / handoff / reconcile), project register, residual severity / lifecycle / engine-check queries
|
|
66
68
|
- `references/knowledge-and-designs.md` — knowledge / iterations / specs 边界与索引
|
|
@@ -94,9 +94,10 @@ Canonical vs legacy residual definitions → **`mstar-artifacts` SKILL.md**("`
|
|
|
94
94
|
- The example above depicts the **held** state (both leases populated, illustrative placeholder values) and passes `validateWorkflowSnapshot`; the released state is **key absence** (delete-key-on-release below), never `null` or `{}`, and enum scalars (`type` / `status` / plan-row `status`) are always single values — the full enum sets are `type`: `plan | iteration`, snapshot `status`: `running | paused | completed | failed | stopped`, plan-row `status`: `Todo | InProgress | InReview | Blocked | Done`.
|
|
95
95
|
|
|
96
96
|
- `plans[]` rows are the **legacy PlanRow shape verbatim** (unknown row fields preserved, never re-bucketed). Per-row `execution_lease` stays on the row; `integration_merge_lease` is **top-level** (the v1 root-`metadata` home is gone).
|
|
97
|
+
- **Scoped coordination (optional):** top-level `coordination.coordinator` plus per-row `coordination` (`revision` / `prepared` / `session` / `progress` / `handoff`) appear only on the scoped route — field table, session envelopes and version rules → § Plan-scoped coordination below.
|
|
97
98
|
- Terminal statuses (`completed` / `failed` / `stopped`) require `ended_at` and no dangling leases.
|
|
98
99
|
- **Completed close (Phase 6)** runs `mstar status workflow-close --workflow <id> [--harness <path>] [--ended-at <date>]`: engine `closeWorkflow` rereads the latest snapshot under the snapshot write lock, refuses any dangling lease / non-`Done` row (fail-loud, bytes unchanged), writes `completed` + `ended_at`, then unregisters the root entry. Unregister failure after the snapshot write is a reported **partial close** — retry finishes unregister without rewriting `ended_at`; a fully closed retry rewrites neither file. An already-terminal `failed` / `stopped` snapshot keeps its actual status (close never fabricates `completed`).
|
|
99
|
-
- **Physical cleanup is out of close's scope**: it is the separate `mstar worktree cleanup --workflow <id> …` verb (dry-run default), run in its own timing lane — same-round after a plan's integration merge (Phase 2) or after §6.1–§6.3 + PR merged (Phase 6). Close and cleanup never release leases —
|
|
100
|
+
- **Physical cleanup is out of close's scope**: it is the separate `mstar worktree cleanup --workflow <id> …` verb (dry-run default), run in its own timing lane — same-round after a plan's integration merge (Phase 2) or after §6.1–§6.3 + PR merged (Phase 6). Close and cleanup never release leases — on the scoped route the plan row's lease is moved/deleted by `mstar plan accept | return | complete` (never by close or cleanup, and never by a standalone release verb); on the whole-iteration route the owner releases before either. Guard/decision codes (`cleanup.keep.*`, `cleanup.refuse.*`, `cleanup.remove.merged`) → **`mstar-branch-worktree`**「Worktree / branch cleanup」.
|
|
100
101
|
- `execution_policy` keys are copied from v1 root `metadata` at migrate; values are accepted-but-opaque this iteration (no semantic gate).
|
|
101
102
|
- `notes`: a plan row's `notes` array is the **legacy verbatim copy** preserved at migrate; the **runtime ledger is `notes.jsonl`** in the workflow dir (see `workflows/<id>/notes.jsonl` below). New notes append to the ledger only — never dual-write the row `notes`.
|
|
102
103
|
|
|
@@ -308,11 +309,11 @@ Optional when a plan is not owned; **required** while a Phase 2 session owns wri
|
|
|
308
309
|
| `working_branch` | non-empty string | Yes | Feature branch at `worktree_path`; MUST agree with Assignment **`Working branch`**. |
|
|
309
310
|
| `session_label` | string | No | Human display only — **MUST NOT** authorize or compare ownership. |
|
|
310
311
|
|
|
311
|
-
Writers **delete** `execution_lease` on release; `null` and tombstone objects are invalid.
|
|
312
|
+
Writers **delete** `execution_lease` on release; `null` and tombstone objects are invalid. On the scoped route the deletion happens **only** through `mstar plan accept | return | complete` (§ Plan-scoped coordination) — never by hand.
|
|
312
313
|
|
|
313
314
|
**Ownership survives release**: later `mstar worktree cleanup` attributes a released plan row through the retained row `metadata.working_branch` / `metadata.worktree_path` and retained track Assignments — never by branch-name inference. Guard codes and the cleanup contract → **`mstar-branch-worktree`**「Worktree / branch cleanup」.
|
|
314
315
|
|
|
315
|
-
V1: **manual release only** — omit `expires_at`; readers **MUST NOT** treat unknown or draft `expires_at` as authority to steal or release.
|
|
316
|
+
V1: **manual release only** — omit `expires_at`; readers **MUST NOT** treat unknown or draft `expires_at` as authority to steal or release. There is also **no standalone release verb / flag**: on the scoped route a plan session's lease moves only through the `accept` → (`integration-start` → `integration-accept`) → `complete` sequence, or returns to the plan session on `return`; `--force`, takeover and TTL/idle theft do not exist.
|
|
316
317
|
|
|
317
318
|
### Snapshot top-level fields
|
|
318
319
|
|
|
@@ -342,7 +343,7 @@ Leases live in the **workflow snapshot** `{WORKFLOW_DIR}/<id>/snapshot.json` (`p
|
|
|
342
343
|
|
|
343
344
|
**Protocol home (single canonical copy):** the full lease protocol prose — same-host exclusive write lock, hard gate, claim-before-`InProgress`, hold/release/override, integration merge protocol, orphan recovery, lease prohibitions — lives in **`mstar-engine-legacy`** `references/lease-protocol.md` (engine-absent fallback). The Phase 2 iteration-command **execution checklist** → **`mstar-iteration`** `references/phase-2-worktree-lease.md`. This file carries the **field semantics** only (tables below + the lockdir location summary).
|
|
344
345
|
|
|
345
|
-
**Same-host exclusive write lock (snapshot / root):** all control-path lease mutations (execution claim/release/transfer, plan-status transitions that touch leases, `integration_merge_lease` claim/release) **MUST** run inside a same-host exclusive write lock for the full read-check-replace-verify sequence. Engine writers handle this automatically (`writeWorkflowSnapshot` / `registerWorkflow` acquire `<status-file dir>/.status-write.lockdir/` next to the file — for snapshots the lockdir lands inside `workflows/<id>/`). Prefer the engine-check commands below over hand-rolled `flock` snippets; the atomic-mkdir alternative (`.status-write.lockdir/` in the same directory as the file) remains the documented fallback when no engine writer exists. Hard gate, cross-host exception and pre-dispatch re-verify → `mstar-engine-legacy/references/lease-protocol.md`.
|
|
346
|
+
**Same-host exclusive write lock (snapshot / root):** all control-path lease mutations (execution claim/release/transfer, plan-status transitions that touch leases, `integration_merge_lease` claim/release) **MUST** run inside a same-host exclusive write lock for the full read-check-replace-verify sequence. Engine writers handle this automatically (`writeWorkflowSnapshot` / `registerWorkflow` acquire `<status-file dir>/.status-write.lockdir/` next to the file — for snapshots the lockdir lands inside `workflows/<id>/`). The lock protects only callers that **actually acquire it**: scoped verbs run their whole read-check-replace-verify inside the same lockdir, whereas a hand-written update that bypasses `writeWorkflowSnapshot` is both unprotected and unauthorized (`coordination.direct-write-refused`). Prefer the engine-check commands below over hand-rolled `flock` snippets; the atomic-mkdir alternative (`.status-write.lockdir/` in the same directory as the file) remains the documented fallback when no engine writer exists. On the **scoped route** that fallback does not reopen a manual path: the verbs own the lock (`mstar plan bind | progress | residual-add | residual-close | handoff | accept | return | integration-start | integration-accept | complete | reconcile`), a missing CLI **fails closed** instead of degrading to hand-written flock/atomic-mkdir, and read-only validators stay checks — never mutation substitutes. Hard gate, cross-host exception and pre-dispatch re-verify → `mstar-engine-legacy/references/lease-protocol.md`.
|
|
346
347
|
|
|
347
348
|
> **Lease Engine-check:** single canonical callout in `mstar-artifacts` `SKILL.md`(Engine-check lease 行)— pointer only, do not re-vendor.
|
|
348
349
|
|
|
@@ -361,7 +362,58 @@ Single global lease authorizing one plan feature branch integration into `branch
|
|
|
361
362
|
|
|
362
363
|
### Claim-before-`InProgress`, hold/release/override, integration merge, orphan recovery, prohibitions
|
|
363
364
|
|
|
364
|
-
These are **full-protocol prose** — the single canonical copy lives in **`mstar-engine-legacy`** `references/lease-protocol.md` (engine-absent fallback); the Phase 2 iteration-command **execution checklist** is **`mstar-iteration`** `references/phase-2-worktree-lease.md`. This file carries the field semantics (tables above) and the engine checks only — do not re-state the protocol here. `V1: manual release only` — omit `expires_at`; readers **MUST NOT** treat unknown or draft `expires_at` as authority to steal or release (see the `execution_lease` field table).
|
|
365
|
+
These are **full-protocol prose** — the single canonical copy lives in **`mstar-engine-legacy`** `references/lease-protocol.md` (engine-absent fallback); the Phase 2 iteration-command **execution checklist** is **`mstar-iteration`** `references/phase-2-worktree-lease.md`. This file carries the field semantics (tables above) and the engine checks only — do not re-state the protocol here. `V1: manual release only` — omit `expires_at`; readers **MUST NOT** treat unknown or draft `expires_at` as authority to steal or release (see the `execution_lease` field table). On the **scoped route** this prose is executed only through the verbs — `bind` (claim), `accept` / `return` (transfer / give-back), `integration-start` → `integration-accept` (merge), `complete` (release both) — with **no** override / `--force` / TTL path and no standalone release verb; the runtime contract is § Plan-scoped coordination above, and the legacy prose is the engine-absent fallback only.
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## Plan-scoped coordination (bind / revision / session / handoff) — sole runtime field home
|
|
370
|
+
|
|
371
|
+
The scoped route(`/iteration-drive --assignment | --workflow <id> --plan <id> | --resume <session.json>` → `mstar plan …`)keeps **one process authority**: the same workflow snapshot (`workflows/<id>/snapshot.json`) and the same root `status.json` — no per-plan snapshot clone, database, daemon or second status copy. This section is the **single runtime home** for the coordination / session / handoff / revision fields; command flags and exit codes → `docs/cli.md`; route semantics → **`mstar-iteration`** `references/plan-scoped-pm.md`; engine API shapes → `packages/engine/src/coordination.ts`.
|
|
372
|
+
|
|
373
|
+
### Snapshot fields
|
|
374
|
+
|
|
375
|
+
| Level | Field | Type | Semantics |
|
|
376
|
+
| --- | --- | --- | --- |
|
|
377
|
+
| top | `coordination.coordinator` | object | `{ session_id, session_file, bound_at }` — one coordinator per workflow; a second fresh coordinator bind fails exactly like a duplicate plan holder. Created only from the verified main worktree or the recorded integration worktree, with a registered running iteration. |
|
|
378
|
+
| row | `coordination.revision` | nonnegative integer | Optimistic-concurrency token; absent `coordination` = `0`. **`--expect <revision>` always means this row value** — never snapshot `schema_version` or a date. |
|
|
379
|
+
| row | `coordination.prepared` | object | `{ assignment_path, assignment_sha256, plan_sha256, qa_gate, findings_cleanup, prepared_by, prepared_at }` — the reviewed-Assignment authorization. Hashes are SHA-256 of the exact UTF-8 bytes; after claim the Assignment is immutable and every show/resume/mutation rechecks its hash — a changed file fails `coordination.assignment-stale` without changing state. |
|
|
380
|
+
| row | `coordination.session` | object | `{ session_id, session_file, bound_at }` — the bound plan-PM session; the UUID is engine-allocated, never derived from plan, assignment path, PID or terminal label. |
|
|
381
|
+
| row | `coordination.progress` | object | `{ status, summary, evidence_paths[], track_branches? }`; `status` ∈ `InProgress` / `InReview` / `Blocked` only; nonblank `summary`; evidence paths must be existing canonical absolute artifacts inside this plan's resolved plan/SDD area; `track_branches` must belong to its recorded L2 Assignments/worktrees. |
|
|
382
|
+
| row | `coordination.handoff` | object | Immutable submitted handoff record: engine-generated UUID / attempt / timestamps plus Git pins and evidence hashes. Input can never set state, holder or target. |
|
|
383
|
+
|
|
384
|
+
### Session envelopes and credentials
|
|
385
|
+
|
|
386
|
+
- Session JSON lives at `<resolved-workflow-dir>/<workflow-id>/sessions/<session-id>.json`, created exclusively, mode `0600`.
|
|
387
|
+
- It is a **credential / pointer**, not a second process-SSOT copy: session identity, resolved harness root and pointers — never copied snapshot state, never a portable handoff address. Cross-primary handoff references are readable absolute **control-root filesystem paths**; `local://` is not portable.
|
|
388
|
+
- Session paths and `--expect` revisions stay with the dispatching PM/coordinator and are **never** handed to a leaf implementer/reviewer (`mstar-dispatch-gates` § Plan 作用域与 credential 不下发).
|
|
389
|
+
- Supported writers are cooperative same-machine interfaces, not a filesystem sandbox: copying a session file or editing protected files by hand is not prevented, and is not an authorized path.
|
|
390
|
+
|
|
391
|
+
### Revision and version protocol
|
|
392
|
+
|
|
393
|
+
- `--expect <revision>` (row) and `--expect-register <version>` (register; artifact version = `sha256:<64 lowercase hex>`, missing = `absent`) are required by every mutating verb. `bind` is the only exception: it checks and claims atomically against current ownership without a caller snapshot, and `--resume` returns context without changing ownership or revision.
|
|
394
|
+
- Every row operation **except residual-only writes** increments only that row's revision. A sibling plan's mutation leaves this row's revision untouched; a stale same-row expectation fails `coordination.version-conflict`.
|
|
395
|
+
- Global coordinator binding takes the snapshot lock but increments no row revision — it changes only top `coordination.coordinator` and `updated_at`.
|
|
396
|
+
- No automatic retry / rebase exists for caller replacements: missing version = `coordination.expected-version-required`, mismatch = version conflict, and no mtime / date / schema version is ever used as CAS.
|
|
397
|
+
- Residual writes touch only `entries[<planId>]` and bump no snapshot revision, so there is no two-document commit pretending to be atomic.
|
|
398
|
+
|
|
399
|
+
### Verbs and row / register ownership
|
|
400
|
+
|
|
401
|
+
| Actor | May write |
|
|
402
|
+
| --- | --- |
|
|
403
|
+
| coordinator — `mstar plan prepare · accept · return · integration-start · integration-accept · complete · reconcile` | selected row `coordination.prepared` and handoff transitions, `status`, both coordination leases, `Done` |
|
|
404
|
+
| plan session — `mstar plan progress · residual-add · residual-close · handoff` | its own row `status` + `coordination.progress`, `metadata.track_branches`, its `entries[<planId>]` register bucket, and the handoff record |
|
|
405
|
+
| anyone else | nothing scoped — sibling rows, lifecycle anchors, root register, `execution_policy`, `compass_ref`, shared indexes, the iteration PR and Phase 3–6 stay on the coordinator / global route |
|
|
406
|
+
|
|
407
|
+
- **State machine:** `Todo → InProgress` (bind) → `InReview` (handoff; lease kept) → `accepted` → `integrating` → `merged` → `completed` ⇒ `Done`. `progress` allows only `InProgress → InProgress | InReview | Blocked`, `Blocked → Blocked | InProgress`, and `InReview → InReview | InProgress | Blocked` **before** handoff — never `Todo` / `Done` / lease removal. After handoff, all scoped progress/residual mutations are rejected until `return`.
|
|
408
|
+
- **`complete` is the one atomic write** that sets `Done` (with verified Git proof and the findings gate), retains row `metadata.working_branch` / `metadata.worktree_path` and existing `track_branches`, and deletes the row `execution_lease` plus the coordinator's `integration_merge_lease`. `accept` is ownership transfer only — no merge, no `Done`; `integration-accept` keeps both leases and `InReview` until `complete`.
|
|
409
|
+
- **Legacy helpers refuse coordinated keys:** `appendProjectRegisterEntries` / `closeProjectRegisterEntry` / backlog next-free-key and `persist` replacements reject an existing coordinated plan bucket with `coordination.scoped-writer-required` (directing the caller to `residual-add` / `residual-close`), and hand writes to protected snapshot / register / root targets are refused with `coordination.direct-write-refused`. Root and global lifecycle operations stay on the existing coordinator route and are never `mutatePlanCoordination` targets.
|
|
410
|
+
- Read-only validators (`mstar lease verify`, `mstar lease verify-integration`, `mstar worktree check`, `mstar status validate`) remain **checks** — never mutation substitutes.
|
|
411
|
+
|
|
412
|
+
### Reconcile outcomes (crash recovery)
|
|
413
|
+
|
|
414
|
+
Per-state `reconcile` outcome **and** the recovery action it requires are **route semantics, not fields**: single canonical copy → **`mstar-iteration`** `references/plan-scoped-pm.md` §6.7(outcome table)with §7(`show` refresh before a stale retry). The `retry-ready` path therefore resumes `show` → `integration-start`(re-pin `base_sha`, re-acquire the merge lease)→ the coordinator's `git merge --no-ff` → `integration-accept` — **never a bare merge**.
|
|
415
|
+
|
|
416
|
+
Reconciliation observes **Git ancestry / HEAD facts** in the recorded repository and never trusts a caller's success flag, and never performs a second merge. A crash after `complete` but before CLI output is handled by `show` + `reconcile`; a crash before the session binding leaves only an inert envelope. `return` after a failed merge requires an explicit Git abort plus reconcile first — a merge lease is never discarded while Git may still be in flight. Lost credentials or an abandoned active owner need explicit human recovery outside the normal verbs; no automatic takeover flag is introduced.
|
|
365
417
|
|
|
366
418
|
---
|
|
367
419
|
|
|
@@ -395,7 +447,7 @@ These are **full-protocol prose** — the single canonical copy lives in **`msta
|
|
|
395
447
|
| ------ | ----- | ---- |
|
|
396
448
|
| Implement fix | `@fullstack-dev` / assignee | Completion Report cites R# + evidence |
|
|
397
449
|
| Verify | `@qa-engineer` when **`QA gate: mandatory`**; else PM per acceptance checklist | Regression / acceptance; open R# close requires verify before close |
|
|
398
|
-
| Write the register | **`@project-manager`** or **`@qa-engineer`** | After verification; waivers after PM + user/architect alignment |
|
|
450
|
+
| Write the register | **`@project-manager`** or **`@qa-engineer`** | After verification; waivers after PM + user/architect alignment. On the scoped route the write is the `residual-add` / `residual-close` verb, never a hand edit |
|
|
399
451
|
|
|
400
452
|
Do not claim “R3 fixed” in chat/plan only without SSOT update.
|
|
401
453
|
|
|
@@ -405,15 +457,15 @@ PM should register open items after **`Approve with residuals`**; QA should stat
|
|
|
405
457
|
|
|
406
458
|
After **`closed_at`**, **`closure_note`**, and PM/QA confirm close:
|
|
407
459
|
|
|
408
|
-
1.
|
|
409
|
-
2. Optional: delete the entry from the register instead when the team prefers an empty open list — the closed record's `lifecycle` + `closed_at` is the durable record either way.
|
|
460
|
+
1. Close through the **domain call**: `mstar plan residual-close --session <plan-session> --entry <id> --note <text> --expect <revision> --expect-register <version>` on the scoped route (legacy `closeProjectRegisterEntry` under lock elsewhere). It sets `lifecycle` / `closed_at` / `closure_note` **in place** in `entries[<plan-id>]`, requires a nonblank evidence-bearing note, and bumps no snapshot revision. A coordinated plan bucket rejects the legacy helper with `coordination.scoped-writer-required`; hand edits are not an authorized path.
|
|
461
|
+
2. Optional: delete the entry from the register instead when the team prefers an empty open list — the closed record's `lifecycle` + `closed_at` is the durable record either way. (A coordinated bucket keeps its entries; close, do not delete.)
|
|
410
462
|
3. Delete empty **`plan-id`** keys; update root `updated_at`; optional milestone entry in the workflow `notes.jsonl`.
|
|
411
463
|
|
|
412
464
|
Closed records live in the register + durable plan summaries; raw review bundles are ephemeral and not part of the long-term record.
|
|
413
465
|
|
|
414
466
|
### Short in-place close (transition only)
|
|
415
467
|
|
|
416
|
-
May set `lifecycle` / `closed_*` in the register for one PR; same milestone close/delete as above.
|
|
468
|
+
May set `lifecycle` / `closed_*` in the register for one PR — through `mstar plan residual-close` (or `residual-add` with a new entry) when the plan is coordinated; same milestone close/delete as above.
|
|
417
469
|
|
|
418
470
|
### Hard delete
|
|
419
471
|
|
|
@@ -144,7 +144,7 @@ Default process artifacts are **gitignored** (`mstar-conventions`「Git 跟踪
|
|
|
144
144
|
- A feature worktree's same-looking `{HARNESS_DIR}` path is **not** the SSOT — **never** treat it as the source of plans/status/SDD, and **never** bootstrap a second process-SSOT copy there.
|
|
145
145
|
- Absolute **`Worktree path`** (feature) MUST appear in the writable Assignment and in `execution_lease.worktree_path` before first writable implement dispatch for that plan.
|
|
146
146
|
- When L1 lease gate is active (not `Worktree mode: waived`), Assignment **`Plan Path`** and **`SDD dir`** MUST be **absolute paths under the control harness root** (not relative `.mstar/...` resolved from the feature cwd). Prefer also writing **`Control harness root: <main-repo-root>/{HARNESS_DIR}`**.
|
|
147
|
-
- Writable dispatch for a plan requires a **verified** `execution_lease` (same read-check-replace-verify discipline as the iteration reference). Full claim tables are **not** duplicated here.
|
|
147
|
+
- Writable dispatch for a plan requires a **verified** `execution_lease` (same read-check-replace-verify discipline as the iteration reference). Full claim tables are **not** duplicated here. Scoped route: the plan session is established by `mstar plan bind` (claim executed inside its own lock) and scope is read from the returned row — hand-written snapshot updates are not a path (`mstar-iteration` `references/plan-scoped-pm.md` §2/§8).
|
|
148
148
|
|
|
149
149
|
**Anti-pattern (forbidden)**
|
|
150
150
|
|
|
@@ -242,7 +242,7 @@ mstar worktree cleanup --workflow <id> [--harness <path>] [--apply] [--remote] [
|
|
|
242
242
|
- **信任模型**:`--harness <path>` 为操作者提供且受信——dry-run 与 `--apply` 的全部状态事实(snapshot、lease、行归属元数据、protected 锚点)均读自该目录。
|
|
243
243
|
- **坏 sibling 不再阻塞,且不丢保护**:扫描 `workflows/*/snapshot.json` 时,**非选中**的坏 snapshot 不会让命令失败(exit 1)。**JSON 可解析但校验失败**者以**降级保守形态**入安全集:只携带具保护性的声明(`branch.base` / `branch.integration` / `branch.target`、lifecycle worktree path、merge / execution lease、行 ownership 元数据),且 lifecycle 与行状态一律强制为非终态——故只会**增加** keep/refuse 判定,绝不减少(它保护的分支/worktree 会被 `cleanup.keep.protected-ref` 或 `cleanup.refuse.*` 拦住)。**完全不可解析**者声明不可知:默认 **withhold 全部 remove**(改判 `cleanup.refuse.unreadable-snapshot`,plan 仍完整打印),仅当操作者给出 `--ignore-unreadable-snapshots` 断言时才按可读 snapshot 判定。**选中** workflow 自身 snapshot 不可读仍是探测失败(exit 1);任何坏 snapshot 的字节**永不**被修复、改写或删除。
|
|
244
244
|
|
|
245
|
-
**Ownership(禁止命名推断)**:候选归属只来自 snapshot 行元数据(`plans[].execution_lease`;lease 释放后为保留的行 `metadata.working_branch` / `metadata.worktree_path` 与 retained track Assignments)或已验证的显式 `--worktree` 断言。归属缺失 / 歧义 / 他属 → `cleanup.refuse.foreign-worktree` / `cleanup.refuse.foreign-branch`。**归属生产者义务(owner=PM)**:设 `Done` 并删除 `execution_lease` 的**同一 locked update** 内,owner 必须把 `metadata.working_branch` + `metadata.worktree_path` 持久化到该 plan 行(值以本轮 Assignment 为准)——这是 lease 释放后 ownership 检查读取的持久归属;缺失时已 merge 的 Done 行也会被 `cleanup.refuse.foreign-*`
|
|
245
|
+
**Ownership(禁止命名推断)**:候选归属只来自 snapshot 行元数据(`plans[].execution_lease`;lease 释放后为保留的行 `metadata.working_branch` / `metadata.worktree_path` 与 retained track Assignments)或已验证的显式 `--worktree` 断言。归属缺失 / 歧义 / 他属 → `cleanup.refuse.foreign-worktree` / `cleanup.refuse.foreign-branch`。**归属生产者义务(owner=PM)**:设 `Done` 并删除 `execution_lease` 的**同一 locked update** 内,owner 必须把 `metadata.working_branch` + `metadata.worktree_path` 持久化到该 plan 行(值以本轮 Assignment 为准)——这是 lease 释放后 ownership 检查读取的持久归属;缺失时已 merge 的 Done 行也会被 `cleanup.refuse.foreign-*` 拒绝。scoped 路线上这条义务由 coordinator 的 `mstar plan complete` 一次原子写入承担(`Done` + 保留 `metadata.working_branch` / `metadata.worktree_path` / `track_branches` + 删除 `execution_lease` 与 `integration_merge_lease`);whole-iteration 路线仍是 owner 的同一 locked update。**禁止**手工补写快照来修归属——scoped 路线回到 `mstar plan complete` / `reconcile`(`mstar-iteration` `references/plan-scoped-pm.md` §6)。
|
|
246
246
|
|
|
247
247
|
**合并证据硬前置**:本地资格 = `git branch --merged <base>` 成员资格,base 取候选自己的锚(plan/track → `branch.integration`;standalone plan / integration 分支 → `branch.target`)。远端证据绑定 {branch, tip, base} **同一分支化身**;当前 harness 无 PR-merged 记录源(`prMerged` 恒为 null)→ 远端仅走 tip-ancestor 历史残留路线。squash-only(tip 非 base 祖先)**保留并报告,绝不 `git branch -D`**;旧 merged PR 不能授权已复用分支的新化身。
|
|
248
248
|
|
|
@@ -252,7 +252,7 @@ mstar worktree cleanup --workflow <id> [--harness <path>] [--apply] [--remote] [
|
|
|
252
252
|
|
|
253
253
|
**顺序(--apply;worktree 移除 ≠ 分支删除)**:普通 `git worktree remove`(**永不 force**)移除 eligible attached worktree → **重新探测 + 重新规划** → 删除**现已**未检出的分支(`git branch -d`,**永不 `-D`**)→ 远端 expected-OID compare-and-delete(`git push --force-with-lease=refs/heads/<branch>:<observed-oid> origin :refs/heads/<branch>`;ref 已移动 → `cleanup.refuse.facts-changed`,**不**自动用新 OID 重试)。dry-run 打印 worktree `remove` + 其分支 `refuse(checked-out)` 是合法状态。**禁止**全局 `git worktree prune`(会动 foreign 注册);Git 调用默认在 main worktree root,`git branch -d` 在该分支证据 base 的检出处执行(`-d` merged-into-HEAD 语义所需)——任何 Git 调用**永不位于移除候选内**。
|
|
254
254
|
|
|
255
|
-
**Lease
|
|
255
|
+
**Lease 的释放/转移在 cleanup 范围外,且没有独立 release 动词**:cleanup(与 close)**从不**释放 lease。scoped 路线由 `mstar plan accept`(转移)→ `integration-start` / `integration-accept` → `complete`(一次原子删除两 lease)或 `return`(交回 plan session)完成;whole-iteration 路线由 owner 释放。释放后归属靠保留的行元数据 / Assignments 维持。
|
|
256
256
|
|
|
257
257
|
**两条时序车道(唯一合法时机)**:
|
|
258
258
|
|
|
@@ -263,13 +263,14 @@ mstar worktree cleanup --workflow <id> [--harness <path>] [--apply] [--remote] [
|
|
|
263
263
|
|
|
264
264
|
## Workflow
|
|
265
265
|
|
|
266
|
-
主链:**PM 唯一分支决策**(`Working branch` / `Branch policy`,写进 Assignment)→ 实现者在 feature worktree 写产品编辑(L1:control root(主 checkout)管进程 SSOT、integration worktree 管 merge、feature 管源码)→ **QC 前**全部待审提交归并到**单一 `Working branch` `HEAD`** → 派 QC 三审 / QA 时共用**同一套对齐字段**(`Review cwd` / `Working branch` / `plan_id` / `Review range` / `Diff basis`,逐字相同)→ 集成分支 merge 串行(`integration_merge_lease`,在 integration worktree
|
|
266
|
+
主链:**PM 唯一分支决策**(`Working branch` / `Branch policy`,写进 Assignment)→ 实现者在 feature worktree 写产品编辑(L1:control root(主 checkout)管进程 SSOT、integration worktree 管 merge、feature 管源码)→ **QC 前**全部待审提交归并到**单一 `Working branch` `HEAD`** → 派 QC 三审 / QA 时共用**同一套对齐字段**(`Review cwd` / `Working branch` / `plan_id` / `Review range` / `Diff basis`,逐字相同)→ 集成分支 merge 串行(`integration_merge_lease`,在 integration worktree 执行;scoped 路线:`mstar plan integration-start` → 显式 `git -C <integration-path> merge --no-ff --no-edit <pinned-source-sha>` → `integration-accept` → `complete`,`reconcile` 是唯一恢复动词)。并发写流在派发**前**完成 worktree 隔离(L1 跨 plan / L2 同 plan);主 worktree 驻留分支 = 计划头记录的 **`Main worktree branch`**,全程不切换。
|
|
267
267
|
|
|
268
268
|
## References
|
|
269
269
|
|
|
270
270
|
- 派发与反递归红线 → **`mstar-dispatch-gates`**
|
|
271
271
|
- SDD implement 波次(file handoff / reviewer)→ **`mstar-sdd`**
|
|
272
272
|
- 迭代 Phase 2 integration worktree + lease 细则 → **`mstar-iteration`** §2(`references/phase-2-worktree-lease.md`)
|
|
273
|
+
- scoped plan 路线(bind / scope 边界 / handoff / coordinator merge 序列 / reconcile)→ **`mstar-iteration`** `references/plan-scoped-pm.md`
|
|
273
274
|
|
|
274
275
|
### L1 refusal diagnostics across hosts
|
|
275
276
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mstar-dispatch-gates
|
|
3
|
-
description: Morning Star 派发与委派门禁 —— 仅 PM 可增派 subagent、`Execute as` 与 `Delegation`、承接方反递归 NEVER
|
|
3
|
+
description: Morning Star 派发与委派门禁 —— 仅 PM 可增派 subagent、`Execute as` 与 `Delegation`、承接方反递归 NEVER 红线、**子 Assignment 继承 plan 作用域且 credential/session 不下发 leaf**、SDD 独立就绪任务并行派发、**SDD 路径 plan QC 强制 tri-review(N=3)**、inline 单席 QC 例外、Assignment 文案≠派发、未齐不发、**invoke 角色字段必填(漏写=静默 generic 回退=派发未完成)**。`project-manager` 派发时必读;leaf 动手前必读反递归。worktree 见 `mstar-branch-worktree`;SDD 见 `mstar-sdd`;宿主见 `mstar-host`;scoped plan 路线见 `mstar-iteration` `plan-scoped-pm.md`。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## Load order(必读顺序)
|
|
@@ -36,6 +36,14 @@ description: Morning Star 派发与委派门禁 —— 仅 PM 可增派 subagent
|
|
|
36
36
|
|
|
37
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 不做判定。
|
|
38
38
|
|
|
39
|
+
## Plan 作用域与 credential 不下发(preflight 强制)
|
|
40
|
+
|
|
41
|
+
派发前,与工具并发 / 角色绑定字段同级的硬门禁:
|
|
42
|
+
|
|
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
|
+
- **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 = 派发缺陷。
|
|
46
|
+
|
|
39
47
|
## 调度防串扰(强制;leaf executor 已在上方读过反递归红线,此处为完整规则供 PM/对照用)
|
|
40
48
|
|
|
41
49
|
- 只有 **`project-manager`** 可以决定增加/并行 subagent;承接方**默认不得二次分派**。
|
|
@@ -73,6 +81,7 @@ When **`Execution mode: sdd`** (`mstar-sdd`):
|
|
|
73
81
|
- **依赖驱动**:按 **`mstar-sdd`** § Ready-task scheduling 并行派发独立 ready tasks;各 task 后一位 fresh reviewer。真实依赖、共享写目标和 integration merge 串行。
|
|
74
82
|
- **`SDD implementer session: sticky`**:same implementer subagent may **resume** across tasks when host supports it; **reviewers never resume** — see **`mstar-sdd/references/sticky-implementer-session.md`**.
|
|
75
83
|
- File handoffs only — no pasted plan/diff/history in dispatch prompts.
|
|
84
|
+
- **scope 与凭据边界**:`{SDD_DIR}/task-N-brief.md` 携带继承的 plan 作用域(plan id + 绝对路径);**不下发** session JSON、`--expect <revision>` 等写凭据,也不得让 implementer/reviewer 自选 plan 或释放 lease(见 § Plan 作用域与 credential 不下发)。
|
|
76
85
|
- Record per-task BASE SHA; use `review-package` for diffs — **never `HEAD~1`**.
|
|
77
86
|
- After all tasks: branch `review-package` in `{SDD_DIR}/review/` → **mandatory tri-review N=3** when `Execution mode: sdd`; **N=1** only for `inline` / explicit single override.
|
|
78
87
|
|
|
@@ -56,6 +56,7 @@ On **dsh** only, read-only fan-out of **N ≥ 3** seats runs through the native
|
|
|
56
56
|
|
|
57
57
|
- **Advancing an iteration**: set the goal to **complete the entire iteration flow** (`iteration-start → per-plan cycles → iteration-close → PR delivery → PR merge-ready loop`). Do not set a sub-stage goal (e.g. "finish Phase 1 only").
|
|
58
58
|
- **Advancing non-iteration work** (single plan / hotfix / one-off task): set the goal to **complete the entire per-plan flow** (`specify → clarify → plan → tasks → implement → plan QC tri + QA gate → Done`). Do not set a sub-stage goal (e.g. "write the plan" or "implement one task").
|
|
59
|
+
- **Scoped primary route** (`/iteration-drive --assignment | --workflow <id> --plan <id> | --resume <session.json>`): the goal is the **active plan scope only** — `mstar plan bind` → constrain → tasks → per-task review → plan QC tri / QA → `mstar plan handoff`. Never set a goal that spans the iteration flow, sibling plans, or Phase 3–6: those stay in the coordinator's own primary session, not this plan-scoped one (`mstar-iteration` `references/plan-scoped-pm.md` §5).
|
|
59
60
|
|
|
60
61
|
Goal text is a session-level objective only: `{HARNESS_DIR}` / `{PLAN_DIR}` / `status.json` remain SSOT, and goal completion is **not** harness Done. Mirror goal success criteria into the SSOT plan; when the goal changes, update goal text and the SSOT in the same round.
|
|
61
62
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Load when **`mstar-host`** detection resolves **codex** (Codex app/CLI session, `/plan` / `/goal` slash commands, Goal tools, or Codex tool namespaces such as `functions.*`, `codex_app.*`, `tool_search`, `image_gen`, or Browser plugin tools).
|
|
4
4
|
|
|
5
|
-
Plan Mode: read **`references/_shared/plan-mode-bridge-core.md`** when Codex Plan Mode (`/plan`) is active. Goal Mode (`/goal`, goal tools, or goal progress controls) follows the host-agnostic **`/goal`** rule in `mstar-host` SKILL.md — applicability is by the `/goal` command, not host identity. Codex session plans, UI todos, and goal text are not durable harness SSOT.
|
|
5
|
+
Plan Mode: read **`references/_shared/plan-mode-bridge-core.md`** when Codex Plan Mode (`/plan`) is active. Goal Mode (`/goal`, goal tools, or goal progress controls) follows the host-agnostic **`/goal`** rule in `mstar-host` SKILL.md — applicability is by the `/goal` command, not host identity. On the scoped route (`/iteration-drive --assignment | --workflow --plan | --resume`) the goal is that **plan's scope only** — never the iteration flow, sibling plans, or Phase 3–6. Codex session plans, UI todos, and goal text are not durable harness SSOT.
|
|
6
6
|
|
|
7
7
|
Parallel PM dispatch: read **`parallel-dispatch.md`** only when Codex exposes an actual multi-agent / Task-style invocation tool. If no callable invoke tool exists, Assignment Markdown is coordination text only; do **not** claim subagent dispatch.
|
|
8
8
|
|
|
@@ -365,6 +365,12 @@ child's settle notification** → next dispatch. When a dispatched child owns th
|
|
|
365
365
|
critical path, the correct action is to **wait** — not to open another unit of
|
|
366
366
|
work against the same worktree.
|
|
367
367
|
|
|
368
|
+
The **scoped plan route** changes none of this: `/iteration-drive --assignment |
|
|
369
|
+
--workflow --plan | --resume` still never arms a goal on dsh, and its
|
|
370
|
+
progression stays the plan-scoped native workflow (`mstar plan bind → progress →
|
|
371
|
+
handoff`, coordinator `accept` / `integration-*` / `complete`) —
|
|
372
|
+
`mstar-iteration/references/plan-scoped-pm.md`.
|
|
373
|
+
|
|
368
374
|
### QC default
|
|
369
375
|
|
|
370
376
|
- **`Execution mode: sdd`**: **N=3** seats — one per QC seat (`qc-specialist`,
|
|
@@ -101,7 +101,7 @@ Single-task shorthand may exist depending on host version — always match the l
|
|
|
101
101
|
|
|
102
102
|
### Notes
|
|
103
103
|
|
|
104
|
-
- PM is the **primary** orchestration seat via the `pm` skill (no PM agent shell is bundled here — the `mode: primary` shell is OpenCode-only, `packages/opencode/agents/`). Do not dispatch PM-to-PM via `task` unless the live schema explicitly lists it **and** the Assignment requires it.
|
|
104
|
+
- PM is the **primary** orchestration seat via the `pm` skill (no PM agent shell is bundled here — the `mode: primary` shell is OpenCode-only, `packages/opencode/agents/`). Do not dispatch PM-to-PM via `task` unless the live schema explicitly lists it **and** the Assignment requires it. The **scoped primary route** (`/iteration-drive --assignment | --workflow --plan | --resume`) likewise runs in the **primary session** — it is never a `task` target, and a plan session may not reach sibling rows, the root register / shared projections, or Phase 3–6 (`mstar-iteration` `references/plan-scoped-pm.md`).
|
|
105
105
|
- Host generics (`scout`, `reviewer`, `designer`, …) remain useful for non-role orientation / assist — they do not replace a listed Morning Star role agent for role-owned deliverables.
|
|
106
106
|
|
|
107
107
|
### Role binding in prompt (C5b — required)
|
|
@@ -11,6 +11,17 @@ description: "Use when starting, driving, resuming, or closing a Morning Star it
|
|
|
11
11
|
|
|
12
12
|
**Phase detail 不在本 skill 正文**:按下方 **Phase route map** 只加载当前动作对应的一行 detail——**禁止**无条件通读全部 phase references。
|
|
13
13
|
|
|
14
|
+
**Scoped primary route**(`/iteration-drive --assignment|--workflow/--plan|--resume`)→ **`references/plan-scoped-pm.md`**,且**先于**本 skill 的全局 todo / backlog / last-plan 逻辑判定。
|
|
15
|
+
|
|
16
|
+
## Scoped primary route(先于全局 Phase 逻辑)
|
|
17
|
+
|
|
18
|
+
`/iteration-drive` 的 scoped 形态在**本 skill 的任何全局 Phase 逻辑之前**改道:
|
|
19
|
+
|
|
20
|
+
- **先选 route,再 seed todo**:不得先按整迭代 boot 建立全局 session todos / backlog / last-plan Phase 3 判断,再把 scoped 会话当作过滤器处理。
|
|
21
|
+
- **scoped finish = durable handoff**(plan 保持 `InReview`、保留 `execution_lease`)。`status: Done`、两个 lease 的删除、Phase 3–6、compass / index / root 投影与迭代 PR **仅 coordinator** 拥有。
|
|
22
|
+
- 无参数调用**语义不变**(Phase 2 → 3 → 4 → 5 → 6);非法非空形态 **fail closed**,**禁止**回落整迭代路线;leaf 收到该命令 → 角色边界拒绝。
|
|
23
|
+
- boot / plan-local drive / finish / coordinator 序列全文 → **`references/plan-scoped-pm.md`**。
|
|
24
|
+
|
|
14
25
|
## 设计思路
|
|
15
26
|
|
|
16
27
|
mstar 实践模式通常是:一次迭代锁定几个 spec 点(`specify + clarify`),产生多个 `plan`,每个 plan 含多个 tasks。**per-plan 生命周期有完整的闭环**(Prepare → Execute → QC → Done)。Compound 不是 per-plan 活动——它是**迭代级收口**,在迭代内所有 plan Done 后,沉淀一轮知识。
|
|
@@ -44,6 +55,7 @@ Phase 6: post-merge close —— PR merged 后 §6.1–§6.4
|
|
|
44
55
|
|
|
45
56
|
| 当前动作 | 必读 detail(按需加载,勿通读) |
|
|
46
57
|
|---------|--------------------------------|
|
|
58
|
+
| **scoped primary**(`/iteration-drive` 带 `--assignment` / `--workflow --plan` / `--resume`) | **`references/plan-scoped-pm.md`**(scoped boot → plan-local drive → handoff finish → coordinator 序列;**先于**整迭代 todo / last-plan 逻辑) |
|
|
47
59
|
| **start**(启动迭代 / 重开方向锁定) | **`references/phase-1-prepare.md`**(§1.1–§1.6:上下文、范围与 direction lock、compass、索引、v2 状态面、产物边界、§1.6 Review & Edit 链) |
|
|
48
60
|
| **execute / resume**(推进或恢复 per-plan 循环) | **`references/phase-2-worktree-lease.md`**(§2.0 五道闸、§2.1–§2.5 loop/dispatch 细则、control root + integration worktree + lease 全文) |
|
|
49
61
|
| **close**(全部 plan Done 后收口迭代) | **`references/phase-3-iteration-close.md`**(§3.0–§3.6:entry checklist、compound、roadmap、完成标记、exit checklist + commit) |
|
|
@@ -22,6 +22,8 @@ Phase 2–5 全程有效(drive + loop 共有的行):
|
|
|
22
22
|
|
|
23
23
|
派发细则 → **`mstar-dispatch-gates`** + **`mstar-host`**。Phase 3 细则 → **`mstar-iteration/references/phase-3-iteration-close.md`** + **`mstar-compound`**。
|
|
24
24
|
|
|
25
|
+
**Scoped primary route 例外**(`references/plan-scoped-pm.md`):scoped plan 会话只驱动**本 plan**——不 seed 全局 phase todos,不做「最后一个 plan `Done` → Phase 3」判断,不加载 compound;其 finish 是 **durable handoff**,`Done`、lease 删除与 Phase 3–6 归 coordinator。
|
|
26
|
+
|
|
25
27
|
## Assignment preflight(bash 块 — byte-identical 共享副本)
|
|
26
28
|
|
|
27
29
|
`mstar-harness` bin 未安装时静默跳过;在每次 implement/QC/QA 派发前(**SDD** 下为最新 `{SDD_DIR}/task-N-brief.md` 或临时写盘的 Assignment)校验。模式由迭代 compass frontmatter 的 `enforcement` 键决定(Slice 5):
|
|
@@ -42,6 +44,8 @@ if command -v mstar-harness >/dev/null 2>&1; then mstar-harness dispatch validat
|
|
|
42
44
|
|
|
43
45
|
## Session todos(重叠行;drive + loop 共有)
|
|
44
46
|
|
|
47
|
+
**Scoped primary route 不 seed 本表任何条目**:其 session todos 是 plan-local 任务列表,finish = handoff,**不**追加 `phase-3-*` / `phase-4-*` / `phase-5-*` / `phase-6-*` → **`plan-scoped-pm.md`** §4–§5。下表仅适用于整迭代路线(no-args `iteration-drive` / `iteration-loop`)。
|
|
48
|
+
|
|
45
49
|
| Todo id | 何时追加 | 何时可勾掉 |
|
|
46
50
|
|---------|----------|------------|
|
|
47
51
|
| plan-wave todos | 进入 Phase 2 | 各 plan `Done` |
|