@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
@@ -3,25 +3,21 @@ name: matrix
3
3
  description: Route, initialize, resume, and govern a persistent Matrix development workflow. Use when the user starts a feature, change, bug fix, or asks to resume managed development.
4
4
  ---
5
5
 
6
- # Matrix
7
-
8
- Use Matrix as the development-workflow entrypoint. Its source of truth is the current repository's `.matrix/`; never infer a phase from chat history.
9
-
10
- Read `artifact_language` from `matrix workflow inspect`. Keep required Markdown heading tokens unchanged, but write every user-facing artifact body, explanation, and handoff in that language: English for `en`, Chinese for `zh-CN`.
11
-
12
- ## Route
6
+ # Matrix
13
7
 
14
- First run:
8
+ Use Matrix as the development-workflow entrypoint. Its source of truth is the current repository's `.matrix/`; never infer a phase from chat history.
15
9
 
16
- ```powershell
17
- matrix workflow inspect
18
- ```
10
+ Read `artifact_language` from `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect`. Keep required Markdown heading tokens unchanged, but write every user-facing artifact body, explanation, and handoff in that language: English for `en`, Chinese for `zh-CN`.
19
11
 
20
- If and only if the `matrix` executable is reported as absent, run the bundled fallback from this Skill directory instead:
12
+ ## Route
21
13
 
22
- ```powershell
23
- node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect
24
- ```
14
+ For every workflow command, run the Runtime bundled with this project Skill so the project compatibility authority wins over a different global launcher:
15
+
16
+ ```powershell
17
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect
18
+ ```
19
+
20
+ Use the global `matrix` command for `init`, `update`, and bootstrap only. A trusted 0.1.4 launcher auto-delegates only to an exact, hash-verified 0.1.4 project Runtime. A different or unidentified project release remains authoritative but must be invoked through the exact direct command returned by the launcher. Older launchers cannot provide this cross-release check and must not be used as the project workflow entrypoint.
25
21
 
26
22
  - If an active change exists, show its phase and frozen `orchestration`, report any Arch installation-integrity failure, and enter the returned `next_skill` only when the Runtime permits continuation.
27
23
  - If no active change exists, classify the request: reproducible small bug → `$matrix-hotfix` with workflow `hotfix`; bounded small change with no public API/schema/architecture impact → `$matrix-tweak` with workflow `tweak`; otherwise full Matrix with workflow `full`.
@@ -29,7 +25,7 @@ node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect
29
25
  - Before `init`, derive a short kebab-case change id and an accurate title. Start with `full` unless a shortcut clearly applies.
30
26
 
31
27
  ```powershell
32
- matrix workflow init <change-id> --workflow <full|hotfix|tweak> --orchestration <prim|arch> --title "<title>"
28
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs init <change-id> --workflow <full|hotfix|tweak> --orchestration <prim|arch> --title "<title>"
33
29
  ```
34
30
 
35
31
  An explicit mode wins; otherwise Runtime uses the project `default_orchestration`. The resolved value is immutable for the change and is shown in init, inspect, and the initialized Event. Then enter `$matrix-open`.
@@ -37,9 +33,9 @@ An explicit mode wins; otherwise Runtime uses the project `default_orchestration
37
33
  ## Orchestration
38
34
 
39
35
  - **Prim** uses Matrix's own capability in every phase and never requires Matt Skills.
40
- - **Arch** conditionally invokes the initialization-verified ten-Skill cohort when documented task-fact triggers are present.
36
+ - **Arch** conditionally invokes the ten reviewed automatic capabilities frozen by the active Change. Matrix 0.1.4 reviews all 25 official Matt Skills v1.2.3 roles and installs only the 23 compatible Skills project-locally; `implement` and raw `resolving-merge-conflicts` are excluded.
41
37
 
42
- Both orchestration modes use the same selected workflow profile. `full` uses `open → design → build → verify → archive`; `hotfix` and `tweak` share one internal `lightweight` profile, `open → build → verify → archive`, with different evidence policies. Companion Skills never write Matrix state, transition, commit, archive, or create competing workflow artifacts.
38
+ Both orchestration modes use the same selected workflow profile. `full` uses `open → design → build → verify → archive`; `hotfix` and `tweak` share one internal `lightweight` profile, `open → build → verify → archive`, with different evidence policies. Companion Skills never write Matrix state, transition, commit, archive, or create competing workflow artifacts.
43
39
 
44
40
  A correctly installed Arch capability that fails gets at most one Matrix-owned fallback for the same bounded capability, with failure and evidence recorded. A missing, modified, or incomplete Arch installation must be repaired with `matrix init --with-mattpocock`; never switch the active change to Prim.
45
41
 
@@ -48,11 +44,11 @@ A correctly installed Arch capability that fails gets at most one Matrix-owned f
48
44
  Use Runtime commands instead of editing Matrix state:
49
45
 
50
46
  ```powershell
