@mstar-harness/opencode 1.1.0 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All notable changes to the `@mstar-harness/opencode` package are documented in t
4
4
 
5
5
  The monorepo root [CHANGELOG.md](../../CHANGELOG.md) summarizes cross-surface releases.
6
6
 
7
+ ## 1.2.0
8
+
9
+ - Bundled commands: add `/iteration-loop` (autonomous Phase 1→5; optional `direction` + `scale`).
10
+ - Bundled skills: `mstar-iteration` autonomous direction lock / scale budget / branch resolve + `references/autonomous-direction-lock.md`.
11
+
12
+ See root [CHANGELOG.md](../../CHANGELOG.md) **1.2.0**.
13
+
7
14
  ## 1.1.0
8
15
 
9
16
  - Bundled skills: raw QC/QA process reports default to gitignored `{SDD_DIR}/review/`; durable gate summaries and `status.json` residual findings are the tracked handoff surface. `{PLAN_DIR}/reports/` is legacy / explicit audit mode only.
package/README.md CHANGED
@@ -28,7 +28,7 @@ npx @mstar-harness/cli init --target opencode
28
28
  |-----------------|----------|
29
29
  | `harness-skills/` | `mstar-harness-core`, `mstar-iteration`, `mstar-sdd`, roles, phase/dispatch gates, … |
30
30
  | `harness-agents/` | Role shells (`project-manager`, `fullstack-dev`, `qc-specialist`, …) |
31
- | `harness-commands/` | `/iteration-start`, `/iteration-drive`, `/mstar-bootstrap` |
31
+ | `harness-commands/` | `/iteration-start`, `/iteration-drive`, `/iteration-loop`, `/mstar-bootstrap` |
32
32
 
33
33
  The plugin resolves **only paths inside this package** — not `process.cwd()/skills`, so your app repo root does not affect harness loading.
34
34
 
