@mstar-harness/dsh 2.1.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 (146) hide show
  1. package/README.i18n.yaml +7 -0
  2. package/README.md +448 -0
  3. package/README.zh.md +221 -0
  4. package/bundle/README.md +312 -0
  5. package/bundle/cordis.patch.yml +17 -0
  6. package/dist/client/index.d.ts +14 -0
  7. package/dist/client/panel/PanelView.d.ts +67 -0
  8. package/dist/client/panel/TabNav.d.ts +28 -0
  9. package/dist/client/panel/graph/event-log.d.ts +76 -0
  10. package/dist/client/panel/graph/project-graph.d.ts +499 -0
  11. package/dist/client/panel/graph/schema.d.ts +224 -0
  12. package/dist/client/panel/guards.d.ts +12 -0
  13. package/dist/client/panel/locale.d.ts +134 -0
  14. package/dist/client/panel/pages/AgentCanvasPage.d.ts +363 -0
  15. package/dist/client/panel/pages/EventLogPage.d.ts +48 -0
  16. package/dist/client/panel/pages/IterationInfoSection.d.ts +80 -0
  17. package/dist/client/panel/pages/IterationTaskPage.d.ts +37 -0
  18. package/dist/client/panel/panel-meta.d.ts +18 -0
  19. package/dist/client/panel/plan-sort.d.ts +54 -0
  20. package/dist/client/panel/sidebar.d.ts +17 -0
  21. package/dist/client/panel/state-section.d.ts +23 -0
  22. package/dist/client/panel/use-mstar-engine-status.d.ts +42 -0
  23. package/dist/client/panel/zones/Legend.d.ts +18 -0
  24. package/dist/client/panel/zones/TaskBoard.d.ts +40 -0
  25. package/dist/client.d.ts +1 -0
  26. package/dist/client.js +4486 -0
  27. package/dist/gates/_shared.d.ts +198 -0
  28. package/dist/gates/adapter.d.ts +131 -0
  29. package/dist/gates/agent-flow.d.ts +320 -0
  30. package/dist/gates/catalog.d.ts +118 -0
  31. package/dist/gates/dispatch.d.ts +152 -0
  32. package/dist/gates/seams.d.ts +152 -0
  33. package/dist/gates/skill-lint.d.ts +87 -0
  34. package/dist/gates/status.d.ts +81 -0
  35. package/dist/gates/tools.d.ts +37 -0
  36. package/dist/index.d.ts +107 -0
  37. package/dist/index.js +5748 -0
  38. package/dist/invariant.d.ts +15 -0
  39. package/dist/invariant.js +29 -0
  40. package/dist/service.d.ts +96 -0
  41. package/dist/types.d.ts +241 -0
  42. package/harness-commands/codebase-audit.md +40 -0
  43. package/harness-commands/iteration-drive.md +129 -0
  44. package/harness-commands/iteration-loop.md +139 -0
  45. package/harness-commands/iteration-start.md +179 -0
  46. package/harness-skills/grill-me/SKILL.md +10 -0
  47. package/harness-skills/mstar-audit/SKILL.md +183 -0
  48. package/harness-skills/mstar-audit/references/audit-playbook.md +130 -0
  49. package/harness-skills/mstar-audit/references/finding-format.md +65 -0
  50. package/harness-skills/mstar-branch-worktree/SKILL.md +219 -0
  51. package/harness-skills/mstar-branch-worktree/references/parallel-writable-pre-dispatch.md +68 -0
  52. package/harness-skills/mstar-coding-behavior/SKILL.md +147 -0
  53. package/harness-skills/mstar-compound/SKILL.md +105 -0
  54. package/harness-skills/mstar-compound/assets/resolution-template.md +94 -0
  55. package/harness-skills/mstar-compound/references/category-mapping.md +37 -0
  56. package/harness-skills/mstar-compound/references/compound-workflow.md +155 -0
  57. package/harness-skills/mstar-compound/references/concepts-vocabulary.md +44 -0
  58. package/harness-skills/mstar-compound/references/schema.yaml +122 -0
  59. package/harness-skills/mstar-compound-refresh/SKILL.md +140 -0
  60. package/harness-skills/mstar-compound-refresh/references/project-knowledge-bootstrap.md +164 -0
  61. package/harness-skills/mstar-design-md/SKILL.md +142 -0
  62. package/harness-skills/mstar-design-md/references/completeness-checklist.md +181 -0
  63. package/harness-skills/mstar-design-md/references/design-md-spec.md +508 -0
  64. package/harness-skills/mstar-design-md/references/vercel-example.md +200 -0
  65. package/harness-skills/mstar-design-md/templates/DESIGN.dark.md.template +354 -0
  66. package/harness-skills/mstar-design-md/templates/DESIGN.md.template +474 -0
  67. package/harness-skills/mstar-dispatch-gates/SKILL.md +128 -0
  68. package/harness-skills/mstar-dispatch-gates/references/leaf-executor-checklist.md +23 -0
  69. package/harness-skills/mstar-harness-core/SKILL.md +180 -0
  70. package/harness-skills/mstar-host/SKILL.md +78 -0
  71. package/harness-skills/mstar-host/references/_shared/host-role-binding-core.md +51 -0
  72. package/harness-skills/mstar-host/references/_shared/plan-mode-bridge-core.md +91 -0
  73. package/harness-skills/mstar-host/references/codex.md +61 -0
  74. package/harness-skills/mstar-host/references/cursor-plan-mode-bridge.md +159 -0
  75. package/harness-skills/mstar-host/references/cursor.md +183 -0
  76. package/harness-skills/mstar-host/references/dsh.md +502 -0
  77. package/harness-skills/mstar-host/references/kimi-plan-mode-bridge.md +36 -0
  78. package/harness-skills/mstar-host/references/kimi.md +136 -0
  79. package/harness-skills/mstar-host/references/omp-plan-mode-bridge.md +32 -0
  80. package/harness-skills/mstar-host/references/omp.md +244 -0
  81. package/harness-skills/mstar-host/references/opencode.md +76 -0
  82. package/harness-skills/mstar-host/references/parallel-dispatch.md +68 -0
  83. package/harness-skills/mstar-host/references/zcode-plan-mode-bridge.md +36 -0
  84. package/harness-skills/mstar-host/references/zcode.md +129 -0
  85. package/harness-skills/mstar-iteration/SKILL.md +393 -0
  86. package/harness-skills/mstar-iteration/references/autonomous-direction-lock.md +90 -0
  87. package/harness-skills/mstar-iteration/references/iteration-artifact-boundaries.md +103 -0
  88. package/harness-skills/mstar-iteration/references/iteration-compass-template.md +142 -0
  89. package/harness-skills/mstar-iteration/references/iteration-corpus-hygiene.md +45 -0
  90. package/harness-skills/mstar-iteration/references/iteration-workspace-readme-template.md +27 -0
  91. package/harness-skills/mstar-iteration/references/phase-2-worktree-lease.md +193 -0
  92. package/harness-skills/mstar-iteration/references/phase-3-iteration-close.md +95 -0
  93. package/harness-skills/mstar-iteration/references/phase-4-5-pr-delivery.md +84 -0
  94. package/harness-skills/mstar-iteration/references/phase5-helper-discovery.md +24 -0
  95. package/harness-skills/mstar-phase-gates/SKILL.md +112 -0
  96. package/harness-skills/mstar-plan-artifacts/SKILL.md +46 -0
  97. package/harness-skills/mstar-plan-artifacts/references/done-compaction.md +88 -0
  98. package/harness-skills/mstar-plan-artifacts/references/knowledge-and-designs.md +100 -0
  99. package/harness-skills/mstar-plan-artifacts/references/plan-files-and-reports.md +99 -0
  100. package/harness-skills/mstar-plan-artifacts/references/plan-quality-bar.md +99 -0
  101. package/harness-skills/mstar-plan-artifacts/references/status-and-residuals.md +570 -0
  102. package/harness-skills/mstar-plan-artifacts/templates/README.md +9 -0
  103. package/harness-skills/mstar-plan-artifacts/templates/notes.empty.json +5 -0
  104. package/harness-skills/mstar-plan-artifacts/templates/plan.main.md +54 -0
  105. package/harness-skills/mstar-plan-artifacts/templates/plans-done.empty.json +3 -0
  106. package/harness-skills/mstar-plan-artifacts/templates/status.empty.json +7 -0
  107. package/harness-skills/mstar-plan-conventions/SKILL.md +165 -0
  108. package/harness-skills/mstar-plan-conventions/references/artifact-storage-paths.md +50 -0
  109. package/harness-skills/mstar-plan-conventions/references/effort-estimation.md +38 -0
  110. package/harness-skills/mstar-plan-conventions/references/harness-bootstrap-and-agents-layering.md +93 -0
  111. package/harness-skills/mstar-review-qc/SKILL.md +60 -0
  112. package/harness-skills/mstar-review-qc/references/review-responsibility-boundaries.md +54 -0
  113. package/harness-skills/mstar-roles/SKILL.md +86 -0
  114. package/harness-skills/mstar-roles/references/_shared/leaf-executor-core.md +46 -0
  115. package/harness-skills/mstar-roles/references/architect.md +114 -0
  116. package/harness-skills/mstar-roles/references/code-reviewer.md +109 -0
  117. package/harness-skills/mstar-roles/references/frontend-dev.md +70 -0
  118. package/harness-skills/mstar-roles/references/fullstack-dev-shared.md +89 -0
  119. package/harness-skills/mstar-roles/references/ops-engineer.md +78 -0
  120. package/harness-skills/mstar-roles/references/product-manager.md +107 -0
  121. package/harness-skills/mstar-roles/references/project-manager/dispatch-and-assignment.md +198 -0
  122. package/harness-skills/mstar-roles/references/project-manager/plan-management.md +61 -0
  123. package/harness-skills/mstar-roles/references/project-manager/qa-trigger-matrix.md +56 -0
  124. package/harness-skills/mstar-roles/references/project-manager/qc-and-residuals.md +98 -0
  125. package/harness-skills/mstar-roles/references/project-manager/routing-and-dev-allocation.md +99 -0
  126. package/harness-skills/mstar-roles/references/project-manager.md +310 -0
  127. package/harness-skills/mstar-roles/references/prompt-engineer.md +71 -0
  128. package/harness-skills/mstar-roles/references/qa-engineer/acceptance-gate.md +62 -0
  129. package/harness-skills/mstar-roles/references/qa-engineer.md +79 -0
  130. package/harness-skills/mstar-roles/references/qc-specialist/deep-review-lenses.md +95 -0
  131. package/harness-skills/mstar-roles/references/qc-specialist/report-template.md +72 -0
  132. package/harness-skills/mstar-roles/references/qc-specialist/reviewer-checklist.md +44 -0
  133. package/harness-skills/mstar-roles/references/qc-specialist/reviewer-workflow.md +57 -0
  134. package/harness-skills/mstar-roles/references/qc-specialist-shared.md +128 -0
  135. package/harness-skills/mstar-roles/references/writing-specialist.md +59 -0
  136. package/harness-skills/mstar-sdd/SKILL.md +133 -0
  137. package/harness-skills/mstar-sdd/references/file-handoffs.md +83 -0
  138. package/harness-skills/mstar-sdd/references/implementer-continuation-prompt.md +44 -0
  139. package/harness-skills/mstar-sdd/references/implementer-prompt.md +56 -0
  140. package/harness-skills/mstar-sdd/references/sticky-implementer-session.md +103 -0
  141. package/harness-skills/mstar-sdd/references/task-reviewer-prompt.md +53 -0
  142. package/harness-skills/mstar-skill-authoring/SKILL.md +162 -0
  143. package/harness-skills/mstar-skill-authoring/references/skillsbench-authoring.md +117 -0
  144. package/harness-skills/mstar-strategy/SKILL.md +130 -0
  145. package/harness-skills/pm/SKILL.md +40 -0
  146. package/package.json +92 -0