51
- matrix workflow return design --reason design-gap
52
- matrix workflow return build --reason verification-failed
53
- matrix workflow return design --reason acceptance-or-design-gap
54
- matrix workflow return design --reason acceptance-or-design-gap # from Archive, before terminal archive
55
- matrix workflow abort --reason <requirement-cancelled|superseded|no-longer-valuable|blocked|other>
47
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap
48
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs return build --reason verification-failed
49
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap
50
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap # from Archive, before terminal archive
51
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs abort --reason <requirement-cancelled|superseded|no-longer-valuable|blocked|other>
56
52
  ```
57
53
 
58
54
  Return preserves the change but moves the current `verification.md` into revisioned evidence history, so the returned phase must produce fresh current evidence. Abort preserves the last phase and moves the terminal change into `.matrix/archive/`; it never undoes worktree changes.
@@ -60,14 +56,14 @@ Return preserves the change but moves the current `verification.md` into revisio
60
56
  If any mutation reports `WORKFLOW_RECOVERY_REQUIRED`, stop normal phase work and run the read-only diagnosis:
61
57
 
62
58
  ```powershell
63
- matrix workflow doctor
59
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor
64
60
  ```
65
61
 
66
62
  Never infer a repair target or strategy. Use only the exact command returned by doctor:
67
63
 
68
64
  ```powershell
69
- matrix workflow doctor --repair --transaction <id> --strategy <continue|rollback>
70
- matrix workflow doctor --repair --lock <id>
65
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor --repair --transaction <id> --strategy <continue|rollback>
66
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor --repair --lock <id>
71
67
  ```
72
68
 
73
69
  ## Optional Claude handoff
@@ -77,16 +73,15 @@ Use it only when the user explicitly chooses Codex design with Claude Code imple
77
73
 
78
74
  ## Cross-Cutting Skills
79
75
 
80
- ### Handoff (`handoff`)
81
- When context is running low and work needs to continue in a fresh session, use `handoff` at any stage boundary. It compacts the conversation into a handoff document with suggested skills for the next agent. Save to the OS temp directory, not the workspace.
76
+ Matrix never nests user-invoked Matt Skills. When relevant, explain the reason and ask the user to invoke one explicitly: `setup-matt-pocock-skills` for one-time setup, `improve-codebase-architecture` for an out-of-band scan, `wayfinder` for generating a separate large-effort candidate, `handoff` at a context boundary, or `to-questionnaire` when another person owns blocking facts. `ask-matt`, `grill-with-docs`, `triage`, `to-spec`, `to-tickets`, `grill-me`, `teach`, and `wait-what` remain standalone. Matrix does not install or manage `implement` or raw `resolving-merge-conflicts`; preserve pre-existing copies as unmanaged extras and never suggest them inside an active Change.
82
77
 
83
78
  ## Rules
84
79
 
85
- - A phase can advance only through `matrix workflow transition`; run its guard first.
86
- - A phase can move backward only through one of the documented `matrix workflow return` intents.
87
- - Full Build approval binds proposal, design, and plan. Lightweight Build approval binds its compact proposal, requires `transition build --confirmed`, and rejects project implementation changes made after initialization but before approval.
88
- - A successful Archive is always a two-step optimistic commit: run `matrix workflow archive --dry-run`, then pass its exact hash to `matrix workflow archive --expect-preflight <sha256>`. Never bypass the preflight.
89
- - `matrix workflow doctor` is read-only. Every transaction or stale-lock repair must explicitly bind the identity reported by doctor; do not edit or delete `.matrix/transactions/` or `.matrix/workflow.lock`.
80
+ - A phase can advance only through `node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition`; run its guard first.
81
+ - A phase can move backward only through one of the documented `node <matrix-skill-directory>/scripts/matrix-runtime.mjs return` intents.
82
+ - Full Build approval binds proposal, design, and plan. Lightweight Build approval binds its compact proposal, requires `transition build --confirmed`, and rejects project implementation changes made after initialization but before approval.
83
+ - A successful Archive is always a two-step optimistic commit: run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs archive --dry-run`, then pass its exact hash to `node <matrix-skill-directory>/scripts/matrix-runtime.mjs archive --expect-preflight <sha256>`. Never bypass the preflight.
84
+ - `node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor` is read-only. Every transaction or stale-lock repair must explicitly bind the identity reported by doctor; do not edit or delete `.matrix/transactions/` or `.matrix/workflow.lock`.
90
85
  - Do not replace required evidence with an assertion that work is complete.
91
86
  - Pause for user confirmation at material architecture/scope decisions and before archive/commit.
