@rosenfan/matrix 0.1.2 → 0.1.3

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 (33) hide show
  1. package/.claude/skills/matrix/SKILL.md +58 -56
  2. package/.claude/skills/matrix/scripts/matrix_claude.py +11 -11
  3. package/.claude/skills/matrix/scripts/matrix_state.py +60 -60
  4. package/.claude/skills/matrix-archive/SKILL.md +27 -24
  5. package/.claude/skills/matrix-build/SKILL.md +26 -24
  6. package/.claude/skills/matrix-claude/SKILL.md +11 -9
  7. package/.claude/skills/matrix-design/SKILL.md +31 -27
  8. package/.claude/skills/matrix-hotfix/SKILL.md +1 -1
  9. package/.claude/skills/matrix-open/SKILL.md +29 -19
  10. package/.claude/skills/matrix-status/SKILL.md +5 -5
  11. package/.claude/skills/matrix-tweak/SKILL.md +1 -1
  12. package/.claude/skills/matrix-verify/SKILL.md +23 -21
  13. package/README.md +123 -97
  14. package/README.zh-CN.md +122 -96
  15. package/assets/skills-zh-CN/matrix/SKILL.md +78 -75
  16. package/assets/skills-zh-CN/matrix-archive/SKILL.md +31 -28
  17. package/assets/skills-zh-CN/matrix-build/SKILL.md +37 -35
  18. package/assets/skills-zh-CN/matrix-claude/SKILL.md +31 -29
  19. package/assets/skills-zh-CN/matrix-design/SKILL.md +10 -6
  20. package/assets/skills-zh-CN/matrix-hotfix/SKILL.md +1 -1
  21. package/assets/skills-zh-CN/matrix-open/SKILL.md +19 -9
  22. package/assets/skills-zh-CN/matrix-status/SKILL.md +5 -5
  23. package/assets/skills-zh-CN/matrix-tweak/SKILL.md +1 -1
  24. package/assets/skills-zh-CN/matrix-verify/SKILL.md +17 -15
  25. package/package.json +2 -2
  26. package/src/catalog.js +16 -16
  27. package/src/cli.js +81 -28
  28. package/src/distribution.js +154 -123
  29. package/src/messages.js +4 -4
  30. package/src/self-update.js +81 -0
  31. package/src/ui.js +1 -1
  32. package/src/workflow-transaction.js +622 -622
  33. package/src/workflow.js +652 -420
@@ -3,9 +3,11 @@ 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.
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`.
9
11
 
10
12
  ## Route
11
13
 
@@ -21,57 +23,57 @@ If and only if the `matrix` executable is reported as absent, run the bundled fa
21
23
  node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect
22
24
  ```
23
25
 
24
- - 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.
26
+ - 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.
25
27
  - 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`.
26
28
  - Do not create Matrix state for questions, read-only investigation, or requests outside software development.
27
29
  - Before `init`, derive a short kebab-case change id and an accurate title. Start with `full` unless a shortcut clearly applies.
28
30
 
29
31
  ```powershell
