@rosenfan/matrix 0.1.0
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.
- package/.claude/skills/matrix/SKILL.md +49 -0
- package/.claude/skills/matrix/agents/openai.yaml +4 -0
- package/.claude/skills/matrix/scripts/matrix_claude.py +166 -0
- package/.claude/skills/matrix/scripts/matrix_state.py +114 -0
- package/.claude/skills/matrix-archive/SKILL.md +26 -0
- package/.claude/skills/matrix-archive/agents/openai.yaml +4 -0
- package/.claude/skills/matrix-build/SKILL.md +55 -0
- package/.claude/skills/matrix-build/agents/openai.yaml +4 -0
- package/.claude/skills/matrix-claude/SKILL.md +96 -0
- package/.claude/skills/matrix-claude/agents/openai.yaml +4 -0
- package/.claude/skills/matrix-design/SKILL.md +68 -0
- package/.claude/skills/matrix-design/agents/openai.yaml +4 -0
- package/.claude/skills/matrix-hotfix/SKILL.md +8 -0
- package/.claude/skills/matrix-hotfix/agents/openai.yaml +4 -0
- package/.claude/skills/matrix-open/SKILL.md +33 -0
- package/.claude/skills/matrix-open/agents/openai.yaml +4 -0
- package/.claude/skills/matrix-status/SKILL.md +14 -0
- package/.claude/skills/matrix-status/agents/openai.yaml +4 -0
- package/.claude/skills/matrix-tweak/SKILL.md +8 -0
- package/.claude/skills/matrix-tweak/agents/openai.yaml +4 -0
- package/.claude/skills/matrix-verify/SKILL.md +82 -0
- package/.claude/skills/matrix-verify/agents/openai.yaml +4 -0
- package/LICENSE +21 -0
- package/README.md +273 -0
- package/README.zh-CN.md +271 -0
- package/assets/skills-zh-CN/matrix/SKILL.md +28 -0
- package/assets/skills-zh-CN/matrix-archive/SKILL.md +12 -0
- package/assets/skills-zh-CN/matrix-build/SKILL.md +13 -0
- package/assets/skills-zh-CN/matrix-claude/SKILL.md +30 -0
- package/assets/skills-zh-CN/matrix-design/SKILL.md +13 -0
- package/assets/skills-zh-CN/matrix-hotfix/SKILL.md +8 -0
- package/assets/skills-zh-CN/matrix-open/SKILL.md +13 -0
- package/assets/skills-zh-CN/matrix-status/SKILL.md +14 -0
- package/assets/skills-zh-CN/matrix-tweak/SKILL.md +8 -0
- package/assets/skills-zh-CN/matrix-verify/SKILL.md +13 -0
- package/bin/matrix.js +15 -0
- package/package.json +56 -0
- package/src/catalog.js +87 -0
- package/src/cli.js +117 -0
- package/src/distribution.js +192 -0
- package/src/installer.js +45 -0
- package/src/matt.js +34 -0
- package/src/messages.js +33 -0
- package/src/ui.js +89 -0
- package/src/workflow.js +95 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: matrix-status
|
|
3
|
+
description: Inspect the active Matrix workflow and report its disk-backed phase, guard result, and recovery command. Use when the user asks for Matrix status, next step, or to resume interrupted Matrix work.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Matrix Status
|
|
7
|
+
|
|
8
|
+
Run the same Matrix state kernel used by the main entry and every phase Skill:
|
|
9
|
+
|
|
10
|
+
```powershell
|
|
11
|
+
matrix workflow inspect
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Report the returned change id, workflow, phase, guard result, and `next_skill`. Do not infer status from conversation history and do not modify state. If the guard is failing, name the missing evidence and direct the user to the current phase Skill.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: matrix-tweak
|
|
3
|
+
description: Run a lightweight Matrix workflow for a bounded small development change. Use for a small request with no schema, public API, architecture, or cross-module coordination impact.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Matrix Tweak
|
|
7
|
+
|
|
8
|
+
Start through `$matrix` with workflow `tweak`. Keep proposal and design concise, but still define acceptance criteria and test seams. Upgrade to full `$matrix` when the change crosses module, API, schema, or architecture boundaries.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: matrix-verify
|
|
3
|
+
description: Verify the active Matrix change against its plan and review its diff. Use when the active Matrix phase is verify.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Matrix Verify
|
|
7
|
+
|
|
8
|
+
Run the plan's acceptance commands and record their output summaries under `## Test evidence` in `artifacts/verification.md`.
|
|
9
|
+
|
|
10
|
+
## Input Sources
|
|
11
|
+
|
|
12
|
+
This phase can receive implementation from two sources:
|
|
13
|
+
|
|
14
|
+
1. **Direct Codex implementation** — from `$matrix-build` phase
|
|
15
|
+
2. **Claude Code implementation** — from `$matrix-claude` sidecar
|
|
16
|
+
|
|
17
|
+
Regardless of source, the verification process is the same: check that implementation evidence meets the plan's requirements.
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
Before starting verification, ensure:
|
|
22
|
+
|
|
23
|
+
- [ ] `artifacts/verification.md` exists
|
|
24
|
+
- [ ] `## Build evidence` section is present and substantive
|
|
25
|
+
- [ ] All commands from the plan's `## Validation` section have been run
|
|
26
|
+
- [ ] Test results are recorded
|
|
27
|
+
|
|
28
|
+
If these are missing (e.g., Claude Code didn't produce complete evidence), return to `$matrix-build` or ask Claude Code to补充.
|
|
29
|
+
|
|
30
|
+
## Skills to Use
|
|
31
|
+
|
|
32
|
+
### Primary: `code-review`
|
|
33
|
+
|
|
34
|
+
Use the `code-review` skill to perform a two-axis review of the diff:
|
|
35
|
+
|
|
36
|
+
1. **Standards axis** — Does the code conform to this repo's documented coding standards? Includes a "smell baseline" (Fowler code smells) even when no standards are documented.
|
|
37
|
+
|
|
38
|
+
2. **Spec axis** — Does the code faithfully implement the originating issue/PRD/spec? Checks for:
|
|
39
|
+
- Missing or partial requirements
|
|
40
|
+
- Scope creep (behavior not asked for)
|
|
41
|
+
- Wrong implementations of required behavior
|
|
42
|
+
|
|
43
|
+
Both axes run as parallel sub-agents and report separately. Record findings under `## Review evidence` in `artifacts/verification.md`.
|
|
44
|
+
|
|
45
|
+
### Optional: `improve-codebase-architecture`
|
|
46
|
+
|
|
47
|
+
After verification passes, if the change touched modules that could be deepened, use `improve-codebase-architecture` to scan for shallow-module opportunities. This is advisory — skip it for simple changes or when time is constrained.
|
|
48
|
+
|
|
49
|
+
## Failure Handling
|
|
50
|
+
|
|
51
|
+
If verification or review fails:
|
|
52
|
+
- If the issue is in the implementation → **return to `$matrix-build`** or ask Claude Code to fix
|
|
53
|
+
- If the issue is in the plan/design → return to `$matrix-design`
|
|
54
|
+
|
|
55
|
+
If documents or public behavior changed, record the required synchronization work before the guard.
|
|
56
|
+
|
|
57
|
+
## Process
|
|
58
|
+
|
|
59
|
+
1. Check that `artifacts/verification.md` exists with `## Build evidence`
|
|
60
|
+
2. Run the plan's acceptance commands (from `plan.md` `## Validation` section)
|
|
61
|
+
3. Record test output under `## Test evidence`
|
|
62
|
+
4. Load `code-review` skill
|
|
63
|
+
5. Run both axes (Standards + Spec) in parallel
|
|
64
|
+
6. Record findings under `## Review evidence`
|
|
65
|
+
7. Optionally run `improve-codebase-architecture`
|
|
66
|
+
8. Run the guard
|
|
67
|
+
9. If guard passes, run transition to advance to archive phase
|
|
68
|
+
10. **Then enter `$matrix-archive` to continue the workflow**
|
|
69
|
+
|
|
70
|
+
```powershell
|
|
71
|
+
matrix workflow guard verify
|
|
72
|
+
matrix workflow transition archive
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Evidence Requirements
|
|
76
|
+
|
|
77
|
+
The guard checks for:
|
|
78
|
+
|
|
79
|
+
1. **Test evidence** — Output from running the plan's validation commands
|
|
80
|
+
2. **Review evidence** — Findings from the two-axis code review
|
|
81
|
+
|
|
82
|
+
Both must be present and substantive (>40 chars each) to pass the guard.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rosen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Matrix Workflow
|
|
2
|
+
|
|
3
|
+
A structured workflow orchestrator for [Matt Pocock's Claude Code skills](https://github.com/mattpocock/skills), inspired by [Comet](https://github.com/rpamis/comet). It enforces evidence-based phase transitions to standardize your development process when using these skills.
|
|
4
|
+
|
|
5
|
+
English | **[中文](./README.zh-CN.md)**
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="./assets/matrix-workflow-poster-en.svg" alt="Matrix Workflow" width="100%">
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Table of Contents
|
|
14
|
+
|
|
15
|
+
- [Why Matrix?](#why-matrix)
|
|
16
|
+
- [What It Does](#what-it-does)
|
|
17
|
+
- [Prerequisites](#prerequisites)
|
|
18
|
+
- [Installation](#installation)
|
|
19
|
+
- [Quick Start](#quick-start)
|
|
20
|
+
- [Workflow Phases](#workflow-phases)
|
|
21
|
+
- [How It Works](#how-it-works)
|
|
22
|
+
- [Workflow Types](#workflow-types)
|
|
23
|
+
- [Integration with Matt Pocock's Skills](#integration-with-matt-pococks-skills)
|
|
24
|
+
- [License](#license)
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Why Matrix
|
|
29
|
+
|
|
30
|
+
[Matt Pocock's skills](https://github.com/mattpocock/skills) are excellent individual tools — `/grill-with-docs` for requirements, `/tdd` for test-driven development, `/implement` for execution. But using them in isolation leads to common problems:
|
|
31
|
+
|
|
32
|
+
- **No process memory**: You grill, then implement, but there's no record of what was decided
|
|
33
|
+
- **Phase confusion**: Did we finish design? Are we in build? Hard to tell after context loss
|
|
34
|
+
- **Silent scope creep**: Requirements change mid-build without returning to design
|
|
35
|
+
- **Missing evidence**: "Looks done" without verification proof
|
|
36
|
+
|
|
37
|
+
Matrix solves this by wrapping these skills into a deterministic state machine with explicit phases, guard conditions, and artifact tracking — inspired by [Comet](https://github.com/rpamis/comet)'s phase-based approach.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## What It Does
|
|
42
|
+
|
|
43
|
+
Matrix orchestrates Matt Pocock's skills into a structured workflow:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
open → design → build → verify → archive
|
|
47
|
+
↓ ↓ ↓ ↓ ↓
|
|
48
|
+
grill plan implement tdd commit
|
|
49
|
+
design review
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Each phase:
|
|
53
|
+
- Has specific deliverables (artifacts)
|
|
54
|
+
- Has guard conditions that must pass
|
|
55
|
+
- Logs all transitions
|
|
56
|
+
- Survives context loss (state on disk)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Prerequisites
|
|
61
|
+
|
|
62
|
+
- [Claude Code](https://docs.anthropic.com/claude-code) and/or Codex installed
|
|
63
|
+
- Node.js 18+ (for the installer)
|
|
64
|
+
- Python is optional during the compatibility window; new installations run the bundled Node workflow runtime.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
Install the Matrix CLI once:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install --global @rosenfan/matrix
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Then initialize Matrix inside any project:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
cd /path/to/your/project
|
|
80
|
+
matrix init
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The interactive setup lets you:
|
|
84
|
+
|
|
85
|
+
- Choose English or Chinese, project or global scope, and Claude Code, Codex, or both
|
|
86
|
+
- Copy skills (recommended) or symlink them for local development
|
|
87
|
+
- Safely update an existing installation with an automatic backup
|
|
88
|
+
- Install Matt Pocock's companion skills in the same flow
|
|
89
|
+
|
|
90
|
+
For automation and CI:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Safe non-interactive installation for both verified platforms
|
|
94
|
+
matrix init --yes --platform claude-code --platform codex --with-mattpocock
|
|
95
|
+
|
|
96
|
+
# Preview exactly what would change (including backups) without writing
|
|
97
|
+
matrix init --platform codex --dry-run --json
|
|
98
|
+
|
|
99
|
+
# Inspect Matrix ownership, Matt Skills inheritance, and the selected platform
|
|
100
|
+
matrix doctor --platform codex
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Until the npm package is published, install directly from GitHub:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npm install --global github:Rosenfan/Matrix
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Matrix installs:
|
|
110
|
+
- `matrix/` — Entry point and state management
|
|
111
|
+
- `matrix-open/` — Open phase (uses `/grill-with-docs`)
|
|
112
|
+
- `matrix-design/` — Design phase (uses `/prototype`, `/research`)
|
|
113
|
+
- `matrix-build/` — Build phase (uses `/implement`, `/tdd`)
|
|
114
|
+
- `matrix-verify/` — Verify phase (uses `/code-review`)
|
|
115
|
+
- `matrix-archive/` — Archive phase
|
|
116
|
+
- `matrix-hotfix/` — Shortcut for small bugs
|
|
117
|
+
- `matrix-tweak/` — Shortcut for bounded changes
|
|
118
|
+
- `matrix-status/` — Check current state
|
|
119
|
+
- `matrix-claude/` — Optional: export for Claude Code
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Quick Start
|
|
124
|
+
|
|
125
|
+
In Claude Code:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
$matrix I want to add user authentication
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Matrix will:
|
|
132
|
+
1. Initialize a change with workflow type `full`
|
|
133
|
+
2. Enter `open` phase → invokes `/grill-with-docs` to clarify requirements
|
|
134
|
+
3. Create `proposal.md` with Goal, Scope, Acceptance, Risks
|
|
135
|
+
4. Guard check: are all sections substantive?
|
|
136
|
+
5. If pass → transition to `design`
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Workflow Phases
|
|
141
|
+
|
|
142
|
+
| Phase | Matt Pocock Skills Used | Deliverables | Guard Condition |
|
|
143
|
+
|-------|-------------------------|--------------|-----------------|
|
|
144
|
+
| **open** | `/grill-with-docs` (auto-invokes `/grilling` + `/domain-modeling`) | `proposal.md`, `CONTEXT.md`, ADRs | Goal, Scope, Acceptance, Risks present |
|
|
145
|
+
| **design** | `/domain-modeling` → `/research` → `/wayfinder` → `/prototype` → `/codebase-design` | `design.md`, `plan.md` | Decisions, Test seams, Steps documented |
|
|
146
|
+
| **build** | `/implement` (auto-invokes `/tdd` + `/code-review`), `/diagnosing-bugs`, `/resolving-merge-conflicts` | Code, `verification.md` | Plan exists, build evidence recorded |
|
|
147
|
+
| **verify** | `/code-review` (two-axis: Standards + Spec), `/improve-codebase-architecture` | Test & review evidence | Test and review evidence present |
|
|
148
|
+
| **archive** | — | Git commit | Verify guard passed |
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## How It Works
|
|
153
|
+
|
|
154
|
+
State is stored in `.matrix/`:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
.matrix/
|
|
158
|
+
├── active.json # Current change ID
|
|
159
|
+
├── config.yaml
|
|
160
|
+
├── changes/
|
|
161
|
+
│ └── <change-id>/
|
|
162
|
+
│ ├── matrix.yaml # Phase, workflow, timestamps
|
|
163
|
+
│ ├── run-state.json
|
|
164
|
+
│ ├── events.jsonl
|
|
165
|
+
│ └── artifacts/
|
|
166
|
+
│ ├── proposal.md
|
|
167
|
+
│ ├── design.md
|
|
168
|
+
│ ├── plan.md
|
|
169
|
+
│ └── verification.md
|
|
170
|
+
└── archive/
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The state machine enforces transitions:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Check guard
|
|
177
|
+
python .claude/skills/matrix/scripts/matrix_state.py guard open
|
|
178
|
+
|
|
179
|
+
# Advance (only if guard passes)
|
|
180
|
+
python .claude/skills/matrix/scripts/matrix_state.py transition design
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Workflow Types
|
|
186
|
+
|
|
187
|
+
| Type | When to Use | Phases |
|
|
188
|
+
|------|-------------|--------|
|
|
189
|
+
| **full** | New features, architecture changes | All 5 phases |
|
|
190
|
+
| **hotfix** | Reproducible small bugs | Simplified: open → build → verify → archive |
|
|
191
|
+
| **tweak** | Bounded changes, no API/schema impact | Simplified: open → build → verify → archive |
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Special Feature: matrix-claude
|
|
196
|
+
|
|
197
|
+
**Default usage**: Just use the main workflow (`$matrix`). Whether you're using Codex or Claude Code, the standard flow works for both:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
$matrix → open → design → build → verify → archive
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**When to use `$matrix-claude`**: Only when you want to **split the work across tools** — use Codex for design, then hand off to Claude Code for implementation.
|
|
204
|
+
|
|
205
|
+
| Scenario | What to Do |
|
|
206
|
+
|----------|------------|
|
|
207
|
+
| Use one tool for everything (default) | Just use `$matrix`, no extra steps |
|
|
208
|
+
| Codex designs + Codex implements | Standard flow: design → build → verify |
|
|
209
|
+
| Codex designs + Claude Code implements | design → `$matrix-claude` → Claude Code → verify |
|
|
210
|
+
|
|
211
|
+
### How matrix-claude Works
|
|
212
|
+
|
|
213
|
+
1. Design phase completes, guard passes
|
|
214
|
+
2. Run `$matrix-claude` → exports frozen design as `artifacts/claude-task.md`
|
|
215
|
+
3. Claude Code reads the task package and implements
|
|
216
|
+
4. Claude Code produces evidence in `artifacts/verification.md`
|
|
217
|
+
5. Return to Matrix: build guard → verify → archive
|
|
218
|
+
|
|
219
|
+
The sidecar does NOT change Matrix state. It's a pure export — like taking a snapshot of the design for another tool to consume.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Integration with Matt Pocock's Skills
|
|
224
|
+
|
|
225
|
+
Matrix is designed to work **on top of** Matt Pocock's skills, not replace them. Here's how they map:
|
|
226
|
+
|
|
227
|
+
### open Phase
|
|
228
|
+
|
|
229
|
+
| Skill | How Matrix Uses It |
|
|
230
|
+
|-------|-------------------|
|
|
231
|
+
| `/grill-with-docs` | Main skill: runs `/grilling` + `/domain-modeling` to clarify requirements |
|
|
232
|
+
| `/grilling` | Stress-tests the plan through relentless Q&A |
|
|
233
|
+
| `/domain-modeling` | Establishes shared vocabulary, creates `CONTEXT.md` and ADRs |
|
|
234
|
+
|
|
235
|
+
### design Phase (Recommended Order)
|
|
236
|
+
|
|
237
|
+
| Order | Skill | How Matrix Uses It |
|
|
238
|
+
|-------|-------|-------------------|
|
|
239
|
+
| 1 | `/domain-modeling` | Establish or refine domain vocabulary from the proposal |
|
|
240
|
+
| 2 | `/research` | Investigate external APIs, docs, specs (runs in background) |
|
|
241
|
+
| 3 | `/wayfinder` | Explore complex codebase structure and dependencies |
|
|
242
|
+
| 4 | `/prototype` | Validate design questions with throwaway experiments |
|
|
243
|
+
| 5 | `/codebase-design` | Define module boundaries, interfaces, test seams |
|
|
244
|
+
|
|
245
|
+
### build Phase
|
|
246
|
+
|
|
247
|
+
| Skill | How Matrix Uses It |
|
|
248
|
+
|-------|-------------------|
|
|
249
|
+
| `/implement` | Main skill: executes plan with TDD, then runs code review, then commits |
|
|
250
|
+
| `/tdd` | Auto-invoked by `/implement`: red-green-refactor at pre-agreed seams |
|
|
251
|
+
| `/diagnosing-bugs` | On failure: builds tight feedback loop before fixing |
|
|
252
|
+
| `/resolving-merge-conflicts` | On merge conflicts: systematic resolution |
|
|
253
|
+
|
|
254
|
+
### verify Phase
|
|
255
|
+
|
|
256
|
+
| Skill | How Matrix Uses It |
|
|
257
|
+
|-------|-------------------|
|
|
258
|
+
| `/code-review` | Two-axis review: **Standards** (coding conventions) + **Spec** (requirements fidelity) |
|
|
259
|
+
| `/improve-codebase-architecture` | Optional: scan for shallow-module deepening opportunities |
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
**Key difference**: Matt Pocock's skills are individual tools. Matrix adds:
|
|
264
|
+
- **State persistence**: Survives context loss
|
|
265
|
+
- **Phase enforcement**: Can't skip design and jump to build
|
|
266
|
+
- **Evidence requirements**: Guards check for artifacts, not assertions
|
|
267
|
+
- **Transition logging**: Full audit trail of phase changes
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## License
|
|
272
|
+
|
|
273
|
+
[MIT](./LICENSE)
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# Matrix Workflow
|
|
2
|
+
|
|
3
|
+
一个基于 [Matt Pocock 的 Claude Code skills](https://github.com/mattpocock/skills) 的结构化工作流编排器,灵感来自 [Comet](https://github.com/rpamis/comet)。它通过强制执行基于证据的阶段转换,规范使用这些 skills 时的开发流程。
|
|
4
|
+
|
|
5
|
+
**[English](./README.md)** | 中文
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="./assets/matrix-workflow-poster-zh.svg" alt="Matrix Workflow" width="100%">
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 目录
|
|
14
|
+
|
|
15
|
+
- [为什么需要 Matrix](#为什么需要-matrix)
|
|
16
|
+
- [它做了什么](#它做了什么)
|
|
17
|
+
- [前置条件](#前置条件)
|
|
18
|
+
- [安装](#安装)
|
|
19
|
+
- [快速开始](#快速开始)
|
|
20
|
+
- [工作流阶段](#工作流阶段)
|
|
21
|
+
- [工作原理](#工作原理)
|
|
22
|
+
- [工作流类型](#工作流类型)
|
|
23
|
+
- [与 Matt Pocock Skills 的集成](#与-matt-pocock-skills-的集成)
|
|
24
|
+
- [许可证](#许可证)
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 为什么需要 Matrix
|
|
29
|
+
|
|
30
|
+
[Matt Pocock 的 skills](https://github.com/mattpocock/skills) 是优秀的独立工具 —— `/grill-with-docs` 用于需求澄清,`/tdd` 用于测试驱动开发,`/implement` 用于执行实现。但单独使用它们会导致常见问题:
|
|
31
|
+
|
|
32
|
+
- **无流程记忆**:你进行了 grilling,然后实现,但没有记录决策过程
|
|
33
|
+
- **阶段混乱**:设计完成了吗?我们在构建阶段吗?上下文丢失后很难判断
|
|
34
|
+
- **静默范围蔓延**:需求在构建过程中变更,却没有返回设计阶段
|
|
35
|
+
- **缺少证据**:"看起来完成了"却没有验证证明
|
|
36
|
+
|
|
37
|
+
Matrix 通过将这些 skills 封装到确定性状态机中来解决这些问题 —— 包含明确的阶段、守卫条件和产物追踪。灵感来自 [Comet](https://github.com/rpamis/comet) 的阶段式方法。
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 它做了什么
|
|
42
|
+
|
|
43
|
+
Matrix 将 Matt Pocock 的 skills 编排成结构化工作流:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
open → design → build → verify → archive
|
|
47
|
+
(开放) (设计) (构建) (验证) (归档)
|
|
48
|
+
↓ ↓ ↓ ↓ ↓
|
|
49
|
+
grill plan implement tdd commit
|
|
50
|
+
design review
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
每个阶段:
|
|
54
|
+
- 有特定的交付物(产物)
|
|
55
|
+
- 有必须通过的守卫条件
|
|
56
|
+
- 记录所有转换
|
|
57
|
+
- 可承受上下文丢失(状态存储在磁盘上)
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 前置条件
|
|
62
|
+
|
|
63
|
+
- 已安装 [Claude Code](https://docs.anthropic.com/claude-code)
|
|
64
|
+
- Node.js 18+(用于运行安装器)
|
|
65
|
+
- Python 3.8+ 已添加到 PATH
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 安装
|
|
70
|
+
|
|
71
|
+
只需全局安装一次 Matrix CLI:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install --global @rosenfan/matrix
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
之后在任意项目中初始化:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
cd /path/to/your/project
|
|
81
|
+
matrix init
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
交互式初始化支持:
|
|
85
|
+
|
|
86
|
+
- 选择安装到当前项目或全局
|
|
87
|
+
- 复制 skills(推荐)或为本地开发创建符号链接
|
|
88
|
+
- 更新已有安装,并自动备份被替换的 Matrix 文件
|
|
89
|
+
- 在同一流程中安装 Matt Pocock 的配套 skills
|
|
90
|
+
|
|
91
|
+
自动化或 CI 环境可以使用:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# 使用推荐的项目级默认值,不显示交互问题
|
|
95
|
+
matrix init --yes --with-mattpocock
|
|
96
|
+
|
|
97
|
+
# 检查安装完整性和运行环境
|
|
98
|
+
matrix doctor
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
npm 包正式发布前,也可以直接从 GitHub 安装:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm install --global github:Rosenfan/Matrix
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Matrix 将安装:
|
|
108
|
+
- `matrix/` — 入口点和状态管理
|
|
109
|
+
- `matrix-open/` — 开放阶段(使用 `/grill-with-docs`)
|
|
110
|
+
- `matrix-design/` — 设计阶段(使用 `/prototype`、`/research`)
|
|
111
|
+
- `matrix-build/` — 构建阶段(使用 `/implement`、`/tdd`)
|
|
112
|
+
- `matrix-verify/` — 验证阶段(使用 `/code-review`)
|
|
113
|
+
- `matrix-archive/` — 归档阶段
|
|
114
|
+
- `matrix-hotfix/` — 小型 Bug 快捷方式
|
|
115
|
+
- `matrix-tweak/` — 有界变更快捷方式
|
|
116
|
+
- `matrix-status/` — 检查当前状态
|
|
117
|
+
- `matrix-claude/` — 可选:导出供 Claude Code 使用
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 快速开始
|
|
122
|
+
|
|
123
|
+
在 Claude Code 中:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
$matrix 我想给 API 添加用户认证
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Matrix 将会:
|
|
130
|
+
1. 用工作流类型 `full` 初始化一个变更
|
|
131
|
+
2. 进入 `open` 阶段 → 调用 `/grill-with-docs` 澄清需求
|
|
132
|
+
3. 创建 `proposal.md`,包含目标、范围、验收标准、风险
|
|
133
|
+
4. 守卫检查:所有章节是否内容充实?
|
|
134
|
+
5. 如果通过 → 转换到 `design`
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 工作流阶段
|
|
139
|
+
|
|
140
|
+
| 阶段 | 使用的 Matt Pocock Skills | 交付物 | 守卫条件 |
|
|
141
|
+
|------|---------------------------|--------|----------|
|
|
142
|
+
| **open** | `/grill-with-docs`(自动调用 `/grilling` + `/domain-modeling`) | `proposal.md`、`CONTEXT.md`、ADRs | 目标、范围、验收标准、风险存在 |
|
|
143
|
+
| **design** | `/domain-modeling` → `/research` → `/wayfinder` → `/prototype` → `/codebase-design` | `design.md`、`plan.md` | 决策、测试点、步骤已记录 |
|
|
144
|
+
| **build** | `/implement`(自动调用 `/tdd` + `/code-review`)、`/diagnosing-bugs`、`/resolving-merge-conflicts` | 代码、`verification.md` | 计划存在,构建证据已记录 |
|
|
145
|
+
| **verify** | `/code-review`(双轴:Standards + Spec)、`/improve-codebase-architecture` | 测试和审查证据 | 测试和审查证据存在 |
|
|
146
|
+
| **archive** | — | Git commit | 验证守卫通过 |
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 工作原理
|
|
151
|
+
|
|
152
|
+
状态存储在 `.matrix/` 目录:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
.matrix/
|
|
156
|
+
├── active.json # 当前变更 ID
|
|
157
|
+
├── config.yaml
|
|
158
|
+
├── changes/
|
|
159
|
+
│ └── <change-id>/
|
|
160
|
+
│ ├── matrix.yaml # 阶段、工作流、时间戳
|
|
161
|
+
│ ├── run-state.json
|
|
162
|
+
│ ├── events.jsonl
|
|
163
|
+
│ └── artifacts/
|
|
164
|
+
│ ├── proposal.md
|
|
165
|
+
│ ├── design.md
|
|
166
|
+
│ ├── plan.md
|
|
167
|
+
│ └── verification.md
|
|
168
|
+
└── archive/
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
状态机强制执行转换:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# 检查守卫
|
|
175
|
+
python .claude/skills/matrix/scripts/matrix_state.py guard open
|
|
176
|
+
|
|
177
|
+
# 推进(仅在守卫通过时)
|
|
178
|
+
python .claude/skills/matrix/scripts/matrix_state.py transition design
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 工作流类型
|
|
184
|
+
|
|
185
|
+
| 类型 | 使用场景 | 阶段 |
|
|
186
|
+
|------|----------|------|
|
|
187
|
+
| **full** | 新功能、架构变更 | 全部 5 个阶段 |
|
|
188
|
+
| **hotfix** | 可复现的小型 Bug | 简化:open → build → verify → archive |
|
|
189
|
+
| **tweak** | 有界变更,无 API/架构影响 | 简化:open → build → verify → archive |
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 特别功能:matrix-claude
|
|
194
|
+
|
|
195
|
+
**默认用法**:直接使用主流程即可。无论你用 Codex 还是 Claude Code,标准流程都适用:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
$matrix → open → design → build → verify → archive
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**何时使用 `$matrix-claude`**:仅当你想**跨工具拆分工作**时 —— 用 Codex 设计,然后交给 Claude Code 实现。
|
|
202
|
+
|
|
203
|
+
| 场景 | 操作 |
|
|
204
|
+
|------|------|
|
|
205
|
+
| 一个工具完成所有工作(默认) | 直接用 `$matrix`,无需额外步骤 |
|
|
206
|
+
| Codex 设计 + Codex 实现 | 标准流程:design → build → verify |
|
|
207
|
+
| Codex 设计 + Claude Code 实现 | design → `$matrix-claude` → Claude Code → verify |
|
|
208
|
+
|
|
209
|
+
### matrix-claude 工作原理
|
|
210
|
+
|
|
211
|
+
1. 设计阶段完成,守卫通过
|
|
212
|
+
2. 运行 `$matrix-claude` → 导出冻结的设计为 `artifacts/claude-task.md`
|
|
213
|
+
3. Claude Code 读取任务包并实现
|
|
214
|
+
4. Claude Code 在 `artifacts/verification.md` 中产生证据
|
|
215
|
+
5. 返回 Matrix:构建守卫 → 验证 → 归档
|
|
216
|
+
|
|
217
|
+
此 sidecar 不会改变 Matrix 状态。它只是纯粹的导出 —— 就像为另一个工具拍一张设计快照。
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 与 Matt Pocock Skills 的集成
|
|
222
|
+
|
|
223
|
+
Matrix 设计为**在 Matt Pocock 的 skills 之上工作**,而非替代它们。以下是各阶段的详细映射:
|
|
224
|
+
|
|
225
|
+
### open 阶段
|
|
226
|
+
|
|
227
|
+
| Skill | Matrix 如何使用 |
|
|
228
|
+
|-------|-----------------|
|
|
229
|
+
| `/grill-with-docs` | 主技能:运行 `/grilling` + `/domain-modeling` 澄清需求 |
|
|
230
|
+
| `/grilling` | 通过连续提问压力测试计划 |
|
|
231
|
+
| `/domain-modeling` | 建立共享词汇,创建 `CONTEXT.md` 和 ADRs |
|
|
232
|
+
|
|
233
|
+
### design 阶段(推荐顺序)
|
|
234
|
+
|
|
235
|
+
| 顺序 | Skill | Matrix 如何使用 |
|
|
236
|
+
|------|-------|-----------------|
|
|
237
|
+
| 1 | `/domain-modeling` | 从提案中建立或精炼领域词汇 |
|
|
238
|
+
| 2 | `/research` | 调查外部 API、文档、规范(后台运行) |
|
|
239
|
+
| 3 | `/wayfinder` | 探索复杂代码库结构和依赖 |
|
|
240
|
+
| 4 | `/prototype` | 用一次性实验验证设计问题 |
|
|
241
|
+
| 5 | `/codebase-design` | 定义模块边界、接口、测试点 |
|
|
242
|
+
|
|
243
|
+
### build 阶段
|
|
244
|
+
|
|
245
|
+
| Skill | Matrix 如何使用 |
|
|
246
|
+
|-------|-----------------|
|
|
247
|
+
| `/implement` | 主技能:执行计划,使用 TDD,运行代码审查,然后提交 |
|
|
248
|
+
| `/tdd` | 由 `/implement` 自动调用:在确认的接缝处进行红绿重构 |
|
|
249
|
+
| `/diagnosing-bugs` | 遇到失败时:先构建紧凑的反馈循环再修复 |
|
|
250
|
+
| `/resolving-merge-conflicts` | 遇到合并冲突时:系统性解决 |
|
|
251
|
+
|
|
252
|
+
### verify 阶段
|
|
253
|
+
|
|
254
|
+
| Skill | Matrix 如何使用 |
|
|
255
|
+
|-------|-----------------|
|
|
256
|
+
| `/code-review` | 双轴审查:**Standards**(编码规范)+ **Spec**(需求忠实度) |
|
|
257
|
+
| `/improve-codebase-architecture` | 可选:扫描浅模块深化机会 |
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
**关键区别**:Matt Pocock 的 skills 是独立工具。Matrix 增加了:
|
|
262
|
+
- **状态持久化**:可承受上下文丢失
|
|
263
|
+
- **阶段强制**:不能跳过设计直接进入构建
|
|
264
|
+
- **证据要求**:守卫检查产物,而非断言
|
|
265
|
+
- **转换日志**:完整的阶段变更审计记录
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 许可证
|
|
270
|
+
|
|
271
|
+
[MIT](./LICENSE)
|