@mstar-harness/dsh 2.4.1 → 3.0.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 (80) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +10 -8
  3. package/README.zh.md +7 -5
  4. package/bundle/README.md +4 -4
  5. package/dist/client/panel/graph/project-graph.d.ts +29 -3
  6. package/dist/client/panel/locale.d.ts +1 -1
  7. package/dist/client/panel/zones/ProjectRollup.d.ts +24 -0
  8. package/dist/client.js +270 -34
  9. package/dist/gates/_shared.d.ts +4 -4
  10. package/dist/gates/adapter.d.ts +38 -12
  11. package/dist/gates/agent-flow.d.ts +109 -12
  12. package/dist/gates/dispatch.d.ts +16 -10
  13. package/dist/gates/goal-bridge.d.ts +1 -1
  14. package/dist/gates/status.d.ts +64 -14
  15. package/dist/gates/system-prompt.d.ts +6 -2
  16. package/dist/gates/workflow-ledger.d.ts +88 -17
  17. package/dist/gates/workflow-policy.d.ts +2 -1
  18. package/dist/gates/workflow-selection.d.ts +31 -0
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.js +1532 -692
  21. package/dist/service.d.ts +14 -9
  22. package/dist/types.d.ts +64 -2
  23. package/harness-agents/code-reviewer.md +0 -8
  24. package/harness-skills/mstar-branch-worktree/SKILL.md +14 -14
  25. package/harness-skills/mstar-branch-worktree/references/parallel-writable-pre-dispatch.md +2 -2
  26. package/harness-skills/mstar-compound/SKILL.md +2 -2
  27. package/harness-skills/mstar-compound/references/compound-workflow.md +3 -3
  28. package/harness-skills/mstar-compound-refresh/SKILL.md +4 -4
  29. package/harness-skills/mstar-compound-refresh/references/project-knowledge-bootstrap.md +1 -1
  30. package/harness-skills/mstar-dispatch-gates/SKILL.md +2 -2
  31. package/harness-skills/mstar-engine-legacy/SKILL.md +53 -0
  32. package/harness-skills/mstar-engine-legacy/references/anti-recursion-checklists.md +58 -0
  33. package/harness-skills/mstar-engine-legacy/references/engine-check-boilerplate.md +26 -0
  34. package/harness-skills/mstar-engine-legacy/references/lease-protocol.md +92 -0
  35. package/harness-skills/mstar-engine-legacy/references/qc-seat-n-restatements.md +57 -0
  36. package/harness-skills/mstar-engine-legacy/references/status-field-history.md +186 -0
  37. package/harness-skills/mstar-harness-core/SKILL.md +6 -3
  38. package/harness-skills/mstar-host/references/_shared/plan-mode-bridge-core.md +8 -8
  39. package/harness-skills/mstar-host/references/codex.md +1 -1
  40. package/harness-skills/mstar-host/references/cursor-plan-mode-bridge.md +19 -8
  41. package/harness-skills/mstar-host/references/cursor.md +5 -5
  42. package/harness-skills/mstar-host/references/dsh.md +10 -7
  43. package/harness-skills/mstar-host/references/kimi-plan-mode-bridge.md +3 -3
  44. package/harness-skills/mstar-host/references/kimi.md +1 -1
  45. package/harness-skills/mstar-host/references/omp-plan-mode-bridge.md +2 -2
  46. package/harness-skills/mstar-host/references/omp.md +2 -2
  47. package/harness-skills/mstar-host/references/zcode-plan-mode-bridge.md +3 -3
  48. package/harness-skills/mstar-host/references/zcode.md +1 -1
  49. package/harness-skills/mstar-iteration/SKILL.md +38 -37
  50. package/harness-skills/mstar-iteration/references/autonomous-direction-lock.md +2 -2
  51. package/harness-skills/mstar-iteration/references/iteration-compass-template.md +3 -3
  52. package/harness-skills/mstar-iteration/references/phase-2-worktree-lease.md +50 -38
  53. package/harness-skills/mstar-iteration/references/phase-3-iteration-close.md +7 -7
  54. package/harness-skills/mstar-iteration/references/phase-4-5-pr-delivery.md +2 -2
  55. package/harness-skills/mstar-phase-gates/SKILL.md +3 -3
  56. package/harness-skills/mstar-plan-artifacts/SKILL.md +21 -23
  57. package/harness-skills/mstar-plan-artifacts/references/knowledge-and-designs.md +6 -6
  58. package/harness-skills/mstar-plan-artifacts/references/plan-files-and-reports.md +10 -10
  59. package/harness-skills/mstar-plan-artifacts/references/status-and-residuals.md +190 -309
  60. package/harness-skills/mstar-plan-artifacts/templates/README.md +1 -3
  61. package/harness-skills/mstar-plan-artifacts/templates/status.empty.json +2 -4
  62. package/harness-skills/mstar-plan-conventions/SKILL.md +53 -13
  63. package/harness-skills/mstar-plan-conventions/references/artifact-storage-paths.md +6 -3
  64. package/harness-skills/mstar-plan-conventions/references/harness-bootstrap-and-agents-layering.md +9 -10
  65. package/harness-skills/mstar-project-governance/SKILL.md +118 -0
  66. package/harness-skills/mstar-review-qc/SKILL.md +3 -3
  67. package/harness-skills/mstar-roles/references/project-manager/dispatch-and-assignment.md +1 -1
  68. package/harness-skills/mstar-roles/references/project-manager/plan-management.md +6 -8
  69. package/harness-skills/mstar-roles/references/project-manager/qc-and-residuals.md +6 -6
  70. package/harness-skills/mstar-roles/references/project-manager.md +7 -7
  71. package/harness-skills/mstar-roles/references/qc-specialist/deep-review-lenses.md +1 -1
  72. package/harness-skills/mstar-roles/references/qc-specialist/report-template.md +1 -1
  73. package/harness-skills/mstar-roles/references/qc-specialist/reviewer-workflow.md +1 -1
  74. package/harness-skills/mstar-roles/references/qc-specialist-shared.md +2 -2
  75. package/harness-skills/mstar-sdd/SKILL.md +2 -2
  76. package/harness-skills/mstar-sdd/references/file-handoffs.md +1 -1
  77. package/package.json +14 -14
  78. package/harness-skills/mstar-plan-artifacts/references/done-compaction.md +0 -88
  79. package/harness-skills/mstar-plan-artifacts/templates/notes.empty.json +0 -5
  80. package/harness-skills/mstar-plan-artifacts/templates/plans-done.empty.json +0 -3
