@mstar-harness/opencode 0.6.21 → 0.6.23

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 (26) hide show
  1. package/harness-commands/bootstrap.md +171 -0
  2. package/harness-commands/iteration-drive.md +42 -30
  3. package/harness-commands/iteration-start.md +11 -7
  4. package/harness-skills/mstar-compound/SKILL.md +251 -0
  5. package/harness-skills/mstar-compound/assets/resolution-template.md +94 -0
  6. package/harness-skills/mstar-compound/references/category-mapping.md +37 -0
  7. package/harness-skills/mstar-compound/references/concepts-vocabulary.md +44 -0
  8. package/harness-skills/mstar-compound/references/schema.yaml +122 -0
  9. package/harness-skills/mstar-compound-refresh/SKILL.md +128 -0
  10. package/harness-skills/mstar-dispatch-gates/SKILL.md +20 -8
  11. package/harness-skills/mstar-dispatch-gates/references/leaf-executor-checklist.md +6 -2
  12. package/harness-skills/mstar-harness-core/SKILL.md +13 -7
  13. package/harness-skills/mstar-iteration/SKILL.md +273 -0
  14. package/harness-skills/mstar-iteration/references/iteration-compass-template.md +96 -0
  15. package/harness-skills/mstar-phase-gates/SKILL.md +15 -3
  16. package/harness-skills/mstar-plan-artifacts/references/knowledge-and-designs.md +1 -0
  17. package/harness-skills/mstar-plan-conventions/SKILL.md +1 -0
  18. package/harness-skills/mstar-plan-conventions/references/artifact-storage-paths.md +46 -0
  19. package/harness-skills/mstar-review-qc/SKILL.md +9 -0
  20. package/harness-skills/mstar-review-qc/references/deep-review-personas.md +151 -0
  21. package/harness-skills/mstar-roles/SKILL.md +6 -2
  22. package/harness-skills/mstar-roles/references/project-manager/dispatch-and-assignment.md +17 -4
  23. package/harness-skills/mstar-roles/references/qc-specialist-shared.md +8 -3
  24. package/harness-skills/mstar-strategy/SKILL.md +128 -0
  25. package/harness-skills/pm/SKILL.md +10 -67
  26. package/package.json +1 -1
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: bootstrap
3
+ description: Bootstrap or refresh a project's knowledge scaffolding — distill STRATEGY.md, CONCEPTS.md, and baseline knowledge docs from the existing codebase and any docs. Use when a project has no knowledge infrastructure, stale/partial docs, or needs a fresh distillation.
4
+ agent: project-manager
5
+ ---
6
+
7
+ # Bootstrap Project Knowledge
8
+
9
+ Distill a coherent knowledge baseline from the current project — useful when the project has no `STRATEGY.md` / `CONCEPTS.md` / `{KNOWLEDGE_DIR}`, has partial or outdated ones, or has accumulated documentation debt.
10
+
11
+ **Goal**: produce a minimal, accurate, opinionated knowledge foundation that future iteration-start and plan-work can ground in.
12
+
13
+ ## Boot
14
+
15
+ 1. `mstar-harness-core`
16
+ 2. `mstar-roles` → `references/project-manager.md`
17
+ 3. `skills/pm/SKILL.md` → **§ Host entry** + **§ Boot**
18
+ 4. `mstar-plan-conventions`(路径符号)
19
+ 5. `mstar-strategy` → **§ STRATEGY.md structure** + **§ Creating STRATEGY.md**
20
+ 6. `mstar-compound` → **references/concepts-vocabulary.md**(CONCEPTS.md 规则)
21
+ 7. `mstar-compound-refresh` → **§ Core rules**(知识维护基线)
22
+
23
+ ## Phase 1: Survey — understand what exists
24
+
25
+ ### 1.1 Codebase scan
26
+
27
+ - Read `README.md` (if exists) to understand project purpose
28
+ - Read `AGENTS.md` / `CLAUDE.md` (if exists) for conventions and maintenance rules
29
+ - Glob for `**/package.json`, `**/pyproject.toml`, `**/go.mod`, `**/Cargo.toml` to identify tech stack
30
+ - Glob for `**/src/`, `**/lib/`, `**/app/` to identify module structure
31
+ - Scan top-level directory layout
32
+
33
+ ### 1.2 Existing knowledge inventory
34
+
35
+ Check what already exists and note its condition:
36
+
37
+ | Artifact | Check | Condition |
38
+ |----------|-------|-----------|
39
+ | `STRATEGY.md` | Exists? Is it current/accurate? | `absent` / `stale` / `partial` / `current` |
40
+ | `CONCEPTS.md` | Exists? Covers core domain nouns? | `absent` / `stale` / `partial` / `current` |
41
+ | `{KNOWLEDGE_DIR}/README.md` | Exists? Index populated? | `absent` / `empty` / `partial` / `current` |
42
+ | `{KNOWLEDGE_DIR}/**/*.md` | Any knowledge docs? Are they still accurate? | `none` / `few` / `some` / `many` |
43
+ | `{ITERATION_DIR}/README.md` | Exists? Any past iteration artifacts? | `absent` / `present` |
44
+ | `{SPECS_DIR}/` or `designs/` | Any specs or ADRs? | `absent` / `present` |
45
+ | `docs/` | Any architecture docs, design notes? | Count and note relevance |
46
+ | `{HARNESS_DIR}/status.json` | Exists? Any historical plans? | `absent` / `present` |
47
+
48
+ Report findings to the user: what exists, what's missing, what's stale.
49
+
50
+ ### 1.3 Deep read — extract knowledge from code
51
+
52
+ For each primary module / package identified in 1.1:
53
+
54
+ 1. Read the module's exported interface (public classes, functions, APIs)
55
+ 2. Read key configuration files (database schema, routes, middlewares)
56
+ 3. Identify recurring patterns: error handling style, dependency injection, ORM usage, auth flow
57
+ 4. Note any README or docstrings that describe domain concepts
58
+
59
+ **Output**: a mental model of the project's domain, architecture patterns, conventions, and tech choices.
60
+
61
+ ## Phase 2: Distill STRATEGY.md
62
+
63
+ Use `mstar-strategy` skill to produce `<repo-root>/STRATEGY.md`.
64
+
65
+ ### If STRATEGY.md is absent
66
+
67
+ 1. Gather context from Phase 1 survey
68
+ 2. Ask the user the 5 interview questions(`mstar-strategy` § Phase 2)
69
+ 3. Draft and review: keep each section 1-3 sentences
70
+
71
+ ### If STRATEGY.md exists but is stale/partial
72
+
73
+ 1. Present specific findings: "Section X contradicts current code / is outdated because Y changed"
74
+ 2. Ask whether to update in-place or rewrite
75
+ 3. Apply edits, keeping the Decision Log for historical context
76
+
77
+ ### If STRATEGY.md is current
78
+
79
+ Skip, note in report.
80
+
81
+ ## Phase 3: Seed CONCEPTS.md
82
+
83
+ Use `mstar-compound/references/concepts-vocabulary.md` rules to produce `<repo-root>/CONCEPTS.md`.
84
+
85
+ ### Identify core domain nouns
86
+
87
+ From the codebase survey and STRATEGY.md, extract terms that meet the qualifying bar:
88
+ - Its meaning in this project is precise enough that a new engineer would need it defined
89
+ - It is not general programming vocabulary
90
+
91
+ **Source areas** to scan:
92
+ - Database schema (table/column names that encode domain concepts)
93
+ - Core model/type definitions
94
+ - API endpoint naming patterns
95
+ - Entity relationship structure
96
+ - README / architecture docs
97
+ - STRATEGY.md domain terms
98
+
99
+ ### Write entries
100
+
101
+ Each entry: one-sentence definition + optional paragraph for behavioral rules.
102
+ - Cluster by domain relationship
103
+ - Add `*Avoid:*` aliases for retired synonyms
104
+ - No implementation specifics (file paths, class names)
105
+ - Add `## Flagged ambiguities` tail section if needed
106
+
107
+ ### If CONCEPTS.md already exists
108
+
109
+ Reconcile: keep valid entries, add newly discovered terms, update stale definitions. Do not duplicate.
110
+
111
+ ## Phase 4: Generate baseline knowledge docs
112
+
113
+ From the Phase 1 survey, identify patterns and conventions worth documenting as knowledge docs in `{KNOWLEDGE_DIR}/`.
114
+
115
+ ### Minimum docs to produce (if absent)
116
+
117
+ | Knowledge doc | Content source | Category |
118
+ |---------------|---------------|----------|
119
+ | **Architecture overview** | Module structure, tech stack, component interactions | `architecture-patterns/` |
120
+ | **Development conventions** | Linting, testing, commit format, code style from AGENTS.md / configs | `conventions/` |
121
+ | **Project setup** | Dependencies, environment setup, build/run commands | `developer-experience/` |
122
+ | **Key domain patterns** | ORM patterns, auth flow, error handling, API design | `best-practices/` |
123
+
124
+ Each doc follows the Knowledge track template (`mstar-compound/assets/resolution-template.md`).
125
+
126
+ ### What NOT to generate
127
+
128
+ - Do not guess implementation details you haven't verified from code
129
+ - Do not document general framework knowledge (e.g., "how to use React")
130
+ - Do not create docs for areas the user explicitly excludes
131
+
132
+ ### If knowledge docs already exist
133
+
134
+ Apply `mstar-compound-refresh` logic:
135
+ - Keep accurate docs
136
+ - Update stale references
137
+ - Consolidate overlapping docs
138
+ - Delete docs for code that no longer exists
139
+ - Add new docs only for genuinely undocumented patterns
140
+
141
+ ## Phase 5: Indexing & discoverability
142
+
143
+ 1. Create or update `{KNOWLEDGE_DIR}/README.md` index table
144
+ 2. Create or update `{ITERATION_DIR}/README.md` index table (if iteration artifacts exist)
145
+ 3. Check AGENTS.md references all knowledge artifacts:
146
+ - If missing `{HARNESS_DIR}/knowledge/` → propose adding
147
+ - If missing `STRATEGY.md` → propose adding
148
+ - If missing `CONCEPTS.md` → propose adding
149
+ 4. Ask for consent before editing AGENTS.md
150
+
151
+ ## Phase 6: Initialize harness (if absent)
152
+
153
+ If `{HARNESS_DIR}/` does not exist:
154
+ 1. Initialize per `mstar-plan-conventions`(`.mstar/` + subdirectories)
155
+ 2. Create empty `status.json` from template (`mstar-plan-artifacts/templates/status.empty.json`)
156
+
157
+ ## Phase 7: Commit
158
+
159
+ All bootstrap artifacts must be committed:
160
+
161
+ ```bash
162
+ git add STRATEGY.md CONCEPTS.md AGENTS.md {HARNESS_DIR}/ {KNOWLEDGE_DIR}/
163
+ git commit -m "chore: bootstrap project knowledge — STRATEGY.md, CONCEPTS.md, baseline knowledge docs"
164
+ ```
165
+
166
+ Report a summary:
167
+ - STRATEGY.md: created / updated / skipped
168
+ - CONCEPTS.md: created / updated(<N> entries)/ skipped
169
+ - Knowledge docs: <N> created, <N> updated, <N> deleted, <N> kept
170
+ - Harness: initialized / already existed
171
+ - AGENTS.md: updated / not modified
@@ -1,51 +1,63 @@
1
1
  ---