30
- matrix workflow init <change-id> --workflow <full|hotfix|tweak> --orchestration <prim|arch> --title "<title>"
31
- ```
32
-
33
- 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`.
34
-
35
- ## Orchestration
36
-
37
- - **Prim** uses Matrix's own capability in every phase and never requires Matt Skills.
38
- - **Arch** conditionally invokes the initialization-verified ten-Skill cohort when documented task-fact triggers are present.
39
-
40
- Both modes share the same Matrix phase graph, artifacts, guards, Return/Abort, Contract, transactions, and Archive protocol. Companion Skills never write Matrix state, transition, commit, archive, or create competing workflow artifacts. Announce each Arch capability and trigger before invoking it; do not ask for redundant per-Skill permission.
41
-
42
- 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.
43
-
44
- ## Recovery
45
-
46
- Use Runtime commands instead of editing Matrix state:
47
-
48
- ```powershell
49
- matrix workflow return design --reason design-gap
50
- matrix workflow return build --reason verification-failed
51
- matrix workflow return design --reason acceptance-or-design-gap
52
- matrix workflow return design --reason acceptance-or-design-gap # from Archive, before terminal archive
53
- matrix workflow abort --reason <requirement-cancelled|superseded|no-longer-valuable|blocked|other>
54
- ```
55
-
56
- 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.
57
-
58
- If any mutation reports `WORKFLOW_RECOVERY_REQUIRED`, stop normal phase work and run the read-only diagnosis:
59
-
60
- ```powershell
61
- matrix workflow doctor
62
- ```
63
-
64
- Never infer a repair target or strategy. Use only the exact command returned by doctor:
65
-
66
- ```powershell
67
- matrix workflow doctor --repair --transaction <id> --strategy <continue|rollback>
68
- matrix workflow doctor --repair --lock <id>
69
- ```
70
-
71
- ## Optional Claude handoff
32
+ matrix workflow init <change-id> --workflow <full|hotfix|tweak> --orchestration <prim|arch> --title "<title>"
33
+ ```
34
+
35
+ 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`.
36
+
37
+ ## Orchestration
38
+
39
+ - **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.
41
+
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.
43
+
44
+ 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
+
46
+ ## Recovery
47
+
48
+ Use Runtime commands instead of editing Matrix state:
49
+
50
+ ```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>
56
+ ```
57
+
58
+ 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.
59
+
60
+ If any mutation reports `WORKFLOW_RECOVERY_REQUIRED`, stop normal phase work and run the read-only diagnosis:
61
+
62
+ ```powershell
63
+ matrix workflow doctor
64
+ ```
65
+
66
+ Never infer a repair target or strategy. Use only the exact command returned by doctor:
67
+
68
+ ```powershell
69
+ matrix workflow doctor --repair --transaction <id> --strategy <continue|rollback>
70
+ matrix workflow doctor --repair --lock <id>
71
+ ```
72
+
73
+ ## Optional Claude handoff
72
74
 
73
- `$matrix-claude` is an optional sidecar command used after the approved Design -> Build transition. It exports the matching approved contract to a Claude Code task package. It never changes the Matrix phase, workflow, guard result, or runtime state.
74
- Use it only when the user explicitly chooses Codex design with Claude Code implementation; never inject it into the standard path.
75
+ `$matrix-claude` is an optional sidecar command used after the approved Design -> Build transition. It exports the matching approved contract to a Claude Code task package. It never changes the Matrix phase, workflow, guard result, or runtime state.
76
+ Use it only when the user explicitly chooses Codex design with Claude Code implementation; never inject it into the standard path.
75
77
 
76
78
  ## Cross-Cutting Skills
77
79
 
