@mstar-harness/opencode 0.5.1 → 0.6.1

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 (31) hide show
  1. package/INSTALL.md +1 -2
  2. package/dist/mstar.js +2 -6
  3. package/harness-skills/mstar-dispatch-gates/SKILL.md +2 -2
  4. package/harness-skills/mstar-harness-core/SKILL.md +8 -4
  5. package/harness-skills/mstar-harness-core/references/open-harness-principles.md +1 -1
  6. package/harness-skills/mstar-host/SKILL.md +49 -0
  7. package/harness-skills/mstar-host/references/codex.md +56 -0
  8. package/harness-skills/mstar-host/references/cursor-plan-mode-bridge.md +175 -0
  9. package/harness-skills/mstar-host/references/cursor.md +73 -0
  10. package/harness-skills/mstar-host/references/opencode.md +58 -0
  11. package/harness-skills/mstar-host/references/parallel-dispatch.md +42 -0
  12. package/harness-skills/mstar-plan-artifacts/SKILL.md +19 -18
  13. package/harness-skills/mstar-plan-artifacts/references/status-and-residuals.md +164 -220
  14. package/harness-skills/mstar-plan-artifacts/scripts/tech-debt-rollup.sh +115 -0
  15. package/harness-skills/mstar-plan-artifacts/templates/README.md +1 -1
  16. package/harness-skills/mstar-roles/SKILL.md +1 -1
  17. package/harness-skills/mstar-roles/references/architect.md +1 -1
  18. package/harness-skills/mstar-roles/references/frontend-dev.md +1 -1
  19. package/harness-skills/mstar-roles/references/fullstack-dev-shared.md +1 -1
  20. package/harness-skills/mstar-roles/references/ops-engineer.md +1 -1
  21. package/harness-skills/mstar-roles/references/product-manager.md +1 -1
  22. package/harness-skills/mstar-roles/references/project-manager/dispatch-and-assignment.md +4 -4
  23. package/harness-skills/mstar-roles/references/project-manager/routing-and-dev-allocation.md +17 -11
  24. package/harness-skills/mstar-roles/references/project-manager.md +7 -3
  25. package/harness-skills/mstar-roles/references/prompt-engineer.md +1 -1
  26. package/harness-skills/mstar-roles/references/qa-engineer.md +1 -1
  27. package/harness-skills/mstar-roles/references/qc-specialist-shared.md +1 -1
  28. package/harness-skills/mstar-roles/references/writing-specialist.md +1 -1
  29. package/harness-skills/pm/SKILL.md +1 -1
  30. package/package.json +1 -2
  31. package/skills/mstar-host/SKILL.md +0 -131
package/INSTALL.md CHANGED
@@ -25,8 +25,7 @@ Restart OpenCode. The plugin installs from npm and registers Morning Star runtim
25
25
 
26
26
  - Keep your role models and permissions in `opencode.json`.
27
27
  - The plugin loads **only paths inside the `@mstar-harness/opencode` package**:
28
- - **`harness-skills/`** — copy of Morning Star `skills/` from the release build (`prepublishOnly` runs `bundle-assets` before `bun build`).
29
- - **`skills/`** — packaged OpenCode host adapter (e.g. `mstar-host`).
28
+ - **`harness-skills/`** — copy of repo `skills/` from the release build (`prepublishOnly` runs `bundle-assets` before `bun build`), including **`mstar-host`**.
30
29
  - **`harness-agents/`** — copy of repo `agents/` from the same build.
31
30
  - It does **not** read `<cwd>/skills` or `<cwd>/agents`, so OpenCode’s `process.cwd()` (your app project root) does not affect harness resolution.
32
31
  - Bootstrap prompt entry is injected once with `<IMPORTANT_FOR_HARNESS>`.
package/dist/mstar.js CHANGED
@@ -6,17 +6,13 @@ import { fileURLToPath } from "node:url";
6
6
  var __dirname2 = path.dirname(fileURLToPath(import.meta.url));
7
7
  var packageRoot = path.resolve(__dirname2, "..");
8
8
  var bundledSkillsDir = path.join(packageRoot, "harness-skills");
9
- var hostSkillsDir = path.join(packageRoot, "skills");
10
9
  var bundledAgentsDir = path.join(packageRoot, "harness-agents");
11
10
  var bootstrapAgentsPath = path.join(packageRoot, "AGENTS.md");
12
11
  var BOOTSTRAP_MARKER = "IMPORTANT_FOR_HARNESS";
13
12
  function resolveSkillPathCandidates() {
14
- const out = [];
15
13
  if (fs.existsSync(bundledSkillsDir))
16
- out.push(bundledSkillsDir);
17
- if (fs.existsSync(hostSkillsDir))
18
- out.push(hostSkillsDir);
19
- return out;
14
+ return [bundledSkillsDir];
15
+ return [];
20
16
  }
