@polymorphism-tech/morph-spec 8.2.1 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +70 -99
  2. package/bin/morph-spec.js +12 -0
  3. package/claude-plugin.json +1 -1
  4. package/docs/CHEATSHEET.md +76 -135
  5. package/docs/QUICKSTART.md +35 -51
  6. package/framework/CLAUDE.md +1 -0
  7. package/framework/agents.json +3 -1
  8. package/framework/hooks/README.md +3 -0
  9. package/framework/hooks/claude-code/core/telemetry-log.js +102 -0
  10. package/framework/hooks/shared/telemetry-logger.js +75 -0
  11. package/framework/rules/ai-agents-standards.md +1 -0
  12. package/framework/schemas/feature.schema.json +0 -5
  13. package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
  14. package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
  15. package/framework/skills/core/morph-apply/SKILL.md +1 -1
  16. package/framework/skills/core/morph-brainstorming/SKILL.md +1 -1
  17. package/framework/skills/core/morph-eval/SKILL.md +1 -1
  18. package/framework/skills/core/morph-hotfix/SKILL.md +1 -1
  19. package/framework/skills/core/morph-implement/SKILL.md +1 -1
  20. package/framework/skills/core/morph-plan/SKILL.md +1 -1
  21. package/framework/skills/core/morph-proposal/SKILL.md +1 -1
  22. package/framework/skills/core/morph-review/SKILL.md +1 -1
  23. package/framework/skills/core/morph-stack-scan/SKILL.md +1 -1
  24. package/framework/skills/core/morph-standards/SKILL.md +1 -1
  25. package/framework/standards/STANDARDS.json +43 -1
  26. package/framework/standards/ai-agents/observability-patterns.md +156 -0
  27. package/framework/standards/ai-agents/production.md +3 -47
  28. package/framework/templates/REGISTRY.json +0 -93
  29. package/package.json +1 -1
  30. package/src/commands/observability/telemetry.js +75 -0
  31. package/src/core/state/state-manager.js +0 -128
  32. package/src/dashboard/app/pages/LiveState.jsx +0 -43
  33. package/src/lib/detectors/design-system-detector.js +0 -43
  34. package/src/lib/generators/index.js +0 -1
  35. package/src/lib/telemetry/telemetry-reader.js +103 -0
  36. package/src/lib/validators/validation-runner.js +9 -73
  37. package/src/utils/hooks-installer.js +27 -3
  38. package/framework/templates/context/CONTEXT-FEATURE.md +0 -269
  39. package/framework/templates/context/CONTEXT.md +0 -181
  40. package/src/lib/agents/metrics-aggregator.js +0 -56
  41. package/src/lib/agents/metrics-calculator.js +0 -125
  42. package/src/lib/generators/metadata-extractor.js +0 -385
package/README.md CHANGED
@@ -3,14 +3,14 @@
3
3
  > Spec-driven development framework for multi-stack projects. Turns feature requests into implementation-ready code through structured, AI-orchestrated phases.
4
4
 
5
5
  **Package:** `@polymorphism-tech/morph-spec`
6
- **Version:** 8.2.1
6
+ **Version:** 8.3.0
7
7
  **Requires:** Node.js 22+, Claude Code
8
8
 
9
9
  ---
10
10
 
11
11
  ## What it does
12
12
 
13
- morph-spec enforces a spec-first development workflow. When you ask for a feature, it does not write code immediately. It runs through structured phases (proposal, design, tasks) with approval gates before a single line of implementation is generated. Each phase produces traceable output files. Every decision is documented.
13
+ morph-spec enforces a spec-first development workflow. When you ask for a feature, it does not write code immediately. It runs through structured phases (proposal, plan, implement) with approval gates before a single line of implementation is generated. Each phase produces traceable output files. Every decision is documented.
14
14
 
15
15
  It integrates natively with Claude Code: skills become slash commands, agents become native subagents, hooks inject state context automatically, and rules enforce standards based on file paths.
16
16
 
@@ -61,7 +61,7 @@ your-project/
61
61
  │ ├── config/
62
62
  │ │ └── config.json # Project configuration
63
63
  │ ├── framework/
64
- │ │ ├── agents.json # 22 agents in 4 tiers (READ-ONLY)
64
+ │ │ ├── agents.json # 8 domain personas (READ-ONLY)
65
65
  │ │ ├── standards/ # Coding and architecture standards (READ-ONLY)
66
66
  │ │ └── templates/ # Code and IaC templates (READ-ONLY)
67
67
  │ ├── context/ # Project context (README.md, standards.md)
@@ -76,9 +76,9 @@ your-project/
76
76
  └── .claude/
77
77
  ├── commands/ # Slash commands
78
78
  ├── skills/ # Framework skills (flat .md files)