@@ -80,11 +82,11 @@ When context is running low and work needs to continue in a fresh session, use `
80
82
 
81
83
  ## Rules
82
84
 
83
- - A phase can advance only through `matrix workflow transition`; run its guard first.
84
- - A phase can move backward only through one of the documented `matrix workflow return` intents.
85
- - The Build transition approves the exact bytes of proposal, design, and plan. Any later byte change blocks Build, Verify, Archive, and Claude export until a controlled Return to Design and a new Build approval.
86
- - 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.
87
- - `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`.
88
- - Do not replace required evidence with an assertion that work is complete.
89
- - Pause for user confirmation at material architecture/scope decisions and before archive/commit.
90
- - On scope expansion, run `matrix workflow return design --reason design-gap` and enter `$matrix-design`; never silently continue the old plan.
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`.
90
+ - Do not replace required evidence with an assertion that work is complete.
91
+ - 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.
@@ -1,11 +1,11 @@
1
- #!/usr/bin/env python3
2
- """Compatibility adapter for the authoritative Node workflow exporter."""
3
- from __future__ import annotations
4
-
5
- import sys
6
-
7
- from matrix_state import run_runtime
8
-
9
-
10
- if __name__ == "__main__":
11
- raise SystemExit(run_runtime(sys.argv[1:]))
1
+ #!/usr/bin/env python3
2
+ """Compatibility adapter for the authoritative Node workflow exporter."""
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+
7
+ from matrix_state import run_runtime
8
+
9
+
10
+ if __name__ == "__main__":
11
+ raise SystemExit(run_runtime(sys.argv[1:]))
@@ -1,60 +1,60 @@
1
- #!/usr/bin/env python3
2
- """Compatibility adapter for the authoritative Node Workflow Runtime."""
3
- from __future__ import annotations
4
-
5
- import os
6
- import shutil
7
- import subprocess
8
- import sys
9
- from pathlib import Path
10
-
11
-
12
- def development_runtime() -> Path | None:
13
- """Return an explicitly selected source runtime for repository tests only."""
14
- configured = os.environ.get("MATRIX_DEVELOPMENT_RUNTIME")
15
- return Path(configured).resolve() if configured else None
16
-
17
-
18
- def primary_runtime() -> str | None:
19
- if os.name == "nt":
20
- return shutil.which("matrix.cmd") or shutil.which("matrix.exe")
21
- return shutil.which("matrix")
22
-
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:
31
- if not development.is_file():
32
- raise RuntimeError(f"Configured Matrix development runtime was not found: {development}")
33
- node = shutil.which("node")
34
- if node is None:
35
- raise RuntimeError("Node.js is required to run the Matrix workflow.")
36
- return [node, str(development), *args]
37
-
38
- bundled = Path(__file__).with_name("matrix-runtime.mjs")
39
- 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.")
44
-
45
-
46
- def run_runtime(args: list[str]) -> int:
47
- try:
48
- completed = subprocess.run(runtime_command(args), cwd=Path.cwd(), check=False)
49
- except (OSError, RuntimeError) as error:
50
- print(f"MATRIX ERROR [RUNTIME_UNAVAILABLE]: {error}", file=sys.stderr)
51
- return 2
52
- return completed.returncode
53
-
54
-
55
- def main() -> int:
56
- return run_runtime(sys.argv[1:])
57
-
58
-
59
- if __name__ == "__main__":
60
- raise SystemExit(main())
1
+ #!/usr/bin/env python3
2
+ """Compatibility adapter for the authoritative Node Workflow Runtime."""
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import shutil
7
+ import subprocess
8
+ import sys
9
+ from pathlib import Path
10
+
11
+
12
+ def development_runtime() -> Path | None:
13
+ """Return an explicitly selected source runtime for repository tests only."""
14
+ configured = os.environ.get("MATRIX_DEVELOPMENT_RUNTIME")
15
+ return Path(configured).resolve() if configured else None
16
+
17
+
18
+ def primary_runtime() -> str | None:
19
+ if os.name == "nt":
20
+ return shutil.which("matrix.cmd") or shutil.which("matrix.exe")
21
+ return shutil.which("matrix")
22
+
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:
31
+ if not development.is_file():
32
+ raise RuntimeError(f"Configured Matrix development runtime was not found: {development}")
33
+ node = shutil.which("node")
34
+ if node is None:
35
+ raise RuntimeError("Node.js is required to run the Matrix workflow.")
36
+ return [node, str(development), *args]
37
+
38
+ bundled = Path(__file__).with_name("matrix-runtime.mjs")
39
+ 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.")
44
+
45
+
46
+ def run_runtime(args: list[str]) -> int:
47
+ try:
48
+ completed = subprocess.run(runtime_command(args), cwd=Path.cwd(), check=False)
49
+ except (OSError, RuntimeError) as error:
50
+ print(f"MATRIX ERROR [RUNTIME_UNAVAILABLE]: {error}", file=sys.stderr)
51
+ return 2
52
+ return completed.returncode
53
+
54
+
55
+ def main() -> int:
56
+ return run_runtime(sys.argv[1:])
57
+
58
+
59
+ if __name__ == "__main__":
60
+ raise SystemExit(main())
@@ -1,33 +1,36 @@
1
- ---
2
- name: matrix-archive
3
- description: Close and archive a verified Matrix change. Use when the active Matrix phase is archive.
4
- ---
5
-
1
+ ---
2
+ name: matrix-archive
3
+ description: Close and archive a verified Matrix change. Use when the active Matrix phase is archive.
4
+ ---
5
+
6
6
  # Matrix Archive
7
7
 
