@mstar-harness/opencode 2.1.1 → 2.3.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/mstar.js +29 -1
  3. package/harness-commands/codebase-audit.md +2 -1
  4. package/harness-commands/iteration-drive.md +2 -1
  5. package/harness-commands/iteration-loop.md +2 -1
  6. package/harness-commands/iteration-start.md +2 -1
  7. package/harness-skills/mstar-audit/SKILL.md +20 -0
  8. package/harness-skills/mstar-audit/references/audit-playbook.md +27 -0
  9. package/harness-skills/mstar-branch-worktree/SKILL.md +8 -1
  10. package/harness-skills/mstar-coding-behavior/SKILL.md +5 -0
  11. package/harness-skills/mstar-compound/references/compound-workflow.md +16 -0
  12. package/harness-skills/mstar-compound-refresh/SKILL.md +5 -0
  13. package/harness-skills/mstar-host/SKILL.md +5 -3
  14. package/harness-skills/mstar-host/references/dsh.md +502 -0
  15. package/harness-skills/mstar-iteration/SKILL.md +1 -1
  16. package/harness-skills/mstar-iteration/references/phase-2-worktree-lease.md +4 -5
  17. package/harness-skills/mstar-iteration/references/phase-4-5-pr-delivery.md +1 -0
  18. package/harness-skills/mstar-plan-artifacts/SKILL.md +1 -0
  19. package/harness-skills/mstar-plan-artifacts/references/status-and-residuals.md +8 -0
  20. package/harness-skills/mstar-plan-conventions/SKILL.md +1 -1
  21. package/harness-skills/mstar-review-qc/SKILL.md +6 -0
  22. package/harness-skills/mstar-roles/references/project-manager/qc-and-residuals.md +2 -1
  23. package/harness-skills/mstar-roles/references/qc-specialist/deep-review-lenses.md +16 -7
  24. package/harness-skills/mstar-roles/references/qc-specialist/report-template.md +17 -1
  25. package/harness-skills/mstar-roles/references/qc-specialist-shared.md +3 -1
  26. package/harness-skills/mstar-roles/references/writing-specialist.md +33 -0
  27. package/harness-skills/mstar-sdd/SKILL.md +5 -1
  28. package/harness-skills/mstar-sdd/references/file-handoffs.md +2 -0
  29. package/harness-skills/mstar-skill-authoring/SKILL.md +4 -2
  30. package/harness-skills/mstar-skill-authoring/references/regression-fixation.md +46 -0
  31. package/harness-skills/mstar-skill-authoring/references/skillsbench-authoring.md +37 -0
  32. package/package.json +2 -2
@@ -33,8 +33,8 @@ QC reviewer 在开工时根据以下信号自判是否启用 deep review。满
33
33
  | Reviewer | 默认透镜 |
34
34
  |----------|---------|
35
35
  | QC1 (architecture/maintainability) | **Modularity Lens** + **Contract Lens** |
36
- | QC2 (security/correctness) | **Security Lens** + **Correctness Lens** |
37
- | QC3 (performance/reliability) | **Performance Lens** + **Reliability Lens** |
36
+ | QC2 (security/correctness) | **Security Lens** + **Correctness Lens** + **Bounds Lens** + **Real-Entry-Path Lens** |
37
+ | QC3 (performance/reliability) | **Performance Lens** + **Reliability Lens** + **Enforcement-Path Lens** + **Ownership / Derived-State Lens** |
38
38
 
39
39
  ### 按信号追加透镜
40
40
 
@@ -47,22 +47,27 @@ QC reviewer 在开工时根据以下信号自判是否启用 deep review。满
47
47
 
48
48
  ---
49
49
 
50
- ## 透镜清单(每透镜一行焦点;详细追问由 reviewer 按专业判断展开)
50
+ ## 透镜清单(每透镜一行焦点;详细追问由 reviewer 按专业判断展开;新增透镜各附 ≤4 条结构化追问,均可由 diff/read/grep 回答)
51
51
 
52
52
  每个透镜是一组审查焦点。QC reviewer 在报告中按透镜分节列出发现,每个发现标注来自哪个透镜(`Source Type: deep-lens: <Lens>`)。
53
53
 
