@rosenfan/matrix 0.1.3 → 0.1.4

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 (35) hide show
  1. package/.claude/skills/matrix/SKILL.md +29 -34
  2. package/.claude/skills/matrix/scripts/matrix_state.py +11 -11
  3. package/.claude/skills/matrix-archive/SKILL.md +12 -12
  4. package/.claude/skills/matrix-build/SKILL.md +16 -13
  5. package/.claude/skills/matrix-claude/SKILL.md +10 -10
  6. package/.claude/skills/matrix-design/SKILL.md +19 -17
  7. package/.claude/skills/matrix-hotfix/SKILL.md +1 -1
  8. package/.claude/skills/matrix-open/SKILL.md +23 -21
  9. package/.claude/skills/matrix-status/SKILL.md +3 -3
  10. package/.claude/skills/matrix-tweak/SKILL.md +1 -1
  11. package/.claude/skills/matrix-verify/SKILL.md +39 -23
  12. package/README.md +78 -69
  13. package/README.zh-CN.md +77 -68
  14. package/assets/skills-zh-CN/matrix/SKILL.md +33 -33
  15. package/assets/skills-zh-CN/matrix-archive/SKILL.md +10 -10
  16. package/assets/skills-zh-CN/matrix-build/SKILL.md +13 -11
  17. package/assets/skills-zh-CN/matrix-claude/SKILL.md +10 -10
  18. package/assets/skills-zh-CN/matrix-design/SKILL.md +13 -11
  19. package/assets/skills-zh-CN/matrix-hotfix/SKILL.md +1 -1
  20. package/assets/skills-zh-CN/matrix-open/SKILL.md +19 -17
  21. package/assets/skills-zh-CN/matrix-status/SKILL.md +3 -3
  22. package/assets/skills-zh-CN/matrix-tweak/SKILL.md +1 -1
  23. package/assets/skills-zh-CN/matrix-verify/SKILL.md +27 -11
  24. package/package.json +1 -1
  25. package/src/catalog.js +31 -20
  26. package/src/cli.js +149 -91
  27. package/src/distribution.js +259 -136
  28. package/src/installer.js +10 -10
  29. package/src/matt-catalog.mjs +67 -0
  30. package/src/matt.js +115 -33
  31. package/src/messages.js +14 -10
  32. package/src/runtime-resolver.js +76 -0
  33. package/src/self-update.js +81 -81
  34. package/src/workflow-transaction.js +13 -9
  35. package/src/workflow.js +641 -388
package/README.md CHANGED
@@ -40,14 +40,14 @@ Matrix solves this with one deterministic state machine, explicit phases, guard
40
40
 
41
41
  ## What It Does
42
42
 
43
- Matrix provides two capability-orchestration modes over two centrally defined workflow profiles:
44
-
45
- ```
46
- full: open → design → build → verify → archive
47
- hotfix/tweak lightweight: open ─────────→ build → verify → archive
48
-
49
- Prim: Matrix performs phase work itself
50
- Arch: Matrix invokes verified atomic Skills only when task facts trigger them
43
+ Matrix provides two capability-orchestration modes over two centrally defined workflow profiles:
44
+
45
+ ```
46
+ full: open → design → build → verify → archive
47
+ hotfix/tweak lightweight: open ─────────→ build → verify → archive
48
+
49
+ Prim: Matrix performs phase work itself
50
+ Arch: Matrix invokes verified atomic Skills only when task facts trigger them
51
51
  ```
52
52
 
53
53
  Recovery paths are controlled Runtime intents:
@@ -69,10 +69,10 @@ Each phase:
69
69
 
70
70
  ## Prerequisites
71
71
 
72
- - [Claude Code](https://docs.anthropic.com/claude-code) and/or Codex installed as the Skill host
73
- - Node.js 18+ and `npm` on `PATH` (for the Matrix CLI)
74
- - Python is optional during the compatibility window; new installations use the bundled Node workflow runtime.
75
- - Git is only needed when installing from GitHub or contributing to Matrix.
72
+ - [Claude Code](https://docs.anthropic.com/claude-code) and/or Codex installed as the Skill host
73
+ - Node.js 18+ and `npm` on `PATH` (for the Matrix CLI)
74
+ - Python is optional during the compatibility window; new installations use the bundled Node workflow runtime.
75
+ - Git is only needed when installing from GitHub or contributing to Matrix.
76
76
 
77
77
  ---
78
78
 
@@ -91,48 +91,53 @@ cd /path/to/your/project
91
91
  matrix init
92
92
  ```
93
93
 
94
- The interactive setup lets you:
94
+ The interactive setup lets you:
95
95
 
96
- - Choose English or Chinese, project or global scope, and Claude Code, Codex, or both
96
+ - Choose English or Chinese, project or global Matrix discovery scope, and Claude Code, Codex, or both
97
97
  - Copy skills (recommended) or symlink them for local development
98
- - Safely reconfigure an existing installation with an automatic backup
99
- - Install Matt Pocock's companion skills in the same flow
98
+ - Safely reconfigure an existing installation with an automatic backup
99
+ - Review all 25 official Matt Skills v1.2.3 roles and install the 23 compatible Skills into the target project
100
100
  - Choose **Prim** or **Arch** as the project default without disabling the other available mode
101
101
 
102
- For automation and CI:
102
+ For automation and CI:
103
103
 
