@polymorphism-tech/morph-spec 10.0.0 → 10.1.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 (46) hide show
  1. package/CLAUDE.md +2 -0
  2. package/README.md +2 -2
  3. package/claude-plugin.json +1 -1
  4. package/docs/CHEATSHEET.md +28 -36
  5. package/docs/QUICKSTART.md +31 -191
  6. package/framework/CLAUDE.md +2 -2
  7. package/framework/MORPH.md +2 -2
  8. package/framework/commands/morph-preflight.md +3 -3
  9. package/framework/docs/CLI.md +1 -1
  10. package/framework/hooks/shared/next-step.js +2 -2
  11. package/framework/mcp/registry.json +4 -4
  12. package/framework/rules/ai-agents-standards.md +1 -1
  13. package/framework/rules/data-standards.md +1 -1
  14. package/framework/rules/hangfire-standards.md +1 -1
  15. package/framework/rules/neon-auth-standards.md +1 -1
  16. package/framework/rules/neon-standards.md +3 -3
  17. package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
  18. package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
  19. package/framework/skills/core/morph-apply/SKILL.md +4 -3
  20. package/framework/skills/core/morph-plan/SKILL.md +19 -13
  21. package/framework/skills/core/morph-plan/references/critique.md +11 -8
  22. package/framework/skills/core/morph-plan/references/interview.md +18 -6
  23. package/framework/skills/core/morph-uiux/SKILL.md +1 -1
  24. package/framework/standards/STANDARDS.json +20 -24
  25. package/framework/standards/STANDARDS.meta.json +12 -19
  26. package/framework/standards/ai-agents/rag-custom-pgvector.md +1 -0
  27. package/framework/standards/architecture/stack-baseline.md +26 -3
  28. package/framework/standards/backend/database/postgresql/database.md +22 -1
  29. package/framework/standards/backend/dotnet/vsa-handler-patterns.md +33 -1
  30. package/framework/standards/backend/integrations/hangfire/hangfire-jobs.md +2 -1
  31. package/framework/standards/backend/integrations/neon-auth/neon-auth.md +10 -9
  32. package/framework/standards/infrastructure/docker/local-compose-isolation.md +2 -2
  33. package/framework/standards/infrastructure/neon/neon-pgvector.md +62 -20
  34. package/framework/standards/infrastructure/neon/neon-platform.md +61 -0
  35. package/framework/standards/infrastructure/neon/neon-setup.md +14 -13
  36. package/framework/standards/integration/mcp/mcp-tools.md +20 -20
  37. package/framework/templates/docs/plan.md +4 -1
  38. package/framework/templates/infrastructure/docker/docker-compose.template.yml +1 -1
  39. package/package.json +1 -1
  40. package/src/commands/state/auto-approval.js +1 -1
  41. package/src/commands/state/create.js +1 -1
  42. package/src/commands/state/gate-check.js +2 -2
  43. package/src/lib/detectors/index.js +1 -1
  44. package/src/lib/installers/memory-installer.js +1 -1
  45. package/src/lib/plan/checks.js +8 -1
  46. package/framework/standards/infrastructure/neon/neon-pgrag.md +0 -243