8
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
9
 
10
- Archive is Matrix-owned in both Prim and Arch. Do not invoke companion implementation, review, or architecture capabilities here.
11
-
12
- ## Mandatory two-step Archive
13
-
14
- Run the read-only preflight and review its bounded effect summary. Then submit exactly the hash returned by that preflight:
15
-
16
- ```powershell
10
+ Write archive summaries and handoff prose in `artifact_language`; keep Runtime-required English heading tokens unchanged.
11
+
12
+ Archive is Matrix-owned in both Prim and Arch. Do not invoke companion implementation, review, or architecture capabilities here.
13
+
14
+ ## Mandatory two-step Archive
15
+
16
+ Run the read-only preflight and review its bounded effect summary. Then submit exactly the hash returned by that preflight:
17
+
18
+ ```powershell
17
19
  matrix workflow archive --dry-run
18
20
  matrix workflow archive --expect-preflight <sha256-returned-by-dry-run>
19
21
  ```
20
22
 
21
23
  Bare Archive is rejected. Runtime reacquires the project Archive boundary and recomputes the entire protected change-directory manifest before committing.
22
-
23
- - `ARCHIVE_PREFLIGHT_CHANGED`: run dry-run again and review the new summary.
24
- - `ARCHIVE_BUSY`: retry later. Do not remove or take over the lock; stale-lock recovery belongs to the later doctor/repair change.
25
- - Guard or Contract failure: use the returned recovery command and do not submit.
26
-
27
- If acceptance criteria or design must change while awaiting confirmation, use the sole Archive recovery path:
28
-
29
- ```powershell
30
- matrix workflow return design --reason acceptance-or-design-gap
31
- ```
32
-
33
- After successful commit, the change is under `.matrix/archive/` and the workflow is complete.
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
+
26
+ - `ARCHIVE_PREFLIGHT_CHANGED`: run dry-run again and review the new summary.
27
+ - `ARCHIVE_BUSY`: retry later. Do not remove or take over the lock; stale-lock recovery belongs to the later doctor/repair change.
28
+ - Guard or Contract failure: use the returned recovery command and do not submit.
29
+
30
+ If acceptance criteria or design must change while awaiting confirmation, use the sole Archive recovery path:
31
+
32
+ ```powershell
33
+ matrix workflow return design --reason acceptance-or-design-gap
34
+ ```
35
+
36
+ After successful commit, the change is under `.matrix/archive/` and the workflow is complete.
@@ -3,38 +3,40 @@ 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`. Read `plan.md`, `design.md`, the approved Contract, and repository instructions. Implement only the frozen scope.
9
-
10
- ## Prim
11
-
12
- Use Matrix's own implementation and test discipline.
13
-
14
- ## Arch
6
+ # Matrix Build
15
7
 
16
- - invoke `tdd` when the change modifies observable behavior at a testable seam;
17
- - invoke `diagnosing-bugs` only when an actual failure exists and root cause is not established;
18
- - invoke `resolving-merge-conflicts` only for an in-progress merge or rebase conflict.
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.
19
9
 
20
- 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.
10
+ Write build evidence and user-facing explanations in `artifact_language`; preserve any Runtime-required English heading tokens.
11
+
12
+ ## Prim
13
+
14
+ Use Matrix's own implementation and test discipline.
15
+
16
+ ## Arch
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.
21
+
22
+ 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.
21
23
 
22
24
  ## Scope Discipline
23
25
 
24
- If implementation exposes a scope or design change, **stop and run**:
25
-
26
- ```powershell
27
- matrix workflow return design --reason design-gap
28
- ```
29
-
30
- 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.
26
+ If implementation exposes a scope or design change, **stop and run**; a lightweight change is upgraded to full by this Return:
27
+
28
+ ```powershell
29
+ matrix workflow return design --reason design-gap
30
+ ```
31
+
32
+ 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.
31
33
 
32
34
  ## Process
33
35
 