92
- - On shortcut scope expansion, run `matrix workflow return design --reason design-gap`; Runtime upgrades the change to `full`. Never silently continue the old contract.
87
+ - On shortcut scope expansion, run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap`; Runtime upgrades the change to `full`. Never silently continue the old contract.
@@ -21,13 +21,9 @@ def primary_runtime() -> str | None:
21
21
  return shutil.which("matrix")
22
22
 
23
23
 
24
- def runtime_command(args: list[str]) -> list[str]:
25
- primary = primary_runtime()
26
- if primary is not None:
27
- return [primary, "workflow", *args, "--json"]
28
-
29
- development = development_runtime()
30
- if development is not None:
24
+ def runtime_command(args: list[str]) -> list[str]:
25
+ development = development_runtime()
26
+ if development is not None:
31
27
  if not development.is_file():
32
28
  raise RuntimeError(f"Configured Matrix development runtime was not found: {development}")
33
29
  node = shutil.which("node")
@@ -37,10 +33,14 @@ def runtime_command(args: list[str]) -> list[str]:
37
33
 
38
34
  bundled = Path(__file__).with_name("matrix-runtime.mjs")
39
35
  node = shutil.which("node")
40
- if node is not None and bundled.exists():
41
- return [node, str(bundled), *args]
42
-
43
- raise RuntimeError("Matrix CLI is absent and the bundled workflow runtime was not found.")
36
+ if node is not None and bundled.exists():
37
+ return [node, str(bundled), *args]
38
+
39
+ primary = primary_runtime()
40
+ if primary is not None:
41
+ return [primary, "workflow", *args, "--json"]
42
+
43
+ raise RuntimeError("Matrix CLI is absent and the bundled workflow runtime was not found.")
44
44
 
45
45
 
46
46
  def run_runtime(args: list[str]) -> int:
@@ -3,11 +3,11 @@ name: matrix-archive
3
3
  description: Close and archive a verified Matrix change. Use when the active Matrix phase is archive.
4
4
  ---
5
5
 
6
- # Matrix Archive
7
-
8
- This is the final Matrix phase. Read the proposal, plan, and verification evidence; summarize changed behavior, verification, residual risks, and follow-up work. Ask for explicit confirmation before committing or archiving.
9
-
10
- Write archive summaries and handoff prose in `artifact_language`; keep Runtime-required English heading tokens unchanged.
6
+ # Matrix Archive
7
+
8
+ This is the final Matrix phase. Read the proposal, plan, and verification evidence; summarize changed behavior, verification, residual risks, and follow-up work. Ask for explicit confirmation before committing or archiving.
9
+
10
+ Write archive summaries and handoff prose in `artifact_language`; keep Runtime-required English heading tokens unchanged.
11
11
 
12
12
  Archive is Matrix-owned in both Prim and Arch. Do not invoke companion implementation, review, or architecture capabilities here.
13
13
 
@@ -16,12 +16,12 @@ Archive is Matrix-owned in both Prim and Arch. Do not invoke companion implement
16
16
  Run the read-only preflight and review its bounded effect summary. Then submit exactly the hash returned by that preflight:
17
17
 
18
18
  ```powershell
19
- matrix workflow archive --dry-run
20
- matrix workflow archive --expect-preflight <sha256-returned-by-dry-run>
21
- ```
22
-
23
- Bare Archive is rejected. Runtime reacquires the project Archive boundary and recomputes the entire protected change-directory manifest before committing.
24
- For hotfix/tweak, ask for explicit confirmation after reviewing the preflight, then use the returned command with `--confirmed`. Runtime rejects a shortcut Archive without it.
19
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs archive --dry-run
20
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs archive --expect-preflight <sha256-returned-by-dry-run>
21
+ ```
22
+
23
+ Bare Archive is rejected. Runtime reacquires the project Archive boundary and recomputes the entire protected change-directory manifest before committing.
24
+ For hotfix/tweak, ask for explicit confirmation after reviewing the preflight, then use the returned command with `--confirmed`. Runtime rejects a shortcut Archive without it.
25
25
 
26
26
  - `ARCHIVE_PREFLIGHT_CHANGED`: run dry-run again and review the new summary.
27
27
  - `ARCHIVE_BUSY`: retry later. Do not remove or take over the lock; stale-lock recovery belongs to the later doctor/repair change.
@@ -30,7 +30,7 @@ For hotfix/tweak, ask for explicit confirmation after reviewing the preflight, t
30
30
  If acceptance criteria or design must change while awaiting confirmation, use the sole Archive recovery path:
31
31
 
32
32
  ```powershell
33
- matrix workflow return design --reason acceptance-or-design-gap
33
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap
34
34
  ```
35
35
 
36
36
  After successful commit, the change is under `.matrix/archive/` and the workflow is complete.
@@ -3,11 +3,11 @@ name: matrix-build
3
3
  description: Implement the frozen active Matrix plan with test-first vertical slices. Use when the active Matrix phase is build.
4
4
  ---
5
5
 