package/CLAUDE.md CHANGED
@@ -8,6 +8,8 @@ morph-spec is a spec-driven development harness CLI (`@polymorphism-tech/morph-s
8
8
 
9
9
  This repo is the **framework source code** — not a project that uses morph-spec.
10
10
 
11
+ **Do not run the morph-spec workflow here.** No `init`, `create`, `plan-check`, `gate-check`, `approve`, `advance`, `verify`, `context refresh` or `finish`, and no `/morph-plan` or `/morph-apply` as a process, even if a prompt starts with one: confirm first. Work here is ordinary: a normal branch, `npm test`, `npm run generate:check`, a PR. `framework/skills/` and `framework/CLAUDE.md` are source to edit, not instructions to follow. `/.morph/` is gitignored: this repo keeps no morph-spec state.
12
+
11
13
  ## Build & Test Commands
12
14
 
13
15
  ```bash
package/README.md CHANGED
@@ -3,7 +3,7 @@
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:** 10.0.0
6
+ **Version:** 10.1.1
7
7
  **Requires:** Node.js 22+, Claude Code
8
8
 
9
9
  ---
@@ -380,4 +380,4 @@ Code generated by morph-spec (contracts, templates, implementation output) belon
380
380
 
381
381
  ---
382
382
 
383
- *morph-spec v10.0.0 by [Polymorphism Tech](https://polymorphism.tech)*
383
+ *morph-spec v10.1.1 by [Polymorphism Tech](https://polymorphism.tech)*
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morph-spec",
3
- "version": "10.0.0",
3
+ "version": "10.1.1",
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",
@@ -23,18 +23,17 @@ morph-spec --version
23
23
  ## Phase workflow
24
24
 
25
25
  ```
26
- proposal → [uiux] → plan → implement → review
26
+ plan → [uiux] → implement → review
27
27
  ```
28
28
 
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.
29
+ `uiux` is optional and runs after the plan gate. Which phases actually run for a given feature is also shaped by its **work type** (see below): a `chore` writes a short plan and goes straight to implement, a `hotfix` follows its own path.
30
30
 
31
31
  | Phase | Folder | Gate |
32
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 |
33
+ | plan | `2-plan/` | ✅ `plan` (`plan.md` + `checks.json`) |
34
+ | uiux *(optional)* | `1-design/` | ✅ `uiux` |
35
+ | implement | `3-implement/` | — (one row per `Cn` in `report.md`) |
36
+ | review | `4-review/` | ✅ `review` (Gate 3) |
38
37
 
39
38
  ---
40
39
 
@@ -42,9 +41,9 @@ proposal → [uiux] → plan → implement → review
42
41
 
43
42
  | Command | Purpose |
44
43
  |---------|---------|
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) |
44
+ | `/morph-plan {feature or issue link}` | From a request to the approved plan: routes by work type (`feature`/`bug`/`chore`/`hotfix`), opens with a thesis against the code |
45
+ | `/morph-hotfix {feature}` | Production incident: surgical fix, Gate 3 always human |
46
+ | `/morph-apply {feature}` | Implements the whole plan, runs `verify` and Gate 3, closes with `finish` |
48
47
  | `/morph-status [feature]` | Status of the active (or specified) feature |
49
48
  | `/morph-archive {feature}` | Archive **without integrating** (legacy feature / cleanup) — normal close is `morph-spec finish --pr\|--merge` |
50
49
  | `/morph-preflight` | Pre-deploy validation (specs, contracts, tests, infra) |
@@ -69,14 +68,15 @@ morph-spec archive {feature} [--force] [--no-git] # archive WITHOUT integ
69
68
 
70
69
  ## CLI — feature birth & work-type routing
71
70
 
72
- 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`).
71
+ Every feature is born with a **work type** that dimensions its pipeline: `feature` (full plan → [uiux] → implement → review), `bug` (same flow, lean plan), `chore` (short plan, straight to implement), `hotfix` (surgical fix, human Gate 3 always, even under `trust: auto`).
73
72
 
74
- Every feature is also born with an **identity**: `--description` is required (`create` refuses a nameless scaffold without it), `name` defaults to the slug.
73
+ Every feature is also born with an **identity**: a description is required (`create` refuses a nameless scaffold without it), `name` defaults to the slug. `--request` is kept literally in `feature.json → description`, and the plan critique checks the plan against it.
75
74
 
76
75
  ```bash
76
+ morph-spec create {feature} --request '<free text>' # detector classifies the type AND seeds the description
77
+ morph-spec create {feature} --type <t> --request '<title> <url>' # issue link: the type is picked, the body stays out of the argument
77
78
  morph-spec create {feature} --type feature|bug|chore|hotfix --description "<what/why>"
78
- morph-spec create {feature} --request "<free text>" # detector classifies the type AND seeds the description
79
- morph-spec retype {feature} {newType} # change type mid-flight (blocked after Gate 3)
79
+ morph-spec retype {feature} {newType} # change type mid-flight (blocked after Gate 3)
80
80
  ```
81
81
 
82
82
  ---
@@ -84,7 +84,9 @@ morph-spec retype {feature} {newType} # change type mid-flig
84
84
  ## CLI — state (server-side, timestamped)
85
85
 
86
86
  ```bash
87
- morph-spec gate-decision {feature} {gate} --pause <bool> [--reason] [--signals json] # writes gateDecisions
87
+ morph-spec next {feature} [--json] # the next step, decided from disk
88
+ morph-spec gate-check {feature} {gate} [--json] # decide + record whether the gate pauses
89
+ morph-spec gate-decision {feature} {gate} --pause <bool> [--reason] [--signals json] # writes gateDecisions by hand
88
90
  ```
89
91
 
90
92
  Never hand-edit `gateDecisions`/`approvalGates` in `feature.json` — always go through these commands (they collide with the `state-sync` hook otherwise).
@@ -94,25 +96,18 @@ Never hand-edit `gateDecisions`/`approvalGates` in `feature.json` — always go
94
96
  ## CLI — validation
95
97
 
96
98
  ```bash
97
- morph-spec validate [packages|next-components|spec-tasks]
99
+ morph-spec plan-check {feature} [--json] # validate plan.md, write checks.json
100
+ morph-spec validate [packages|next-components]
98
101
  morph-spec validate-feature {feature} [--phase {phase}] [--json] # alias: vf
99
- morph-spec verify {feature} [task] [--json] [--skip-tests] [--skip-build] # deterministic build+test+validator chain, before the LLM judge
100
- ```
101
-
102
- ---
103
-
104
- ## CLI — DAG
105
-
106
- ```bash
107
- morph-spec dag {feature} [--json] # sequential vs parallel dispatch decision (effort-weighted)
108
- morph-spec dag {feature} --mermaid # emit the tasks.json DAG as a Mermaid flowchart
102
+ morph-spec verify {feature} [--json] [--filter <ids>] [--skip-tests] [--skip-build] [--skip-e2e] # deterministic build+test+validator+e2e chain; the gate reads the unfiltered run
103
+ morph-spec report-check {feature} [--before-eval] [--json] # state of the implement and of the Gate 3 reports
109
104
  ```
110
105
 
111
106
  ---
112
107
 
113
108
  ## CLI — worktrees (parallel development / fleet)
114
109
 
115
- 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.
110
+ One feature = one git worktree = one Claude Code instance. Each worktree gets its own deterministic port block (`.morph/worktree.env`).
116
111
 
117
112
  ```bash
118
113
  morph-spec create {feature} --description "<what/why>" --worktree # birth the feature already isolated in its own worktree
@@ -120,9 +115,8 @@ morph-spec worktree setup {feature} # create worktrees/{feature}/ on bran
120
115
  morph-spec worktree link [--all] # relink shared infra (node_modules[, .claude, .morph/framework])
121
116
  morph-spec worktree list [--json] # active feature worktrees with phase/gate status
122
117
  # Close a worktree feature with `morph-spec finish {feature} --pr|--merge` (see above) — it absorbed `worktree finish`.
123
- morph-spec handoff {feature} [--json] [--here] # regenerate the handoff doc — resolves the owning tree and writes THERE, safe to run from the root
124
118
  morph-spec doctor --worktrees [--prune] # reconcile git's registry × disk × features; --prune also clears a dangling root worktree.path pointer
125
- morph-spec fleet [--json] # every active feature (root + worktrees) with phase/gates/ports/handoff/activity
119
+ morph-spec fleet [--json] # every active feature (root + worktrees) with phase/gates/ports/activity
126
120
  ```
127
121
 
128
122
  ---
@@ -145,14 +139,13 @@ morph-spec dashboard [--port 3200] # open the ins
145
139
  .morph/
146
140
  ├── config/config.json # project config (editable)
147
141
  ├── framework/ # READ-ONLY
148
- │ ├── agents.json # 8 domain personas
142
+ │ ├── agents.json # the 3 Gate 3 personas
149
143
  │ ├── standards/ # standards registry
150
- │ └── templates/ # code, IaC, and context templates
144
+ │ └── CLI.md # every command in detail
151
145
  ├── context/ # project context (editable)
152
146
  ├── features/{feature}/
153
147
  │ ├── feature.json # authoritative, committed
154
- │ ├── handoff.md
155
- │ └── 0-proposal/ 1-design/ 2-plan/ 3-implement/ 4-review/
148
+ │ └── 1-design/ 2-plan/ 3-implement/ 4-review/
156
149
  └── state.json # gitignored, derived index — never hand-edited
157
150
 
158
151
  .claude/
@@ -171,18 +164,17 @@ Never edited directly — go through CLI commands or `morph-spec update` instead
171
164
  | Path | Protected by |
172
165
  |------|-------------|
173
166
  | `.morph/state.json`, `.morph/framework/**` | `permissions.deny` |
174
- | `tasks.json` plan contract (`title`/`description`/`dependencies`/`effort`/`doneCriteria`/`group`) after Gate 2 | `protect-spec-files` hook (semantic diff) |
167
+ | `2-plan/checks.json`, and the body of `2-plan/plan.md` after the plan gate (only `## Errata` is appended) | `protect-spec-files` hook |
175
168
 
176
169
  ---
177
170
 
178
171
  ## Links
179
172
 
180
173
  - [QUICKSTART.md](QUICKSTART.md) — step-by-step guide
181
- - [ARCHITECTURE.md](ARCHITECTURE.md) — system design
182
174
  - [CHANGELOG.md](../CHANGELOG.md) — release history
183
175
  - [npm](https://www.npmjs.com/package/@polymorphism-tech/morph-spec)
184
176
  - support@polymorphism.com.br
185
177
 
186
178
  ---
187
179
 
188
- *morph-spec v10.0.0 by Polymorphism Tech*
180
+ *morph-spec v10.1.1 by Polymorphism Tech*
@@ -1,82 +1,47 @@
1
1
  # morph-spec Quick Start
2
2
 
3
+ One page: install, run `doctor`, paste the issue, open the PR.
4
+
3
5
  ## Install
4
6
 
5
7
  ```bash
6
8
  npm install -g @polymorphism-tech/morph-spec@latest --prefer-online
7
9
  ```
8
10
 
9
- > The installer automatically configures your PowerShell PATH on Windows. If `morph-spec` is not found, open a new terminal window.
10
-
11
- ---
11
+ If `morph-spec` is not found on Windows, open a new terminal window.
12
12
 
13
- ## Initialize a project
13
+ ## Set up the project
14
14
 
15
- Navigate to your project root and run:
15
+ From the project root:
16
16
 
17
17
  ```bash
18
18
  morph-spec init
19
- ```
20
-
21
- `init` does the following:
22
- - Auto-detects your stack (.NET, Next.js, Node.js, monorepo)
23
- - Creates `.morph/` with framework files, standards, and templates
24
- - Creates `.morph/context/` with inferred project context
25
- - Installs `.claude/skills/`, `.claude/agents/`, `.claude/rules/`
26
- - Writes `.claude/settings.local.json` with the fail-open Claude Code hooks (see `docs/ARCHITECTURE.md`)
27
- - Copies `CLAUDE.md` with runtime instructions
28
-
29
- Verify the installation:
30
-
31
- ```bash
32
19
  morph-spec doctor
33
20
  ```
34
21
 
35
- ---
22
+ `init` installs the harness into `.morph/` and `.claude/`. `doctor` is your first debugging step: it reports version mismatches, missing files and hook problems.
36
23
 
37
- ## Your first feature
24
+ ## Paste the issue
38
25
 
39
- Open your project in Claude Code and run:
26
+ Open the project in Claude Code and paste the link:
40
27
 
41
28
  ```
42
- /morph-proposal my-feature
29
+ /morph-plan https://github.com/your-org/your-repo/issues/123
43
30
  ```
44
31
 
45
- Replace `my-feature` with a short kebab-case name for your feature (e.g., `user-notifications`, `payment-flow`).
46
-
47
- The proposal pipeline runs the `proposal` and `plan` phases (plus the optional `uiux` phase), with an approval gate at each:
48
-
49
- ### Proposal (Gate 1)
32
+ A free-text request works too: `/morph-plan user-notifications`, then describe what you want.
50
33
 
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).
34
+ Claude reads the issue, checks it against the code and opens with a thesis: "asks for X; the code shows Y; I propose Z". There is no process question. How much it asks depends on what is at stake:
52
35
 
53
- ### UI/UX — optional (Gate)
36
+ | The request is | What happens |
37
+ |---|---|
38
+ | clear and matches the code | a one-line thesis, then it moves on |
39
+ | missing something, or contradicts the code | up to 3 challenges, each with evidence |
40
+ | unclear about the outcome, or high risk | a full interview with you |
54
41
 
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
42
+ The result is `2-plan/plan.md`: the problem, the outcome sought, what is out of scope, and the scenarios `C1..Cn` that define done. Read `## Padrões assumidos` at the end: to veto a default, tell Claude its number before implementing.
60
43
 
61
- You approve the UI design before moving on.
62
-
63
- ### Plan (Gate 2)
64
-
65
- Claude produces, under `2-plan/`:
66
- - `usecases/UC-*.md` — the behavior, with postconditions observable in a test
67
- - `spec.md` — architecture, contracts and the `## Contrato de implementação` section (standards, runtime verification)
68
- - `tasks.json` — ordered task breakdown (`T001`, `T002`, …)
69
- - `decisions.md` — architectural decision records (optional)
70
-
71
- Claude identifies ambiguities in the spec and resolves them with you before finalizing. You review and approve the use cases, spec and task list together.
72
-
73
- At this point, planning is complete:
74
-
75
- ```
76
- ✅ Planning complete — run /morph-apply my-feature to implement
77
- ```
78
-
79
- ---
44
+ You approve the gates yourself. If you have a question about the issue, ask the person who wrote it.
80
45
 
81
46
  ## Implement
82
47
 
@@ -84,169 +49,44 @@ At this point, planning is complete:
84
49
  /morph-apply my-feature
85
50
  ```
86
51
 
87
- Claude reads the use cases, `spec.md` and `tasks.json`, then implements task by task with auto-advance (no pause between tasks unless there's a blocking ambiguity):
88
- - Records task progress in `tasks.json`, writing the mutable `status`/`outputs`/`notes` fields
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
- - Closes each task when `verify` is green and every `doneCriteria` has the evidence that proves it — red triggers an autonomous correction loop, not a pause
91
- - Generates `3-implement/recap.md` on completion, then Gate 3 review (`4-review/`)
92
-
93
- ---
94
-
95
- ## During development
96
-
97
- Check feature state:
98
-
99
- ```bash
100
- morph-spec status my-feature
101
- ```
102
-
103
- Approve the current gate and scaffold the next phase folder in one step:
104
-
105
- ```bash
106
- morph-spec advance my-feature
107
- ```
108
-
109
- Task progress is recorded in `tasks.json` — Claude writes the mutable `status`/`outputs`/`notes` fields directly, and there is no separate CLI command for marking a task done.
110
-
111
- Run validators at any time:
52
+ Claude implements the whole plan in one session, tracks each scenario in `3-implement/report.md`, runs `verify`, and dispatches the Gate 3 reviewers in fresh context. If a discovery makes the outcome sought false, it stops and asks you.
112
53
 
113
- ```bash
114
- morph-spec validate # all validators
115
- morph-spec validate architecture # specific validator
116
- morph-spec validate packages
117
- ```
54
+ ## Open the PR
118
55
 
119
- Run the deterministic verification chain (build + tests + validators) before trusting an LLM judge score:
56
+ When Gate 3 passes, Claude asks how to integrate. You can also run it yourself:
120
57
 
121
58
  ```bash
122
- morph-spec verify my-feature # whole feature
123
- morph-spec verify my-feature T001 # scoped to one task
59
+ morph-spec finish my-feature --pr
124
60
  ```
125
61
 
126
- ---
127
-
128
- ## Work-type routing
129
-
130
- Not every change needs the full pipeline walked above. Every feature is born with a **work type** that dimensions its pipeline:
62
+ `finish` archives the feature, pushes `morph/my-feature` and opens the PR.
131
63
 
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):
64
+ ## Along the way
133
65
 
134
66
  ```bash
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"
67
+ morph-spec next my-feature # what happens next, read from disk
68
+ morph-spec status my-feature # phase, gates and progress
69
+ morph-spec fleet # every active feature
143
70
  ```
144
71
 
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):
72
+ Picked up a session mid-feature? Run `/morph-apply my-feature`. It resumes from `3-implement/report.md`.
146
73
 
147
- ```bash
148
- morph-spec create my-feature --request "produção caiu, corrigir urgente"
149
- ```
150
-
151
- Change the type later if it turns out to be wrong (blocked after Gate 3):
152
-
153
- ```bash
154
- morph-spec retype my-feature hotfix --reason "escalated to production incident"
155
- ```
156
-
157
- Production incidents run through the dedicated `/morph-hotfix my-feature` slash command instead of `/morph-proposal`.
158
-
159
- ---
160
-
161
- ## Parallel development with worktrees
162
-
163
- Independent features can be developed in parallel, each isolated in its own git worktree — one feature, one worktree, one Claude Code instance:
164
-
165
- ```bash
166
- morph-spec create my-feature --description "what & why" --worktree # birth the feature already isolated
167
- # or, for an existing feature:
168
- morph-spec worktree setup my-feature # creates worktrees/my-feature/ on branch morph/my-feature
169
- ```
170
-
171
- Open the new worktree directory in its own Claude Code instance and work normally — a SessionStart hook injects the worktree's feature identity into context automatically. When the feature is done (Gate 3 approved), close it in one step:
172
-
173
- ```bash
174
- morph-spec finish my-feature --merge # archive + merge --no-ff into the default branch (local), tear down the worktree
175
- # or, to open a PR instead of merging locally:
176
- morph-spec finish my-feature --pr # archive + push morph/my-feature + gh pr create (keeps the branch the PR needs)
177
- ```
178
-
179
- `finish` archives the feature (committing the move inside `morph/my-feature`) *and* integrates *and* tears down the worktree in one step — it replaces the old `worktree finish` + separate `archive`. The same command closes features developed **without** a worktree (they're born on `morph/{feature}` too).
180
-
181
- List every active worktree with its phase and gate status:
182
-
183
- ```bash
184
- morph-spec worktree list
185
- ```
186
-
187
- ---
188
-
189
- ## Multiple features
190
-
191
- You can have multiple features in progress simultaneously. Each has its own directory under `.morph/features/`, with its own committed `feature.json`:
192
-
193
- ```
194
- .morph/features/
195
- ├── user-notifications/
196
- │ ├── feature.json
197
- │ ├── 0-proposal/
198
- │ └── 2-plan/
199
- └── payment-flow/
200
- ├── feature.json
201
- └── 0-proposal/
202
- ```
203
-
204
- See every active feature — root and worktrees — with phase, gates, and activity:
205
-
206
- ```bash
207
- morph-spec fleet
208
- ```
209
-
210
- ---
74
+ Not everything needs the full flow. `/morph-plan` routes by work type: `feature` and `bug` run the whole flow, `chore` writes a short plan and goes straight to implementation. For a production incident, use `/morph-hotfix my-feature`: Gate 3 always stops for a human.
211
75
 
212
76
  ## Keeping up to date
213
77
 
214
- When a new version of `@polymorphism-tech/morph-spec` is published:
215
-
216
78
  ```bash
217
- # Update the CLI (--prefer-online bypasses the ~5 min local packument cache)
218
79
  npm install -g @polymorphism-tech/morph-spec@latest --prefer-online
219
-
220
- # Update framework files in your project
221
80
  morph-spec update
222
-
223
- # Verify
224
81
  morph-spec doctor
225
82
  ```
226
83
 
227
- `morph-spec update` re-syncs `.morph/framework/`, `.claude/skills/`, `.claude/agents/`, `.claude/rules/`, and `CLAUDE.md`. It does not touch your config, context, or feature outputs.
228
-
229
- ---
230
-
231
- ## Tips
232
-
233
- **Use `/morph-proposal` even for small features.** The proposal phase catches scope creep, identifies the right agents, and generates contracts early — before implementation makes it expensive to change direction.
234
-
235
- **Approve explicitly at each gate.** The design gate exists to prevent implementing the wrong thing. If something in `spec.md` or `contracts.cs` looks off, say so before approving.
236
-
237
- **ADRs belong in `decisions.md`.** When Claude makes an architectural choice, it documents it there. Read it after Design completes. Decisions drive the validators that run during implementation.
238
-
239
- **`morph-spec doctor` is your first debugging step.** If something is behaving unexpectedly, doctor will surface version mismatches, missing files, and hook configuration issues.
240
-
241
- ---
242
-
243
84
  ## Next steps
244
85
 
245
86
  - [CHEATSHEET.md](CHEATSHEET.md) — command reference
246
- - [ARCHITECTURE.md](ARCHITECTURE.md) — system design and agent hierarchy
87
+ - `.morph/framework/CLI.md` — every command in detail
247
88
  - [CHANGELOG.md](../CHANGELOG.md) — release history
248
- - `.morph/framework/standards/` — all coding and architecture standards
249
89
 
250
90
  ---
251
91
 
252
- *morph-spec v10.0.0 by Polymorphism Tech*
92
+ *morph-spec v10.1.1 by Polymorphism Tech*
@@ -22,7 +22,7 @@ Prefixo `morph-spec`; detalhe em `.morph/framework/CLI.md`.
22
22
 
23
23
  | Comando | Para quê |
24
24
  |---|---|
25
- | `create <f> --request "…" [--worktree]` | nasce a feature |
25
+ | `create <f> --request '…' [--worktree]` | nasce a feature |
26
26
  | `next <f>` | o próximo passo, do disco |
27
27
  | `plan-check <f>` | valida o plano, grava `checks.json` |
28
28
  | `gate-check <f> <gate>` / `approve` / `advance` | decide e aprova gates |
@@ -38,7 +38,7 @@ Prefixo `morph-spec`; detalhe em `.morph/framework/CLI.md`.
38
38
 
39
39
  ## Gate 3 (sub-agents)
40
40
 
41
- `morph-verifier`, `morph-reviewer`, `morph-security` em `.claude/agents/`, gerados de `agents.json` — nunca edite à mão. Com a crítica do plano (`Plan` nativo, `morph-plan`), são os únicos sub-agents do fluxo; o resto é feito nesta sessão. Leia o relatório que gravam, não a mensagem final.
41
+ `morph-verifier`, `morph-reviewer`, `morph-security` em `.claude/agents/`, gerados de `agents.json` — nunca edite à mão. Com a crítica do plano (`Plan` nativo, `morph-plan`), são os únicos sub-agents do fluxo; o resto é feito nesta sessão. Do Gate 3, leia o relatório que gravam, não a mensagem final.
42
42
 
43
43
  <!-- morph-agents:start -->
44
44
  _Lista derivada na instalação. Bloco vazio → `morph-spec setup-infra --reinstall`._
@@ -15,7 +15,7 @@ Entre gates, você opera sozinho: faz o que `next` mandar (`implement`, `verify`
15
15
  | `next` devolve `escalate` (3 verify vermelhos seguidos) | `AskUserQuestion`: aceitar, continuar ou parar. Nunca uma 4ª tentativa por conta própria |
16
16
  | `verify` exit 3 | fila cheia, não vermelho: no máximo uma chamada nova |
17
17
 
18
- Na abertura do plano vale o contrário: o modo entrevista pergunta até fechar o entendimento. **A prova é o código:** `verify` prova o determinístico, o Gate 3 prova cada cenário `Cn`. Estilo é nota, nunca bloqueio.
18
+ Na abertura do plano vale o contrário: confronte o pedido com o código e pergunte o que a tese não fecha. **A prova é o código:** `verify` prova o determinístico, o Gate 3 prova cada cenário `Cn`. Estilo é nota, nunca bloqueio.
19
19
 
20
20
  ---
21
21
 
@@ -40,7 +40,7 @@ Na abertura do plano vale o contrário: o modo entrevista pergunta até fechar o
40
40
 
41
41
  ### 2.1 Roteamento por tipo de trabalho
42
42
 
43
- `morph-spec create <f> --request "<pedido>"` (ou `--type <t> --description "…"`).
43
+ `morph-spec create <f> --request '<pedido>'` (ou `--type <t> --request '…'`).
44
44
 
45
45
  | Tipo | Pipeline | Gates |
46
46
  | --- | --- | --- |
@@ -72,15 +72,15 @@ dotnet restore --verbosity normal 2>&1 | grep -E "(NU1605|NU1608|warning)"
72
72
  **How to check:**
73
73
  ```bash
74
74
  # Step 0: Verify database connectivity
75
- psql "$(neonctl connection-string)" -c "SELECT 1" 2>/dev/null && \
75
+ psql "$(neon connection-string)" -c "SELECT 1" 2>/dev/null && \
76
76
  echo "✓ Database reachable" || \
77
77
  echo "✗ Database unreachable — skip remaining migration checks"
78
78
 
79
79
  # Check for pending migrations (skip if connectivity failed)
80
- neonctl branches diff <branch>
80
+ neon branches schema-diff <base-branch> <branch>
81
81
 
82
82
  # Verify RLS is enabled on all tables
83
- psql "$(neonctl connection-string)" -c "SELECT tablename FROM pg_tables WHERE schemaname='public' AND tablename NOT IN (SELECT tablename FROM pg_policies)"
83
+ psql "$(neon connection-string)" -c "SELECT tablename FROM pg_tables WHERE schemaname='public' AND tablename NOT IN (SELECT tablename FROM pg_policies)"
84
84
  ```
85
85
 
86
86
  > **Important:** If the database connectivity check fails, skip all migration checks and warn the user. Do not block the preflight — the database may be intentionally scaled to zero.
@@ -89,7 +89,7 @@ A tabela é a mesma régua que `shouldPauseGate` aplica e que o `gate-check` imp
89
89
 
90
90
  ### create
91
91
 
92
- **`morph-spec create <feature> --description "<o quê/porquê>" --type <feature|bug|chore|hotfix> [--request "<txt>"] [--name "<nome>"] [--worktree] [--no-checkout]`** — cria a estrutura da feature + `feature.json` canônico explicitamente (nascimento explícito no início do plano, `morph-plan` §1; o hook state-sync continua cobrindo o caminho implícito como fallback).
92
+ **`morph-spec create <feature> --description "<o quê/porquê>" --type <feature|bug|chore|hotfix> [--request '<txt>'] [--name "<nome>"] [--worktree] [--no-checkout]`** — cria a estrutura da feature + `feature.json` canônico explicitamente (nascimento explícito no início do plano, `morph-plan` §1; o hook state-sync continua cobrindo o caminho implícito como fallback).
93
93
 
94
94
  **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.
95
95
 
@@ -26,8 +26,8 @@ const HOW = {
26
26
  + `em 3-implement/report.md e commite \`wip(${f}): Cn …\`.`,
27
27
  ],
28
28
  decide: () => [
29
- 'Leia a pergunta do Cn bloqueado em 3-implement/report.md ## Notas; decida pelo plano/ADR ou faça AskUserQuestion com ela.',
30
- 'Registre a resposta em ## Notas, volte o Cn para `pendente` e siga implementando.',
29
+ 'Leia a pergunta do Cn bloqueado em 3-implement/report.md ## Notas; decida pelo plano/ADR ou faça AskUserQuestion com ela. Se o `Resultado buscado` ficou falso, o plano não decide: pergunte.',
30
+ 'Registre a resposta em ## Notas, volte o Cn para `pendente` e siga implementando; resposta que muda escopo vai por `unapprove`.',
31
31
  ],
32
32
  verify: (f) => [
33
33
  `\`morph-spec verify ${f} --json\` sem filtro; passou de 10 min, run_in_background.`,
@@ -252,11 +252,11 @@
252
252
  },
253
253
  "neon": {
254
254
  "phases": ["plan", "implement"],
255
- "tools": ["list_projects", "describe_table_schema", "get_database_tables", "run_sql", "explain_sql_statement", "prepare_database_migration", "complete_database_migration", "compare_database_schema", "create_branch", "list_branches", "get_connection_string"],
255
+ "tools": ["list_projects", "describe_table_schema", "get_database_tables", "run_sql", "explain_sql_statement", "prepare_database_migration", "complete_database_migration", "compare_database_schema", "create_branch", "list_branches", "get_connection_string", "list_slow_queries", "prepare_query_tuning", "complete_query_tuning", "create_snapshot", "search_docs", "get_doc"],
256
256
  "serverNames": ["neon", "Neon"],
257
257
  "detection": "mcpServers includes neon (case-insensitive)",
258
- "fallback": "SQL via the connection string (psql / dotnet ef) and the neonctl CLI for branches",
259
- "usage": "Schema inspection, migration dry-run on a throwaway branch (prepare_database_migration → complete_database_migration), query tuning. The server exposes DESTRUCTIVE tools (delete_branch, delete_project, reset_from_parent): never call one without explicit human confirmation",
258
+ "fallback": "SQL via the connection string (psql / dotnet ef) and the neon CLI for branches",
259
+ "usage": "Schema inspection, migration dry-run on a throwaway branch (prepare_database_migration → complete_database_migration), query tuning (list_slow_queries, prepare_query_tuning), snapshot before a risky migration, current Neon docs (search_docs, get_doc). Work on a branch: the Neon docs say never to connect MCP agents to production databases. The server exposes DESTRUCTIVE tools (delete_branch, delete_project, reset_from_parent): never call one without explicit human confirmation",
260
260
  "healthCheck": {
261
261
  "toolPattern": "neon",
262
262
  "testCall": "Call list_projects with limit 1",
@@ -274,7 +274,7 @@
274
274
  "credentials": [],
275
275
  "prerequisites": [],
276
276
  "stackRelevance": ["neon"],
277
- "warnings": ["OAuth against your Neon account on first use. The server can delete branches and projects: keep destructive calls behind a human."],
277
+ "warnings": ["OAuth against your Neon account on first use. The server can delete branches and projects: keep destructive calls behind a human, and point agents at a branch, never at production."],
278
278
  "setupGuide": "Run: claude mcp add --transport http neon https://mcp.neon.tech/mcp"
279
279
  }
280
280
  },
@@ -26,7 +26,7 @@ stacks:
26
26
  - **ai-agents-structured-output** (`ai-agents/structured-output.md`) — Saída que alimenta outro sistema é record tipado (`RunAsync<T>` ou `ChatResponseFormat.ForJsonSchema<T>()`): `sealed record` com `[Description]` e `[JsonPropertyName]`. Raiz nunca primitivo/array (use wrapper); em streaming, `ToAgentResponseAsync()` antes de desserializar. Regra de negócio se valida depois da chamada.
27
27
  - **ai-agents-multi-agent-patterns** (`ai-agents/multi-agent-patterns.md`) — Do mais barato: agent-as-tool (`AsAIFunction()`, aninhamento ≤ 2) → sequencial → workflow; handoff vem depois de agent-as-tool, com Id estável e `WithAutonomousMode(turnLimit:)`; group chat ≤ 3 agentes. PROIBIDO: agente auxiliar DENTRO de uma tool (dois loops de function calling no mesmo turno).
28
28
  - **ai-agents-prompt-sources** (`ai-agents/prompt-sources.md`) — Prompt fixo: tabela versionada `agent_prompts` (INSERT + flip de `is_active` numa transação, nunca UPDATE; id `Guid.CreateVersion7()`). Prompt por tenant: YAML no repo → compositor determinístico → spec renderizada em jsonb. O registro de execução grava a versão EFETIVA (e o hash do blob no caminho composto).
29
- - **ai-agents-rag-custom-pgvector** (`ai-agents/rag-custom-pgvector.md`) — RAG em pgvector via EF Core: `IEmbeddingGenerator` injetado direto (sem EmbeddingService), alias `embeddings` do registry, `CosineDistance` LINQ, HNSW `vector_cosine_ops`, `tenant_id` filtrado em toda query e nunca exposto ao LLM. Ingestão delta por lookup-key: Unchanged nunca re-embeda, Removed só depois das escritas.
29
+ - **ai-agents-rag-custom-pgvector** (`ai-agents/rag-custom-pgvector.md`) — RAG em pgvector via EF Core: `IEmbeddingGenerator` injetado direto (sem EmbeddingService), alias `embeddings` do registry, `CosineDistance` LINQ, HNSW `vector_cosine_ops`, `tenant_id` filtrado em toda query e nunca exposto ao LLM. Ingestão delta por lookup-key: Unchanged nunca re-embeda, Removed só depois das escritas. Corpus com código, SKU ou nome próprio: busca híbrida com RRF (`infrastructure-neon-pgvector#hybrid-search-vector--full-text`).
30
30
  - **ai-agents-middleware-patterns** (`ai-agents/middleware-patterns.md`) — Registro sempre `.AsBuilder().Use(...).Build()`; o PRIMEIRO registrado é o mais externo. Ordem medida: timeout → usage-cost → FunctionInvokingChatClient → chat telemetry → provider. Só o delegate não-streaming rebaixa streaming em silêncio: use `Use(sharedFunc)`.
31
31
  - **ai-agents-observability-patterns** (`ai-agents/observability-patterns.md`) — Registre os DOIS ActivitySources (`Experimental.Microsoft.Agents.AI` e `Experimental.Microsoft.Extensions.AI`); a API é `builder.UseOpenTelemetry(...)` (`agent.WithOpenTelemetry()` não existe). Instrumentar os dois níveis é normal; o mesmo nível duas vezes duplica. Prompt cru só em dev com opt-in, hash em produção; turno cancelado não grava nada.
32
32
  - **ai-agents-workflows** (`ai-agents/workflows.md`) — Raro: só para fan-in/out real ou HITL longo; `foreach` + LINQ costuma bastar. `AgentWorkflowBuilder`/`WorkflowBuilder`/`InProcessExecution` vivem no pacote SEPARADO `Microsoft.Agents.AI.Workflows` 1.20.0. Agente declarativo (`Microsoft.Agents.AI.Declarative`) ainda pede `--prerelease`.
@@ -13,6 +13,6 @@ stacks:
13
13
 
14
14
  - **data-nosql-cache-redis** (`data/nosql/cache/redis.md`) — Cache distribuído, nunca store primário. `Microsoft.Extensions.Caching.StackExchangeRedis` 10.0.12; `IConnectionMultiplexer` singleton LAZY (nunca conectar no registro). Cache-aside no handler com `IDistributedCache` (sem wrapper); invalide a chave exata depois do `SaveChangesAsync`. PROIBIDO: cachear segredo/PII sem criptografia, omitir TTL, engolir `RedisConnectionException`.
15
15
  - **data-vector-search-rag-chunking** (`data/vector-search/rag-chunking.md`) — Prosa: sentence-aware, 256 tokens; doc técnico: semântico por headers; Q&A inteiro; código: a função inteira. Overlap 10–20%, mínimo 50 e máximo ~512 tokens. Sempre grave metadados do chunk (DocumentId, ChunkIndex, Section, SourceUrl) e reindexe quando o hash do conteúdo mudar.
16
- - **backend-database-vector-search-rag** (`backend/database/vector-search-rag.md`) — Slices VSA sobre EF Core 10 + pgvector: o handler injeta `ApplicationDbContext` e `IEmbeddingGenerator` direto (sem EmbeddingService/SearchService). Busca por `d.Embedding!.CosineDistance(query)` com a distância em ordem ASC. Sem documento relevante, `NotFound` antes de chamar o LLM. Indexação em lote: um `GenerateAsync` e um `SaveChanges`.
16
+ - **backend-database-vector-search-rag** (`backend/database/vector-search-rag.md`) — Slices VSA sobre EF Core 10 + pgvector: o handler injeta `ApplicationDbContext` e `IEmbeddingGenerator` direto (sem EmbeddingService/SearchService). Busca por `d.Embedding!.CosineDistance(query)` com a distância em ordem ASC. Sem documento relevante, `NotFound` antes de chamar o LLM. Indexação em lote: um `GenerateAsync` e um `SaveChanges`. Corpus com código, SKU ou nome próprio: busca híbrida com RRF (`infrastructure-neon-pgvector#hybrid-search-vector--full-text`).
17
17
 
18
18
  > Resumo injetado quando você lê ou edita um arquivo casado por `paths:`. Texto completo: `morph-spec standards --find "<id>"` e leia só a seção necessária de `.morph/framework/standards/<path>`.
@@ -10,6 +10,6 @@ stacks:
10
10
 
11
11
  # Hangfire Background Jobs Standards
12
12
 
13
- - **backend-integrations-hangfire-hangfire-jobs** (`backend/integrations/hangfire/hangfire-jobs.md`) — Hangfire 1.8.25 só com razão real em `plan.md` (`## Decisões`); o que cabe no request fica no handler. Storage `Hangfire.PostgreSql` 1.21.1 com `UseNpgsqlConnection` no endpoint DIRETO do Neon; referencie `Newtonsoft.Json` 13.0.4. Job é classe fina e idempotente que chama o handler; `[AutomaticRetry]`, sem try/catch nem retry manual. Dashboard exige Admin autenticado.
13
+ - **backend-integrations-hangfire-hangfire-jobs** (`backend/integrations/hangfire/hangfire-jobs.md`) — Hangfire 1.8.25 só com razão real em `plan.md` (`## Decisões`); o que cabe no request fica no handler. Tarefa genérica e cron usam Hangfire; job com estado que a app lê usa tabela + claim `SKIP LOCKED` (`backend-dotnet-vsa-handler-patterns#queue-on-postgres`). Storage `Hangfire.PostgreSql` 1.21.1 com `UseNpgsqlConnection` no endpoint DIRETO do Neon; referencie `Newtonsoft.Json` 13.0.4. Job é classe fina e idempotente que chama o handler; `[AutomaticRetry]`, sem try/catch nem retry manual. Dashboard exige Admin autenticado.
14
14
 
15
15
  > Resumo injetado quando você lê ou edita um arquivo casado por `paths:`. Texto completo: `morph-spec standards --find "<id>"` e leia só a seção necessária de `.morph/framework/standards/<path>`.
@@ -10,6 +10,6 @@ stacks:
10
10
 
11
11
  # Neon Auth Standards
12
12
 
13
- - **backend-integrations-neon-auth-neon-auth** (`backend/integrations/neon-auth/neon-auth.md`) — SDK `@neondatabase/auth`: `createNeonAuth()` no server, `createAuthClient()` no client, `auth.middleware()` com `runtime='nodejs'`. Duas constantes de prefixo (`BACKEND_API_PREFIX`/`PROXY_API_PREFIX`), nunca uma só. O front não consulta o Neon para dado de negócio. .NET: token EdDSA/Ed25519, verificado pelo JWKS com BouncyCastle + `SignatureValidator` devolvendo `JsonWebToken`.
13
+ - **backend-integrations-neon-auth-neon-auth** (`backend/integrations/neon-auth/neon-auth.md`) — SDK `@neon/auth` (≥ 0.8.1; `@neondatabase/auth` é o nome antigo): `createNeonAuth()` no server, `createAuthClient()` no client, `auth.middleware()` com `runtime='nodejs'`. Duas constantes de prefixo (`BACKEND_API_PREFIX`/`PROXY_API_PREFIX`), nunca uma só. O front não consulta o Neon para dado de negócio. .NET: token EdDSA/Ed25519, verificado pelo JWKS com BouncyCastle + `SignatureValidator` devolvendo `JsonWebToken`.
14
14
 
15
15
  > Resumo injetado quando você lê ou edita um arquivo casado por `paths:`. Texto completo: `morph-spec standards --find "<id>"` e leia só a seção necessária de `.morph/framework/standards/<path>`.