104
104
  ```bash
105
105
  # Safe non-interactive installation for both verified platforms
106
106
  matrix init --yes --platform claude-code --platform codex --with-mattpocock
107
107
 
108
- # Explicitly select the project default
109
- matrix init --yes --with-mattpocock --default-orchestration arch
108
+ # Explicitly select the project default
109
+ matrix init --yes --with-mattpocock --default-orchestration arch
110
+
111
+ # Replace locally modified Matt Skills only after an explicit backup authorization
112
+ matrix init --yes --with-mattpocock --force-matt
110
113
 
111
114
  # Preview exactly what would change (including backups) without writing
112
115
  matrix init --platform codex --dry-run --json
113
116
 
114
- # Inspect Matrix ownership, Matt Skills inheritance, and the selected platform
117
+ # Inspect Matrix ownership, project-local Matt compatibility, and the selected platform
115
118
  matrix doctor --platform codex
116
- ```
117
-
118
- Update an initialized project:
119
-
120
- ```bash
121
- # Check for a newer Matrix CLI, confirm the plan, then refresh this project's installed assets
122
- matrix update
123
-
124
- # Offline or local-development refresh: skip the npm registry and use the current CLI package
125
- matrix update --skip-self-update
126
-
127
- # Non-interactive update after CI has explicitly authorized writes
128
- matrix update --yes
129
- ```
130
-
131
- `matrix update` preserves the installation's scope, platforms, language, mode, and orchestration. It first validates a newer npm package in isolation, then re-runs the new CLI to refresh project assets. npm and project assets are separate transactions: if asset refresh fails after a CLI upgrade, run `matrix update --skip-self-update` to retry. Use `matrix init` to change installation choices, and `matrix doctor` for read-only diagnosis.
132
-
133
- The language selected by `matrix init` controls the prose in new Matrix artifacts. Markdown headings required by Matrix guards remain stable English tokens; the artifact body is Chinese for `zh-CN` and English for `en`. A change freezes this language at creation time.
119
+ ```
120
+
121
+ Update an initialized project:
122
+
123
+ ```bash
124
+ # Check for a newer Matrix CLI, confirm the plan, then refresh this project's installed assets
125
+ matrix update
126
+
127
+ # Offline or local-development refresh: skip the npm registry and use the current CLI package
128
+ matrix update --skip-self-update
129
+
130
+ # Non-interactive update after CI has explicitly authorized writes
131
+ matrix update --yes
132
+ ```
133
+
134
+ `matrix update` preserves the installation's scope, platforms, language, mode, and orchestration. It first validates a newer npm package in isolation, then re-runs the new CLI to refresh Matrix assets. It never downloads, installs, repairs, or deletes Matt Skills; after the Matrix update it reports the local Matt compatibility status and, when needed, points to `matrix init . --with-mattpocock`. npm and project assets are separate transactions: if asset refresh fails after a CLI upgrade, run `matrix update --skip-self-update` to retry.
134
135
 
135
- To install directly from GitHub instead of npm:
136
+ Matrix 0.1.4 is bound to Matt Skills v1.2.3 at commit `6acc160e4e0cd062dbbbd7a1b26ae92855edf07e`. `matrix init --with-mattpocock` always uses that exact archive and its reviewed 23-Skill compatible manifest, even if upstream has a newer release. The two official but incompatible Skills, `implement` and raw `resolving-merge-conflicts`, are not Matrix-managed or installed. Matrix scope controls Matrix Skill discovery only: Matt Skills and `.matrix/matt-installation.json` are always project-local. Global Matt copies are preserved but never used to complete project readiness.
137
+
138
+ The language selected by `matrix init` controls the prose in new Matrix artifacts. Markdown headings required by Matrix guards remain stable English tokens; the artifact body is Chinese for `zh-CN` and English for `en`. A change freezes this language at creation time.
139
+
140
+ To install directly from GitHub instead of npm:
136
141
 
137
142
  ```bash
138
143
  npm install --global github:Rosenfan/Matrix
@@ -174,9 +179,9 @@ Matrix will:
174
179
  | Phase | Arch capabilities (triggered, not a fixed sequence) | Deliverables | Guard Condition |
175
180
  |-------|------------------------------------------------------|--------------|-----------------|
176
181
  | **open** | `/grilling`, `/domain-modeling` | `proposal.md`; optional repository-standard context/ADR evidence | Goal, Scope, Non-goals, Acceptance, Risks present |
177
- | **design** | `/domain-modeling`, `/research`, `/wayfinder`, `/prototype`, `/codebase-design` | `design.md`, `plan.md` | Decisions, Test seams, Steps documented |
178
- | **build** | `/tdd`, `/diagnosing-bugs`, `/resolving-merge-conflicts` | Code, `verification.md` | Exact approved Contract matches; build evidence recorded |
179
- | **verify** | `/code-review` | Test & review evidence | Test and review evidence present |
182
+ | **design** | `/domain-modeling`, `/research`, `/prototype`, `/codebase-design`, conditional `/writing-for-agents` | `design.md`, `plan.md` | Decisions, Test seams, Steps documented |
183
+ | **build** | `/tdd`, `/diagnosing-bugs`, conditional `/writing-for-agents` and generate-only `/wizard` | Code, `verification.md` | Exact approved Contract matches; build evidence recorded |
184
+ | **verify** | `/code-review` | Test evidence, two-axis review, Arch receipt | Evidence is substantive; Arch receipt matches the current Contract, review, and workspace |
180
185
  | **archive** | None; Matrix-owned in both modes | Archive record | Verify guard passed |
181
186
 
182
187
  ---
@@ -191,9 +196,9 @@ State is stored in `.matrix/`:
191
196
  ├── config.yaml
192
197
  ├── changes/
193
198
  │ └── <change-id>/
194
- │ ├── matrix.yaml # Canonical workflow, orchestration, phase, status, revision
195
- │ ├── workspace-baseline.json # Lightweight implementation-order boundary
196
- │ ├── events.jsonl
199
+ │ ├── matrix.yaml # Canonical workflow, orchestration, phase, status, revision
200
+ │ ├── workspace-baseline.json # Lightweight implementation-order boundary
201
+ │ ├── events.jsonl
197
202
  │ └── artifacts/
198
203
  │ ├── proposal.md
199
204
  │ ├── design.md
@@ -209,12 +214,12 @@ The state machine enforces transitions:
209
214
  # Check guard
210
215
  matrix workflow guard open
211
216
 
