@polymorphism-tech/morph-spec 8.2.1 → 8.4.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.
- package/README.md +73 -102
- package/bin/morph-spec.js +36 -1
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +77 -134
- package/docs/QUICKSTART.md +47 -57
- package/framework/CLAUDE.md +6 -3
- package/framework/MORPH.md +2 -2
- package/framework/agents.json +3 -1
- package/framework/commands/morph-hotfix.md +1 -1
- package/framework/hooks/README.md +3 -0
- package/framework/hooks/claude-code/core/state-sync.js +41 -9
- package/framework/hooks/claude-code/core/telemetry-log.js +102 -0
- package/framework/hooks/shared/state-writer.js +14 -3
- package/framework/hooks/shared/telemetry-logger.js +75 -0
- package/framework/rules/ai-agents-standards.md +1 -0
- package/framework/schemas/feature.schema.json +15 -7
- package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
- package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
- package/framework/skills/core/morph-apply/SKILL.md +1 -1
- package/framework/skills/core/morph-brainstorming/SKILL.md +1 -1
- package/framework/skills/core/morph-eval/SKILL.md +1 -1
- package/framework/skills/core/morph-hotfix/SKILL.md +3 -3
- package/framework/skills/core/morph-implement/SKILL.md +1 -1
- package/framework/skills/core/morph-plan/SKILL.md +1 -1
- package/framework/skills/core/morph-proposal/SKILL.md +4 -4
- package/framework/skills/core/morph-review/SKILL.md +1 -1
- package/framework/skills/core/morph-stack-scan/SKILL.md +1 -1
- package/framework/skills/core/morph-standards/SKILL.md +1 -1
- package/framework/standards/STANDARDS.json +43 -1
- package/framework/standards/ai-agents/observability-patterns.md +156 -0
- package/framework/standards/ai-agents/production.md +3 -47
- package/framework/templates/REGISTRY.json +0 -93
- package/package.json +1 -1
- package/src/commands/observability/telemetry.js +75 -0
- package/src/commands/project/doctor.js +28 -0
- package/src/commands/state/advance.js +17 -0
- package/src/commands/state/approve.js +13 -0
- package/src/commands/state/create.js +21 -1
- package/src/commands/state/delete.js +143 -0
- package/src/commands/state/list.js +110 -0
- package/src/core/state/feature-identity.js +36 -0
- package/src/core/state/gate-order.js +51 -0
- package/src/core/state/lifecycle-audit.js +79 -0
- package/src/core/state/state-manager.js +47 -140
- package/src/dashboard/app/pages/LiveState.jsx +0 -43
- package/src/lib/detectors/design-system-detector.js +0 -43
- package/src/lib/generators/index.js +0 -1
- package/src/lib/telemetry/telemetry-reader.js +103 -0
- package/src/lib/validators/validation-runner.js +9 -73
- package/src/utils/hooks-installer.js +27 -3
- package/framework/templates/context/CONTEXT-FEATURE.md +0 -269
- package/framework/templates/context/CONTEXT.md +0 -181
- package/src/lib/agents/metrics-aggregator.js +0 -56
- package/src/lib/agents/metrics-calculator.js +0 -125
- package/src/lib/generators/metadata-extractor.js +0 -385
package/docs/CHEATSHEET.md
CHANGED
|
@@ -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 --
|
|
9
|
-
morph-spec init --
|
|
10
|
-
morph-spec
|
|
11
|
-
morph-spec
|
|
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,96 +23,78 @@ morph-spec --version
|
|
|
21
23
|
## Phase workflow
|
|
22
24
|
|
|
23
25
|
```
|
|
24
|
-
proposal → [uiux] →
|
|
26
|
+
proposal → [uiux] → plan → implement → review
|
|
25
27
|
```
|
|
26
28
|
|
|
27
|
-
|
|
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 |
|
|
30
|
-
|
|
31
|
-
| proposal | `0-proposal/` |
|
|
32
|
-
| uiux *(optional)* | `1-design/` |
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
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 |
|
|
44
|
-
|
|
45
|
-
| `/morph-proposal {feature}` |
|
|
46
|
-
| `/morph-
|
|
47
|
-
| `/morph-
|
|
48
|
-
| `/morph-status` |
|
|
49
|
-
| `/morph-
|
|
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 —
|
|
55
|
+
## CLI — approvals & phase advance
|
|
54
56
|
|
|
55
57
|
```bash
|
|
56
|
-
morph-spec
|
|
57
|
-
morph-spec
|
|
58
|
-
morph-spec
|
|
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
|
|
67
|
+
## CLI — feature birth & work-type routing
|
|
64
68
|
|
|
65
|
-
|
|
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
|
-
---
|
|
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`).
|
|
76
70
|
|
|
77
|
-
|
|
71
|
+
Every feature is also born with an **identity**: `--description` is required (`create` refuses a nameless scaffold without it), `name` defaults to the slug.
|
|
78
72
|
|
|
79
73
|
```bash
|
|
80
|
-
morph-spec
|
|
81
|
-
morph-spec
|
|
82
|
-
morph-spec
|
|
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
|
|
74
|
+
morph-spec create {feature} --type feature|bug|chore|hotfix --description "<what/why>"
|
|
75
|
+
morph-spec create {feature} --request "<free text>" # detector classifies the type AND seeds the description
|
|
76
|
+
morph-spec retype {feature} {newType} # change type mid-flight (blocked after Gate 3)
|
|
86
77
|
```
|
|
87
78
|
|
|
88
79
|
---
|
|
89
80
|
|
|
90
|
-
## CLI —
|
|
91
|
-
|
|
92
|
-
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`).
|
|
81
|
+
## CLI — state (server-side, timestamped)
|
|
93
82
|
|
|
94
83
|
```bash
|
|
95
|
-
morph-spec
|
|
96
|
-
morph-spec
|
|
97
|
-
morph-spec retype {feature} {newType} # change type mid-flight (blocked after Gate 3)
|
|
84
|
+
morph-spec score {feature} {task} {score} [--dims "9.5,9,9,9"] # writes taskScores
|
|
85
|
+
morph-spec gate-decision {feature} {gate} --pause <bool> [--reason] [--signals json] # writes gateDecisions
|
|
98
86
|
```
|
|
99
87
|
|
|
100
|
-
|
|
88
|
+
Never hand-edit `taskScores`/`gateDecisions`/`approvalGates` in `feature.json` — always go through these commands (they collide with the `state-sync` hook otherwise).
|
|
101
89
|
|
|
102
|
-
|
|
90
|
+
---
|
|
103
91
|
|
|
104
|
-
|
|
92
|
+
## CLI — validation
|
|
105
93
|
|
|
106
94
|
```bash
|
|
107
|
-
morph-spec
|
|
108
|
-
morph-spec
|
|
109
|
-
morph-spec
|
|
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
|
|
95
|
+
morph-spec validate [architecture|packages|contrast] [--wcag-aaa]
|
|
96
|
+
morph-spec validate-feature {feature} [--phase {phase}] [--json] # alias: vf
|
|
97
|
+
morph-spec verify {feature} [task] [--json] [--skip-tests] [--skip-build] # deterministic build+test+validator chain, before the LLM judge
|
|
114
98
|
```
|
|
115
99
|
|
|
116
100
|
---
|
|
@@ -124,59 +108,30 @@ morph-spec dag {feature} --mermaid # emit the tasks.json DAG as a Mermai
|
|
|
124
108
|
|
|
125
109
|
---
|
|
126
110
|
|
|
127
|
-
## CLI —
|
|
128
|
-
|
|
129
|
-
```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]
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## State — mark-output
|
|
140
|
-
|
|
141
|
-
```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
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
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
|
-
---
|
|
111
|
+
## CLI — worktrees (parallel development / fleet)
|
|
166
112
|
|
|
167
|
-
|
|
113
|
+
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
114
|
|
|
169
115
|
```bash
|
|
170
|
-
morph-spec
|
|
116
|
+
morph-spec create {feature} --description "<what/why>" --worktree # birth the feature already isolated in its own worktree
|
|
117
|
+
morph-spec worktree setup {feature} # create .worktrees/{feature}/ on branch morph/{feature}
|
|
118
|
+
morph-spec worktree link [--all] # relink shared infra (node_modules[, .claude, .morph/framework])
|
|
119
|
+
morph-spec worktree finish {feature} # merge --no-ff back to the primary root, clean up + release ports (requires Gate 3)
|
|
120
|
+
morph-spec worktree list [--json] # active feature worktrees with phase/gate status
|
|
121
|
+
morph-spec handoff {feature} [--json] # regenerate the compressed session-handoff doc (pointers, not copies)
|
|
122
|
+
morph-spec fleet [--json] # every active feature (root + worktrees) with phase/gates/ports/handoff/activity
|
|
171
123
|
```
|
|
172
124
|
|
|
173
125
|
---
|
|
174
126
|
|
|
175
|
-
##
|
|
127
|
+
## CLI — scaffolding & misc
|
|
176
128
|
|
|
177
129
|
```bash
|
|
178
|
-
morph-spec
|
|
179
|
-
morph-spec
|
|
130
|
+
morph-spec scaffold dotnet {feature} {slice-name} [--dry-run] # generate a VSA feature slice
|
|
131
|
+
morph-spec scaffold nextjs {feature} [--dry-run] # generate a feature page + components
|
|
132
|
+
morph-spec context refresh # rescan project, regenerate .morph/context/README.md
|
|
133
|
+
morph-spec mcp setup [name] [--list] [--auto]
|
|
134
|
+
morph-spec dashboard [--port 3200] # open the inspector dashboard
|
|
180
135
|
```
|
|
181
136
|
|
|
182
137
|
---
|
|
@@ -185,47 +140,35 @@ morph-spec approval-status {feature} # show gate status
|
|
|
185
140
|
|
|
186
141
|
```
|
|
187
142
|
.morph/
|
|
188
|
-
├── config/
|
|
189
|
-
│ └── config.json # project config (editable)
|
|
143
|
+
├── config/config.json # project config (editable)
|
|
190
144
|
├── framework/ # READ-ONLY
|
|
191
|
-
│ ├── agents.json
|
|
192
|
-
│ ├── standards/
|
|
193
|
-
│ └── templates/
|
|
194
|
-
├── context/
|
|
195
|
-
|
|
196
|
-
│
|
|
197
|
-
├──
|
|
198
|
-
│ └──
|
|
199
|
-
|
|
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
|
|
145
|
+
│ ├── agents.json # 8 domain personas
|
|
146
|
+
│ ├── standards/ # standards registry
|
|
147
|
+
│ └── templates/ # code, IaC, and context templates
|
|
148
|
+
├── context/ # project context (editable)
|
|
149
|
+
├── features/{feature}/
|
|
150
|
+
│ ├── feature.json # authoritative, committed
|
|
151
|
+
│ ├── handoff.md
|
|
152
|
+
│ └── 0-proposal/ 1-design/ 2-plan/ 3-implement/ 4-review/
|
|
153
|
+
└── state.json # gitignored, derived index — never hand-edited
|
|
207
154
|
|
|
208
155
|
.claude/
|
|
209
|
-
├── commands/
|
|
156
|
+
├── commands/ # slash commands
|
|
210
157
|
├── skills/ # framework skills (SKILL.md per dir)
|
|
211
|
-
├── agents/
|
|
212
|
-
|
|
213
|
-
│ └── morph-domain-{name}.md # tier 3 domain agents
|
|
214
|
-
├── rules/ # path-scoped rules (6 files)
|
|
215
|
-
└── settings.local.json # hooks (10)
|
|
158
|
+
├── agents/morph-{id}.md # generated subagents (one per persona, no tiers)
|
|
159
|
+
└── settings.local.json # hooks + permissions.deny
|
|
216
160
|
```
|
|
217
161
|
|
|
218
162
|
---
|
|
219
163
|
|
|
220
164
|
## Protected files
|
|
221
165
|
|
|
222
|
-
|
|
166
|
+
Never edited directly — go through CLI commands or `morph-spec update` instead:
|
|
223
167
|
|
|
224
168
|
| Path | Protected by |
|
|
225
169
|
|------|-------------|
|
|
226
|
-
| `.morph/state.json
|
|
227
|
-
|
|
|
228
|
-
| Approved spec/contracts | `protect-spec-files.js` hook |
|
|
170
|
+
| `.morph/state.json`, `.morph/framework/**` | `permissions.deny` |
|
|
171
|
+
| `tasks.json` plan contract (`title`/`description`/`dependencies`/`effort`/`doneCriteria`/`group`) after Gate 2 | `protect-spec-files` hook (semantic diff) |
|
|
229
172
|
|
|
230
173
|
---
|
|
231
174
|
|
|
@@ -239,4 +182,4 @@ These files are never edited directly. Use CLI commands or `morph-spec update` i
|
|
|
239
182
|
|
|
240
183
|
---
|
|
241
184
|
|
|
242
|
-
*morph-spec v8.
|
|
185
|
+
*morph-spec v8.4.0 by Polymorphism Tech*
|
package/docs/QUICKSTART.md
CHANGED
|
@@ -19,11 +19,11 @@ morph-spec init
|
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
`init` does the following:
|
|
22
|
-
- Auto-detects your stack (
|
|
22
|
+
- Auto-detects your stack (.NET, Next.js, Node.js, monorepo)
|
|
23
23
|
- Creates `.morph/` with framework files, standards, and templates
|
|
24
24
|
- Creates `.morph/context/` with inferred project context
|
|
25
25
|
- Installs `.claude/skills/`, `.claude/agents/`, `.claude/rules/`
|
|
26
|
-
- Writes `.claude/settings.local.json` with
|
|
26
|
+
- Writes `.claude/settings.local.json` with the fail-open Claude Code hooks (see `docs/ARCHITECTURE.md`)
|
|
27
27
|
- Copies `CLAUDE.md` with runtime instructions
|
|
28
28
|
|
|
29
29
|
Verify the installation:
|
|
@@ -44,42 +44,31 @@ Open your project in Claude Code and run:
|
|
|
44
44
|
|
|
45
45
|
Replace `my-feature` with a short kebab-case name for your feature (e.g., `user-notifications`, `payment-flow`).
|
|
46
46
|
|
|
47
|
-
The proposal pipeline runs phases
|
|
47
|
+
The proposal pipeline runs the `proposal` and `plan` phases (plus the optional `uiux` phase), with an approval gate at each:
|
|
48
48
|
|
|
49
|
-
###
|
|
49
|
+
### Proposal (Gate 1)
|
|
50
50
|
|
|
51
|
-
Claude analyzes your request, detects
|
|
51
|
+
Claude analyzes your request, detects the relevant stack and standards, and produces `0-proposal/proposal.md`. You review it and approve (or request changes).
|
|
52
52
|
|
|
53
|
-
###
|
|
53
|
+
### UI/UX — optional (Gate)
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
Only runs for UI-heavy features. Claude generates, under `1-design/`:
|
|
56
|
+
- `design-system.md` — colors, typography, spacing
|
|
57
|
+
- `mockups.md` — ASCII wireframes
|
|
58
|
+
- `components.md` — component specs
|
|
59
|
+
- `flows.md` — user flows and edge cases
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
You approve the UI design before moving on.
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
- `1-design/design-system.md` — colors, typography, spacing
|
|
61
|
-
- `1-design/mockups.md` — ASCII wireframes
|
|
62
|
-
- `1-design/components.md` — component specs
|
|
63
|
-
- `1-design/flows.md` — user flows and edge cases
|
|
63
|
+
### Plan (Gate 2)
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Claude produces, under `2-plan/`:
|
|
66
|
+
- `spec.md` — full requirements, use cases, validations
|
|
67
|
+
- `mandate.md` — the implementation contract (stack defaults, forbidden patterns)
|
|
68
|
+
- `tasks.json` — ordered task breakdown (`T001`, `T002`, …)
|
|
69
|
+
- `decisions.md` — architectural decision records (optional)
|
|
66
70
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
Claude produces the technical specification:
|
|
70
|
-
- `2-design/spec.md` — full requirements, use cases, validations
|
|
71
|
-
- `2-design/contracts.cs` — C# interfaces, DTOs, enums
|
|
72
|
-
- `2-design/decisions.md` — architectural decision records (ADRs)
|
|
73
|
-
|
|
74
|
-
You review and approve the design.
|
|
75
|
-
|
|
76
|
-
### Phase 4 — Clarify
|
|
77
|
-
|
|
78
|
-
Claude identifies 3–7 ambiguities in the spec, asks you to resolve them, then updates the spec. No gate.
|
|
79
|
-
|
|
80
|
-
### Phase 6 — Tasks
|
|
81
|
-
|
|
82
|
-
Claude breaks the spec into atomic tasks (`T001`, `T002`, …) saved to `3-tasks/tasks.md`. You approve the task list.
|
|
71
|
+
Claude identifies ambiguities in the spec and resolves them with you before finalizing. You review and approve the spec + mandate + task list together.
|
|
83
72
|
|
|
84
73
|
At this point, planning is complete:
|
|
85
74
|
|
|
@@ -95,11 +84,11 @@ At this point, planning is complete:
|
|
|
95
84
|
/morph-apply my-feature
|
|
96
85
|
```
|
|
97
86
|
|
|
98
|
-
Claude reads `spec.md`, `
|
|
99
|
-
-
|
|
100
|
-
- Runs
|
|
101
|
-
-
|
|
102
|
-
- Generates `
|
|
87
|
+
Claude reads `spec.md`, `mandate.md`, and `tasks.json`, then implements task by task with auto-advance (no pause between tasks unless there's a blocking ambiguity):
|
|
88
|
+
- Tracks task progress with the native `TaskCreate`/`TaskUpdate` tools, persisted to `tasks.json`
|
|
89
|
+
- Runs the validators relevant to your stack after each task (e.g. `architecture`/`packages`/`contract-compliance` for .NET, `nextjs-component`/`css`/`design-system` for Next.js) via `morph-spec verify`
|
|
90
|
+
- Applies `morph-eval` after each task — a score below 9 triggers an autonomous correction loop, not a pause
|
|
91
|
+
- Generates `3-implement/recap.md` on completion, then Gate 3 review (`4-review/`)
|
|
103
92
|
|
|
104
93
|
---
|
|
105
94
|
|
|
@@ -108,21 +97,16 @@ Claude reads `spec.md`, `contracts.cs`, and `tasks.md`, then implements task by
|
|
|
108
97
|
Check feature state:
|
|
109
98
|
|
|
110
99
|
```bash
|
|
111
|
-
morph-spec state get my-feature
|
|
112
100
|
morph-spec status my-feature
|
|
113
101
|
```
|
|
114
102
|
|
|
115
|
-
|
|
103
|
+
Approve the current gate and scaffold the next phase folder in one step:
|
|
116
104
|
|
|
117
105
|
```bash
|
|
118
|
-
morph-spec
|
|
106
|
+
morph-spec advance my-feature
|
|
119
107
|
```
|
|
120
108
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
morph-spec task done my-feature T001
|
|
125
|
-
```
|
|
109
|
+
Task progress is tracked with the native `TaskCreate`/`TaskUpdate` tools and persisted to `tasks.json` — there is no separate CLI command for marking a task done.
|
|
126
110
|
|
|
127
111
|
Run validators at any time:
|
|
128
112
|
|
|
@@ -145,14 +129,20 @@ morph-spec verify my-feature T001 # scoped to one task
|
|
|
145
129
|
|
|
146
130
|
Not every change needs the full pipeline walked above. Every feature is born with a **work type** that dimensions its pipeline:
|
|
147
131
|
|
|
132
|
+
Every feature is also born with an **identity** — a `--description` (the one field a human must supply; `create` refuses a nameless scaffold without it) and a `name` (defaults to the slug):
|
|
133
|
+
|
|
148
134
|
```bash
|
|
149
|
-
|
|
150
|
-
morph-spec create my-
|
|
151
|
-
|
|
152
|
-
morph-spec create my-
|
|
135
|
+
# full: proposal → [uiux] → plan → implement → review
|
|
136
|
+
morph-spec create my-feature --type feature --description "what & why"
|
|
137
|
+
# bug: lean proposal/plan
|
|
138
|
+
morph-spec create my-fix --type bug --description "what broke"
|
|
139
|
+
# chore: skips straight to implement (Gates 1/2 stamped by policy)
|
|
140
|
+
morph-spec create my-chore --type chore --description "the tidy-up"
|
|
141
|
+
# hotfix: scout → surgical fix → test loop; Gate 3 always pauses for a human
|
|
142
|
+
morph-spec create my-hotfix --type hotfix --description "the incident"
|
|
153
143
|
```
|
|
154
144
|
|
|
155
|
-
You can also let the deterministic detector classify a free-text request instead of picking a type by hand:
|
|
145
|
+
You can also let the deterministic detector classify a free-text request instead of picking a type by hand (`--request` doubles as the description):
|
|
156
146
|
|
|
157
147
|
```bash
|
|
158
148
|
morph-spec create my-feature --request "produção caiu, corrigir urgente"
|
|
@@ -173,7 +163,7 @@ Production incidents run through the dedicated `/morph-hotfix my-feature` slash
|
|
|
173
163
|
Independent features can be developed in parallel, each isolated in its own git worktree — one feature, one worktree, one Claude Code instance:
|
|
174
164
|
|
|
175
165
|
```bash
|
|
176
|
-
morph-spec create my-feature --worktree
|
|
166
|
+
morph-spec create my-feature --description "what & why" --worktree # birth the feature already isolated
|
|
177
167
|
# or, for an existing feature:
|
|
178
168
|
morph-spec worktree setup my-feature # creates .worktrees/my-feature/ on branch morph/my-feature
|
|
179
169
|
```
|
|
@@ -195,23 +185,23 @@ morph-spec worktree list
|
|
|
195
185
|
|
|
196
186
|
## Multiple features
|
|
197
187
|
|
|
198
|
-
You can have multiple features in progress simultaneously. Each has its own directory under `.morph/features
|
|
188
|
+
You can have multiple features in progress simultaneously. Each has its own directory under `.morph/features/`, with its own committed `feature.json`:
|
|
199
189
|
|
|
200
190
|
```
|
|
201
191
|
.morph/features/
|
|
202
192
|
├── user-notifications/
|
|
193
|
+
│ ├── feature.json
|
|
203
194
|
│ ├── 0-proposal/
|
|
204
|
-
│
|
|
205
|
-
│ └── 3-tasks/
|
|
195
|
+
│ └── 2-plan/
|
|
206
196
|
└── payment-flow/
|
|
207
|
-
├──
|
|
208
|
-
└──
|
|
197
|
+
├── feature.json
|
|
198
|
+
└── 0-proposal/
|
|
209
199
|
```
|
|
210
200
|
|
|
211
|
-
See
|
|
201
|
+
See every active feature — root and worktrees — with phase, gates, and activity:
|
|
212
202
|
|
|
213
203
|
```bash
|
|
214
|
-
morph-spec
|
|
204
|
+
morph-spec fleet
|
|
215
205
|
```
|
|
216
206
|
|
|
217
207
|
---
|
|
@@ -256,4 +246,4 @@ morph-spec doctor
|
|
|
256
246
|
|
|
257
247
|
---
|
|
258
248
|
|
|
259
|
-
*morph-spec v8.
|
|
249
|
+
*morph-spec v8.4.0 by Polymorphism Tech*
|
package/framework/CLAUDE.md
CHANGED
|
@@ -47,12 +47,15 @@ Se não houver feature ativa, pergunte ao usuário qual feature trabalhar.
|
|
|
47
47
|
- `morph-spec dag <feature>` — análise do DAG de tasks.json com decisão sequencial vs paralelo **ponderada por effort** (raízes S vão inline, nunca ganham agente próprio).
|
|
48
48
|
- `morph-spec score <feature> <task> <score> [--dims a,c,q,t]` — grava `taskScores` no feature.json com timestamp server-side; **nunca edite taskScores à mão**. Em PowerShell, cite o valor de `--dims` entre aspas (`--dims "9.5,9,9,9"`) — sem aspas, a lista pode chegar como tokens separados; o parser aceita ambas as formas, mas citar evita qualquer ambiguidade.
|
|
49
49
|
- `morph-spec gate-decision <feature> <gate> --pause <bool> [--reason <txt>] [--signals <json>]` — grava `gateDecisions` no feature.json com timestamp server-side (shape em `framework/schemas/feature.schema.json`); **nunca edite gateDecisions à mão** — o Edit manual colide com o hook state-sync.
|
|
50
|
-
- `morph-spec create <feature> --type <feature|bug|chore|hotfix> [--request "<txt>"] [--worktree]` — cria a estrutura da feature + `feature.json` canônico explicitamente (nascimento explícito no início da proposal; o hook state-sync continua cobrindo o caminho implícito como fallback). `--type` classifica direto; `--request "<pedido>"` roda o detector determinístico (empate/sem sinal sai com exit 2 e candidatos — a LLM decide e re-roda com `--type`); `--worktree` já nasce a feature no seu worktree próprio.
|
|
50
|
+
- `morph-spec create <feature> --description "<o quê/porquê>" --type <feature|bug|chore|hotfix> [--request "<txt>"] [--name "<nome>"] [--worktree]` — cria a estrutura da feature + `feature.json` canônico explicitamente (nascimento explícito no início da proposal; o hook state-sync continua cobrindo o caminho implícito como fallback). **Identidade no nascimento:** `name` (default = slug) e `description` são carimbados; a `--description` é **obrigatória** numa feature nova (ou `--request`, que a semeia) — sem nenhuma das duas o `create` recusa (fim dos scaffolds anônimos). `--type` classifica direto; `--request "<pedido>"` roda o detector determinístico (empate/sem sinal sai com exit 2 e candidatos — a LLM decide e re-roda com `--type` + `--request`/`--description`); `--worktree` já nasce a feature no seu worktree próprio.
|
|
51
|
+
- `morph-spec list [--all] [--json]` — o quadro de auditoria: uma linha por feature × workType × status × fase × gates G1/G2/G3 × descrição, com `⚠` para inconsistências (sem descrição, ordem de gate). `--all` inclui as arquivadas; `--json` para scripting. É o complemento do `delete` (enxergar o que está morto antes de remover).
|
|
52
|
+
- `morph-spec delete <feature> [--archive] [--force]` — remove uma feature. Hard por padrão (pasta apagada, git-aware, + entrada podada do índice raiz para não ressuscitar); `--archive` move para `.morph/archive` com status `abandoned` em vez de apagar. Recusa se algum gate estiver aprovado, a menos que `--force`. Use para faxina de scaffolds mortos e drafts abandonados (`archive` é para trabalho concluído; `delete` é para trabalho morto).
|
|
51
53
|
- `morph-spec retype <feature> <newType>` — muda o tipo de trabalho mid-flight; desfaz só os gates carimbados por política, preserva aprovações humanas; bloqueado após o Gate 3.
|
|
52
54
|
- `morph-spec verify <feature> [task] [--json]` — cadeia determinística build+testes+validadores (código antes do juiz LLM); escopo de task quando informado, senão a feature inteira.
|
|
53
55
|
- `morph-spec worktree setup|link|finish|list` — gerencia o ciclo do worktree por feature (`setup` cria `.worktrees/{f}/` na branch `morph/{f}`, aloca o bloco de portas e escreve `.morph/worktree.env`; `link` religa infra compartilhada; `finish` faz merge `--no-ff`, limpa e libera o bloco; `list` mostra fase/gate de cada worktree ativo).
|
|
54
56
|
- `morph-spec handoff <feature>` — regenera o documento de retomada (`.morph/features/{f}/handoff.md`): comprimido, derivado, aponta para os artefatos em vez de copiá-los. Gerado automaticamente em `setup`/`create --worktree`/`advance`.
|
|
55
57
|
- `morph-spec fleet` — visão da frota: toda feature ativa (raiz + worktrees) com fase, gates pendentes, tasks, portas, handoff e atividade. Use entre sessões para decidir onde atuar.
|
|
58
|
+
- `morph-spec telemetry [--json] [--feature <f>] [--limit <n>]` — reconstrói o caminho de execução da sessão a partir de `.morph/logs/events.jsonl` (skills invocadas, personas despachadas + prompts, standards/base de conhecimento lidos, mix de tools, prompts do usuário). Capturado silenciosamente pelo hook `telemetry-log` em todo tool call e todo UserPromptSubmit.
|
|
56
59
|
|
|
57
60
|
## Skills core (em `.claude/skills/`)
|
|
58
61
|
|
|
@@ -69,9 +72,9 @@ Se não houver feature ativa, pergunte ao usuário qual feature trabalhar.
|
|
|
69
72
|
|
|
70
73
|
## Roteamento por tipo de trabalho
|
|
71
74
|
|
|
72
|
-
Toda feature nasce com um `workType` (`morph-spec create <f> --type <tipo>` ou classificado de `--request "<pedido>"
|
|
75
|
+
Toda feature nasce com um `workType` (`morph-spec create <f> --description "<o quê/porquê>" --type <tipo>` ou classificado de `--request "<pedido>"`, que também semeia a descrição obrigatória) que dimensiona o pipeline: `feature` roda o fluxo completo (proposal → [uiux] → plan → implement → review); `bug` roda uma versão enxuta (proposal/plan lean); `chore` pula direto para implement (Gates 1/2 carimbados por política no nascimento); `hotfix` roda scout → fix cirúrgico → test loop → ship. O Gate 3 do `hotfix` **pausa sempre para um humano**, mesmo em `trust: auto` — o CLI recusa `morph-spec approve <f> review --mode auto` nesse tipo. Detalhes em `.morph/framework/MORPH.md` §2.1 e §5.
|
|
73
76
|
|
|
74
|
-
Features independentes podem rodar em paralelo, cada uma isolada num git worktree (`morph-spec create <f> --worktree` ou `morph-spec worktree setup <f>`) — uma feature por worktree, uma instância de Claude Code por worktree. Cada worktree tem seu **bloco de portas** próprio (`.morph/worktree.env` — suba dev servers SEMPRE nelas, nunca nas portas padrão) e seu **handoff.md** de retomada. `feature.json` viaja commitado na branch `morph/{f}`; ao fechar, aprove o Gate 3 dentro do worktree e rode `morph-spec worktree finish <f>` seguido de `morph-spec archive <f>` na raiz. Visão agregada: `morph-spec fleet`. Detalhes em `.morph/framework/MORPH.md` §2.2.
|
|
77
|
+
Features independentes podem rodar em paralelo, cada uma isolada num git worktree (`morph-spec create <f> --description "<o quê/porquê>" --worktree` ou `morph-spec worktree setup <f>`) — uma feature por worktree, uma instância de Claude Code por worktree. Cada worktree tem seu **bloco de portas** próprio (`.morph/worktree.env` — suba dev servers SEMPRE nelas, nunca nas portas padrão) e seu **handoff.md** de retomada. `feature.json` viaja commitado na branch `morph/{f}`; ao fechar, aprove o Gate 3 dentro do worktree e rode `morph-spec worktree finish <f>` seguido de `morph-spec archive <f>` na raiz. Visão agregada: `morph-spec fleet`. Detalhes em `.morph/framework/MORPH.md` §2.2.
|
|
75
78
|
|
|
76
79
|
## Personas (em `.claude/agents/`)
|
|
77
80
|
|
package/framework/MORPH.md
CHANGED
|
@@ -97,7 +97,7 @@ Não avance de fase sem o gate correspondente ter sido confirmado.
|
|
|
97
97
|
|
|
98
98
|
### 2.1 Roteamento por tipo de trabalho
|
|
99
99
|
|
|
100
|
-
Nem todo trabalho merece o pipeline completo. Cada feature nasce com um **workType** (`morph-spec create <f> --type <tipo
|
|
100
|
+
Nem todo trabalho merece o pipeline completo. Cada feature nasce com **identidade** (`name` = slug por padrão + `description` obrigatória) e um **workType** (`morph-spec create <f> --description "<o quê/porquê>" --type <tipo>`, ou classificado de `--request "<pedido>"` — que também semeia a descrição), e o tipo dimensiona o pipeline:
|
|
101
101
|
|
|
102
102
|
| Tipo | Pipeline | Gates |
|
|
103
103
|
|------|----------|-------|
|
|
@@ -114,7 +114,7 @@ Nem todo trabalho merece o pipeline completo. Cada feature nasce com um **workTy
|
|
|
114
114
|
|
|
115
115
|
### 2.2 Desenvolvimento paralelo por worktree (frota)
|
|
116
116
|
|
|
117
|
-
Features independentes podem ser desenvolvidas **em paralelo, cada uma no seu git worktree**, com uma instância de Claude Code por worktree. `morph-spec create <f> --worktree` (ou `morph-spec worktree setup <f>`) cria `.worktrees/{f}/` na branch `morph/{f}`. Contrato:
|
|
117
|
+
Features independentes podem ser desenvolvidas **em paralelo, cada uma no seu git worktree**, com uma instância de Claude Code por worktree. `morph-spec create <f> --description "<o quê/porquê>" --worktree` (ou `morph-spec worktree setup <f>`) cria `.worktrees/{f}/` na branch `morph/{f}`. Contrato:
|
|
118
118
|
|
|
119
119
|
- **Uma feature = um worktree = uma instância.** Nunca abra duas instâncias na mesma feature (o setup recusa com exit 3).
|
|
120
120
|
- O estado autoritativo (`feature.json`) viaja **commitado na branch** `morph/{f}`. O `state.json` local do worktree é um índice derivável — materializado por self-heal, nunca sincronizado à mão.
|
package/framework/agents.json
CHANGED
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"ai-agents-prompts-in-db",
|
|
65
65
|
"ai-agents-rag-custom-pgvector",
|
|
66
66
|
"ai-agents-middleware-patterns",
|
|
67
|
+
"ai-agents-observability-patterns",
|
|
67
68
|
"ai-agents-multi-agent-patterns"
|
|
68
69
|
],
|
|
69
70
|
"mcp": ["context7"],
|
|
@@ -125,7 +126,8 @@
|
|
|
125
126
|
"standards": [
|
|
126
127
|
"backend-integrations-hangfire-hangfire-jobs",
|
|
127
128
|
"infrastructure-docker-coolify-deploy",
|
|
128
|
-
"backend-dotnet-scrutor"
|
|
129
|
+
"backend-dotnet-scrutor",
|
|
130
|
+
"ai-agents-observability-patterns"
|
|
129
131
|
],
|
|
130
132
|
"mcp": ["context7"],
|
|
131
133
|
"model": "sonnet",
|
|
@@ -16,7 +16,7 @@ Resolve uma queda ou bug crítico de produção com prioridade máxima em veloci
|
|
|
16
16
|
|
|
17
17
|
## Fluxo
|
|
18
18
|
|
|
19
|
-
1. **Nascimento:** `morph-spec create {feature-name} --type hotfix` — carimba os gates `proposal`/`plan` por política e cria `0-proposal/`, `2-plan/`, `3-implement/` num passo só.
|
|
19
|
+
1. **Nascimento:** `morph-spec create {feature-name} --type hotfix --description "<incidente>"` — carimba `name`+`description` (obrigatória) e os gates `proposal`/`plan` por política e cria `0-proposal/`, `2-plan/`, `3-implement/` num passo só.
|
|
20
20
|
2. **Scout obrigatório:** despacha `subagent_type: "morph-scout"` (fallback `general-purpose` + persona colada) para localizar root cause e blast radius antes de qualquer fix.
|
|
21
21
|
3. **Hotfix brief:** escreve `0-proposal/proposal.md` curto (sintoma/root cause/blast radius/plano do fix) e `2-plan/tasks.json` mínimo (T1 fix, T2 verify/regressão).
|
|
22
22
|
4. **Fix cirúrgico:** implementa a mudança mínima que resolve o sintoma — sem refatoração, sem hardening fora de escopo.
|
|
@@ -51,7 +51,9 @@ framework/hooks/
|
|
|
51
51
|
| **PostToolUse** (Write\|Edit) | trace-autogen.js | State sync | Auto-generates `.morph/traces/YYYY-MM-DD-{feature}-implement.json` from tasks.json + recap.md + taskScores on every tasks.json write — the skills never write traces by hand |
|
|
52
52
|
| **PostToolUse** (Write\|Edit\|AskUserQuestion) | state-sync.js | State sync | Autonomous state updates (feature register, output tracking, gate approval) |
|
|
53
53
|
| **PostToolUse** (Write\|Edit\|AskUserQuestion) | gate-guard.js | Advisory | Warns (never blocks) when a gate action disagrees with the persisted gateDecisions; logs one `coherent`/`divergent` line per check in `.morph/logs/activity.json` (issue #63) |
|
|
54
|
+
| **PostToolUse** (all tools) | telemetry-log.js | Telemetry | Appends every tool call (skill, sub-agent dispatch + prompt, knowledge-base read, bash/edit) to `.morph/logs/events.jsonl`; silent, fail-open — the NLH execution-path capture read back by `morph-spec telemetry` |
|
|
54
55
|
| **PostToolUse** (all tools) | loop-detect.js | Advisory | Warns when the last 8 actions collapse to ≤2 unique signatures |
|
|
56
|
+
| **UserPromptSubmit** | telemetry-log.js | Telemetry | Appends the user's prompt to the same `events.jsonl` stream; silent, fail-open |
|
|
55
57
|
| **Stop** | validate-completion.js | Advisory | Warns about incomplete tasks/missing outputs/recap drift; build check; session snapshot |
|
|
56
58
|
|
|
57
59
|
## Design Principles
|
|
@@ -112,6 +114,7 @@ All Claude Code hooks import from `framework/hooks/shared/`:
|
|
|
112
114
|
| `phase-utils.js` | Phase constants, path extraction, file classification |
|
|
113
115
|
| `hook-response.js` | `block(reason)`, `approve(context)`, `injectContext(text)`, `pass()` |
|
|
114
116
|
| `stdin-reader.js` | `readStdin()` — Promise-based stdin JSON reader |
|
|
117
|
+
| `telemetry-logger.js` | `appendTelemetryEvent()`, `readTelemetryEvents()` — append-only JSONL event stream (`.morph/logs/events.jsonl`) |
|
|
115
118
|
|
|
116
119
|
`injectContext(text)` is how `worktree-context.js` (and any other SessionStart hook) delivers context: it emits `{ "hookSpecificOutput": { "hookEventName": "SessionStart", "additionalContext": text } }` on stdout. Claude Code only honors additional context nested under `hookSpecificOutput` — a bare top-level field is ignored.
|
|
117
120
|
|