6
- # Matrix Build
7
-
8
- Run `matrix workflow inspect` and implement only its approved Contract. Full and `legacy-full` read proposal/design/plan. `lightweight` reads the approved compact proposal and must not backfill Design artifacts.
9
-
10
- Write build evidence and user-facing explanations in `artifact_language`; preserve any Runtime-required English heading tokens.
6
+ # Matrix Build
7
+
8
+ Run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect` and implement only its approved Contract. Full and `legacy-full` read proposal/design/plan. `lightweight` reads the approved compact proposal and must not backfill Design artifacts.
9
+
10
+ Write build evidence and user-facing explanations in `artifact_language`; preserve any Runtime-required English heading tokens.
11
11
 
12
12
  ## Prim
13
13
 
@@ -15,18 +15,21 @@ Use Matrix's own implementation and test discipline.
15
15
 
16
16
  ## Arch
17
17
 
18
- - invoke `tdd` when the change modifies observable behavior at a testable seam;
19
- - invoke `diagnosing-bugs` only when an actual failure exists and root cause is not established;
20
- - invoke `resolving-merge-conflicts` only for an in-progress merge or rebase conflict.
18
+ - invoke `tdd` when the change modifies observable behavior at a testable seam;
19
+ - invoke `diagnosing-bugs` only when an actual failure exists and root cause is not established;
20
+ - invoke `writing-for-agents` when the approved Contract changes agent-facing instructions;
21
+ - invoke `wizard` only to generate and statically verify human-run shell steps required by the Contract; never execute the wizard end-to-end or collect secrets.
22
+
23
+ Resolve an in-progress merge/rebase through Matrix-owned conflict handling. Do not invoke raw `resolving-merge-conflicts`, because it can stage, continue, and commit outside Matrix lifecycle ownership. Never invoke `implement` inside an active Change.
21
24
 
22
25
  Announce each triggered capability and reason. No companion may commit, review, transition, archive, or broaden scope. A correctly installed capability gets at most one Matrix-owned fallback for that same capability; record the Skill, failure, fallback, and evidence. Installation-integrity failure stops the phase.
23
26
 
24
27
  ## Scope Discipline
25
28
 
26
- If implementation exposes a scope or design change, **stop and run**; a lightweight change is upgraded to full by this Return:
29
+ If implementation exposes a scope or design change, **stop and run**; a lightweight change is upgraded to full by this Return:
27
30
 
28
31
  ```powershell
29
- matrix workflow return design --reason design-gap
32
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap
30
33
  ```
31
34
 
32
35
  Then enter `$matrix-design`; do not amend the plan silently. The Runtime preserves old verification evidence in revision history and requires fresh evidence after the redesigned plan returns to Build.
@@ -35,10 +38,10 @@ Then enter `$matrix-design`; do not amend the plan silently. The Runtime preserv
35
38
 
36
39
  1. Implement the approved plan in bounded vertical slices.
37
40
  2. Use only triggered Arch capabilities.
38
- 3. Record common facts under `## Build evidence`. Hotfix also requires `## Reproduction evidence` and `## Root cause`; tweak also requires `## Scope evidence`.
41
+ 3. Record common facts under `## Build evidence`. Hotfix also requires `## Reproduction evidence` and `## Root cause`; tweak also requires `## Scope evidence`.
39
42
  4. Run the guard and transition, then enter `$matrix-verify`.
40
43
 
41
44
  ```powershell
42
- matrix workflow guard build
43
- matrix workflow transition verify
45
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard build
46
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition verify
44
47
  ```
@@ -3,11 +3,11 @@ name: matrix-claude
3
3
  description: Export a frozen Matrix design as a bounded Claude Code task package without changing Matrix workflow state. Use when Codex should design and Claude Code should implement.
4
4
  ---
5
5
 
6
- # Matrix Claude Handoff
7
-
8
- This is an optional Matrix sidecar, not a Matrix phase. It must not call `transition`, `archive`, or write `matrix.yaml` or `events.jsonl`. It supports only a matching full or legacy-full three-artifact Contract; new lightweight hotfix/tweak changes are intentionally unsupported.
9
-
10
- Use `artifact_language` from inspect for human-readable handoff text while retaining the stable machine-readable headings and metadata keys.
6
+ # Matrix Claude Handoff
7
+
8
+ This is an optional Matrix sidecar, not a Matrix phase. It must not call `transition`, `archive`, or write `matrix.yaml` or `events.jsonl`. It supports only a matching full or legacy-full three-artifact Contract; new lightweight hotfix/tweak changes are intentionally unsupported.
9
+
10
+ Use `artifact_language` from inspect for human-readable handoff text while retaining the stable machine-readable headings and metadata keys.
11
11
 
12
12
  ## When to Use
13
13
 
@@ -21,7 +21,7 @@ Use `$matrix-claude` when:
21
21
  The exporter performs this read-only check before writing anything:
22
22
 
23
23
  ```powershell
24
- matrix workflow guard build
24
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard build
25
25
  ```
26
26
 
27
27
  If `matrix` is genuinely absent from PATH, use the bundled runtime from the installed root Matrix Skill. Do not fall back when the primary command starts and returns an error.
@@ -34,11 +34,11 @@ Treat explicit invocation of `$matrix-claude` as the user's choice of Claude Cod
34
34
 