79
- ├── agents/ # Native subagents (22 agents)
80
- ├── rules/ # Path-scoped standards rules
81
- └── settings.local.json # Hooks configuration (10 hooks)
79
+ ├── agents/ # Native subagents (one morph-{id}.md per persona)
80
+ ├── rules/ # Stack-aware, path-scoped standards rules
81
+ └── settings.local.json # Hooks configuration
82
82
  ```
83
83
 
84
84
  ---
@@ -88,10 +88,10 @@ your-project/
88
88
  Features move through structured phases. Some are optional depending on feature type.
89
89
 
90
90
  ```
91
- proposal → [design] → plan → implement → review
91
+ proposal → [uiux] → plan → implement → review
92
92
  ```
93
93
 
94
- `design` is optional — applies only to UI-heavy features.
94
+ `uiux` is optional — applies only to UI-heavy features.
95
95
 
96
96
  ### Phase outputs
97
97
 
@@ -134,13 +134,15 @@ Independent features can also be developed **in parallel, each isolated in its o
134
134
  These commands are available inside Claude Code after init.
135
135
 
136
136
 
137
- | Command | Description |
138
- | --------------------------- | --------------------------------------------------------- |
139
- | `/morph-proposal {feature}` | Full spec pipeline (phases 0-4, pauses at approval gates) |
140
- | `/morph-apply {feature}` | Implement approved feature (phase 5) |
141
- | `/morph-hotfix {feature}` | Surgical hotfix ADW — scout → fix → human Gate 3 → ship |
142
- | `/morph-status` | Feature status dashboard |
143
- | `/morph-preflight` | Pre-implementation validation |
137
+ | Command | Description |
138
+ | ------------------------------ | ---------------------------------------------------------- |
139
+ | `/morph-proposal {feature}` | Business understanding + plan (Gates 1 and 2) |
140
+ | `/morph-apply {feature}` | Autonomous execution + review (Gate 3) |
141
+ | `/morph-hotfix {feature}` | Surgical hotfix ADW — scout → fix → human Gate 3 → ship |
142
+ | `/morph-status [feature]` | Status of the active (or specified) feature |
143
+ | `/morph-archive {feature}` | Archive a completed feature (after Gate 3) |
144
+ | `/morph-preflight` | Pre-deploy validation (specs, contracts, tests, infra) |
145
+ | `/morph-troubleshoot [error]` | Root-cause diagnosis for .NET/Next.js errors |
144
146
 
145
147
 
146
148
  ---
@@ -160,15 +162,16 @@ morph-spec doctor --full # Full health check (all file verificatio
160
162
  ### Feature workflow
161
163
 
162
164
  ```bash
163
- morph-spec state list # List all features and their states
164
- morph-spec state get {feature} # Get feature state
165
- morph-spec state set {feature} {key} {value}
166
- morph-spec phase advance {feature} # Advance to next phase
167
- morph-spec task done {feature} # Mark current task complete
168
- morph-spec task start {feature} # Start next task
169
- morph-spec status {feature} # Feature status dashboard
165
+ morph-spec fleet # Every active feature (root + worktrees): phase, gates, activity
166
+ morph-spec status {feature} # Feature status dashboard
167
+ morph-spec approve {feature} {gate} # Approve a phase gate (proposal, plan, review)
168
+ morph-spec advance {feature} # Approve the current gate and scaffold the next phase folder
169
+ morph-spec approval-status {feature} # Show approval status for all gates
170
+ morph-spec archive {feature} # Archive a completed feature (after Gate 3)
170
171
  ```
171
172
 
173
+ Task progress within a feature is tracked with the native `TaskCreate`/`TaskUpdate` tools, persisted to `tasks.json` — there is no separate CLI command for starting or completing a task.
174
+
172
175
  ### Validation
173
176
 
174
177
  ```bash
@@ -199,92 +202,59 @@ morph-spec worktree list [--json] # List active feature worktrees with ph
199
202
 
200
203
  ---
201
204
 
202
- ## Agent hierarchy
203
-
204
- morph-spec includes 22 agents organized in 4 tiers (2+3+13+4). Tier 1-2 agents are installed as native Claude Code subagents in `.claude/agents/`. Tier 3 domain agents are installed as `.claude/agents/morph-domain-{name}.md`.
205
-
206
- ### Tier 1 — Orchestrators (2)
207
-
208
-
209
- | Agent | Role | Active |
210
- | --------------------- | ------------------------------------------------------ | --------- |
211
- | `standards-architect` | Chief Architect — enforces standards across all phases | Always |
212
- | `ai-system-architect` | AI/Agent system design and orchestration | On-demand |
213
-
214
-
215
- ### Tier 2 — Domain Leaders (3)
216
-
217
-
218
- | Agent | Squad | Active |
219
- | ------------------ | ------------------------- | --------- |
220
- | `dotnet-senior` | Backend squad lead | Always |
221
- | `nextjs-expert` | Frontend squad lead | Always |
222
- | `infra-architect` | Infrastructure squad lead | Always |
205
+ ## Agent model
223
206
 
