@polymorphism-tech/morph-spec 4.11.0 → 4.11.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 (34) hide show
  1. package/CLAUDE.md +106 -2
  2. package/README.md +2 -2
  3. package/bin/morph-spec.js +31 -3
  4. package/bin/task-manager.js +391 -35
  5. package/claude-plugin.json +1 -1
  6. package/docs/CHEATSHEET.md +1 -1
  7. package/docs/QUICKSTART.md +1 -1
  8. package/framework/commands/morph-apply.md +21 -1
  9. package/framework/commands/morph-proposal.md +44 -1
  10. package/framework/hooks/claude-code/post-tool-use/dispatch.js +47 -2
  11. package/framework/hooks/claude-code/session-start/inject-morph-context.js +4 -3
  12. package/framework/hooks/shared/dispatch-helpers.js +14 -0
  13. package/framework/hooks/shared/state-reader.js +7 -3
  14. package/framework/rules/morph-task-tracking.md +49 -0
  15. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +6 -10
  16. package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +10 -1
  17. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +1 -1
  18. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +7 -13
  19. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +7 -1
  20. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +9 -12
  21. package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +7 -10
  22. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +10 -18
  23. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +9 -1
  24. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +1 -1
  25. package/package.json +1 -1
  26. package/src/commands/agents/dispatch-agents.js +25 -1
  27. package/src/commands/tasks/task.js +54 -0
  28. package/src/lib/build/build-runner.js +99 -0
  29. package/src/lib/checkpoints/checkpoint-hooks.js +110 -0
  30. package/src/lib/generators/recap-generator.js +27 -4
  31. package/src/lib/stack/stack-profile.js +3 -0
  32. package/src/lib/tasks/task-parser.js +23 -9
  33. package/src/utils/file-copier.js +1 -0
  34. package/framework/hooks/claude-code/pre-tool-use/protect-readonly-files.js +0 -7
@@ -110,6 +110,18 @@ morph-spec phase advance $ARGUMENTS
110
110
 
111
111
  This validates phase eligibility and emits a SKILL DISPATCH block listing required skills for implementation (verification-before-completion, morph-checklist, etc.).
112
112
 
113
+ ### Step 1.5: Create pipeline visibility task
114
+
115
+ > **MANDATORY** — Create umbrella task for implementation tracking.
116
+
117
+ ```
118
+ TaskCreate: "Implement: {feature-name}"
119
+ → description: "Execute T001-T00N from tasks.md with checkpoints"
120
+ → activeForm: "Implementing feature"
121
+ ```
122
+
123
+ Mark as `in_progress`. After all tasks complete (Step 5), mark as `completed`.
124
+
113
125
  ### Step 2: Initialize state tracking
114
126
 
115
127
  ```bash
@@ -145,6 +157,13 @@ morph-spec task done $ARGUMENTS {task-id}
145
157
  - Re-run `task done` — do NOT use `--skip-validation` unless the user explicitly authorizes it
146
158
  - After 3 consecutive failures, escalate to the user
147
159
 
160
+ **`--skip-validation` budget system:**
161
+ - Budget-limited: `min(5, ceil(totalTasks × 0.20))` — e.g., 5 tasks → 1 skip, 32 tasks → 5 skips
162
+ - Requires `--reason <text>` (minimum 5 characters) for audit trail
163
+ - Skipped tasks don't count as `passed` in validationHistory → degrades pass rate
164
+ - Usage: `morph-spec task done feat T001 --skip-validation --reason "CSS-only change, no logic"`
165
+ - When budget is exhausted, all remaining tasks must pass Tier-4 validation
166
+
148
167
  **Parallel execution (agent teams):**
149
168
  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.
150
169
 
@@ -212,7 +231,8 @@ Next: {next-task-id} — {next-task-title}
212
231
 
213
232
  - Using `state set phase` instead of `phase advance` — phase advance validates eligibility first
214
233
  - Skipping `task start` before implementing — the task-tracking guard will warn
215
- - Using `--skip-validation` without user authorization
234
+ - Using `--skip-validation` without user authorization or without `--reason`
235
+ - Exhausting `--skip-validation` budget on trivial tasks — reserve for genuine emergencies
216
236
  - Implementing without reading spec.md and contracts first
217
237
  - Writing code before `phase advance` to implement — the hook will block writes
218
238
  - Skipping checkpoints — they catch integration issues early
@@ -18,7 +18,7 @@ Check if the feature already has state:
18
18
  morph-spec state get {feature-name}
19
19
  ```