@@ -0,0 +1,570 @@
1
+ # `{HARNESS_DIR}/status.json` and Residual Findings (Morning Star)
2
+
3
+ > **Load order (same as other `mstar-*` skills):** Before changing SSOT / residual fields using this reference, Read **`mstar-harness-core`** (SKILL.md; same-repo branches and worktrees → **`mstar-branch-worktree`**). On conflict, **`mstar-harness-core` wins**; skill index in that SKILL.md.
4
+
5
+ `status.json` lives at **`{HARNESS_DIR}/status.json`**. It is the **single source of truth (SSOT)** for **`plans[]` row status** and **open residual findings**.
6
+ Canonical vs legacy residual definitions → **`mstar-plan-artifacts` SKILL.md** (“`status.json` and open residual (summary)”); this file covers **fields, severity, lifecycle, archive, and `jq` examples**.
7
+ **Closed** residuals should not accumulate here long-term; authoritative archive → **`{HARNESS_DIR}/archived/residuals/<plan-id>.json`** (see “Residual findings lifecycle”).
8
+
9
+ **Why this matters:** Within a working copy, the open list in `status.json` and `archived/residuals/` are the **local session SSOT** for risk and decisions. Non-blocking conclusions that stay only in chat or a gitignored review bundle **without local SSOT update** cannot be inherited reliably in that session; `Done` drifts from visible known debt. **`@project-manager`** should register trackable open items soon after review closure; close/archive after verification per **`QA gate`** (`qa-engineer` when `mandatory`, else PM acceptance checklist).
10
+
11
+ **Cross-clone handoff** (default git policy): tracked `{HARNESS_DIR}/AGENTS.md`, `{KNOWLEDGE_DIR}/**`, `{SPECS_DIR}/**`, and root `CONCEPTS.md` / `STRATEGY.md` when used. Residuals that must survive clone must be **promoted** (compound) or written into those tracked results — do not treat `status.json` / `plans/` as the default clone handoff surface.
12
+
13
+ ## Basic structure
14
+
15
+ ```json
16
+ {
17
+ "version": 1,
18
+ "updated_at": "YYYY-MM-DD",
19
+ "plans": [
20
+ {
21
+ "id": "plan-id",
22
+ "title": "Plan title",
23
+ "file": "{PLAN_DIR}/plan-id-feature-name.md",
24
+ "status": "Todo | InProgress | InReview | Blocked | Done",
25
+ "owner": "@project-manager",
26
+ "agents": ["@fullstack-dev"],
27
+ "progress": 0,
28
+ "tags": [],
29
+ "created_at": "YYYY-MM-DD",
30
+ "updated_at": "YYYY-MM-DD",
31
+ "done_at": null,
32
+ "notes": "",
33
+ "metadata": {}
34
+ }
35
+ ],
36
+ "residual_findings": {
37
+ "plan-id": [
38
+ {
39
+ "id": "R1",
40
+ "title": "Finding title",
41
+ "severity": "critical | high | medium | low | nit",
42
+ "source": "QC-#1 qc1.md F-001 @ <review-range>, QA qa.md, review, …",
43
+ "scope": "Affected file or component",
44
+ "decision": "defer | accept | risk-accepted",
45
+ "owner": "@fullstack-dev",
46
+ "target": "Before plan 02 / YYYY-MM-DD / milestone",
47
+ "tracking": "Issue URL or null",
48
+ "detail_doc": "{PLAN_DIR}/residuals/plan-id/R1-short-label.md"
49
+ }
50
+ ]
51
+ },
52
+ "metadata": {}
53
+ }
54
+ ```
55
+
56
+ **Empty-repo templates:** **`templates/status.empty.json`**; optional **`templates/notes.empty.json`** → `{HARNESS_DIR}/notes.json`. See **`templates/README.md`**.
57
+
58
+ **Closed entries** add: `lifecycle`, `closed_at`, `closure_note`; optional `closure_evidence`, `superseded_by`. See “Residual findings lifecycle”.
59
+
60
+ **Open `detail_doc` (optional):** repo-relative path under **`{PLAN_DIR}/residuals/<plan-id>/`** matching **`id`** (e.g. `R1`); omit if prose layer unused (`knowledge-and-designs.md`).
61
+
62
+ ## Residual findings: `severity` (SSOT, machine field)
63
+
64
+ Each `residual_findings[<plan-id>][]` entry’s **`severity`** must be from this enum (legacy read paths → **`jq` examples** at end). QC report Markdown **Critical / Warning / Suggestion** are **section titles** — **do not** copy them verbatim into JSON `severity`.
65
+
66
+ ### 1. Allowed values
67
+
68
+ Only these five, **lowercase English**:
69
+
70
+ `critical`, `high`, `medium`, `low`, `nit`
71
+
72
+ ### 2. Total order (heavy → light)
73
+
74
+ `critical` > `high` > `medium` > `low` > `nit`
75
+
76
+ - **`nit` is always lighter than `low`** — never invert or equate.
77
+ - **Forbidden** in JSON: `warning`, `Major`, non-English, or any value not listed.
78
+
79
+ ### 3. Meaning and gate relationship
80
+
81
+ | `severity` | Meaning |
82
+ | ---------- | ------- |
83
+ | `critical` | Merge-blocking; maps to QC **Critical** findings. |
84
+ | `high` | Not blocking but high impact (security, correctness, data, significant tech debt); fix, escalate, or open residual with PM follow-up. |
85
+ | `medium` | Should address this or next milestone; may be open residual. |
86
+ | `low` | Small impact, cheap fix; may be open residual. |
87
+ | `nit` | Style, naming, wording, non-behavior doc nits; **lighter than `low`**. PM may omit from `residual_findings` if no tracking needed. |
88
+
89
+ Summary vs `mstar-review-qc`: unresolved **`critical`** → usually `Request Changes`; **`high`** often “fix or explicit decision before merge”; **`medium` / `low` / `nit`** may ship with residual tracking (final **Verdict** = PM consolidation).
90
+
91
+ ### 4. QC report section → JSON `severity`
92
+
93
+ When registering into root **`residual_findings`** (template in `mstar-review-qc`):
94
+
95
+ | Report Findings section | JSON `severity` |
96
+ | ----------------------- | --------------- |
97
+ | **Critical** | Default `critical`. PM may record `high` if “not blocking this merge but follow up soon” — state reason in `title`/`scope`. |
98
+ | **Warning** | `high` or `medium`: security/correctness/data → `high`; other substantive non-blocking → `medium`; **when unsure, use `high`**. |
99
+ | **Suggestion** | `low` or `nit`: substantive improvement → `low`; pure style/optional → `nit`. |
100
+
101
+ **Common mistake:** report **Warning** is not a valid `severity` string; there is no `warning` in the enum (see legacy below).
102
+
103
+ ### 5. Legacy `"severity": "warning"`
104
+
105
+ In old JSON, **`"severity": "warning"`** is read and rolled up as **`low`**. **Forbidden** on new entries.
106
+
107
+ ---
108
+
109
+ ## Findings cleanup modes
110
+
111
+ Plan-level policy for whether non-blocking QC/QA findings may remain as open residuals or must be cleared in the current plan session.
112
+
113
+ ### Assignment + metadata
114
+
115
+ | Surface | Values |
116
+ | ------- | ------ |
117
+ | Assignment **`Findings cleanup`** | `zero-residual` \| `allow-residual` |
118
+ | `plans[].metadata.findings_cleanup` | same strings (optional mirror; Assignment wins when both set) |
119
+
120
+ **Defaults**
121
+
122
+ | Context | Default |
123
+ | ------- | ------- |
124
+ | Formal **iteration Phase 2** (Autonomous Execute) | `zero-residual` (compass or Assignment may override to `allow-residual`) |
125
+ | Standalone `/pm`, hotfix, `Execution mode: inline` | `allow-residual` |
126
+
127
+ ### `zero-residual` (clean-session)
128
+
129
+ Intent: clear findings in the current plan session whenever possible. Open residuals only for **true blocker-defers**.
130
+
131
+ 1. After QC: default path is **fix-now + targeted re-review**, not `Approve with residuals`.
132
+ 2. Do **not** register open R# for items that can be fixed in this session.
133
+ 3. **`nit`**: fix in-session **or** drop with no R# (existing “no tracking needed”); **never** open residual for style-only nits.
134
+ 4. **`Approve with residuals`** only when every remaining open item is a true blocker-defer (`decision: defer`, `target` = next iteration/milestone, Durable Roadmap Gate written).
135
+ 5. **True defer** only: external dependency; product/scope decision for a later iteration; or explicit **current-turn** user defer — plus Durable Roadmap Gate.
136
+ 6. **`waived` / `risk-accepted`**: still require PM + user/architect alignment; **close/archive** (do not leave open). Prefer a cheap fix over waive-as-shortcut.
137
+ 7. Plan **Done**: prefer empty `residual_findings[<plan_id>]`. If any open R# remain, **every** entry must be blocker-defer + roadmap; otherwise keep `InReview` / `Blocked`.
138
+
139
+ ### `allow-residual` (legacy default)
140
+
141
+ Non-blocking Warning/Suggestion may ship with open R# registration and `Approve with residuals` when no unresolved Critical remains (existing residual lifecycle unchanged).
142
+
143
+ ---
144
+
145
+ ## `plans[].metadata` standard optional fields
146
+
147
+ | Key | Type | Purpose |
148
+ | --- | --- | --- |
149
+ | `findings_cleanup` | `zero-residual` \| `allow-residual` | Mirror of Assignment **`Findings cleanup`**; see **Findings cleanup modes** |
150
+ | `working_branch` | string | Implementation branch; aligns with Assignment **`Working branch`** (SSOT) |
151
+ | `spec_integration_branch` | string | (Multi-plan same **Spec**) integration branch name; created from root `metadata.iteration_base_branch`; plan branches merge here before final PR (`mstar-plan-conventions`) |
152
+ | `merge_target` | string | Next merge target; multi-plan + Spec → usually `spec_integration_branch`; final PR target is root `metadata.target_branch` |
153
+ | `branch_policy` | string | One-line policy per `mstar-harness-core` |
154
+ | `phase` | string | Program/roadmap label |
155
+ | `priority` | `high` \| `medium` \| `low` | PM scheduling |
156
+ | `description` / `scope` | string | One-line scope; pick one key per repo |
157
+ | `gates` | object | Gate summary (`qc`, `qa`, `typecheck`, `tests`, `lint`, …) |
158
+ | `blocked_since` | `YYYY-MM-DD` | When `status` is `Blocked` |
159
+ | `blocked_reason` | string | Block reason |
160
+ | `blocked_by_plan_id` | string | Blocking **`plans[].id`** |
161
+ | `dependency` | string | Other dependencies |
162
+ | `next_action` | string | Next step after unblock/review |
163
+ | `primary_spec` | string | Main spec path (`{KNOWLEDGE_DIR}/…`, `{SPECS_DIR}/…`) |
164
+ | `iteration_compass` | string | Optional `{ITERATION_DIR}/…` |
165
+ | `iteration_refs` | string[] | Optional multiple compass paths |
166
+ | `qc_status` / `tests` / `commits` | string | InReview/Done snapshots; not a substitute for durable plan gate summaries or root `residual_findings` |
167
+ | `sdd_dir` | string | SDD scratch path, e.g. `{HARNESS_DIR}/sdd/<plan-id>/` (gitignored; `mstar-sdd`) |
168
+ | `sdd_progress` | string | Optional pointer to `{SDD_DIR}/progress.md` ledger |
169
+ | `review_bundle` | string | Optional pointer to `{SDD_DIR}/review/` for current ephemeral QC/QA evidence |
170
+ | `task_commits` | array\<object\> | SDD recovery: `{ "task_id": "T1", "base": "<sha>", "head": "<sha>" }` per completed task |
171
+
172
+ ### `plans[].execution_lease` (iteration Phase 2)
173
+
174
+ Optional when a plan is not owned; **required** while a Phase 2 session owns writable execution for that plan. Normative protocol below; iteration command checklist → `mstar-iteration/references/phase-2-worktree-lease.md`.
175
+
176
+ | Field | Type | Required | Semantics |
177
+ | --- | --- | --- | --- |
178
+ | `holder` | non-empty string | Yes | Opaque cooperative owner identity (recommended `<host>:<stable-session-id>`, e.g. `cursor:bc-1234`). Stable for claim lifetime; **no credentials**; used for ownership comparison — not `session_label`. |
179
+ | `claimed_at` | RFC 3339 UTC (`Z`) | Yes | Acquisition time (audit only; **not** an expiry clock). |
180
+ | `worktree_path` | absolute path string | Yes | Dedicated feature-worktree root; **MUST** differ from `metadata.control_worktree_path`. |
181
+ | `working_branch` | non-empty string | Yes | Feature branch at `worktree_path`; MUST agree with Assignment **`Working branch`**. |
182
+ | `session_label` | string | No | Human display only — **MUST NOT** authorize or compare ownership. |
183
+
184
+ Writers **delete** `execution_lease` on release; `null` and tombstone objects are invalid.
185
+
186
+ ### Optional delivery ledger (`phase` + `batches` + `verification`)
187
+
188
+ For multi-batch or multi-role plans:
189
+
190
+ | Key | Type | Purpose |
191
+ | --- | --- | --- |
192
+ | `phase` | string | Delivery phase label |
193
+ | `batches` | array\<object\> | Per-batch task coverage, owner, status, commits, self-audit |
194
+ | `verification` | object | Command-level verification snapshot |
195
+
196
+ Recommended `batches[]` subfields: `index`, `covers`, `status`, `owner`, `commits`, `a2_self_audit` (or synonym), `verification`.
197
+
198
+ > `batches` / `verification` are evidence indexes — not replacements for durable plan gate summaries or root `residual_findings`.
199
+
200
+ ### `plans[].notes` vs `{HARNESS_DIR}/notes.json`
201
+
202
+ - `plans[].notes`: per-plan timeline (string array recommended).
203
+ - `{HARNESS_DIR}/notes.json`: cross-plan program milestones.
204
+
205
+ Legacy string `plans[].notes` is OK; new repos should use arrays with time + event + evidence anchor.
206
+
207
+ ## Root `metadata` standard optional fields
208
+
209
+ | Key | Type | Purpose |
210
+ | --- | --- | --- |
211
+ | `versioning` | object | Cross-plan conventions (team-defined) |
212
+ | `iteration_base_branch` | string | Branch/ref used to create `spec_integration_branch`; required for formal iterations |
213
+ | `target_branch` | string | Final PR target after iteration-close; required for formal iterations |
214
+ | `notes` | array | **Legacy** — prefer **`{HARNESS_DIR}/notes.json`** |
215
+ | `residual_findings_history` | object | **Legacy** — prefer **`archived/residuals/<plan-id>.json`** |
216
+ | `tech_debt_summary` | object | Optional rollup over open R#; maintain via engine rollup (below) |
217
+ | `control_worktree_path` | absolute path string | Iteration Phase 2: canonical **repository root** (not `{HARNESS_DIR}`) checked out to active `spec_integration_branch`; coordination + serial merge cwd |
218
+ | `integration_merge_lease` | object | While one integration merge is owned; **absent** = unclaimed. Writers **delete** the key on release — never write `null` or tombstone objects |
219
+
220
+ **Formal iteration example** (root `metadata`; values are project-specific — **do not** copy `main` by default):
221
+
222
+ ```json
223
+ "metadata": {
224
+ "iteration_base_branch": "release/1.76",
225
+ "target_branch": "release/1.77"
226
+ }
227
+ ```
228
+
229
+ Plan row (per active iteration plan):
230
+
231
+ ```json
232
+ "metadata": {
233
+ "spec_integration_branch": "iteration/v1.77-live-teels",
234
+ "merge_target": "iteration/v1.77-live-teels",
235
+ "iteration_refs": ["v1.77"]
236
+ }
237
+ ```
238
+
239
+ ---
240
+
241
+ ## Iteration execution leases (Phase 2)
242
+
243
+ Cooperative coordination through the **control worktree** copy of `{HARNESS_DIR}/status.json`. Not a distributed lock service — non-cooperating processes are out of scope. **Same-host** writers use an exclusive write lock (below) around lease mutations; **cross-plan parallel writable implement** is permitted only when that lock is available on the control path and held for every lease mutation (see hard gate below).
244
+
245
+ **When fields apply:** iteration Phase 2 (after control worktree entry, or primary checkout when `Worktree mode: waived`). Control worktree + lease fields are waived only by explicit current-turn user instruction (`Worktree mode: waived` or equivalent). `Plan parallelism: serial` does **not** waive leases. **`Worktree mode: waived` does not waive the cross-plan parallel safety gate** (see hard gate below).
246
+
247
+ **Path SSOT:** Default-gitignored process artifacts — `status.json`, `plans/`, `iterations/`, `sdd/`, `notes.json`, `archived/` — read/write via `<control_worktree_path>/{HARNESS_DIR}/…` (absolute). A feature worktree's same-looking `{HARNESS_DIR}` path is **not** the SSOT. Missing plans under a feature checkout (gitignore) is **not** grounds for `Worktree mode: waived` — keep feature worktrees and use control absolute **`Plan Path`** / **`SDD dir`**. Detail → **`mstar-branch-worktree`** 「Harness path SSOT under default gitignore」.
248
+
249
+ ### Same-host exclusive write lock (control `status.json`)
250
+
251
+ Lease mutations on the **control** copy of `{HARNESS_DIR}/status.json` — execution claim/release/transfer, plan-status transitions that touch leases, and `integration_merge_lease` claim/release — **MUST** run inside a **same-host exclusive write lock** for the full read-check-replace-verify sequence.
252
+
253
+ **Preferred (same machine, shared filesystem):** advisory lock on `{HARNESS_DIR}/.status-write.lock` via `flock` (or equivalent). Hold from first read through post-write verify; release on all exit paths (success or failure).
254
+
255
+ ```bash
256
+ CONTROL_ROOT="<metadata.control_worktree_path>"
257
+ HARNESS=".harness" # or resolved {HARNESS_DIR}
258
+ STATUS="$CONTROL_ROOT/$HARNESS/status.json"
259
+ LOCK="$CONTROL_ROOT/$HARNESS/.status-write.lock"
260
+ (
261
+ flock -x 9 || exit 1
262
+ # read → mutate → temp file + atomic replace → re-read verify
263
+ ) 9>"$LOCK"
264
+ ```
265
+
266
+ **Alternative when `flock` unavailable:** atomic `mkdir` on `{HARNESS_DIR}/.status-write.lockdir/` — success acquires; existing dir → **Blocked** (another writer holds the lock); remove the directory only after successful verify or explicit rollback.
267
+
268
+ **Hard gate — cross-plan parallel writable implement:** Applies **whether or not** `Worktree mode: waived`. Lease-gated **cross-plan parallel** writable implement (when lease gate active) is allowed **only when** a same-host exclusive write lock is **available on the coordination `status.json` filesystem and held for every status/coordination mutation** in that Phase 2 session (execution claim/release/transfer, plan-status transitions, `integration_merge_lease` claim/release when lease gate active). When waived, the coordination path is primary checkout `{HARNESS_DIR}/status.json` — the same lock discipline applies to any shared status mutation before parallel writable dispatch. If agents span hosts or the coordination path has **no shared flock/lockdir** (distinct machines, non-shared mount), **default `Plan parallelism: serial`** for cross-plan implement scheduling — one plan writable wave at a time (**preferred default when waived**). If Assignment still claims cross-plan parallel implement without same-host lock availability → **Blocked** until PM aligns Assignment (`Plan parallelism: serial`) or the user supplies the override below. **`Worktree mode: waived` alone is not** the cross-host parallel override. v1 does **not** add a distributed CAS CLI.
269
+
270
+ **Exception — documented cross-host residual:** Explicit **current-turn** user instruction such as `Cross-host lease race: accepted` (or equally unambiguous equivalent) **plus** audit entry on affected `plans[].notes` (timestamp, hosts/sessions involved, residual race risk acknowledged) permits cooperative multi-host cross-plan parallel with documented residual risk.
271
+
272
+ **Pre-dispatch re-verify:** Immediately before **any** writable implement dispatch, reread control `status.json` and confirm this session still passes verify-held-lease (`holder`, `worktree_path`, `working_branch` match Assignment). Mismatch or absent lease → **STOP** — do not dispatch.
273
+
274
+ ### Root `metadata.integration_merge_lease` (v1)
275
+
276
+ Single global lease authorizing one plan feature branch integration into `spec_integration_branch`.
277
+
278
+ | Field | Type | Required | Semantics |
279
+ | --- | --- | --- | --- |
280
+ | `holder` | non-empty string | Yes | Same format and comparison rules as `execution_lease.holder`. |
281
+ | `claimed_at` | RFC 3339 UTC (`Z`) | Yes | Acquisition time (audit only). |
282
+ | `plan_id` | non-empty string | Yes | `plans[].id` (or legacy `plan_id`) of the feature being integrated. |
283
+ | `source_branch` | non-empty string | Yes | Plan feature branch to integrate. |
284
+ | `target_branch` | non-empty string | Yes | Resolved `spec_integration_branch` — no other target is valid. |
285
+ | `session_label` | string | No | Display only. |
286
+
287
+ Example fragments:
288
+
289
+ ```json
290
+ {
291
+ "metadata": {
292
+ "control_worktree_path": "/repo",
293
+ "integration_merge_lease": {
294
+ "holder": "cursor:bc-1234",
295
+ "claimed_at": "2026-07-22T04:00:00Z",
296
+ "plan_id": "plan-a",
297
+ "source_branch": "feature/plan-a",
298
+ "target_branch": "iteration/2026-07",
299
+ "session_label": "Integrate plan A"
300
+ }
301
+ },
302
+ "plans": [
303
+ {
304
+ "id": "plan-a",
305
+ "status": "InProgress",
306
+ "execution_lease": {
307
+ "holder": "cursor:bc-1234",
308
+ "claimed_at": "2026-07-22T02:30:00Z",
309
+ "worktree_path": "/repo-worktrees/plan-a",
310
+ "working_branch": "feature/plan-a",
311
+ "session_label": "Plan A implementation"
312
+ },
313
+ "metadata": {
314
+ "spec_integration_branch": "iteration/2026-07",
315
+ "merge_target": "iteration/2026-07"
316
+ }
317
+ }
318
+ ]
319
+ }
320
+ ```
321
+
322
+ ### Claim-before-`InProgress` (execution lease)
323
+
324
+ A Phase 2 session **MUST** claim **before** moving a plan from `Todo` or `Blocked` to `InProgress` and **before** any writable dispatch for that plan:
325
+
326
+ 1. Reread the control copy of `status.json`; locate exactly one plan row (`id` or `plan_id` read compatibility).
327
+ 2. **Resume (not steal):** if `execution_lease` exists and `holder` **equals this session** → verify-held-lease: confirm `worktree_path` and `working_branch` match the Assignment; continue (this is **not** Blocked and **not** a new claim).
328
+ 3. **Blocked:** if `execution_lease` exists and `holder` **differs** → stop. No timestamp, TTL, or inactivity makes it stealable.
329
+ 4. **Orphan:** if `status` is `InProgress` but `execution_lease` is absent → **STOP** (see “Orphan recovery” below). Do not writable-dispatch or invent a lease.
330
+ 5. Create or verify the dedicated feature worktree and branch (`worktree_path` ≠ `control_worktree_path`).
331
+ 6. Acquire same-host write lock (see above); reread `status.json`; if row, status, or lease state changed, restart from step 1.
332
+ 7. In **one complete-file update** (under lock), set `status: "InProgress"` and write the full `execution_lease` object. Use a temp file in the same directory and atomically replace `status.json`.
333
+ 8. Reread the stored row; verify `holder`, `worktree_path`, and `working_branch` exactly match the attempted claim. Writable dispatch is forbidden until verification succeeds.
334
+
335
+ V1: **manual release only** — omit `expires_at`; readers **MUST NOT** treat unknown or draft `expires_at` as authority to steal or release.
336
+
337
+ ### Hold, release, and override
338
+
339
+ - Lease remains active across `InProgress` and `InReview` (including review fix rounds) unless deliberately released or transferred.
340
+ - **Release:** reread control `status.json`; stored `holder` must match this session (mismatch → **Blocked**, not permission to delete). Delete `execution_lease` in the same complete-file update — never `null`.
341
+ - Voluntary abandonment: may set `status: "Blocked"` and delete the lease in one update.
342
+ - **`Done` authority** deletes any `execution_lease` in the **same** complete-file update as `status: "Done"` — **only after** successful integration merge into `spec_integration_branch` when Phase 2 lease gate is not waived (see “Integration merge protocol” and `mstar-iteration` §2.4). After QC/QA pass, plan stays **`InReview`** with lease retained until merge succeeds.
343
+ - Temporary blockage may retain the lease when the same holder remains responsible and the plan record explains the next action.
344
+ - **Override (only exception to no-steal):** explicit **user instruction in the current turn** may remove or replace another holder's lease. Append an audit entry to `plans[].notes` with timestamp, prior holder, new holder (or release), and that the user authorized override. Agents **MUST NOT** infer override from age, inactivity, `Blocked` status, or a failed session.
345
+ - Cooperative handoff: current holder explicitly agrees; receiving worktree/branch verified; one complete-file update — otherwise old holder releases and new holder follows normal claim.
346
+
347
+ ### Integration merge protocol
348
+
349
+ Feature implementation may run in parallel across plan IDs **only when** the cross-plan parallel hard gate above is satisfied (same-host lock on coordination `status.json`, default **`Plan parallelism: serial`**, or current-turn `Cross-host lease race: accepted` + audit `plans[].notes` — **not** by `Worktree mode: waived` alone); when lease gate is active, each plan also needs a verified `execution_lease` and distinct feature worktree. Mutations of `spec_integration_branch` are **serial**. Plan status after QC/QA is **`InReview`** with `execution_lease` retained until merge succeeds (when lease gate active); **`Done`** + lease deletion happen **after** the integration merge commit is recorded.
350
+
351
+ 1. From `control_worktree_path`: clean working tree; checked-out branch = resolved `spec_integration_branch`.
352
+ 2. Reread root `metadata` under the same-host write lock (above). If `integration_merge_lease` exists:
353
+ - **Resume (not steal):** `holder` **equals this session** → verify-held-merge-lease: confirm `plan_id`, `source_branch`, and `target_branch` match the intended merge; confirm control worktree state (clean or documented in-progress resolution); continue (this is **not** Blocked).
354
+ - **Blocked:** `holder` **differs** → stop. No timestamp, TTL, or inactivity makes it stealable.
355
+ 3. If unclaimed, claim merge lease with the same read-check-replace-verify discipline as execution claims. `source_branch` and `plan_id` must match the feature; `target_branch` must match `spec_integration_branch`.
356
+ 4. Only the stored merge-lease `holder` runs integration from `control_worktree_path`.
357
+ 5. On success: record merge commit/evidence per plan/status conventions; **delete** `integration_merge_lease`; in the **same** locked update set plan `status: "Done"` and **delete** `execution_lease`.
358
+ 6. On conflict/failure: retain both leases; plan stays **`InReview`** — do **not** set `Done`. Release merge lease only after control worktree is clean and in a known state.
359
+
360
+ Execution and merge leases may coexist; merge lease does not grant execution ownership for the source plan.
361
+
362
+ ### Orphan recovery (`InProgress` without `execution_lease`)
363
+
364
+ Runtime skills that detect this state (e.g. `mstar-iteration`) **STOP** and defer recovery here — they **MUST NOT** silently add a lease or writable-dispatch.
365
+
366
+ **Immediate gate:** no writable dispatch until recovery completes and a verified `execution_lease` exists (or plan is returned to a non-active status).
367
+
368
+ **Resolver:** `@project-manager` (or explicit human/PM ownership resolution after race or corruption).
369
+
370
+ | Path | When | Actions |
371
+ | ---- | ---- | ------- |
372
+ | **Reset to `Todo`** | Work abandoned, unknown owner, or safe to restart claim | One complete-file update under write lock: `status: "Todo"`; ensure `execution_lease` absent; append `plans[].notes` audit (timestamp, reason, actor). |
373
+ | **Recover with claim (same holder)** | Legitimate in-progress work; feature worktree/branch verified on disk; **this session's stable `holder`** matches the prior owner | Unattended recovery permitted **only** for the **same** stable `holder`. Follow claim-before-`InProgress` from step 5 under write lock; append `plans[].notes` audit (orphan recovery, same `holder`, paths verified). |
374
+ | **Recover with claim (different holder)** | New session must take over live work | **Blocked** for unattended recovery. Requires **verified quiescence** of the prior writer (no live writable work on the feature branch/worktree) **and** explicit cooperative handoff from the prior holder, **or** **current-turn user override** + audit `notes` (prior holder, new holder, user authorized). Then normal claim under write lock. |
375
+ | **Escalate / `Blocked`** | Ambiguous ownership, conflicting worktrees, or partial/corrupt `status.json` | Set `status: "Blocked"` with `metadata.blocked_reason`; do **not** writable-dispatch until human/PM resolves. Restore coherent `status.json` from latest complete state if needed. |
376
+
377
+ After any recovery path, the next session must pass verify-held-lease before writable dispatch.
378
+
379
+ ### Agent prohibitions (lease SSOT)
380
+
381
+ - **MUST NOT** steal or overwrite an active `execution_lease` or `integration_merge_lease` (no TTL, age, or inactivity authority in v1).
382
+ - **MUST NOT** writable-dispatch without a verified `execution_lease` for that plan (resume counts only when same `holder` passes verify-held-lease).
383
+ - **MUST NOT** write `null` or tombstone objects for lease keys — **delete** the key on release.
384
+ - **PM NEVER** steal an active lease without explicit current-turn user override + audit `notes` (full list → `mstar-roles/references/project-manager.md` § PM-Specific NEVER Rules).
385
+
386
+ Preservation: writers **MUST** preserve unrelated plan rows, root metadata, and `residual_findings` on every lease mutation.
387
+
388
+ ---
389
+
390
+ ## General constraints
391
+
392
+ - Each `plans[]` row may include optional **`metadata`** (`{}` or omit).
393
+ - Init with `"residual_findings": {}`; **no dual-write** with legacy side (see SKILL.md). Program timeline → **`notes.json`**, not long `metadata.notes` in `status.json`.
394
+ - **`plans[].id`** keys must align with root **`residual_findings`** keys and `{SDD_DIR}` plan-id segments. Do not store `residual_findings_plan_id`.
395
+ - **Empty `plan-id` key:** when no open items remain, **delete** the key from root **`residual_findings`** (and legacy side if present) — no `"plan-id": []`. Whether **`plans[]`** keeps the row is separate (`done-compaction.md`).
396
+ - **`residual_summary` (optional):** one-line human summary of **open** items only.
397
+
398
+ ---
399
+
400
+ ## Residual findings lifecycle (close, archive, remove)
401
+
402
+ ### `lifecycle` (optional; default open)
403
+
404
+ | `lifecycle` | Meaning | `closure_note` should explain |
405
+ | ----------- | ------- | ----------------------------- |
406
+ | `open` | Not closed (omit field = open) | — |
407
+ | `resolved` | Fixed in code/config/docs and **verified** | What changed; how verified |
408
+ | `waived` | Explicit decision not to fix | Who decided; why; optional `tracking` Issue |
409
+ | `superseded` | Replaced by new finding/spec/refactor | `superseded_by` |
410
+ | `duplicate` | Duplicate of another R# | Canonical `id` or mistake note |
411
+
412
+ **On close:** set **`closed_at`** (`YYYY-MM-DD`) and **`closure_note`**; recommend **`closure_evidence`** (PR, commit, test, doc anchor).
413
+
414
+ ### Who updates when
415
+
416
+ | Action | Owner | When |
417
+ | ------ | ----- | ---- |
418
+ | Implement fix | `@fullstack-dev` / assignee | Completion Report cites R# + evidence |
419
+ | Verify | `@qa-engineer` when **`QA gate: mandatory`**; else PM per acceptance checklist | Regression / acceptance; open R# close requires verify before archive |
420
+ | Write `status.json` | **`@project-manager`** or **`@qa-engineer`** | After verification; waivers after PM + user/architect alignment |
421
+
422
+ Do not claim “R3 fixed” in chat/plan only without SSOT update.
423
+
424
+ PM should register open items after **`Approve with residuals`**; QA should state each related R# (open / resolved this round / needs waiver).
425
+
426
+ ### Recommended: archive to `archived/residuals/<plan-id>.json`
427
+
428
+ After **`closed_at`**, **`closure_note`**, and PM/QA confirm close:
429
+
430
+ 1. **Append** to **`{HARNESS_DIR}/archived/residuals/<plan-id>.json`**.
431
+ 2. **Remove** from open list (root **`residual_findings[<plan-id>]`**; legacy side if used). Delete empty **`plan-id`** keys.
432
+ 3. Update root **`updated_at`**; optional milestone in **`notes.json`**.
433
+
434
+ Archive file shape (append to `entries`):
435
+
436
+ ```json
437
+ {
438
+ "plan_id": "01-data-infrastructure",
439
+ "schema_version": 1,
440
+ "entries": [
441
+ {
442
+ "id": "R1",
443
+ "severity": "medium",
444
+ "lifecycle": "resolved",
445
+ "closed_at": "2026-04-06",
446
+ "closure_note": "…",
447
+ "closure_evidence": "PR #42 / commit …",
448
+ "archived_at": "2026-04-07"
449
+ }
450
+ ]
451
+ }
452
+ ```
453
+
454
+ - Each archived entry needs **`archived_at`** (`YYYY-MM-DD`).
455
+ - Closed records live in archive + durable plan summaries; raw review bundles are ephemeral and not part of the long-term open list.
456
+ - After batch archive/close, **refresh `tech_debt_summary`** (engine rollup below).
457
+
458
+ ### Short in-place close (transition only)
459
+
460
+ May set `lifecycle` / `closed_*` in open list for one PR; **same milestone** move to archive + delete from open list.
461
+
462
+ ### Legacy `metadata.residual_findings_history`
463
+
464
+ Prefer **`archived/residuals/`**; migrate and delete history key when possible.
465
+
466
+ ### Hard delete
467
+
468
+ - **Forbidden** for **open** entries.
469
+ - Do not delete archived entries; correct via new entry or new R# referencing old `id`.
470
+ - Mistaken open-only entry: PM may delete or mark **`duplicate`** then close/archive.
471
+
472
+ ### Query open and archived (examples)
473
+
474
+ ```bash
475
+ # Replace .mstar with your resolved {HARNESS_DIR}; legacy projects may use .agents.
476
+ jq '.residual_findings["01-data-infrastructure"] // .metadata.residual_findings["01-data-infrastructure"]' .mstar/status.json
477
+ jq '.entries[] | select(.id == "R1")' .mstar/archived/residuals/01-data-infrastructure.json
478
+ # Engine rollup (read-only, no CLI form): import { techDebtRollup } from "@mstar-harness/engine" in a host hook
479
+ ```
480
+
481
+ (`//` right-hand side = legacy read path.)
482
+
483
+ ---
484
+
485
+ ## `{HARNESS_DIR}/notes.json` (optional program timeline)
486
+
487
+ Append-only log for merge closure, batch archive, `tech_debt_summary` refresh, etc. Does not compete with **`plans[].status`** / open residual SSOT.
488
+
489
+ ```json
490
+ {
491
+ "schema_version": 1,
492
+ "updated_at": "YYYY-MM-DD",
493
+ "entries": [
494
+ { "at": "2026-04-08", "message": "Short milestone", "plan_id": "01-data-infrastructure" }
495
+ ]
496
+ }
497
+ ```
498
+
499
+ - **`@project-manager`** maintains; do not rewrite past `entries` — add correction as new entry.
500
+ - **`plans[].notes`**: per-plan; **`notes.json`**: cross-plan.
501
+
502
+ ---
503
+
504
+ ## `metadata.tech_debt_summary` (optional rollup)
505
+
506
+ **Role:** Cross-plan aggregate over **open** R# in root **`residual_findings`** (and legacy read path if present). Does **not** replace per-entry SSOT.
507
+
508
+ **Compute (canonical):** engine import (do **not** hand-count):
509
+
510
+ ```ts
511
+ // Engine check (when available) — pass status.json path if not .mstar/status.json
512
+ import { techDebtRollup } from "@mstar-harness/engine";
513
+ const rollup = techDebtRollup(".mstar/status.json"); // { computed, stored, checks, overall }
514
+ ```
515
+
516
+ - Prints computed `total_open`, `by_severity`, `by_target`, `by_plan`.
517
+ - Prints **PASS** / **DRIFT** vs stored `metadata.tech_debt_summary`.
518
+ - The engine call **does not write** `status.json` — PM copies computed values into `metadata.tech_debt_summary` after DRIFT or milestone refresh.
519
+
520
+ **When to refresh:** after QC waves, batch archive of resolved items, or release freeze. Optional `notes.json` entry: “refreshed tech_debt_summary”.
521
+
522
+ **Recommended stored shape** (`cross_cutting` optional; engine does not compute `cross_cutting` — maintain manually if used):
523
+
524
+ ```json
525
+ {
526
+ "tech_debt_summary": {
527
+ "updated_at": "YYYY-MM-DD",
528
+ "total_open": 29,
529
+ "by_severity": { "critical": 0, "high": 10, "medium": 10, "low": 5, "nit": 1 },
530
+ "by_target": { "V1.0": 5, "V1.1": 18 },
531
+ "by_plan": { "domain-models": 4, "cli-daemon-foundation": 11 },
532
+ "cross_cutting": [
533
+ {
534
+ "id": "DEBT-X1",
535
+ "title": "Cross-plan theme",
536
+ "severity": "high",
537
+ "relates_to": ["CLI-R9", "SYNC-R4"]
538
+ }
539
+ ]
540
+ }
541
+ }
542
+ ```
543
+
544
+ - **`by_plan`** keys: short labels or `plans[].id` prefixes per repo convention.
545
+ - **`cross_cutting`**: themes spanning plans/R#; explain intentional count differences in `notes.json` or here.
546
+
547
+ ---
548
+
549
+ ## Pre-merge: `status.json` should match reality
550
+
551
+ Before merge/PR, **`@project-manager`** (or delegate) should verify: `plans[].status`, `metadata.gates`, root **`residual_findings`** (no accidental dual-write), **`tech_debt_summary`** (if used — run engine rollup), **`notes.json`** (if used), vs review/CI.
552
+
553
+ **Common gaps:**
554
+
555
+ - R# added/closed but **`tech_debt_summary` not refreshed** (engine rollup shows DRIFT).
556
+ - Finding only in **`plans[].notes`** or chat, not in **`residual_findings[<plan-id>]`**.
557
+ - Major milestone with no **`notes.json`** entry when team uses program timeline.
558
+
559
+ ## Compatibility: plan key names
560
+
561
+ - Read: accept `id` or `plan_id`.
562
+ - Write: one canonical key (prefer `id`).
563
+ - Document canonical key in `{HARNESS_DIR}/AGENTS.md` if migrating.
564
+
565
+ ## Common queries
566
+
567
+ ```bash
568
+ jq '.plans[] | select(.id == "01-data-infrastructure")' .mstar/status.json
569
+ jq '.residual_findings["01-data-infrastructure"] // .metadata.residual_findings["01-data-infrastructure"]' .mstar/status.json
570
+ ```
@@ -0,0 +1,9 @@
1
+ # Plan harness file templates
2
+
3
+ Copy these into `{HARNESS_DIR}` when bootstrapping a project. Path symbols (`{HARNESS_DIR}`, `{PLAN_DIR}`, …) → **`mstar-plan-conventions`**. Field semantics and residual lifecycle → **`mstar-plan-artifacts/references/status-and-residuals.md`**. Optional rollup: engine `techDebtRollup` import (read-only; see that reference).
4
+
5
+ | File | Copy to | Notes |
6
+ |------|---------|--------|
7
+ | `status.empty.json` | `{HARNESS_DIR}/status.json` | Root `residual_findings` only (see **`mstar-plan-artifacts` SKILL.md**). Replace `updated_at` with the real date. Iteration Phase 2 lease fields (`control_worktree_path`, `execution_lease`, `integration_merge_lease`) are added at runtime — not in the empty template. |
8
+ | `notes.empty.json` | `{HARNESS_DIR}/notes.json` | Optional program timeline. Replace `updated_at` when first edited. |
9
+ | `plans-done.empty.json` | `{HARNESS_DIR}/archived/plans-done.json` | **Profile B only** — `{ "plans": [<plan-id>, ...] }` **only** (`references/done-compaction.md`). Append id on each `Done` compaction; no other keys or object elements. |
@@ -0,0 +1,5 @@
1
+ {
2
+ "schema_version": 1,
3
+ "updated_at": "1970-01-01",
4
+ "entries": []
5
+ }
@@ -0,0 +1,54 @@
1
+ # [Feature Name] Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use `mstar-sdd` (recommended) or inline execution. Steps use checkbox (`- [ ]`) syntax.
4
+
5
+ **Goal:** [One sentence]
6
+
7
+ **Architecture:** [2–3 sentences]
8
+
9
+ **Tech Stack:** [Key technologies]
10
+
11
+ **Execution:** mstar-sdd | inline
12
+
13
+ ## Global Constraints
14
+
15
+ [Project-wide requirements — version floors, naming, exact values — copied verbatim from spec. Every task implicitly includes this section.]
16
+
17
+ ---
18
+
19
+ ### Task 1: [Component Name]
20
+
21
+ **Files:**
22
+ - Create: `exact/path/to/file`
23
+ - Modify: `exact/path/existing.py`
24
+ - Test: `tests/path/test.py`
25
+
26
+ **Interfaces:**
27
+ - Consumes: [signatures from earlier tasks]
28
+ - Produces: [what later tasks rely on]
29
+
30
+ - [ ] **Step 1: Write the failing test**
31
+
32
+ ```python
33
+ # complete test code
34
+ ```
35
+
36
+ - [ ] **Step 2: Run test — expect FAIL**
37
+
38
+ Run: `pytest tests/path/test.py -v`
39
+
40
+ - [ ] **Step 3: Minimal implementation**
41
+
42
+ - [ ] **Step 4: Run test — expect PASS**
43
+
44
+ - [ ] **Step 5: Commit**
45
+
46
+ ## Plan self-review (PM before locked)
47
+
48
+ 1. **Spec coverage:** every spec requirement maps to a task
49
+ 2. **Placeholder scan:** no TBD, no "add tests" without code
50
+ 3. **Type consistency:** names match across tasks
51
+
52
+ ## SDD runtime (ephemeral)
53
+
54
+ When using `mstar-sdd`, artifacts live under `{SDD_DIR}` (see `mstar-plan-conventions`). Do not duplicate briefs/reports in this file.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 1,
3
+ "updated_at": "1970-01-01",
4
+ "plans": [],
5
+ "residual_findings": {},
6
+ "metadata": {}
7
+ }