34
- 1. Implement the approved plan in bounded vertical slices.
35
- 2. Use only triggered Arch capabilities.
36
- 3. Record commands, outcomes, capability invocations and fallbacks under `## Build evidence`.
37
- 4. Run the guard and transition, then enter `$matrix-verify`.
36
+ 1. Implement the approved plan in bounded vertical slices.
37
+ 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`.
39
+ 4. Run the guard and transition, then enter `$matrix-verify`.
38
40
 
39
41
  ```powershell
40
42
  matrix workflow guard build
@@ -3,14 +3,16 @@ 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`.
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.
9
11
 
10
12
  ## When to Use
11
13
 
12
14
  Use `$matrix-claude` when:
13
- - The active change is in Build and the Design -> Build transition has approved the contract
15
+ - The active change is in Build and the Design -> Build transition has approved the contract
14
16
  - You want Claude Code (instead of Codex) to implement the design
15
17
  - You need a bounded task package with all implementation details
16
18
 
@@ -19,16 +21,16 @@ Use `$matrix-claude` when:
19
21
  The exporter performs this read-only check before writing anything:
20
22
 
21
23
  ```powershell
22
- matrix workflow guard build
24
+ matrix workflow guard build
23
25
  ```
24
26
 
25
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.
26
28
 
27
- If the build guard reports `CONTRACT_CHANGED` or `CONTRACT_UNAPPROVED`, return to `$matrix-design` and approve a new contract through Build. The exporter reads the approved bytes of `proposal.md`, `design.md`, and `plan.md`; it does not invent missing facts.
29
+ If the build guard reports `CONTRACT_CHANGED` or `CONTRACT_UNAPPROVED`, return to `$matrix-design` and approve a new contract through Build. The exporter reads the approved bytes of `proposal.md`, `design.md`, and `plan.md`; it does not invent missing facts.
28
30
 
29
31
  ## Export
30
32
 
31
- Treat explicit invocation of `$matrix-claude` as the user's choice of Claude Code as the implementation actor. Generate the package with the deterministic exporter; it refuses a non-matching approved contract and does not alter Matrix state.
33
+ Treat explicit invocation of `$matrix-claude` as the user's choice of Claude Code as the implementation actor. Generate the package with the deterministic exporter; it refuses a non-matching approved contract and does not alter Matrix state.
32
34
 
33
35
  ```powershell
34
36
  # Generic project: only exports a Matrix artifact.
@@ -43,7 +45,7 @@ matrix workflow export --task-id <ID> --target fnsec --apply-fnsec-board
43
45
 
44
46
  The exported package (`artifacts/claude-task.md`) contains everything Claude Code needs to implement and produce evidence for `$matrix-verify`:
45
47
 
46
- 1. **Task ID, execution actor, and approved contract hash**: Claude Code and the exact approved snapshot
48
+ 1. **Task ID, execution actor, and approved contract hash**: Claude Code and the exact approved snapshot
47
49
  2. **Objective and acceptance criteria** — copied from `proposal.md`
48
50
  3. **In-scope and out-of-scope boundaries** — from `proposal.md`
49
51
  4. **Frozen design decisions** — from `design.md` (Decisions, Boundaries, Test seams)
@@ -91,6 +93,6 @@ If the build guard fails, return to Claude Code to补充 missing evidence.
91
93
  ## Important Notes
92
94
 
93
95
  - This sidecar does NOT change Matrix phase, workflow, or guard result
94
- - The Matrix state remains in `build` phase; export itself does not advance it
96
+ - The Matrix state remains in `build` phase; export itself does not advance it
95
97
  - Claude Code must produce evidence that satisfies the build guard conditions
96
98
  - After successful transition to verify, the normal verify流程 continues