35
35
  ```powershell
36
36
  # Generic project: only exports a Matrix artifact.
37
- matrix workflow export --task-id <ID> --target generic
37
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs export --task-id <ID> --target generic
38
38
 
39
39
  # FnSec: exports its formal task package. Add --apply-fnsec-board only when
40
40
  # active.md is NO_ACTIVE_OBJECTIVE; an existing task is never overwritten.
41
- matrix workflow export --task-id <ID> --target fnsec --apply-fnsec-board
41
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs export --task-id <ID> --target fnsec --apply-fnsec-board
42
42
  ```
43
43
 
44
44
  ## Task Package Contents
@@ -78,12 +78,12 @@ After Claude Code completes and evidence is present:
78
78
 
79
79
  1. Run build guard to verify evidence:
80
80
  ```powershell
81
- matrix workflow guard build
81
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard build
82
82
  ```
83
83
 
84
84
  2. If guard passes, transition to verify:
85
85
  ```powershell
86
- matrix workflow transition verify
86
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition verify
87
87
  ```
88
88
 
89
89
  3. Enter `$matrix-verify` to继续验证流程
@@ -3,13 +3,13 @@ name: matrix-design
3
3
  description: Design and freeze the active Matrix change before implementation. Use when the active Matrix phase is design or when build scope requires redesign.
4
4
  ---
5
5
 
6
- # Matrix Design
7
-
8
- Design is used by `full` and resumable legacy shortcut changes only. A new lightweight hotfix/tweak moves directly from Open to Build and must not create Design artifacts merely to satisfy the full guard.
9
-
10
- Use `artifact_language` from `matrix workflow inspect` for all design and plan prose. Keep Runtime-required English heading tokens unchanged.
11
-
12
- Run `matrix workflow inspect`, read the active proposal and frozen `orchestration`, then write `artifacts/design.md` with `## Decisions`, `## Boundaries`, `## Test seams`, and `## Risks`; write `artifacts/plan.md` with `## Steps`, `## Validation`, and `## Stop conditions`.
6
+ # Matrix Design
7
+
8
+ Design is used by `full` and resumable legacy shortcut changes only. A new lightweight hotfix/tweak moves directly from Open to Build and must not create Design artifacts merely to satisfy the full guard.
9
+
10
+ Use `artifact_language` from `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect` for all design and plan prose. Keep Runtime-required English heading tokens unchanged.
11
+
12
+ Run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect`, read the active proposal and frozen `orchestration`, then write `artifacts/design.md` with `## Decisions`, `## Boundaries`, `## Test seams`, and `## Risks`; write `artifacts/plan.md` with `## Steps`, `## Validation`, and `## Stop conditions`.
13
13
 
14
14
  ## Prim
15
15
 
@@ -19,15 +19,17 @@ Use Matrix's own capability to investigate the repository and design the change.
19
19
 
20
20
  Invoke only capabilities whose task-fact trigger is proven:
21
21
 
22
- - `domain-modeling` for unclear vocabulary, invariants, or architectural decisions;
23
- - `research` when required external facts cannot be established from the repository;
24
- - `wayfinder` when module ownership or dependency seams are unknown;
25
- - `prototype` when a material design decision needs disposable empirical evidence;
26
- - `codebase-design` when a deep-module, interface, or test-seam decision remains.
22
+ - `domain-modeling` for unclear vocabulary, invariants, or architectural decisions;
23
+ - `research` when required external facts cannot be established from the repository;
24
+ - `prototype` when a material design decision needs disposable empirical evidence;
25
+ - `codebase-design` when a deep-module, interface, or test-seam decision remains;
26
+ - `writing-for-agents` when the Contract creates or changes Skills, `AGENTS.md`, `CLAUDE.md`, or documents reached through agent pointers.
27
27
 
28
28
  Order follows actual dependencies; never run a fixed companion sequence. Announce each invocation and reason. A correctly installed capability gets at most one same-capability Matrix fallback; installation-integrity failure stops the phase.
29
29
 
30
- Long-lived domain, ADR, or research artifacts follow repository conventions, and material conclusions must be synchronized into the canonical design or plan. Prototypes default to an OS temporary directory unless the approved design promotes a project path. Companion output cannot own Matrix state or create a competing plan.
30
+ Long-lived domain, ADR, or research artifacts follow repository conventions, and material conclusions must be synchronized into the canonical design or plan. Prototypes default to an OS temporary directory unless the approved design promotes a project path. Companion output cannot own Matrix state or create a competing plan.
31
+
32
+ `wayfinder` and `improve-codebase-architecture` are explicit handoffs outside the active Design. Recommend one only when its purpose fits, then let the user invoke it; a selected result may enter a separate governed Change.
31
33
 
32
34
  ## Process
33
35
 
@@ -37,7 +39,7 @@ Long-lived domain, ADR, or research artifacts follow repository conventions, and
37
39
  4. Run the guard, then choose the implementation actor.
38
40
 
39
41
  ```powershell
40
- matrix workflow guard design
42
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard design
41
43
  ```
42
44
 
43
45
  ## Implementation Decision Point