2
2
  name: iteration-drive
3
- description: Drive the active iteration to completion — run the PM Autonomous Execute loop (implement QC → QA → Done) until all plans are Done, then optionally create PR to target branch (default main)
3
+ description: Drive the active iteration to completion — run the Autonomous Execute loop (Phase 2 of mstar-iteration) until all plans are Done, then run iteration-close (Phase 3: compound + compass + roadmap update) on the integration branch, then create PR to target branch (default main)
4
4
  agent: project-manager
5
5
  ---
6
6
 
7
7
  # Drive Iteration
8
8
 
9
- Drive the active Morning Star iteration forward. Run the **Autonomous Execute driver** from `skills/pm/SKILL.md` (`§ Autonomous Execute driver`) to advance all non-`Done` plans to completion.
9
+ Drive the active Morning Star iteration forward. The canonical flow is in **`mstar-iteration`** this command loads it and executes its phases.
10
10
 
11
11
  ## Boot
12
12
 
13
13
  1. `mstar-harness-core`
14
14
  2. `mstar-roles` → `references/project-manager.md`
15
- 3. `skills/pm/SKILL.md` → focus on **§ When to activate autonomous Execute** and **§ Autonomous Execute driver**
16
- 4. `mstar-dispatch-gates` + host reference
17
- 5. `mstar-plan-artifacts`, `mstar-plan-conventions`, `mstar-branch-worktree`
18
-
19
- ## Precondition Gate
15
+ 3. `skills/pm/SKILL.md` → **§ Host entry** + **§ Boot**(PM role identity + dispatch-first rules)
16
+ 4. `mstar-iteration` → **§ Phase 2: Autonomous Execute**(per-plan dispatch loop)+ **§ Phase 3: iteration-close**(compound + compass)
17
+ 5. `mstar-dispatch-gates` + host reference
18
+ 6. `mstar-plan-artifacts`, `mstar-plan-conventions`, `mstar-branch-worktree`
19
+
20
+ ## Phase 2: Autonomous Execute
21
+
22
+ Execute **`mstar-iteration` § Phase 2** exactly. Summary:
23
+
24
+ 1. **Precondition gate** (§ 2.0) — three checks before entering
25
+ 2. **Session todos** (§ 2.1) — set host todos per plan wave
26
+ 3. **Read backlog** (§ 2.2) — `status.json` + `spec_integration_branch`
27
+ 4. **Integration branch** (§ 2.3) — checkout/create
28
+ 5. **Per-plan loop** (§ 2.4) — for each non-`Done` plan:
29
+ - Create plan feature branch from integration
30
+ - Dispatch implement subagents (dispatch-first)
31
+ - Update `status.json` + main plan after each Completion Report v2
32
+ - QC tri-review + QA per `mstar-review-qc`
33
+ - Merge plan branch → integration branch
34
+ - Cross-plan progress sync → compass
35
+ - Next plan
36
+ 6. Repeat until **all** plans `Done` → exit loop, enter Phase 3
20
37
 