207
+ morph-spec dispatches 8 flat domain personas — no tiers, no hierarchy — defined in `.morph/framework/agents.json` (single source of truth) and installed identically to `.claude/agents/morph-{id}.md`. Claude picks the right persona per task from the domains/keywords in `agents.json`, then dispatches it via the `Agent` tool.
224
208
 
225
- ### Tier 3 — Specialists (13)
226
-
227
- Organized into squads:
228
-
229
- **Backend (6):** ef-modeler, hangfire-orchestrator, ms-agent-expert, supabase-expert, vector-search-expert, morph-spec-architect
230
-
231
- **Frontend (3):** css-specialist, ui-designer, seo-growth-hacker
232
-
233
- **Integrations (3):** asaas-financial, clerk-auth, resend-email
234
-
235
- **Security (1):** security-expert
236
-
237
- ### Tier 4 — Validators (4)
238
-
239
-
240
- | Agent | Validates |
241
- | ------------------------------ | --------------------------------------- |
242
- | `architecture-expert` | Architectural decisions and constraints |
243
- | `packages-validator` | Package versions and compatibility |
244
- | `design-system-validator` | Design system adherence |
245
- | `nextjs-component-validator` | Next.js component structure and naming |
209
+ | Persona | Domain | Model |
210
+ | ---------------- | -------------------------------------- | ------ |
211
+ | `dotnet-senior` | Backend (.NET, VSA) | sonnet |
212
+ | `ef-modeler` | EF Core / Postgres modeling | sonnet |
213
+ | `maf-expert` | Microsoft Agent Framework | sonnet |
214
+ | `nextjs-expert` | Frontend (Next.js/React) | sonnet |
215
+ | `ui-designer` | UI/UX, design systems | sonnet |
216
+ | `infra-engineer` | Jobs, deployment, observability | sonnet |
217
+ | `evaluator` | Independent code/architecture review (Gate 3) | opus |
218
+ | `scout` | Read-only codebase diagnosis | haiku |
246
219
 
220
+ `morph-spec doctor` detects drift between `agents.json` and the generated `.claude/agents/morph-*.md` files — never hand-edit the generated files.
247
221
 
248
222
  ---
249
223
 
250
224
  ## Hooks
251
225
 
252
- 10 Claude Code hooks are installed into `.claude/settings.local.json` across 8 event types:
226
+ Guardrail hooks are installed into `.claude/settings.local.json` across 7 event bindings. All are **fail-open** — they check that state exists first and silently no-op on missing/corrupt state; they never throw, write state, or orchestrate.
253
227
 
254
228
 
255
- | Event | Hook | Purpose |
256
- | -------------------- | -------------------------- | ----------------------------------------------------------------- |
257
- | `SessionStart` | `inject-morph-context.js` | Injects active feature spec into context (configurable char max) |
258
- | `UserPromptSubmit` | `enrich-prompt.js` | Context-aware prompt enrichment, wrong-phase warnings |
259
- | `PreToolUse` | Bash guard (prompt type) | Detects destructive patterns inline via Claude's reasoning |
260
- | `PreToolUse` | `protect-spec-files.js` | Blocks edits to spec files after approval gate |
261
- | `PreToolUse` | `enforce-phase-writes.js` | Ensures writes go to the correct phase directory |
262
- | `PostToolUse` | `dispatch.js` | Triggers auto-checkpoints on task completion |
263
- | `PostToolUseFailure` | `handle-tool-failure.js` | Logs failures to `.morph/logs/tool-failures.log` |
264
- | `Stop` | `validate-completion.js` | Warns about incomplete tasks/missing outputs/pending gates |
265
- | `PreCompact` | `save-morph-context.js` | Snapshots state to `.morph/memory/` before compaction |
229
+ | Event | Hook(s) | Purpose |
230
+ | --------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
231
+ | `SessionStart` | `worktree-context.js` | Injects feature identity (worktree) or active-feature summary (root) |
232
+ | `PreToolUse` (Write\|Edit) | `protect-spec-files.js`, `enforce-phase-writes.js` | Blocks edits to the frozen plan contract post-Gate-2; enforces phase folders |
233
+ | `PreToolUse` (Bash) | `pre-bash-denylist.js` | Detects destructive shell patterns |
234
+ | `PostToolUse` | `post-edit-typecheck.js`, `tasks-json-guard.js`, `trace-autogen.js` | Stack-aware typecheck; guards `tasks.json` plan-contract edits; auto-generates execution traces |
235
+ | `PostToolUse` | `state-sync.js`, `gate-guard.js`, `loop-detect.js` | Syncs feature state; enforces gate ordering; detects repeated-action loops |
236
+ | `Stop` | `validate-completion.js` | Warns about incomplete tasks, missing outputs, or pending approval gates |
266
237
 
