@polymorphism-tech/morph-spec 4.8.1 → 4.8.4
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 +2 -2
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/hooks/dev/guard-version-numbers.js +1 -1
- package/framework/skills/level-1-workflows/phase-clarify/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-codebase-analysis/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-design/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-implement/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-setup/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/phase-uiux/SKILL.md +1 -1
- package/package.json +4 -4
- package/.morph/analytics/threads-log.jsonl +0 -54
- package/.morph/state.json +0 -198
- package/docs/ARCHITECTURE.md +0 -328
- package/docs/COMMAND-FLOWS.md +0 -398
- package/docs/plans/2026-02-22-claude-docs-morph-alignment-analysis.md +0 -514
- package/docs/plans/2026-02-22-claude-settings.md +0 -517
- package/docs/plans/2026-02-22-morph-cc-alignment-impl.md +0 -730
- package/docs/plans/2026-02-22-morph-spec-next.md +0 -480
- package/docs/plans/2026-02-22-native-alignment-design.md +0 -201
- package/docs/plans/2026-02-22-native-alignment-impl.md +0 -927
- package/docs/plans/2026-02-22-native-enrichment-design.md +0 -246
- package/docs/plans/2026-02-22-native-enrichment.md +0 -737
- package/docs/plans/2026-02-23-ddd-architecture-refactor.md +0 -1155
- package/docs/plans/2026-02-23-ddd-nextsteps.md +0 -684
- package/docs/plans/2026-02-23-infra-architect-refactor.md +0 -439
- package/docs/plans/2026-02-23-nextjs-code-review-design.md +0 -157
- package/docs/plans/2026-02-23-nextjs-code-review-impl.md +0 -1256
- package/docs/plans/2026-02-23-nextjs-standards-design.md +0 -150
- package/docs/plans/2026-02-23-nextjs-standards-impl.md +0 -1848
- package/docs/plans/2026-02-24-cli-radical-simplification.md +0 -592
- package/docs/plans/2026-02-24-framework-failure-points.md +0 -125
- package/docs/plans/2026-02-24-morph-init-design.md +0 -337
- package/docs/plans/2026-02-24-morph-init-impl.md +0 -1269
- package/docs/plans/2026-02-24-tutorial-command-design.md +0 -71
- package/docs/plans/2026-02-24-tutorial-command.md +0 -298
- package/scripts/bump-version.js +0 -248
- package/scripts/generate-refs.js +0 -336
- package/scripts/generate-standards-registry.js +0 -44
- package/scripts/install-dev-hooks.js +0 -138
- package/scripts/scan-nextjs.mjs +0 -169
- package/scripts/validate-real.mjs +0 -255
|
@@ -1,514 +0,0 @@
|
|
|
1
|
-
# Claude Code Native Alignment Analysis — Morph-Spec Framework
|
|
2
|
-
|
|
3
|
-
**Status:** COMPLETE
|
|
4
|
-
|
|
5
|
-
**Date:** 2026-02-22
|
|
6
|
-
**Source docs:** `code.claude.com/docs/en` (common-workflows, hooks-guide, sub-agents, skills, best-practices, settings)
|
|
7
|
-
**Scope:** Architectural comparison, gap analysis, concrete improvement recommendations
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 1. Executive Summary
|
|
12
|
-
|
|
13
|
-
Morph-Spec has strong alignment in some areas (CLAUDE.md design, native `permissions.deny`, agents installer, rules files) but significant **over-engineering in three zones**: the hooks infrastructure, the skills/agents taxonomy, and the state machine's relationship to Claude Code's own session and permission mechanisms.
|
|
14
|
-
|
|
15
|
-
The framework's core value — **spec-driven phase gating** — is real and irreplaceable by anything Claude Code provides natively. The problem is that the scaffolding around it uses complex custom Node.js infrastructure where simple YAML frontmatter or jq one-liners would suffice.
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 2. Claude Code Native Features Reference
|
|
20
|
-
|
|
21
|
-
The following features are **platform-native** and require zero custom code:
|
|
22
|
-
|
|
23
|
-
| Feature | What CC provides | Location |
|
|
24
|
-
|---|---|---|
|
|
25
|
-
| **Skills** | SKILL.md files, `/slash-commands`, `$ARGUMENTS`, `context: fork`, scoped hooks, `allowed-tools`, `disable-model-invocation` | `.claude/skills/<name>/SKILL.md` |
|
|
26
|
-
| **Subagents** | Markdown+frontmatter, automatic delegation, `tools`, `model`, `permissionMode`, `maxTurns`, `memory`, `isolation: worktree`, scoped hooks, preloaded skills | `.claude/agents/<name>.md` |
|
|
27
|
-
| **Hooks** | 17 lifecycle events, `command`/`prompt`/`agent` types, matchers, exit-code control, JSON output for structured decisions, async execution | `settings.json` → `hooks` |
|
|
28
|
-
| **Permissions** | `allow/deny/ask` rules with glob patterns, `defaultMode`, `additionalDirectories`, `disableBypassPermissionsMode` | `settings.json` → `permissions` |
|
|
29
|
-
| **Memory / CLAUDE.md** | Multi-level CLAUDE.md (`~/.claude/`, `.claude/`, project root, subdirs), `@path/to/import` syntax | Any `CLAUDE.md` |
|
|
30
|
-
| **Agent persistent memory** | `memory: user/project/local` in subagent frontmatter, auto-managed `MEMORY.md` per agent | `.claude/agent-memory/<name>/` |
|
|
31
|
-
| **Plan Mode** | Read-only exploration before writing, `defaultMode: "plan"`, Shift+Tab toggle, `--permission-mode plan` | Platform |
|
|
32
|
-
| **Worktrees** | `--worktree`, `isolation: worktree` in subagent frontmatter, auto-cleanup | Platform |
|
|
33
|
-
| **Session management** | `--continue`, `--resume`, `/rename`, session picker, `--from-pr` | Platform |
|
|
34
|
-
| **Statusline** | `statusLine.type: "command"` in `settings.json` | `settings.json` |
|
|
35
|
-
| **Schema validation** | `$schema` in settings.json | `settings.json` |
|
|
36
|
-
|
|
37
|
-
### Key design principles from CC docs:
|
|
38
|
-
|
|
39
|
-
1. **Hooks are deterministic; CLAUDE.md is advisory** — hooks guarantee enforcement; instructions are guidance
|
|
40
|
-
2. **Skills are context-loaded knowledge; subagents are isolated executors** — different tools for different jobs
|
|
41
|
-
3. **CLAUDE.md should be short** — only things Claude can't infer; bloated CLAUDE.md is ignored
|
|
42
|
-
4. **Subagent description drives delegation** — no manual "tier" system needed; Claude matches by description
|
|
43
|
-
5. **Persistent agent memory** (`memory: project`) replaces custom context persistence
|
|
44
|
-
6. **Skill `context: fork`** runs skills in isolation — subagents aren't always needed
|
|
45
|
-
7. **`prompt`/`agent` hook types** — CC supports LLM-evaluated hooks natively; no custom prompt engineering needed
|
|
46
|
-
8. **`allowed-tools` in skill frontmatter** — scoped permission for skill duration, no custom validation
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## 3. Morph-Spec Architecture vs CC Native: Feature-by-Feature
|
|
51
|
-
|
|
52
|
-
### 3.1 Skills System
|
|
53
|
-
|
|
54
|
-
**Current:**
|
|
55
|
-
```
|
|
56
|
-
framework/skills/
|
|
57
|
-
level-0-meta/ → 6 skills (brainstorming, code-review, etc.)
|
|
58
|
-
level-1-workflows/ → 8 skills (phase-proposal, phase-design, etc.)
|
|
59
|
-
level-2-domains/ → 22 skills (blazor-builder, azure-architect, etc.)
|
|
60
|
-
level-3-technologies/ → NOT installed
|
|
61
|
-
level-4-patterns/ → NOT installed
|
|
62
|
-
```
|
|
63
|
-
`skills-installer.js` copies level-0 + level-1 **FLAT** to `.claude/skills/` (no subdirectories, no supporting files).
|
|
64
|
-
|
|
65
|
-
**Assessment:**
|
|
66
|
-
|
|
67
|
-
| Aspect | Status | Issue |
|
|
68
|
-
|---|---|---|
|
|
69
|
-
| YAML frontmatter with `name` + `description` | ✅ Aligned | — |
|
|
70
|
-
| `/slash-command` invocation | ✅ Aligned | — |
|
|
71
|
-
| Level hierarchy (0–4) | ⚠️ Overhead | CC uses flat dirs + description matching — levels add no CC value |
|
|
72
|
-
| Levels 2–4 never installed | ❌ Dead code | 22+ domain skills built but never deployed to users |
|
|
73
|
-
| Installed FLAT (no dirs) | ⚠️ Limitation | No supporting files possible; `context: fork`, `allowed-tools`, `hooks` frontmatter unused |
|
|
74
|
-
| level-2-domains as skills | ⚠️ Wrong type | Domain specialists (blazor-builder, azure-architect) are **subagents**, not skills — they need isolated execution, tool access, and persistent memory |
|
|
75
|
-
|
|
76
|
-
**What's missing from skills:**
|
|
77
|
-
- No `context: fork` + `agent:` for isolated phase execution
|
|
78
|
-
- No `$ARGUMENTS` in phase workflow skills (could pass feature name)
|
|
79
|
-
- No `allowed-tools` scoping per skill
|
|
80
|
-
- No `hooks:` frontmatter for skill-scoped lifecycle events
|
|
81
|
-
- No `memory:` for persistent skill context
|
|
82
|
-
- No `disable-model-invocation: true` on dangerous phase skills (e.g. `phase-implement`)
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
### 3.2 Agents System
|
|
87
|
-
|
|
88
|
-
**Current:**
|
|
89
|
-
- `framework/agents.json` — 37 agents in 4 tiers, custom JSON format
|
|
90
|
-
- `agents-installer.js` transpiles tier-1/2 agents to `.claude/agents/morph-{id}.md`
|
|
91
|
-
- Tiers 3–4 (Specialists + Validators) are NOT installed as agents
|
|
92
|
-
|
|
93
|
-
**Assessment:**
|
|
94
|
-
|
|
95
|
-
| Aspect | Status | Issue |
|
|
96
|
-
|---|---|---|
|
|
97
|
-
| Agents installed to `.claude/agents/` | ✅ Aligned | — |
|
|
98
|
-
| YAML frontmatter + description | ✅ Aligned | — |
|
|
99
|
-
| Tier 1/2 as agents | ✅ Reasonable | These are orchestrators/leaders — appropriate as persistent subagents |
|
|
100
|
-
| Tier 3/4 NOT installed | ❌ Dead code | 31 specialists built but unused by CC native delegation |
|
|
101
|
-
| Custom 4-tier taxonomy | ⚠️ Overhead | CC delegates by description alone — tiers are an organizational concept with no runtime effect |
|
|
102
|
-
| `agents.json` → `.md` transpilation | ⚠️ Adapter complexity | Extra build step; agents could be authored directly as `.md` files |
|
|
103
|
-
| No `memory: project` in agents | ❌ Gap | Agents lose context between sessions; CC provides this natively |
|
|
104
|
-
| No `isolation: worktree` for parallel work | ❌ Gap | Parallel agent execution doesn't use CC's native worktree isolation |
|
|
105
|
-
| No `skills` preloading in agent frontmatter | ❌ Gap | Agents could have domain standards pre-injected from standards library |
|
|
106
|
-
| No `maxTurns` guard | ❌ Gap | Runaway agents not bounded |
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
### 3.3 Hooks System
|
|
111
|
-
|
|
112
|
-
**Current:**
|
|
113
|
-
```
|
|
114
|
-
framework/hooks/
|
|
115
|
-
shared/ → 4 Node.js modules (state-reader, hook-response, stdin-reader, phase-utils)
|
|
116
|
-
claude-code/
|
|
117
|
-
session-start/inject-morph-context.js
|
|
118
|
-
user-prompt/enrich-prompt.js
|
|
119
|
-
pre-tool-use/protect-readonly-files.js (deprecated — replaced by permissions.deny)
|
|
120
|
-
pre-tool-use/protect-spec-files.js
|
|
121
|
-
pre-tool-use/enforce-phase-writes.js
|
|
122
|
-
pre-tool-use/validate-bash-commands.js
|
|
123
|
-
post-tool-use/dispatch.js
|
|
124
|
-
post-tool-use/track-output-creation.js
|
|
125
|
-
post-tool-use/handle-tool-failure.js
|
|
126
|
-
pre-compact/save-morph-context.js
|
|
127
|
-
stop/validate-completion.js
|
|
128
|
-
notification/approval-reminder.js
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
**Assessment:**
|
|
132
|
-
|
|
133
|
-
| Hook | Value | Issue |
|
|
134
|
-
|---|---|---|
|
|
135
|
-
| `inject-morph-context.js` | ✅ High — state summary is unique | Partially overlaps with CLAUDE.md `@.morph/context/README.md` import; could be a `prompt`-type hook for lighter weight |
|
|
136
|
-
| `enrich-prompt.js` | ⚠️ Medium | User prompt enrichment is potentially noisy; a `UserPromptSubmit` hook with `additionalContext` is correct CC pattern |
|
|
137
|
-
| `protect-readonly-files.js` | ❌ DEAD — replaced by `permissions.deny` | Remove from installer |
|
|
138
|
-
| `protect-spec-files.js` | ✅ Legitimate — approval gate logic | Cannot be replaced by static `permissions.deny`; keep |
|
|
139
|
-
| `enforce-phase-writes.js` | ✅ High value — phase enforcement | Core morph-spec logic; irreplaceable |
|
|
140
|
-
| `validate-bash-commands.js` | ⚠️ Medium | Could use CC's `PreToolUse` with `prompt` type hook instead of custom Node.js |
|
|
141
|
-
| `track-output-creation.js` | ✅ Unique — state sync | Essential morph-specific; direct JSON I/O is correct |
|
|
142
|
-
| `dispatch.js` | ❌ Unclear | PostToolUse dispatcher — unclear what it dispatches beyond existing hooks |
|
|
143
|
-
| `handle-tool-failure.js` | ✅ Reasonable | Failure logging; CC's `PostToolUseFailure` is the right event |
|
|
144
|
-
| `save-morph-context.js` | ✅ Reasonable | Pre-compact state preservation; CC's `PreCompact` with `compact` matcher |
|
|
145
|
-
| `validate-completion.js` | ⚠️ Complexity | Stop-hook completion validation; could be `agent`-type hook with tool access |
|
|
146
|
-
| `approval-reminder.js` | ⚠️ Low value | Notification hook for approval reminders; CLAUDE.md + phase skill is sufficient |
|
|
147
|
-
| **4 shared Node.js modules** | ❌ Over-engineering | Complex infrastructure for what CC recommends as bash/jq scripts; ESM imports add startup overhead |
|
|
148
|
-
|
|
149
|
-
**The fundamental problem with the hooks architecture:**
|
|
150
|
-
|
|
151
|
-
CC recommends hooks as simple shell commands with `jq` for JSON parsing. Morph-spec has built a custom Node.js framework *around* the hooks with shared utilities, ESM modules, and an internal API (`block()`, `pass()`, `injectContext()`). This:
|
|
152
|
-
- Adds ~100ms+ startup overhead per hook invocation (Node.js + ESM)
|
|
153
|
-
- Creates a custom abstraction layer that masks what's happening from the hooks documentation
|
|
154
|
-
- Makes it hard for users to understand and modify hooks
|
|
155
|
-
- Caused the circular bug in `track-output-creation.js` (importing state-manager → subprocess)
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
### 3.4 State Machine vs CC Native Capabilities
|
|
160
|
-
|
|
161
|
-
**Current morph-spec state concepts:**
|
|
162
|
-
|
|
163
|
-
| Morph concept | CC native equivalent | Gap |
|
|
164
|
-
|---|---|---|
|
|
165
|
-
| Phase system (proposal→implement) | No direct equivalent | **Unique value** — keep |
|
|
166
|
-
| Phase approval gates | CC's `PreToolUse` hook + `block()` | **Unique value** — morph's approval gates are richer |
|
|
167
|
-
| Trust scoring (low/medium/high/maximum) | `permissions.defaultMode` (acceptEdits/askAll/plan) | **Duplication** — trust levels could map directly to CC permission modes |
|
|
168
|
-
| Task tracking (total/completed) | CC's `TaskCreate/TaskUpdate` (internal) | Partial overlap |
|
|
169
|
-
| Checkpoints (save/restore) | CC's native `/rewind` + checkpointing | **Significant overlap** — morph's checkpoint commands duplicate CC's built-in checkpointing |
|
|
170
|
-
| Feature session naming | CC's `/rename` + `--resume session-name` | **Duplication** — morph could use CC sessions as feature sessions |
|
|
171
|
-
| LLM workflow-detector | Plan Mode + user choice | Over-engineering |
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
### 3.5 Standards System
|
|
176
|
-
|
|
177
|
-
**Current:**
|
|
178
|
-
- 74 standards in `framework/standards/` organized in 11 categories
|
|
179
|
-
- `STANDARDS.json` registry with `name/id/category/tags/path`
|
|
180
|
-
- `morph-spec standards --list/--search/--show` CLI commands
|
|
181
|
-
- Scripts: `generate-standards-registry.js`
|
|
182
|
-
|
|
183
|
-
**Assessment:**
|
|
184
|
-
|
|
185
|
-
Standards are **domain knowledge** — exactly what CC skills are for. The current system implements a searchable registry with a CLI, but CC provides this through:
|
|
186
|
-
- Skill `description` field → automatic loading when relevant
|
|
187
|
-
- `/skill-name` for direct invocation
|
|
188
|
-
- Skill `user-invocable: false` for background knowledge (no slash command)
|
|
189
|
-
|
|
190
|
-
A standard like `csharp-standards.md` would be better as:
|
|
191
|
-
```yaml
|
|
192
|
-
---
|
|
193
|
-
name: csharp-standards
|
|
194
|
-
description: C# coding standards for this project. Loaded automatically when working on .cs or .csproj files.
|
|
195
|
-
user-invocable: false
|
|
196
|
-
---
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
With `paths:` scoping (via the morph `rules/` system), this is nearly identical to what morph-spec is doing manually.
|
|
200
|
-
|
|
201
|
-
The CLI registry (`--list/--search/--show`) is custom tooling for what `/agents` + skill descriptions already provide natively.
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
|
-
### 3.6 What `.claude/rules/` Actually Is
|
|
206
|
-
|
|
207
|
-
**Finding:** The `.claude/rules/` directory with path-scoped rule files is **not a native Claude Code feature** in the official documentation. The CC docs only describe:
|
|
208
|
-
- `CLAUDE.md` at various directory levels (auto-loaded)
|
|
209
|
-
- `.claude/settings.json` for permissions/hooks
|
|
210
|
-
- `.claude/skills/` and `.claude/agents/` for extensions
|
|
211
|
-
|
|
212
|
-
The morph-spec `rules/` system appears to be either:
|
|
213
|
-
1. A **CC experimental/preview feature** not yet in stable docs
|
|
214
|
-
2. A **morph-spec custom convention** that isn't actually parsed by Claude Code natively
|
|
215
|
-
|
|
216
|
-
If it's the latter, the path-scoped rules (csharp-standards.md with `paths: ["**/*.cs"]`) are written to `.claude/rules/` but have no enforcement mechanism — they'd be documentation-only. The correct CC-native alternative is **skills with `user-invocable: false`** loaded when relevant files are detected.
|
|
217
|
-
|
|
218
|
-
**Recommendation:** Verify whether `.claude/rules/` is a CC native feature. If not, migrate rules to skills with appropriate descriptions or `paths`-aware CLAUDE.md imports.
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## 4. What Morph-Spec Does Right
|
|
223
|
-
|
|
224
|
-
These are **genuinely aligned or uniquely valuable**:
|
|
225
|
-
|
|
226
|
-
1. **`enforce-phase-writes.js` hook** — phase-gated write enforcement is unique, irreplaceable, and correctly implemented as a `PreToolUse` hook
|
|
227
|
-
2. **`track-output-creation.js`** — auto-tracking spec outputs to state.json; the direct JSON I/O approach is correct
|
|
228
|
-
3. **`protect-spec-files.js`** — approval-gate-aware file protection; cannot be replaced by static `permissions.deny`
|
|
229
|
-
4. **`permissions.deny` for framework readonly** — replacing the old hook with native settings; excellent alignment
|
|
230
|
-
5. **CLAUDE.md with `@.morph/context/README.md` import** — using CC's `@` import syntax correctly
|
|
231
|
-
6. **`.claude/CLAUDE.md` runtime reference** — project-level CLAUDE.md for quick reference; correct pattern
|
|
232
|
-
7. **Skills with YAML frontmatter** — proper `name` + `description` in all skill files
|
|
233
|
-
8. **Phase system itself** — the 8-phase spec-driven workflow is unique value with no CC equivalent
|
|
234
|
-
9. **`statusline.py` → `settings.json` statusLine** — using CC's native statusline mechanism correctly
|
|
235
|
-
10. **`update-agents` command** — keeping agents in sync is a good maintenance pattern
|
|
236
|
-
|
|
237
|
-
---
|
|
238
|
-
|
|
239
|
-
## 5. What Should Be Simplified
|
|
240
|
-
|
|
241
|
-
### 5.1 Collapse the skills level hierarchy
|
|
242
|
-
|
|
243
|
-
**Current:** 5 levels (0–4), only levels 0–1 installed, installed flat
|
|
244
|
-
**Should be:** Two categories, installed as proper directories with supporting files
|
|
245
|
-
|
|
246
|
-
```
|
|
247
|
-
framework/skills/
|
|
248
|
-
meta/ → brainstorming, code-review, verification (level-0 content)
|
|
249
|
-
workflows/ → phase-proposal, phase-design, phase-implement, etc. (level-1 content)
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
Benefits:
|
|
253
|
-
- Skills installed as directories → supporting files possible → richer skills
|
|
254
|
-
- `context: fork` can be added to phase-implement for isolated execution
|
|
255
|
-
- `$ARGUMENTS` can be used: `/phase-design my-feature`
|
|
256
|
-
- `allowed-tools` can gate what each phase can do
|
|
257
|
-
- `disable-model-invocation: true` on implementation phases (don't auto-trigger)
|
|
258
|
-
|
|
259
|
-
### 5.2 Convert domain skills (level-2) to proper subagents
|
|
260
|
-
|
|
261
|
-
**Current:** `framework/skills/level-2-domains/` — 22 domain skill files never installed
|
|
262
|
-
**Should be:** Proper `.claude/agents/` files with `memory: project`
|
|
263
|
-
|
|
264
|
-
Example:
|
|
265
|
-
```markdown
|
|
266
|
-
---
|
|
267
|
-
name: blazor-builder
|
|
268
|
-
description: Blazor/.NET frontend specialist. Use proactively when working on .razor files, Blazor components, or MudBlazor UI.
|
|
269
|
-
tools: Read, Edit, Write, Bash, Grep, Glob
|
|
270
|
-
model: sonnet
|
|
271
|
-
memory: project
|
|
272
|
-
skills:
|
|
273
|
-
- csharp-standards
|
|
274
|
-
- frontend-standards
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
You are a senior Blazor/.NET developer...
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
This gives domain specialists:
|
|
281
|
-
- Persistent project memory across sessions
|
|
282
|
-
- Pre-loaded standards
|
|
283
|
-
- Proper tool access control
|
|
284
|
-
- CC's automatic delegation by description (no tier system needed)
|
|
285
|
-
|
|
286
|
-
### 5.3 Reduce the hooks Node.js framework to targeted scripts
|
|
287
|
-
|
|
288
|
-
The `shared/` modules are well-written but add unnecessary complexity. For the hooks that remain, prefer the CC-recommended pattern:
|
|
289
|
-
|
|
290
|
-
**Instead of:**
|
|
291
|
-
```js
|
|
292
|
-
import { readStdin } from '../../shared/stdin-reader.js';
|
|
293
|
-
import { block, pass } from '../../shared/hook-response.js';
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
**Use inline bash/jq:**
|
|
297
|
-
```bash
|
|
298
|
-
#!/bin/bash
|
|
299
|
-
INPUT=$(cat)
|
|
300
|
-
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
|
|
301
|
-
# ... logic ...
|
|
302
|
-
echo "reason" >&2; exit 2 # block
|
|
303
|
-
exit 0 # pass
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
Or for LLM-evaluated validation, use CC's native `type: "prompt"` hook.
|
|
307
|
-
|
|
308
|
-
### 5.4 Map trust scoring to CC permission modes
|
|
309
|
-
|
|
310
|
-
**Current:** Internal trust levels (low/medium/high/maximum) control auto-approval behavior
|
|
311
|
-
**Should be:** Map directly to CC's `permissions.defaultMode` in generated `settings.json`
|
|
312
|
-
|
|
313
|
-
| Morph trust level | CC `defaultMode` |
|
|
314
|
-
|---|---|
|
|
315
|
-
| low | `askAll` (ask for everything) |
|
|
316
|
-
| medium | `default` (standard prompting) |
|
|
317
|
-
| high | `acceptEdits` (auto-accept file edits) |
|
|
318
|
-
| maximum | `bypassPermissions` (skip all checks — use carefully) |
|
|
319
|
-
|
|
320
|
-
This eliminates the custom trust scoring machinery and makes the user's experience consistent with how CC presents permission modes.
|
|
321
|
-
|
|
322
|
-
### 5.5 Simplify workflow configs
|
|
323
|
-
|
|
324
|
-
**Current:** 10 workflow configs (fast-track, standard, full-morph, design-impl, ui-refresh, express, spec-only, zero-touch, fusion, ...)
|
|
325
|
-
**Should be:** 3–4 that map to clearly different phase sequences
|
|
326
|
-
|
|
327
|
-
The distinction between "fast-track" and "express" or "zero-touch" is subtle enough to confuse users. More workflows = more surface area for the LLM workflow-detector to get wrong. The workflow-detector's LLM call adds latency for a decision the user could make with a simple prompt.
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## 6. What Should Be Removed or Deprecated
|
|
332
|
-
|
|
333
|
-
| Item | Reason | Alternative |
|
|
334
|
-
|---|---|---|
|
|
335
|
-
| `protect-readonly-files.js` hook | Already replaced by `permissions.deny` | Already done — remove from installer |
|
|
336
|
-
| Hooks `shared/` Node.js modules | Over-engineered for bash/jq use cases | Inline bash or `type: "prompt"` CC hook |
|
|
337
|
-
| Skills "level" naming convention | CC has no tier concept; levels 2–4 never installed | Rename to `meta/` + `workflows/` |
|
|
338
|
-
| `STANDARDS.json` registry + `generate-standards-registry.js` | CLI for what CC skill descriptions provide | Migrate standards to skills; `/` menu is the registry |
|
|
339
|
-
| `morph-spec standards --list/--search/--show` commands | Replaced by CC's native skill discovery | Remove (3 CLI commands) |
|
|
340
|
-
| LLM-powered `workflow-detector.js` | Latency + complexity for a user decision | Ask via `AskUserQuestion` or Plan Mode |
|
|
341
|
-
| Trust scoring system | Maps to existing CC permission modes | Write directly to `settings.json` `defaultMode` |
|
|
342
|
-
| `dispatch.js` (PostToolUse dispatcher) | Unclear value beyond what hooks already provide | Evaluate and likely remove |
|
|
343
|
-
| `approval-reminder.js` (notification hook) | CLAUDE.md + phase workflow covers this | Remove |
|
|
344
|
-
| 10 workflow configs → simplify to ≤4 | Cognitive overhead, LLM detection errors | Merge similar workflows |
|
|
345
|
-
| `morph-spec checkpoint-save/restore/list` commands | CC has native `/rewind` + checkpointing | Deprecate; document CC's native commands |
|
|
346
|
-
|
|
347
|
-
---
|
|
348
|
-
|
|
349
|
-
## 7. How to Make Morph-Spec Truly Spec-Driven
|
|
350
|
-
|
|
351
|
-
The core promise of "spec-driven development" means the **spec file is the source of truth** for all phases. Currently, the spec exists at `.morph/features/{feature}/1-design/spec.md` but Claude has to be told to read it — there's no automatic loading mechanism.
|
|
352
|
-
|
|
353
|
-
### 7.1 Auto-load the active feature spec into every session
|
|
354
|
-
|
|
355
|
-
Use CC's `@` import syntax in `framework/CLAUDE.md` with a dynamic reference:
|
|
356
|
-
|
|
357
|
-
```markdown
|
|
358
|
-
## Active Feature Spec
|
|
359
|
-
|
|
360
|
-
The current feature spec is loaded from state:
|
|
361
|
-
|
|
362
|
-
@.morph/features/__active__/1-design/spec.md
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
Problem: CC's `@` syntax uses static paths. But the `inject-morph-context.js` hook already injects state summary. **Extend it** to also include the spec content for the active feature using `additionalContext`. This makes the spec always visible without the user needing to reference it explicitly.
|
|
366
|
-
|
|
367
|
-
### 7.2 Use `context: fork` in phase skills
|
|
368
|
-
|
|
369
|
-
Phase skills should run in isolated contexts so the implementation gets a clean view:
|
|
370
|
-
|
|
371
|
-
```yaml
|
|
372
|
-
---
|
|
373
|
-
name: phase-implement
|
|
374
|
-
description: Execute the implementation phase for a morph-spec feature
|
|
375
|
-
context: fork
|
|
376
|
-
agent: general-purpose
|
|
377
|
-
disable-model-invocation: true
|
|
378
|
-
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
379
|
-
---
|
|
380
|
-
|
|
381
|
-
Implement feature $ARGUMENTS according to its spec.
|
|
382
|
-
|
|
383
|
-
## Context loading
|
|
384
|
-
1. Read: .morph/features/$ARGUMENTS/1-design/spec.md
|
|
385
|
-
2. Read: .morph/features/$ARGUMENTS/3-tasks/tasks.md
|
|
386
|
-
3. Read: .morph/config/config.json
|
|
387
|
-
|
|
388
|
-
## Implementation rules
|
|
389
|
-
- One task at a time
|
|
390
|
-
- Checkpoint every 3 tasks via: morph-spec checkpoint-save $ARGUMENTS
|
|
391
|
-
- Mark outputs: morph-spec mark-output $ARGUMENTS recap
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
### 7.3 Enforce spec existence before implementation
|
|
395
|
-
|
|
396
|
-
Replace the complex `validate-completion.js` Stop hook with a targeted `PreToolUse` check:
|
|
397
|
-
|
|
398
|
-
```json
|
|
399
|
-
{
|
|
400
|
-
"hooks": {
|
|
401
|
-
"Stop": [{
|
|
402
|
-
"hooks": [{
|
|
403
|
-
"type": "prompt",
|
|
404
|
-
"prompt": "Check if the active morph-spec feature has completed required outputs for its phase. Read .morph/state.json. If required outputs are missing, respond {\"ok\": false, \"reason\": \"Missing: <output> at <path>\"}"
|
|
405
|
-
}]
|
|
406
|
-
}]
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
This uses CC's native `type: "prompt"` hook instead of a custom Node.js validation chain.
|
|
412
|
-
|
|
413
|
-
### 7.4 Use agent `memory: project` for standards enforcement
|
|
414
|
-
|
|
415
|
-
Domain specialist agents should accumulate project-specific pattern knowledge:
|
|
416
|
-
|
|
417
|
-
```markdown
|
|
418
|
-
---
|
|
419
|
-
name: morph-csharp-specialist
|
|
420
|
-
memory: project
|
|
421
|
-
skills:
|
|
422
|
-
- csharp-standards
|
|
423
|
-
---
|
|
424
|
-
|
|
425
|
-
Maintain your project memory with:
|
|
426
|
-
- Naming conventions discovered in this codebase
|
|
427
|
-
- Architecture patterns in use
|
|
428
|
-
- Known anti-patterns to avoid
|
|
429
|
-
- Decision log entries from .morph/features/*/1-design/decisions.md
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
---
|
|
433
|
-
|
|
434
|
-
## 8. How to Implement Native Enforcement and Validations
|
|
435
|
-
|
|
436
|
-
### 8.1 Permission rules as the first enforcement layer
|
|
437
|
-
|
|
438
|
-
Replace custom validation hooks where possible with `settings.json` rules:
|
|
439
|
-
|
|
440
|
-
```json
|
|
441
|
-
{
|
|
442
|
-
"permissions": {
|
|
443
|
-
"deny": [
|
|
444
|
-
"Write(.morph/state.json)",
|
|
445
|
-
"Edit(.morph/state.json)",
|
|
446
|
-
"Write(.morph/framework/**)",
|
|
447
|
-
"Edit(.morph/framework/**)",
|
|
448
|
-
"Bash(rm -rf .morph/**)"
|
|
449
|
-
]
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
Already implemented for state.json and framework/ — extend to cover other dangerous patterns.
|
|
455
|
-
|
|
456
|
-
### 8.2 Phase enforcement as the second layer (keep `enforce-phase-writes.js`)
|
|
457
|
-
|
|
458
|
-
This hook provides logic that `permissions.deny` cannot (it reads dynamic state). Keep it, but:
|
|
459
|
-
- Convert from Node.js ESM to a Python or bash script (lighter startup)
|
|
460
|
-
- Or use CC's `type: "agent"` hook for complex validation (CC manages the LLM call)
|
|
461
|
-
|
|
462
|
-
### 8.3 Approval gates as the third layer (keep `protect-spec-files.js`)
|
|
463
|
-
|
|
464
|
-
Keep as-is — this is unique domain logic. But convert to bash/jq for lighter execution.
|
|
465
|
-
|
|
466
|
-
### 8.4 Completion validation as a `type: "prompt"` hook (replace `validate-completion.js`)
|
|
467
|
-
|
|
468
|
-
The Stop hook that validates all required outputs are created before Claude can stop is important but currently implemented in complex Node.js. Replace with a CC native `type: "prompt"` hook that reads state.json and checks completion.
|
|
469
|
-
|
|
470
|
-
---
|
|
471
|
-
|
|
472
|
-
## 9. Concrete Action Items (Prioritized)
|
|
473
|
-
|
|
474
|
-
### High Priority — Remove dead code, align native features
|
|
475
|
-
|
|
476
|
-
1. **Remove `protect-readonly-files.js` from hooks installer** — already replaced, still installed
|
|
477
|
-
2. **Remove `dispatch.js` and `approval-reminder.js`** — low value hooks
|
|
478
|
-
3. **Convert `validate-bash-commands.js` to `type: "prompt"` hook** — use CC native LLM evaluation
|
|
479
|
-
4. **Add `$ARGUMENTS` to all phase workflow skills** — enable `/phase-design my-feature` invocation
|
|
480
|
-
5. **Add `disable-model-invocation: true` to `phase-implement` and `phase-tasks`** — prevent accidental trigger
|
|
481
|
-
6. **Install level-2-domains skills as subagents** (`.claude/agents/morph-blazor-builder.md`, etc.) with `memory: project`
|
|
482
|
-
|
|
483
|
-
### Medium Priority — Reduce infrastructure complexity
|
|
484
|
-
|
|
485
|
-
7. **Convert hooks shared modules to inline bash/jq scripts** — remove `shared/` layer
|
|
486
|
-
8. **Map trust scoring directly to `settings.json` `defaultMode`** — eliminate custom trust machinery
|
|
487
|
-
9. **Migrate standards from CLI registry to skills** with `user-invocable: false` descriptions
|
|
488
|
-
10. **Remove `morph-spec standards` CLI commands** (3 commands, replace with skill search)
|
|
489
|
-
11. **Add active feature spec to `inject-morph-context.js` payload** — truly spec-driven context
|
|
490
|
-
|
|
491
|
-
### Low Priority — Architecture improvements
|
|
492
|
-
|
|
493
|
-
12. **Rename skill levels to `meta/` + `workflows/`** — better reflects purpose, removes false hierarchy
|
|
494
|
-
13. **Add `memory: project` to all domain specialist agents** — persistent cross-session learning
|
|
495
|
-
14. **Verify `.claude/rules/` native support** — if not native, migrate to skills with `user-invocable: false`
|
|
496
|
-
15. **Reduce workflow configs from 10 to ≤4** — simplify LLM detection surface
|
|
497
|
-
16. **Replace `workflow-detector.js` LLM call with user question** — use `AskUserQuestion` in phase-setup skill
|
|
498
|
-
|
|
499
|
-
---
|
|
500
|
-
|
|
501
|
-
## 10. Summary Assessment
|
|
502
|
-
|
|
503
|
-
| Area | Current State | Target State |
|
|
504
|
-
|---|---|---|
|
|
505
|
-
| Skills | 2-level deployment, flat, missing CC features | 2-category dirs, `$ARGUMENTS`, `context: fork`, `disable-model-invocation` |
|
|
506
|
-
| Agents | Tier 1+2 only, no `memory`, no `isolation` | All domain specialists as agents with `memory: project` + `skills` preload |
|
|
507
|
-
| Hooks | Node.js ESM framework, 12 hooks, 4 shared modules | Bash/jq or `type: "prompt"` hooks, 7 core hooks, no shared modules |
|
|
508
|
-
| Permissions | `permissions.deny` for state+framework | Extended deny rules + mapped `defaultMode` from trust levels |
|
|
509
|
-
| Standards | CLI registry + 74 standards | Skills with `user-invocable: false` + path descriptions |
|
|
510
|
-
| State machine | Full phase gating + trust scoring + LLM detection | Keep phase gating, simplify trust → CC modes, remove LLM detection |
|
|
511
|
-
| Spec-driven | Spec exists but not auto-loaded | Spec auto-injected via SessionStart hook additionalContext |
|
|
512
|
-
| Dead code | 31 agents never installed, 22 skills never deployed, 10 workflows | Remove or deploy everything that's built |
|
|
513
|
-
|
|
514
|
-
The framework's **unique value** is the spec-driven phase workflow with approval gates, phase-write enforcement, and output tracking. All of this should be preserved and sharpened. The infrastructure around it should be dramatically simplified by leaning on what Claude Code provides natively.
|