@@ -36,7 +36,7 @@ The plugin resolves **only paths inside this package** — not `process.cwd()/sk
36
36
 
37
37
  1. Install the plugin (above).
38
38
  2. In OpenCode, start with the **Project Manager** agent (`project-manager`).
39
- 3. For a full iteration: run **`/iteration-start`**, then **`/iteration-drive`** when plans are ready.
39
+ 3. For a full iteration: run **`/iteration-start`** then **`/iteration-drive`**, or one-shot **`/iteration-loop`** (autonomous Phase 1→5).
40
40
 
41
41
  Entry skill: **`mstar-harness-core`** (loaded before other `mstar-*` skills).
42
42
 
@@ -0,0 +1,297 @@
1
+ ---
2
+ name: iteration-loop
3
+ description: Autonomous full iteration loop for cloud agents — Phase 1 (code-first auto direction lock + compass/plans + Review & Edit chain) through Phase 2–5 (execute → close → PR → merge-ready). Optional args: direction, scale (S|M|L, default M). Not Done until Phase 5 exit checklist passes. Minimal human intervention; no grill-me.
4
+ agent: project-manager
5
+ ---
6
+
7
+ # Iteration Loop
8
+
9
+ Run a **full** Morning Star iteration with minimal human intervention. **Done = Phase 5 §5.5 exit checklist 全 `[x]`** — not Phase 1 lock, not Phase 3 close, not Phase 4 PR open.
10
+
11
+ **vs other commands:**
12
+
13
+ | Command | Scope |
14
+ |---------|--------|
15
+ | `iteration-start` | Phase 1 only; **grill-me** with user |
16
+ | `iteration-drive` | Phase 2→5 on an already locked iteration |
17
+ | **`iteration-loop`** | Phase 1→5 end-to-end; **autonomous** direction lock |
18
+
19
+ Phase gate SSOT → **`mstar-iteration`** §1–§5. This command is a **consumer**; it does not redefine skill semantics.
20
+
21
+ ## Args(最多 2 个)
22
+
23
+ ```
24
+ /iteration-loop [direction] [scale]
25
+ ```
26
+
27
+ | Arg | Meaning | Default |
28
+ |-----|---------|---------|
29
+ | `direction` | Iteration direction / feedback constraint (free text) | Code-first research → **auto-lock recommended** |
30
+ | `scale` | `S` \| `M` \| `L` | **`M`** |
31
+
32
+ **Scale budget**(写入 compass;约束 **业务** plan 数量)→ **`mstar-iteration`** §1.2 + `references/autonomous-direction-lock.md`:
33
+
34
+ - **S** → 1 business plan
35
+ - **M** → 2–3 business plans
36
+ - **L** → 3–4 business plans(默认上限 4,除非 `direction` 显式要求更大)
37
+
38
+ **HARD**:budget **只计**实际业务交付 plan;**不计** harness 流程(Review 链、QC/QA、compound、close、PR、merge-ready、compass/`status.json` 维护等)。流程门禁仍须执行,但不占 S/M/L 名额,也不得写成独立 process plan 来“凑数/占坑”。
39
+
40
+ Parse: if the last token is exactly `S`/`M`/`L` (case-insensitive), treat it as `scale`; remaining text is `direction`. If only one token and it is `S`/`M`/`L`, that is `scale` with empty `direction`.
41
+
42
+ ## Phase state machine(禁止跳步)
43
+
44
+ ```
45
+ Phase 1: Autonomous start → Phase 2: Autonomous Execute → Phase 3: close → Phase 4: PR → Phase 5: merge-ready
46
+ ```
47
+
48
+ | 当前状态 | 允许 | 禁止 |
49
+ |----------|------|------|
50
+ | Phase 1 未 lock | Research → auto-lock → Review chain → integration | 进入 Phase 2 implement;grill-me |
51
+ | compass `locked` + plans registered | **立刻** Phase 2 | 问用户「是否开始 execute」 |
52
+ | 存在非 `Done` plan | Phase 2 dispatch | 进入 Phase 3 或开 PR |
53
+ | **全部** plan `Done` | **立刻** Phase 3 | 宣称 loop 完成、开 PR |
54
+ | Phase 3 exit 全 `[x]` + compass `completed` | Phase 4 | 跳过 compound |
55
+ | PR 已创建 | Phase 5 loop | 汇报结束 |
56
+ | Phase 5 exit 全 `[x]` | **iteration-loop Done** | — |
57
+
58
+ ## Continuous execution(HARD — Phase 1 lock 后至 Phase 5 exit)
59
+
60
+ 自 Phase 1 §6 integration 完成起,至 Phase 5 §5.5 全 `[x]` 前,PM **连续编排**。
61
+
62
+ | 禁止 | 必须 |
63
+ |------|------|
64
+ | 方向 / plan / phase 边界例行 yes/no(「是否同意该方向」「要不要继续」「是否开 PR」) | 进度摘要后**下一条** = dispatch 或下一 phase 步骤 |
65
+ | 用 Phase 汇报收束 turn 后等待用户 | Phase 1 lock → **立刻** Phase 2;plan Done → 下一 plan 或 Phase 3 |
66
+ | 跨 plan 并行 implement | Per-plan **串行** |
67
+
68
+ **合法 STOP(仅此升级用户)**:
69
+
70
+ - Branch metadata 按 **`mstar-iteration`** autonomous resolve 顺序仍无法确定(**禁止**静默默认 `main`/`master`)
71
+ - 代码/roadmap **无可信候选**且无 `direction` 参数
72
+ - **`Blocked`**:真冲突、secrets、不可逆范围缺口、Phase 5 多轮仍无法 merge-ready
73
+ - 用户本轮显式打断
74
+
75
+ **Turn 收束纪律**:最后一条内容必须是 **in-flight 动作**(invoke 已发出或下一 Assignment),**不得**以确认问句结尾。
76
+
77
+ ## PM invariants
78
+
79
+ ### Phase 1(Review & Edit)
80
+
81
+ | 禁止(PM 线程) | 必须 |
82
+ |-----------------|------|
83
+ | 自己 Edit 冒充 product-manager / architect / writing-specialist | §5.1 → §5.2 → §5.3 **顺序**各 **1 次 invoke** |
84
+ | 只写 Assignment 就声称 review 完成 | 几条角色 ⇒ 几条 invoke |
85
+ | §5 完成前 commit / 创建 integration | 5.4 PM lock 在 subagent 返回之后 |
86
+ | 加载 `grill-me` | **Autonomous** direction lock(`mstar-iteration` §1.2) |
87
+
88
+ ### Phase 2–5
89
+
90
+ | 禁止(PM 线程) | 必须 |
91
+ |-----------------|------|
92
+ | Write/Edit/Shell 产品代码、写测试、跑 QC | 每条 implement/QC/QA Assignment ⇒ **1 次 `Task`** |
93
+ | 多 task plan inline 大包派发 | **SDD** per-task 循环 |
94
+ | 最后 plan `Done` 后直接开 PR | **Phase 3 → 4 → 5** |
95
+ | Phase 5 自己改产品代码 | dispatch `fullstack-dev` / `ops-engineer` |
96
+
97
+ 派发细则 → **`mstar-dispatch-gates`** + **`mstar-host`**。
98
+
99
+ **Session todos**:
100
+
101
+ | Todo id | 何时追加 | 何时可勾掉 |
102
+ |---------|----------|------------|
103
+ | `phase-1-autonomous-start` | Boot | compass `locked` + integration committed |
104
+ | plan-wave todos | 进入 Phase 2 | 各 plan `Done` |
105
+ | `phase-3-iteration-close` | 仅剩 1 个非 `Done` plan | Phase 3 §3.5 exit 全 `[x]` |
106
+ | `phase-4-create-pr` | Phase 3 完成后 | PR 已创建 |
107
+ | `phase-5-pr-merge-ready` | Phase 4 完成后 | Phase 5 §5.5 exit 全 `[x]` |
108
+
109
+ ## Boot
110
+
111
+ 1. `mstar-harness-core`
112
+ 2. `mstar-roles` → `references/project-manager.md`
113
+ 3. `mstar-iteration` → **§ Phase 1**(含 **autonomous** direction lock / scale budget / branch resolve)+ **§ Phase 2–5**
114
+ 4. `mstar-dispatch-gates`
115
+ 5. `mstar-phase-gates` → Prepare
116
+ 6. `mstar-plan-conventions`, `mstar-plan-artifacts`
117
+ 7. `mstar-host` → active host reference
118
+ 8. `mstar-compound` — before Phase 3 §3.2
119
+ 9. **`mstar-sdd`** — before first implement dispatch in Phase 2
120
+ 10. `mstar-review-qc` — before first QC dispatch in Phase 2
121
+ 11. `mstar-branch-worktree` — when Git/write or QC checkout
122
+
123
+ **Do not** Read `skills/grill-me/SKILL.md` for this command.
124
+
125
+ ---
126
+
127
+ ## Phase 1: Autonomous start
128
+
129
+ ### 1. Research
130
+
131
+ Survey structured and unstructured sources(code-first — **explore before guessing**):
132
+
133
+ **Structured:**
134
+ - `{HARNESS_DIR}/status.json` → active plans, deferred, residuals
135
+ - `{ITERATION_DIR}/` → prior compasses, roadmap batches
136
+ - `{KNOWLEDGE_DIR}/` → design / architecture notes
137
+ - `{SPECS_DIR}/` → specs, gaps
138
+
139
+ **Unstructured — Glob then Read:**
140
+ - `**/roadmap*.md`, `**/ROADMAP*.md`, `**/*-roadmap.md`
141
+ - `**/deferred*.md`, `**/DEFERRED*.md`
142
+ - `**/features*.md`, `**/FEATURES*.md`
143
+ - `**/backlog*.md`, `**/TODO*.md`, `**/todo*.md`, `**/*.plan.md`
144
+
145
+ Prioritize deferred / incomplete items from prior iterations. Read `STRATEGY.md` if present.
146
+
147
+ ### 2. Explore Directions
148
+
149
+ Scope **2–4** candidates targeting product completeness; each with goals + trade-offs. Prefer deferred / roadmap `next` items.
150
+
151
+ ### 3. Lock Direction — autonomous(NOT grill-me)
152
+
153
+ **Direction lock mode: `autonomous`**(显式 opt-in → **`mstar-iteration` §1.2**)。
154
+
155
+ Execute **`mstar-iteration` §1.2 autonomous** direction lock(detail: `references/autonomous-direction-lock.md`):
156
+
157
+ 1. If `direction` arg present → constrain candidates to that intent; pick the best evidence-backed fit.
158
+ 2. If absent → rank candidates(deferred/roadmap next > STRATEGY alignment > product completeness > risk)and **lock the recommended** direction.
159
+ 3. Write to compass: locked direction, rationale, success criteria, non-goals, scale budget.
160
+ 4. Resolve delivery branch policy via **autonomous branch resolve**(`references/autonomous-direction-lock.md`)— never silent `main`/`master`.
161
+
162
+ **Do not** ask the user to confirm the chosen direction. Record rationale on disk instead.
163
+
164
+ **STOP** if no credible candidate and no `direction` arg, or branch policy unresolved after resolve order.
165
+
166
+ ### 4. Write Compass & Plans
167
+
168
+ Per **`mstar-iteration` §1.3–§1.5**(template: `iteration-compass-template.md`):
169
+
170
+ - Compass with `iteration_base_branch`, `target_branch`, `status: active`, scale budget noted in Scope / Plans
171
+ - **Business** plan count within scale budget(exclude harness process from the count)
172
+ - Register plans in `status.json`; update `{ITERATION_DIR}/README.md`
173
+
174
+ ### 5. Review & Edit Chain(HARD GATE)
175
+
176
+ **顺序(HARD)**:`product-manager` → `architect` → `writing-specialist` → PM lock。**禁止**并行三角色。OpenCode:plain role id — **`mstar-host/references/opencode.md`** § Role-mention hygiene.
177
+
178
+ | # | Role | Required action |
179
+ |---|------|-----------------|
180
+ | 5.1 | **product-manager** | invoke: **edit** compass, plans, `{SPECS_DIR}/`, `{ITERATION_DIR}/<iteration-id>/` — **禁止** `{KNOWLEDGE_DIR}/` 新增 |
181
+ | 5.2 | **architect** | invoke: **edit** compass, plans, specs / workspace(含 5.1 后版本)— **禁止** knowledge 新增 |
182
+ | 5.3 | **writing-specialist** | invoke: edit docs + **specs corpus hygiene** — `iteration-artifact-boundaries.md` + `iteration-corpus-hygiene.md` |
183
+ | 5.4 | **project-manager** | Merge; **lock** compass (`status: locked`); confirm Prepare gates |
184
+
185
+ Tool rule → **`mstar-dispatch-gates`** specialist review-and-edit(顺序链)。Exception: user waives ("PM-only review").
186
+
187
+ ### iteration-loop Phase 1 pre-commit checklist
188
+
189
+ Print before §6; all must be `[x]`:
190
+
191
+ - [ ] Autonomous direction lock rationale recorded in compass(not grill-me)
192
+ - [ ] Scale budget applied; **business** plan count within S/M/L(harness process not counted)
193
+ - [ ] Draft compass + plans + `status.json` registered
194
+ - [ ] product-manager invoke completed;**未**向 `{KNOWLEDGE_DIR}/` 新增
195
+ - [ ] architect invoke completed;**未**向 `{KNOWLEDGE_DIR}/` 新增
196
+ - [ ] writing-specialist invoke completed;specs corpus hygiene done
197
+ - [ ] PM final lock: compass `status: locked`; Prepare gates pass
198
+ - [ ] Branch policy locked: `iteration_base_branch`, `spec_integration_branch`, `target_branch` in compass / `status.json`
199
+ - [ ] **THEN**: git commit + push `iteration/<iteration-id>`
200
+
201
+ ### 6. Integration Branch
202
+
203
+ **Precondition**: §5 complete.
204
+
205
+ ```bash
206
+ git fetch origin # if needed
207
+ git checkout -b <spec_integration_branch> <iteration_base_branch>
208
+ # or: git checkout <spec_integration_branch> if it already exists
209
+ ```
210
+
211
+ Register branch fields in compass + `status.json`. Commit docs; push.
212
+
213
+ **STOP** if `iteration_base_branch` or `target_branch` still missing after autonomous resolve.
214
+
215
+ **Immediately** print `## Phase 2: Autonomous Execute` → continue below(勾掉 `phase-1-autonomous-start`)。
216
+
217
+ ---
218
+
219
+ ## Phase 2: Autonomous Execute
220
+
221
+ **Continuous execution applies.** Branch policy first(`mstar-iteration` §2.3).
222
+
223
+ Execute **`mstar-iteration` § Phase 2** exactly. Summary:
224
+
225
+ 1. Precondition gate §2.0(four checks)
226
+ 2. Session todos §2.1
227
+ 3. Read backlog §2.2
228
+ 4. Integration branch §2.3
229
+ 5. Per-plan loop §2.4 — **SDD** default; serial implementer → task reviewer; QC **full tri-review** N=3; QA gate; merge to integration; next plan
230
+ 6. All plans `Done` → print `## Phase 3: iteration-close` → **`mstar-iteration` §3**(不得开 PR)
231
+
232
+ 派发纪律 → **`mstar-dispatch-gates`** + **`mstar-iteration` §2.5**。
233
+
234
+ ## Phase 3: iteration-close
235
+
236
+ 当 every plan 为 `Done`:
237
+
238
+ 1. STOP per-plan loop
239
+ 2. Print `## Phase 3: iteration-close`
240
+ 3. Execute **`mstar-iteration` §3.0→§3.5**(compound + workspace promotion)
241
+ 4. Exit checklist `[x]` + compass `completed` → print `## Phase 4: Create PR`
242
+
243
+ ```bash
244
+ git add {ITERATION_DIR}/ {KNOWLEDGE_DIR}/ CONCEPTS.md
245
+ git commit -m "chore(iteration): close <iteration-id> — compound round, roadmap update"
246
+ git push origin <spec_integration_branch>
247
+ ```
248
+
249
+ ## Phase 4: Create PR
250
+
251
+ Execute **`mstar-iteration` § Phase 4**:
252
+
253
+ 1. Print `## Phase 4: Create PR`
254
+ 2. Resolve `metadata.target_branch`(compass fallback);missing → STOP;never default `main`
255
+ 3. Create PR: `spec_integration_branch` → `target_branch`
256
+ 4. Record URL/number;勾掉 `phase-4-create-pr`
257
+ 5. **Immediately** print `## Phase 5: PR merge-ready` → Phase 5
258
+
259
+ ## Phase 5: PR merge-ready
260
+
261
+ Execute **`mstar-iteration` § Phase 5**。**§5.5 exit 全 `[x]` = iteration-loop Done.**
262
+
263
+ ### 5.0 Discover optional helper skills(non-`mstar-*`)
264
+
265
+ | Skill | Search paths(示例) |
266
+ |-------|----------------------|
267
+ | `greploop` | `skills/greploop/SKILL.md`;`~/.cursor/skills-cursor/greploop/SKILL.md`;`~/.agents/skills/greploop/SKILL.md` |
268
+ | `babysit` | `skills/babysit/SKILL.md`;`~/.cursor/skills-cursor/babysit/SKILL.md`;`~/.agents/skills/babysit/SKILL.md` |
269
+
270
+ | Priority | Condition | Primary done signal |
271
+ |----------|-----------|---------------------|
272
+ | 1 | `greploop` found | Greptile **5/5** |
273
+ | 2 | else `babysit` | Required CI green + reviews resolved |
274
+ | 3 | else neither | Same as babysit(本 command fallback) |
275
+
276
+ Both present: greploop to 5/5, then babysit(串行).
277
+
278
+ ### 5.1–5.4 Loop
279
+
280
+ Same hygiene as drive consumer pattern: status → conflicts → reviews → CI → mode pass → comment+resolve on addressed threads → repeat until §5.5.
281
+
282
+ Fixes push to `spec_integration_branch` only. PM does not rewrite product code in-thread.
283
+
284
+ ### 5.5 Phase 5 exit checklist(iteration-loop Done)
285
+
286
+ 与 **`mstar-iteration` §5.2** 对齐:
287
+
288
+ - [ ] PR mergeable
289
+ - [ ] All **required** CI checks green on latest head
290
+ - [ ] All review threads **resolved**(或用户书面 waive)
291
+ - [ ] Greptile **5/5**(若 greploop mode / repo 可见分数)
292
+ - [ ] Review comment + resolve 已覆盖本轮 addressed feedback
293
+ - [ ] Host todo `phase-5-pr-merge-ready` 可勾选
294
+
295
+ **Then** report: iteration id, locked direction + scale, plans completed, compound summary, PR link, merge-ready evidence.
296
+
297
+ PR merge itself may remain manual unless user authorized auto-merge.
@@ -65,6 +65,8 @@ Explore candidate directions targeting **product completeness**:
65
65
 
66
66
  ## 3. Lock Direction — bundled `grill-me`
67
67
 
68
+ **Direction lock mode: `interactive`**(`mstar-iteration` §1.2 默认;本命令不使用 `autonomous`)。
69
+
68
70
  This command bundles a **non-`mstar-*`** skill at `skills/grill-me/SKILL.md`. **Only this command step** references it — **do not** load it from `mstar-harness-core` or other `mstar-*` skills.
69
71
 
70
72
  **Before this step:** Read `skills/grill-me/SKILL.md`.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mstar-iteration
3
- description: Morning Star 迭代管理 —— iteration-start(specs + `<iteration-id>/` workspace;禁止直写 knowledge)、Autonomous Execute、iteration-close(compound 提升 workspace → knowledge)、PR 交付、PR merge-ready loop。分支 SSOT:`status.json` + compass frontmatter。
3
+ description: Morning Star 迭代管理 —— Phase 1(默认 interactive direction lock;opt-in autonomous;specs + `<iteration-id>/` workspace;禁止直写 knowledge)、Autonomous Execute、iteration-close(compound 提升 workspace → knowledge)、PR 交付、PR merge-ready loop。分支 SSOT:`status.json` + compass frontmatter。
4
4
  ---
5
5
 
6
6
  # mstar-iteration(迭代管理)
@@ -69,7 +69,7 @@ PM 在新迭代启动时执行。
69
69
 
70
70
  ### 1.2 定义迭代范围
71
71
 
72
- 与用户/产品对齐后,确定:
72
+ 与用户/产品对齐后(或按下方 **autonomous** 模式锁定后),确定:
73
73
 
74
74
  | 字段 | 说明 |
75
75
  |------|------|
@@ -81,10 +81,22 @@ PM 在新迭代启动时执行。
81
81
  | **非目标** | 明确排除在本次迭代外的事项 |
82
82
  | **Roadmap 上下文** | 本迭代在整体 roadmap 中的位置(current iteration / next iteration) |
83
83
  | **Delivery branch policy** | `iteration_base_branch`(integration 分支从何处分出)、`spec_integration_branch`、`target_branch`(最终 PR 目标) |
84
+ | **Scale budget**(可选) | 仅当 caller **显式**给出或选用 **autonomous** 时适用:`S` = 1 **业务** plan;`M` = 2–3;`L` = 3–4(默认上限 4)。**只计实际业务交付 plan**,不计 harness 流程性工作(Review 链 / QC / QA / compound / close / PR 等)。**interactive 默认不强制** S/M/L。计数细则 → **`references/autonomous-direction-lock.md`** § Scale budget |
84
85
 
85
- **Branch policy gate**:若用户、现有 roadmap、或项目约定未明确 `iteration_base_branch` / `target_branch`,PM 必须检查当前分支并向用户确认。**不得**因为存在 `main` / `master` 就默认从默认分支开 iteration 或向默认分支提 PR。
86
+ #### Direction lock modes
86
87
 
87
- **Direction lock**:compass/plans 初稿落盘前,PM 须与用户逐问收敛**单一**迭代方向、成功标准、非目标,并确认 delivery branch policy;决策写入 compass `## Scope` / `## Acceptance Criteria` / `## Non-Goals` 与 Delivery Branch Policy。
88
+ compass/plans 初稿落盘前,必须锁定**单一**迭代方向、成功标准、非目标,并确认 delivery branch policy;决策写入 compass `## Scope` / `## Acceptance Criteria` / `## Non-Goals` 与 Delivery Branch Policy。
89
+
90
+ | Mode | 何时选用 | 行为 |
91
+ |------|----------|------|
92
+ | **`interactive`** | **默认**(未显式声明 mode 时一律用此) | 与用户/产品**逐问**收敛方向与 branch policy;不得静默默认 `main`/`master` |
93
+ | **`autonomous`** | **仅**当 caller / Assignment **显式**声明 `Direction lock mode: autonomous`(或等价书面 opt-in) | 代码优先调研 → 排序候选 → **锁定推荐方向并落盘 rationale**;不因「是否同意该方向」例行问用户。细则 → **`references/autonomous-direction-lock.md`** |
94
+
95
+ **禁止**:在未显式 opt-in 时自行切换到 `autonomous`(例如仅因读了本 skill 或存在 roadmap next)。
96
+
97
+ **Branch policy gate(interactive — 默认路径)**:若用户、现有 roadmap、或项目约定未明确 `iteration_base_branch` / `target_branch`,PM 必须检查当前分支并向用户确认。**不得**因为存在 `main` / `master` 就默认从默认分支开 iteration 或向默认分支提 PR。
98
+
99
+ **Autonomous branch resolve**:仅 `autonomous` 模式;解析顺序与 STOP 规则见 **`references/autonomous-direction-lock.md`**(勿把该顺序套用到 interactive 以跳过向用户确认)。
88
100
 
89
101
  ### 1.3 创建迭代 compass
90
102
 
@@ -460,6 +472,7 @@ PR **merge** 本身可仍由用户手动执行,除非 Assignment 明确授权
460
472
  | `references/iteration-artifact-boundaries.md` | Phase 1 specs / iterations workspace / knowledge 分工 |
461
473
  | `references/iteration-workspace-readme-template.md` | `<iteration-id>/README.md` 可选模板 |
462
474
  | `references/iteration-corpus-hygiene.md` | §1.6 writing-specialist specs 卫生细则 |
475
+ | `references/autonomous-direction-lock.md` | §1.2 autonomous direction lock、scale budget、branch resolve |
463
476
  | `mstar-strategy` | iteration-start 时读 `STRATEGY.md` 对齐方向 |
464
477
 
465
478
  ## NOT to do
@@ -480,3 +493,6 @@ PR **merge** 本身可仍由用户手动执行,除非 Assignment 明确授权
480
493
  - **不要在 iteration-close 跳过 `<iteration-id>/` workspace 盘点**(compound 提升 SSOT → **`mstar-compound`**)
481
494
  - **不要在 iteration-start §1.6 跳过 writing-specialist 全库 specs corpus hygiene**(仅改当轮 compass/plans 而不扫 `{SPECS_DIR}/`)
482
495
  - **不要在 SDD plan 上以单席 `qc.md` 收尾**(除非用户书面 `QC mode: single — override`)
496
+ - **不要在未显式 `Direction lock mode: autonomous` 时跳过与用户收敛方向**(interactive 仍为默认)
497
+ - **不要在 `autonomous` mode 下例行问用户「是否同意该方向」**(须落盘 rationale;无候选且无约束时 STOP)
498
+ - **不要把 harness 流程(Review 链 / QC / QA / compound / close / PR 等)计进 Scale budget 的 plan 数量**,也不得为此单独建 process plan 占坑
@@ -0,0 +1,89 @@
1
+ # Autonomous direction lock
2
+
3
+ Capability detail for Phase 1 when direction lock mode is **`autonomous`**.
4
+
5
+ **Opt-in only.** Default Phase 1 mode remains **`interactive`** (user-converged). Do **not** apply this reference unless the caller / Assignment explicitly declares `Direction lock mode: autonomous` (or equivalent written opt-in). Reading this file alone is not opt-in.
6
+
7
+ ## Preconditions
8
+
9
+ - Research (§1.1) and candidate exploration already done — **read repo artifacts before ranking**.
10
+ - Do not invent roadmap items that have no file or status evidence.
11
+ - Scale budget (`S`/`M`/`L`) applies in this mode (or when the caller supplies one); do not retrofit a scale cap onto an interactive start that never asked for one.
12
+
13
+ ## Ranking heuristics(highest first)
14
+
15
+ 1. **Deferred / roadmap next** — prior compass `## Roadmap Position` next iteration, deferred-features, residuals marked for follow-up
16
+ 2. **STRATEGY alignment** — `STRATEGY.md` vision / decision principles when present
17
+ 3. **Product completeness** — closes a user-visible gap or unfinished capability
18
+ 4. **Risk / blast radius** — prefer smaller, shippable slices when candidates are otherwise equal
19
+
20
+ Document trade-offs for **each** shortlisted candidate (2–4), then lock **one**.
21
+
22
+ ## Lock outputs(must land on disk)
23
+
24
+ Write into compass (and plan Scope as needed):
25
+
26
+ | Field | Content |
27
+ |-------|---------|
28
+ | Locked direction | Single sentence |
29
+ | Rationale | Why this candidate won(cite paths / roadmap lines) |
30
+ | Acceptance criteria | Iteration-level Done |
31
+ | Non-goals | Explicit exclusions |
32
+ | Scale budget | `S` \| `M` \| `L` and resulting plan-count cap |
33
+
34
+ ## Scale budget
35
+
36
+ | Budget | **Business** plan count |
37
+ |--------|-------------------------|
38
+ | `S` | 1 |
39
+ | `M` | 2–3 |
40
+ | `L` | 3–4(default cap 4 unless a written constraint requires more) |
41
+
42
+ ### What counts toward the budget(HARD)
43
+
44
+ Count only **business delivery plans** registered in compass / `status.json` whose primary outcome is product, feature, bugfix, user-facing docs, API/contract, or architecture work for the locked direction.
45
+
46
+ **Do not count** harness / process work as plans (and do not invent plans whose sole job is process):
47
+
48
+ | Exclude from scale count | Examples |
49
+ |--------------------------|----------|
50
+ | Phase 1 process | Research, direction lock, Review & Edit chain, compass/index/`status.json` bootstrap |
51
+ | Phase 2 process | Per-task SDD briefs/reviews, plan QC tri, QA gate, branch merge-back |
52
+ | Phase 3–5 process | Compound / workspace promotion, iteration-close, Create PR, merge-ready / CI babysit |
53
+ | Meta “plans” | “run QC”, “do compound”, “open PR”, “setup harness”, “write compass only” |
54
+
55
+ Harness steps remain **mandatory gates** outside the budget — they do not consume S/M/L slots and must not be padded into the plan list to “fill” the budget.
56
+
57
+ If evidence suggests more **business** work than the budget allows, keep overflow in compass `## Roadmap Position` → next iteration — do not silently expand past the budget, and do not replace business plans with process plans to stay under the cap.
58
+
59
+ ## Direction constraint(optional input)
60
+
61
+ When a free-text direction / feedback constraint is supplied by the caller:
62
+
63
+ - Filter or re-rank candidates to fit that intent
64
+ - Still require code/roadmap evidence; do not lock a direction that contradicts the repo without documenting the conflict
65
+ - If constraint and evidence conflict irreconcilably → **Blocked**(escalate)
66
+
67
+ ## Autonomous branch resolve
68
+
69
+ **Only in `autonomous` mode.** Do not use this order to skip user confirmation under `interactive`.
70
+
71
+ Resolve `iteration_base_branch` and `target_branch` in order(first hit wins per field):
72
+
73
+ 1. `{HARNESS_DIR}/status.json` root `metadata`
74
+ 2. Existing / prior iteration compass frontmatter
75
+ 3. Current git branch **only if** it is already a documented delivery, integration, or project-policy branch(not merely “whatever HEAD is”)
76
+ 4. Still missing → **STOP** — escalate; **never** substitute `main` / `master` because those names exist
77
+
78
+ `spec_integration_branch` defaults to `iteration/<iteration-id>` once base/target are known.
79
+
80
+ ## Anti-patterns
81
+
82
+ - Applying this reference without explicit autonomous opt-in
83
+ - Asking the user “do you agree with this direction?” as a routine gate in autonomous mode
84
+ - Locking without reading roadmap / status / STRATEGY when those files exist
85
+ - Silent default to `main` / `master` for base or PR target
86
+ - Skipping written rationale because “it was obvious”
87
+ - Forcing S/M/L plan caps on interactive starts that did not request a scale budget
88
+ - Counting harness process (Review chain / QC / QA / compound / close / PR) toward the scale budget
89
+ - Creating process-only plans to fill or absorb S/M/L slots
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mstar-harness/opencode",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Morning Star harness OpenCode plugin (skills bootstrap and agent loading).",
5
5
  "license": "MIT",
6
6
  "repository": {