267
238
 
268
239
  Protected files (via `permissions.deny`):
269
240
 
270
- - `.morph/state.json` — never edited directly, CLI only
271
- - `.morph/framework/`** — read-only framework content
241
+ - `.morph/state.json` — never edited directly, derived from `feature.json` files
242
+ - `.morph/framework/` — read-only framework content
272
243
 
273
244
  ---
274
245
 
275
246
  ## Rules
276
247
 
277
- Path-scoped rules are installed to `.claude/rules/` and activate automatically based on file patterns:
278
-
248
+ Rules are installed to `.claude/rules/` based on your detected stack (`stacks:` frontmatter, same tagging mechanism as agents and templates) and activate automatically based on file path patterns (`paths:` frontmatter). A subset of the current set:
279
249
 
280
- | Rule file | Applies to |
281
- | ----------------------------- | -------------------------------------------------------- |
282
- | `morph-workflow.md` | Always active — spec-first mandate, phase commands |
283
- | `csharp-standards.md` | `**/*.cs`, `**/*.csproj` |
284
- | `frontend-standards.md` | `**/*.razor`, `**/*.css`, `**/*.scss` |
285
- | `nextjs-standards.md` | `**/*.tsx`, `**/*.ts` |
286
- | `testing-standards.md` | `tests/`**, `**/*.test.*`, `**/*.spec.*`, `**/*Tests.cs` |
287
- | `infrastructure-standards.md` | `**/*.bicep`, `**/Dockerfile`, `**/pipelines/**` |
250
+ | Rule file | Applies to | Stack |
251
+ | ----------------------------- | ------------------------------------------------- | --------- |
252
+ | `morph-workflow.md` | Always active — spec-first mandate | any |
253
+ | `csharp-standards.md` | `**/*.cs`, `**/*.csproj` | dotnet |
254
+ | `frontend-standards.md` | `**/*.tsx`, `**/*.css`, `**/*.scss` | nextjs |
255
+ | `nextjs-standards.md` | Next.js-specific patterns | nextjs |
256
+ | `ai-agents-standards.md` | `**/Agents/**`, `**/*Agent*.cs` | dotnet |
257
+ | `infrastructure-standards.md` | `**/Dockerfile*`, `**/docker-compose*`, `**/.github/**` | docker |
288
258
 
289
259
 
290
260
  ---
@@ -292,11 +262,12 @@ Path-scoped rules are installed to `.claude/rules/` and activate automatically b
292
262
  ## Stack support
293
263
 
294
264
 
295
- | Technology | Support |
296
- | ------------------------------------------- | ------------------------------------------------ |
297
- | .NET 10 / ASP.NET Core | Full — C# contracts, EF Core, CQRS, Minimal API |
298
- | Next.js / React / TypeScript | Full — components, routing, state management |
299
- | Supabase | Supported via CLI (local Docker) |
265
+ | Technology | Support |
266
+ | ------------------------------------------- | ------------------------------------------------------------- |
267
+ | .NET 10 / ASP.NET Core | Full — VSA with direct handlers, result pattern, Minimal API |
268
+ | EF Core / Neon (Postgres) | Full — migrations, Neon Auth (Better Auth) |
269
+ | Next.js / React / TypeScript | Full — components, routing, state management |
270
+ | Microsoft Agent Framework (MAF) | Full — single-agent + structured output + tools + RAG |
300
271
 
301
272
 
302
273
  TypeScript strict mode is enforced by default. See `.morph/framework/standards/` for all coding standards.
@@ -323,12 +294,12 @@ After updating, run `morph-spec doctor` to confirm the installation is healthy.
323
294
 
324
295
  **Never edit protected files directly:**
325
296
 
326
- - `.morph/state.json` — use `morph-spec state set`
327
- - `.morph/framework/`** — read-only, updated by `morph-spec update`
297
+ - `.morph/state.json` — derived automatically from `feature.json`; use `morph-spec approve`/`advance`/`score`/`gate-decision` to change feature state
298
+ - `.morph/framework/` — read-only, updated by `morph-spec update`
328
299
 
329
- **Always document decisions.** Each feature has a `2-design/decisions.md`. Architectural choices go there, not in commit messages.
300
+ **Always document decisions.** Each feature can have a `2-plan/decisions.md`. Architectural choices go there, not in commit messages.
330
301
 
331
- **Checkpoints every 3 tasks.** The framework auto-validates architecture compliance, package versions, and security after every third completed task.
302
+ **Validators run after every task.** `morph-spec verify` runs the build + test + validator chain relevant to your stack; `morph-eval` scores the result — a score below 9 triggers an autonomous correction loop rather than a pause.
332
303
 