@@ -49,7 +51,7 @@ After the design guard passes, the user chooses:
49
51
  Run transition and enter `$matrix-build`:
50
52
 
51
53
  ```powershell
52
- matrix workflow transition build
54
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition build
53
55
  ```
54
56
 
55
57
  Then enter `$matrix-build` to implement directly in this session.
@@ -64,8 +66,8 @@ First approve the frozen contract by transitioning to Build, then run `$matrix-c
64
66
  After Claude Code completes and returns results, run the Build guard and enter `$matrix-verify`:
65
67
 
66
68
  ```powershell
67
- matrix workflow guard build
68
- matrix workflow transition verify
69
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard build
70
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition verify
69
71
  ```
70
72
 
71
73
  Then enter `$matrix-verify` to verify the implementation.
@@ -5,4 +5,4 @@ description: Run a constrained Matrix workflow for a reproducible small bug. Use
5
5
 
6
6
  # Matrix Hotfix
7
7
 
8
- Start through `$matrix` with workflow `hotfix`. It uses the shared lightweight lifecycle `open → build → verify → archive`; there is no separate hotfix state machine. Before Build, record expected/actual behavior and a reproducible failure signal, present the compact Contract, and wait for confirmation. Build records reproduction and root-cause evidence; Verify records regression evidence. If the bug requires architecture, public API, schema, or broad coordination, use controlled Return to upgrade the change to full.
8
+ Start through `$matrix` with workflow `hotfix`. It uses the shared lightweight lifecycle `open → build → verify → archive`; there is no separate hotfix state machine. Before Build, record expected/actual behavior and a reproducible failure signal, present the compact Contract, and wait for confirmation. Build records reproduction and root-cause evidence; Verify records regression evidence. If the bug requires architecture, public API, schema, or broad coordination, use controlled Return to upgrade the change to full.
@@ -3,16 +3,16 @@ name: matrix-open
3
3
  description: Open or resume the Matrix open phase by clarifying a development request into an evidence-backed proposal. Use after $matrix initializes a change or when the active Matrix phase is open.
4
4
  ---
5
5
 
6
- # Matrix Open
7
-
8
- Run `matrix workflow inspect` and follow its `profile` and `evidence_policy`.
9
-
10
- Use its `artifact_language` for all proposal prose. Keep the required English heading tokens exactly as specified for Runtime guards; only the text beneath them is localized.
11
-
12
- - **full**: produce `proposal.md` with `## Goal`, `## Scope`, `## Non-goals`, `## Acceptance`, and `## Risks`, then continue to Design.
13
- - **lightweight**: produce the complete compact Contract before editing project implementation. Include `## Goal`, `## Scope`, `## Non-goals`, `## Approach`, `## Acceptance`, `## Validation`, `## Risks`, and `## Upgrade conditions`.
14
- - **hotfix evidence**: also include `## Expected behavior`, `## Actual behavior`, and `## Reproduction`.
15
- - **tweak evidence**: also include `## Current behavior`, `## Preserved behavior`, and `## Diff boundary`.
6
+ # Matrix Open
7
+
8
+ Run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect` and follow its `profile` and `evidence_policy`.
9
+
10
+ Use its `artifact_language` for all proposal prose. Keep the required English heading tokens exactly as specified for Runtime guards; only the text beneath them is localized.
11
+
12
+ - **full**: produce `proposal.md` with `## Goal`, `## Scope`, `## Non-goals`, `## Acceptance`, and `## Risks`, then continue to Design.
13
+ - **lightweight**: produce the complete compact Contract before editing project implementation. Include `## Goal`, `## Scope`, `## Non-goals`, `## Approach`, `## Acceptance`, `## Validation`, `## Risks`, and `## Upgrade conditions`.
14
+ - **hotfix evidence**: also include `## Expected behavior`, `## Actual behavior`, and `## Reproduction`.
15
+ - **tweak evidence**: also include `## Current behavior`, `## Preserved behavior`, and `## Diff boundary`.
16
16
 
17
17
  ## Prim
18
18
 
@@ -20,7 +20,9 @@ Use Matrix's own capability to clarify the request and write the proposal.
20
20
 
21
21
  ## Arch
22
22
 
23
- Invoke `grilling` only when material ambiguity remains or the user asks to stress-test the request. Invoke `domain-modeling` only when domain vocabulary, invariants, or an architectural decision is unclear. Announce the capability and reason before invoking it; selecting Arch already authorizes triggered capabilities.
23
+ Invoke `grilling` only when material ambiguity remains or the user asks to stress-test the request. Invoke `domain-modeling` only when domain vocabulary, invariants, or an architectural decision is unclear. Announce the capability and reason before invoking it; selecting Arch already authorizes triggered capabilities.
24
+
25
+ If progress is blocked by facts or decisions owned by another person, explain why `to-questionnaire` fits and ask the user to invoke it. Do not invoke the wrapper yourself.
24
26
 