21
- Check the three conditions from **§ When to activate autonomous Execute**:
38
+ **Dispatch-first constraint** 2.5): PM never implements directly; `1 Assignment ⇒ 1 invoke`.
22
39
 
23
- 1. `{HARNESS_DIR}/status.json` exists with at least one plan **not** `Done`
24
- 2. **Pre-implement gate = GO** (`plan` locked, tasks ready)
25
- 3. User intent is **continue Execute**
40
+ ## Phase 3: iteration-close
26
41
 
27
- If any is **false** → stop. If Prepare is incomplete tell the user to run `/iteration-start` first.
42
+ When every plan is `Done`, execute **`mstar-iteration` § Phase 3**:
28
43
 
29
- ## Execute Loop
44
+ 1. **前置检查** (§ 3.1) — all plans Done, residuals closed, compass synced
45
+ 2. **Compound 轮** (§ 3.2) — 收集素材 → 自检清单(Q1-Q8)→ `mstar-compound` → CONCEPTS.md
46
+ 3. **更新 compass** (§ 3.3-3.4) — status → completed, roadmap, compound summary, retrospective, index
47
+ 4. **Commit** to integration branch:
30
48
 
31
- Follow **§ Autonomous Execute driver** from the PM skill exactly:
49
+ ```bash
50
+ git add {ITERATION_DIR}/ {KNOWLEDGE_DIR}/ CONCEPTS.md
51
+ git commit -m "chore(iteration): close <iteration-id> — compound round, roadmap update"
52
+ git push origin <spec_integration_branch>
53
+ ```
32
54
 