@@ -0,0 +1,92 @@
1
+ # Lease claim protocol (full prose, archived)
2
+
3
+ > Engine-absent fallback: the full lease protocol prose displaced from `mstar-iteration` / `mstar-plan-artifacts` when engine validators (`validateExecutionLease` / `validateIntegrationMergeLease` / CLI `mstar lease verify --workflow <id>`) took over the same contract. Engine-present hosts read the runtime skills' engine-check pointers instead.
4
+
5
+ ## When it applies
6
+
7
+ **Iteration Phase 2 only** (after control-worktree entry, or primary checkout when `Worktree mode: waived`). Defaults are **hard** unless the current turn explicitly waives via Assignment `Worktree mode: waived` (or equivalent user instruction). `Plan parallelism: serial` is **not** a waiver — it only forces serial cross-plan **implement** scheduling while control worktree + leases remain required. Phase 1 Review & Edit may stay on the primary checkout; the control-worktree gate starts at **Phase 2 entry**. **`Worktree mode: waived` does not waive the cross-plan parallel safety gate**.
8
+
9
+ ## Coordination SSOT and lock discipline
10
+
11
+ Lease mutations happen on the **control copy** of the coordination file — the v2 workflow snapshot `{WORKFLOW_DIR}/<id>/snapshot.json` (v1: `{HARNESS_DIR}/status.json`, migrated). This is cooperative, not a distributed lock service — non-cooperating processes are out of scope.
12
+
13
+ **Same-host exclusive write lock** — all control-path lease mutations (claim, release, transfer, plan-status transitions that touch the lease, merge-lease claim/release) MUST run inside a same-host exclusive write lock for the full **read-check-replace-verify** sequence. Hold from first read through post-write verify; release on all exit paths.
14
+
15
+ - Engine writers acquire the lock automatically: `writeWorkflowSnapshot` / `registerWorkflow` atomic-`mkdir` the lockdir at `<status-file dir>/.status-write.lockdir/` — for the snapshot the lockdir lands **inside `workflows/<id>/`** (next to `snapshot.json`).
16
+ - Manual fallback when no engine writer exists: atomic `mkdir` on `{WORKFLOW_DIR}/<id>/.status-write.lockdir/` — success acquires; existing dir → **Blocked** (another writer holds the lock); `rmdir` the directory only after successful verify or explicit rollback. The dsh notes-ledger writer uses the same lockdir pattern (`{WORKFLOW_DIR}/<id>/.ledger-write.lockdir`). Do **not** invent a distributed CAS CLI.
17
+
18
+ ```bash
19
+ CONTROL_ROOT="<snapshot top-level control_worktree_path>"
20
+ HARNESS=".mstar" # or resolved {HARNESS_DIR}
21
+ WORKFLOW_ID="<plan-or-iteration-id>"
22
+ SNAPSHOT="$CONTROL_ROOT/$HARNESS/workflows/$WORKFLOW_ID/snapshot.json"
23
+ LOCKDIR="$CONTROL_ROOT/$HARNESS/workflows/$WORKFLOW_ID/.status-write.lockdir"
24
+ (
25
+ mkdir "$LOCKDIR" || exit 1
26
+ trap 'rmdir "$LOCKDIR"' EXIT
27
+ # read → mutate → temp file + atomic replace → re-read verify
28
+ )
29
+ ```
30
+
31
+ **Pre-dispatch re-verify:** immediately before **any** writable implement dispatch, re-read the coordination file and confirm this session still passes verify-held-lease (`holder`, `worktree_path`, `working_branch` match Assignment). Mismatch or absent lease ⇒ **STOP** — do not dispatch.
32
+
33
+ ## Claim-before-`InProgress` (execution lease)
34
+
35
+ A Phase 2 session **MUST** claim before moving a plan from `Todo`/`Blocked` to `InProgress` and before any writable dispatch for that plan:
36
+
37
+ 1. Re-read the coordination copy; locate exactly one plan row (`id` read compatibility).
38
+ 2. **Resume (not steal):** if `execution_lease` exists and `holder` **equals this session** → verify-held: confirm `worktree_path` and `working_branch` match the Assignment; continue (not Blocked, not a new claim).
39
+ 3. **Blocked:** if `execution_lease` exists and `holder` **differs** → stop. No timestamp, TTL, or inactivity makes it stealable.
40
+ 4. **Orphan:** if `status` is `InProgress` but `execution_lease` is absent → **STOP** (see Orphan recovery). Do not writable-dispatch or invent a lease.
41
+ 5. Create or verify the dedicated feature worktree and branch (`worktree_path` ≠ `control_worktree_path`).
42
+ 6. Acquire the same-host write lock (above); re-read the coordination file; if row/status/lease changed, restart from step 1.
43
+ 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 + atomic replace; never expose partial JSON.
44
+ 8. Re-read the stored row; verify `holder`, `worktree_path`, `working_branch` exactly match the attempted claim. Writable dispatch is forbidden until verification succeeds.
45
+
46
+ V1: **manual release only** — omit `expires_at`; readers **MUST NOT** treat unknown/draft `expires_at` as authority to steal or release.
47
+
48
+ ## Hold, release, and override
49
+
50
+ - Lease remains active across `InProgress` and `InReview` (including review fix rounds) unless deliberately released or transferred.
51
+ - **Release:** re-read coordination file; stored `holder` must match this session (mismatch ⇒ **Blocked**, not permission to delete). Delete `execution_lease` in the same complete-file update — never `null`.
52
+ - Voluntary abandonment: may set `status: "Blocked"` and delete the lease in one update.
53
+ - **Done authority** deletes `execution_lease` in the **same** complete-file update as `status: "Done"` — **only after** successful integration merge when the lease gate is not waived. After QC/QA pass the plan stays **`InReview`** with lease retained until merge succeeds.
54
+ - Temporary blockage may retain the lease when the same holder remains responsible and the plan record explains the next action.
55
+ - **Override (only exception to no-steal):** explicit **user instruction in the current turn** may remove or replace another holder's lease. Append an audit note (prior holder, new holder/release, user authorized) to `plans[].notes` / `notes.jsonl`. Agents **MUST NOT** infer override from age, inactivity, `Blocked` status, or a failed session.
56
+ - Cooperative handoff: current holder explicitly agrees; receiving worktree/branch verified; one complete-file update — otherwise old holder releases and new holder follows normal claim.
57
+
58
+ ## Integration merge protocol
59
+
60
+ Feature implementation may run in parallel across plan IDs **only when** the cross-plan parallel hard gate is satisfied (same-host lock on the coordination file, default `Plan parallelism: serial`, or current-turn `Cross-host lease race: accepted` + audit — **not** by `Worktree mode: waived` alone); when the 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.
61
+
62
+ 1. From `control_worktree_path`: clean working tree; checked-out branch = resolved `spec_integration_branch`.
63
+ 2. Re-read the coordination file under the same-process write lock. If `integration_merge_lease` exists:
64
+ - **Resume (not steal):** `holder` equals this session → verify `plan_id`, `source_branch`, `target_branch` match the intended merge; confirm control worktree state; continue (not Blocked).
65
+ - **Blocked:** `holder` differs → stop. No timestamp, TTL, or inactivity makes it stealable.
66
+ 3. If unclaimed, claim the merge lease with the same read-check-replace-verify discipline as execution claims. `source_branch`/`plan_id` must match the feature; `target_branch` must match `spec_integration_branch`.
67
+ 4. Only the stored merge-lease holder runs integration from `control_worktree_path`.
68
+ 5. On success: record merge commit/evidence; **delete** `integration_merge_lease`; in the **same** locked update set plan `status: "Done"` and **delete** `execution_lease`.
69
+ 6. On conflict/failure: retain both leases; plan stays `InReview` — do not set `Done`. Release the merge lease only after the control worktree is clean and in a known state.
70
+
71
+ Execution and merge leases may coexist; the merge lease does not grant execution ownership for the source plan.
72
+
73
+ ## Orphan recovery (`InProgress` without `execution_lease`)
74
+
75
+ Runtime skills that detect this state **STOP** and defer recovery — they must not silently add a lease or writable-dispatch. **Immediate gate:** no writable dispatch until recovery completes and a verified `execution_lease` exists (or the plan returns to a non-active status). **Resolver:** `@project-manager` (or explicit human/PM ownership resolution after race or corruption).
76
+
77
+ | Path | When | Actions |
78
+ | ---- | ---- | ------- |
79
+ | **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 audit note (timestamp, reason, actor). |
80
+ | **Recover with claim (same holder)** | Legitimate in-progress work; 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 from step 5 under write lock; append audit note (orphan recovery, same holder, paths verified). |
81
+ | **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 note. Then normal claim under write lock. |
82
+ | **Escalate / `Blocked`** | Ambiguous ownership, conflicting worktrees, or partial/corrupt state | Set `status: "Blocked"` with `metadata.blocked_reason`; do not writable-dispatch until human/PM resolves. Restore coherent state from the latest complete version if needed. |
83
+
84
+ After any recovery path, the next session must pass verify-held before writable dispatch.
85
+
86
+ ## Lease prohibitions (SSOT)
87
+
88
+ - **MUST NOT** steal or overwrite an active `execution_lease` or `integration_merge_lease` (no TTL, age, or inactivity authority).
89
+ - **MUST NOT** writable-dispatch without a verified `execution_lease` for that plan (resume counts only when same `holder` passes verify-held).
90
+ - **MUST NOT** write `null` or tombstone objects for lease keys — **delete** the key on release.
91
+ - **PM NEVER** steals an active lease without explicit current-turn user override + audit note (full list → `mstar-roles/references/project-manager.md`).
92
+ - Writers **MUST preserve** unrelated plan rows, root metadata, and residual data on every lease mutation.
@@ -0,0 +1,57 @@
1
+ # QC seat N restatements (per-host, archived)
2
+
3
+ > Engine-absent fallback: the per-host N=3/N=1 restatements that runtime host references (`mstar-host/references/*`) consolidate. Engine-present hosts read `mstar-host` → `parallel-dispatch.md` + `executionModeToN` instead; this file is the consolidated full restatement text.
4
+
5
+ ## Canonical N mapping (any host)
6
+
7
+ | `Execution mode` | QC seats | N |
8
+ | --- | --- | --- |
9
+ | `sdd` (multi-task plan, single plan, or iteration Phase 2) | `qc-specialist` / `qc-specialist-2` / `qc-specialist-3` in **one** dispatch turn | **N=3** |
10
+ | `inline` (hotfix) / explicit `QC mode: single` override | `qc-specialist` ×1 | **N=1** |
11
+ | Targeted re-review (`QC re-review: targeted — reviewers: <ids>`) | the listed seats only | N = listed count (1–3) |
12
+
13
+ Rules that never change: tri seats dispatch **in one message** with a branch review-package path (`{SDD_DIR}/review/qc1.md`…`qc3.md` + `qc-consolidated.md`); post-dispatch verify three distinct agent ids; `Execution mode: inline` with `QC mode: full tri-review` still launches the three seats; SDD implement/reviewer dispatches stay **serial** (never parallel implementers for the same plan); each invoke must carry the role-binding field set to `Execute as` even at N=1.
14
+
15
+ ## Per-host restatements (full text)
16
+
17
+ ### omp (`task` tool, `agent` field)
18
+
19
+ - **`Execution mode: sdd`**: **N=3** task entries — prefer `agent: "qc-specialist"`, `"qc-specialist-2"`, `"qc-specialist-3"` when listed; each body still **Act as** the respective QC role + QC skill load. If a seat is missing from the live schema, fall back per C5 (generic + C5b) for that seat only. N rules → `parallel-dispatch.md`.
20
+ - **`inline`**: **N=1** per `parallel-dispatch.md`.
21
+ - Cannot emit required **N** → **`Blocked`**.
22
+ - SDD implement: one implementer `task` entry per task id with `agent` matching the implementer role when listed; task reviewer = new entry with `agent: "code-reviewer"` (omp L2 review; not qc-specialist*) or `agent: "reviewer"`/`"task"` fallback + C5b; serial rule → `parallel-dispatch.md`.
23
+
24
+ ### opencode (`task` tool, `subagent` field)
25
+
26
+ - Parallel batch **N** = **N task tool calls** in one assistant message when the host allows (`parallel-dispatch.md`); 1 Assignment ⇒ 1 invoke.
27
+ - Prepare phase serial roles (`explore → product-manager → architect`) still require a real task-tool call per handoff (**N=1** per dispatch turn) — Assignment Markdown alone does not open subagent sessions.
28
+ - SDD task reviewer: new task tool call with `subagent: "code-reviewer"` (OpenCode L2; not qc-specialist*), no sticky resume for reviewers.
29
+
30
+ ### cursor (Task tool, `subagent_type` field)
31
+
32
+ - **`Execution mode: sdd`**: **N=3** Tasks (`qc-specialist`, `qc-specialist-2`, `qc-specialist-3`) + branch review-package path (N rules → `parallel-dispatch.md`).
33
+ - **`inline`**: **N=1** per `parallel-dispatch.md`.
34
+ - SDD implement/reviewer: serial — implementer Task per task id with `subagent_type` matching the implementer role when listed; task reviewer = new Task with `subagent_type: "code-reviewer"` (Cursor L2; not qc-specialist*) when listed, else generic fallback per C5 — no `resume` for reviewers.
35
+
36
+ ### codex (custom-agent / multi-agent tools only)
37
+
38
+ - QC: N rules → `parallel-dispatch.md` (**`Execution mode: sdd`** → N=3; **`inline`** → N=1) when a callable invoke tool exists. Cannot emit required **N** → **`Blocked`**.
39
+ - If no invoke tool is present when dispatch is required → **`Blocked`** — report missing invoke capability; do not substitute single-session role execution in the PM thread unless the user explicitly overrides harness dispatch this turn.
40
+
41
+ ### kimi (`Agent` tool, `subagent_type` ∈ {`coder`,`explore`,`plan`})
42
+
43
+ - **`Execution mode: sdd`**: **N=3** `Agent` calls (`qc-specialist`, `qc-specialist-2`, `qc-specialist-3`) — each prompt **Act as** the respective QC role, all `subagent_type: "coder"` (N rules → `parallel-dispatch.md`).
44
+ - **`inline`**: **N=1** per `parallel-dispatch.md`. Cannot emit required **N** → **`Blocked`**.
45
+ - SDD implement: one implementer `Agent` per task id; task reviewer = new `Agent` with **Act as `code-reviewer`** (Kimi L2; not qc-specialist*), generic fallback `subagent_type: "coder"` per C5 — no sticky resume unless the host adds it later.
46
+
47
+ ### zcode (`Agent` tool, `subagent_type` ∈ {`general-purpose`, …})
48
+
49
+ - **`Execution mode: sdd`**: **N=3** `Agent` calls (`qc-specialist`, `qc-specialist-2`, `qc-specialist-3`) — each prompt **Act as** the respective QC role, all `subagent_type: "general-purpose"` (N rules → `parallel-dispatch.md`).
50
+ - **`inline`**: **N=1** per `parallel-dispatch.md`. Cannot emit required **N** → **`Blocked`**.
51
+ - SDD implement: one implementer `Agent` per task id; task reviewer = new `Agent` with **Act as `code-reviewer`** (ZCode L2; not qc-specialist*), generic fallback `subagent_type: "general-purpose"` per C5 — no sticky resume unless the host adds it later.
52
+
53
+ ### dsh (`subagent` dispatches)
54
+
55
+ - **`Execution mode: sdd`**: **N=3** `subagent` dispatches — one per QC seat (`qc-specialist`, `qc-specialist-2`, `qc-specialist-3`), each body **Act as** the respective QC role + QC skill load. **MUST dispatch all three with `run_in_background: true` in one message** → the seats run CONCURRENTLY (background children; wall ≈ single seat); foreground (no `run_in_background`) runs serially (wall ≈ 3× single seat) and does NOT count as parallel tri. Cannot emit required **N** → **`Blocked`**.
56
+ - **`inline`**: **N=1**.
57
+ - SDD implement: one implementer `subagent` dispatch per task id; task reviewer = a separate dispatch (SDD review role) — no sticky resume unless the host's continuable-subagent id is available and recorded.
@@ -0,0 +1,186 @@
1
+ # Status v1→v2 field history (archived contract prose)
2
+
3
+ > Engine-absent fallback: the full field tables displaced from `mstar-plan-artifacts` when engine validators took over the same contract. Engine-present hosts read `mstar-plan-artifacts/references/status-and-residuals.md` (v2) instead; this file is the historical + fallback full text.
4
+
5
+ ## v1 `{HARNESS_DIR}/status.json` — full shape (historical)
6
+
7
+ `status.json` lived at `{HARNESS_DIR}/status.json` and was the **SSOT** for `plans[]` row status and open residual findings. Closed residuals were archived to `{HARNESS_DIR}/archived/residuals/<plan-id>.json`.
8
+
9
+ ```json
10
+ {
11
+ "version": 1,
12
+ "updated_at": "YYYY-MM-DD",
13
+ "plans": [
14
+ {
15
+ "id": "plan-id",
16
+ "title": "Plan title",
17
+ "file": "{PLAN_DIR}/plan-id-feature-name.md",
18
+ "status": "Todo | InProgress | InReview | Blocked | Done",
19
+ "owner": "@project-manager",
20
+ "agents": ["@fullstack-dev"],
21
+ "progress": 0,
22
+ "tags": [],
23
+ "created_at": "YYYY-MM-DD",
24
+ "updated_at": "YYYY-MM-DD",
25
+ "done_at": null,
26
+ "notes": "",
27
+ "metadata": {}
28
+ }
29
+ ],
30
+ "residual_findings": {
31
+ "plan-id": [
32
+ {
33
+ "id": "R1",
34
+ "title": "Finding title",
35
+ "severity": "critical | high | medium | low | nit",
36
+ "source": "QC-#1 qc1.md F-001 @ <review-range>, QA qa.md, review, …",
37
+ "scope": "Affected file or component",
38
+ "decision": "defer | accept | risk-accepted",
39
+ "owner": "@fullstack-dev",
40
+ "target": "Before plan 02 / YYYY-MM-DD / milestone",
41
+ "tracking": "Issue URL or null",
42
+ "detail_doc": "{PLAN_DIR}/residuals/plan-id/R1-short-label.md"
43
+ }
44
+ ]
45
+ },
46
+ "metadata": {}
47
+ }
48
+ ```
49
+
50
+ Closed residual entries added: `lifecycle`, `closed_at`, `closure_note`; optional `closure_evidence`, `superseded_by`.
51
+
52
+ ## v1 `plans[]` row fields
53
+
54
+ | Field | Meaning |
55
+ | --- | --- |
56
+ | `id` | Plan id (legacy alias `plan_id` read-compatible). |
57
+ | `title` / `file` | Display title / main plan path (`{PLAN_DIR}/…`). |
58
+ | `status` | `Todo \| InProgress \| InReview \| Blocked \| Done` (Done only by `@project-manager` / `@qa-engineer`). |
59
+ | `owner` / `agents` / `progress` / `tags` | PM ownership, role agents, progress 0–100, tags. |
60
+ | `created_at` / `updated_at` / `done_at` | `YYYY-MM-DD`; `done_at` set at Done. |
61
+ | `notes` | Per-plan timeline (string array recommended; legacy string OK). |
62
+ | `metadata` | Optional object (see below). |
63
+
64
+ ## v1 `plans[].metadata` standard optional fields
65
+
66
+ | Key | Type | Purpose |
67
+ | --- | --- | --- |
68
+ | `findings_cleanup` | `zero-residual` \| `allow-residual` | Mirror of Assignment `Findings cleanup`. |
69
+ | `working_branch` | string | Implementation branch; aligns with Assignment `Working branch` (SSOT). |
70
+ | `spec_integration_branch` | string | (Multi-plan same Spec) integration branch; created from root `metadata.iteration_base_branch`. |
71
+ | `merge_target` | string | Next merge target; final PR target is root `metadata.target_branch`. |
72
+ | `branch_policy` | string | One-line policy per `mstar-harness-core`. |
73
+ | `phase` / `priority` / `description` / `scope` | string | Program label; `high\|medium\|low`; one-line scope (pick one key per repo). |
74
+ | `gates` | object | Gate summary (`qc`, `qa`, `typecheck`, `tests`, `lint`, …). |
75
+ | `blocked_since` / `blocked_reason` / `blocked_by_plan_id` / `dependency` / `next_action` | string | Block bookkeeping + deps + next step. |
76
+ | `primary_spec` / `iteration_compass` / `iteration_refs` | string / string[] | Spec / compass pointers. |
77
+ | `qc_status` / `tests` / `commits` | string | InReview/Done snapshots — not a substitute for durable gate summaries or root `residual_findings`. |
78
+ | `sdd_dir` / `sdd_progress` / `review_bundle` / `task_commits` | string / array | SDD scratch path, progress ledger pointer, review bundle pointer, `{task_id,base,head}[]`. |
79
+
80
+ ### v1 `plans[].execution_lease` (iteration Phase 2)
81
+
82
+ | Field | Type | Required | Semantics |
83
+ | --- | --- | --- | --- |
84
+ | `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`. |
85
+ | `claimed_at` | RFC 3339 UTC (`Z`) | Yes | Acquisition time (audit only; **not** an expiry clock). |
86
+ | `worktree_path` | absolute path string | Yes | Dedicated feature-worktree root; **MUST** differ from `metadata.control_worktree_path`. |
87
+ | `working_branch` | non-empty string | Yes | Feature branch at `worktree_path`; MUST agree with Assignment `Working branch`. |
88
+ | `session_label` | string | No | Human display only — **MUST NOT** authorize or compare ownership. |
89
+
90
+ Writers **delete** `execution_lease` on release; `null` and tombstone objects are invalid.
91
+
92
+ ## v1 root `metadata` standard optional fields
93
+
94
+ | Key | Type | Purpose |
95
+ | --- | --- | --- |
96
+ | `versioning` | object | Cross-plan conventions (team-defined). |
97
+ | `iteration_base_branch` | string | Branch/ref used to create `spec_integration_branch`; required for formal iterations. |
98
+ | `target_branch` | string | Final PR target after iteration-close; required for formal iterations. |
99
+ | `notes` | array | **Legacy** — prefer `{HARNESS_DIR}/notes.json`. |
100
+ | `residual_findings_history` | object | **Legacy** — prefer `archived/residuals/<plan-id>.json`. |
101
+ | `tech_debt_summary` | object | Optional rollup over open R# (engine `techDebtRollup`). |
102
+ | `control_worktree_path` | absolute path string | Iteration Phase 2: canonical repository root checked out to active `spec_integration_branch`; coordination + serial merge cwd. |
103
+ | `integration_merge_lease` | object | While one integration merge is owned; **absent** = unclaimed. Writers **delete** the key on release — never `null`/tombstones. |
104
+
105
+ ## v1 residual entry contract (9 required fields + severity/lifecycle)
106
+
107
+ Entry keys mirroring engine `RESIDUAL_REQUIRED_FIELDS`: `id`, `title`, `severity`, `source`, `scope`, `decision`, `owner`, `target`, `tracking` (+ optional `detail_doc`). Malformed entries (non-object, missing any required field, or severity outside enum) were rejected fail-loud by `validateResidual` / `validateStatus` — never silent pass-through.
108
+
109
+ ### Severity (machine enum, lowercase English only)
110
+
111
+ `critical` > `high` > `medium` > `low` > `nit`. `nit` is always lighter than `low`. Forbidden in JSON: `warning`, `Major`, non-English. Legacy `"severity": "warning"` read+rolled up as `low`. QC report **Critical / Warning / Suggestion** are section titles — never copied verbatim into JSON.
112
+
113
+ ### Lifecycle states
114
+
115
+ `open` (default; omit field) · `resolved` · `waived` · `superseded` · `duplicate`. On close set `closed_at` (`YYYY-MM-DD`) + `closure_note`; recommend `closure_evidence` (PR/commit/test/doc anchor). Owners: fix → implementer; verify → QA (when `QA gate: mandatory`) else PM; write SSOT → PM or QA.
116
+
117
+ ## v1 archive shapes (historical)
118
+
119
+ **`archived/residuals/<plan-id>.json`** (append to `entries`):
120
+
121
+ ```json
122
+ {
123
+ "plan_id": "01-data-infrastructure",
124
+ "schema_version": 1,
125
+ "entries": [
126
+ {
127
+ "id": "R1",
128
+ "severity": "medium",
129
+ "lifecycle": "resolved",
130
+ "closed_at": "2026-04-06",
131
+ "closure_note": "…",
132
+ "closure_evidence": "PR #42 / commit …",
133
+ "archived_at": "2026-04-07"
134
+ }
135
+ ]
136
+ }
137
+ ```
138
+
139
+ **`{HARNESS_DIR}/notes.json`** (append-only program timeline):
140
+
141
+ ```json
142
+ { "schema_version": 1, "updated_at": "YYYY-MM-DD",
143
+ "entries": [{ "at": "2026-04-08", "message": "Short milestone", "plan_id": "01-data-infrastructure" }] }
144
+ ```
145
+
146
+ `plans[].notes` = per-plan timeline; `notes.json` = cross-plan milestones.
147
+
148
+ ## v1 jq / flock examples (legacy read paths)
149
+
150
+ ```bash
151
+ # Replace .mstar with your resolved {HARNESS_DIR}; legacy projects may use .agents.
152
+ jq '.plans[] | select(.id == "01-data-infrastructure")' .mstar/status.json
153
+ jq '.residual_findings["01-data-infrastructure"] // .metadata.residual_findings["01-data-infrastructure"]' .mstar/status.json
154
+ jq '.entries[] | select(.id == "R1")' .mstar/archived/residuals/01-data-infrastructure.json
155
+ ```
156
+
157
+ Legacy read paths (root `residual_findings` / `metadata.residual_findings` / `archived/residuals/<plan-id>.json`) were **legacy read-only**; `mstar migrate` moved open entries into the register.
158
+
159
+ ## v2 destinations (where each v1 surface landed)
160
+
161
+ | v1 surface | v2 home |
162
+ | --- | --- |
163
+ | root `plans[]` rows | `{WORKFLOW_DIR}/<id>/snapshot.json` → `plans[]` (legacy PlanRow shape verbatim) |
164
+ | root `plans[].execution_lease` | snapshot plan row `execution_lease` |
165
+ | root `metadata.integration_merge_lease` | snapshot top-level `integration_merge_lease` |
166
+ | root `metadata.control_worktree_path` | snapshot top-level `control_worktree_path` |
167
+ | root `metadata.iteration_base_branch` / `target_branch` / `spec_integration_branch` / `merge_target` | snapshot top-level `branch.{base,integration,target}` |
168
+ | root `metadata.plan_parallelism` / `worktree_mode` / `push_policy` | snapshot `execution_policy` |
169
+ | root `metadata.notes` / legacy row `notes` | `{WORKFLOW_DIR}/<id>/notes.jsonl` (runtime ledger; row `notes` kept verbatim as legacy copy) |
170
+ | root `residual_findings` | `{PROJECT_DIR}/<id>/residuals.json` → `entries[<plan-id>]` (array semantics preserved) |
171
+ | `archived/residuals/<plan-id>.json` | register **close in place** (lifecycle/closed_at/closure_note on the entry) |
172
+ | `metadata.tech_debt_summary` | derived `mstar status tech-debt <project-dir>` rollup (v1 stored drift path dead) |
173
+ | root `version: 1` | root `version: 2` + `workflows[]` (active-only registry; terminal rows removed after snapshot write) |
174
+ | v1 root `plans[]`/`residual_findings` trees | migrated first via `mstar migrate [--dry-run] [--path <root>]` |
175
+
176
+ Root v2 shape:
177
+
178
+ ```json
179
+ { "version": 2, "updated_at": "YYYY-MM-DD",
180
+ "workflows": [{ "id": "<plan-or-iteration-id>", "type": "plan | iteration", "started_at": "YYYY-MM-DD", "dir": "workflows/<id>" }] }
181
+ ```
182
+
183
+ ## Compatibility
184
+
185
+ - Read: accept `id` or `plan_id`; write: one canonical key (prefer `id`).
186
+ - Document the canonical key in `{HARNESS_DIR}/AGENTS.md` if migrating.
@@ -12,6 +12,7 @@ description: Morning Star (启明星) harness **强制全局入口** —— 信
12
12
  - 凡 **`mstar-*`**(`name` ≠ `mstar-harness-core`)假定读者**已 Read 本 skill**。
