@polymorphism-tech/morph-spec 4.21.0 → 5.0.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.
Files changed (213) hide show
  1. package/CLAUDE.md +57 -71
  2. package/README.md +2 -2
  3. package/bin/morph-spec.js +224 -491
  4. package/claude-plugin.json +1 -1
  5. package/docs/CHEATSHEET.md +1 -1
  6. package/docs/QUICKSTART.md +1 -1
  7. package/framework/CLAUDE.md +55 -38
  8. package/framework/MORPH.md +244 -0
  9. package/framework/agents.json +127 -1183
  10. package/framework/commands/morph-apply.md +56 -240
  11. package/framework/commands/morph-archive.md +48 -85
  12. package/framework/commands/morph-preflight.md +7 -7
  13. package/framework/commands/morph-proposal.md +35 -191
  14. package/framework/commands/morph-status.md +19 -50
  15. package/framework/commands/morph-troubleshoot.md +2 -2
  16. package/framework/evals/rubrics/README.md +44 -0
  17. package/framework/evals/rubrics/architecture.md +46 -0
  18. package/framework/evals/rubrics/code-quality.md +50 -0
  19. package/framework/evals/rubrics/contracts.md +47 -0
  20. package/framework/evals/rubrics/test-coverage.md +50 -0
  21. package/framework/evals/scenarios/dotnet-crud.yaml +42 -0
  22. package/framework/evals/scenarios/nextjs-auth.yaml +38 -0
  23. package/framework/evals/suites/standard.yaml +5 -0
  24. package/framework/evals/trace-schema.md +67 -0
  25. package/framework/hooks/claude-code/core/README.md +3 -0
  26. package/framework/hooks/claude-code/core/denylist.json +14 -0
  27. package/framework/hooks/claude-code/{pre-tool-use → core}/enforce-phase-writes.js +5 -5
  28. package/framework/hooks/claude-code/core/post-edit-typecheck.js +69 -0
  29. package/framework/hooks/claude-code/core/pre-bash-denylist.js +29 -0
  30. package/framework/hooks/claude-code/{pre-tool-use → core}/protect-spec-files.js +4 -6
  31. package/framework/hooks/claude-code/{stop → core}/validate-completion.js +13 -82
  32. package/framework/hooks/shared/phase-utils.js +20 -28
  33. package/framework/hooks/shared/state-reader.js +4 -5
  34. package/framework/{skills/level-0-meta/mcp-registry.json → mcp/registry.json} +254 -210
  35. package/framework/phases.json +40 -114
  36. package/framework/rubrics/eval-rubric.json +66 -0
  37. package/framework/skills/README.md +39 -64
  38. package/framework/skills/core/README.md +3 -0
  39. package/framework/skills/core/morph-brainstorming/SKILL.md +102 -0
  40. package/framework/skills/core/morph-eval/SKILL.md +57 -0
  41. package/framework/skills/core/morph-implement/SKILL.md +83 -0
  42. package/framework/skills/core/morph-plan/SKILL.md +64 -0
  43. package/framework/skills/core/morph-review/SKILL.md +62 -0
  44. package/framework/skills/core/morph-stack-scan/SKILL.md +109 -0
  45. package/framework/skills/core/morph-standards/SKILL.md +49 -0
  46. package/framework/standards/STANDARDS.json +32 -0
  47. package/framework/standards/frontend/design-system/ai-image-generation.md +244 -0
  48. package/framework/standards/integration/mcp/mcp-tools.md +48 -0
  49. package/framework/templates/CLAUDE.md.core.guide.md +29 -0
  50. package/framework/templates/CLAUDE.md.core.template +22 -0
  51. package/framework/templates/REGISTRY.json +4 -4
  52. package/framework/workflows/configs/fast-track.json +5 -10
  53. package/framework/workflows/configs/full.json +4 -8
  54. package/framework/workflows/configs/quick.json +32 -0
  55. package/framework/workflows/configs/standard.json +57 -64
  56. package/package.json +7 -6
  57. package/src/commands/mcp/mcp-setup.js +58 -31
  58. package/src/commands/project/doctor.js +69 -70
  59. package/src/commands/project/init.js +26 -5
  60. package/src/commands/project/status.js +18 -19
  61. package/src/commands/state/approve.js +1 -1
  62. package/src/commands/validation/validate-feature.js +18 -112
  63. package/src/core/paths/output-schema.js +133 -151
  64. package/src/core/state/phase-state-machine.js +10 -24
  65. package/src/core/state/state-manager.js +17 -17
  66. package/src/core/workflows/workflow-detector.js +214 -31
  67. package/src/core/workflows/workflow-router.js +204 -0
  68. package/src/dashboard/app/pages/AgentMap.jsx +32 -33
  69. package/src/dashboard/app/pages/LiveState.jsx +1 -1
  70. package/src/dashboard/app/pages/PhasePipeline.jsx +2 -4
  71. package/src/dashboard/app/pages/SkillsLibrary.jsx +2 -3
  72. package/src/dashboard/app/pages/Workflows.jsx +2 -2
  73. package/src/dashboard/scanner/agents-scanner.js +30 -35
  74. package/src/lib/agents/metrics-aggregator.js +1 -1
  75. package/src/lib/agents/output-collector.js +7 -8
  76. package/src/lib/context/context-builder.js +289 -0
  77. package/src/lib/detectors/claude-config-detector.js +19 -3
  78. package/src/lib/generators/context-generator.js +20 -42
  79. package/src/lib/generators/index.js +1 -0
  80. package/src/lib/generators/mandate-generator.js +512 -0
  81. package/src/lib/generators/metadata-extractor.js +1 -1
  82. package/src/lib/generators/recap-generator.js +3 -4
  83. package/src/lib/installers/mcp-installer.js +300 -92
  84. package/src/lib/phase-chain/phase-validator.js +36 -40
  85. package/src/lib/stack/stack-profile.js +74 -91
  86. package/src/lib/tasks/task-parser.js +1 -1
  87. package/src/lib/tasks/wave-resolver.js +353 -0
  88. package/src/lib/validators/checkpoint-persistence.js +2 -2
  89. package/src/lib/validators/content/cross-phase-validator.js +281 -0
  90. package/src/lib/validators/content/index.js +1 -0
  91. package/src/lib/validators/shared/emit-validator-dispatch.js +6 -56
  92. package/src/scripts/global-install.js +2 -27
  93. package/src/utils/agents-installer.js +224 -447
  94. package/src/utils/claude-settings-manager.js +57 -15
  95. package/src/utils/file-copier.js +1 -0
  96. package/src/utils/hooks-installer.js +15 -117
  97. package/src/utils/skills-installer.js +12 -18
  98. package/bin/detect-agents.js +0 -226
  99. package/bin/task-manager.js +0 -1036
  100. package/framework/agents/README.md +0 -13
  101. package/framework/agents/ai-agents/ai-system-architect.md +0 -194
  102. package/framework/agents/ai-agents/vector-search-expert.md +0 -247
  103. package/framework/agents/architecture/architecture-expert.md +0 -98
  104. package/framework/agents/architecture/morph-spec-architect.md +0 -66
  105. package/framework/agents/architecture/packages-validator.md +0 -89
  106. package/framework/agents/architecture/security-expert.md +0 -79
  107. package/framework/agents/architecture/seo-growth-hacker.md +0 -168
  108. package/framework/agents/architecture/standards-architect.md +0 -153
  109. package/framework/agents/backend/dotnet-senior.md +0 -163
  110. package/framework/agents/backend/ef-modeler.md +0 -119
  111. package/framework/agents/backend/hangfire-orchestrator.md +0 -133
  112. package/framework/agents/backend/ms-agent-expert.md +0 -55
  113. package/framework/agents/backend/neon-expert.md +0 -379
  114. package/framework/agents/frontend/css-specialist.md +0 -89
  115. package/framework/agents/frontend/design-system-validator.md +0 -100
  116. package/framework/agents/frontend/gsap-animator.md +0 -131
  117. package/framework/agents/frontend/nextjs-component-validator.md +0 -97
  118. package/framework/agents/frontend/nextjs-expert.md +0 -201
  119. package/framework/agents/frontend/ui-designer.md +0 -259
  120. package/framework/agents/infrastructure/infra-architect.md +0 -215
  121. package/framework/agents/integrations/asaas-financial.md +0 -138
  122. package/framework/agents/integrations/neon-auth.md +0 -151
  123. package/framework/agents/integrations/resend-email.md +0 -127
  124. package/framework/hooks/claude-code/post-tool-use/agent-complete.js +0 -122
  125. package/framework/hooks/claude-code/post-tool-use/dispatch.js +0 -363
  126. package/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +0 -78
  127. package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +0 -194
  128. package/framework/hooks/claude-code/pre-compact/save-morph-context.js +0 -199
  129. package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +0 -55
  130. package/framework/hooks/claude-code/session-start/inject-morph-context.js +0 -323
  131. package/framework/hooks/claude-code/session-start/post-compact-restore.js +0 -41
  132. package/framework/hooks/claude-code/session-start/resume-context.js +0 -77
  133. package/framework/hooks/claude-code/teammate-idle/teammate-idle.js +0 -90
  134. package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +0 -114
  135. package/framework/hooks/shared/compact-restore.js +0 -123
  136. package/framework/hooks/shared/dispatch-helpers.js +0 -147
  137. package/framework/hooks/shared/skill-reminder-helpers.js +0 -79
  138. package/framework/hooks/shared/stale-task-reset.js +0 -57
  139. package/framework/hooks/shared/worktree-helpers.js +0 -75
  140. package/framework/skills/level-0-meta/README.md +0 -7
  141. package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +0 -472
  142. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +0 -174
  143. package/framework/skills/level-0-meta/morph-brainstorming/references/proposal-example.md +0 -138
  144. package/framework/skills/level-0-meta/morph-checklist/SKILL.md +0 -145
  145. package/framework/skills/level-0-meta/morph-code-review/SKILL.md +0 -250
  146. package/framework/skills/level-0-meta/morph-code-review/references/review-example.md +0 -164
  147. package/framework/skills/level-0-meta/morph-code-review/references/review-guidelines.md +0 -100
  148. package/framework/skills/level-0-meta/morph-code-review/scripts/scan-csharp.mjs +0 -151
  149. package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +0 -165
  150. package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +0 -254
  151. package/framework/skills/level-0-meta/morph-code-review-nextjs/scripts/scan-nextjs.mjs +0 -189
  152. package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +0 -344
  153. package/framework/skills/level-0-meta/morph-frontend-review/scripts/scan-accessibility.mjs +0 -376
  154. package/framework/skills/level-0-meta/morph-init/SKILL.md +0 -537
  155. package/framework/skills/level-0-meta/morph-parallel-dispatch/SKILL.md +0 -225
  156. package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +0 -382
  157. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-dev-server.mjs +0 -153
  158. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-stack.mjs +0 -234
  159. package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +0 -106
  160. package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +0 -243
  161. package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +0 -169
  162. package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +0 -148
  163. package/framework/skills/level-0-meta/morph-verification-before-completion/scripts/check-phase-outputs.mjs +0 -110
  164. package/framework/skills/level-1-workflows/README.md +0 -7
  165. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +0 -269
  166. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +0 -453
  167. package/framework/skills/level-1-workflows/morph-phase-design/references/architecture-analysis-guide.md +0 -44
  168. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-authoring-guide.md +0 -55
  169. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-example.md +0 -253
  170. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
  171. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +0 -493
  172. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +0 -50
  173. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +0 -46
  174. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +0 -47
  175. package/framework/skills/level-1-workflows/morph-phase-implement/references/recap-example.md +0 -132
  176. package/framework/skills/level-1-workflows/morph-phase-implement/references/vsa-implementation-guide.md +0 -92
  177. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +0 -257
  178. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
  179. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +0 -291
  180. package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +0 -143
  181. package/framework/skills/level-1-workflows/morph-phase-tasks/references/tasks-example.md +0 -404
  182. package/framework/skills/level-1-workflows/morph-phase-tasks/scripts/validate-tasks.mjs +0 -112
  183. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +0 -788
  184. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +0 -147
  185. package/framework/squad-templates/backend-only.json +0 -47
  186. package/framework/squad-templates/frontend-only.json +0 -56
  187. package/framework/squad-templates/full-stack.json +0 -74
  188. package/src/commands/agents/agent-metrics.js +0 -174
  189. package/src/commands/agents/audit-dispatch.js +0 -82
  190. package/src/commands/agents/detect-agents.js +0 -275
  191. package/src/commands/agents/dispatch-agents.js +0 -461
  192. package/src/commands/agents/index.js +0 -13
  193. package/src/commands/agents/manage-agents.js +0 -352
  194. package/src/commands/agents/project-metrics.js +0 -74
  195. package/src/commands/phase/phase-reset.js +0 -74
  196. package/src/commands/scope/escalate.js +0 -217
  197. package/src/commands/state/advance-phase.js +0 -600
  198. package/src/commands/state/phase-runner.js +0 -215
  199. package/src/commands/state/state.js +0 -444
  200. package/src/commands/task/expand.js +0 -100
  201. package/src/commands/tasks/index.js +0 -4
  202. package/src/commands/tasks/task.js +0 -105
  203. package/src/commands/templates/index.js +0 -5
  204. package/src/commands/templates/template-render.js +0 -93
  205. package/src/commands/trust/trust.js +0 -118
  206. package/src/lib/agents/agents-manager.js +0 -349
  207. package/src/lib/build/build-runner.js +0 -99
  208. package/src/lib/checkpoints/checkpoint-hooks.js +0 -111
  209. package/src/lib/contracts/sprint-contract-generator.js +0 -137
  210. package/src/lib/scope/impact-analyzer.js +0 -106
  211. package/src/lib/trust/trust-manager.js +0 -157
  212. package/src/utils/tier-helpers.js +0 -24
  213. /package/framework/hooks/claude-code/{post-tool-use → core}/loop-detect.js +0 -0