33
- 1. **Session todos** — set host todos for current `plan_id` + next gates
34
- 2. **Read backlog** — `status.json`, active plans, `primary_spec` / `spec_integration_branch`
35
- 3. **Checkout integration branch** — resolve or create from `status.json` metadata
36
- 4. **Per-plan loop** — for each non-`Done` plan:
37
- - Create plan feature branch from integration branch
38
- - Dispatch implement subagents (dispatch-first, no parent agent implementation)
39
- - Update `status.json` + main plan after each Completion Report
40
- - QC tri-review + QA per `mstar-review-qc`
41
- - Merge plan branch → integration branch
42
- - Move to next plan
43
- 5. Repeat until **all** plans in the iteration are `Done`
55
+ ## Completion: Create PR
44
56
 
45
- ## Completion
57
+ All iteration-close changes committed to integration branch:
46
58
 
47
- When every plan is `Done` in `status.json`:
59
+ - Resolve PR target branch from `status.json` → `target_branch`(default `main`)
60
+ - Create PR from `spec_integration_branch` to target
61
+ - Report summary: plans completed, compound round(结晶文档数), target branch, PR link
48
62
 
49
- - Resolve the PR target branch from iteration metadata: `status.json` → `target_branch`. Default to `main` if not set.
50
- - Create a PR from `spec_integration_branch` to the resolved `target_branch`
51
- - Report a summary: plans completed, branch names, target branch, PR link
63
+ PR 合并后(babysit loop 或手动),本次迭代完整结束。
@@ -6,15 +6,16 @@ agent: project-manager
6
6
 
7
7
  # Start Iteration
8
8
 
9
- Start a new Morning Star harness iteration. Follow Prepare gates from `mstar-phase-gates` (specify → clarify → plan).
9
+ Start a new Morning Star harness iteration. Detailed workflow → **`mstar-iteration` § Phase 1: iteration-start**;per-plan Prepare gates **`mstar-phase-gates`**(specify → clarify → plan)。
10
10
 
11
11
  ## 0. Boot
12
12
 
13
13
  1. `mstar-harness-core`
14
14
  2. `mstar-roles` → `references/project-manager.md`