20
20
 
21
- - **Exists:** Read the current phase and resume from where it stopped (skip completed phases)
21
+ - **Exists:** Read the current phase and resume from where it stopped (skip completed phases). Create pipeline master tasks (Step 6) and mark already-completed phases as `completed`.
22
22
  - **Does not exist:** Start from scratch (PHASE 0)
23
23
 
24
24
  ---
@@ -75,6 +75,35 @@ morph-spec state set {feature-name} status draft
75
75
  morph-spec state mark-output {feature-name} proposal
76
76
  ```
77
77
 
78
+ ### Step 6: Create pipeline master tasks
79
+
80
+ > **MANDATORY** — Create one native task per pipeline phase for progress visibility.
81
+ > These are high-level tasks — one per phase, not per workflow step.
82
+
83
+ ```
84
+ TaskCreate: "Phase 0: Proposal" → description: "Define feature scope and approach" → activeForm: "Proposal"
85
+ TaskCreate: "Phase 1: Setup" → description: "Load context, detect agents, confirm stack" → activeForm: "Setup"
86
+ TaskCreate: "Phase 2: Design" → description: "Schema analysis, spec, contracts, decisions" → activeForm: "Design"
87
+ TaskCreate: "Phase 3: Clarify" → description: "Resolve ambiguities and edge cases" → activeForm: "Clarify"
88
+ TaskCreate: "Phase 4: Plan" → description: "Implementation plan with TDD and file paths" → activeForm: "Plan"
89
+ TaskCreate: "Phase 5: Tasks" → description: "Break spec into T001-T00N with dependencies" → activeForm: "Tasks"
90
+ ```
91
+
92
+ If `ui-designer` is among the activated agents, also create:
93
+ ```
94
+ TaskCreate: "Phase 1.5: UI/UX" → description: "Design system, mockups, components, flows" → activeForm: "UI/UX"
95
+ ```
96
+
97
+ Wire dependencies (addBlockedBy) matching the phase sequence:
98
+ - Setup ← Proposal
99
+ - UI/UX (if created) ← Setup
100
+ - Design ← UI/UX (or Setup if no UI/UX)
101
+ - Clarify ← Design
102
+ - Plan ← Clarify
103
+ - Tasks ← Plan
104
+
105
+ Mark "Phase 0: Proposal" as `in_progress` immediately.
106
+
78
107
  ### MANDATORY PAUSE
79
108
 
80
109
  Use `AskUserQuestion` to present the approval gate with these elements:
@@ -100,6 +129,8 @@ Invoke the `morph-phase-setup` skill.
100
129
 
101
130
  Summary: load project context, confirm stack, list active agents, update state.
102
131
 
132
+ > **Task lifecycle:** `TaskUpdate` the "Phase 0: Proposal" task → `completed`. `TaskUpdate` the "Phase 1: Setup" task → `in_progress`.
133
+
103
134
  **No pause here.** Continue automatically to the next phase.
104
135
 
105
136
  ---
@@ -110,6 +141,8 @@ Check if `ui-designer` is in `activeAgents`:
110
141
  - **Yes:** Invoke the `morph-phase-uiux` skill. **MANDATORY PAUSE** after generating UI deliverables.
111
142
  - **No:** Skip to PHASE 2.
112
143
 
144
+ > **Task lifecycle:** `TaskUpdate` the "Phase 1: Setup" task → `completed`. `TaskUpdate` the "Phase 1.5: UI/UX" task → `in_progress` (if UI/UX), or the "Phase 2: Design" task → `in_progress` (if skipping UI/UX).
145
+
113
146
  After approval:
114
147
  ```bash
115
148
  morph-spec approve {feature-name} uiux
@@ -120,6 +153,8 @@ morph-spec phase advance {feature-name}
120
153
 