13
13
  - **仅读专题、未读核心** → 未完成 harness 加载。
14
14
  - 各专题 SKILL.md 含 **Load order**;按 **`mstar-harness-core`** 专题 skill 索引 + 角色 load contract 按需加载,**禁止**为「保险」通读全部专题。
15
+ - **加载条件(`mstar-engine-legacy`)**:`mstar-engine-legacy` 是**条件契约档案**(engine-absent fallback)。**engine 约束激活(或宿主含 engine 能力)时不加载**——engine-present 宿主以运行时 skills 的 engine-check 指针 + engine 校验为权威;仅 engine-absent 宿主(无 `mstar` CLI / engine import)为找回被 engine 校验接管的 contract 全文而读取(触发契约见其 description)。
15
16
 
16
17
  ## Standalone harness(`mstar-*` 自洽)
17
18
 
@@ -52,7 +53,7 @@ Routing eval(Cursor 插件内回归用,**非**运行时必读)→ `.cursor
52
53
  - **`Done`**:仅 `@project-manager` 或 `@qa-engineer`。
53
54
  - 实现类可设 **`InReview`**,不可设 **`Done`**。
54
55
 
55
- `status.json` 字段与 residual → **`mstar-plan-artifacts`**。
56
+ `status.json`(v2 根)/ workflow snapshot / project register 字段与 residual → **`mstar-plan-artifacts`**。
56
57
 
57
58
  ## Task category(路由摘要)
58
59
 
@@ -90,10 +91,12 @@ PM 在 Assignment 写 **`Task category`**(主类 + 可选 `secondary`):
90
91
  | `mstar-phase-gates` | per-plan 双阶段门禁:Prepare/Execute、意图门禁、hotfix、可验证编辑 |
91
92
  | `mstar-iteration` | 迭代管理:Phase 1–5(start / Autonomous Execute / iteration-close / PR delivery / PR merge-ready loop) |
92
93
  | `mstar-dispatch-gates` | 派发、Delegation、反递归、SDD 串行、SDD 路径 plan QC 强制 tri |
94
+ | `mstar-engine-legacy` | 条件契约档案(engine-absent fallback):status v1→v2 字段历史、lease 协议全文、各宿主 N=3/N=1 重述、反递归全清单、Engine-check 样板;engine 激活时不加载 |
93
95
  | `mstar-sdd` | Subagent-driven development:file handoff、per-task review、ledger |
94
96
  | `mstar-branch-worktree` | 功能分支、worktree、QC/QA 检出对齐 |
95
97
  | `mstar-plan-conventions` | `{HARNESS_DIR}` 发现、初始化、Spec 分支模型摘要、产物路径 SSOT |
96
- | `mstar-plan-artifacts` | 主 plan、review bundle / durable summaries、`status.json`、residual、knowledge、Done 归档 |
98
+ | `mstar-plan-artifacts` | 主 plan、review bundle / durable summaries、`status.json`(v2 根)+ workflow snapshots + project register、residual、knowledge |
99
+ | `mstar-project-governance` | 项目治理层:`projects/<id>/roadmap.md` 编写约定 + `residuals.json` register 生命周期(open → verified close in place)、`_default` 回退、provenance;schema 与 engine `project.ts` 逐字一致 |
97
100
  | `mstar-design-md` | DESIGN.md 设计系统规范 —— 创建/审计/维护 design tokens,三级检查清单,light/dark 双主题 |
98
101
  | `mstar-review-qc` | PM:QC tri 编排、residual 留档、四层边界;leaf 执行 → `mstar-roles/references/qc-specialist/` |
99
102
  | `mstar-coding-behavior` | Think / Simplicity / Surgical / Debugging / Review Feedback / Goal-Driven / Communication |
@@ -148,7 +151,7 @@ Read **`mstar-host`** after this skill; detect host per its table, then Read the
148
151
  | 因默认 gitignore 致 feature 缺 plans 而 `Worktree mode: waived`(应保留 feature worktree + control 绝对 Plan Path / SDD dir;无 flock 仅 → `Plan parallelism: serial`) | `mstar-branch-worktree` · `mstar-iteration` §2.0 #5 · `phase-2-worktree-lease` |
149
152
  | 并行 writable implement 无隔离(L2 同 plan 多轨:N invoke ≠ worktree;L1 跨 plan:无 verified `execution_lease` + feature worktree) | `mstar-branch-worktree` L1/L2 · `mstar-iteration` §2.6 · `references/parallel-writable-pre-dispatch.md` |
150
153
  | 跨 plan 可写派发无 verified `execution_lease` / steal 活跃 lease / 并行 merge 入 `spec_integration_branch` | `mstar-iteration` · `mstar-plan-artifacts`(leases)· `mstar-branch-worktree` L1 |
151
- | `InProgress` 无 `execution_lease` 未恢复即可写派发 | `mstar-plan-artifacts` — orphan recovery |
154
+ | `InProgress` 无 `execution_lease`(snapshot 行)未恢复即可写派发 | `mstar-plan-artifacts` — orphan recovery |
152
155
  | 混淆跨 plan lease 门控并行与单 plan 内 SDD 并行 implementer | `mstar-dispatch-gates` · `mstar-sdd` |
153
156
  | residual 只写 plan 不写 SSOT | `mstar-plan-artifacts` |
154
157
  | `zero-residual` 下把可修 findings 登记为 open R# / 草草 `Approve with residuals` | `mstar-plan-artifacts` Findings cleanup modes · `mstar-review-qc` |
@@ -6,13 +6,13 @@ Each per-host bridge (`cursor-plan-mode-bridge.md`, `kimi-plan-mode-bridge.md`,
6
6
 
7
7
  ## Dual-write SSOT rule
8
8
 
9
- The host **Plan mode** (session plan file, todos, UI) is a **session UX mirror**. Morning Star **SSOT** lives on disk under **`{HARNESS_DIR}`** (default `.mstar/`, legacy `.agents/`): the main plan in `{PLAN_DIR}/<plan-id>-<name>.md`, the plan registry in `{HARNESS_DIR}/status.json`, the iteration compass under `{ITERATION_DIR}/…` when in a formal iteration. Mirror every durable plan artifact to the repo; never treat the host plan file/URI/UI alone as the handoff surface.
9
+ The host **Plan mode** (session plan file, todos, UI) is a **session UX mirror**. Morning Star **SSOT** lives on disk under **`{HARNESS_DIR}`** (default `.mstar/`, legacy `.agents/`): the main plan in `{PLAN_DIR}/<plan-id>-<name>.md`, the plan registry in `{HARNESS_DIR}/status.json` (v2 root `workflows[]`) + per-lifecycle `{WORKFLOW_DIR}/<id>/snapshot.json` (`plans[]` rows + leases), the iteration compass under `{ITERATION_DIR}/…` when in a formal iteration. Mirror every durable plan artifact to the repo; never treat the host plan file/URI/UI alone as the handoff surface.
10
10
 
11
11
  ### Priority (hard)
12
12
 
13
13
  1. User explicit instructions (this turn)
14
14
  2. Project `AGENTS.md` / `CLAUDE.md`
15
- 3. **`{HARNESS_DIR}` / `{PLAN_DIR}` / `status.json`** (harness SSOT)
15
+ 3. **`{HARNESS_DIR}` / `{PLAN_DIR}` / `status.json` (v2) + workflow snapshot** (harness SSOT)
16
16
  4. Host session plan / todos / UI (session UX mirror) — the host bridge names its surfaces
17
17
 
18
18
  **NEVER** cite only a host plan path / session todo list / chat summary in Assignment **Plan Path**, **Context Loaded**, or Completion Report when `{PLAN_DIR}/<plan-id>-<name>.md` should exist.
@@ -21,7 +21,7 @@ The host **Plan mode** (session plan file, todos, UI) is a **session UX mirror**
21
21
 
22
22
  1. **Read** (minimum): `mstar-plan-conventions`, `mstar-plan-artifacts` (SKILL.md); Prepare gates from `mstar-phase-gates` if not hotfix.
23
23
  2. **Discover** `{HARNESS_DIR}` / `{PLAN_DIR}` per `mstar-plan-conventions` (prefer `.mstar/` + `.mstar/plans/`; reuse legacy `.agents/` only when already present and `.mstar/` is absent).
24
- 3. **Initialize** if absent: `{HARNESS_DIR}/`, `{PLAN_DIR}/`, `status.json` from `mstar-plan-artifacts/templates/status.empty.json`, `archived/residuals/`, Morning Star process-artifact gitignore set (canonical snippet → `mstar-plan-conventions` SKILL.md「Git 跟踪策略」). Full PM checklist: `mstar-roles/references/project-manager/plan-management.md`.
24
+ 3. **Initialize** if absent: `{HARNESS_DIR}/`, `{PLAN_DIR}/`, `status.json` from `mstar-plan-artifacts/templates/status.empty.json` (v2 shape), Morning Star process-artifact gitignore set (canonical snippet → `mstar-plan-conventions` SKILL.md「Git 跟踪策略」; `workflows/` / `projects/` subdirs are created on demand by engine writers, not pre-created). Full PM checklist: `mstar-roles/references/project-manager/plan-management.md`.
25
25
 
26
26
  ## Build resume contract
27
27
 
@@ -45,8 +45,8 @@ Not allowed in the parent Build session by default: product implementation, test
45
45
 
46
46
  | Todo ID (use in title) | Goal | On-disk outcome |
47
47
  |------------------------|------|-----------------|
48
- | **`harness-init`** | Bootstrap harness tree | `{HARNESS_DIR}/`, `{PLAN_DIR}/`, process-artifact gitignore set, `archived/residuals/`, `status.json` initialized |
49
- | **`spec-register`** | Register plan in SSOT | New `plans[]` row in `status.json` (`id`, `status`, `file`, `metadata`); spec stub in `{SPECS_DIR}` or plan frontmatter |
48
+ | **`harness-init`** | Bootstrap harness tree | `{HARNESS_DIR}/`, `{PLAN_DIR}/`, process-artifact gitignore set, `status.json` (v2) initialized (`workflows/` / `projects/` created on demand by engine writers) |
49
+ | **`spec-register`** | Register plan in SSOT | New root `workflows[]` entry (`{HARNESS_DIR}/status.json` v2) + `plans[]` row in `{WORKFLOW_DIR}/<id>/snapshot.json` (`id`, `status`, `file`, `metadata`); spec stub in `{SPECS_DIR}` or plan frontmatter |
50
50
  | **`mirror-plan`** | SSOT main plan file | `{PLAN_DIR}/<plan-id>-<name>.md` with task checkboxes aligned to the host plan body |
51
51
 
52
52
  After the host plan is created, keep the host plan body and mirror file **in sync** when scope changes (update both in the same coordination round).
@@ -57,7 +57,7 @@ After the host plan is created, keep the host plan body and mirror file **in syn
57
57
 
58
58
  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).
59
59
  2. **Plan checkbox**: Set `- [x]` on the matching line in `{PLAN_DIR}/<plan-id>-<name>.md`.
60
- 3. **status.json** (when PM round requires): bump `plans[].status` (e.g. `InProgress`) or append coordination notes per `mstar-plan-artifacts`.
60
+ 3. **status.json / snapshot** (when PM round requires): bump the snapshot plan row `plans[].status` (e.g. `InProgress`) or append coordination notes to `{WORKFLOW_DIR}/<id>/notes.jsonl` per `mstar-plan-artifacts`.
61
61
  4. **Evidence**: Record real `git log -1 --oneline` in Completion Report **Git** (or the plan-mode status note if executing as PM in Plan mode).
62
62
 
63
63
  **NEVER**
@@ -80,11 +80,11 @@ Dev-role NEVER rules also apply when executing as implementer: `mstar-roles/refe
80
80
 