54
54
  - **Modularity Lens** — 新依赖方向合理;无逻辑错放层级(controller 业务逻辑、model 视图逻辑);公共接口职责单一边界清晰;无循环依赖/隐含耦合。
55
- - **Contract Lens** — 公共 API/接口签名无未声明 breaking change(有则 plan 声明 + 迁移说明);新端点遵循命名/参数约定;返回类型稳定(新字段不破坏已有解析)。
56
- - **Security Lens** — 认证/授权/session/token/permission 逻辑正确;未验证输入未直入 DB/命令/文件;敏感数据(密钥/token/PII)未在日志/错误/返回值泄露;新访问控制点覆盖所有调用路径。
55
+ - **Contract Lens** — 公共 API/接口签名无未声明 breaking change(有则 plan 声明 + 迁移说明);新端点遵循命名/参数约定;返回类型稳定(新字段不破坏已有解析);docs-match-code:config/defaults/errors/wire fields/events 变更同 diff 更新 README/JSDoc;双语仓对照同步。
56
+ - **Security Lens** — 认证/授权/session/token/permission 逻辑正确;未验证输入未直入 DB/命令/文件;敏感数据(密钥/token/PII)未在日志/错误/返回值泄露;新访问控制点覆盖所有调用路径。(与 **Enforcement-Path Lens** 互指:访问控制点自身的正确性归本透镜;拒绝/校验路径的执行与旁路追迹归 Enforcement-Path)
57
57
  - **Correctness Lens** — 错误处理显式可恢复(无吞关键异常的 catch-all);边界条件覆盖(空/零/溢出/并发);状态转换一致(无外部可观察中间态);返回值/副作用与声明一致。
58
58
  - **Performance Lens** — 无 N+1 查询(ORM eager loading);循环/批处理无无界操作;新索引必要且不退化写入;大对象/列表分页或流式。
59
- - **Reliability Lens** — 资源(连接/句柄/锁)异常路径也释放;外部调用有超时+重试;缓存失效正确(不长期返回过期);无可能无限增长的结构(无界缓存/日志/队列)。
59
+ - **Reliability Lens** — 资源(连接/句柄/锁)异常路径也释放;外部调用有超时+重试;缓存失效正确(不长期返回过期);无可能无限增长的结构(无界缓存/日志/队列)。(与 **Lifecycle & Concurrency Lens** 互指:资源释放/超时重试/缓存失效归本透镜;对象生命周期与并发时序(发布竞态/取消/重入/清理完整性)归 Lifecycle & Concurrency)
60
60
  - **Auth Lens** — 认证中间件覆盖所有新端点;权限检查在业务逻辑前(先鉴权再操作);session 生命周期正确(创建/续期/失效);权限提升路径需二次确认。
61
61
  - **Input Validation Lens** — 外部输入(query/body/headers)经类型/范围/格式验证;无可触发路径遍历/注入/XSS;文件上传有大小/类型检查;错误信息不暴露内部实现细节。
62
62
  - **Data Migration Lens** — migration 可回滚(`down` 存在且正确);大表用非阻塞策略;数据一致(不丢/无脏中间态);并发写入下安全。
63
63
  - **Error Handling Lens** — 异常层级清晰(业务 vs 系统);面向用户错误消息安全;关键操作失败副作用正确处理(事务回滚/补偿);无"静默失败"路径。
64
64
  - **Standards Lens** — 风格/命名/文件组织符项目约定;无与现有冲突的重复实现;新依赖有充分理由;遵循项目 `AGENTS.md` 维护契约。