121
154
  ## 5. PHASE 2: DESIGN
122
155
 
156
+ > **Task lifecycle:** `TaskUpdate` the completing phase task (UI/UX or Setup) → `completed`. `TaskUpdate` the "Phase 2: Design" task → `in_progress`.
157
+
123
158
  Invoke the `morph-phase-design` skill.
124
159
 
125
160
  Summary: generate spec.md, contracts.cs (or contracts-vsa.cs for VSA), decisions.md with ADRs.
@@ -138,6 +173,8 @@ morph-spec phase advance {feature-name}
138
173
 
139
174
  ## 6. PHASE 3: CLARIFY (interactive)
140
175
 
176
+ > **Task lifecycle:** `TaskUpdate` the "Phase 2: Design" task → `completed`. `TaskUpdate` the "Phase 3: Clarify" task → `in_progress`.
177
+
141
178
  Invoke the `morph-phase-clarify` skill.
142
179
 
143
180
  Summary: identify ambiguities in spec.md, generate 3-7 targeted questions (building on the questions seeded in the proposal), wait for user answers, update spec with clarifications and edge cases.
@@ -148,6 +185,8 @@ Summary: identify ambiguities in spec.md, generate 3-7 targeted questions (build
148
185
 
149
186
  ## 7. PHASE 4: PLAN
150
187
 
188
+ > **Task lifecycle:** `TaskUpdate` the "Phase 3: Clarify" task → `completed`. `TaskUpdate` the "Phase 4: Plan" task → `in_progress`.
189
+
151
190
  Invoke the `morph-phase-plan` skill.
152
191
 
153
192
  Summary: generate a detailed implementation plan with exact file paths, TDD structure, and context-aware execution strategy.
@@ -166,6 +205,8 @@ morph-spec phase advance {feature-name}
166
205
 
167
206
  ## 8. PHASE 5: TASKS
168
207
 
208
+ > **Task lifecycle:** `TaskUpdate` the "Phase 4: Plan" task → `completed`. `TaskUpdate` the "Phase 5: Tasks" task → `in_progress`.
209
+
169
210
  Invoke the `morph-phase-tasks` skill.
170
211
 
171
212
  Summary: break spec into tasks T001-TXXX with dependencies, checkpoints, estimates.
@@ -184,6 +225,8 @@ morph-spec phase advance {feature-name}
184
225
 
185
226
  ## 9. Planning Complete
186
227
 
228
+ > **Task lifecycle:** `TaskUpdate` the "Phase 5: Tasks" task → `completed`.
229
+
187
230
  After task approval:
188
231
 
189
232
  ```
@@ -27,7 +27,7 @@ import { readStdin } from '../../shared/stdin-reader.js';
27
27
  import { stateExists, getFeature, getFeaturePhase } from '../../shared/state-reader.js';
28
28
  import { pass, injectContext } from '../../shared/hook-response.js';
29
29
  import { logHookActivity } from '../../shared/activity-logger.js';
30
- import { extractValidationDispatch, formatValidatorInstruction, getToolOutput, parseTaskDoneCommand, parsePhaseAdvanceCommand } from '../../shared/dispatch-helpers.js';
30
+ import { extractValidationDispatch, formatValidatorInstruction, getToolOutput, parseTaskDoneCommand, parsePhaseAdvanceCommand, parseDispatchAgentsCommand } from '../../shared/dispatch-helpers.js';
31
31
 
32
32
  try {
33
33
  if (!stateExists()) pass();
@@ -73,8 +73,21 @@ async function dispatch(command, payload) {
73
73
  const validatorText = await buildValidatorDispatchContext(featureName, payload);
74
74
  if (validatorText) {
75
75
  if (skipValidation) {
76
+ // Include budget info when available
77
+ let budgetInfo = '';
78
+ try {
79
+ const feature = getFeature(featureName);
80
+ if (feature) {
81
+ const total = feature.tasks?.total || 0;
82
+ const budget = total === 0 ? 1 : Math.max(1, Math.min(5, Math.ceil(total * 0.2)));
83
+ const used = (feature.skipValidationLog || []).length;
84
+ budgetInfo = ` (budget: ${used}/${budget})`;
85
+ }
86
+ } catch {
87
+ // Non-blocking
88
+ }
76
89
  contextParts.push(
77
- '⏩ DEFERRED TO CHECKPOINT — validators skipped on this task but MUST run at next checkpoint:\n\n' +
90
+ `⏩ DEFERRED TO CHECKPOINT — validators skipped on this task${budgetInfo} but MUST run at next checkpoint:\n\n` +
78
91
  validatorText
79
92
  );
80
93
  dispatchResult = 'task_done_deferred_validators';
@@ -107,6 +120,23 @@ async function dispatch(command, payload) {
107
120
  const validatorText = await buildValidatorDispatchContext(featureName, payload);
108
121
  if (validatorText) contextParts.push(validatorText);
109
122
 
123
+ // Mandatory dispatch instruction when advancing to implement phase
124
+ try {
125
+ const advancedPhase = getFeaturePhase(featureName);
126
+ if (advancedPhase === 'implement') {
127
+ contextParts.push(
128
+ '🔧 MANDATORY AGENT DISPATCH\n' +
129
+ '════════════════════════════════════════\n' +
130
+ `Run this command BEFORE starting any task:\n\n` +
131
+ ` morph-spec dispatch-agents ${featureName} implement\n\n` +
132
+ `Task start will be BLOCKED until dispatch is recorded.\n` +
133
+ `Use the dispatch output to determine execution mode (single/subagents/agent-teams).`
134
+ );
135
+ }
136
+ } catch {
137
+ // Non-blocking
138
+ }
139
+
110
140
  logHookActivity('phase-dispatch', 'PostToolUse',
111
141
  validatorText ? 'phase_advance_with_validators' : 'phase_chain');
112
142
 
@@ -116,6 +146,21 @@ async function dispatch(command, payload) {
116
146
  pass();
117
147
  }
118
148
 
149
+ // morph-spec dispatch-agents <feature> <phase>
150
+ const dispatchParsed = parseDispatchAgentsCommand(command);
151
+ if (dispatchParsed) {
152
+ const { featureName: dispFeature, phase: dispPhase } = dispatchParsed;
153
+ if (dispPhase === 'implement') {
154
+ injectContext(
155
+ `✓ Agent dispatch recorded for '${dispFeature}' (implement phase).\n` +
156
+ `You may now start tasks with: morph-spec task start ${dispFeature} <taskId>\n` +
157
+ `Use the dispatch config above to assign tasks to the correct typed agents.`
158
+ );
159
+ }
160
+ logHookActivity('phase-dispatch', 'PostToolUse', 'dispatch_agents_confirmed');
161
+ pass();
162
+ }
163
+
119
164
  // morph-spec approve <feature> <gate>
120
165
  const approveMatch = command.match(/morph-spec\s+approve\s+(\S+)\s+(\S+)/);
121
166
  if (approveMatch) {
@@ -125,10 +125,11 @@ try {
125
125
  }
126
126
 
127
127
  // Task tracking guidance for work phases
128
- if (['design', 'tasks', 'implement'].includes(phase)) {
128
+ if (['proposal', 'setup', 'uiux', 'design', 'clarify', 'plan', 'tasks', 'implement'].includes(phase)) {
129
129
  lines.push('');
130
- lines.push('💡 TaskCreate/TaskUpdate: Para sessões com 3+ ações planejadas, crie tasks Claude Code');
131
- lines.push(' para visibilidade do progresso. Ex: TaskCreate("Gerar spec.md"), TaskUpdate(id, "completed")');
130
+ lines.push('⚠️ MANDATORY: Create session tasks (TaskCreate) BEFORE starting phase work.');
131
+ lines.push(' Analyze the phase workflow and create tasks reflecting your planned actions.');
132
+ lines.push(' Mark each in_progress → completed as you go. See phase skill for guidance.');
132
133
  }
133
134
 
134
135
  // Trust level visibility — warn when low trust may block approval gates
@@ -98,6 +98,20 @@ export function parsePhaseAdvanceCommand(command) {
98
98
  return { featureName: match[1] };
99
99
  }
100
100
 
101
+ /**
102
+ * Parse `morph-spec dispatch-agents <feature> <phase>` from a bash command string.
103
+ * Returns { featureName, phase } or null if the command doesn't match.
104
+ *
105
+ * @param {string} command
106
+ * @returns {{ featureName: string, phase: string } | null}
107
+ */
108
+ export function parseDispatchAgentsCommand(command) {
109
+ if (!command || typeof command !== 'string') return null;
110
+ const match = command.match(/morph-spec\s+dispatch-agents\s+(\S+)\s+(\S+)/);
111
+ if (!match) return null;
112
+ return { featureName: match[1], phase: match[2] };
113
+ }
114
+
101
115
  /**
102
116
  * Extract the tool result string from a PostToolUse hook payload.
103
117
  * Handles multiple possible formats.
@@ -142,7 +142,9 @@ export function getFeaturePhase(featureName, projectPath) {
142
142
  */
143
143
  export function isGateApproved(featureName, gate, projectPath) {
144
144
  const feature = getFeature(featureName, projectPath);
145
- return feature?.approvalGates?.[gate]?.approved === true;
145
+ // Support both field names: 'approvals' (v5 state) and 'approvalGates' (legacy)
146
+ const gates = feature?.approvals || feature?.approvalGates;
147
+ return gates?.[gate]?.approved === true;
146
148
  }
147
149
 
148
150
  /**
@@ -153,9 +155,11 @@ export function isGateApproved(featureName, gate, projectPath) {
153
155
  */
154
156
  export function getPendingGates(featureName, projectPath) {
155
157
  const feature = getFeature(featureName, projectPath);
156
- if (!feature?.approvalGates) return [];
158
+ // Support both field names: 'approvals' (v5 state) and 'approvalGates' (legacy)
159
+ const gates = feature?.approvals || feature?.approvalGates;
160
+ if (!gates) return [];
157
161
 
158
- return Object.entries(feature.approvalGates)
162
+ return Object.entries(gates)
159
163
  .filter(([, gate]) => !gate.approved)
160
164
  .map(([name]) => name);
161
165
  }
@@ -0,0 +1,49 @@
1
+ ---
2
+ stacks:
3
+ - "*"
4
+ ---
5
+
6
+ # MORPH-SPEC Task Tracking
7
+
8
+ > Session tasks are MANDATORY in every MORPH-SPEC phase. They track real progress and must be
9
+ > created BEFORE any phase work begins.
10
+
11
+ ## Rules
12
+
13
+ 1. **Every phase skill MUST create session tasks** using `TaskCreate` before reading files or generating outputs
14
+ 2. **Tasks are dynamic** — analyze the phase workflow and create tasks that reflect YOUR actual planned actions for this session
15
+ 3. **Every task MUST be updated**: `in_progress` before starting, `completed` after finishing
16
+ 4. **Pipeline orchestrators** (`/morph-proposal`, `/morph-apply`) MUST create master tasks for each phase
17
+ 5. **Never skip task creation** — even if resuming mid-phase, create tasks for remaining steps
18
+ 6. **Granularity**: minimum 2, typically 3-7 tasks per phase — adjust to complexity
19
+ 7. **For iterative work** (clarification rounds, quality loops): update task `subject` with round/score progress
20
+
21
+ ## Task Update Pattern
22
+
23
+ ```
24
+ TaskUpdate(taskId, status="in_progress") // before starting the step
25
+ // ... do the work ...
26
+ TaskUpdate(taskId, status="completed") // after step finishes
27
+ ```
28
+
29
+ For iterative tasks:
30
+ ```
31
+ TaskUpdate(taskId, subject="Round 3 — score 82/100")
32
+ ```
33
+
34
+ ## Deviation Tracking
35
+
36
+ When completing a task differently than originally planned, record the reason:
37
+
38
+ ```
39
+ morph-spec task done <feature> <taskId> --note "Reason for deviation"
40
+ ```
41
+
42
+ For after-the-fact annotation (supports multiple types):
43
+ ```
44
+ morph-spec task annotate <feature> <taskId> "Reason" --type deviation
45
+ morph-spec task annotate <feature> <taskId> "Context info" --type context
46
+ morph-spec task annotate <feature> <taskId> "Resolved" --type blocker-resolved
47
+ ```
48
+
49
+ Note types: `deviation` (default), `context`, `blocker-resolved`
@@ -33,17 +33,13 @@ allowed-tools: Read, Bash, Glob, Grep, AskUserQuestion
33
33
 
34
34
  ## Workflow
35
35
 
36
- ### Step 0: Create session tasks
36
+ ## MANDATORY: Session Tasks
37
37
 
38
- ```
39
- TaskCreate: "Explore project context" → activeForm: "Exploring context"
40
- TaskCreate: "Ask clarifying questions" → activeForm: "Asking questions"
41
- TaskCreate: "Propose 2-3 approaches" → activeForm: "Analyzing approaches"
42
- TaskCreate: "Present design" → activeForm: "Presenting design"
43
- TaskCreate: "Document recommendation" → activeForm: "Documenting"
44
- ```
45
-
46
- Update each to `in_progress` before its step and `completed` after.
38
+ > **BEFORE starting any brainstorming work**, analyze what you need to do and create session tasks.
39
+ >
40
+ > **Rules:** Minimum 2 tasks, typically 3-5. Mark `in_progress` before starting, `completed` after.
41
+ >
42
+ > **Typical tasks:** context exploration, clarifying questions, approach analysis, recommendation, documentation
47
43
 
48
44
  ### Step 1: Explore Context
49
45
 
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 3 (Clarify). Iterative clarification loop driven b
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.11.0"
7
+ cliVersion: "4.11.1"
8
8
  ---
9
9
 
10
10
  # MORPH Clarify — Phase 3
@@ -94,6 +94,15 @@ Read: .morph/features/$ARGUMENTS/1-design/spec.md
94
94
 
95
95
  Calculate the initial score. Track accumulated answers from prior rounds to avoid repeating already-answered questions.
96
96
 
97
+ ## MANDATORY: Session Tasks
98
+
99
+ > **BEFORE starting clarification work**, analyze the spec quality and create session tasks.
100
+ >
101
+ > **Rules:** Minimum 2 tasks, typically 2-4. Mark `in_progress` before starting, `completed` after.
102
+ > For the clarification loop, update the task `subject` with round and score progress.
103
+ >
104
+ > **Typical tasks:** initial score calculation, clarification rounds (iterative), output generation
105
+
97
106
  ---
98
107
 
99
108
  ### Main Loop
@@ -3,7 +3,7 @@ name: morph-phase-codebase-analysis
3
3
  description: MORPH-SPEC Design sub-phase that analyzes existing codebase and database schema, producing schema-analysis.md with real column names, types, relationships, and field mismatches. Use at the start of Design phase before generating contracts.cs to prevent incorrect field names or types.
4
4
  user-invocable: false
5
5
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- cliVersion: "4.11.0"
6
+ cliVersion: "4.11.1"
7
7
  ---
8
8
 
9
9
  # MORPH Codebase Analysis - Design Sub-phase
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 2 (Design). Schema-first interactive design: reads
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion, Agent
7
- cliVersion: "4.11.0"
7
+ cliVersion: "4.11.1"
8
8
  ---
9
9
 
10
10
  # MORPH Design — Phase 2
@@ -53,19 +53,13 @@ Schema-first interactive design: read the real schema, validate with user, gener
53
53
 
54
54
  ## PRE-FLIGHT
55
55
 
56
- ### Create session tasks for visibility
56
+ ## MANDATORY: Session Tasks
57
57
 
58
- ```
59
- TaskCreate: "Pre-flight validation" → activeForm: "Validating pre-flight"
60
- TaskCreate: "Schema analysis" → activeForm: "Analyzing schema"
61
- TaskCreate: "Architecture blueprint" → activeForm: "Designing architecture"
62
- TaskCreate: "Generate spec.md" → activeForm: "Writing spec"
63
- TaskCreate: "Generate contracts" → activeForm: "Writing contracts"
64
- TaskCreate: "Generate decisions.md" → activeForm: "Documenting decisions"
65
- TaskCreate: "Design approval" → activeForm: "Awaiting design approval"
66
- ```
67
-
68
- Update each to `in_progress` before starting and `completed` after finishing.
58
+ > **BEFORE starting any design work**, analyze the workflow below and create session tasks.
59
+ >
60
+ > **Rules:** Minimum 3 tasks, typically 5-7. Mark `in_progress` before starting, `completed` after.
61
+ >
62
+ > **Typical tasks:** pre-flight validation, schema analysis, architecture blueprint, spec generation, contracts generation, decisions documentation, design approval
69
63
 
70
64
  ---
71
65
 
@@ -5,7 +5,7 @@ argument-hint: "[feature-name]"
5
5
  context: fork
6
6
  agent: general-purpose
7
7
  user-invocable: false
8
- cliVersion: "4.11.0"
8
+ cliVersion: "4.11.1"
9
9
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion, Agent
10
10
  ---
11
11
 
@@ -150,6 +150,12 @@ Use `AskUserQuestion` with header `"{MCP}"` and options:
150
150
 
151
151
  ## Context Loading
152
152
 
153
+ ## MANDATORY: Session Tasks
154
+
155
+ > **You MUST create one native task per T001-T00N from tasks.md BEFORE starting implementation.**
156
+ > After creating all tasks, wire dependencies using `addBlockedBy`.
157
+ > Update each to `in_progress` before starting and `completed` after `task done` succeeds.
158
+
153
159
  ### 1. Read full context in PARALLEL
154
160
 
155
161
  ```
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 4 (Plan). Generates a detailed implementation plan
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.11.0"
7
+ cliVersion: "4.11.1"
8
8
  ---
9
9
 
10
10
  # MORPH Plan — Phase 4
@@ -54,6 +54,14 @@ Check the `"phase"` field:
54
54
 
55
55
  > **Rule:** Never write to `3-plan/` until the phase is `plan`.
56
56
 
57
+ ## MANDATORY: Session Tasks
58
+
59
+ > **BEFORE reading any files**, analyze the planning workflow and create session tasks.
60
+ >
61
+ > **Rules:** Minimum 2 tasks, typically 3-5. Mark `in_progress` before starting, `completed` after.
62
+ >
63
+ > **Typical tasks:** feature analysis, execution strategy, plan.md generation, plan approval
64
+
57
65
  ### 1. Read all prerequisites in PARALLEL
58
66
 
59
67
  ```
@@ -65,17 +73,6 @@ Read: .morph/features/{feature}/1-design/spec.md
65
73
  + Read: .morph/config/config.json
66
74
  ```
67
75
 
68
- ### 1.5 Create session tasks for visibility
69
-
70
- ```
71
- TaskCreate: "Analyze feature for execution strategy" → activeForm: "Analyzing feature"
72
- TaskCreate: "Determine execution strategy" → activeForm: "Planning strategy"
73
- TaskCreate: "Generate plan.md" → activeForm: "Writing plan"
74
- TaskCreate: "Plan approval" → activeForm: "Awaiting plan approval"
75
- ```
76
-
77
- Update each to `in_progress` before starting and `completed` after finishing.
78
-
79
76
  ---
80
77
 
81
78
  ## Workflow
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 1 (Setup). Reads project context, detects tech sta
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.11.0"
7
+ cliVersion: "4.11.1"
8
8
  ---
9
9
 
10
10
  # MORPH Setup — Phase 1
@@ -58,16 +58,13 @@ If any checkbox is NOT checked → go back to Phase 0 (Proposal).
58
58
 
59
59
  ---
60
60
 
61
- ### Create session tasks for visibility
61
+ ## MANDATORY: Session Tasks
62
62
 
63
- ```
64
- TaskCreate: "Detect agents and load standards" → activeForm: "Detecting agents"
65
- TaskCreate: "Validate MCP connections" → activeForm: "Validating MCPs"
66
- TaskCreate: "Confirm stack with user" → activeForm: "Confirming stack"
67
- TaskCreate: "Configure feature state" → activeForm: "Configuring state"
68
- ```
69
-
70
- Update each task to `in_progress` before its step and `completed` after.
63
+ > **BEFORE starting any setup work**, analyze the steps below and create session tasks.
64
+ >
65
+ > **Rules:** Minimum 2 tasks, typically 3-5. Mark `in_progress` before starting, `completed` after.
66
+ >
67
+ > **Typical tasks:** agent detection, MCP validation, stack confirmation, state configuration
71
68
 
72
69
  ---
73
70
 
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 4 (Tasks). Breaks approved spec into bottom-up ord
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.11.0"
7
+ cliVersion: "4.11.1"
8
8
  ---
9
9
 
10
10
  # MORPH Tasks — Phase 4
@@ -71,6 +71,14 @@ Check the `"phase"` field:
71
71
 
72
72
  ---
73
73
 
74
+ ## MANDATORY: Session Tasks
75
+
76
+ > **BEFORE reading any files**, analyze the task breakdown workflow and create session tasks.
77
+ >
78
+ > **Rules:** Minimum 2 tasks, typically 3-4. Mark `in_progress` before starting, `completed` after.
79
+ >
80
+ > **Typical tasks:** spec analysis and task definition, tasks.md generation, state update and approval
81
+
74
82
  ### 1. Read all prerequisites in PARALLEL
75
83
 
76
84
  ```
@@ -82,25 +90,9 @@ Read: .morph/features/{feature}/1-design/spec.md
82
90
  + Read: .morph/config/config.json (→ architecture.style)
83
91
  ```
84
92
 
85
- ### 2. Create session tasks for visibility
86
-
87
- After detecting `activeAgents` from state, create tasks with agent context:
88
-
89
- ```
90
- TaskCreate: "Analyze spec and define tasks"
91
- → description: "Active agents: {activeAgents.join(', ')}"
92
- → activeForm: "Analyzing spec"
93
- TaskCreate: "Generate tasks.md"
94
- → description: "Architecture: {config.architecture.style}"
95
- → activeForm: "Generating tasks.md"
96
- TaskCreate: "Phase advance" → activeForm: "Awaiting tasks approval + advancing phase"
97
- ```
98
-
99
- > **Note:** Individual T001-T00N tasks are created as native tasks during the implementation phase (`phase-implement`). Here we only keep the 3 high-level tasks for this planning session.
100
-
101
93
  ---
102
94
 
103
- ### 3. Entry checkpoint — verify prerequisites
95
+ ### 2. Entry checkpoint — verify prerequisites
104
96
 
105
97
  Before starting the breakdown:
106
98
 
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 1.5 (UI/UX). Creates design-system.md, mockups.md,
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.11.0"
7
+ cliVersion: "4.11.1"
8
8
  ---
9
9
 
10
10
  # MORPH UI/UX Design - Phase 1.5
@@ -129,6 +129,14 @@ Print: `✓ Design system generated from [N] tokens — .morph/context/design-sy
129
129
 
130
130
  > **Design system is mandatory** for UI features. The implementation gate (Phase 5) will block if no design system exists.
131
131
 
132
+ ## MANDATORY: Session Tasks
133
+
134
+ > **BEFORE starting UI/UX work**, analyze the workflow below and create session tasks.
135
+ >
136
+ > **Rules:** Minimum 3 tasks, typically 5-7. Mark `in_progress` before starting, `completed` after.
137
+ >
138
+ > **Typical tasks:** design system check, user input collection, UI library selection, visual mockup, deliverable generation, accessibility validation, approval
139
+
132
140
  ### Step 1: Detect If Phase Is Needed
133
141
 
134
142
  Check if active agents include `ui-designer`:
@@ -4,7 +4,7 @@ description: Guided workflow for mid-implementation scope escalation — analyze
4
4
  user-invocable: true
5
5
  argument-hint: "[feature-name]"
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.11.0"
7
+ cliVersion: "4.11.1"
8
8
  ---
9
9
 
10
10
  # Scope Escalation Workflow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polymorphism-tech/morph-spec",
3
- "version": "4.11.0",
3
+ "version": "4.11.1",
4
4
  "description": "MORPH-SPEC: AI-First development framework with validation pipeline and multi-stack support",
5
5
  "keywords": [
6
6
  "claude-code",