81
81
  | Anti-pattern | Fix |
82
82
  |--------------|-----|
83
- | Host plan only, no `{HARNESS_DIR}` files | Run bootstrap todos; write mirror plan + status.json |
83
+ | Host plan only, no `{HARNESS_DIR}` files | Run bootstrap todos; write mirror plan + status.json/snapshot |
84
84
  | Todo done, no commit | Commit per task; paste `git log -1` evidence |
85
85
  | Drift between host plan and SSOT plan | Update both in same round |
86
86
  | Host plan URI as Plan Path | Use `{PLAN_DIR}/...` path |
87
- | Skip `spec-register` | Add `plans[]` row before implement |
87
+ | Skip `spec-register` | Add the snapshot `plans[]` row + root `workflows[]` entry before implement |
88
88
  | Build starts coding in the parent session | Resume PM context; dispatch implement work or block on missing Assignment |
89
89
  | Host plan approval treated as Done authority | Check harness plan/status/QC/QA gates first |
90
90
  | Resume starts coding from host chat summary | Reload harness context and SSOT plan/status first |
@@ -30,7 +30,7 @@ Use skill names in prompts and references. Avoid absolute local paths unless the
30
30
  - Codex does not imply an OpenCode-style `question` tool.
31
31
  - If a structured user-input tool is available in the active mode, use it for concise 1-3 choice decisions.