25
27
  Companion output is evidence for the Matrix proposal. It must not create another workflow, proposal, confirmation state, or phase transition. If a correctly installed capability fails, perform at most one Matrix-owned fallback for that same capability and record the failure and evidence. Installation-integrity failures require `matrix init --with-mattpocock` and are not eligible for fallback.
26
28
 
@@ -28,13 +30,13 @@ Companion output is evidence for the Matrix proposal. It must not create another
28
30
 
29
31
  1. Resolve only ambiguities required by the active workflow.
30
32
  2. Write the canonical proposal and synchronize material companion conclusions into it.
31
- 3. For full, ask for confirmation when scope or risk is material, then enter Design.
32
- 4. For lightweight, always present the compact Contract and wait for explicit confirmation before entering Build.
33
-
34
- ```powershell
35
- matrix workflow guard open
36
- # full
37
- matrix workflow transition design
38
- # hotfix/tweak, only after explicit confirmation
39
- matrix workflow transition build --confirmed
40
- ```
33
+ 3. For full, ask for confirmation when scope or risk is material, then enter Design.
34
+ 4. For lightweight, always present the compact Contract and wait for explicit confirmation before entering Build.
35
+
36
+ ```powershell
37
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard open
38
+ # full
39
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition design
40
+ # hotfix/tweak, only after explicit confirmation
41
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition build --confirmed
42
+ ```
@@ -8,8 +8,8 @@ description: Inspect the active Matrix workflow and report its disk-backed phase
8
8
  Run the same Matrix state kernel used by the main entry and every phase Skill:
9
9
 
10
10
  ```powershell
11
- matrix workflow inspect
12
- matrix workflow doctor
11
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect
12
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor
13
13
  ```
14
14
 
15
- Report the returned change id, workflow, `profile`, `evidence_policy`, frozen `orchestration`, phase, guard result, `next_skill`, Workflow health, unfinished transactions, available strategies, and exact recovery commands. If Arch integrity fails, identify the affected platform/Skill facts and report `matrix init --with-mattpocock`; do not reinterpret the change as Prim. Both commands are read-only. Do not infer status from conversation history, run `--repair`, or modify state. If the guard is failing, name the missing evidence and direct the user to the current phase Skill.
15
+ Report the returned change id, workflow, `profile`, `evidence_policy`, frozen `orchestration`, phase, guard result, `next_skill`, Workflow health, unfinished transactions, available strategies, and exact recovery commands. If Arch integrity fails, identify the affected platform/Skill facts and report `matrix init --with-mattpocock`; do not reinterpret the change as Prim. Both commands are read-only. Do not infer status from conversation history, run `--repair`, or modify state. If the guard is failing, name the missing evidence and direct the user to the current phase Skill.
@@ -5,4 +5,4 @@ description: Run a lightweight Matrix workflow for a bounded small development c
5
5
 
6
6
  # Matrix Tweak
7
7
 
8
- Start through `$matrix` with workflow `tweak`. It uses the shared lightweight lifecycle `open → build → verify → archive`; there is no separate tweak state machine or Design phase. Before editing implementation, define current/preserved behavior, the diff boundary, acceptance, and validation in the compact proposal, present it, and wait for confirmation. Build and Verify must prove scope and diff alignment. Use controlled Return to upgrade to full when the change crosses module, API, schema, or architecture boundaries.
8
+ Start through `$matrix` with workflow `tweak`. It uses the shared lightweight lifecycle `open → build → verify → archive`; there is no separate tweak state machine or Design phase. Before editing implementation, define current/preserved behavior, the diff boundary, acceptance, and validation in the compact proposal, present it, and wait for confirmation. Build and Verify must prove scope and diff alignment. Use controlled Return to upgrade to full when the change crosses module, API, schema, or architecture boundaries.
@@ -3,11 +3,11 @@ name: matrix-verify
3
3
  description: Verify the active Matrix change against its plan and review its diff. Use when the active Matrix phase is verify.
4
4
  ---
5
5
 
6
- # Matrix Verify
7
-
8
- Run the approved Contract's acceptance commands and record their output summaries under `## Test evidence` in `artifacts/verification.md`.
9
-
10
- Write verification prose in `artifact_language` from inspect while preserving the required English evidence headings.
6
+ # Matrix Verify
7
+
8
+ Run the approved Contract's acceptance commands and record their output summaries under `## Test evidence` in `artifacts/verification.md`.
9
+
10
+ Write verification prose in `artifact_language` from inspect while preserving the required English evidence headings.
11
11
 
12
12
  ## Input Sources
13
13
 