212
- # Advance (only if guard passes)
213
- matrix workflow transition design
214
-
215
- # Lightweight: approve the compact proposal and enter Build
216
- matrix workflow transition build --confirmed
217
-
217
+ # Advance (only if guard passes)
218
+ matrix workflow transition design
219
+
220
+ # Lightweight: approve the compact proposal and enter Build
221
+ matrix workflow transition build --confirmed
222
+
218
223
  # Return from verification failure; stale evidence is retained in history
219
224
  matrix workflow return build --reason verification-failed
220
225
 
@@ -223,8 +228,8 @@ matrix workflow abort --reason requirement-cancelled
223
228
 
224
229
  # Final Archive is a mandatory two-step optimistic commit
225
230
  matrix workflow archive --dry-run
226
- matrix workflow archive --expect-preflight <sha256-returned-by-dry-run>
227
- # hotfix/tweak commit command additionally carries --confirmed
231
+ matrix workflow archive --expect-preflight <sha256-returned-by-dry-run>
232
+ # hotfix/tweak commit command additionally carries --confirmed
228
233
 
229
234
  # Diagnose an interrupted Workflow without writing
230
235
  matrix workflow doctor
@@ -234,7 +239,7 @@ matrix workflow doctor --repair --transaction <id> --strategy <continue|rollback
234
239
  matrix workflow doctor --repair --lock <id>
235
240
  ```
236
241
 
237
- `matrix.yaml` is the only canonical workflow/orchestration/phase/status/revision record, using `matrix/change/v2`. Full approval binds the exact bytes of proposal/design/plan. Lightweight approval binds the compact proposal, requires explicit confirmation, and compares the project with its initialization baseline so implementation cannot precede approval. Contract drift blocks later phases. Final Archive uses a read-only dry-run and hash-bound commit; shortcut workflows additionally require explicit confirmation. Multi-file mutations remain protected by durable journals.
242
+ `matrix.yaml` is the only canonical workflow/orchestration/phase/status/revision record, using `matrix/change/v2`. Full approval binds the exact bytes of proposal/design/plan. Lightweight approval binds the compact proposal, requires explicit confirmation, and compares the project with its initialization baseline so implementation cannot precede approval. Contract drift blocks later phases. Final Archive uses a read-only dry-run and hash-bound commit; shortcut workflows additionally require explicit confirmation. Multi-file mutations remain protected by durable journals.
238
243
 
239
244
  ---
240
245
 
@@ -244,10 +249,10 @@ matrix workflow doctor --repair --lock <id>
244
249
  |------|-------------|--------|
245
250
  | **full** | New features, architecture changes | All 5 phases |
246
251
  | **hotfix** | Reproducible small bugs | Simplified: open → build → verify → archive |
247
- | **tweak** | Bounded changes, no API/schema impact | Simplified: open → build → verify → archive |
248
-
249
- Hotfix and tweak reference the same internal `lightweight` transition profile. They differ only in routing and evidence: hotfix requires reproduction/root-cause/regression evidence; tweak requires behavior-boundary, diff, and scope-review evidence.
250
-
252
+ | **tweak** | Bounded changes, no API/schema impact | Simplified: open → build → verify → archive |
253
+
254
+ Hotfix and tweak reference the same internal `lightweight` transition profile. They differ only in routing and evidence: hotfix requires reproduction/root-cause/regression evidence; tweak requires behavior-boundary, diff, and scope-review evidence.
255
+
251
256
  ---
252
257
 
253
258
  ## Special Feature: matrix-claude
@@ -280,28 +285,32 @@ The sidecar does NOT change Matrix state. It's a pure export — like taking a s
280
285
 
281
286
  ## Integration with Matt Pocock's Skills
282
287
 
283
- Prim uses Matrix's own capability. Arch uses one initialization-verified cohort of ten atomic capabilities:
288
+ Prim uses Matrix's own capability. Matrix reviews all 25 official Matt v1.2.3 roles, installs the 23 compatible Skills, and lets Arch automatically invoke only this reviewed ten-capability cohort:
284
289
 
285
290
  | Phase | Capability | Trigger |
286
291
  |---|---|---|
287
292
  | open | `/grilling` | Material ambiguity or explicit stress-test request |
288
293
  | open/design | `/domain-modeling` | Unclear vocabulary, invariants, or architectural decisions |
289
294
  | design | `/research` | Required external facts are unavailable in the repository |
290
- | design | `/wayfinder` | Module ownership or dependency seams are unknown |
291
- | design | `/prototype` | A material design question needs disposable evidence |
292
- | design | `/codebase-design` | A deep-module, interface, or test-seam decision remains |
293
- | build | `/tdd` | Observable behavior changes at a testable seam |
294
- | build | `/diagnosing-bugs` | An actual failure exists and root cause is unknown |
295
- | build | `/resolving-merge-conflicts` | A merge or rebase conflict is in progress |
296
- | verify | `/code-review` | Standards and Spec review evidence is required |
297
-
298
- `grill-with-docs`, `implement`, and `improve-codebase-architecture` are not Matrix-managed or automatically invoked. Existing user-installed copies are preserved as unmanaged extras. A companion never transitions, commits, archives, or writes Matrix state.
295
+ | design | `/prototype` | A material design question needs disposable evidence |
296
+ | design | `/codebase-design` | A deep-module, interface, or test-seam decision remains |
297
+ | design/build | `/writing-for-agents` | The Contract changes agent-facing instructions or pointer-reached documents |
298
+ | build | `/tdd` | Observable behavior changes at a testable seam |
299
+ | build | `/diagnosing-bugs` | An actual failure exists and root cause is unknown |
300
+ | build | `/wizard` | The Contract requires generated human-run shell steps; Matrix never runs them end-to-end |
301
+ | verify | `/code-review` | Standards and Spec review evidence is required |
302
+
303
+ Matrix may recommend but never nest these user-invoked handoffs: `setup-matt-pocock-skills`, `improve-codebase-architecture`, `wayfinder`, `handoff`, and `to-questionnaire`. The user explicitly runs them outside the active phase; selected output may enter a governed Change.
304
+
305
+ Arch records a Runtime-managed review receipt after `code-review`, binding its fixed point and committed HEAD diff to the current Contract, review evidence, and workspace. A normal `code-review` receipt requires a clean candidate worktree outside Matrix-managed assets. When Git has no usable baseline, the committed diff is empty, staged/unstaged/untracked candidate files still exist, or the correctly installed capability fails, Matrix may perform one explicitly labelled same-capability fallback for that revision. The `uncommitted-worktree` fallback binds both the fixed point and a content hash of the complete worktree candidate. Installation-integrity failures never fall back. A heading or self-description without the matching receipt cannot advance Verify.
306
+
307
+ Installed standalone Skills are `ask-matt`, `grill-with-docs`, `triage`, `to-spec`, `to-tickets`, `grill-me`, `teach`, and `wait-what`. `implement` and raw `resolving-merge-conflicts` are incompatible because they can take over TDD/review/staging/commit effects owned by Matrix, so 0.1.4 neither installs nor manages them. Pre-existing copies are preserved and reported as unmanaged extras. Installation never grants automatic invocation, and no companion may transition, commit, archive, recover, or write Matrix state.
299
308
 
300
309
  ---
301
310
 
302
311
  **Key difference**: Matt Pocock's skills are individual tools. Matrix adds:
303
312
  - **State persistence**: Survives context loss
304
- - **Phase enforcement**: Full cannot skip Design; lightweight cannot edit implementation before its confirmed Open Contract
313
+ - **Phase enforcement**: Full cannot skip Design; lightweight cannot edit implementation before its confirmed Open Contract
305
314
  - **Evidence requirements**: Guards check for artifacts, not assertions
306
315
  - **Transition logging**: Full audit trail of phase changes
307
316
 
package/README.zh-CN.md CHANGED
@@ -40,14 +40,14 @@ Matrix 通过唯一的确定性状态机解决这些问题 —— 包含明确
40
40
 
41
41
  ## 它做了什么
42
42
 
43
- Matrix 在集中定义的两种 workflow profile 上提供两种能力编排:
44
-
45
- ```
46
- full: open → design → build → verify → archive
47
- hotfix/tweak lightweight:open ─────────→ build → verify → archive
48
-
49
- Prim:Matrix 使用自身能力
50
- Arch:仅在任务事实满足触发条件时调用已验证的原子 Skill
43
+ Matrix 在集中定义的两种 workflow profile 上提供两种能力编排:
44
+
45
+ ```
46
+ full: open → design → build → verify → archive
47
+ hotfix/tweak lightweight:open ─────────→ build → verify → archive
48
+
49
+ Prim:Matrix 使用自身能力
50
+ Arch:仅在任务事实满足触发条件时调用已验证的原子 Skill
51
51
  ```