21
17
  var extractFrontmatterAndBody = (content) => {
22
18
  const match = content.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mstar-dispatch-gates
3
- description: Morning Star 派发与委派门禁 —— 仅 PM 可增派 subagent、`Execute as` 与 `Delegation`、承接方反递归 NEVER 红线、同条消息 N 次 invoke、QC 三审禁止串行 rollout、Assignment 文案≠派发(invoke 条数须对齐)、未齐不发(emit zero until batch-ready)。**必须**在 `@project-manager` 每轮派发、QC 三审并发、双轨 implement、或 leaf 角色疑惑能否 Task 时 Read;所有非 PM 承接方动手前必读反递归与自检。同仓 worktree 与 QC 检出对齐见 `mstar-branch-worktree`。Superpowers 并行短语见 `mstar-superpowers-align`。宿主细则见 `mstar-host-opencode` / `mstar-host-cursor`。
3
+ description: Morning Star 派发与委派门禁 —— 仅 PM 可增派 subagent、`Execute as` 与 `Delegation`、承接方反递归 NEVER 红线、同条消息 N 次 invoke、QC 三审禁止串行 rollout、Assignment 文案≠派发(invoke 条数须对齐)、未齐不发(emit zero until batch-ready)。**必须**在 `@project-manager` 每轮派发、QC 三审并发、双轨 implement、或 leaf 角色疑惑能否 Task 时 Read;所有非 PM 承接方动手前必读反递归与自检。同仓 worktree 与 QC 检出对齐见 `mstar-branch-worktree`。Superpowers 并行短语见 `mstar-superpowers-align`。宿主细则见 `mstar-host`(`references/parallel-dispatch.md` 与各宿主 reference)。
4
4
  ---
5
5
 
6
6
  ## Load order(必读顺序)
@@ -43,7 +43,7 @@ description: Morning Star 派发与委派门禁 —— 仅 PM 可增派 subagent
43
43
  - **QC 三审硬门禁**:`qc-specialist` / `qc-specialist-2` / `qc-specialist-3` 须**同一条消息**全部发起;只发其中一个 = **`dispatch incomplete`**,不得写「三审已并行启动」。
44
44
  - **先自检再发送**:发送前核对「Assignment 条数 = 本条消息中的实际 **派发** 调用条数」。
45
45
  - **前置步骤与派发回合分离(防串行 rollout)**:为派发准备的 **`bash` / `read` / `glob` / `grep`**(如 `merge-base`、`Review range`、`git rev-parse`)**不计入** `N` 次派发;可在上一条仅含准备的消息完成。准备完成后,**下一条派发消息**须**一次性**含 **`N` 次** Task / subagent invoke。**禁止**先发 `1` 次、等返回再补发其余 `N-1` 次。
46
- - **未齐不发(emit zero until batch-ready)**:需并发 `N≥2` 而当前只能发 `1` 条时,本条应发 **`0` 条派发 invoke`**(可继续 read/bash 补齐),**禁止**「先发一个顶一下」;`N` 份 payload 就绪后**单次消息发满 `N`**。OpenCode **`mstar-host-opencode`**「OpenCode PM: dispatch order」。
46
+ - **未齐不发(emit zero until batch-ready)**:需并发 `N≥2` 而当前只能发 `1` 条时,本条应发 **`0` 条派发 invoke`**(可继续 read/bash 补齐),**禁止**「先发一个顶一下」;`N` 份 payload 就绪后**单次消息发满 `N`**。见 **`mstar-host`** `references/parallel-dispatch.md`(具备 invoke / Task / subagent 工具的宿主共用)。
47
47
 
48
48
  ### 具名 subagent 宿主:文案分派 ≠ 调度完成
49
49
 
@@ -85,14 +85,18 @@ PM 在 Assignment 写 **`Task category`**(主类 + 可选 `secondary`):
85
85
  | `mstar-coding-behavior` | Think / Simplicity / Surgical / Goal-Driven |
86
86
  | `mstar-superpowers-align` | Superpowers × harness 优先级与短语 |
87
87
  | `mstar-roles` | 角色正文 hub |
88
+ | `mstar-host` | 宿主适配(自动识别;`references/opencode.md` / `cursor.md` / `codex.md` / `parallel-dispatch.md`) |
88
89
 
89
90
  ## 宿主 `mstar-host`
90
91
 
92
+ Read **`mstar-host`** after this skill; detect host per its table, then Read the matching reference.
93
+
91
94
  | 宿主 | 要点 |
92
95
  |------|------|
93
- | OpenCode | `AGENTS.md` → 本 skill;`question`、`@explore` |
94
- | Cursor | 会话先 Read 本 skill;Task 并行 QC;Plan 模式双写 → `mstar-host-cursor` · `references/cursor-plan-mode-bridge.md` |
95
- | 其它 | 初始化时强制 Read skill |
96
+ | OpenCode | `question`、`@explore`、named-role invoke → `references/opencode.md` |
97
+ | Cursor | Task 并行 QC;Plan 双写 → `references/cursor.md` · `cursor-plan-mode-bridge.md` |
98
+ | Codex | plugin skills、sandbox/apply_patch/tool discovery;无 invoke 工具时不声称 subagent dispatch → `references/codex.md` |
99
+ | 其它 | 同 `mstar-host` skill;按工具信号选 reference |
96
100
 
97
101
  ## 护栏(不变量)
98
102
 
@@ -123,7 +127,7 @@ PM 在 Assignment 写 **`Task category`**(主类 + 可选 `secondary`):
123
127
  | residual 只写 plan 不写 SSOT | `mstar-plan-artifacts` |
124
128
  | 角色文件塞流程长文 | 用专题 skill |
125
129
  | 无证据宣称完成 | `mstar-coding-behavior` / verification |
126
- | CreatePlan 不落盘 / 无 `.agents` mirror | `mstar-host-cursor` · `cursor-plan-mode-bridge` |
130
+ | CreatePlan 不落盘 / 无 `.agents` mirror | `mstar-host` · `cursor-plan-mode-bridge` |
127
131
 
128
132
  ## 可选:OpenViking Memory
129
133
 
@@ -70,7 +70,7 @@
70
70
 
71
71
  ## 延伸阅读
72
72
 
73
- - 按能力选配 MCP/skills:当前宿主的 `mstar-host` skill 的「按能力选配」章节
73
+ - 按能力选配 MCP/skills:OpenCode `mstar-host` `references/opencode.md`;其它宿主见 `mstar-host` 检测表
74
74
  - Superpowers 与门禁对齐:`mstar-superpowers-align`
75
75
  - 库文档检索共享协议:`mstar-harness-core` `references/library-docs-protocol.md`
76
76
  - 跨角色编码行为准则(轻量、可复用):`mstar-coding-behavior`
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: mstar-host
3
+ description: Morning Star host adapter (OpenCode, Cursor, Codex). Use after mstar-harness-core whenever host entry, clarify, dispatch, or plan UX differs by platform - OpenCode question/@agent-id invoke, Cursor /pm and CreatePlan/SwitchMode dual-write and Task parallel QC, Codex plugin skills plus sandboxed tools/tool discovery. Auto-detect host from session tools; then Read references/<host>.md. Always load after mstar-harness-core.
4
+ ---
5
+
6
+ # Morning Star Host Adapter
7
+
8
+ Host-specific **capabilities and entry behavior** for Morning Star. Process gates and invariants stay in `mstar-harness-core` and topic `mstar-*` skills.
9
+
10
+ ## First action
11
+
12
+ Read **`mstar-harness-core`** before this skill (even when the host injects project `AGENTS.md`).
13
+
14
+ ## Default path
15
+
16
+ 1. Read `mstar-harness-core`
17
+ 2. Read **`mstar-host`** (this skill) and detect host below
18
+ 3. Read **`references/<host>.md`** for the active host
19
+ 4. Load role via `mstar-roles`
20
+ 5. Execute with evidence-first completion checks
21
+
22
+ Load topic skills **on demand** per `mstar-roles` (do not read every `mstar-*` skill by default). Cursor maint routing-eval: `.cursor/skills/mstar-routing-eval/` only.
23
+
24
+ ## Detect active host
25
+
26
+ Use **capability signals** (not filesystem paths):
27
+
28
+ | Signal | Host | Next read |
29
+ |--------|------|-----------|
30
+ | **CreatePlan** / **SwitchMode** available | `cursor` | `references/cursor.md`; Plan mode also `references/cursor-plan-mode-bridge.md` |
31
+ | **`question`** tool or PM **`@<agent-id>`** subagent invoke | `opencode` | `references/opencode.md` |
32
+ | **Task** + `subagent_type`, no CreatePlan | `cursor` | `references/cursor.md` |
33
+ | **Codex app/CLI/plugin context**, `functions.*`, `codex_app.*`, `tool_search`, Browser plugin tools | `codex` | `references/codex.md` |
34
+ | Still ambiguous | - | Read sections in **`cursor.md`**, **`opencode.md`**, and **`codex.md`** that match tools you have; **`mstar-harness-core` wins** on conflict |
35
+
36
+ ## Parallel dispatch (invoke-capable hosts)
37
+
38
+ When PM dispatches **N >= 2** concurrent assignees (QC tri-review, dual-track implement, etc.) and the host exposes actual invoke / Task / subagent tools, read **`references/parallel-dispatch.md`** in the dispatch round (shared with `mstar-dispatch-gates`). Without a callable invoke tool, Assignment Markdown is not dispatch.
39
+
40
+ ## Library docs (Context7)
41
+
42
+ Follow `mstar-harness-core` → `references/library-docs-protocol.md`.
43
+
44
+ ## Conflict order
45
+
46
+ 1. User explicit instructions (this turn)
47
+ 2. Project `AGENTS.md` / `CLAUDE.md`
48
+ 3. `mstar-harness-core` and related `mstar-*` skills
49
+ 4. This `mstar-host` skill and `references/*`
@@ -0,0 +1,56 @@
1
+ # Codex host reference
2
+
3
+ Load when **`mstar-host`** detection resolves **codex** (Codex app/CLI session, Codex plugin installed from `.codex-plugin/plugin.json`, or Codex tool namespaces such as `functions.*`, `codex_app.*`, `tool_search`, `image_gen`, or Browser plugin tools).
4
+
5
+ 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.
6
+
7
+ ## Codex-only context
8
+
9
+ - Plugin source: `.codex-plugin/plugin.json`.
10
+ - Runtime skills: repo `skills/` mounted by the Codex plugin (`"skills": "./skills/"`).
11
+ - `/pm`: shared force entry via the `pm` skill; after that, role behavior comes from `mstar-roles`.
12
+ - Role files under `agents/` are for hosts that load agent shells; Codex role execution should load `mstar-roles` references directly.
13
+ - Tool and plugin availability can be lazy-loaded or session-dependent. Use the tools actually present in the current session; do not infer capability from documentation alone.
14
+
15
+ ## Skill loading
16
+
17
+ 1. Read `mstar-harness-core`.
18
+ 2. Read `mstar-host` and this Codex reference.
19
+ 3. Load `mstar-roles` and the active role reference.
20
+ 4. Load topic skills on demand per the role reference.
21
+
22
+ Use skill names in prompts and references. Avoid absolute local paths unless the user is maintaining this repository or the skill is not installed and must be read from the checkout.
23
+
24
+ ## Clarify
25
+
26
+ - Codex does not imply an OpenCode-style `question` tool.
27
+ - If a structured user-input tool is available in the active mode, use it for concise 1-3 choice decisions.
28
+ - Otherwise ask one concise Markdown question only after codebase exploration cannot answer it.
29
+ - `update_plan` / local todo UI is session progress only; it does not replace `{PLAN_DIR}` plans or `{HARNESS_DIR}/status.json`.
30
+
31
+ ## Dispatch and role execution
32
+
33
+ - **No invoke tool = no dispatch**: printing `## Assignment` does not start another Codex worker.
34
+ - If Codex exposes multi-agent tools, PM may dispatch through those tools and must follow `parallel-dispatch.md`.
35
+ - If no invoke tool is present, use single-session role execution: state the active role, load that role reference, complete the assignment, and return Completion Report v2.
36
+ - QC tri-review is only "parallel" when three distinct callable reviewer sessions are actually launched in one dispatch turn. Without that, run a clearly labeled serial/manual review path or return `Blocked` for PM rerouting.
37
+ - Leaf executors still follow `mstar-dispatch-gates`: no recursive Task/subagent calls unless Assignment says `Delegation: allowed (...)`.
38
+
39
+ ## Files, shell, and approvals
40
+
41
+ - Prefer `rg` / `rg --files` for search and `apply_patch` for manual edits.
42
+ - Respect Codex sandbox and approval prompts. If a required command fails because of sandbox or network restrictions, request escalation through the host approval mechanism.
43
+ - Do not edit global Codex plugin metadata, marketplace files, credentials, secrets, or user config without explicit user consent.
44
+ - Browser, image, document, spreadsheet, presentation, and automation capabilities are host tools. Use them only when the user request or verification need calls for them.
45
+
46
+ ## Git and final evidence
47
+
48
+ - Git work still follows `mstar-branch-worktree` and the Assignment `Working branch` / `Branch policy`.
49
+ - Codex app git directives, when available, are audit annotations only. Emit them only after the underlying git action succeeds; never use a directive as a substitute for staging, committing, pushing, or PR creation evidence.
50
+ - Completion reports should cite concrete commands, artifacts, and commit lines when required by the Assignment.
51
+
52
+ ## Gotchas
53
+
54
+ - Codex plugin install gives skills, not automatic OpenCode-style named role invocations.
55
+ - Tool discovery (`tool_search`) can reveal capabilities, but availability is not authorization; Assignment `Delegation` still controls use.
56
+ - Session plans, chat summaries, and UI todos are not durable harness SSOT unless mirrored to `{HARNESS_DIR}`.
@@ -0,0 +1,175 @@
1
+ # Cursor Plan Mode × Harness Dual-Write Bridge
2
+
3
+ > **Load order**: Read **`mstar-harness-core`** first, then **`mstar-plan-conventions`** and **`mstar-plan-artifacts`** before the first **CreatePlan** in Plan mode. Path symbols `{HARNESS_DIR}`, `{PLAN_DIR}`, `{SPECS_DIR}` are defined in `mstar-plan-conventions`. On conflict, **`mstar-harness-core`** wins.
4
+
5
+ ## Purpose
6
+
7
+ Cursor **Plan mode** uses **CreatePlan** and built-in plan todos for session UX. Morning Star **SSOT** lives on disk under **`{HARNESS_DIR}`** (default `.agents/`). This reference defines **dual-write**: mirror every durable plan artifact to the repo; never treat the Cursor plan URI alone as the handoff surface.
8
+
9
+ ## Priority (hard)
10
+
11
+ 1. User explicit instructions (this turn)
12
+ 2. Project `AGENTS.md` / `CLAUDE.md`
13
+ 3. **`{HARNESS_DIR}` / `{PLAN_DIR}` / `status.json`** (harness SSOT)
14
+ 4. Cursor CreatePlan body and plan todos (session UX mirror)
15
+
16
+ **NEVER** cite only a Cursor plan file path in Assignment **Plan Path**, **Context Loaded**, or Completion Report when `{PLAN_DIR}/<plan-id>-<name>.md` should exist.
17
+
18
+ ## When this applies
19
+
20
+ - Cursor **Plan mode** is active (system guidance to use **CreatePlan** / **SwitchMode**).
21
+ - Morning Star plugin or `/pm` is in use (`mstar-host`, `pm` skill, or `rules/mstar-cursor-plan-mode.mdc`).
22
+
23
+ ## Before the first CreatePlan
24
+
25
+ 1. **Read** (minimum): `mstar-plan-conventions`, `mstar-plan-artifacts` (SKILL.md); Prepare gates from `mstar-phase-gates` if not hotfix.
26
+ 2. **Discover** `{HARNESS_DIR}` / `{PLAN_DIR}` per `mstar-plan-conventions` (prefer `.agents/` + `.agents/plans/`).
27
+ 3. **Initialize** if absent (see checklist below).
28
+
29
+ ### Harness initialization checklist
30
+
31
+ When plan management is required and directories are missing:
32
+
33
+ 1. Create `{HARNESS_DIR}` and `{PLAN_DIR}`.
34
+ 2. Create `{PLAN_DIR}/reports/`.
35
+ 3. Create `{HARNESS_DIR}/archived/residuals/`.
36
+ 4. Initialize `{HARNESS_DIR}/status.json` from `mstar-plan-artifacts/templates/status.empty.json` if missing.
37
+ 5. Optional: `{HARNESS_DIR}/notes.json` from `templates/notes.empty.json`, `{HARNESS_DIR}/knowledge/README.md`.
38
+
39
+ Reuse legacy `.plans/` or `plans/` only when already present; do not duplicate structures.
40
+
41
+ Full PM checklist: `mstar-roles/references/project-manager/plan-management.md`.
42
+
43
+ ## CreatePlan: fixed bootstrap todos (prefix)
44
+
45
+ **Emit these three todos first**, in order, **before** any implement / code todos. Do **not** mark implement todos in progress until all three are **done**.
46
+
47
+ | Todo ID (use in title) | Goal | On-disk outcome |
48
+ |------------------------|------|-----------------|
49
+ | **`harness-init`** | Bootstrap harness tree | `{HARNESS_DIR}/`, `{PLAN_DIR}/`, `reports/`, `archived/residuals/`, `status.json` initialized |
50
+ | **`spec-register`** | Register plan in SSOT | New `plans[]` row in `status.json` (`id`, `status`, `file`, `metadata`); spec stub in `{SPECS_DIR}` or plan frontmatter |
51
+ | **`mirror-plan`** | SSOT main plan file | `{PLAN_DIR}/<plan-id>-<name>.md` with task checkboxes aligned to CreatePlan body |
52
+
53
+ ### `spec-register` minimum fields
54
+
55
+ Add one object to `status.json` → `plans[]`:
56
+
57
+ ```json
58
+ {
59
+ "id": "<plan-id>",
60
+ "status": "Todo",
61
+ "file": ".agents/plans/<plan-id>-<short-name>.md",
62
+ "metadata": {
63
+ "primary_spec": "<spec-id or path if known>",
64
+ "description": "<one-line summary>"
65
+ }
66
+ }
67
+ ```
68
+
69
+ Set `updated_at` on `status.json` to today (`YYYY-MM-DD`). Commit harness files in the **business repo** when the project tracks `.agents/` (default).
70
+
71
+ ### `mirror-plan` minimum content
72
+
73
+ - YAML or markdown frontmatter with `plan_id`, title, status (`Todo` / `InProgress` — not `Done` unless PM/QA authority).
74
+ - **Task list** as markdown checkboxes (`- [ ]` / `- [x]`) matching CreatePlan implement todos.
75
+ - Link: “SSOT status: `{HARNESS_DIR}/status.json` → `plans[]` / `residual_findings`.”
76
+
77
+ After **CreatePlan**, keep CreatePlan body and mirror file **in sync** when scope changes (update both in the same coordination round).
78
+
79
+ ## CreatePlan body template (copyable)
80
+
81
+ Use this structure in CreatePlan `plan` markdown; mirror the same sections into `{PLAN_DIR}/<plan-id>-<name>.md`.
82
+
83
+ ```markdown
84
+ # Plan: <title>
85
+
86
+ **plan_id**: <plan-id>
87
+ **HARNESS_DIR**: .agents/
88
+ **Plan file (SSOT)**: .agents/plans/<plan-id>-<short-name>.md
89
+ **status.json**: .agents/status.json
90
+
91
+ ## Prepare gates
92
+
93
+ - specify: [done|n/a]
94
+ - clarify: [done|n/a]
95
+ - plan: [done|in progress]
96
+
97
+ ## Tasks (mirror as checkboxes in SSOT plan file)
98
+
99
+ ### Bootstrap (fixed prefix — complete before implement)
100
+
101
+ 1. harness-init — init .agents/, status.json, reports/, archived/residuals/
102
+ 2. spec-register — register plan_id in status.json; spec stub if applicable
103
+ 3. mirror-plan — write .agents/plans/<plan-id>-<short-name>.md
104
+
105
+ ### Implement
106
+
107
+ - [ ] <task-id-1>: <description>
108
+ - Done when: git commit on Working branch + checkbox [x] in SSOT plan + evidence below
109
+ - [ ] <task-id-2>: ...
110
+
111
+ ## Working branch
112
+
113
+ <branch-name or "PM to assign before implement">
114
+
115
+ ## Verification
116
+
117
+ - Commands / tests required before InReview
118
+ ```
119
+
120
+ ## Implement todo completion gate (every code todo)
121
+
122
+ Embed this checklist **inside each implement todo description** in CreatePlan (and mirror the same text on the matching checkbox line in the SSOT plan file).
123
+
124
+ **Before marking the todo done:**
125
+
126
+ 1. **Commit**: `git add` + `git commit` on the authorized **Working branch** for this **task id** (one commit per task unless PM explicitly allowed batched commits in Assignment).
127
+ 2. **Plan checkbox**: Set `- [x]` on the matching line in `{PLAN_DIR}/<plan-id>-<name>.md`.
128
+ 3. **status.json** (when PM round requires): bump `plans[].status` (e.g. `InProgress`) or append coordination notes per `mstar-plan-artifacts`.
129
+ 4. **Evidence**: Record real `git log -1 --oneline` in Completion Report v2 **Git** (or Plan-mode status note if executing as PM in Plan mode).
130
+
131
+ **NEVER**
132
+
133
+ - Mark implement todos done without a commit when tracked files changed.
134
+ - Batch all work into one closing commit unless PM documented an exception.
135
+ - Mark plan-level `Done` in `status.json` without PM/QA authority.
136
+
137
+ Dev-role NEVER rules also apply when executing as implementer: `mstar-roles/references/fullstack-dev-shared.md` (Git NEVER).
138
+
139
+ ## SwitchMode → Agent (pre-flight)
140
+
141
+ Before switching from Plan to Agent for implementation (or declaring Plan phase complete):
142
+
143
+ - [ ] `{PLAN_DIR}/<plan-id>-<name>.md` exists on disk
144
+ - [ ] `status.json` contains `plans[]` entry with matching `id` and `file`
145
+ - [ ] Bootstrap todos `harness-init`, `spec-register`, `mirror-plan` are **done**
146
+ - [ ] CreatePlan implement todos reference **task ids** traceable to SSOT plan checkboxes
147
+ - [ ] **Plan Path** for any Assignment uses the SSOT path, not the Cursor plan URI
148
+
149
+ If any item fails → **Blocked**; finish harness sync before implement.
150
+
151
+ ## PM in Plan mode (`/pm`)
152
+
153
+ When `/pm` runs under Plan mode:
154
+
155
+ - Load this reference via **`mstar-host`** (Cursor detection) after `mstar-harness-core`.
156
+ - **CreatePlan** todos **must** include the three bootstrap prefix items.
157
+ - Prepare phase (`specify → clarify → plan`) still applies; `mirror-plan` is the harness **`plan`** artifact, not a substitute for clarify.
158
+ - Before QC dispatch, read **`mstar-review-qc`** (unchanged).
159
+
160
+ ## Anti-patterns
161
+
162
+ | Anti-pattern | Fix |
163
+ |--------------|-----|
164
+ | CreatePlan only, no `.agents/` files | Run bootstrap todos; Write mirror plan + status.json |
165
+ | Todo done, no commit | Commit per task; paste `git log -1` evidence |
166
+ | Drift between CreatePlan and SSOT plan | Update both in same round |
167
+ | Cursor plan URI as Plan Path | Use `{PLAN_DIR}/...` path |
168
+ | Skip `spec-register` | Add `plans[]` row before implement |
169
+
170
+ ## Related skills
171
+
172
+ - `mstar-plan-conventions` — discovery, init, `writing-plans` path gate
173
+ - `mstar-plan-artifacts` — `status.json`, reports, checkboxes, residual
174
+ - `mstar-phase-gates` — Prepare / Execute order
175
+ - `mstar-roles/references/project-manager/dispatch-and-assignment.md` — Checkpoint: commit → Completion Report → Status Update
@@ -0,0 +1,73 @@
1
+ # Cursor host reference
2
+
3
+ Load when **`mstar-host`** detection resolves **cursor** (CreatePlan / SwitchMode, Task + `subagent_type`, or Cursor `/pm` flow).
4
+
5
+ Parallel PM dispatch: **`parallel-dispatch.md`** (Task tool uses same turn model).
6
+
7
+ ## Cursor-only context
8
+
9
+ - Role prompts: `mstar-roles`; **`/pm`** → `project-manager` via `pm` skill + `mstar-roles`.
10
+ - Routing-eval: `.cursor/skills/mstar-routing-eval/` — maint only.
11
+
12
+ ## Plan mode × harness dual-write
13
+
14
+ When **Plan mode** is active, **CreatePlan is session UX**; SSOT is **`{HARNESS_DIR}`** (default `.agents/`) — `{PLAN_DIR}/<plan-id>-<name>.md`, `{HARNESS_DIR}/status.json`.
15
+
16
+ Before first **CreatePlan**: Read `mstar-plan-conventions`, `mstar-plan-artifacts`, Prepare gates from `mstar-phase-gates` when not hotfix. Full procedure: **`cursor-plan-mode-bridge.md`**.
17
+
18
+ **Bootstrap CreatePlan todos (prefix, before implement):**
19
+
20
+ | Todo ID | Purpose |
21
+ |---------|---------|
22
+ | `harness-init` | Init `{HARNESS_DIR}`, `{PLAN_DIR}`, `reports/`, `archived/residuals/`, `status.json` |
23
+ | `spec-register` | Register `plan_id` in `status.json.plans[]` + spec stub if applicable |
24
+ | `mirror-plan` | Write SSOT main plan under `{PLAN_DIR}/` |
25
+
26
+ Each **implement todo**: per–task-ID **git commit** on Working branch → SSOT `- [x]` → optional `status.json` sync → `git log -1 --oneline` evidence.
27
+
28
+ Before **SwitchMode → Agent**: mirror plan exists; `status.json` lists `plan_id`; bootstrap todos done. **Never** use only the Cursor plan URI as **Plan Path**.
29
+
30
+ Enforcement: `rules/mstar-cursor-plan-mode.mdc` when plugin active.
31
+
32
+ ## `/pm` precedence
33
+
34
+ 1. User explicit instructions
35
+ 2. Project `AGENTS.md` / `CLAUDE.md`
36
+ 3. `mstar-harness-core` and `mstar-*` skills
37
+ 4. `mstar-host` + this reference
38
+
39
+ ## Task tool (QC tri-review)
40
+
41
+ - Apply **`parallel-dispatch.md`**: prerequisite message may prep only; dispatch message emits **all `N`** Tasks (**3** for tri-review) in **one** message when parallel is required.
42
+ - `subagent_type`: `qc-specialist`, `qc-specialist-2`, `qc-specialist-3`.
43
+ - Identical across three Tasks: **`plan_id`**, **`Review cwd`**, **`Review range` / Diff basis** (`mstar-branch-worktree`, `mstar-dispatch-gates`, `mstar-review-qc`).
44
+ - Parallel QC ≠ different review cwd per reviewer; one integrated HEAD for scope.
45
+ - Status Update may note QC ran via parallel Task subagents.
46
+
47
+ ## Supplemental execution modes
48
+
49
+ **Mode A — Single session, multiple roles:** PM writes Assignment; executor states `Acting as role: …` and loads `mstar-roles` reference. QC/QA without Task: same field alignment rules.
50
+
51
+ **Mode B — Multi-window:** One Assignment per chat; first turn loads role via `mstar-roles`; PM consolidates in main thread.
52
+
53
+ **Mode C — Worktrees:** `mstar-branch-worktree` + `mstar-dispatch-gates` for concurrent writers; do not assign different tri-review cwd by default.
54
+
55
+ **No recursive Task in implement subagents:** Task recipient is already `Execute as`; must not re-spawn same dev role. Assignment wins over conflicting outer messages (`Delegation: forbidden`).
56
+
57
+ ## Clarify
58
+
59
+ - No `question` tool: structured Markdown or Cursor UI.
60
+ - “Question asked” ≠ clarify done; high-impact ambiguity → `Blocked` or escalation.
61
+
62
+ ## Superpowers
63
+
64
+ If no Skill invocation tool: `mstar-superpowers-align` “plugin not installed”; **Read** upstream `SKILL.md` before execution.
65
+
66
+ ## Gotchas
67
+
68
+ - Tri-review needs identical `plan_id` and review scope fields.
69
+ - Task parallelism does not relax branch/worktree isolation.
70
+
71
+ ## Project rules
72
+
73
+ Project `AGENTS.md` / `CLAUDE.md` upward from cwd override global harness defaults when they conflict with Cursor-side rules; user instructions win.
@@ -0,0 +1,58 @@
1
+ # OpenCode host reference
2
+
3
+ Load when **`mstar-host`** detection resolves **opencode** (`question` tool, `@<agent-id>` invoke, or OpenCode session).
4
+
5
+ Parallel PM dispatch: **`parallel-dispatch.md`** (read in dispatch rounds).
6
+
7
+ ## Role loading
8
+
9
+ - **Role shell**: `agents/<id>.md` referenced by `opencode.json` `agent.<id>` (frontmatter + role binding only).
10
+ - **Role body**: `mstar-roles` `references/<id>.md` (or shared references + parameters).
11
+ - Superpowers conflicts: `mstar-superpowers-align`.
12
+
13
+ ## OpenCode-specific capabilities
14
+
15
+ - **Structured clarify**: prefer `question` tool (title, prompt, options, optional custom text). Requires `permission.question` in config (user-maintained; do not edit global config without consent).
16
+ - **Built-in subagents**: `@explore` (read-only), `@general`; subject to `mstar-harness-core` explore boundaries.
17
+ - **Named roles (`@<agent-id>`)**: configured in `opencode.json` `agent.<id>` must be **actually invoked** by PM. Assignment Markdown alone does not open sessions.
18
+ - **Per-role models**: configurable per subagent in `opencode.json`.
19
+
20
+ ## Invoke entry
21
+
22
+ Use host subagent / Task / equivalent per **`parallel-dispatch.md`**. OpenCode PM typically uses **`@<agent-id>`** or the host’s subagent entry — same **no tool = no dispatch** rule.
23
+
24
+ ## Prepare phase — serial roles still require invoke
25
+
26
+ `mstar-roles` **project-manager** may route `@explore → @product-manager → @architect` **sequentially**. Each handoff still needs a real **host invoke** with Assignment (often **`N = 1`** per dispatch turn). Writing PRD / architecture only in the PM chat when routing assigns **`product-manager`** or **`architect`** is **not** a substitute. Cross-check: `mstar-roles` → `references/project-manager.md` → **§1.1.1a Phase routing pre-flight**.
27
+
28
+ ## Gotchas
29
+
30
+ - `question` availability is config-dependent; if unavailable, structured Markdown clarify.
31
+ - `@explore` is orientation only, not role-owned implementation or review deliverables.
32
+ - More MCPs do not replace phase gates or evidence rules.
33
+
34
+ ## Session noise control
35
+
36
+ - Large unrelated platform injections (e.g. long ecosystem prompts): prefer on-demand / `alwaysApply: false` when not stack-relevant.
37
+ - One default channel per capability class (search, docs).
38
+
39
+ ## Optional MCPs / skills (user-enabled)
40
+
41
+ Aligned with `mstar-harness-core` `references/open-harness-principles.md`. Editing global `opencode.json` requires explicit user consent.
42
+
43
+ | Capability | Purpose | Notes |
44
+ |------|------|------|
45
+ | **Current docs** | Versioned API/libs | Context7-like MCP or equivalent |
46
+ | **Web search** | Time-sensitive / migrations | Avoid duplicate search MCPs |
47
+ | **Code pattern search** | Cross-repo references | e.g. grep.app MCP |
48
+ | **Repo graph** | Impact / PR risk | e.g. GitNexus |
49
+ | **Browser / E2E** | Observable QA evidence | agent-browser, Playwright |
50
+ | **Git workflow** | Atomic commits, branch closure | git-commit, finishing-a-development-branch |
51
+ | **Systematic debugging** | RCA before fix | `mstar-superpowers-align` |
52
+ | **OpenViking memory** | Long-term memory tools | Only if `memsearch` present; `openviking-memory-plugin.md` |
53
+
54
+ **Not recommended**: overlapping search MCPs; extra tools to mask missing harness baseline.
55
+
56
+ ## Maintenance boundary
57
+
58
+ Runtime only — do not modify `opencode.json`, `secrets.env`, or `.secrets/*` without explicit user consent.
@@ -0,0 +1,42 @@
1
+ # Parallel dispatch (invoke-capable hosts)
2
+
3
+ Shared PM dispatch contract for **any** host that uses subagent / Task / named-role invoke (OpenCode, Cursor Task, Codex only when a callable multi-agent / Task tool is actually available). Process SSOT also in `mstar-dispatch-gates`.
4
+
5
+ If the active host has no callable invoke tool, this reference does not create delegation capability: use single-session execution, multi-window handoff, or mark dispatch `Blocked`.
6
+
7
+ ## Paste-only failure
8
+
9
+ Printing `## Assignment` in the main thread **without** matching host invocations is **not** delegation; downstream work **does not start**. Parallel dispatch makes this worse (N Assignments printed, zero invokes).
10
+
11
+ ## Prerequisite vs dispatch turn
12
+
13
+ - **Prerequisite turn** (optional): `bash` / `read` / `glob` / `grep` to collect facts (`merge-base`, `Review range`, `git rev-parse`, paths). **Do not** emit **any** batch dispatch in this message unless `N = 1` and that single call *is* the dispatch.
14
+ - **Dispatch turn** (when `N ≥ 2`): the **first** message that emits **any** dispatch for the batch must contain **all `N`** invocations. If not ready for all `N`, emit **zero** dispatches — finish prep, then one message with **`N`** calls.
15
+
16
+ ## Mandatory order (dispatch turn)
17
+
18
+ 1. Finalize all `N` Assignment payloads (after any prerequisite turn).
19
+ 2. Count distinct `Execute as` sessions (`N`).
20
+ 3. Issue **`N` host invocations first** (subagent / Task / `@agent-id`), each with one Assignment body. For parallel work, **all `N` tool calls in one assistant message** when the host allows.
21
+ 4. Optionally post a short **Status Update** after invocations (audit trail only — does not replace step 3).
22
+
23
+ ## Hard rules
24
+
25
+ - **Emit zero until batch-ready**: if `N ≥ 2` and only one invoke is possible now, **do not** send that one; complete payloads, then **`N` in one message**.
26
+ - Do not end the dispatch turn until **`N` invocations emitted**, or mark `Blocked` / `dispatch incomplete`.
27
+ - Dual-track implement: **`N = 2` ⇒ two invocations in one message** when parallel is required.
28
+ - Status Update on dispatch turns: **`Subagent invokes issued: N`** (must match Assignment count). If Assignments were written but `N = 0` → **`dispatch failed — paste-only`**; fix next message.
29
+
30
+ ## QC tri-review
31
+
32
+ - Launch `qc-specialist`, `qc-specialist-2`, `qc-specialist-3` in **one** dispatch turn (**3** invocations, one message).
33
+ - Do not claim parallel QC unless all three were issued in that turn.
34
+ - Post-dispatch: verify three distinct agent IDs and intended model mapping; on mismatch → invalid dispatch, re-dispatch before consolidation.
35
+
36
+ ## Self-check before send
37
+
38
+ 1. Required assignments this turn? (`N`)
39
+ 2. Prerequisite-only message? → **zero** batch dispatches unless `N = 1`.
40
+ 3. Dispatch message contains **exactly `N`** invocation calls?
41
+ 4. QC tri-review → **exactly 3** in one dispatch message?
42
+ 5. Previous message was prerequisite-only → this message must include **all `N`** (not “QC1 first”).
@@ -3,29 +3,30 @@ name: mstar-plan-artifacts
3
3
  description: Morning Star plan harness artifacts — `{PLAN_DIR}` main plans and `reports/`, `{KNOWLEDGE_DIR}` / `{ITERATION_DIR}` indexes, Done compaction, plus `{HARNESS_DIR}/status.json` and root `residual_findings` (severity SSOT, open/archived lifecycle, `notes.json`). Read when writing plans or QC reports, maintaining knowledge/iteration indexes, reading or writing `status.json` / R#, Done compaction, or mapping QC severity to JSON. Required for `@project-manager` on status, residuals, and InReview/QC waves; `@qc-specialist*` before `reports/**/*.md`; `@qa-engineer` before closing R#. Verdict rules in `mstar-review-qc`; paths in `mstar-plan-conventions`.
4
4
  ---
5
5
 
6
- ## Load order(必读顺序)
6
+ ## Load order
7
7
 
8
- **首次 Read skill 前:必须先 Read `mstar-harness-core`(SKILL.md),并按需 Read `mstar-plan-conventions`(路径符号)。** 涉及 Git 分支 / worktree / QC 检出 → **`mstar-branch-worktree`**。冲突时 **以 `mstar-harness-core` 为准**。
8
+ **Before first Read of this skill: Read `mstar-harness-core` (SKILL.md), and `mstar-plan-conventions` when path symbols matter.** Git branch / worktree / QC checkout → **`mstar-branch-worktree`**. On conflict, **`mstar-harness-core` wins**.
9
9
 
10
- ## Scopeplan 目录工件)
10
+ ## Scope (plan directory artifacts)
11
11
 
12
- | Topic | 详见 |
13
- |-------|------|
14
- | planreports 命名、QC 波次、residual plan 索引顺序 | `references/plan-files-and-reports.md` |
15
- | knowledge / iterations / specs 边界与索引 | `references/knowledge-and-designs.md` |
16
- | Done 行瘦身 Profile A/B | `references/done-compaction.md` |
17
- | `status.json`、residual severity、生命周期、`jq` | `references/status-and-residuals.md` |
18
- | 空仓库 `status.json` / `notes.json` 模板 | `templates/status.empty.json`、`templates/notes.empty.json`(见 `templates/README.md`) |
12
+ | Topic | See |
13
+ |-------|-----|
14
+ | Main plan, reports naming, QC waves, residual and plan index order | `references/plan-files-and-reports.md` |
15
+ | knowledge / iterations / specs boundaries and indexes | `references/knowledge-and-designs.md` |
16
+ | Done row compaction Profile A/B | `references/done-compaction.md` |
17
+ | `status.json`, residual severity, lifecycle, `jq` | `references/status-and-residuals.md` |
18
+ | Empty-repo `status.json` / `notes.json` templates | `templates/status.empty.json`, `templates/notes.empty.json` (`templates/README.md`) |
19
+ | Tech-debt rollup (read-only) | `scripts/tech-debt-rollup.sh` |
19
20
 
20
- **Out of scope:** 分支与 QC/QA 检出对齐 → **`mstar-branch-worktree`**;QC 清单与 verdict → **`mstar-review-qc`**;`{HARNESS_DIR}` 路径发现与目录初始化步骤 → **`mstar-plan-conventions`**。
21
+ **Out of scope:** branch and QC/QA checkout alignment → **`mstar-branch-worktree`**; QC checklist and verdict → **`mstar-review-qc`**; `{HARNESS_DIR}` discovery and init → **`mstar-plan-conventions`**.
21
22
 
22
- ## `status.json` open residual(摘要)
23
+ ## `status.json` and open residual (summary)
23
24
 
24
- - **`{HARNESS_DIR}/status.json`**:`plans[]` 行状态 + 根级 **`residual_findings[<plan-id>]`**(open 列表 **SSOT**)。
25
- - **Canonical**:新登记只写根级 `residual_findings`;**`metadata.residual_findings`** legacy 读,**禁止**双写。
26
- - **生命周期**:open → 验证关闭 → **`archived/residuals/<plan-id>.json`**;**`severity`** 机器枚举见 reference
27
- - **`notes.json`**、**`tech_debt_summary`**(可选聚合视图)。
25
+ - **`{HARNESS_DIR}/status.json`**: `plans[]` row status + root **`residual_findings[<plan-id>]`** (open list **SSOT**).
26
+ - **Canonical**: register new findings only at root `residual_findings`; **`metadata.residual_findings`** is legacy read-only — **do not** dual-write.
27
+ - **Lifecycle**: open → verified close → **`archived/residuals/<plan-id>.json`**; machine **`severity`** enum in reference.
28
+ - **`notes.json`**, optional **`tech_debt_summary`** (rollup view; compute via **`scripts/tech-debt-rollup.sh`**).
28
29
 
29
- 字段、severity 映射表、归档与 `jq` 示例 → **`references/status-and-residuals.md`**。
30
+ Field semantics, severity mapping, archive flow, and `jq` examples → **`references/status-and-residuals.md`**.
30
31
 
31
- **Templates(本 skill):** `templates/status.empty.json`、`templates/notes.empty.json` — 复制到 `{HARNESS_DIR}/`(说明见 `templates/README.md`)。
32
+ **Templates (this skill):** `templates/status.empty.json`, `templates/notes.empty.json` — copy into `{HARNESS_DIR}/` (`templates/README.md`).