15
- 3. `skills/pm/SKILL.md` → **§ Host entry** (PM role identity) + **§ Boot** (load order)
16
- 4. `mstar-phase-gates` → Prepare (specify clarify → plan)
17
- 5. `mstar-plan-conventions`, `mstar-plan-artifacts`
15
+ 3. `skills/pm/SKILL.md` → **§ Host entry** + **§ Boot**
16
+ 4. `mstar-iteration` → **§ Phase 1: iteration-start**(迭代范围、compass 模板、状态初始化)
17
+ 5. `mstar-phase-gates` → Prepare(specify → clarify → plan
18
+ 6. `mstar-plan-conventions`, `mstar-plan-artifacts`
18
19
 
19
20
  ## 1. Research
20
21
 
@@ -35,6 +36,8 @@ Load harness entry, then survey structured and unstructured sources:
35
36
 
36
37
  Identify deferred or incomplete items from prior iterations as priority candidates for this iteration.
37
38
 
39
+ Also read `STRATEGY.md`(if exists)for strategic alignment.
40
+
38
41
  ## 2. Explore Directions
39
42
 
40
43
  Explore candidate directions targeting **product completeness**:
@@ -53,11 +56,12 @@ Run the **grill-me skill** to stress-test candidate directions with the user:
53
56
 
54
57
  ## 4. Write Compass & Plans
55
58
 
56
- Produce harness artifacts:
59
+ Produce harness artifacts per **`mstar-iteration` § 1.3 创建迭代 compass**(template: `mstar-iteration/references/iteration-compass-template.md`):
57
60
 
58
- - `{ITERATION_DIR}/<iteration-id>-compass.md` — iteration vision, scope, roadmap batches, deferred items
61
+ - `{ITERATION_DIR}/<iteration-id>-delivery-compass.md` — iteration scope, plans table, milestones, acceptance criteria, non-goals, roadmap position
59
62
  - `{PLAN_DIR}/<plan-id>-<name>.md` for each plan in this iteration
60
- - Register all plans in `{HARNESS_DIR}/status.json`
63
+ - Register all plans in `{HARNESS_DIR}/status.json`(per `mstar-plan-artifacts`)
64
+ - Update `{ITERATION_DIR}/README.md` index(per `mstar-iteration` § 1.4)
61
65
 
62
66
  ## 5. Review & Edit Chain
63
67
 
@@ -0,0 +1,251 @@
1
+ ---
2
+ name: mstar-compound
3
+ description: Morning Star 知识结晶 —— 将已解决问题的经验沉淀为结构化知识文档,存入 `{KNOWLEDGE_DIR}`。支持 Bug track(症状/失败尝试/解决方案)与 Knowledge track(上下文/指南/适用场景)双轨。含重叠检测(更新已有文档)、可发现性检查(AGENTS.md 索引)、CONCEPTS.md 领域词汇协同。触发:迭代收口时(`mstar-iteration` § iteration-close)批量执行;也可独立触发。产出:`{KNOWLEDGE_DIR}/<category>/<slug>.md` + 可选 AGENTS.md 更新。
4
+ ---
5
+
6
+ # mstar-compound(知识结晶)
7
+
8
+ ## Load order
9
+
10
+ **Read `mstar-harness-core` first.** Path symbols (`{KNOWLEDGE_DIR}`, `{HARNESS_DIR}`) → **`mstar-plan-conventions`**. On conflict, **`mstar-harness-core` wins**.
11
+
12
+ ## Purpose
13
+
14
+ After solving a non-trivial problem, `mstar-compound` captures the learning as a structured document in `{KNOWLEDGE_DIR}`, so future plan research, debugging, and implementation can find and reuse it.
15
+
16
+ **In the mstar lifecycle**, compound is triggered at iteration-close (`mstar-iteration` § Phase 3), not per-plan Done. It can also be invoked standalone for ad-hoc captures outside formal iterations.
17
+
18
+ Knowledge that isn't captured evaporates when the session ends. Knowledge that is captured but not discoverable is equally lost. This skill addresses both.
19
+
20
+ ## 产物存储位置
21
+
22
+ **SSOT**: `mstar-plan-conventions/references/artifact-storage-paths.md`。本 skill 不重定义路径;知识文档 → `{HARNESS_DIR}/knowledge/<category>/<slug>.md`,CONCEPTS.md → `<repo-root>/CONCEPTS.md`。`<category>` 取值见 `references/category-mapping.md`。
23
+
24
+ ## 是否值得结晶(自检清单 · 必须逐条回答)
25
+
26
+ 在调用本 skill 前,PM(或触发方)**必须**逐条回答以下问题。得分仅用于辅助决策,不替代判断。
27
+
28
+ ### 自检问题(每条回答 Yes / No / Not sure)
29
+
30
+ | # | 问题 | 说明 |
31
+ |---|------|------|
32
+ | Q1 | 这个问题的诊断过程耗时是否 ≥ 15 分钟(或 ≥ 3 次尝试)? | 若只是 1-2 次尝试就找到答案,可能太琐碎 |
33
+ | Q2 | 解决方案是否涉及**非显而易见**的知识(隐含假设、框架行为、workaround)? | 显而易见的知识无需文档化(如"少了个分号") |
34
+ | Q3 | 同一个开发者在未来遇到类似问题时,是否可能**再次花费相似的时间**来诊断? | 核心问题:知识能否复用? |
35
+ | Q4 | 问题的**根因**是否是项目特定的(不是通用语言/框架问题)? | 通用问题可搜索到,项目特定问题必须自己记录 |
36
+ | Q5 | `{KNOWLEDGE_DIR}` 中是否**已有**与此高度重叠的文档? | 若有 → 更新已有文档,不新建(见 Phase 2 重叠检测) |
37
+ | Q6 | 此解决方案是否可能**引导未来架构决策**或成为约定? | Knowledge track 的典型触发条件 |
38
+ | Q7 | 此解决方案中的"**什么没起作用**"部分是否有价值? | 失败的尝试往往是最有教学价值的部分 |
39
+ | Q8 | 问题是否涉及** ≥ 2 个模块/组件**的交互? | 跨模块问题最难排查,最值得记录 |
40
+
41
+ ### 决策矩阵
42
+
43
+ | 得分 | 行动 |
44
+ |------|------|
45
+ | **Yes ≥ 4**(含 Q5=No) | **强烈建议结晶**。执行完整 Phase 1-7。 |
46
+ | **Yes = 3** | **建议结晶**。使用 Lightweight 模式(Phase 1 单遍)。 |
47
+ | **Yes ≤ 2** | **跳过**。在 conversation/Completion Report 中注明"跳过结晶(<简述原因>)"。 |
48
+ | **Q5 = Yes(高重叠)** | 无论其它得分如何,**不要新建**。执行 Phase 2 重叠检测,更新已有文档即可。 |
49
+ | **任一 Not sure** | 倾向于回答者的默认判断。若 Q1-Q4 有 ≥ 2 个 Yes,仍建议结晶。 |
50
+
51
+ ### 示例判定
52
+
53
+ ```
54
+ Q1: Yes — debug 了 40 分钟
55
+ Q2: Yes — ActiveRecord 的 counter_cache 在 after_destroy 回调中的时序问题
56
+ Q3: Yes — 下次遇到类似时序问题仍会踩坑
57
+ Q4: Yes — 是项目特有 model 结构导致的
58
+ Q5: No — grep 了 knowledge/ 无匹配
59
+ Q6: No — 纯 bug 修复
60
+ Q7: Yes — 第一次尝试了手动更新 counter 导致数据不一致
61
+ Q8: No — 只涉及一个 model
62
+ → Yes = 5 → 强烈建议结晶(Bug track)
63
+ ```
64
+
65
+ ## Integration with mstar lifecycle
66
+
67
+ Compound 在迭代收口时触发(`mstar-iteration` § iteration-close),不在 per-plan Done 后单独执行:
68
+
69
+ ```
70
+ iteration-start → [plan lifecycle × N: specify→...→Done] → iteration-close
71
+
72
+ mstar-compound
73
+ (per-iteration round)
74
+
75
+ {KNOWLEDGE_DIR}
76
+
77
+ feeds back into next iteration's specify / plan
78
+ ```
79
+
80
+ 迭代内所有 plan Done 后,PM 回顾整轮迭代中产生的可结晶知识,批量 compound。per-plan Done 是 per-plan 的闭环终点;compound 是迭代级收口活动。
81
+
82
+ ## When to use (trigger)
83
+
84
+ - **迭代收口时**(`mstar-iteration` § iteration-close):PM 批量回顾所有 plan 的产物
85
+ - **独立触发**(非迭代模式或紧急情况):任何非平凡问题解决后,PM 或开发者手动触发
86
+ - **Debug 后**:`mstar-iteration` 尚未启用时,重大 bug 修复后手动触发
87
+
88
+ ### Skip when
89
+
90
+ - 自检清单判定 ≤ 2 个 Yes
91
+ - Q5 高重叠(应更新已有文档而非新建)
92
+ - 纯机械性工作:格式化、依赖升级、typo 修复
93
+ - 问题仍在进行中或方案未经验证
94
+
95
+ ## Two tracks
96
+
97
+ The skill classifies work into one of two tracks based on problem type:
98
+
99
+ | Track | What it captures | Section structure |
100
+ |-------|-----------------|-------------------|
101
+ | **Bug** | Incident-level fix — "X broke, here's why and how we fixed it" | Problem, Symptoms, What Didn't Work, Solution, Why This Works, Prevention |
102
+ | **Knowledge** | Durable guidance — "this is how we do X, and why" | Context, Guidance, Why This Matters, When to Apply, Examples |
103
+
104
+ Track is determined by `problem_type`. See `references/category-mapping.md` for the full mapping.
105
+
106
+ ## Execution modes
107
+
108
+ | Mode | When | Behavior |
109
+ |------|------|----------|
110
+ | **Full** (default) | Most cases | Dispatches research subagents for context analysis, solution extraction, and overlap detection |
111
+ | **Lightweight** | Simple fixes, context-tight sessions | Single-pass documentation, no subagents, faster |
112
+
113
+ In Cursor, Full mode dispatches subagents via Task tool. PM selects mode.
114
+
115
+ ## Phase 1: Gather context
116
+
117
+ Read the conversation history to understand:
118
+ - What problem was solved (the concrete issue)
119
+ - What was tried and didn't work
120
+ - What the working solution was
121
+ - Why the solution works (root cause)
122
+ - Which files/modules were involved
123
+ - The plan_id if applicable (link to `status.json`)
124
+
125
+ If `{KNOWLEDGE_DIR}/README.md` exists, scan its index for related existing documents.
126
+
127
+ Classify the problem into a track (bug vs knowledge) and category using `references/category-mapping.md`.
128
+
129
+ ## Phase 2: Overlap detection
130
+
131
+ Before creating a new doc, check if an existing doc covers the same ground:
132
+
133
+ 1. Extract keywords from the problem (module names, error messages, technical terms)
134
+ 2. Search `{KNOWLEDGE_DIR}/**/*.md` using frontmatter fields (`module:`, `tags:`, `problem_type:`)
135
+ 3. Score overlap across dimensions: problem statement, root cause, solution approach, referenced files, prevention
136
+
137
+ | Overlap | Action |
138
+ |---------|--------|
139
+ | **High** (4-5 dimensions match) | **Update** the existing doc with fresher context instead of creating a new one. Add `last_updated` field. |
140
+ | **Moderate** (2-3 dimensions match) | Create new doc; flag for consolidation review (potential `mstar-compound-refresh` trigger) |
141
+ | **Low/None** | Create new doc normally |
142
+
143
+ ## Phase 3: Write the document
144
+
145
+ ### 3.1 Determine path
146
+
147
+ Category → directory under `{KNOWLEDGE_DIR}/`. Examples:
148
+ - Bug track: `build-errors/`, `runtime-errors/`, `performance-issues/`, `database-issues/`, `security-issues/`, `integration-issues/`
149
+ - Knowledge track: `architecture-patterns/`, `design-patterns/`, `conventions/`, `workflow-patterns/`, `tooling-decisions/`, `best-practices/`
150
+
151
+ Filename: `<sanitized-slug>.md` (lowercase, hyphen-separated, no date prefix).
152
+
153
+ ### 3.2 Frontmatter
154
+
155
+ Required fields for both tracks (SSOT: `references/schema.yaml`):
156
+
157
+ ```yaml
158
+ ---
159
+ module: <area>
160
+ date: YYYY-MM-DD
161
+ problem_type: <enum value>
162
+ category: <directory name>
163
+ severity: critical|high|medium|low
164
+ plan_id: <optional, link to status.json>
165
+ tags: [<keywords>]
166
+ ---
167
+ ```
168
+
169
+ Bug-track adds: `symptoms`, `root_cause`, `resolution_type`.
170
+ Knowledge-track adds: `applies_when` (optional).
171
+
172
+ ### 3.3 Body
173
+
174
+ Follow the section structure from `assets/resolution-template.md` for the determined track.
175
+
176
+ ### 3.4 Validate
177
+
178
+ After writing, validate the YAML frontmatter:
179
+ - `---` delimiters are correct
180
+ - All required fields present
181
+ - Enum values match allowed values
182
+ - `date` is YYYY-MM-DD format
183
+ - Array fields use `[item1, item2]` syntax
184
+
185
+ ## Phase 4: Discoverability check
186
+
187
+ Check whether the project's `AGENTS.md` or `CLAUDE.md` would lead a future agent to discover `{KNOWLEDGE_DIR}`.
188
+
189
+ If `{KNOWLEDGE_DIR}` is not mentioned in the root instruction file, propose the smallest addition that surfaces the knowledge store. Example:
190
+
191
+ ```markdown
192
+ - `{HARNESS_DIR}/knowledge/` — captured solutions and reusable patterns
193
+ ```
194
+
195
+ Ask for user consent before applying (PM can approve). If the user declines, the doc is still written — only the discoverability edit is skipped.
196
+
197
+ ## Phase 5: CONCEPTS.md synergy
198
+
199
+ If the captured learning introduces or clarifies a domain term whose meaning is project-specific and not obvious to a newcomer, propose adding it to `CONCEPTS.md` at the repo root.
200
+
201
+ Read `references/concepts-vocabulary.md` for inclusion rules. Only propose when the term meets the qualifying bar:
202
+ - Its meaning in this project is precise enough that a new engineer would need it defined
203
+ - It is not general programming vocabulary
204
+
205
+ If `CONCEPTS.md` doesn't exist yet, ask whether to seed it. A seed populates the core domain nouns of the area the learning touches; a full repo-wide bootstrap is the job of `mstar-compound-refresh`.
206
+
207
+ ## Phase 6: Update indexes
208
+
209
+ 1. Add a row to `{KNOWLEDGE_DIR}/README.md` index table (create if missing):
210
+ - Document (link), Source Plan (`plan_id`), Description, Status (`Active`)
211
+
212
+ 2. If `plan_id` was provided, optionally update `status.json` metadata to reference this doc under `knowledge_refs`.
213
+
214
+ ## Phase 7: Refresh trigger
215
+
216
+ After capturing, check if the new learning suggests an older doc may now be stale (contradicted, superseded, or in a refactored domain). If so, recommend:
217
+
218
+ ```
219
+ Consider: /pm compound-refresh <scope hint>
220
+ ```
221
+
222
+ Do not automatically run refresh — only flag when there's a concrete reason.
223
+
224
+ ## CONCEPTS.md bootstrap requests
225
+
226
+ If invoked specifically to create CONCEPTS.md from scratch (not to document a solved problem), redirect to `mstar-compound-refresh` (which handles full repo-wide vocabulary bootstrapping). `mstar-compound` only seeds vocabulary as a side effect of capturing a real learning.
227
+
228
+ ## Support files
229
+
230
+ Read on demand at the step that needs them:
231
+
232
+ - `references/schema.yaml` — canonical frontmatter schema (Phase 3)
233
+ - `references/category-mapping.md` — problem_type → directory + track mapping (Phase 1)
234
+ - `references/concepts-vocabulary.md` — CONCEPTS.md rules (Phase 5)
235
+ - `assets/resolution-template.md` — section structure per track (Phase 3)
236
+
237
+ ## Skill dependencies
238
+
239
+ This skill integrates with:
240
+ - **`mstar-plan-conventions`** — path symbols (`{KNOWLEDGE_DIR}`, `{HARNESS_DIR}`)
241
+ - **`mstar-plan-artifacts`** — `status.json` linking, index maintenance
242
+ - **`mstar-compound-refresh`** — for knowledge maintenance after capture
243
+
244
+ ## NOT to do
245
+
246
+ - Do not create a doc for trivial fixes (typos, formatting, dep bumps)
247
+ - Do not write the doc before the solution is verified
248
+ - Do not skip the overlap check — creating duplicates degrades the knowledge store
249
+ - Do not edit AGENTS.md without user consent
250
+ - Do not create CONCEPTS.md entries for general programming vocabulary
251
+ - Do not modify product code — this skill writes documentation only
@@ -0,0 +1,94 @@
1
+ # Resolution templates for mstar-compound
2
+
3
+ ## Bug track template
4
+
5
+ ```markdown
6
+ ---
7
+ module: <area>
8
+ date: YYYY-MM-DD
9
+ problem_type: <enum>
10
+ category: <directory>
11
+ severity: <critical|high|medium|low>
12
+ symptoms: ["<symptom 1>", "<symptom 2>"]
13
+ root_cause: <fundamental cause>
14
+ resolution_type: <enum>
15
+ tags: [<keyword1>, <keyword2>]
16
+ ---
17
+
18
+ # <Title>
19
+
20
+ ## Problem
21
+ <1-2 sentence description of the issue>
22
+
23
+ ## Symptoms
24
+ - <Observable symptom 1>
25
+ - <Observable symptom 2>
26
+
27
+ ## What Didn't Work
28
+ - <Failed approach 1>: <why it failed>
29
+ - <Failed approach 2>: <why it failed>
30
+
31
+ ## Solution
32
+ <The actual fix with code examples when applicable>
33
+
34
+ ```lang
35
+ // Before
36
+ <broken code>
37
+
38
+ // After
39
+ <fixed code>
40
+ ```
41
+
42
+ ## Why This Works
43
+ <Root cause explanation and why the solution addresses it>
44
+
45
+ ## Prevention
46
+ - <Strategy 1 to avoid recurrence>
47
+ - <Strategy 2>
48
+ - <Test case or lint rule if applicable>
49
+ ```
50
+
51
+ ## Knowledge track template
52
+
53
+ ```markdown
54
+ ---
55
+ module: <area>
56
+ date: YYYY-MM-DD
57
+ problem_type: <enum>
58
+ category: <directory>
59
+ severity: <critical|high|medium|low>
60
+ applies_when: ["<condition 1>", "<condition 2>"]
61
+ tags: [<keyword1>, <keyword2>]
62
+ ---
63
+
64
+ # <Title>
65
+
66
+ ## Context
67
+ <What situation, gap, or friction prompted this guidance>
68
+
69
+ ## Guidance
70
+ <The practice, pattern, or recommendation>
71
+
72
+ ```lang
73
+ // Example of the pattern
74
+ <code>
75
+ ```
76
+
77
+ ## Why This Matters
78
+ <Rationale and impact of following or not following this guidance>
79
+
80
+ ## When to Apply
81
+ - <Condition or situation 1>
82
+ - <Condition or situation 2>
83
+
84
+ ## Examples
85
+ ### Before
86
+ ```lang
87
+ <code before>
88
+ ```
89
+
90
+ ### After
91
+ ```lang
92
+ <code after>
93
+ ```
94
+ ```