32
32
  - Otherwise ask one concise Markdown question only after codebase exploration cannot answer it.
33
- - `update_plan` / local todo UI is session progress only; it does not replace `{PLAN_DIR}` plans or `{HARNESS_DIR}/status.json`.
33
+ - `update_plan` / local todo UI is session progress only; it does not replace `{PLAN_DIR}` plans or `{HARNESS_DIR}/status.json` (v2 root `workflows[]`) + `{WORKFLOW_DIR}/<id>/snapshot.json` (`plans[]` rows).
34
34
  - Codex Goal Mode objective is completion criteria for the host thread, not Morning Star Done authority; mirror it into the SSOT plan when the work is implementation-sized.
35
35
 
36
36
  ## Dispatch and role execution
@@ -21,13 +21,24 @@ Bootstrap todos `harness-init` / `spec-register` / `mirror-plan` (emit first, in
21
21
 
22
22
  ### `spec-register` minimum fields
23
23
 
24
- Add one object to `status.json` `plans[]`:
24
+ Add a root `workflows[]` entry to `status.json` (v2) + one `plans[]` object to the workflow snapshot:
25
25
 
26
26
  ```json
27
+ // {HARNESS_DIR}/status.json (v2 root) — active lifecycle entry
28
+ {
29
+ "id": "<plan-id>",
30
+ "type": "plan",
31
+ "started_at": "YYYY-MM-DD",
32
+ "dir": "workflows/<plan-id>"
33
+ }
34
+ ```
35
+
36
+ ```json
37
+ // {WORKFLOW_DIR}/<plan-id>/snapshot.json — plan row (schema_version 1)
27
38
  {
28
39
  "id": "<plan-id>",
29
40
  "status": "Todo",
30
- "file": ".mstar/plans/<plan-id>-<short-name>.md",
41
+ "file": ".mstar/plans/<plan-id>-<short-name>.md",
31
42
  "metadata": {
32
43
  "primary_spec": "<spec-id or path if known>",
33
44
  "description": "<one-line summary>"
@@ -35,14 +46,14 @@ Add one object to `status.json` → `plans[]`:
35
46
  }
36
47
  ```
37
48
 
38
- Set `updated_at` on `status.json` to today (`YYYY-MM-DD`). Commit **tracked results** in the business repo when applicable: `{HARNESS_DIR}/AGENTS.md`, `{KNOWLEDGE_DIR}/`, `{SPECS_DIR}/` (default git policy — see `mstar-plan-conventions`). Do **not** default `git add` for `status.json`, `plans/`, or `iterations/`.
49
+ Set `updated_at` on `status.json` / the snapshot to today (`YYYY-MM-DD`). Commit **tracked results** in the business repo when applicable: `{HARNESS_DIR}/AGENTS.md`, `{KNOWLEDGE_DIR}/`, `{SPECS_DIR}/` (default git policy — see `mstar-plan-conventions`). Do **not** default `git add` for `status.json`, `workflows/`, `projects/`, `plans/`, or `iterations/`.
39
50
 
40
51
  ### `mirror-plan` minimum content
41
52
 
42
53
  - YAML or markdown frontmatter with `plan_id`, title, status (`Todo` / `InProgress` — not `Done` unless PM/QA authority).
43
54
  - **Task list** as markdown checkboxes (`- [ ]` / `- [x]`) matching CreatePlan implement todos.
44
55
  - **Roadmap / deferred scope** section when delivery is staged, partial, or uses a temporary workaround.
45
- - Link: “SSOT status: `{HARNESS_DIR}/status.json` → `plans[]` / `residual_findings`.”
56
+ - Link: “SSOT status: `{HARNESS_DIR}/status.json` (v2 `workflows[]`) → `{WORKFLOW_DIR}/<id>/snapshot.json` `plans[]`; open residuals → `{PROJECT_DIR}/<id>/residuals.json`.”
46
57
 
47
58
  After **CreatePlan**, keep CreatePlan body and mirror file **in sync** when scope changes (update both in the same coordination round).
48
59
 
@@ -76,8 +87,8 @@ Use this structure in CreatePlan `plan` markdown; mirror the same sections into
76
87
 
77
88
  ### Bootstrap (fixed prefix — complete before implement)
78
89
 
79
- 1. harness-init — init .mstar/, status.json, process-artifact gitignore set, archived/residuals/
80
- 2. spec-register — register plan_id in status.json; spec stub if applicable
90
+ 1. harness-init — init .mstar/, status.json (v2), process-artifact gitignore set
91
+ 2. spec-register — register the root `workflows[]` entry + snapshot plan row; spec stub if applicable
81
92
  3. mirror-plan — write .mstar/plans/<plan-id>-<short-name>.md
82
93
 
83
94
  ### Implement
@@ -104,7 +115,7 @@ Commit → SSOT checkbox → `status.json` sync → `git log -1 --oneline` evide
104
115
  Before switching from Plan to Agent for implementation (or declaring Plan phase complete):
105
116
 
106
117
  - [ ] `{PLAN_DIR}/<plan-id>-<name>.md` exists on disk
107
- - [ ] `status.json` contains `plans[]` entry with matching `id` and `file`
118
+ - [ ] Root `status.json` `workflows[]` contains the entry and `{WORKFLOW_DIR}/<id>/snapshot.json` contains the `plans[]` row with matching `id` and `file`
108
119
  - [ ] Bootstrap todos `harness-init`, `spec-register`, `mirror-plan` are **done**
109
120
  - [ ] CreatePlan implement todos reference **task ids** traceable to SSOT plan checkboxes
110
121
  - [ ] If staged/partial/temporary, CreatePlan and SSOT plan both contain `Roadmap / deferred scope`
@@ -139,7 +150,7 @@ When starting a **new iteration** under Cursor Plan mode (host command may orche
139
150
 
140
151
  **Single CreatePlan URI (HARD)**: one CreatePlan per Phase 1 Plan session. Updates use file edit tools on that path. If a duplicate plan file was created by mistake: merge into the original, delete the duplicate, keep View Plan on the original.
141
152
 
142
- **Bootstrap relationship**: ordinary per-plan work still uses `harness-init` / `spec-register` / `mirror-plan`. Phase 1 CreatePlan uses Phase 1 todos (`harness-init` → `finalize-compass-plans` → review-edit seats → `pm-lock` → `integration-branch`). Business `plans[]` rows should exist as drafts before Build when direction has converged.
153
+ **Bootstrap relationship**: ordinary per-plan work still uses `harness-init` / `spec-register` / `mirror-plan`. Phase 1 CreatePlan uses Phase 1 todos (`harness-init` → `finalize-compass-plans` → review-edit seats → `pm-lock` → `integration-branch`). Snapshot `plans[]` rows should exist as drafts before Build when direction has converged.
143
154
 
144
155
  **Helpers**: third-party interview helpers are **not** named here; host **command** layer may use them only after feedback-close when gaps remain.
145
156
 
@@ -12,7 +12,7 @@ Parallel PM dispatch: **`parallel-dispatch.md`** (Task tool uses same turn model
12
12
 
13
13
  ## Plan mode × harness dual-write
14
14
 
15
- When **Plan mode** is active, **CreatePlan is session UX**; SSOT is **`{HARNESS_DIR}`** (default `.mstar/`, legacy `.agents/`) — `{PLAN_DIR}/<plan-id>-<name>.md`, `{HARNESS_DIR}/status.json`.
15
+ When **Plan mode** is active, **CreatePlan is session UX**; SSOT is **`{HARNESS_DIR}`** (default `.mstar/`, legacy `.agents/`) — `{PLAN_DIR}/<plan-id>-<name>.md`, `{HARNESS_DIR}/status.json` (v2 root `workflows[]`) + `{WORKFLOW_DIR}/<id>/snapshot.json` (`plans[]` rows).
16
16
 
17
17
  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`**.
18
18
 
@@ -20,13 +20,13 @@ Before first **CreatePlan**: Read `mstar-plan-conventions`, `mstar-plan-artifact
20
20
 
21
21
  | Todo ID | Purpose |
22
22
  |---------|---------|
23
- | `harness-init` | Init `{HARNESS_DIR}`, `{PLAN_DIR}`, process-artifact gitignore set (`plans/`, `iterations/`, `sdd/`, `status.json`, …), `archived/residuals/`, `status.json` |
24
- | `spec-register` | Register `plan_id` in `status.json.plans[]` + spec stub if applicable |
23
+ | `harness-init` | Init `{HARNESS_DIR}`, `{PLAN_DIR}`, process-artifact gitignore set (`plans/`, `iterations/`, `sdd/`, `status.json`, `workflows/`, `projects/`, …), `status.json` (v2 template) |
24
+ | `spec-register` | Register the root `workflows[]` entry + snapshot plan row (`{WORKFLOW_DIR}/<id>/snapshot.json` → `plans[]`) + spec stub if applicable |
25
25
  | `mirror-plan` | Write SSOT main plan under `{PLAN_DIR}/` |
26
26
 
27
- Each **implement todo**: per–task-ID **git commit** on Working branch → SSOT `- [x]` → optional `status.json` sync → `git log -1 --oneline` evidence.
27
+ Each **implement todo**: per–task-ID **git commit** on Working branch → SSOT `- [x]` → optional snapshot sync → `git log -1 --oneline` evidence.
28
28
 
29
- 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
+ Before **SwitchMode → Agent**: mirror plan exists; snapshot lists `plan_id` + root `workflows[]` entry; bootstrap todos done. **Never** use only the Cursor plan URI as **Plan Path**.
30
30
 
31
31
  After **Build**: treat the run as plan resume, not `/pm` replay. Reload `mstar-harness-core` + this Cursor reference, resume Morning Star plans as `project-manager` orchestration, and dispatch implementation through Task unless the user explicitly overrides the harness.
32
32
 
@@ -295,11 +295,12 @@ The plugin wires the engine gates on dsh seams (all in-process):
295
295
 
296
296
  **Enforcement semantics**: warn-only by default. `Enforcement: hard` —
297
297
  resolved from the plugin Config (`enforcement: hard`), the Assignment header
298
- flag, or the iteration compass frontmatter escalates dispatch violations to
298
+ flag, the repo `.mstarc` `[config] enforcement`, or the iteration compass
299
+ frontmatter — escalates dispatch violations to
299
300
  a real veto; status/skill-lint writes are never hard-vetoed because the intent
300
301
  waterfall is content-blind (an already-invalid document is allowed as a
301
- repair escape). Config `soft` is the only local rollback. Hard gates are never
302
- a global default.
302
+ repair escape). Config / `.mstarc` `soft` are the local rollbacks. Hard gates
303
+ are never a global default.
303
304
 
304
305
  Every composed agent step carries ONE **`<mstar_engine_status>`** catalog
305
306
  message: the watermark (unified mstar version, harness dir, enforcement),
@@ -458,14 +459,16 @@ The dsh web client resolves slash commands against a client-side lexicon driven
458
459
 
459
460
  ## Harness dir and environment
460
461
 
461
- - `{HARNESS_DIR}` resolves via the engine `resolveHarnessDir` (`.mstar/` →
462
- `.agents/` → `.plans/`/`plans/`), with the plugin Config `harnessDir`
462
+ - `{HARNESS_DIR}` resolves via the engine `resolveHarnessDir` (`.mstarc`
463
+ `[config] harness_dir` → `.mstar/` → `.agents/` → `.plans/`/`plans/`),
464
+ with the plugin Config `harnessDir`
463
465
  override winning. The probe starts from the SESSION workspace root (the
464
466
  session cwd — **never the dsh launch/process cwd**) and **STOPS there** — it
465
467
  never walks above the session workspace, so the watermark and gates follow
466
468
  the workspace the session actually works in. Repos using a
467
- non-standard harness root (e.g. `.harness/`) MUST set Config `harnessDir`
468
- (absolute path) — the gates are inert without a resolvable harness dir.
469
+ non-standard harness root MUST set Config `harnessDir`
470
+ (absolute path) or declare it in a repo `.mstarc` — the gates are inert
471
+ without a resolvable harness dir.
469
472
  - The dispatch gate needs the dispatching agent's own role for the
470
473
  anti-recursion precheck: declare it via Config **`dispatchBinding`** (dsh
471
474
  exposes no per-agent role on the tool-execution context). Under hard
@@ -15,13 +15,13 @@ Kimi **Plan mode** (`EnterPlanMode` / `ExitPlanMode`, `/plan`, or `Shift-Tab`) u
15
15
 
16
16
  | Step | Kimi session | Harness SSOT |
17
17
  |------|--------------|--------------|
18
- | Enter | `EnterPlanMode` or `/plan on` — explore read-only | Ensure `{HARNESS_DIR}` exists; register `plan_id` in `status.json` when known |
18
+ | Enter | `EnterPlanMode` or `/plan on` — explore read-only | Ensure `{HARNESS_DIR}` exists; register the root `workflows[]` entry + snapshot plan row when known |
19
19
  | Design | Edit Kimi plan file with `Write` / `Edit` (when Plan mode allows writes) | Mirror main plan to `{PLAN_DIR}/<plan-id>-<name>.md` with task checkboxes |
20
20
  | Clarify | `AskUserQuestion` for blocking ambiguity only | Record decisions in plan / spec when durable |
21
- | Exit | `ExitPlanMode` — user approves plan to implement | SSOT plan locked; `status.json` row updated |
21
+ | Exit | `ExitPlanMode` — user approves plan to implement | SSOT plan locked; snapshot plan row updated |
22
22
  | Implement | Agent mode resumes | Per-task commits, Working branch, dispatch per `mstar-dispatch-gates` |
23
23
 
24
- `TodoList` and Kimi UI todos are **session progress only** — sync meaningful state to SSOT plan checkboxes and `status.json` when coordination requires it.
24
+ `TodoList` and Kimi UI todos are **session progress only** — sync meaningful state to SSOT plan checkboxes and the workflow snapshot (`{WORKFLOW_DIR}/<id>/snapshot.json` → `plans[]`) when coordination requires it.
25
25
 
26
26
  ## ExitPlanMode gate
27
27