65
- - **Testing Lens** — 关键逻辑路径有覆盖;边界/异常路径覆盖;无仅 happy-path 跳 failure-mode;集成测试覆盖外部服务交互边界。
65
+ - **Testing Lens** — 关键逻辑路径有覆盖;边界/异常路径覆盖;无仅 happy-path 跳 failure-mode;集成测试覆盖外部服务交互边界;断言必须在目标回归上失败;验证外部状态/logs/events/disposal,不复述实现、不信任 agent 自报。
66
+ - **Lifecycle & Concurrency Lens** — 对象生命周期与并发时序:① publication 前无竞态(无其他路径可观察到未初始化状态)?② await 期间取消/超时传播到被等待任务且资源正确回收?③ reentry 前所有权已转移或显式保留?④ detach 清理完整(监听器/句柄移除),disposal 在 quiescent(无 in-flight 任务)时执行?(与 **Reliability Lens** 互指:资源/超时/缓存归 Reliability;生命周期/并发时序归本透镜)
67
+ - **Ownership / Derived-State Lens** — ① 每个保留值(字段/闭包捕获/缓存条目)是 borrowed 还是 owned,借用方生命周期不超过所有者?② 每个 cache/UI echo/replay/query view 追溯到 documented success point 与 authoritative source?③ 派生状态(缓存/投影/回显)的失效点与权威源同步声明?
68
+ - **Bounds Lens** — ① 完整产出(含 wrapper/metadata/封套行)的 owner 明确,边界检查覆盖完整产出而非仅载荷?② tiny/exact limit 被探测(空/最小/恰好等于上限)?③ 超大单块(单条记录超上限)被拒绝/截断而非绕过按行/按条门禁?④ 多字节文本(UTF-8 多字节字符)按字节上限而非字符数处理?
69
+ - **Enforcement-Path Lens** — ① 每个 deny/veto 路径追到实际执行拒绝的操作(而非仅声明策略)?② 直调/wrapper/facade/schema-less 路径/listener 顺序等旁路调用方是否都经同一校验点?③ 观察/记录侧(listener/consumer/回调)不会绕过主校验路径写入状态或缓存?(与 **Security Lens** 互指:访问控制点自身正确性归 Security;拒绝/校验路径的执行与旁路追迹归本透镜)
70
+ - **Real-Entry-Path Lens** — ① 测试/覆盖走 shipped entry(CLI/bin/loader/plugin boot)而非 hand-mounted 等价物(手工装配的组件实例)?② 真实入口的启动/挂载顺序(注册时序)被覆盖?
66
71
 
67
72
  ---
68
73
 
@@ -70,6 +75,8 @@ QC reviewer 在开工时根据以下信号自判是否启用 deep review。满
70
75
 
71
76
  所有透镜发现归入主报告的 `## Findings` 三节(Critical / Warning / Suggestion)中,每个发现的 `Source Type` 标注为对应透镜名(如 `deep-lens: Security Lens`),与主审查者的 `manual-reasoning` 发现同等待遇。
72
77
 