@@ -31,36 +31,51 @@ If these are missing (e.g., Claude Code didn't produce complete evidence), retur
31
31
 
32
32
  ## Orchestration
33
33
 
34
- Run `matrix workflow inspect` and read the frozen mode.
35
-
36
- - **Prim**: Matrix performs the Standards and Spec review itself.
37
- - **Arch**: invoke `code-review` to produce both review axes; announce the invocation and reason.
34
+ Run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect` and read the frozen mode.
38
35
 
39
- Review findings are inputs to Matrix Verify; a companion cannot decide the phase outcome, broaden approved architecture, transition, or archive. Do not invoke post-review architecture wrappers. A correctly installed review capability gets at most one same-capability Matrix fallback; installation-integrity failure stops verification.
36
+ - **Prim**: Matrix performs the Standards and Spec review itself.
37
+ - **Arch**: invoke `code-review` to produce both review axes; announce the invocation and reason.
38
+
39
+ Review findings are inputs to Matrix Verify; a companion cannot decide the phase outcome, broaden approved architecture, transition, or archive. Do not invoke post-review architecture wrappers. A correctly installed review capability gets at most one same-capability Matrix fallback; installation-integrity failure stops verification.
40
+
41
+ Under `## Review evidence`, preserve two substantive subsections named `### Standards` and `### Spec`. Arch must then ask the project Runtime to bind those results to the current revision:
42
+
43
+ ```powershell
44
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs review --source code-review --fixed-point <ref> --standards <passed|failed> --spec <passed|failed>
45
+ ```
46
+
47
+ If `code-review` cannot run because the Git baseline is unavailable, the committed HEAD diff is empty, staged/unstaged/untracked candidate files exist, or the capability actually fails, document that limitation and use the single bounded fallback for this revision:
48
+
49
+ ```powershell
50
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs review --source matrix-fallback --reason <git-baseline-unavailable|empty-head-diff|uncommitted-worktree|capability-execution-failed> [--fixed-point <ref-for-empty-head-diff-or-uncommitted-worktree>] --standards <passed|failed> --spec <passed|failed>
51
+ ```
52
+
53
+ Never label fallback output as a successful `code-review` run. `empty-head-diff` requires the fixed point so Runtime can verify the empty three-dot diff. `uncommitted-worktree` requires a fixed point and Runtime binds the staged, unstaged, and untracked candidate content into `candidate_hash`; any later change makes the receipt stale. If a receipt already exists or either axis failed, use a controlled Return before another attempt.
40
54
 
41
55
  ## Failure Handling
42
56
 
43
57
  If verification or review fails:
44
- - If the issue is in the implementation, run `matrix workflow return build --reason verification-failed`, then enter `$matrix-build` or ask Claude Code to fix.
45
- - If the issue is in the acceptance criteria or design, run `matrix workflow return design --reason acceptance-or-design-gap`, then enter `$matrix-design`.
58
+ - If the issue is in the implementation, run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs return build --reason verification-failed`, then enter `$matrix-build` or ask Claude Code to fix.
59
+ - If the issue is in the acceptance criteria or design, run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap`, then enter `$matrix-design`.
46
60
 
47
- Both Return paths rotate the current `verification.md` into revisioned evidence history. Do not copy stale conclusions back into the new current evidence.
61
+ Both Return paths rotate the current `verification.md` and any `review-receipt.json` into revisioned evidence history. Do not copy stale conclusions or receipts back into the new current evidence.
48
62
 
49
63
  If documents or public behavior changed, record the required synchronization work before the guard.
50
64
 
51
65
  ## Process
52
66
 
53
67
  1. Check that `artifacts/verification.md` exists with `## Build evidence`
54
- 2. Run the approved validation commands (full plan or lightweight proposal)
55
- 3. Record test output under `## Test evidence`
56
- 4. Produce both Standards and Spec review axes through the selected orchestration mode
57
- 6. Record findings under `## Review evidence`
58
- 7. Run the guard
59
- 8. If it passes, transition to archive and enter `$matrix-archive`
68
+ 2. Run the approved validation commands (full plan or lightweight proposal)
69
+ 3. Record test output under `## Test evidence`
70
+ 4. Produce both Standards and Spec review axes through the selected orchestration mode
71
+ 5. Record findings under `## Review evidence` with `### Standards` and `### Spec`
72
+ 6. In Arch, record the Runtime review receipt for the current revision
73
+ 7. Run the guard
74
+ 8. If it passes, transition to archive and enter `$matrix-archive`
60
75
 
61
76
  ```powershell
62
- matrix workflow guard verify
63
- matrix workflow transition archive
77
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard verify
78
+ node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition archive
64
79
  ```
65
80
 
66
81
  ## Evidence Requirements
@@ -68,6 +83,7 @@ matrix workflow transition archive
68
83
  The guard checks for:
69
84
 
70
85
  1. **Test evidence** — Output from running the plan's validation commands
71
- 2. **Review evidence** — Findings from the two-axis code review
86
+ 2. **Review evidence** — Separate Standards and Spec findings from the selected review path
87
+ 3. **Arch review receipt** — Runtime-bound identity for the current Contract, evidence, workspace, and normal or fallback source
72
88
 
73
- Full requires Test and Review evidence. Hotfix additionally requires `## Regression evidence`; tweak additionally requires `## Scope review evidence`.
89
+ Full requires Test and Review evidence. Hotfix additionally requires `## Regression evidence`; tweak additionally requires `## Scope review evidence`.