@rosenfan/matrix 0.1.4 → 0.1.6
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/LICENSE +21 -21
- package/README.md +41 -40
- package/README.zh-CN.md +39 -38
- package/{.claude → assets}/skills/matrix/SKILL.md +79 -78
- package/{.claude → assets}/skills/matrix/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix/scripts/matrix_claude.py +11 -11
- package/{.claude → assets}/skills/matrix/scripts/matrix_state.py +49 -49
- package/assets/skills/matrix/scripts/test_matrix_claude.py +69 -0
- package/assets/skills/matrix/scripts/test_matrix_state.py +69 -0
- package/{.claude → assets}/skills/matrix-archive/SKILL.md +36 -36
- package/{.claude/skills/matrix-hotfix → assets/skills/matrix-archive}/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix-build/SKILL.md +41 -41
- package/{.claude/skills/matrix-archive → assets/skills/matrix-build}/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix-design/SKILL.md +71 -65
- package/{.claude → assets}/skills/matrix-design/agents/openai.yaml +4 -4
- package/assets/skills/matrix-handoff/SKILL.md +89 -0
- package/{.claude/skills/matrix-claude → assets/skills/matrix-handoff}/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix-hotfix/SKILL.md +8 -8
- package/{.claude/skills/matrix-build → assets/skills/matrix-hotfix}/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix-open/SKILL.md +51 -40
- package/assets/skills/matrix-open/agents/openai.yaml +4 -0
- package/{.claude → assets}/skills/matrix-status/SKILL.md +15 -15
- package/{.claude → assets}/skills/matrix-status/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix-tweak/SKILL.md +8 -8
- package/assets/skills/matrix-tweak/agents/openai.yaml +4 -0
- package/{.claude → assets}/skills/matrix-verify/SKILL.md +62 -62
- package/assets/skills/matrix-verify/agents/openai.yaml +4 -0
- package/assets/skills-zh-CN/matrix/SKILL.md +72 -71
- package/assets/skills-zh-CN/matrix-build/SKILL.md +4 -4
- package/assets/skills-zh-CN/matrix-design/SKILL.md +37 -20
- package/assets/skills-zh-CN/matrix-handoff/SKILL.md +79 -0
- package/assets/skills-zh-CN/matrix-open/SKILL.md +38 -28
- package/assets/skills-zh-CN/matrix-verify/SKILL.md +19 -19
- package/bin/matrix.js +15 -15
- package/package.json +4 -13
- package/src/catalog.js +79 -72
- package/src/cli.js +211 -141
- package/src/distribution.js +182 -179
- package/src/installer.js +10 -10
- package/src/matt-catalog.mjs +1 -1
- package/src/matt.js +9 -14
- package/src/messages.js +32 -23
- package/src/npm-invocation.js +23 -0
- package/src/project-index.js +43 -0
- package/src/runtime-resolver.js +76 -76
- package/src/self-update.js +88 -81
- package/src/ui.js +97 -89
- package/src/workflow-transaction.js +13 -13
- package/src/workflow.js +734 -705
- package/.claude/skills/matrix-claude/SKILL.md +0 -98
- package/.claude/skills/matrix-open/agents/openai.yaml +0 -4
- package/.claude/skills/matrix-tweak/agents/openai.yaml +0 -4
- package/.claude/skills/matrix-verify/agents/openai.yaml +0 -4
- package/assets/skills-zh-CN/matrix-claude/SKILL.md +0 -33
|
@@ -1,38 +1,38 @@
|
|
|
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
|
-
|
|
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
24
|
def runtime_command(args: list[str]) -> list[str]:
|
|
25
25
|
development = development_runtime()
|
|
26
26
|
if development is not None:
|
|
27
|
-
if not development.is_file():
|
|
28
|
-
raise RuntimeError(f"Configured Matrix development runtime was not found: {development}")
|
|
29
|
-
node = shutil.which("node")
|
|
30
|
-
if node is None:
|
|
31
|
-
raise RuntimeError("Node.js is required to run the Matrix workflow.")
|
|
32
|
-
return [node, str(development), *args]
|
|
33
|
-
|
|
34
|
-
bundled = Path(__file__).with_name("matrix-runtime.mjs")
|
|
35
|
-
node = shutil.which("node")
|
|
27
|
+
if not development.is_file():
|
|
28
|
+
raise RuntimeError(f"Configured Matrix development runtime was not found: {development}")
|
|
29
|
+
node = shutil.which("node")
|
|
30
|
+
if node is None:
|
|
31
|
+
raise RuntimeError("Node.js is required to run the Matrix workflow.")
|
|
32
|
+
return [node, str(development), *args]
|
|
33
|
+
|
|
34
|
+
bundled = Path(__file__).with_name("matrix-runtime.mjs")
|
|
35
|
+
node = shutil.which("node")
|
|
36
36
|
if node is not None and bundled.exists():
|
|
37
37
|
return [node, str(bundled), *args]
|
|
38
38
|
|
|
@@ -41,20 +41,20 @@ def runtime_command(args: list[str]) -> list[str]:
|
|
|
41
41
|
return [primary, "workflow", *args, "--json"]
|
|
42
42
|
|
|
43
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())
|
|
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())
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import shutil
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
import tempfile
|
|
7
|
+
import unittest
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
STATE = Path(__file__).with_name("matrix_state.py")
|
|
11
|
+
CLAUDE = Path(__file__).with_name("matrix_claude.py")
|
|
12
|
+
RUNTIME = Path(__file__).resolve().parents[4] / "src" / "workflow.js"
|
|
13
|
+
NODE_DIRECTORY = str(Path(shutil.which("node") or "").parent)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class MatrixClaudeTests(unittest.TestCase):
|
|
17
|
+
def invoke(self, script, *args, cwd):
|
|
18
|
+
env = {**os.environ, "PATH": NODE_DIRECTORY, "MATRIX_DEVELOPMENT_RUNTIME": str(RUNTIME)}
|
|
19
|
+
return subprocess.run([sys.executable, str(script), *args], cwd=cwd, env=env, text=True, capture_output=True)
|
|
20
|
+
|
|
21
|
+
def inspect(self, cwd):
|
|
22
|
+
return json.loads(self.invoke(STATE, "inspect", cwd=cwd).stdout)
|
|
23
|
+
|
|
24
|
+
def make_design_change(self, cwd):
|
|
25
|
+
self.assertEqual(self.invoke(STATE, "init", "bridge", "--title", "Bridge", cwd=cwd).returncode, 0)
|
|
26
|
+
artifacts = cwd / ".matrix/changes/bridge/artifacts"
|
|
27
|
+
(artifacts / "proposal.md").write_text("## Goal\nBuild a bounded feature.\n\n## Scope\nOne module only.\n\n## Non-goals\nNo extra work.\n\n## Acceptance\nA focused test passes.\n\n## Risks\nKnown risk.\n")
|
|
28
|
+
self.assertEqual(self.invoke(STATE, "transition", "design", cwd=cwd).returncode, 0)
|
|
29
|
+
(artifacts / "design.md").write_text("## Decisions\nKeep one public seam.\n\n## Boundaries\nOne public seam only.\n\n## Test seams\nUse the public interface.\n\n## Risks\nKnown risk.\n")
|
|
30
|
+
(artifacts / "plan.md").write_text("## Steps\n1. Add a failing test.\n\n## Validation\nRun the focused test.\n\n## Stop conditions\nStop on scope change.\n")
|
|
31
|
+
self.assertEqual(self.invoke(STATE, "transition", "build", cwd=cwd).returncode, 0)
|
|
32
|
+
|
|
33
|
+
def test_generic_export_does_not_change_matrix_state(self):
|
|
34
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
35
|
+
cwd = Path(temp)
|
|
36
|
+
self.make_design_change(cwd)
|
|
37
|
+
result = self.invoke(CLAUDE, "export", "--task-id", "GEN-001", cwd=cwd)
|
|
38
|
+
self.assertEqual(result.returncode, 0, result.stderr)
|
|
39
|
+
task = cwd / ".matrix/changes/bridge/artifacts/claude-task.md"
|
|
40
|
+
self.assertIn("## Prohibited work", task.read_text(encoding="utf-8"))
|
|
41
|
+
self.assertEqual(self.inspect(cwd)["phase"], "build")
|
|
42
|
+
|
|
43
|
+
def test_fnsec_board_refuses_existing_objective(self):
|
|
44
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
45
|
+
cwd = Path(temp)
|
|
46
|
+
self.make_design_change(cwd)
|
|
47
|
+
tasks = cwd / "docs/tasks"
|
|
48
|
+
tasks.mkdir(parents=True)
|
|
49
|
+
(tasks / "active.md").write_text("# Active task\n", encoding="utf-8")
|
|
50
|
+
result = self.invoke(CLAUDE, "export", "--task-id", "FNSEC-X", "--target", "fnsec", "--apply-fnsec-board", cwd=cwd)
|
|
51
|
+
self.assertNotEqual(result.returncode, 0)
|
|
52
|
+
self.assertFalse((tasks / "claude-task-FNSEC-X.md").exists(), result.stdout + result.stderr)
|
|
53
|
+
|
|
54
|
+
def test_fnsec_export_updates_empty_board_only(self):
|
|
55
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
56
|
+
cwd = Path(temp)
|
|
57
|
+
self.make_design_change(cwd)
|
|
58
|
+
tasks = cwd / "docs/tasks"
|
|
59
|
+
tasks.mkdir(parents=True)
|
|
60
|
+
(tasks / "active.md").write_text("# NO_ACTIVE_OBJECTIVE\n", encoding="utf-8")
|
|
61
|
+
result = self.invoke(CLAUDE, "export", "--task-id", "FNSEC-Y", "--target", "fnsec", "--apply-fnsec-board", cwd=cwd)
|
|
62
|
+
self.assertEqual(result.returncode, 0, result.stderr)
|
|
63
|
+
self.assertIn("## Prohibited work", (tasks / "claude-task-FNSEC-Y.md").read_text(encoding="utf-8"))
|
|
64
|
+
self.assertIn("CLAUDE_QUEUED", (tasks / "active.md").read_text(encoding="utf-8"))
|
|
65
|
+
self.assertEqual(self.inspect(cwd)["phase"], "build")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if __name__ == "__main__":
|
|
69
|
+
unittest.main()
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import importlib.util
|
|
3
|
+
import os
|
|
4
|
+
import shutil
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
import tempfile
|
|
8
|
+
import unittest
|
|
9
|
+
from unittest import mock
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
SCRIPT = Path(__file__).with_name("matrix_state.py")
|
|
13
|
+
RUNTIME = Path(__file__).resolve().parents[4] / "src" / "workflow.js"
|
|
14
|
+
NODE_DIRECTORY = str(Path(shutil.which("node") or "").parent)
|
|
15
|
+
class MatrixStateTests(unittest.TestCase):
|
|
16
|
+
def invoke(self, *args, cwd):
|
|
17
|
+
env = {**os.environ, "PATH": NODE_DIRECTORY, "MATRIX_DEVELOPMENT_RUNTIME": str(RUNTIME)}
|
|
18
|
+
return subprocess.run([sys.executable, str(SCRIPT), *args], cwd=cwd, env=env, text=True, capture_output=True)
|
|
19
|
+
def load_adapter(self, directory):
|
|
20
|
+
script = directory / "matrix_state.py"
|
|
21
|
+
shutil.copyfile(SCRIPT, script)
|
|
22
|
+
spec = importlib.util.spec_from_file_location(f"matrix_state_{directory.name}", script)
|
|
23
|
+
module = importlib.util.module_from_spec(spec)
|
|
24
|
+
spec.loader.exec_module(module)
|
|
25
|
+
return module
|
|
26
|
+
def test_runtime_precedence_is_bundled_then_global(self):
|
|
27
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
28
|
+
directory = Path(temp)
|
|
29
|
+
adapter = self.load_adapter(directory)
|
|
30
|
+
bundled = directory / "matrix-runtime.mjs"
|
|
31
|
+
bundled.write_text("// project runtime\n", encoding="utf-8")
|
|
32
|
+
with mock.patch.object(adapter, "development_runtime", return_value=None), mock.patch.object(adapter, "primary_runtime", return_value="global-matrix"):
|
|
33
|
+
command = adapter.runtime_command(["inspect"])
|
|
34
|
+
self.assertEqual(Path(command[1]), bundled)
|
|
35
|
+
bundled.unlink()
|
|
36
|
+
with mock.patch.object(adapter, "development_runtime", return_value=None), mock.patch.object(adapter, "primary_runtime", return_value="global-matrix"):
|
|
37
|
+
self.assertEqual(adapter.runtime_command(["inspect"]), ["global-matrix", "workflow", "inspect", "--json"])
|
|
38
|
+
def test_phase_guard_and_recovery(self):
|
|
39
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
40
|
+
cwd = Path(temp); result = self.invoke("init", "sample", "--title", "Sample", cwd=cwd); self.assertEqual(result.returncode, 0)
|
|
41
|
+
self.assertTrue((cwd / ".matrix" / "active.json").exists())
|
|
42
|
+
self.assertFalse((cwd / ".codex").exists())
|
|
43
|
+
self.assertNotEqual(self.invoke("transition", "design", cwd=cwd).returncode, 0)
|
|
44
|
+
p = cwd / ".matrix/changes/sample/artifacts"
|
|
45
|
+
(p / "proposal.md").write_text("## Goal\nBuild a bounded feature.\n\n## Scope\nOne module only.\n\n## Non-goals\nNo extra work.\n\n## Acceptance\nA focused test passes.\n\n## Risks\nKnown risk.\n")
|
|
46
|
+
self.assertEqual(self.invoke("transition", "design", cwd=cwd).returncode, 0)
|
|
47
|
+
self.assertEqual(json.loads(self.invoke("inspect", cwd=cwd).stdout)["phase"], "design")
|
|
48
|
+
|
|
49
|
+
def test_full_lifecycle_requires_evidence(self):
|
|
50
|
+
with tempfile.TemporaryDirectory() as temp:
|
|
51
|
+
cwd = Path(temp); self.assertEqual(self.invoke("init", "full", "--title", "Full", cwd=cwd).returncode, 0)
|
|
52
|
+
p = cwd / ".matrix/changes/full/artifacts"
|
|
53
|
+
(p / "proposal.md").write_text("## Goal\nBuild a bounded feature.\n\n## Scope\nOne module only.\n\n## Non-goals\nNo extra work.\n\n## Acceptance\nA focused test passes.\n\n## Risks\nKnown risk.\n")
|
|
54
|
+
self.assertEqual(self.invoke("transition", "design", cwd=cwd).returncode, 0)
|
|
55
|
+
self.assertNotEqual(self.invoke("transition", "build", cwd=cwd).returncode, 0)
|
|
56
|
+
(p / "design.md").write_text("## Decisions\nKeep one public seam.\n\n## Boundaries\nOne public seam only.\n\n## Test seams\nUse the public interface.\n\n## Risks\nKnown risk.\n")
|
|
57
|
+
(p / "plan.md").write_text("## Steps\n1. Add a failing test.\n\n## Validation\nRun the focused test.\n\n## Stop conditions\nStop on scope change.\n")
|
|
58
|
+
self.assertEqual(self.invoke("transition", "build", cwd=cwd).returncode, 0)
|
|
59
|
+
(p / "verification.md").write_text("## Build evidence\nThe focused implementation test command completed successfully with an expected result.\n")
|
|
60
|
+
self.assertEqual(self.invoke("transition", "verify", cwd=cwd).returncode, 0)
|
|
61
|
+
self.assertNotEqual(self.invoke("transition", "archive", cwd=cwd).returncode, 0)
|
|
62
|
+
(p / "verification.md").write_text("## Build evidence\nThe focused implementation test command completed successfully with an expected result.\n\n## Test evidence\nThe acceptance command passed and its output was reviewed for the requested behavior.\n\n## Review evidence\nThe fixed-baseline standards and specification review found no blocking issue.\n")
|
|
63
|
+
self.assertEqual(self.invoke("transition", "archive", cwd=cwd).returncode, 0)
|
|
64
|
+
preflight = self.invoke("archive", "--dry-run", cwd=cwd)
|
|
65
|
+
self.assertEqual(preflight.returncode, 0)
|
|
66
|
+
token = json.loads(preflight.stdout)["preflight_hash"]
|
|
67
|
+
self.assertEqual(self.invoke("archive", "--expect-preflight", token, cwd=cwd).returncode, 0)
|
|
68
|
+
self.assertTrue((cwd / ".matrix/archive/full/matrix.yaml").exists())
|
|
69
|
+
if __name__ == "__main__": unittest.main()
|
|
@@ -1,36 +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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
After successful commit, the change is under `.matrix/archive/` and the workflow is complete.
|
|
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
|
+
# 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
|
+
|
|
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
|
|
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
|
+
|
|
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
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
After successful commit, the change is under `.matrix/archive/` and the workflow is complete.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Matrix Workflow"
|
|
3
|
-
short_description: "Persistent development workflow stage"
|
|
4
|
-
default_prompt: "Use $name to continue a Matrix development workflow."
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Matrix Workflow"
|
|
3
|
+
short_description: "Persistent development workflow stage"
|
|
4
|
+
default_prompt: "Use $name to continue a Matrix development workflow."
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: matrix-build
|
|
3
|
-
description: Implement the frozen active Matrix plan with test-first vertical slices. Use when the active Matrix phase is build.
|
|
4
|
-
---
|
|
5
|
-
|
|
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
|
-
|
|
12
|
-
## Prim
|
|
13
|
-
|
|
14
|
-
Use Matrix's own implementation and test discipline.
|
|
15
|
-
|
|
16
|
-
## Arch
|
|
17
|
-
|
|
1
|
+
---
|
|
2
|
+
name: matrix-build
|
|
3
|
+
description: Implement the frozen active Matrix plan with test-first vertical slices. Use when the active Matrix phase is build.
|
|
4
|
+
---
|
|
5
|
+
|
|
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
|
+
|
|
12
|
+
## Prim
|
|
13
|
+
|
|
14
|
+
Use Matrix's own implementation and test discipline.
|
|
15
|
+
|
|
16
|
+
## Arch
|
|
17
|
+
|
|
18
18
|
- invoke `tdd` when the change modifies observable behavior at a testable seam;
|
|
19
19
|
- invoke `diagnosing-bugs` only when an actual failure exists and root cause is not established;
|
|
20
20
|
- invoke `writing-for-agents` when the approved Contract changes agent-facing instructions;
|
|
21
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
22
|
|
|
23
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.
|
|
24
|
-
|
|
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.
|
|
26
|
-
|
|
27
|
-
## Scope Discipline
|
|
28
|
-
|
|
29
|
-
If implementation exposes a scope or design change, **stop and run**; a lightweight change is upgraded to full by this Return:
|
|
30
|
-
|
|
31
|
-
```powershell
|
|
32
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap
|
|
33
|
-
```
|
|
34
|
-
|
|
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.
|
|
36
|
-
|
|
37
|
-
## Process
|
|
38
|
-
|
|
39
|
-
1. Implement the approved plan in bounded vertical slices.
|
|
40
|
-
2. Use only triggered Arch capabilities.
|
|
41
|
-
3. Record common facts under `## Build evidence`. Hotfix also requires `## Reproduction evidence` and `## Root cause`; tweak also requires `## Scope evidence`.
|
|
42
|
-
4. Run the guard and transition, then enter `$matrix-verify`.
|
|
43
|
-
|
|
44
|
-
```powershell
|
|
45
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard build
|
|
46
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition verify
|
|
47
|
-
```
|
|
24
|
+
|
|
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.
|
|
26
|
+
|
|
27
|
+
## Scope Discipline
|
|
28
|
+
|
|
29
|
+
If implementation exposes a scope or design change, **stop and run**; a lightweight change is upgraded to full by this Return:
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap
|
|
33
|
+
```
|
|
34
|
+
|
|
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.
|
|
36
|
+
|
|
37
|
+
## Process
|
|
38
|
+
|
|
39
|
+
1. Implement the approved plan in bounded vertical slices.
|
|
40
|
+
2. Use only triggered Arch capabilities.
|
|
41
|
+
3. Record common facts under `## Build evidence`. Hotfix also requires `## Reproduction evidence` and `## Root cause`; tweak also requires `## Scope evidence`.
|
|
42
|
+
4. Run the guard and transition, then enter `$matrix-verify`.
|
|
43
|
+
|
|
44
|
+
```powershell
|
|
45
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard build
|
|
46
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition verify
|
|
47
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Matrix Workflow"
|
|
3
|
-
short_description: "Persistent development workflow stage"
|
|
4
|
-
default_prompt: "Use $name to continue a Matrix development workflow."
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Matrix Workflow"
|
|
3
|
+
short_description: "Persistent development workflow stage"
|
|
4
|
+
default_prompt: "Use $name to continue a Matrix development workflow."
|
|
@@ -1,73 +1,79 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: matrix-design
|
|
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
|
-
---
|
|
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 `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
|
-
|
|
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
|
-
|
|
1
|
+
---
|
|
2
|
+
name: matrix-design
|
|
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
|
+
---
|
|
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 `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
|
+
|
|
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
22
|
- `domain-modeling` for unclear vocabulary, invariants, or architectural decisions;
|
|
23
23
|
- `research` when required external facts cannot be established from the repository;
|
|
24
24
|
- `prototype` when a material design decision needs disposable empirical evidence;
|
|
25
25
|
- `codebase-design` when a deep-module, interface, or test-seam decision remains;
|
|
26
26
|
- `writing-for-agents` when the Contract creates or changes Skills, `AGENTS.md`, `CLAUDE.md`, or documents reached through agent pointers.
|
|
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
|
-
|
|
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
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
31
|
|
|
32
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.
|
|
33
|
-
|
|
34
|
-
## Process
|
|
35
|
-
|
|
36
|
-
1. Establish repository facts and resolve only triggered design questions.
|
|
37
|
-
2. Write and synchronize the canonical Matrix design and plan.
|
|
38
|
-
3. Confirm material architecture choices with the user before freezing.
|
|
39
|
-
4. Run the guard, then choose the implementation actor.
|
|
40
|
-
|
|
41
|
-
```powershell
|
|
42
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard design
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Implementation Decision Point
|
|
46
|
-
|
|
47
|
-
After the design guard passes
|
|
48
|
-
|
|
49
|
-
### Option A: Continue with
|
|
50
|
-
|
|
51
|
-
Run transition and enter `$matrix-build`:
|
|
52
|
-
|
|
53
|
-
```powershell
|
|
54
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition build
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Then enter `$matrix-build` to implement directly in this session.
|
|
58
|
-
|
|
59
|
-
### Option B:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
33
|
+
|
|
34
|
+
## Process
|
|
35
|
+
|
|
36
|
+
1. Establish repository facts and resolve only triggered design questions.
|
|
37
|
+
2. Write and synchronize the canonical Matrix design and plan.
|
|
38
|
+
3. Confirm material architecture choices with the user before freezing.
|
|
39
|
+
4. Run the guard, then choose the implementation actor.
|
|
40
|
+
|
|
41
|
+
```powershell
|
|
42
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard design
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Implementation Decision Point
|
|
46
|
+
|
|
47
|
+
After the design guard passes and before `transition build`, pause and present the implementation-actor choice to the user. Do not transition without an explicit choice:
|
|
48
|
+
|
|
49
|
+
### Option A: Continue with the current agent / model (default)
|
|
50
|
+
|
|
51
|
+
Run transition and enter `$matrix-build`:
|
|
52
|
+
|
|
53
|
+
```powershell
|
|
54
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Then enter `$matrix-build` to implement directly in this session.
|
|
58
|
+
|
|
59
|
+
### Option B: Switch the model, keep this agent
|
|
60
|
+
|
|
61
|
+
The user switches the model in their own client (for example, a stronger model for design, an efficient one for implementation), returns to this session, and confirms. Then run transition exactly as in Option A. Matrix cannot see the client-side model; it provides the mandatory pause point only.
|
|
62
|
+
|
|
63
|
+
### Option C: Switch the implementation agent
|
|
64
|
+
|
|
65
|
+
First approve the frozen contract by transitioning to Build, then run `$matrix-handoff` to export a bounded task package for the chosen agent (for example Codex designs, Claude Code implements; or zcode designs, opencode implements). This:
|
|
66
|
+
- Does not change the Build phase or state beyond the preceding transition
|
|
67
|
+
- Creates `artifacts/handoff-task-<task-id>.md` with all implementation details
|
|
68
|
+
- Includes acceptance criteria, test seams, and required commands
|
|
69
|
+
|
|
70
|
+
After the implementation agent completes and returns results, run the Build guard and enter `$matrix-verify`:
|
|
71
|
+
|
|
72
|
+
```powershell
|
|
73
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard build
|
|
74
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition verify
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Then enter `$matrix-verify` to verify the implementation.
|
|
78
|
+
|
|
79
|
+
Record the chosen option in `design.md` under `## Decisions` so it freezes with the Contract.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Matrix Workflow"
|
|
3
|
-
short_description: "Persistent development workflow stage"
|
|
4
|
-
default_prompt: "Use $name to continue a Matrix development workflow."
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Matrix Workflow"
|
|
3
|
+
short_description: "Persistent development workflow stage"
|
|
4
|
+
default_prompt: "Use $name to continue a Matrix development workflow."
|