@@ -3,34 +3,38 @@ 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
- 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`.
9
-
10
- ## Prim
11
-
12
- Use Matrix's own capability to investigate the repository and design the change.
6
+ # Matrix Design
13
7
 
14
- ## Arch
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.
15
9
 
16
- Invoke only capabilities whose task-fact trigger is proven:
10
+ Use `artifact_language` from `matrix workflow inspect` for all design and plan prose. Keep Runtime-required English heading tokens unchanged.
17
11
 
18
- - `domain-modeling` for unclear vocabulary, invariants, or architectural decisions;
19
- - `research` when required external facts cannot be established from the repository;
20
- - `wayfinder` when module ownership or dependency seams are unknown;
21
- - `prototype` when a material design decision needs disposable empirical evidence;
22
- - `codebase-design` when a deep-module, interface, or test-seam decision remains.
23
-
24
- 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.
25
-
26
- 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.
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`.
13
+
14
+ ## Prim
15
+
16
+ Use Matrix's own capability to investigate the repository and design the change.
17
+
18
+ ## Arch
19
+
20
+ Invoke only capabilities whose task-fact trigger is proven:
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.
27
+
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
+
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.
27
31
 
28
32
  ## Process
29
33
 
30
- 1. Establish repository facts and resolve only triggered design questions.
31
- 2. Write and synchronize the canonical Matrix design and plan.
32
- 3. Confirm material architecture choices with the user before freezing.
33
- 4. Run the guard, then choose the implementation actor.
34
+ 1. Establish repository facts and resolve only triggered design questions.
35
+ 2. Write and synchronize the canonical Matrix design and plan.
36
+ 3. Confirm material architecture choices with the user before freezing.
37
+ 4. Run the guard, then choose the implementation actor.
34
38
 
35
39
  ```powershell
36
40
  matrix workflow guard design
@@ -52,16 +56,16 @@ Then enter `$matrix-build` to implement directly in this session.
52
56
 
53
57
  ### Option B: Use Claude Code for implementation
54
58
 
55
- First approve the frozen contract by transitioning to Build, then run `$matrix-claude` to export a bounded task package. This:
56
- - Does not change the Build phase or state beyond the preceding transition
59
+ First approve the frozen contract by transitioning to Build, then run `$matrix-claude` to export a bounded task package. This:
60
+ - Does not change the Build phase or state beyond the preceding transition
57
61
  - Creates `artifacts/claude-task.md` with all implementation details
58
62
  - Includes acceptance criteria, test seams, and required commands
59
63
 
60
- After Claude Code completes and returns results, run the Build guard and enter `$matrix-verify`:
64
+ After Claude Code completes and returns results, run the Build guard and enter `$matrix-verify`:
61
65
 
62
66
  ```powershell
63
- matrix workflow guard build
64
- matrix workflow transition verify
67
+ matrix workflow guard build
68
+ matrix workflow transition verify
65
69
  ```
66
70
 
67
71
  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` and preserve its frozen Prim or Arch orchestration. Prim diagnoses directly. Arch invokes `diagnosing-bugs` only when an actual failure exists and root cause is not established. Write the compact proposal, continue through the normal Matrix gates, and keep all companion output subordinate to Matrix artifacts and state. If the bug requires architecture change, a new public API, schema work, or broad coordination, use controlled Return and upgrade the work to a full Matrix change.
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,28 +3,38 @@ 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`, read the active change and its frozen `orchestration`, then produce `artifacts/proposal.md` containing exactly these substantive sections: `## Goal`, `## Scope`, `## Non-goals`, `## Acceptance`, and `## Risks`.
9
-
10
- ## Prim
11
-
12
- Use Matrix's own capability to clarify the request and write the proposal.
6
+ # Matrix Open
13
7
 
14
- ## Arch
8
+ Run `matrix workflow inspect` and follow its `profile` and `evidence_policy`.
15
9
 
16
- 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.
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.
17
11
 
18
- 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.
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`.
19
16
 
20
- ## Process
17
+ ## Prim
18
+
19
+ Use Matrix's own capability to clarify the request and write the proposal.
21
20
 
22
- 1. Resolve only ambiguities required by the active workflow.
23
- 2. Write the canonical proposal and synchronize material companion conclusions into it.
24
- 3. Ask the user to confirm when scope or risk is material.
25
- 4. Run the guard and transition, then enter `$matrix-design`.
21
+ ## Arch
26
22
 
27
- ```powershell
28
- matrix workflow guard open
29
- matrix workflow transition design
30
- ```
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
+ 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
+
27
+ ## Process
28
+
29
+ 1. Resolve only ambiguities required by the active workflow.
30
+ 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
+ ```