78
+ 每个透镜 finding 必须附 **diff / read / grep 锚点** + **预期 vs 实际(Expected vs observed)**——无锚点不入报告(宁可漏报不虚报)。
79
+
73
80
  ```markdown
74
81
  ## Scope
75
82
  - plan_id: <id>
@@ -81,6 +88,8 @@ QC reviewer 在开工时根据以下信号自判是否启用 deep review。满
81
88
  ### 🔴 Critical
82
89
  - [DS-001] Auth middleware missing on POST /api/admin/users → <fix>
83
90
  - Source Type: deep-lens: Auth Lens
91
+ - Verification: diff/read/grep anchor(`src/routes/admin.ts:41-52` 缺 auth 中间件引用 vs `src/middleware/auth.ts` 注册路径)
92
+ - Expected vs observed: 预期所有 `/api/admin/*` 经 auth 中间件 vs 实际 `POST /api/admin/users` 直入 handler
84
93
  - Confidence: High
85
94
  ```
86
95
 
@@ -28,18 +28,28 @@ Write under the Assignment-provided **`{SDD_DIR}/review/qc#.md`** (`qc1`…`qc3`
28
28
  ## Findings
29
29
  ### 🔴 Critical
30
30
  - {issue} -> {fix}
31
+ - Verification: {re-run repro | log comparison | input-output comparison | dual-path comparison | diff/read/grep anchor}
32
+ - Expected vs observed: {expected state} vs {actual observation}
31
33
 
32
34
  ### 🟡 Warning
33
35
  - {issue} -> {fix}
36
+ - Verification: {re-run repro | log comparison | input-output comparison | dual-path comparison | diff/read/grep anchor}
37
+ - Expected vs observed: {expected state} vs {actual observation}
34
38
 
35
39
  ### 🟢 Suggestion
36
40
  - {improvement}
41
+ - Verification: {diff/read/grep anchor}
42
+ - Expected vs observed: {expected state} vs {actual observation}
43
+
44
+ ### ⚪ Unconfirmed
45
+ - {finding} — channel gap: {reason}
37
46
 
38
47
  ## Source Trace
39
48
  - Finding ID: {F-001}
40
49
  - Source Type: {git-diff | read | grep | doc-rule | manual-reasoning | deep-lens: <name> | assignment-ci-note}
41
50
  - Source Reference: {path/snippet — not a test/build log you produced}
42
51
  - Confidence: High | Medium | Low
52
+ - Note: every finding carries `Verification` + `Expected vs observed` — see the Findings entry format above
43
53
 
44
54
  ## Summary
45
55
  | Severity | Count |
@@ -47,14 +57,18 @@ Write under the Assignment-provided **`{SDD_DIR}/review/qc#.md`** (`qc1`…`qc3`
47
57
  | 🔴 Critical | {n} |
48
58
  | 🟡 Warning | {n} |
49
59
  | 🟢 Suggestion | {n} |
60
+ | ⚪ Unconfirmed | {n} |
50
61
 
51
- **Verdict**: Approve | Request Changes | Needs Discussion
62
+ **Verdict**: Approve | Request Changes | Needs Discussion | Unconfirmed
52
63
  ```
53
64
 
54
65
  Report **Critical / Warning / Suggestion** sections are human-readable; PM maps to machine **`severity`** in `status.json` per `mstar-plan-artifacts/references/status-and-residuals.md`.
55
66
 
56
67
  ## Verdict rules (reviewer applies)
57
68
 
69
+ - Evidence channel failure (Review range cannot be established / key file unreadable) → `Unconfirmed` — report states the failure reason; PM-side handling per `mstar-review-qc` consolidated
70
+ - **Partial** evidence-channel failure → mark only the affected findings **Unconfirmed** (keep verifiable findings; state channel gaps in Summary)
71
+ - Any `Unconfirmed` finding (with or without Critical/Warning) → verdict `Unconfirmed`, never `Approve`; `Approve` additionally requires every finding's evidence channel intact
58
72
  - Unresolved **Critical** or **Warning** → `Request Changes`
59
73
  - No Critical/Warning but high-impact unresolved trade-off (often architectural Suggestion) → `Needs Discussion`
60
74
  - **Approve** only when Critical = 0 and Warning = 0 (unresolved)
@@ -67,6 +81,8 @@ Report **Critical / Warning / Suggestion** sections are human-readable; PM maps
67
81
 
68
82
  ## Evidence rules
69
83
 
84
+ - **If you cannot state a verifiable cross-check, do not report the finding** (prefer omission to fabrication)
85
+ - **A failed evidence channel is not "no problem"** — when the review-package is missing, the diff cannot be parsed, or a referenced file is unreadable, mark the affected scope **Unconfirmed**; never default to "no findings"
70
86
  - Critical findings: trigger condition, impact scope, fix suggestion (from source reasoning)
71
87
  - Low-confidence / runtime-only doubts: follow-up steps for **L4 QA** or implementer — not self-executed suites
72
88
  - Repeated cross-task patterns: mark as recurring in findings
@@ -102,9 +102,11 @@ report_kind: qc
102
102
  reviewer: {role_id}
103
103
  reviewer_index: {reviewer_index}
104
104
  plan_id: "<id>"
105
- verdict: "Approve | Request Changes | Needs Discussion"
105
+ verdict: "Approve | Request Changes | Needs Discussion | Unconfirmed"
106
106
  generated_at: "YYYY-MM-DD"
107
107
  ---
108
+
109
+ Verdict enumeration and rules (incl. `Unconfirmed` semantics) → **`references/qc-specialist/report-template.md`**.
108
110
  ```
109
111
 
110
112
  ## Completion Report
@@ -49,6 +49,39 @@ If any item below matches, **stop** and return `Blocked` to `project-manager` in
49
49
  - If unspecified, choose the clearest structure for target audience
50
50
  - Keep writing usable and publication-ready
51
51
  - Include source notes when factual claims require evidence
52
+ - Durable harness artifacts (knowledge docs, plans, README, promoted guides) must pass the **HEAD-resolvability test**: a reader at HEAD — no chat transcripts, dispatch prompts, or unmerged drafts — can resolve every reference and verify every claim.
53
+ - Leakage taxonomy and keep rules (mstar-sanctioned): SSOT → `mstar-compound/references/compound-workflow.md`.
54
+ - The same rubric applies to writing scenarios; do not duplicate its prose here.
55
+
56
+ ### Complete-proposition rule
57
+
58
+ Before trimming or restating a passage, enumerate the propositions it makes:
59
+
60
+ - actor + action
61
+ - condition / timing / ordering
62
+ - modality (must / may / must not)
63
+ - negative guarantee + exception
64
+ - ownership / side-effect / failure / consequence
65
+
66
+ Trim modifiers, repetition, or narration **only when every factual clause survives** the edit. Word count alone is not an improvement — a shorter sentence that drops a guarantee, a condition, or an ownership boundary changes the contract, not the prose.
67
+
68
+ ### Coverage-by-artifact
69
+
70
+ One explanation has one home; essential contract facts may repeat locally. Each durable artifact type has a coverage focus:
71
+
72
+ | Artifact | Coverage focus |
73
+ |----------|----------------|
74
+ | Knowledge docs | unique rationale, alternatives considered, shipped verification evidence, named coverage gaps |
75
+ | Plans | prerequisites, actions, observable verification |
76
+ | Review bundles | defect / location / impact / evidence; blockers separated from suggestions |
77
+ | SKILL.md | behavioral guardrails + explicit "guidance, not script" scope limitation |
78
+ | README | consumer contract: config / semantics / failures / limitations / extension points — durable gaps, not cleanup inventories |
79
+ | Completion reports | what / why / verification |
80
+
81
+ ### Doc standards
82
+
83
+ - **Atomic-move rule**: a move = remove + add + fixing every inbound link in the same change; no orphaned references may survive the change set.
84
+ - **Tutorial vs reference**: user-facing docs are either a tutorial (ordered steps to an observable outcome) or a reference (explicitly scoped lookup).
52
85
 
53
86
  ## Completion Report
54
87
 
@@ -87,7 +87,11 @@ Host mapping → **`mstar-host`** references (`model` / Task field).
87
87
 
88
88
  1. `mstar sdd review-package MERGE_BASE HEAD` → branch diff in `{SDD_DIR}/review/`
89
89
  2. PM dispatches **plan QC tri-review (L3)** — **`QC mode: full tri-review`**, **N=3** — with branch review-package path and report paths under `{SDD_DIR}/review/` → **`mstar-review-qc`** · **`mstar-dispatch-gates`**. Layer SSOT → **`mstar-review-qc/references/review-responsibility-boundaries.md`**. PM writes `{SDD_DIR}/review/qc-consolidated.md` and durable main-plan gate summary. **Mandatory whenever `Execution mode: sdd`** (single-plan or iteration).
90
- 3. Critical/Important QC findings → **one** fix dispatch (full list), then targeted re-review
90
+ 3. Critical/Important QC findings → **one** fix dispatch (full list), then targeted re-review. Fix rounds run on four mechanics — the per-task fix loop applies the same (`references/file-handoffs.md`):
91
+ - **Unverified rounds count**: a fix round without verification evidence (reviewer not confirmed / report not on disk) is **not clean** — re-check and count the round; never enter the convergence branch.
92
+ - **Full re-entry**: the next fix dispatch carries **all** open findings (including last round's unverified items) — never slice a subset.
93
+ - **Capped cross-round excerpt**: from round ≥2, the fix dispatch attaches an excerpt of prior rounds' findings and dispositions (advisory caps: ~500 words per round, ~1500 total — suggested values, not hard limits).
94
+ - **Honest non-convergence**: open findings at wave close → list them in detail and state the disposition — re-feed to the next fix round **or** transfer to residual tracking — never silently close.
91
95
  4. QA gate → **`mstar-harness-core`** Done rules; PM **`mstar-roles/references/project-manager/qa-trigger-matrix.md`**
92
96
 
93
97
  ## Progress ledger
@@ -48,6 +48,8 @@ Fix subagent appends to same `task-N-report.md` with test evidence:
48
48
 
49
49
  Re-dispatch reviewer only when all three are present.
50
50
 
51
+ The per-task fix loop applies the same fix-round mechanics as plan-level QC fix waves (SKILL.md · "After all tasks" — unverified rounds count, full re-entry, capped cross-round excerpt, honest non-convergence): from round ≥2 the excerpt of prior rounds' findings/dispositions goes into the fix dispatch brief, and the round tally/verification history lands in `$SDD_DIR/progress.md`.
52
+
51
53
  ## Progress ledger
52
54
 
53
55
  On clean task review, append to `$SDD_DIR/progress.md`:
@@ -152,11 +152,13 @@ Agents 按 **skill 名** 发现 skill;文档若给出完整仓内相对路径
152
152
  - Progressive disclosure:
153
153
  - Evidence for behavior change (P6):
154
154
  - Stale references checked:
155
- - Verdict: Approve | Request Changes | Needs Discussion
155
+ - Verdict: Approve | Request Changes | Needs Discussion | Unconfirmed
156
+ - Unconfirmed: paired evidence (P6) cannot be established or verified
156
157
  ```
157
158
 
158
159
  ## References
159
160
 
160
161
  | 何时 | 打开 |
161
162
  |------|------|
162
- | 需要完整 skill-writer 流程、原则细则、输出模板 | `references/skillsbench-authoring.md` |
163
+ | 需要完整 skill-writer 流程、原则细则、输出模板 | `references/skillsbench-authoring.md` |
164
+ | 需要把「真实产物」固化为可重跑断言(P6 重武器选项) | `references/regression-fixation.md` |
@@ -0,0 +1,46 @@
1
+ # 回归固化参考(Regression Fixation Reference)
2
+
3
+ 行为塑形改动(skill 正文流程、命令序列、CLI 行为面)的 paired evidence 武器库之一(P6 **重武器选项**)。默认证据仍是 SKILL.md「验证门控」的 P6 before/after + 应用案例;仅当行为可脚本化、且该行为面值得长期固化时,用本手法。
4
+
5
+ ## 何时用(When)
6
+
7
+ - 行为面有**可执行产物**:skill 正文里的流程脚本 / 命令序列 / CLI 调用链。
8
+ - 该面曾出过行为 bug,或改动触碰宿主边界(解析、打包、路径解析、子进程执行)。
9
+ - 例外:纯文案 / 无可观测行为的规则微调 → 走默认 P6,不加载本参考。
10
+
11
+ ## 手法(Technique)
12
+
13
+ 1. **真实产物当被测对象(real artifact as test subject)**
14
+ 不 import 源码、不 mock 掉被测面本身——直接运行用户/agent 实际触达的产物(built bundle、命令序列、宿主钩子驱动的完整流程)。产物侧跑通,才能覆盖「源码 import 跑不到」的缺陷面(bundle 解码、产物路径解析、子进程环境)。
15
+ → 本仓实例:`packages/cli/test/bundle-smoke.test.ts`(2026-08-16 落地)对 **built bundle** `dist/mstar-harness.js` 子进程执行 `dispatch validate` 并断言 exit code,而非 import `src/index.ts`。
16
+
17
+ 2. **Mock 宿主钩子(mock host hooks)**
18
+ 把宿主边界替换为受控桩:mstar 面对应 dispatch / file IO / CLI 调用。固定输入(fixture 文件、argv、环境变量),断言行为输出(exit code、stdout/stderr、副作用文件)。钩子命名沿用宿主自身词汇,不引入外部系统 hook 名。
19
+
20
+ 3. **双路径断言一致(dual-path assertion)**
21
+ 同一断言集对两条路径各跑一遍并断言一致:**真实模块路径**(import 产物 / 源码)与**被测路径**(vm 求值真实脚本 / 子进程 bundle)。任一路径偏离 → 立即暴露「实现与产物行为漂移」。
22
+
23
+ 4. **修复固化(fix solidification)**
24
+ 行为 bug 修复流程:先写复现用例见 FAIL → 修 → 用例见 PASS → 进回归集。此后每次改动重跑回归集,同类 bug 不再复发(回归集随修复轮增长)。
25
+
26
+ ## 最小骨架(Skeleton,零外部依赖)
27
+
28
+ ```js
29
+ // node:test + vm:求值「真实脚本文本」,不复制逻辑到测试
30
+ import test from "node:test";
31
+ import vm from "node:vm";
32
+
33
+ const script = readFileSync("flow.js", "utf8"); // 真实产物
34
+ const sandbox = { dispatch: mockDispatch, fileIO: mockFileIO }; // mock 宿主钩子
35
+ vm.runInNewContext(script, sandbox); // 被测路径
36
+ assert.deepEqual(sandbox.events, expected); // 断言行为输出
37
+ // 双路径:同一断言集对真实模块路径再跑一遍,assert 一致
38
+ ```
39
+
40
+ bun test 同理:`Bun.spawnSync` 子进程跑 bundle + `expect` 断言(见本仓 bundle-smoke 实例)。
41
+
42
+ ## 边界(Boundaries)
43
+
44
+ - **零外部依赖**:Node 内置 `vm` / `node:test`(或 bun test)即可,不引入第三方测试框架。
45
+ - **不强制**:默认仍是 P6 before/after + 应用案例;本参考是重武器选项。
46
+ - **只固化可观测行为**:模型判断、触发精确性等不可脚本化断言的面,仍走压力场景(SKILL.md「验证门控」)。
@@ -76,6 +76,43 @@ Do **not** restate generic knowledge the model already has — that wastes token
76
76
  6. **Pressure / paired check** — 2–3 prompts that fail without the skill; confirm improvement (P4, P6).
77
77
  7. **Ship note** — list deletions/compressions (P2/P5) and how P6 was verified.
78
78
 
79
+ ## Authoring devices
80
+
81
+ Small, composable techniques for specific authoring problems; each maps onto one or two
82
+ principles above. Pull one in when it fits — do not encode all six into every skill.
83
+
84
+ 1. **Calibrated examples file** (serves P2/P5) — keep one small reference of real cases
85
+ distilled into annotated judgments; readers identify the governing principle, not text
86
+ templates, and it is written back when a new rule settles. In this harness: the Q1–Q8
87
+ worked judgments in `mstar-compound` `references/compound-workflow.md`; this iteration's
88
+ fold-B overcorrection checklist (device 3) is a softer second instance.
89
+
90
+ 2. **Recall batteries** (serves P5) — for audit/hunt skills: over-matching probes that
91
+ force a semantic judgment, plus a documented list of known false-positive families; a
92
+ zero-hit pattern proves nothing until you have seen it match. In this harness: the recon
93
+ hints `mstar-audit` fans out to scout subagents — scoping facts, domain risk hints, and
94
+ decided-tradeoff "don't report" pointers.
95
+
96
+ 3. **Overcorrection traps** (adjacent to P6) — a short section per skill naming the failure
97
+ modes of over-applying its own rules, so the skill guards its own bias. In this harness:
98
+ the overcorrection-traps row in `mstar-compound` `references/compound-workflow.md`
99
+ (obligation↛endorsement flips, hypotheticals stay marked, delete clauses, not sentences).
100
+
101
+ 4. **Required-explicit-input** (adjacent to P3) — when the required scope or answers are
102
+ missing, report and stop; never infer a repo-wide default. In this harness: `mstar-audit`
103
+ asks which findings to turn into plans — "do not write 30 plans nobody asked for" —
104
+ instead of inferring the scope itself.
105
+
106
+ 5. **Questions ≠ write authority** (serves P6) — interaction and calibration gates never
107
+ change edit authority; only the evaluation does. In this harness: `grill-me` interviews
108
+ without editing, and `mstar-sdd` keeps the per-task reviewer's report separate from the
109
+ implementer's application.
110
+
111
+ 6. **Invocation boundary** (adjacent to P3) — declare expensive workflows user-invocable
112
+ only; never put them in a skill load order. In this harness: the `/iteration-*` lifecycle
113
+ lives in `commands/`; `mstar-harness-core` keeps command-layer references out of the
114
+ `mstar-*` load matrix.
115
+
79
116
  ## Output template
80
117
 
81
118
  ```markdown
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mstar-harness/opencode",
3
- "version": "2.1.1",
3
+ "version": "2.3.0",
4
4
  "description": "Morning Star harness OpenCode plugin — skills bootstrap + engine-backed runtime hooks (status lint, dispatch validation, Enforcement: hard gates).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,6 +36,6 @@
36
36
  "access": "public"
37
37
  },
38
38
  "devDependencies": {
39
- "@mstar-harness/engine": "2.1.1"
39
+ "@mstar-harness/engine": "workspace:*"
40
40
  }
41
41
  }