@polymorphism-tech/morph-spec 4.10.0 → 4.10.1
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/README.md +2 -2
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +5 -69
- package/framework/agents/backend/api-designer.md +3 -0
- package/framework/agents/backend/dotnet-senior.md +3 -0
- package/framework/agents/backend/ef-modeler.md +2 -0
- package/framework/agents/backend/hangfire-orchestrator.md +2 -0
- package/framework/agents/backend/ms-agent-expert.md +2 -0
- package/framework/agents/frontend/blazor-builder.md +2 -0
- package/framework/agents/frontend/nextjs-expert.md +2 -0
- package/framework/agents/infrastructure/azure-architect.md +2 -0
- package/framework/agents/infrastructure/azure-deploy-specialist.md +2 -0
- package/framework/agents/infrastructure/bicep-architect.md +2 -0
- package/framework/agents/infrastructure/container-specialist.md +2 -0
- package/framework/agents/infrastructure/devops-engineer.md +3 -0
- package/framework/agents/infrastructure/infra-architect.md +3 -0
- package/framework/agents/integrations/asaas-financial.md +2 -0
- package/framework/agents/integrations/azure-identity.md +2 -0
- package/framework/agents/integrations/clerk-auth.md +3 -0
- package/framework/agents/integrations/hangfire-integration.md +2 -0
- package/framework/agents/integrations/resend-email.md +2 -0
- package/framework/commands/morph-apply.md +151 -161
- package/framework/commands/morph-archive.md +28 -28
- package/framework/commands/morph-infra.md +79 -79
- package/framework/commands/morph-preflight.md +92 -56
- package/framework/commands/morph-proposal.md +94 -70
- package/framework/commands/morph-status.md +31 -31
- package/framework/commands/morph-troubleshoot.md +63 -60
- package/framework/rules/csharp-standards.md +3 -0
- package/framework/rules/frontend-standards.md +2 -0
- package/framework/rules/infrastructure-standards.md +3 -0
- package/framework/rules/morph-workflow.md +57 -2
- package/framework/rules/nextjs-standards.md +2 -0
- package/framework/rules/testing-standards.md +3 -0
- package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +54 -49
- package/framework/skills/level-0-meta/morph-checklist/SKILL.md +42 -19
- package/framework/skills/level-0-meta/morph-code-review/SKILL.md +8 -5
- package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +7 -5
- package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +139 -136
- package/framework/skills/level-0-meta/morph-init/SKILL.md +42 -13
- package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +130 -130
- package/framework/skills/level-0-meta/morph-replicate/SKILL.md +95 -87
- package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +24 -0
- package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +42 -41
- package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +22 -11
- package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +123 -114
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +120 -102
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +206 -214
- package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +38 -0
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +241 -360
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +107 -115
- package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +135 -135
- package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +14 -0
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +143 -139
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +168 -165
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +57 -8
- package/package.json +3 -3
- package/src/commands/project/doctor.js +7 -2
- package/src/commands/project/update.js +4 -4
- package/src/lib/stack-filter.js +58 -0
- package/src/scripts/setup-infra.js +53 -18
- package/src/utils/agents-installer.js +19 -5
- package/src/utils/claude-md-injector.js +90 -0
- package/src/utils/hooks-installer.js +1 -4
- package/src/utils/skills-installer.js +67 -7
- package/CLAUDE.md +0 -98
- package/framework/memory/patterns-learned.md +0 -766
- package/framework/skills/level-0-meta/morph-terminal-title/SKILL.md +0 -61
- package/framework/skills/level-0-meta/morph-terminal-title/scripts/set_title.sh +0 -65
|
@@ -1,200 +1,206 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: morph:phase-clarify
|
|
3
|
-
description: MORPH-SPEC Phase 3 (Clarify). Iterative clarification loop driven by a satisfaction score (0-100). Generates targeted questions per round, always presents "
|
|
3
|
+
description: MORPH-SPEC Phase 3 (Clarify). Iterative clarification loop driven by a satisfaction score (0-100). Generates targeted questions per round, always presents "End Clarify" as exit option, and stops when score >= 85 or user exits. Use after design approval to eliminate spec ambiguities before task breakdown begins.
|
|
4
4
|
argument-hint: "[feature-name]"
|
|
5
5
|
user-invocable: false
|
|
6
|
-
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
7
|
-
cliVersion: "4.10.
|
|
6
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
+
cliVersion: "4.10.1"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# MORPH Clarify
|
|
10
|
+
# MORPH Clarify — Phase 3
|
|
11
11
|
|
|
12
12
|
> INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Eliminate spec ambiguities through an iterative question loop until the spec has sufficient quality to generate tasks.
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Prerequisites
|
|
17
17
|
|
|
18
|
-
- [ ]
|
|
19
|
-
- [ ] `spec.md`
|
|
20
|
-
- [ ] `contracts.cs`
|
|
18
|
+
- [ ] Phase 2 (Design) completed
|
|
19
|
+
- [ ] `spec.md` approved by user
|
|
20
|
+
- [ ] `contracts.cs` (or `contracts.ts`) defined
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Recommended Tools
|
|
23
23
|
|
|
24
|
-
> **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md`
|
|
24
|
+
> **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for complete guide.
|
|
25
25
|
> **Example:** `references/clarifications-example.md` — filled-in clarifications.md showing expected Q&A format.
|
|
26
26
|
|
|
27
|
-
|
|
|
28
|
-
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
27
|
+
| Action | Tool | Alternative |
|
|
28
|
+
|--------|------|-------------|
|
|
29
|
+
| Read spec + contracts | **Read** all design outputs | — |
|
|
30
|
+
| Verify technical feasibility | **Context7 MCP** `query_docs()` | **WebSearch** |
|
|
31
|
+
| Check external issues/limitations | **GitHub MCP** `search_issues()` | — |
|
|
32
|
+
| Ask clarifying questions | **AskUserQuestion** (never plain text) | — |
|
|
33
|
+
| Update spec with clarifications | **Edit** spec.md | — |
|
|
34
|
+
| Create clarifications.md | **Write** | — |
|
|
35
|
+
| Update state | **Bash** `npx morph-spec state mark-output $ARGUMENTS clarifications` | — |
|
|
35
36
|
|
|
36
37
|
---
|
|
37
38
|
|
|
38
|
-
##
|
|
39
|
+
## Satisfaction Scoring System
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
Before each round, calculate the **Satisfaction Score (0-100)** by evaluating the current spec:
|
|
41
42
|
|
|
42
|
-
|
|
|
43
|
-
|
|
44
|
-
| **
|
|
45
|
-
| **
|
|
46
|
-
| **Edge cases** | 20 |
|
|
47
|
-
| **
|
|
48
|
-
| **
|
|
43
|
+
| Dimension | Pts | Maximum Score Criteria |
|
|
44
|
+
|-----------|-----|----------------------|
|
|
45
|
+
| **Functional completeness** | 25 | All requirements have measurable acceptance criteria (no vague "should", "may", "generally") |
|
|
46
|
+
| **Failure coverage** | 20 | All error paths have defined behavior (invalid input, not found, timeout, unauthorized) |
|
|
47
|
+
| **Edge cases** | 20 | Boundaries, concurrent states, empty/extreme inputs documented |
|
|
48
|
+
| **Definitional clarity** | 20 | No critical term undefined, no "TBD", no "to be defined" |
|
|
49
|
+
| **Integration contracts** | 15 | External dependencies have payload format, errors, and retry policy defined |
|
|
49
50
|
|
|
50
51
|
**Thresholds:**
|
|
51
52
|
|
|
52
|
-
| Score |
|
|
53
|
-
|
|
54
|
-
|
|
|
55
|
-
| 70
|
|
56
|
-
| < 70 |
|
|
53
|
+
| Score | Action |
|
|
54
|
+
|-------|--------|
|
|
55
|
+
| >= 85 | Satisfied. Present results and offer "End Clarify" as the primary option |
|
|
56
|
+
| 70-84 | Continue. Focus questions on the lowest-scoring dimensions |
|
|
57
|
+
| < 70 | Continue. Broad questions covering the largest gaps |
|
|
57
58
|
|
|
58
|
-
>
|
|
59
|
+
> The score rises as answers are incorporated. There's no fixed maximum rounds — the loop ends when score >= 85 **or** the user chooses to end.
|
|
59
60
|
|
|
60
61
|
---
|
|
61
62
|
|
|
62
63
|
## Workflow
|
|
63
64
|
|
|
64
|
-
###
|
|
65
|
+
### Initialization
|
|
65
66
|
|
|
66
|
-
**
|
|
67
|
+
**Step 0 (BEFORE any writing) — Ensure clarify phase:**
|
|
67
68
|
|
|
68
69
|
```bash
|
|
69
70
|
npx morph-spec state get $ARGUMENTS
|
|
70
71
|
```
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
Check the `"phase"` field in the output:
|
|
73
74
|
|
|
74
|
-
**
|
|
75
|
+
**If `"phase": "clarify"`** → correct phase, proceed.
|
|
75
76
|
|
|
76
|
-
**
|
|
77
|
+
**If `"phase": "design"`** → run in sequence:
|
|
77
78
|
1. `npx morph-spec approve $ARGUMENTS design`
|
|
78
79
|
2. `npx morph-spec phase advance $ARGUMENTS` (→ clarify)
|
|
79
80
|
|
|
80
|
-
**
|
|
81
|
+
**Any other value** → STOP — inconsistent state, report to user.
|
|
81
82
|
|
|
82
|
-
> **
|
|
83
|
+
> **Rule:** Never write `clarifications.md` or update `spec.md` until the phase is `clarify`.
|
|
83
84
|
|
|
84
85
|
---
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
- `.morph/features/$ARGUMENTS/1-design/spec.md`
|
|
88
|
-
- `.morph/features/$ARGUMENTS/1-design/contracts.cs`
|
|
89
|
-
- `.morph/features/$ARGUMENTS/1-design/schema-analysis.md` (se existir)
|
|
87
|
+
Read the base files in PARALLEL:
|
|
90
88
|
|
|
91
|
-
|
|
89
|
+
```
|
|
90
|
+
Read: .morph/features/$ARGUMENTS/1-design/spec.md
|
|
91
|
+
+ Read: .morph/features/$ARGUMENTS/1-design/contracts.cs (or contracts.ts for TypeScript)
|
|
92
|
+
+ Read: .morph/features/$ARGUMENTS/1-design/schema-analysis.md (if exists)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Calculate the initial score. Track accumulated answers from prior rounds to avoid repeating already-answered questions.
|
|
92
96
|
|
|
93
97
|
---
|
|
94
98
|
|
|
95
|
-
### Loop
|
|
99
|
+
### Main Loop
|
|
100
|
+
|
|
101
|
+
**Repeat until: score >= 85 OR user chooses to end.**
|
|
96
102
|
|
|
97
|
-
|
|
103
|
+
#### A. Calculate Current Round Score
|
|
98
104
|
|
|
99
|
-
|
|
105
|
+
Score each dimension based on the spec + accumulated answers. Note which dimensions are weakest — they guide this round's questions.
|
|
100
106
|
|
|
101
|
-
|
|
107
|
+
#### B. Identify New Questions
|
|
102
108
|
|
|
103
|
-
|
|
109
|
+
Analyze only what **hasn't been answered yet**. Categorize by dimension:
|
|
104
110
|
|
|
105
|
-
|
|
111
|
+
| Category | Example Questions |
|
|
112
|
+
|----------|-------------------|
|
|
113
|
+
| **Validation** | Field limits, accepted formats, business rules |
|
|
114
|
+
| **Behavior** | What happens when X fails? Empty state? Loading state? |
|
|
115
|
+
| **Priority** | Must-have vs nice-to-have? MVP vs v2? |
|
|
116
|
+
| **Integration** | Webhook vs polling? Retry policy? Timeout? |
|
|
117
|
+
| **Performance** | Expected volume? Response SLA? |
|
|
118
|
+
| **UX** | Error message shown to user? Visual feedback? |
|
|
106
119
|
|
|
107
|
-
|
|
108
|
-
|-----------|----------------------|
|
|
109
|
-
| **Validação** | Limites de campo, formatos aceitos, regras de negócio |
|
|
110
|
-
| **Comportamento** | O que acontece quando X falha? Estado vazio? Loading? |
|
|
111
|
-
| **Prioridade** | Must-have vs nice-to-have? MVP vs v2? |
|
|
112
|
-
| **Integração** | Webhook vs polling? Retry policy? Timeout? |
|
|
113
|
-
| **Performance** | Volume esperado? SLA de resposta? |
|
|
114
|
-
| **UX** | Mensagem de erro exibida ao usuário? Feedback visual? |
|
|
120
|
+
#### C. Present Questions via `AskUserQuestion`
|
|
115
121
|
|
|
116
|
-
|
|
122
|
+
**Why this matters:** AskUserQuestion gives structured options the user can click — far better UX than walls of text. It also captures answers programmatically for the clarifications.md output.
|
|
117
123
|
|
|
118
|
-
**
|
|
124
|
+
**Rules:**
|
|
119
125
|
|
|
120
|
-
1. Use `AskUserQuestion` — **
|
|
121
|
-
2.
|
|
122
|
-
3.
|
|
123
|
-
4. **
|
|
126
|
+
1. Use `AskUserQuestion` — **NEVER list questions as plain text**
|
|
127
|
+
2. Maximum **4 questions per call** (tool limit)
|
|
128
|
+
3. If there are more than 3 new questions, make sequential calls — the **exit option always appears in the last call of each round**
|
|
129
|
+
4. **Always include the following question as the last in the final batch of each round:**
|
|
124
130
|
|
|
125
131
|
```json
|
|
126
132
|
{
|
|
127
|
-
"header": "
|
|
128
|
-
"question": "
|
|
133
|
+
"header": "End Clarify?",
|
|
134
|
+
"question": "End the Clarify phase now or continue refining the spec?",
|
|
129
135
|
"multiSelect": false,
|
|
130
136
|
"options": [
|
|
131
137
|
{
|
|
132
|
-
"label": "
|
|
133
|
-
"description": "
|
|
138
|
+
"label": "Continue refining",
|
|
139
|
+
"description": "There are still open questions identified in this round"
|
|
134
140
|
},
|
|
135
141
|
{
|
|
136
|
-
"label": "
|
|
137
|
-
"description": "
|
|
142
|
+
"label": "End Clarify",
|
|
143
|
+
"description": "Proceed to Plan phase with the spec in its current state"
|
|
138
144
|
}
|
|
139
145
|
]
|
|
140
146
|
}
|
|
141
147
|
```
|
|
142
148
|
|
|
143
|
-
>
|
|
149
|
+
> If score >= 85, adjust the first option label to: `"Continue (optional)"` with description: `"Score ${score}/100 — spec is satisfactory, but you can refine further"`
|
|
144
150
|
|
|
145
|
-
#### D.
|
|
151
|
+
#### D. Wait and Incorporate Answers
|
|
146
152
|
|
|
147
|
-
**
|
|
153
|
+
**Do not proceed before receiving all responses.**
|
|
148
154
|
|
|
149
|
-
|
|
150
|
-
1.
|
|
151
|
-
2.
|
|
152
|
-
3.
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
155
|
+
After receiving answers:
|
|
156
|
+
1. Check if the answer is consistent with `contracts.cs` and `schema-analysis.md`
|
|
157
|
+
2. If any answer is ambiguous or contradictory → ask for clarification before updating
|
|
158
|
+
3. Update `spec.md` with:
|
|
159
|
+
- Section `## Clarifications (Phase 3)` with structured Q&A
|
|
160
|
+
- Updates to affected functional sections
|
|
161
|
+
- New edge cases in `## Edge Cases`
|
|
156
162
|
|
|
157
|
-
#### E.
|
|
163
|
+
#### E. Check Exit Condition
|
|
158
164
|
|
|
159
|
-
-
|
|
160
|
-
- Score
|
|
161
|
-
-
|
|
165
|
+
- User chose **"End Clarify"** → exit loop
|
|
166
|
+
- Score >= 85 AND no new questions identified → exit loop
|
|
167
|
+
- Otherwise → return to A
|
|
162
168
|
|
|
163
169
|
---
|
|
164
170
|
|
|
165
|
-
###
|
|
171
|
+
### Post-Loop: Generate Outputs
|
|
166
172
|
|
|
167
|
-
**
|
|
173
|
+
**Step 1: Create `clarifications.md`**
|
|
168
174
|
|
|
169
|
-
|
|
175
|
+
Write to `.morph/features/$ARGUMENTS/1-design/clarifications.md`:
|
|
170
176
|
|
|
171
177
|
```markdown
|
|
172
178
|
# Clarifications — {Feature Name}
|
|
173
179
|
|
|
174
|
-
**
|
|
175
|
-
**Rounds
|
|
176
|
-
**
|
|
177
|
-
**Status:**
|
|
180
|
+
**Phase:** Clarify (Phase 3)
|
|
181
|
+
**Rounds completed:** {N}
|
|
182
|
+
**Final score:** {score}/100
|
|
183
|
+
**Status:** Resolved — incorporated into spec.md
|
|
178
184
|
|
|
179
185
|
---
|
|
180
186
|
|
|
181
187
|
## Questions & Answers
|
|
182
188
|
|
|
183
|
-
### Q{N}: {
|
|
184
|
-
**Question:** {
|
|
185
|
-
**Answer:** {
|
|
186
|
-
**Spec Updates:** {
|
|
189
|
+
### Q{N}: {Title}
|
|
190
|
+
**Question:** {question}
|
|
191
|
+
**Answer:** {user's answer}
|
|
192
|
+
**Spec Updates:** {which sections were updated}
|
|
187
193
|
**Priority:** High/Medium/Low
|
|
188
|
-
**Resolved:**
|
|
194
|
+
**Resolved:** Yes
|
|
189
195
|
|
|
190
196
|
---
|
|
191
197
|
|
|
192
198
|
## Edge Cases
|
|
193
199
|
|
|
194
|
-
### EC{N}: {
|
|
195
|
-
**Scenario:** {
|
|
196
|
-
**Expected Behavior:** {
|
|
197
|
-
**Implementation Notes:** {
|
|
200
|
+
### EC{N}: {Name}
|
|
201
|
+
**Scenario:** {when it happens}
|
|
202
|
+
**Expected Behavior:** {how the system reacts}
|
|
203
|
+
**Implementation Notes:** {tips}
|
|
198
204
|
|
|
199
205
|
---
|
|
200
206
|
|
|
@@ -205,10 +211,10 @@ Escreva em `.morph/features/$ARGUMENTS/1-design/clarifications.md`:
|
|
|
205
211
|
| Questions Answered | {N} |
|
|
206
212
|
| Edge Cases Documented | {N} |
|
|
207
213
|
| Spec Sections Updated | {N} |
|
|
208
|
-
| Score
|
|
214
|
+
| Final Score | {score}/100 |
|
|
209
215
|
```
|
|
210
216
|
|
|
211
|
-
**
|
|
217
|
+
**Step 2: Update State**
|
|
212
218
|
|
|
213
219
|
```bash
|
|
214
220
|
npx morph-spec state mark-output $ARGUMENTS clarifications
|
|
@@ -216,18 +222,21 @@ npx morph-spec state mark-output $ARGUMENTS clarifications
|
|
|
216
222
|
|
|
217
223
|
---
|
|
218
224
|
|
|
219
|
-
## Outputs
|
|
225
|
+
## Phase Outputs
|
|
220
226
|
|
|
221
|
-
|
|
222
|
-
|
|
227
|
+
<!-- morph:outputs:clarify -->
|
|
228
|
+
| Output | Path |
|
|
229
|
+
|--------|------|
|
|
230
|
+
| `clarifications` | `.morph/features/{feature}/1-design/clarifications.md` |
|
|
231
|
+
<!-- /morph:outputs -->
|
|
223
232
|
|
|
224
|
-
##
|
|
233
|
+
## Advancement Criteria
|
|
225
234
|
|
|
226
|
-
- [x]
|
|
227
|
-
- [x]
|
|
228
|
-
- [x] `spec.md`
|
|
229
|
-
- [x] `clarifications.md`
|
|
230
|
-
- [x] State
|
|
235
|
+
- [x] Satisfaction score >= 85 OR user opted to end
|
|
236
|
+
- [x] All answers are consistent with `contracts.cs`
|
|
237
|
+
- [x] `spec.md` updated with clarifications and edge cases
|
|
238
|
+
- [x] `clarifications.md` created with Q&A and final score
|
|
239
|
+
- [x] State updated (`mark-output clarifications`)
|
|
231
240
|
|
|
232
241
|
---
|
|
233
242
|
|
|
@@ -235,4 +244,4 @@ npx morph-spec state mark-output $ARGUMENTS clarifications
|
|
|
235
244
|
npx morph-spec phase advance $ARGUMENTS
|
|
236
245
|
```
|
|
237
246
|
|
|
238
|
-
|
|
247
|
+
Continue automatically to Phase 4 (Plan) after clarifications.md is generated.
|