@@ -1,240 +1,56 @@
1
- ---
2
- description: Implement the specified feature following the task breakdown from the MORPH-SPEC workflow. Orchestrates task execution with state tracking, checkpoints, agent dispatch, and verification.
3
- argument-hint: <feature-name>
4
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion
5
- ---
6
-
7
- # /morph-apply — Feature Implementation
8
-
9
- Implement the feature by executing its task breakdown, tracking progress through the morph-spec state machine, and producing a recap at the end.
10
-
11
- ## Usage
12
-
13
- ```
14
- /morph-apply {feature-name}
15
- ```
16
-
17
- ## Recommended Tools
18
-
19
- > **Ref:** `framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md` for complete guide.
20
- > **Ref:** `framework/standards/integration/mcp/mcp-tools.md` for MCP reference.
21
-
22
- | Action | Tool | Alternative |
23
- |--------|------|-------------|
24
- | Read spec, tasks, contracts | **Read** all outputs | — |
25
- | Detect architecture style | **Bash** `cat .morph/config/config.json \| grep architecture` | — |
26
- | Agent dispatch config | **Bash** `morph-spec dispatch-agents $ARGUMENTS implement` | — |
27
- | Parallel task execution | **Agent** subagent per task group | Sequential fallback |
28
- | Look up implementation patterns | **Context7 MCP** `query_docs()` | **WebSearch** |
29
- | Track progress | **Bash** `morph-spec state get $ARGUMENTS` | — |
30
-
31
- ---
32
-
33
- ## Pre-flight Validation
34
-
35
- Before writing any code, verify all prior phases are complete. This gate prevents implementation from starting with missing specs, unapproved designs, or incomplete task breakdowns.
36
-
37
- ### 1. Check state and approvals
38
-
39
- ```bash
40
- morph-spec state get $ARGUMENTS
41
- morph-spec approval-status $ARGUMENTS
42
- morph-spec validate-feature $ARGUMENTS
43
- ```
44
-
45
- **All three must pass.** If any fails:
46
-
47
- ```
48
- Feature is not ready for implementation.
49
- Run /morph-proposal $ARGUMENTS to complete planning phases.
50
- (Resumes automatically from the current phase.)
51
- ```
52
-
53
- Do NOT proceed until all phases are complete and all gates approved.
54
-
55
- ### 2. Load context in PARALLEL
56
-
57
- Read all prerequisite files in a single parallel call — every file listed here matters for implementation quality:
58
-
59
- ```
60
- Read: .morph/features/$ARGUMENTS/2-design/spec.md (→ functional requirements, API contracts)
61
- + Read: .morph/features/$ARGUMENTS/2-design/contracts.cs (or contracts.ts / contracts-vsa.cs → C# interfaces)
62
- + Read: .morph/features/$ARGUMENTS/2-design/decisions.md (→ ADRs, architectural choices)
63
- + Read: .morph/features/$ARGUMENTS/3-plan/plan.md (→ TDD structure, execution strategy)
64
- + Read: .morph/features/$ARGUMENTS/4-tasks/tasks.md (→ task breakdown with T### IDs)
65
- + Read: .morph/config/config.json (→ architecture.style for VSA routing)
66
- ```
67
-
68
- **For VSA projects** (`architecture.style: "vertical-slice"`), also read:
69
- ```
70
- Read: framework/standards/architecture/vertical-slice/vertical-slice.md
71
- ```
72
- This contains the 9 VSA implementation rules (Handler+Validator+Endpoint per feature folder, no cross-feature imports, etc.).
73
-
74
- Also read relevant standards:
75
- - `framework/standards/` — coding standards for the detected stack
76
- - `.morph/context/` — project-specific patterns and conventions
77
-
78
- ### 3. Detect architecture style
79
-
80
- ```bash
81
- cat .morph/config/config.json | grep -A3 '"architecture"'
82
- ```
83
-
84
- - **`"vertical-slice"`** → follow VSA implementation patterns from `framework/standards/architecture/vertical-slice/vertical-slice.md`. Each task is a complete slice (Handler + Validator + Endpoint in one folder).
85
-
86
- ### 4. Get agent dispatch config
87
-
88
- ```bash
89
- morph-spec dispatch-agents $ARGUMENTS implement --table
90
- ```
91
-
92
- This shows which agents are active for implementation and how tasks can be grouped. If agent teams are enabled and tasks have no dependencies between groups, consider dispatching parallel agents:
93
-
94
- ```bash
95
- morph-spec dispatch-agents $ARGUMENTS implement
96
- ```
97
-
98
- The JSON output includes `shouldDispatch`, `recommended` (agents by group), and `tasks` (task IDs by group) for multi-agent coordination.
99
-
100
- ---
101
-
102
- ## Workflow
103
-
104
- ### Step 1: Advance to implement phase
105
-
106
- ```bash
107
- morph-spec phase advance $ARGUMENTS
108
- ```
109
-
110
- This validates phase eligibility and emits a SKILL DISPATCH block listing required skills for implementation (verification-before-completion, morph-checklist, etc.).
111
-
112
- ### Step 1.5: Create pipeline visibility task
113
-
114
- > **MANDATORY** — Create umbrella task for implementation tracking.
115
-
116
- ```
117
- TaskCreate: "Implement: {feature-name}"
118
- → description: "Execute T001-T00N from tasks.md with checkpoints"
119
- → activeForm: "Implementing feature"
120
- ```
121
-
122
- Mark as `in_progress`. After all tasks complete (Step 5), mark as `completed`.
123
-
124
- ### Step 2: Initialize state tracking
125
-
126
- ```bash
127
- morph-spec state set $ARGUMENTS tasks.total {N}
128
- ```
129
-
130
- Where `{N}` is the number of tasks in tasks.md (e.g., 6 for T001-T006).
131
-
132
- ### Step 3: Execute tasks in order
133
-
134
- For each task in the breakdown, follow this cycle:
135
-
136
- ```bash
137
- # 1. Start the task (activates task-tracking guard)
138
- morph-spec task start $ARGUMENTS {task-id}
139
-
140
- # 2. Implement the task
141
- # - Follow spec.md and contracts
142
- # - Follow coding standards from framework/standards/ and .morph/context/
143
- # - For VSA: create all slice files in one folder (Handler + Validator + Endpoint)
144
-
145
- # 3. Verify before completing — run validate-feature or check your work
146
- # matches the spec and contracts before marking done
147
-
148
- # 4. Complete the task (triggers Tier-4 validators automatically)
149
- morph-spec task done $ARGUMENTS {task-id}
150
- ```
151
-
152
- **If validation fails on `task done`:**
153
- - Read the error messages carefully
154
- - Fix the violations in your code
155
- - Re-run `task done` — do NOT use `--skip-validation` unless the user explicitly authorizes it
156
- - After 3 consecutive failures, escalate to the user
157
-
158
- **`--skip-validation` budget system:**
159
- - Budget-limited: `min(5, ceil(totalTasks × 0.20))` — e.g., 5 tasks → 1 skip, 32 tasks → 5 skips
160
- - Requires `--reason <text>` (minimum 5 characters) for audit trail
161
- - Skipped tasks don't count as `passed` in validationHistory → degrades pass rate
162
- - Usage: `morph-spec task done feat T001 --skip-validation --reason "CSS-only change, no logic"`
163
- - When budget is exhausted, all remaining tasks must pass Tier-4 validation
164
-
165
- **Parallel execution (agent teams):**
166
- If `dispatch-agents` identified parallelizable task groups and agent teams are enabled, dispatch independent tasks to separate agents. Each agent still calls `task start` and `task done` for its assigned task.
167
-
168
- ### Step 4: Checkpoint every 3 tasks
169
-
170
- After every 3 completed tasks, save a checkpoint:
171
-
172
- ```bash
173
- morph-spec checkpoint-save $ARGUMENTS "after-T003"
174
- morph-spec state get $ARGUMENTS
175
- ```
176
-
177
- Checkpoints validate architecture compliance, check package versions, scan for security issues, and save a restorable snapshot. The cadence is every 3 tasks — for 6 tasks: checkpoint after T003 and T006. For 10 tasks: after T003, T006, T009, and at completion.
178
-
179
- After each checkpoint, check progress:
180
-
181
- ```bash
182
- morph-spec state list
183
- ```
184
-
185
- ### Step 5: Finalize implementation
186
-
187
- After all tasks are complete:
188
-
189
- ```bash
190
- # Final validation
191
- morph-spec validate-feature $ARGUMENTS
192
-
193
- # Generate recap (auto-marks 'recap' output in state)
194
- morph-spec generate recap $ARGUMENTS
195
-
196
- # Verify final state
197
- morph-spec state get $ARGUMENTS
198
-
199
- # Advance to next phase
200
- morph-spec phase advance $ARGUMENTS
201
- ```
202
-
203
- ### Step 6: Post-implementation review
204
-
205
- After implementation, present a summary to the user:
206
-
207
- 1. Total tasks completed (X/Y)
208
- 2. Files created/modified
209
- 3. Validation results
210
- 4. Any deviations from spec
211
-
212
- For Azure projects, remind the user: "Run `/morph-preflight` before deploying to validate packages, migrations, Docker, and secrets."
213
-
214
- ---
215
-
216
- ## Task Output Format
217
-
218
- After each task completion, show:
219
-
220
- ```
221
- Task {task-id} complete (X/Y tasks done)
222
- Files: [list of created/modified files]
223
- Next: {next-task-id} — {next-task-title}
224
- ```
225
-
226
- ---
227
-
228
- ## Anti-patterns
229
-
230
- - Using `state set phase` instead of `phase advance` — phase advance validates eligibility first
231
- - Skipping `task start` before implementing — the task-tracking guard will warn
232
- - Using `--skip-validation` without user authorization or without `--reason`
233
- - Exhausting `--skip-validation` budget on trivial tasks — reserve for genuine emergencies
234
- - Implementing without reading spec.md and contracts first
235
- - Writing code before `phase advance` to implement — the hook will block writes
236
- - Skipping checkpoints — they catch integration issues early
237
-
238
- ---
239
-
240
- **Feature:** $ARGUMENTS
1
+ ---
2
+ description: Implementa a feature aprovada no Gate 2. Loop autônomo de tarefas via morph-implement com auto-advance entre tarefas, depois morph-review apresenta o Gate 3.
3
+ argument-hint: <feature-name>
4
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion, Skill
5
+ ---
6
+
7
+ # /morph-apply — NLH Implementation
8
+
9
+ Executa as tarefas do `tasks.md` em sequência sem pausa, depois apresenta o Gate 3.
10
+
11
+ ## Argumentos
12
+
13
+ `{feature-name}` — nome da feature já planejada (Gate 2 aprovado).
14
+
15
+ ## Pré-requisitos
16
+
17
+ Antes de começar, verifique:
18
+ - `.morph/features/{feature-name}/2-plan/spec.md` existe
19
+ - `.morph/features/{feature-name}/2-plan/mandate.md` existe
20
+ - `.morph/features/{feature-name}/2-plan/tasks.md` existe
21
+ - `.morph/features/{feature-name}/3-implement/recap.md` existe ou pode ser criado
22
+
23
+ Se algum estiver faltando, abortar e pedir ao usuário para rodar `/morph-proposal {feature-name}` primeiro.
24
+
25
+ ## Fluxo
26
+
27
+ 1. **Loop de tarefas** — para cada tarefa pendente em `tasks.md`:
28
+ - Invocar a skill `morph-implement` em `framework/skills/core/morph-implement/`.
29
+ - A skill executa a tarefa, registra em `recap.md`, atualiza o trace.
30
+ - **Auto-advance:** ao concluir uma tarefa, passar imediatamente para a próxima sem aguardar instrução do usuário.
31
+ - Pausar apenas se encontrar ambiguidade bloqueante não coberta pelo `mandate.md`.
32
+
33
+ 2. **Após todas as tarefas concluídas, invocar `morph-review`** (skill em `framework/skills/core/morph-review/`):
34
+ - Lê `mandate.md` e `recap.md`.
35
+ - Aplica `morph-eval` para gerar scores por dimensão.
36
+ - Produz `review-report.md` em `.morph/features/{feature-name}/4-review/`.
37
+ - Apresenta o **Gate 3**.
38
+
39
+ 3. **Aguardar aprovação do Gate 3.**
40
+ - Resposta válida: "aprovado", "merge".
41
+ - Se houver itens bloqueantes (score < 6): corrija antes de apresentar o gate.
42
+
43
+ ## Anti-padrões
44
+
45
+ - Não pausar entre tarefas para confirmação — o tasks.md já foi aprovado no Gate 2.
46
+ - Não escrever código fora de `3-implement/` ou da source tree do projeto.
47
+ - Não modificar `spec.md` ou `mandate.md` durante a implementação — esses arquivos foram congelados pelo Gate 2.
48
+
49
+ ## Referências
50
+
51
+ - `framework/MORPH.md` — charter completo
52
+ - `framework/skills/core/morph-implement/SKILL.md`
53
+ - `framework/skills/core/morph-eval/SKILL.md`
54
+ - `framework/skills/core/morph-review/SKILL.md`
55
+
56
+ **Feature:** $ARGUMENTS
@@ -1,85 +1,48 @@
1
- ---
2
- description: Archive a completed feature by moving from features/ to archive/ and updating state
3
- argument-hint: <feature-name>
4
- allowed-tools: Read, Write, Edit, Bash
5
- ---
6
-
7
- # Archive MORPH Feature
8
-
9
- Archive a completed feature, moving it from `features/` to `archive/`.
10
-
11
- ## Prerequisites
12
-
13
- Verify before archiving:
14
- - [ ] Feature exists in `.morph/features/{feature}/`
15
- - [ ] All tasks are complete
16
- - [ ] `recap.md` is filled in
17
- - [ ] Code is in production (or staging)
18
-
19
- ## Workflow
20
-
21
- 1. **Validate completion**:
22
- - Read `.morph/features/{feature}/4-tasks/tasks.md`
23
- - Verify all tasks are completed
24
- - Confirm with user before archiving
25
-
26
- 2. **Complete the recap**:
27
- - Update `.morph/features/{feature}/5-implement/recap.md`
28
- - Fill in final metrics
29
- - Document lessons learned
30
-
31
- 3. **Extract specs**:
32
- - If the feature defines permanent behavior
33
- - Copy relevant spec to `.morph/specs/`
34
- - This becomes the "current truth" of the system
35
-
36
- 4. **Move to archive**:
37
- ```
38
- .morph/features/{feature}/ → .morph/archive/{feature}/
39
- ```
40
-
41
- 5. **Update project metrics**:
42
- - Increment feature counter
43
- - Update total cost
44
- - Update total time
45
-
46
- ## Output
47
-
48
- Present archival summary:
49
-
50
- ```
51
- ╔════════════════════════════════════════════╗
52
- ║ FEATURE ARCHIVED ║
53
- ╠════════════════════════════════════════════╣
54
- ║ Feature: {name} ║
55
- ║ Completed: {date} ║
56
- ╠════════════════════════════════════════════╣
57
- ║ METRICS ║
58
- ╠════════════════════════════════════════════╣
59
- ║ Tasks: {X}/{X} completed ║
60
- ║ Time: {X}h (estimated: {Y}h) ║
61
- ║ Cost Impact: +${X}/month ║
62
- ╠════════════════════════════════════════════╣
63
- ║ FILES ║
64
- ╠════════════════════════════════════════════╣
65
- ║ Created: {X} files ║
66
- ║ Modified: {Y} files ║
67
- ║ Tests: {Z} files ({W}% coverage) ║
68
- ╠════════════════════════════════════════════╣
69
- ║ ARCHIVED TO ║
70
- ╠════════════════════════════════════════════╣
71
- ║ .morph/archive/{feature}/ ║
72
- ╚════════════════════════════════════════════╝
73
- ```
74
-
75
- ## Extracted Specs
76
-
77
- If specs were extracted:
78
- ```
79
- Specs extracted to .morph/specs/:
80
- - {domain}/spec.md - {description}
81
- ```
82
-
83
- ---
84
-
85
- **Feature to archive:** $ARGUMENTS
1
+ ---
2
+ description: Archive a completed MORPH-SPEC feature after Gate 3 approval
3
+ argument-hint: <feature-name>
4
+ allowed-tools: Read, Write, Edit, Bash
5
+ ---
6
+
7
+ # Archive MORPH Feature
8
+
9
+ Archive a feature that has cleared Gate 3 (review). Use when the work is shipped and you want the
10
+ feature out of the active set in `.morph/features/`.
11
+
12
+ ## Prerequisites
13
+
14
+ Before archiving, verify:
15
+ - [ ] Feature folder exists at `.morph/features/{feature}/`
16
+ - [ ] `4-review/review-report.md` exists and Gate 3 is approved in `state.json`
17
+ - [ ] `3-implement/recap.md` is filled in
18
+ - [ ] Code is merged or otherwise shipped
19
+
20
+ If any precondition fails, stop and report what is missing instead of archiving.
21
+
22
+ ## Workflow
23
+
24
+ 1. **Validate completion** by reading `state.json`:
25
+ - `features[name].phase === 'review'`
26
+ - `features[name].approvalGates.review.approved === true`
27
+
28
+ 2. **Move the folder** from active to archive:
29
+ ```
30
+ .morph/features/{feature}/ → .morph/archive/{feature}/
31
+ ```
32
+ Use `Bash` (`mv` on POSIX, `Move-Item` on Windows). Preserve all phase subfolders
33
+ (`0-proposal/`, `1-ui/`, `2-plan/`, `3-implement/`, `4-review/`).
34
+
35
+ 3. **Update state.json**:
36
+ - Set `features[name].status = 'completed'`
37
+ - Set `features[name].archivedAt = <ISO timestamp>`
38
+
39
+ 4. **Confirm with the user** before any destructive step. Show the move plan first.
40
+
41
+ ## Output
42
+
43
+ Present a short summary of what moved and the new path. Do not invent metrics that are not
44
+ recorded in state.json or recap.md.
45
+
46
+ ---
47
+
48
+ **Feature to archive:** $ARGUMENTS
@@ -26,18 +26,18 @@ These checks verify that the morph-spec workflow is complete for the feature bei
26
26
 