333
304
  ---
334
305
 
@@ -382,7 +353,7 @@ Ensure `.claude/settings.local.json` is not gitignored in your project. The file
382
353
 
383
354
  ## Standards
384
355
 
385
- The framework ships 82 registered standards across 11 categories, stored in `.morph/framework/standards/STANDARDS.json`. Standards are enforced via path-scoped rules installed to `.claude/rules/` during `morph-spec init`.
356
+ The framework ships 60 registered standards across 7 categories (`ai-agents`, `architecture`, `backend`, `data`, `frontend`, `infrastructure`, `integration`), stored in `.morph/framework/standards/STANDARDS.json`. Standards are looked up on demand (by keyword/alias) rather than preloaded wholesale into context, and enforced via stack-aware, path-scoped rules installed to `.claude/rules/` during `morph-spec init`.
386
357
 
387
358
  ---
388
359
 
@@ -394,4 +365,4 @@ Code generated by morph-spec (contracts, templates, implementation output) belon
394
365
 
395
366
  ---
396
367
 
397
- *morph-spec v8.2.1 by [Polymorphism Tech](https://polymorphism.tech)*
368
+ *morph-spec v8.3.0 by [Polymorphism Tech](https://polymorphism.tech)*
package/bin/morph-spec.js CHANGED
@@ -56,6 +56,9 @@ import { contextRefreshCommand } from '../src/commands/context/context-refresh.j
56
56
  // === Dashboard ===
57
57
  import { dashboardCommand } from '../src/commands/dashboard/dashboard.js';
58
58
 
59
+ // === Observability ===
60
+ import { telemetryCommand } from '../src/commands/observability/telemetry.js';
61
+
59
62
  const __dirname = dirname(fileURLToPath(import.meta.url));
60
63
  const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
61
64
 
@@ -344,4 +347,13 @@ program
344
347
  .option('--no-open', 'Don\'t auto-open browser')
345
348
  .action(dashboardCommand);
346
349
 
350
+ // ─── Observability ────────────────────────────────────────────────────────
351
+ program
352
+ .command('telemetry')
353
+ .description('Summarize the harness execution path from .morph/logs/events.jsonl (skills, personas, standards read, tool mix, prompts)')
354
+ .option('--json', 'Output the aggregate as JSON')
355
+ .option('--feature <name>', 'Narrow the summary to a single feature')
356
+ .option('--limit <n>', 'How many recent prompts to show (default 10)', (v) => parseInt(v, 10))
357
+ .action((options) => telemetryCommand(options));
358
+
347
359
  program.parse();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morph-spec",
3
- "version": "8.2.1",
3
+ "version": "8.3.0",
4
4
  "displayName": "MORPH-SPEC Framework",
5
5
  "description": "Spec-driven development with 38 agents and 8-phase workflow for .NET/Blazor/Next.js/Azure",
6
6
  "publisher": "polymorphism-tech",
@@ -5,10 +5,12 @@
5
5
  ```bash
6
6
  npm install -g @polymorphism-tech/morph-spec@latest --prefer-online # install/upgrade globally
7
7
  morph-spec init # initialize project
8
- morph-spec init --wizard # interactive wizard
9
- morph-spec init --force # overwrite existing
10
- morph-spec update # sync framework files
11
- morph-spec doctor # health check
8
+ morph-spec init --force # overwrite existing install
9
+ morph-spec init --skip-mcp # skip interactive MCP setup
10
+ morph-spec setup-infra # headless install, no prompts (used by init internally)
11
+ morph-spec setup-infra --reinstall # re-install only stack-aware assets (rules/skills/agents)
12
+ morph-spec update # sync framework templates/standards to the installed version
13
+ morph-spec doctor # health check (agents/rules drift, hook config, etc.)
12
14
  morph-spec --version
13
15
  ```
14
16
 
@@ -21,162 +23,113 @@ morph-spec --version
21
23
  ## Phase workflow
22
24
 
23
25
  ```
24
- proposal → [uiux] → design → plan → tasks → implement → [sync]
26
+ proposal → [uiux] → plan → implement → review
25
27
  ```
26
28
 
27
- Phases in brackets are optional.
29
+ `uiux` is optional. Which of the 5 phases actually run for a given feature is also shaped by its **work type** (see below) — a `chore` skips straight to implement, a `hotfix` runs a different pipeline entirely.
28
30
 
29
- | Phase | Directory | Output files | Gate |
30
- |-------|-----------|--------------|------|
31
- | proposal | `0-proposal/` | `proposal.md` | ✅ Approval |
32
- | uiux *(optional)* | `1-design/` | `design-system.md`, `mockups.md`, `components.md`, `flows.md` | ✅ Approval |
33
- | design | `2-design/` | `spec.md`, `contracts.cs`, `decisions.md` | ✅ Approval |
34
- | plan | `3-plan/` | `plan.md` | ✅ Approval |
35
- | tasks | `4-tasks/` | `tasks.md` | ✅ Approval |
36
- | implement | `3-implement/` | code + `recap.md` | — |
37
- | sync *(optional)* | — | standards updated | — |
31
+ | Phase | Folder | Gate |
32
+ |-------|--------|------|
33
+ | proposal | `0-proposal/` | ✅ Gate 1 |
34
+ | uiux *(optional)* | `1-design/` | ✅ |
35
+ | plan | `2-plan/` | ✅ Gate 2 |
36
+ | implement | `3-implement/` | — (auto-advance between tasks) |
37
+ | review | `4-review/` | ✅ Gate 3 |
38
38
 
39
39
  ---
40
40
 
41
41
  ## Slash commands (Claude Code)
42
42
 
43
- | Command | Description |
44
- |---------|-------------|
45
- | `/morph-proposal {feature}` | Full spec pipeline — phases 0–4 with approval gates |
46
- | `/morph-apply {feature}` | Implement approved feature — phase 5 |
47
- | `/morph-hotfix {feature}` | Surgical hotfix ADW — scout → fix → human Gate 3 → ship |
48
- | `/morph-status` | Project-wide feature status dashboard |
49
- | `/morph-preflight` | Pre-implementation validation (7 checks) |
43
+ | Command | Purpose |
44
+ |---------|---------|
45
+ | `/morph-proposal {feature}` | Business understanding + plan (Gates 1 and 2). Step 0 routes by work type (`feature`/`bug`/`chore`/`hotfix`) |
46
+ | `/morph-hotfix {feature}` | Surgical hotfix ADW (scout → fix → human gate → ship) |
47
+ | `/morph-apply {feature}` | Autonomous execution + review (Gate 3) |
48
+ | `/morph-status [feature]` | Status of the active (or specified) feature |
49
+ | `/morph-archive {feature}` | Archive a completed feature (after Gate 3) |
50
+ | `/morph-preflight` | Pre-deploy validation (specs, contracts, tests, infra) |
51
+ | `/morph-troubleshoot [error]` | Root-cause diagnosis for .NET/Next.js errors |
50
52
 
51
53
  ---
52
54
 
53
- ## CLI — project management
55
+ ## CLI — approvals & phase advance
54
56
 
55
57
  ```bash
56
- morph-spec init [--force] [--skip-mcp]
57
- morph-spec update [--templates] [--standards]
58
- morph-spec doctor
58
+ morph-spec approve {feature} {gate} [--mode auto] [--approver name] [--notes text]
59
+ morph-spec advance {feature} [--design] # approve current gate + scaffold next phase folder in one step
60
+ morph-spec approval-status {feature} [--json]
61
+ morph-spec unapprove {feature} {gate} [--reason text] # recovery only
62
+ morph-spec archive {feature} [--force] [--no-git]
59
63
  ```
60
64
 
61
65
  ---
62
66
 
63
- ## CLI — feature workflow
64
-
65
- ```bash
66
- morph-spec state list # all features
67
- morph-spec state get {feature} [--json] # feature detail
68
- morph-spec state set {feature} {key} {value} # update property
69
- morph-spec phase advance {feature} # advance to next phase
70
- morph-spec status {feature} [--json] [--verbose]
71
- morph-spec task done {feature} {task-id} # mark task complete
72
- morph-spec task start {feature} {task-id} # start a task (dispatch gate)
73
- ```
74
-
75
- ---
76
-
77
- ## CLI — validation
78
-
79
- ```bash
80
- morph-spec validate # all validators
81
- morph-spec validate architecture
82
- morph-spec validate packages
83
- morph-spec validate contrast [--wcag-aaa]
84
- morph-spec validate-feature {feature} [--phase {phase}] [--json]
85
- morph-spec verify {feature} [task] [--json] # deterministic build+tests+validators chain, before the LLM judge
86
- ```
87
-
88
- ---
89
-
90
- ## CLI — work-type routing
67
+ ## CLI — feature birth & work-type routing
91
68
 
92
69
  Every feature is born with a **work type** that dimensions its pipeline: `feature` (full proposal → [uiux] → plan → implement → review), `bug` (lean), `chore` (fast-track straight to implement), `hotfix` (scout → surgical fix → human Gate 3 always, even under `trust: auto`).
93
70
 
94
71
  ```bash
95
72
  morph-spec create {feature} --type feature|bug|chore|hotfix
96
- morph-spec create {feature} --request "<free text>" # deterministic detector classifies the type
97
- morph-spec retype {feature} {newType} # change type mid-flight (blocked after Gate 3)
73
+ morph-spec create {feature} --request "<free text>" # deterministic detector classifies the type
74
+ morph-spec retype {feature} {newType} # change type mid-flight (blocked after Gate 3)
98
75
  ```
99
76
 
100
77
  ---
101
78
 
102
- ## CLI — worktrees (parallel development / fleet)
103
-
104
- One feature = one git worktree = one Claude Code instance. Independent features run side by side without stepping on each other's state; a SessionStart hook injects each worktree's feature identity, allocated ports and handoff pointer into context. Each worktree gets a deterministic port block (`.morph/worktree.env`) and a regenerable handoff document.
79
+ ## CLI — state (server-side, timestamped)
105
80
 
106
81
  ```bash
107
- morph-spec create {feature} --worktree # birth the feature already isolated in its own worktree
108
- morph-spec worktree setup {feature} # create .worktrees/{feature}/ on branch morph/{feature}
109
- morph-spec worktree link [--all] # relink shared infra (node_modules, .claude, .morph/framework)
110
- morph-spec worktree finish {feature} # merge --no-ff back to the primary root, clean up + release ports (requires Gate 3)
111
- morph-spec worktree list [--json] # active feature worktrees with phase/gate status
112
- morph-spec handoff {feature} [--json] # regenerate the compressed session-handoff doc (pointers, not copies)
113
- morph-spec fleet [--json] # fleet view: every active feature (root + worktrees) with phase/gates/ports/handoff/activity
82
+ morph-spec score {feature} {task} {score} [--dims "9.5,9,9,9"] # writes taskScores
83
+ morph-spec gate-decision {feature} {gate} --pause <bool> [--reason] [--signals json] # writes gateDecisions
114
84
  ```
115
85
 
116
- ---
117
-
118
- ## CLI — DAG
119
-
120
- ```bash
121
- morph-spec dag {feature} [--json] # sequential vs parallel dispatch decision (effort-weighted)
122
- morph-spec dag {feature} --mermaid # emit the tasks.json DAG as a Mermaid flowchart
123
- ```
86
+ Never hand-edit `taskScores`/`gateDecisions`/`approvalGates` in `feature.json` — always go through these commands (they collide with the `state-sync` hook otherwise).
124
87
 
125
88
  ---
126
89
 
127
- ## CLI — utilities
90
+ ## CLI — validation
128
91
 
129
92
  ```bash
130
- morph-spec generate recap {feature} # auto-generate recap.md
131
- morph-spec template render {id} {output} {vars-json}
132
- morph-spec trust status [feature]
133
- morph-spec trust set {feature} {level} [reason] # level: manual|high|auto
134
- morph-spec mcp setup [name] [--list] [--auto]
93
+ morph-spec validate [architecture|packages|contrast] [--wcag-aaa]
94
+ morph-spec validate-feature {feature} [--phase {phase}] [--json] # alias: vf
95
+ morph-spec verify {feature} [task] [--json] [--skip-tests] [--skip-build] # deterministic build+test+validator chain, before the LLM judge
135
96
  ```
136
97
 
137
98
  ---
138
99
 
139
- ## State — mark-output
100
+ ## CLI — DAG
140
101
 
141
102
  ```bash
142
- morph-spec state mark-output {feature} proposal
143
- morph-spec state mark-output {feature} spec
144
- morph-spec state mark-output {feature} contracts
145
- morph-spec state mark-output {feature} decisions
146
- morph-spec state mark-output {feature} tasks
147
- morph-spec state mark-output {feature} recap
148
-
149
- # UI outputs (camelCase or kebab-case both work)
150
- morph-spec state mark-output {feature} uiDesignSystem
151
- morph-spec state mark-output {feature} uiMockups
152
- morph-spec state mark-output {feature} uiComponents
153
- morph-spec state mark-output {feature} uiFlows
103
+ morph-spec dag {feature} [--json] # sequential vs parallel dispatch decision (effort-weighted)
104
+ morph-spec dag {feature} --mermaid # emit the tasks.json DAG as a Mermaid flowchart
154
105
  ```
155
106
 
156
107
  ---
157
108
 
158
- ## State — agents
159
-
160
- ```bash
161
- morph-spec state add-agent {feature} {agent-id}
162
- morph-spec state remove-agent {feature} {agent-id}
163
- ```
164
-
165
- ---
109
+ ## CLI — worktrees (parallel development / fleet)
166
110
 
167
- ## Checkpoints
111
+ One feature = one git worktree = one Claude Code instance. Each worktree gets its own deterministic port block (`.morph/worktree.env`) and a regenerable handoff document.
168
112
 
169
113
  ```bash
170
- morph-spec checkpoint-save {feature}
114
+ morph-spec create {feature} --worktree # birth the feature already isolated in its own worktree
115
+ morph-spec worktree setup {feature} # create .worktrees/{feature}/ on branch morph/{feature}
116
+ morph-spec worktree link [--all] # relink shared infra (node_modules[, .claude, .morph/framework])
117
+ morph-spec worktree finish {feature} # merge --no-ff back to the primary root, clean up + release ports (requires Gate 3)
118
+ morph-spec worktree list [--json] # active feature worktrees with phase/gate status
119
+ morph-spec handoff {feature} [--json] # regenerate the compressed session-handoff doc (pointers, not copies)
120
+ morph-spec fleet [--json] # every active feature (root + worktrees) with phase/gates/ports/handoff/activity
171
121
  ```
172
122
 
173
123
  ---
174
124
 
175
- ## Approvals
125
+ ## CLI — scaffolding & misc
176
126
 
177
127
  ```bash
178
- morph-spec approve {feature} {gate} # approve a gate
179
- morph-spec approval-status {feature} # show gate status
128
+ morph-spec scaffold dotnet {feature} {slice-name} [--dry-run] # generate a VSA feature slice
129
+ morph-spec scaffold nextjs {feature} [--dry-run] # generate a feature page + components
130
+ morph-spec context refresh # rescan project, regenerate .morph/context/README.md
131
+ morph-spec mcp setup [name] [--list] [--auto]
132
+ morph-spec dashboard [--port 3200] # open the inspector dashboard
180
133
  ```
181
134
 
182
135
  ---
@@ -185,47 +138,35 @@ morph-spec approval-status {feature} # show gate status
185
138
 
186
139
  ```
187
140
  .morph/
188
- ├── config/
189
- │ └── config.json # project config (editable)
141
+ ├── config/config.json # project config (editable)
190
142
  ├── framework/ # READ-ONLY
191
- │ ├── agents.json # 22 agents, 4 tiers
192
- │ ├── standards/ # 82 standards across 11 categories
193
- │ └── templates/ # code and IaC templates
194
- ├── context/ # project context (editable)
195
- │ ├── README.md
196
- │ └── standards.md
197
- ├── features/
198
- │ └── {feature}/
199
- │ ├── 0-proposal/proposal.md
200
- │ ├── 1-design/design-system.md, mockups.md, components.md, flows.md
201
- │ ├── 2-design/spec.md, contracts.cs, decisions.md
202
- │ ├── 3-tasks/tasks.md
203
- │ └── 4-implement/recap.md
204
- ├── checkpoints/
205
- ├── logs/
206
- └── state.json # READ-ONLY — CLI managed
143
+ │ ├── agents.json # 8 domain personas
144
+ │ ├── standards/ # standards registry
145
+ │ └── templates/ # code, IaC, and context templates
146
+ ├── context/ # project context (editable)
147
+ ├── features/{feature}/
148
+ │ ├── feature.json # authoritative, committed
149
+ │ ├── handoff.md
150
+ │ └── 0-proposal/ 1-design/ 2-plan/ 3-implement/ 4-review/
151
+ └── state.json # gitignored, derived index — never hand-edited
207
152
 
208
153
  .claude/
209
- ├── commands/ # slash commands
154
+ ├── commands/ # slash commands
210
155
  ├── skills/ # framework skills (SKILL.md per dir)
211
- ├── agents/ # native subagents (22)
212
- │ ├── morph-{id}.md # tier 1-2 agents
213
- │ └── morph-domain-{name}.md # tier 3 domain agents
214
- ├── rules/ # path-scoped rules (6 files)
215
- └── settings.local.json # hooks (10)
156
+ ├── agents/morph-{id}.md # generated subagents (one per persona, no tiers)
157
+ └── settings.local.json # hooks + permissions.deny
216
158
  ```
217
159
 
218
160
  ---
219
161
 
220
162
  ## Protected files
221
163
 
222
- These files are never edited directly. Use CLI commands or `morph-spec update` instead:
164
+ Never edited directly — go through CLI commands or `morph-spec update` instead:
223
165
 
224
166
  | Path | Protected by |
225
167
  |------|-------------|
226
- | `.morph/state.json` | `permissions.deny` |
227
- | `.morph/framework/**` | `permissions.deny` |
228
- | Approved spec/contracts | `protect-spec-files.js` hook |
168
+ | `.morph/state.json`, `.morph/framework/**` | `permissions.deny` |
169
+ | `tasks.json` plan contract (`title`/`description`/`dependencies`/`effort`/`doneCriteria`/`group`) after Gate 2 | `protect-spec-files` hook (semantic diff) |
229
170
 
230
171
  ---
231
172
 
@@ -239,4 +180,4 @@ These files are never edited directly. Use CLI commands or `morph-spec update` i
239
180
 
240
181
  ---
241
182
 
242
- *morph-spec v8.2.1 by Polymorphism Tech*
183
+ *morph-spec v8.3.0 by Polymorphism Tech*