52
52
 
53
53
  恢复路径由 Runtime 受控执行:
@@ -69,10 +69,10 @@ verify --acceptance-or-design-gap------> design
69
69
 
70
70
  ## 前置条件
71
71
 
72
- - 已安装 [Claude Code](https://docs.anthropic.com/claude-code) 和/或 Codex,作为 Skill 宿主
73
- - Node.js 18+,且 `npm` 已加入 PATH(用于 Matrix CLI)
74
- - Python 仅在兼容窗口内的旧适配器路径使用;新安装使用内置 Node workflow runtime
75
- - Git 仅在从 GitHub 安装或参与 Matrix 开发时需要
72
+ - 已安装 [Claude Code](https://docs.anthropic.com/claude-code) 和/或 Codex,作为 Skill 宿主
73
+ - Node.js 18+,且 `npm` 已加入 PATH(用于 Matrix CLI)
74
+ - Python 仅在兼容窗口内的旧适配器路径使用;新安装使用内置 Node workflow runtime
75
+ - Git 仅在从 GitHub 安装或参与 Matrix 开发时需要
76
76
 
77
77
  ---
78
78
 
@@ -93,10 +93,10 @@ matrix init
93
93
 
94
94
  交互式初始化支持:
95
95
 
96
- - 选择安装到当前项目或全局
96
+ - 选择 Matrix Skill 发现入口安装到当前项目或全局
97
97
  - 复制 skills(推荐)或为本地开发创建符号链接
98
- - 安全地重新配置已有安装,并自动备份被替换的 Matrix 文件
99
- - 在同一流程中安装 Matt Pocock 的配套 skills
98
+ - 安全地重新配置已有安装,并自动备份被替换的 Matrix 文件
99
+ - 审查 Matt Skills v1.2.3 官方 25 项角色,并在目标项目安装其中 23 项兼容 Skill
100
100
  - 选择 Prim 或 Arch 作为项目默认值,且不禁用另一种可用模式
101
101
 
102
102
  自动化或 CI 环境可以使用:
@@ -105,31 +105,36 @@ matrix init
105
105
  # 使用推荐的项目级默认值,不显示交互问题
106
106
  matrix init --yes --with-mattpocock
107
107
 
108
- # 显式选择项目默认编排
109
- matrix init --yes --with-mattpocock --default-orchestration arch
110
-
111
- # 检查安装完整性和运行环境
112
- matrix doctor
113
- ```
114
-
115
- 更新已经初始化的项目:
116
-
117
- ```bash
118
- # 检查新版 Matrix CLI,确认计划后更新 CLI 并同步当前项目资产
119
- matrix update
120
-
121
- # 离线或本地开发:不访问 npm registry,只用当前 CLI 同步资产
122
- matrix update --skip-self-update
108
+ # 显式选择项目默认编排
109
+ matrix init --yes --with-mattpocock --default-orchestration arch
123
110
 
124
- # 已在自动化中明确授权写入
125
- matrix update --yes
126
- ```
127
-
128
- `matrix update` 会保留既有安装的 scope、平台、语言、mode 与 orchestration。它先隔离验证 npm 新包,再由新 CLI 同步项目资产。npm 与项目资产是两个事务:若 CLI 已更新但资产同步失败,可运行 `matrix update --skip-self-update` 重试。修改安装选择请使用 `matrix init`;只读诊断请使用 `matrix doctor`。
129
-
130
- `matrix init` 选择的语言决定新 Matrix 产物的正文语言:`zh-CN` 使用中文、`en` 使用英文。Runtime 守卫依赖的 Markdown 英文标题 token 保持不变;每个 change 在创建时冻结该语言。
111
+ # 只有明确授权备份后才替换被本地修改的 Matt Skills
112
+ matrix init --yes --with-mattpocock --force-matt
113
+
114
+ # 检查安装完整性和运行环境
115
+ matrix doctor
116
+ ```
117
+
118
+ 更新已经初始化的项目:
119
+
120
+ ```bash
121
+ # 检查新版 Matrix CLI,确认计划后更新 CLI 并同步当前项目资产
122
+ matrix update
123
+
124
+ # 离线或本地开发:不访问 npm registry,只用当前 CLI 同步资产
125
+ matrix update --skip-self-update
126
+
127
+ # 已在自动化中明确授权写入
128
+ matrix update --yes
129
+ ```
130
+
131
+ `matrix update` 会保留既有安装的 scope、平台、语言、mode 与 orchestration。它先隔离验证 npm 新包,再由新 CLI 同步 Matrix 资产;它绝不下载、安装、修复或删除 Matt Skills。Matrix 更新完成后只读报告项目 Matt 兼容状态,必要时提示 `matrix init . --with-mattpocock`。npm 与项目资产是两个事务:若 CLI 已更新但资产同步失败,可运行 `matrix update --skip-self-update` 重试。
131
132
 
132
- 也可以直接从 GitHub 安装,而不是 npm:
133
+ Matrix 0.1.4 固定对应 Matt Skills v1.2.3,commit 为 `6acc160e4e0cd062dbbbd7a1b26ae92855edf07e`。即使上游已有新版,`matrix init --with-mattpocock` 仍使用该确切 archive 与经过审查的 23 项兼容 manifest。官方角色中的 `implement` 与 raw `resolving-merge-conflicts` 不兼容,因此 Matrix 不安装也不管理它们。Matrix scope 只控制 Matrix Skill 的发现位置;Matt Skills 与 `.matrix/matt-installation.json` 始终属于目标项目。全局 Matt 副本会保留,但绝不用于补齐项目 readiness。
134
+
135
+ `matrix init` 选择的语言决定新 Matrix 产物的正文语言:`zh-CN` 使用中文、`en` 使用英文。Runtime 守卫依赖的 Markdown 英文标题 token 保持不变;每个 change 在创建时冻结该语言。
136
+
137
+ 也可以直接从 GitHub 安装,而不是 npm:
133
138
 
134
139
  ```bash
135
140
  npm install --global github:Rosenfan/Matrix
@@ -171,9 +176,9 @@ Matrix 将会:
171
176
  | 阶段 | Arch 能力(按事实触发,不是固定序列) | 交付物 | 守卫条件 |
172
177
  |------|----------------------------------------|--------|----------|
173
178
  | **open** | `/grilling`、`/domain-modeling` | `proposal.md`;可选仓库约定的 context/ADR 证据 | 目标、范围、验收标准、风险存在 |
174
- | **design** | `/domain-modeling`、`/research`、`/wayfinder`、`/prototype`、`/codebase-design` | `design.md`、`plan.md` | 决策、测试点、步骤已记录 |
175
- | **build** | `/tdd`、`/diagnosing-bugs`、`/resolving-merge-conflicts` | 代码、`verification.md` | 已批准的精确 Contract 匹配,且已记录构建证据 |
176
- | **verify** | `/code-review` | 测试和审查证据 | 测试和审查证据存在 |
179
+ | **design** | `/domain-modeling`、`/research`、`/prototype`、`/codebase-design`、条件触发的 `/writing-for-agents` | `design.md`、`plan.md` | 决策、测试点、步骤已记录 |
180
+ | **build** | `/tdd`、`/diagnosing-bugs`、条件触发的 `/writing-for-agents` 与仅生成的 `/wizard` | 代码、`verification.md` | 已批准的精确 Contract 匹配,且已记录构建证据 |
181
+ | **verify** | `/code-review` | 测试证据、双轴审查、Arch 回执 | 证据内容充分;Arch 回执匹配当前 Contract、审查正文和工作区 |
177
182
  | **archive** | 无;两种模式均由 Matrix 拥有 | 归档记录 | 验证守卫通过 |
178
183
 
179
184
  ---
@@ -188,9 +193,9 @@ Matrix 将会:
188
193
  ├── config.yaml
189
194
  ├── changes/
190
195
  │ └── <change-id>/
191
- │ ├── matrix.yaml # 唯一 workflow、orchestration、阶段、状态与 revision 事实
192
- │ ├── workspace-baseline.json # lightweight 的实施顺序边界
193
- │ ├── events.jsonl
196
+ │ ├── matrix.yaml # 唯一 workflow、orchestration、阶段、状态与 revision 事实
197
+ │ ├── workspace-baseline.json # lightweight 的实施顺序边界
198
+ │ ├── events.jsonl
194
199
  │ └── artifacts/
195
200
  │ ├── proposal.md
196
201
  │ ├── design.md
@@ -206,12 +211,12 @@ Matrix 将会:
206
211
  # 检查守卫
207
212
  matrix workflow guard open
208
213
 
209
- # 推进(仅在守卫通过时)
210
- matrix workflow transition design
211
-
212
- # lightweight:确认紧凑 proposal 后进入 Build
213
- matrix workflow transition build --confirmed
214
-
214
+ # 推进(仅在守卫通过时)
215
+ matrix workflow transition design
216
+
217
+ # lightweight:确认紧凑 proposal 后进入 Build
218
+ matrix workflow transition build --confirmed
219
+
215
220
  # 验证失败时返回 Build;旧证据保留在历史目录
216
221
  matrix workflow return build --reason verification-failed
217
222
 
@@ -220,8 +225,8 @@ matrix workflow abort --reason requirement-cancelled
220
225
 
221
226
  # 最终归档强制使用两步乐观提交
222
227
  matrix workflow archive --dry-run
223
- matrix workflow archive --expect-preflight <dry-run-返回的-sha256>
224
- # hotfix/tweak 的提交命令还必须带 --confirmed
228
+ matrix workflow archive --expect-preflight <dry-run-返回的-sha256>
229
+ # hotfix/tweak 的提交命令还必须带 --confirmed
225
230
 
226
231
  # 只读诊断中断的 Workflow
227
232
  matrix workflow doctor
@@ -231,7 +236,7 @@ matrix workflow doctor --repair --transaction <id> --strategy <continue|rollback
231
236
  matrix workflow doctor --repair --lock <id>
232
237
  ```
233
238
 
234
- `matrix.yaml` 仍是 workflow、orchestration、阶段、状态与 revision 的唯一事实来源。full 批准 proposal/design/plan 的精确字节;lightweight 批准紧凑 proposal,要求明确确认,并与初始化工作区基线比较,阻止先实现后补方案。Contract 漂移会阻断后续阶段。最终 Archive 仍使用只读 dry-run 与 hash-bound commit,shortcut 还要求明确确认;所有多文件 mutation 继续受持久 journal 保护。
239
+ `matrix.yaml` 仍是 workflow、orchestration、阶段、状态与 revision 的唯一事实来源。full 批准 proposal/design/plan 的精确字节;lightweight 批准紧凑 proposal,要求明确确认,并与初始化工作区基线比较,阻止先实现后补方案。Contract 漂移会阻断后续阶段。最终 Archive 仍使用只读 dry-run 与 hash-bound commit,shortcut 还要求明确确认;所有多文件 mutation 继续受持久 journal 保护。
235
240
 
236
241
  ---
237
242
 
@@ -241,10 +246,10 @@ matrix workflow doctor --repair --lock <id>
241
246
  |------|----------|------|
242
247
  | **full** | 新功能、架构变更 | 全部 5 个阶段 |
243
248
  | **hotfix** | 可复现的小型 Bug | 简化:open → build → verify → archive |
244
- | **tweak** | 有界变更,无 API/架构影响 | 简化:open → build → verify → archive |
245
-
246
- hotfix 与 tweak 引用同一个内部 `lightweight` 迁移 profile,只在入口和证据上区分:hotfix 要求复现、根因、回归证据;tweak 要求行为边界、diff 与范围审查证据。
247
-
249
+ | **tweak** | 有界变更,无 API/架构影响 | 简化:open → build → verify → archive |
250
+
251
+ hotfix 与 tweak 引用同一个内部 `lightweight` 迁移 profile,只在入口和证据上区分:hotfix 要求复现、根因、回归证据;tweak 要求行为边界、diff 与范围审查证据。
252
+
248
253
  ---
249
254
 
250
255
  ## 特别功能:matrix-claude
@@ -277,28 +282,32 @@ $matrix → open → design → build → verify → archive
277
282
 
278
283
  ## 与 Matt Pocock Skills 的集成
279
284
 
280
- Prim 使用 Matrix 自身能力。Arch 使用初始化时验证的十项原子能力:
285
+ Prim 使用 Matrix 自身能力。Matrix 会审查 Matt v1.2.3 官方 25 项角色,安装其中 23 项兼容 Skill,但 Arch 只自动调用以下十项经过审查的能力:
281
286
 
282
287
  | 阶段 | 能力 | 触发条件 |
283
288
  |---|---|---|
284
289
  | open | `/grilling` | 存在重大歧义或用户明确要求压力测试 |
285
290
  | open/design | `/domain-modeling` | 词汇、不变量或架构决定不清晰 |
286
291
  | design | `/research` | 仓库内无法获得必需的外部事实 |
287
- | design | `/wayfinder` | 模块归属或依赖接缝未知 |
288
- | design | `/prototype` | 重大设计问题需要一次性实验证据 |
289
- | design | `/codebase-design` | 深模块、接口或测试接缝决定尚未完成 |
290
- | build | `/tdd` | 可测试接缝上的可观察行为发生变化 |
291
- | build | `/diagnosing-bugs` | 存在真实失败且根因未知 |
292
- | build | `/resolving-merge-conflicts` | 正在发生 merge/rebase 冲突 |
293
- | verify | `/code-review` | 需要 Standards 与 Spec 双轴证据 |
294
-
295
- `grill-with-docs`、`implement`、`improve-codebase-architecture` 不受 Matrix 管理,也不会自动调用。用户已安装的副本会作为非受管额外 Skill 保留。companion 不得推进、提交、归档或写 Matrix 状态。
292
+ | design | `/prototype` | 重大设计问题需要一次性实验证据 |
293
+ | design | `/codebase-design` | 深模块、接口或测试接缝决定尚未完成 |
294
+ | design/build | `/writing-for-agents` | Contract 修改 agent-facing 指令或指针可达文档 |
295
+ | build | `/tdd` | 可测试接缝上的可观察行为发生变化 |
296
+ | build | `/diagnosing-bugs` | 存在真实失败且根因未知 |
297
+ | build | `/wizard` | Contract 需要生成人工执行的 shell 步骤;Matrix 不端到端运行 |
298
+ | verify | `/code-review` | 需要 Standards 与 Spec 双轴证据 |
299
+
300
+ Matrix 可以推荐但绝不嵌套以下 user-invoked handoff:`setup-matt-pocock-skills`、`improve-codebase-architecture`、`wayfinder`、`handoff`、`to-questionnaire`。它们由用户在活动阶段外显式运行,选中的结果可以再进入受治理 Change。
301
+
302
+ Arch 在 `code-review` 后记录由 Runtime 管理的审查回执,把 fixed point 与已提交的 HEAD diff 绑定到当前 Contract、审查正文和工作区。正常的 `code-review` 回执要求 Matrix 管理资产之外的候选工作区是干净的。无可用 Git 基线、已提交 diff 为空、仍存在 staged/unstaged/untracked 候选,或正确安装的 capability 真实失败时,Matrix 可为该 revision 执行一次明确标记的同能力 fallback;其中 `uncommitted-worktree` 会同时绑定 fixed point 与完整工作区候选的内容 hash。安装完整性失败不得 fallback。只有标题或自述、但没有匹配回执时,Verify 不能推进。
303
+
304
+ 安装但保持 standalone 的 Skill 是 `ask-matt`、`grill-with-docs`、`triage`、`to-spec`、`to-tickets`、`grill-me`、`teach`、`wait-what`。`implement` 与 raw `resolving-merge-conflicts` 可能接管 Matrix 所有的 TDD、review、stage 或 commit 副作用,因此 0.1.4 不安装也不管理它们;已有副本会被保留并报告为未管理额外项。安装不代表自动调用;任何 companion 都不得推进、提交、归档、恢复或写 Matrix 状态。
296
305
 
297
306
  ---
298
307
 
299
308
  **关键区别**:Matt Pocock 的 skills 是独立工具。Matrix 增加了:
300
309
  - **状态持久化**:可承受上下文丢失
301
- - **阶段强制**:full 不能跳过 Design;lightweight 不能在确认 Open Contract 前修改实现
310
+ - **阶段强制**:full 不能跳过 Design;lightweight 不能在确认 Open Contract 前修改实现
302
311
  - **证据要求**:守卫检查产物,而非断言
303
312
  - **转换日志**:完整的阶段变更审计记录
304
313
 
@@ -3,28 +3,24 @@ name: matrix
3
3
  description: 启动、恢复并治理持久化的 Matrix 开发工作流。
4
4
  ---
5
5
 
6
- # Matrix
7
-
8
- 以当前仓库的 `.matrix/` 为唯一状态来源;不得从聊天记录推断阶段。
9
-
10
- 读取 `matrix workflow inspect` 的 `artifact_language`。规范 Markdown 标题 token 必须保持不变;面向用户的产物正文、说明和 handoff 在 `zh-CN` 时写中文,在 `en` 时写英文。
11
-
12
- 先执行:
6
+ # Matrix
13
7
 
14
- ```powershell
15
- matrix workflow inspect
16
- ```
8
+ 以当前仓库的 `.matrix/` 为唯一状态来源;不得从聊天记录推断阶段。
17
9
 
18
- 只有系统明确报告 `matrix` 命令不存在时,才使用当前 Matrix Skill 目录中的 bundled runtime:
10
+ 读取 `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect` 的 `artifact_language`。规范 Markdown 标题 token 必须保持不变;面向用户的产物正文、说明和 handoff 在 `zh-CN` 时写中文,在 `en` 时写英文。
19
11
 
20
- ```powershell
21
- node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect
22
- ```
12
+ 所有 workflow 命令都先执行当前项目 Matrix Skill 自带的 Runtime,使项目兼容性权威优先于不同版本的全局启动器:
13
+
14
+ ```powershell
15
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect
16
+ ```
17
+
18
+ 全局 `matrix` 命令只负责 init、update 和 bootstrap。受信任的 0.1.4 启动器只会自动委派给版本与 hash 都精确匹配的 0.1.4 项目 Runtime。项目 Runtime 属于不同版本或无法识别版本时仍是项目权威,但必须执行启动器返回的精确直连命令;旧版启动器不具备这项跨版本检查,不能作为项目 workflow 入口。
23
19
 
24
20
  有活动变更时,报告其 phase、冻结的 `orchestration` 以及 Arch 安装完整性,再按 Runtime 结果进入 `next_skill`。没有活动变更时,为开发请求创建简短 kebab-case ID:
25
21
 
26
22
  ```powershell
27
- matrix workflow init <change-id> --workflow <full|hotfix|tweak> --orchestration <prim|arch> --title "<title>"
23
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs init <change-id> --workflow <full|hotfix|tweak> --orchestration <prim|arch> --title "<title>"
28
24
  ```
29
25
 
30
26
  显式模式优先,否则使用项目 `default_orchestration`。解析后的模式在整个 change 生命周期中不可切换。
@@ -32,9 +28,9 @@ matrix workflow init <change-id> --workflow <full|hotfix|tweak> --orchestration
32
28
  ## 编排模式
33
29
 
34
30
  - **Prim**:各阶段使用 Matrix 自身能力,不依赖 Matt Skills。
35
- - **Arch**:仅在任务事实满足触发条件时,调用初始化阶段已验证的十项原子能力。
31
+ - **Arch**:仅在任务事实满足触发条件时,调用活动 Change 冻结的十项自动能力。Matrix 0.1.4 审查 Matt Skills v1.2.3 官方 25 项角色,只把其中 23 项兼容 Skill 安装在项目本地;排除 `implement` 与 raw `resolving-merge-conflicts`。
36
32
 
37
- 两种编排模式使用已选定的 workflow profile:`full` 走 `open → design → build → verify → archive`;`hotfix` 与 `tweak` 共用内部 `lightweight` profile,走 `open → build → verify → archive`,仅证据策略不同。Arch 能力不得写 Matrix 状态、推进阶段、提交、归档或创建竞争工作流。
33
+ 两种编排模式使用已选定的 workflow profile:`full` 走 `open → design → build → verify → archive`;`hotfix` 与 `tweak` 共用内部 `lightweight` profile,走 `open → build → verify → archive`,仅证据策略不同。Arch 能力不得写 Matrix 状态、推进阶段、提交、归档或创建竞争工作流。
38
34
 
39
35
  正确安装的 Arch 能力执行失败时,最多允许一次同能力的 Matrix fallback,并记录失败与证据。缺失、修改或不完整的 Arch 安装必须通过 `matrix init --with-mattpocock` 修复,不得切换活动 change 到 Prim。
40
36
 
@@ -43,10 +39,10 @@ matrix workflow init <change-id> --workflow <full|hotfix|tweak> --orchestration
43
39
  只能通过 Runtime 恢复,不得手工修改状态:
44
40
 
45
41
  ```powershell
46
- matrix workflow return design --reason design-gap
47
- matrix workflow return build --reason verification-failed
48
- matrix workflow return design --reason acceptance-or-design-gap
49
- matrix workflow abort --reason <requirement-cancelled|superseded|no-longer-valuable|blocked|other>
42
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap
43
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs return build --reason verification-failed
44
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap
45
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs abort --reason <requirement-cancelled|superseded|no-longer-valuable|blocked|other>
50
46
  ```
51
47
 
52
48
  Return 会把当前 `verification.md` 轮换至按 revision 编号的证据历史。Archive 等待确认期间若验收或设计改变,只能使用 `archive -> design` 的 `acceptance-or-design-gap` Return。Abort 将终态变更移入 `.matrix/archive/`,但不会撤销工作区代码。
@@ -54,30 +50,34 @@ Return 会把当前 `verification.md` 轮换至按 revision 编号的证据历
54
50
  任何 mutation 返回 `WORKFLOW_RECOVERY_REQUIRED` 时,停止正常阶段操作并先执行只读诊断:
55
51
 
56
52
  ```powershell
57
- matrix workflow doctor
53
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor
58
54
  ```
59
55
 
60
56
  不得推断恢复目标或策略,只能执行 doctor 返回的精确命令:
61
57
 
62
58
  ```powershell
63
- matrix workflow doctor --repair --transaction <id> --strategy <continue|rollback>
64
- matrix workflow doctor --repair --lock <id>
59
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor --repair --transaction <id> --strategy <continue|rollback>
60
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor --repair --lock <id>
65
61
  ```
66
62
 
67
63
  ## 精确 Contract
68
64
 
69
- full 的 `design -> build` 会批准 proposal/design/plan;lightweight 的 `open -> build --confirmed` 只批准紧凑 proposal,并拒绝初始化后、批准前发生的项目实现改动。Contract 后续漂移都会阻断推进。
65
+ full 的 `design -> build` 会批准 proposal/design/plan;lightweight 的 `open -> build --confirmed` 只批准紧凑 proposal,并拒绝初始化后、批准前发生的项目实现改动。Contract 后续漂移都会阻断推进。
70
66
 
71
- ## 可选 Claude 交接
67
+ ## 可选 Claude 交接
72
68
 
73
69
  `$matrix-claude` 只在已批准的 Build 中使用,导出同一 Contract 快照给 Claude Code。它不拥有阶段推进或验收;直接由 Codex 实现仍使用原有 Matrix 主流程。
74
- 只有用户明确选择“Codex 设计、Claude Code 实现”时才使用,不得自动插入标准流程。
70
+ 只有用户明确选择“Codex 设计、Claude Code 实现”时才使用,不得自动插入标准流程。
71
+
72
+ ## 显式 Matt handoff
73
+
74
+ Matrix 不嵌套 user-invoked Skill。适用时只解释原因,并让用户显式调用:一次性配置使用 `setup-matt-pocock-skills`,工作流外架构扫描使用 `improve-codebase-architecture`,独立大型候选生成使用 `wayfinder`,上下文边界使用 `handoff`,他人掌握阻塞事实时使用 `to-questionnaire`。`ask-matt`、`grill-with-docs`、`triage`、`to-spec`、`to-tickets`、`grill-me`、`teach`、`wait-what` 保持 standalone。Matrix 不安装也不管理 `implement` 或 raw `resolving-merge-conflicts`;已有副本保留为未管理额外项,活动 Change 内不得建议使用。
75
75
 
76
76
  ## 规则
77
77
 
78
- - 阶段只能经 `matrix workflow transition` 正向推进。
79
- - 只能经上述明确的 `matrix workflow return` 反向推进。
80
- - 成功 Archive 必须使用两步乐观提交:先运行 `matrix workflow archive --dry-run`,再将其精确 hash 传给 `matrix workflow archive --expect-preflight <sha256>`;不得绕过预演。
81
- - `matrix workflow doctor` 始终只读;transaction 与陈旧锁 repair 必须显式绑定 doctor 报告的 identity,不得手工编辑或删除 `.matrix/transactions/`、`.matrix/workflow.lock`。
82
- - 重大架构/范围决定和 archive/commit 前应暂停等待用户确认。
83
- - shortcut 范围扩大时执行 `matrix workflow return design --reason design-gap`;Runtime 将其升级为 full。
78
+ - 阶段只能经 `node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition` 正向推进。
79
+ - 只能经上述明确的 `node <matrix-skill-directory>/scripts/matrix-runtime.mjs return` 反向推进。
80
+ - 成功 Archive 必须使用两步乐观提交:先运行 `node <matrix-skill-directory>/scripts/matrix-runtime.mjs archive --dry-run`,再将其精确 hash 传给 `node <matrix-skill-directory>/scripts/matrix-runtime.mjs archive --expect-preflight <sha256>`;不得绕过预演。
81
+ - `node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor` 始终只读;transaction 与陈旧锁 repair 必须显式绑定 doctor 报告的 identity,不得手工编辑或删除 `.matrix/transactions/`、`.matrix/workflow.lock`。
82
+ - 重大架构/范围决定和 archive/commit 前应暂停等待用户确认。
83
+ - shortcut 范围扩大时执行 `node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap`;Runtime 将其升级为 full。