27
27
  ```bash
28
28
  # Verify implementation is complete
29
- morph-spec state get {feature}
29
+ morph-spec status {feature}
30
30
  morph-spec approval-status {feature}
31
- morph-spec validate-feature {feature}
31
+ morph-spec validate {feature}
32
32
  ```
33
33
 
34
34
  | Check | Command | Pass Criteria |
35
35
  |-------|---------|---------------|
36
- | Phase is implement or later | `state get` | phase derived as `implement` |
37
- | All gates approved | `approval-status` | design, plan, tasks gates all approved |
38
- | Feature validation passes | `validate-feature` | 100% pass rate |
39
- | All tasks complete | `state get` → tasks | 0 tasks in `pending` or `in_progress` |
40
- | Recap generated | Read `5-implement/recap.md` | File exists and is non-empty |
36
+ | Phase is implement or later | `status` | phase derived as `implement` or `review` |
37
+ | All gates approved | `approval-status` | proposal, plan, review gates all approved |
38
+ | Feature validation passes | `validate` | 100% pass rate |
39
+ | All tasks complete | `status` → tasks | 0 tasks in `pending` or `in_progress` |
40
+ | Recap generated | Read `3-implement/recap.md` | File exists and is non-empty |
41
41
 
42
42
  **If any MORPH check fails:** Show which check failed and recommend: `Run /morph-apply {feature} to complete implementation before deploying.`
43
43