@polymorphism-tech/morph-spec 4.22.0 → 6.0.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/CLAUDE.md +57 -71
- package/README.md +2 -2
- package/bin/morph-spec.js +224 -491
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +55 -38
- package/framework/MORPH.md +244 -0
- package/framework/agents.json +127 -1198
- package/framework/commands/morph-apply.md +56 -240
- package/framework/commands/morph-archive.md +48 -85
- package/framework/commands/morph-preflight.md +7 -7
- package/framework/commands/morph-proposal.md +35 -191
- package/framework/commands/morph-status.md +19 -50
- package/framework/commands/morph-troubleshoot.md +2 -2
- package/framework/evals/rubrics/README.md +44 -0
- package/framework/evals/rubrics/architecture.md +46 -0
- package/framework/evals/rubrics/code-quality.md +50 -0
- package/framework/evals/rubrics/contracts.md +47 -0
- package/framework/evals/rubrics/test-coverage.md +50 -0
- package/framework/evals/scenarios/dotnet-crud.yaml +42 -0
- package/framework/evals/scenarios/nextjs-auth.yaml +38 -0
- package/framework/evals/suites/standard.yaml +5 -0
- package/framework/evals/trace-schema.md +67 -0
- package/framework/hooks/claude-code/core/README.md +3 -0
- package/framework/hooks/claude-code/core/denylist.json +14 -0
- package/framework/hooks/claude-code/{pre-tool-use → core}/enforce-phase-writes.js +5 -5
- package/framework/hooks/claude-code/core/post-edit-typecheck.js +69 -0
- package/framework/hooks/claude-code/core/pre-bash-denylist.js +29 -0
- package/framework/hooks/claude-code/{pre-tool-use → core}/protect-spec-files.js +4 -6
- package/framework/hooks/claude-code/{stop → core}/validate-completion.js +13 -82
- package/framework/hooks/shared/phase-utils.js +20 -31
- package/framework/hooks/shared/state-reader.js +4 -5
- package/framework/{skills/level-0-meta/mcp-registry.json → mcp/registry.json} +254 -243
- package/framework/phases.json +41 -115
- package/framework/rubrics/eval-rubric.json +66 -0
- package/framework/skills/README.md +39 -64
- package/framework/skills/core/README.md +3 -0
- package/framework/skills/core/morph-brainstorming/SKILL.md +102 -0
- package/framework/skills/core/morph-eval/SKILL.md +57 -0
- package/framework/skills/core/morph-implement/SKILL.md +83 -0
- package/framework/skills/core/morph-plan/SKILL.md +64 -0
- package/framework/skills/core/morph-review/SKILL.md +62 -0
- package/framework/skills/core/morph-stack-scan/SKILL.md +109 -0
- package/framework/skills/core/morph-standards/SKILL.md +49 -0
- package/framework/templates/CLAUDE.md.core.guide.md +29 -0
- package/framework/templates/CLAUDE.md.core.template +22 -0
- package/framework/templates/REGISTRY.json +4 -4
- package/framework/workflows/configs/fast-track.json +5 -10
- package/framework/workflows/configs/full.json +4 -8
- package/framework/workflows/configs/quick.json +32 -0
- package/framework/workflows/configs/standard.json +57 -64
- package/package.json +7 -6
- package/src/commands/mcp/mcp-setup.js +58 -31
- package/src/commands/project/doctor.js +69 -70
- package/src/commands/project/init.js +26 -5
- package/src/commands/project/status.js +18 -19
- package/src/commands/state/approve.js +1 -1
- package/src/commands/validation/validate-feature.js +18 -112
- package/src/core/paths/output-schema.js +133 -152
- package/src/core/state/phase-state-machine.js +10 -24
- package/src/core/state/state-manager.js +17 -17
- package/src/core/workflows/workflow-detector.js +214 -31
- package/src/core/workflows/workflow-router.js +204 -0
- package/src/dashboard/app/pages/AgentMap.jsx +32 -33
- package/src/dashboard/app/pages/LiveState.jsx +1 -1
- package/src/dashboard/app/pages/PhasePipeline.jsx +2 -4
- package/src/dashboard/app/pages/SkillsLibrary.jsx +2 -3
- package/src/dashboard/app/pages/Workflows.jsx +2 -2
- package/src/dashboard/scanner/agents-scanner.js +30 -35
- package/src/lib/agents/metrics-aggregator.js +1 -1
- package/src/lib/agents/output-collector.js +7 -9
- package/src/lib/context/context-builder.js +289 -0
- package/src/lib/detectors/claude-config-detector.js +19 -3
- package/src/lib/generators/context-generator.js +20 -42
- package/src/lib/generators/index.js +1 -0
- package/src/lib/generators/mandate-generator.js +512 -0
- package/src/lib/generators/metadata-extractor.js +1 -1
- package/src/lib/generators/recap-generator.js +3 -4
- package/src/lib/installers/mcp-installer.js +300 -92
- package/src/lib/phase-chain/phase-validator.js +36 -40
- package/src/lib/stack/stack-profile.js +74 -91
- package/src/lib/tasks/task-parser.js +1 -1
- package/src/lib/tasks/wave-resolver.js +353 -0
- package/src/lib/validators/checkpoint-persistence.js +2 -2
- package/src/lib/validators/content/cross-phase-validator.js +281 -0
- package/src/lib/validators/content/index.js +1 -0
- package/src/lib/validators/shared/emit-validator-dispatch.js +6 -56
- package/src/scripts/global-install.js +2 -27
- package/src/utils/agents-installer.js +224 -447
- package/src/utils/claude-settings-manager.js +57 -15
- package/src/utils/file-copier.js +1 -0
- package/src/utils/hooks-installer.js +15 -117
- package/src/utils/skills-installer.js +12 -18
- package/bin/detect-agents.js +0 -226
- package/bin/task-manager.js +0 -1036
- package/framework/agents/README.md +0 -13
- package/framework/agents/ai-agents/ai-system-architect.md +0 -194
- package/framework/agents/ai-agents/vector-search-expert.md +0 -247
- package/framework/agents/architecture/architecture-expert.md +0 -98
- package/framework/agents/architecture/morph-spec-architect.md +0 -66
- package/framework/agents/architecture/packages-validator.md +0 -89
- package/framework/agents/architecture/security-expert.md +0 -79
- package/framework/agents/architecture/seo-growth-hacker.md +0 -168
- package/framework/agents/architecture/standards-architect.md +0 -153
- package/framework/agents/backend/dotnet-senior.md +0 -163
- package/framework/agents/backend/ef-modeler.md +0 -119
- package/framework/agents/backend/hangfire-orchestrator.md +0 -133
- package/framework/agents/backend/ms-agent-expert.md +0 -55
- package/framework/agents/backend/neon-expert.md +0 -379
- package/framework/agents/frontend/css-specialist.md +0 -89
- package/framework/agents/frontend/design-system-validator.md +0 -100
- package/framework/agents/frontend/gsap-animator.md +0 -131
- package/framework/agents/frontend/nextjs-component-validator.md +0 -97
- package/framework/agents/frontend/nextjs-expert.md +0 -201
- package/framework/agents/frontend/ui-designer.md +0 -259
- package/framework/agents/infrastructure/infra-architect.md +0 -215
- package/framework/agents/integrations/asaas-financial.md +0 -138
- package/framework/agents/integrations/neon-auth.md +0 -151
- package/framework/agents/integrations/resend-email.md +0 -127
- package/framework/hooks/claude-code/post-tool-use/agent-complete.js +0 -122
- package/framework/hooks/claude-code/post-tool-use/dispatch.js +0 -363
- package/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +0 -78
- package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +0 -194
- package/framework/hooks/claude-code/pre-compact/save-morph-context.js +0 -199
- package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +0 -55
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +0 -323
- package/framework/hooks/claude-code/session-start/post-compact-restore.js +0 -41
- package/framework/hooks/claude-code/session-start/resume-context.js +0 -77
- package/framework/hooks/claude-code/teammate-idle/teammate-idle.js +0 -90
- package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +0 -114
- package/framework/hooks/shared/compact-restore.js +0 -123
- package/framework/hooks/shared/dispatch-helpers.js +0 -147
- package/framework/hooks/shared/skill-reminder-helpers.js +0 -79
- package/framework/hooks/shared/stale-task-reset.js +0 -57
- package/framework/hooks/shared/worktree-helpers.js +0 -75
- package/framework/skills/level-0-meta/README.md +0 -7
- package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +0 -472
- package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +0 -174
- package/framework/skills/level-0-meta/morph-brainstorming/references/proposal-example.md +0 -138
- package/framework/skills/level-0-meta/morph-checklist/SKILL.md +0 -145
- package/framework/skills/level-0-meta/morph-code-review/SKILL.md +0 -250
- package/framework/skills/level-0-meta/morph-code-review/references/review-example.md +0 -164
- package/framework/skills/level-0-meta/morph-code-review/references/review-guidelines.md +0 -100
- package/framework/skills/level-0-meta/morph-code-review/scripts/scan-csharp.mjs +0 -151
- package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +0 -165
- package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +0 -254
- package/framework/skills/level-0-meta/morph-code-review-nextjs/scripts/scan-nextjs.mjs +0 -189
- package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +0 -344
- package/framework/skills/level-0-meta/morph-frontend-review/scripts/scan-accessibility.mjs +0 -376
- package/framework/skills/level-0-meta/morph-gemini-image/SKILL.md +0 -290
- package/framework/skills/level-0-meta/morph-init/SKILL.md +0 -537
- package/framework/skills/level-0-meta/morph-parallel-dispatch/SKILL.md +0 -225
- package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +0 -401
- package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-dev-server.mjs +0 -153
- package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-stack.mjs +0 -234
- package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +0 -106
- package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +0 -243
- package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +0 -169
- package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +0 -148
- package/framework/skills/level-0-meta/morph-verification-before-completion/scripts/check-phase-outputs.mjs +0 -110
- package/framework/skills/level-1-workflows/README.md +0 -7
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +0 -269
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +0 -453
- package/framework/skills/level-1-workflows/morph-phase-design/references/architecture-analysis-guide.md +0 -44
- package/framework/skills/level-1-workflows/morph-phase-design/references/spec-authoring-guide.md +0 -55
- package/framework/skills/level-1-workflows/morph-phase-design/references/spec-example.md +0 -253
- package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +0 -634
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +0 -50
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +0 -54
- package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +0 -47
- package/framework/skills/level-1-workflows/morph-phase-implement/references/recap-example.md +0 -132
- package/framework/skills/level-1-workflows/morph-phase-implement/references/vsa-implementation-guide.md +0 -92
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +0 -257
- package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +0 -291
- package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +0 -143
- package/framework/skills/level-1-workflows/morph-phase-tasks/references/tasks-example.md +0 -404
- package/framework/skills/level-1-workflows/morph-phase-tasks/scripts/validate-tasks.mjs +0 -112
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +0 -995
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +0 -147
- package/framework/squad-templates/backend-only.json +0 -47
- package/framework/squad-templates/frontend-only.json +0 -56
- package/framework/squad-templates/full-stack.json +0 -74
- package/src/commands/agents/agent-metrics.js +0 -174
- package/src/commands/agents/audit-dispatch.js +0 -82
- package/src/commands/agents/detect-agents.js +0 -275
- package/src/commands/agents/dispatch-agents.js +0 -461
- package/src/commands/agents/index.js +0 -13
- package/src/commands/agents/manage-agents.js +0 -352
- package/src/commands/agents/project-metrics.js +0 -74
- package/src/commands/phase/phase-reset.js +0 -74
- package/src/commands/scope/escalate.js +0 -217
- package/src/commands/state/advance-phase.js +0 -600
- package/src/commands/state/phase-runner.js +0 -215
- package/src/commands/state/state.js +0 -444
- package/src/commands/task/expand.js +0 -100
- package/src/commands/tasks/index.js +0 -4
- package/src/commands/tasks/task.js +0 -105
- package/src/commands/templates/index.js +0 -5
- package/src/commands/templates/template-render.js +0 -93
- package/src/commands/trust/trust.js +0 -118
- package/src/lib/agents/agents-manager.js +0 -349
- package/src/lib/build/build-runner.js +0 -99
- package/src/lib/checkpoints/checkpoint-hooks.js +0 -111
- package/src/lib/contracts/sprint-contract-generator.js +0 -137
- package/src/lib/scope/impact-analyzer.js +0 -106
- package/src/lib/trust/trust-manager.js +0 -157
- package/src/utils/tier-helpers.js +0 -24
- /package/framework/hooks/claude-code/{post-tool-use → core}/loop-detect.js +0 -0
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: morph-scope-escalation
|
|
3
|
-
description: Guided workflow for mid-implementation scope escalation — analyzes complexity discovery, recommends action, and executes phase regression or task expansion
|
|
4
|
-
user-invocable: true
|
|
5
|
-
argument-hint: "[feature-name]"
|
|
6
|
-
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
7
|
-
cliVersion: "4.22.0"
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Scope Escalation Workflow
|
|
11
|
-
|
|
12
|
-
Use this skill when a task during implementation reveals significantly more complexity than estimated.
|
|
13
|
-
|
|
14
|
-
## Prerequisites
|
|
15
|
-
|
|
16
|
-
- Feature must be in `implement` phase
|
|
17
|
-
- You must have identified a specific task that triggered the discovery
|
|
18
|
-
|
|
19
|
-
## Workflow
|
|
20
|
-
|
|
21
|
-
### Step 1: COLLECT Evidence
|
|
22
|
-
|
|
23
|
-
Use `AskUserQuestion` to gather the details:
|
|
24
|
-
|
|
25
|
-
```json
|
|
26
|
-
{
|
|
27
|
-
"questions": [
|
|
28
|
-
{
|
|
29
|
-
"header": "Task ID",
|
|
30
|
-
"question": "Which task triggered the complexity discovery?",
|
|
31
|
-
"multiSelect": false,
|
|
32
|
-
"options": [
|
|
33
|
-
{ "label": "T001", "description": "First task" },
|
|
34
|
-
{ "label": "T002", "description": "Second task" },
|
|
35
|
-
{ "label": "Other", "description": "Type the task ID" }
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"header": "Discovery",
|
|
40
|
-
"question": "What complexity did you discover?",
|
|
41
|
-
"multiSelect": true,
|
|
42
|
-
"options": [
|
|
43
|
-
{ "label": "Hidden dependencies", "description": "More systems involved than spec assumed" },
|
|
44
|
-
{ "label": "Wrong assumptions", "description": "Spec assumed simpler architecture" },
|
|
45
|
-
{ "label": "Missing abstractions", "description": "Need new patterns/interfaces not in contracts" },
|
|
46
|
-
{ "label": "Other", "description": "Describe the discovery" }
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
> Populate the Task ID options dynamically from the feature's `tasks.md`. After receiving answers, **read the relevant code files** to verify the evidence before classifying.
|
|
54
|
-
|
|
55
|
-
### Step 2: ANALYZE Impact
|
|
56
|
-
|
|
57
|
-
Run dry-run analysis:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
morph-spec scope escalate <feature> --task <id> --reason "<reason>" --dry-run
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Read the recommendation output. Additionally:
|
|
64
|
-
|
|
65
|
-
- Read `tasks.md` to understand which tasks are affected
|
|
66
|
-
- Read `spec.md` to check if the spec assumed simpler architecture
|
|
67
|
-
- Check completed tasks for potential impact
|
|
68
|
-
|
|
69
|
-
### Step 3: CLASSIFY and PROPOSE
|
|
70
|
-
|
|
71
|
-
Present the recommendation to the user:
|
|
72
|
-
|
|
73
|
-
| Impact | Action | When |
|
|
74
|
-
|--------|--------|------|
|
|
75
|
-
| **Low** (1-3 tasks) | Task Expansion | The task is bigger than expected, but scope is contained |
|
|
76
|
-
| **Medium** (4+ tasks, spec ok) | Regress to tasks | Multiple tasks need rewriting, but the spec is correct |
|
|
77
|
-
| **High** (spec wrong) | Regress to design | The spec made incorrect assumptions about the codebase |
|
|
78
|
-
|
|
79
|
-
Explain WHY you recommend this classification based on the evidence.
|
|
80
|
-
|
|
81
|
-
### Step 4: APPROVE
|
|
82
|
-
|
|
83
|
-
Pause and wait for user confirmation using `AskUserQuestion`:
|
|
84
|
-
|
|
85
|
-
```json
|
|
86
|
-
{
|
|
87
|
-
"questions": [
|
|
88
|
-
{
|
|
89
|
-
"header": "Severity",
|
|
90
|
-
"question": "Impact classified as {LOW|MEDIUM|HIGH}. Do you agree?",
|
|
91
|
-
"multiSelect": false,
|
|
92
|
-
"options": [
|
|
93
|
-
{ "label": "Agree", "description": "Classification is correct" },
|
|
94
|
-
{ "label": "Override", "description": "I think the impact is different" }
|
|
95
|
-
]
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"header": "Action",
|
|
99
|
-
"question": "Recommended action: {action}. Proceed?",
|
|
100
|
-
"multiSelect": false,
|
|
101
|
-
"options": [
|
|
102
|
-
{ "label": "Proceed", "description": "{action description}" },
|
|
103
|
-
{ "label": "Different target", "description": "I want to regress to a different phase" },
|
|
104
|
-
{ "label": "Cancel", "description": "Do not escalate — continue as-is" }
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
**DO NOT proceed without explicit user approval.** If user chooses "Cancel", stop the workflow entirely.
|
|
112
|
-
|
|
113
|
-
### Step 5: EXECUTE
|
|
114
|
-
|
|
115
|
-
Based on approved action:
|
|
116
|
-
|
|
117
|
-
**For expansion (low impact):**
|
|
118
|
-
```bash
|
|
119
|
-
morph-spec task expand <feature> <task-id> --into "T017a: <title>" "T017b: <title>" ...
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**For regression (medium/high impact):**
|
|
123
|
-
```bash
|
|
124
|
-
morph-spec scope escalate <feature> --task <id> --reason "<reason>"
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Or with target override:
|
|
128
|
-
```bash
|
|
129
|
-
morph-spec scope escalate <feature> --task <id> --reason "<reason>" --target design
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Step 6: GUIDE Next Steps
|
|
133
|
-
|
|
134
|
-
After escalation:
|
|
135
|
-
|
|
136
|
-
- **If regressed to tasks:** "Re-analyze the affected tasks. Rewrite tasks.md with accurate scope. Run `/morph-proposal <feature>` to continue from the tasks phase."
|
|
137
|
-
- **If regressed to design:** "Re-analyze the spec. Update spec.md with the discovered architecture. Then regenerate tasks."
|
|
138
|
-
- **If expanded:** "Continue implementing. Use `morph-spec task start <feature> <sub-task-id>` to start the first sub-task."
|
|
139
|
-
|
|
140
|
-
Always remind: "Completed tasks flagged with `needsReview` should be checked for compatibility with the new scope."
|
|
141
|
-
|
|
142
|
-
## Anti-Patterns
|
|
143
|
-
|
|
144
|
-
- **DO NOT** skip the approval step
|
|
145
|
-
- **DO NOT** escalate without evidence — read the actual code first
|
|
146
|
-
- **DO NOT** regress to design when only tasks need rewriting
|
|
147
|
-
- **DO NOT** expand when 4+ tasks are affected — regress instead
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "backend-only",
|
|
3
|
-
"name": "Backend Squad",
|
|
4
|
-
"description": "Backend-focused squad: API + data + domain logic",
|
|
5
|
-
"parallel": true,
|
|
6
|
-
"coordination": "dotnet-senior",
|
|
7
|
-
"waitForAll": true,
|
|
8
|
-
"agents": [
|
|
9
|
-
{
|
|
10
|
-
"id": "dotnet-senior",
|
|
11
|
-
"role": "Backend Squad Leader",
|
|
12
|
-
"domain": "backend",
|
|
13
|
-
"standards": ["coding.md", "architecture.md", "dotnet10-compatibility.md"]
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"id": "ef-modeler",
|
|
17
|
-
"role": "Database/EF Core Layer",
|
|
18
|
-
"domain": "backend",
|
|
19
|
-
"standards": ["coding.md", "ef-core.md"]
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"id": "hangfire-orchestrator",
|
|
23
|
-
"role": "Background Jobs & Scheduling",
|
|
24
|
-
"domain": "backend",
|
|
25
|
-
"standards": ["coding.md"]
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"deliverables": {
|
|
29
|
-
"dotnet-senior": "Application services, business logic, command/query handlers, API endpoints, DTOs",
|
|
30
|
-
"ef-modeler": "Entity models, DbContext, migrations",
|
|
31
|
-
"hangfire-orchestrator": "Background jobs, recurring tasks, job scheduling"
|
|
32
|
-
},
|
|
33
|
-
"estimatedParallelGain": "2-3x throughput vs sequential",
|
|
34
|
-
"agent_team": {
|
|
35
|
-
"team_name_pattern": "{feature}-backend",
|
|
36
|
-
"lead": "standards-architect",
|
|
37
|
-
"teammates": [
|
|
38
|
-
{
|
|
39
|
-
"id": "dotnet-senior",
|
|
40
|
-
"spawn_context": "standards/coding.md, standards/architecture/, contracts.cs, spec.md",
|
|
41
|
-
"task_scope": "backend tasks (domain logic, application services, EF Core, API endpoints, DTOs, background jobs)"
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
"coordination_notes": "Single-domain squad — Agent Teams not required. Use subagents for parallelization.",
|
|
45
|
-
"quality_gate": "Require plan approval before implementation. Only approve plans that match contracts.cs."
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "frontend-only",
|
|
3
|
-
"name": "Frontend Squad",
|
|
4
|
-
"description": "Frontend-focused squad: UI components + CSS + UX",
|
|
5
|
-
"parallel": true,
|
|
6
|
-
"coordination": "ui-designer",
|
|
7
|
-
"waitForAll": true,
|
|
8
|
-
"agents": [
|
|
9
|
-
{
|
|
10
|
-
"id": "ui-designer",
|
|
11
|
-
"role": "UI Design Lead",
|
|
12
|
-
"domain": "frontend",
|
|
13
|
-
"standards": [
|
|
14
|
-
"css-architecture.md",
|
|
15
|
-
"css-design-system.md"
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"id": "nextjs-expert",
|
|
20
|
-
"role": "Frontend Developer",
|
|
21
|
-
"domain": "frontend",
|
|
22
|
-
"standards": [
|
|
23
|
-
"coding.md",
|
|
24
|
-
"nextjs-components.md"
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"id": "css-specialist",
|
|
29
|
-
"role": "CSS/Design System Specialist",
|
|
30
|
-
"domain": "frontend",
|
|
31
|
-
"standards": [
|
|
32
|
-
"css-architecture.md",
|
|
33
|
-
"css-design-system.md"
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
],
|
|
37
|
-
"deliverables": {
|
|
38
|
-
"ui-designer": "Design system tokens, component specs, mockup annotations",
|
|
39
|
-
"nextjs-expert": "React components, pages, state management",
|
|
40
|
-
"css-specialist": "CSS modules, design system implementation, responsive layout"
|
|
41
|
-
},
|
|
42
|
-
"estimatedParallelGain": "2x throughput vs sequential",
|
|
43
|
-
"agent_team": {
|
|
44
|
-
"team_name_pattern": "{feature}-frontend",
|
|
45
|
-
"lead": "standards-architect",
|
|
46
|
-
"teammates": [
|
|
47
|
-
{
|
|
48
|
-
"id": "ui-designer",
|
|
49
|
-
"spawn_context": "standards/css-architecture.md, standards/css-design-system.md, design-system.md, spec.md",
|
|
50
|
-
"task_scope": "frontend tasks (UI components, CSS, design system implementation, responsive layout)"
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
"coordination_notes": "Single-domain squad — Agent Teams not required. Use subagents for parallelization.",
|
|
54
|
-
"quality_gate": "Require plan approval before implementation. Only approve plans that match spec.md and design-system.md."
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "full-stack",
|
|
3
|
-
"name": "Full Stack Squad",
|
|
4
|
-
"description": "Full-stack feature squad: backend API + frontend + infra",
|
|
5
|
-
"parallel": true,
|
|
6
|
-
"coordination": "standards-architect",
|
|
7
|
-
"waitForAll": true,
|
|
8
|
-
"agents": [
|
|
9
|
-
{
|
|
10
|
-
"id": "dotnet-senior",
|
|
11
|
-
"role": "Backend Squad Leader",
|
|
12
|
-
"domain": "backend",
|
|
13
|
-
"standards": [
|
|
14
|
-
"coding.md",
|
|
15
|
-
"architecture.md",
|
|
16
|
-
"dotnet10-compatibility.md"
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"id": "nextjs-expert",
|
|
21
|
-
"role": "Frontend Developer",
|
|
22
|
-
"domain": "frontend",
|
|
23
|
-
"standards": [
|
|
24
|
-
"coding.md",
|
|
25
|
-
"nextjs-components.md"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"id": "infra-architect",
|
|
30
|
-
"role": "Infrastructure Engineer",
|
|
31
|
-
"domain": "infrastructure",
|
|
32
|
-
"standards": [
|
|
33
|
-
"infrastructure.md"
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"id": "css-specialist",
|
|
38
|
-
"role": "Design System & CSS",
|
|
39
|
-
"domain": "frontend",
|
|
40
|
-
"standards": [
|
|
41
|
-
"css-design-system.md"
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"deliverables": {
|
|
46
|
-
"backend": "Services, controllers, DTOs, EF Core entities",
|
|
47
|
-
"frontend": "Next.js components, pages, CSS, design system",
|
|
48
|
-
"infrastructure": "IaC templates, deployment scripts"
|
|
49
|
-
},
|
|
50
|
-
"estimatedParallelGain": "3-5x throughput vs sequential",
|
|
51
|
-
"agent_team": {
|
|
52
|
-
"team_name_pattern": "{feature}-full-stack",
|
|
53
|
-
"lead": "standards-architect",
|
|
54
|
-
"teammates": [
|
|
55
|
-
{
|
|
56
|
-
"id": "dotnet-senior",
|
|
57
|
-
"spawn_context": "standards/coding.md, standards/architecture/, contracts.cs, spec.md",
|
|
58
|
-
"task_scope": "backend tasks (domain logic, EF Core, API endpoints, DTOs)"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"id": "nextjs-expert",
|
|
62
|
-
"spawn_context": "standards/coding.md, standards/nextjs-components.md, design-system.md, spec.md",
|
|
63
|
-
"task_scope": "frontend tasks (pages, components, CSS, state management)"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"id": "infra-architect",
|
|
67
|
-
"spawn_context": "standards/infrastructure.md, spec.md",
|
|
68
|
-
"task_scope": "infrastructure tasks (IaC templates, cloud resources, deployments)"
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
"coordination_notes": "Backend deve sinalizar quando contracts.cs/DTOs estiverem estáveis antes do frontend prosseguir com chamadas de API. Infrastructure pode executar em paralelo com backend/frontend.",
|
|
72
|
-
"quality_gate": "Require plan approval before each teammate implements. Only approve plans that match contracts.cs and spec.md."
|
|
73
|
-
}
|
|
74
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* agent-metrics — Display agent performance metrics for a feature
|
|
3
|
-
*
|
|
4
|
-
* Reads dispatchLog from state.json, computes per-agent metrics
|
|
5
|
-
* (dispatch count, task coverage, completion rate, avg duration),
|
|
6
|
-
* and renders a table or JSON output.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* morph-spec agent-metrics <feature>
|
|
10
|
-
* morph-spec agent-metrics <feature> --json
|
|
11
|
-
* morph-spec agent-metrics --all
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { loadState, stateExists } from '../../core/state/state-manager.js';
|
|
15
|
-
import { calculateMetrics, calculateAggregatedMetrics, formatDuration } from '../../lib/agents/metrics-calculator.js';
|
|
16
|
-
import chalk from 'chalk';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* CLI command: morph-spec agent-metrics [feature]
|
|
20
|
-
*
|
|
21
|
-
* @param {string} [featureName] - Feature name (required unless --all)
|
|
22
|
-
* @param {Object} [options] - CLI options
|
|
23
|
-
* @param {boolean} [options.json] - Output as JSON instead of table
|
|
24
|
-
* @param {boolean} [options.all] - Aggregate metrics across all features
|
|
25
|
-
*/
|
|
26
|
-
export async function agentMetricsCommand(featureName, options = {}) {
|
|
27
|
-
if (!options.all && !featureName) {
|
|
28
|
-
console.error(chalk.red('Usage: morph-spec agent-metrics <feature> [--json] [--all]'));
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (!stateExists()) {
|
|
33
|
-
console.error(chalk.red('No state.json found.'));
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const state = loadState();
|
|
38
|
-
|
|
39
|
-
if (options.all) {
|
|
40
|
-
return renderAggregated(state.features || {}, options);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const feature = state.features?.[featureName];
|
|
44
|
-
if (!feature) {
|
|
45
|
-
console.error(chalk.red(`Feature '${featureName}' not found.`));
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const log = feature.dispatchLog || [];
|
|
50
|
-
if (log.length === 0) {
|
|
51
|
-
console.log(chalk.gray('\n No dispatch events recorded.\n'));
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const result = calculateMetrics(log);
|
|
56
|
-
result.feature = featureName;
|
|
57
|
-
|
|
58
|
-
if (options.json) {
|
|
59
|
-
console.log(JSON.stringify(result, null, 2));
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
renderTable(featureName, result);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Render per-feature metrics table.
|
|
68
|
-
*/
|
|
69
|
-
function renderTable(featureName, result) {
|
|
70
|
-
const { agents, summary } = result;
|
|
71
|
-
|
|
72
|
-
console.log(chalk.bold(`\n Agent Performance \u2014 ${featureName}`));
|
|
73
|
-
console.log(' ' + '\u2500'.repeat(70));
|
|
74
|
-
|
|
75
|
-
// Header
|
|
76
|
-
console.log(
|
|
77
|
-
' ' +
|
|
78
|
-
pad('Agent', 28) +
|
|
79
|
-
pad('Dispatches', 12) +
|
|
80
|
-
pad('Tasks', 8) +
|
|
81
|
-
pad('Completed', 12) +
|
|
82
|
-
pad('Avg Duration', 14)
|
|
83
|
-
);
|
|
84
|
-
console.log(' ' + '\u2500'.repeat(70));
|
|
85
|
-
|
|
86
|
-
for (const agent of agents) {
|
|
87
|
-
const tasks = agent.tasksAssigned > 0 ? String(agent.tasksAssigned) : '\u2014';
|
|
88
|
-
const completed = agent.tasksAssigned > 0
|
|
89
|
-
? `${agent.tasksCompleted}/${agent.tasksAssigned}`
|
|
90
|
-
: '\u2014';
|
|
91
|
-
const duration = formatDuration(agent.avgDurationMs);
|
|
92
|
-
|
|
93
|
-
console.log(
|
|
94
|
-
' ' +
|
|
95
|
-
pad(agent.id, 28) +
|
|
96
|
-
pad(String(agent.dispatches), 12) +
|
|
97
|
-
pad(tasks, 8) +
|
|
98
|
-
pad(completed, 12) +
|
|
99
|
-
pad(duration, 14)
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
console.log();
|
|
104
|
-
const rate = summary.totalTasks > 0
|
|
105
|
-
? `${Math.round(summary.completionRate * 100)}%`
|
|
106
|
-
: '0%';
|
|
107
|
-
console.log(` Summary: ${summary.completedTasks} tasks completed of ${summary.totalTasks} (${rate}), avg ${formatDuration(summary.avgTaskDurationMs)}/task`);
|
|
108
|
-
console.log(` Dispatches: ${summary.totalDispatches} total`);
|
|
109
|
-
console.log();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Render aggregated metrics across all features.
|
|
114
|
-
*/
|
|
115
|
-
function renderAggregated(features, options) {
|
|
116
|
-
const featureNames = Object.keys(features);
|
|
117
|
-
if (featureNames.length === 0) {
|
|
118
|
-
console.log(chalk.gray('\n No features found.\n'));
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const result = calculateAggregatedMetrics(features);
|
|
123
|
-
|
|
124
|
-
if (options.json) {
|
|
125
|
-
console.log(JSON.stringify(result, null, 2));
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
console.log(chalk.bold(`\n Agent Performance \u2014 All Features (${result.featureCount})`));
|
|
130
|
-
console.log(' ' + '\u2500'.repeat(70));
|
|
131
|
-
|
|
132
|
-
console.log(
|
|
133
|
-
' ' +
|
|
134
|
-
pad('Agent', 28) +
|
|
135
|
-
pad('Dispatches', 12) +
|
|
136
|
-
pad('Tasks', 8) +
|
|
137
|
-
pad('Completed', 12) +
|
|
138
|
-
pad('Avg Duration', 14)
|
|
139
|
-
);
|
|
140
|
-
console.log(' ' + '\u2500'.repeat(70));
|
|
141
|
-
|
|
142
|
-
for (const agent of result.agents) {
|
|
143
|
-
const tasks = agent.tasksAssigned > 0 ? String(agent.tasksAssigned) : '\u2014';
|
|
144
|
-
const completed = agent.tasksAssigned > 0
|
|
145
|
-
? `${agent.tasksCompleted}/${agent.tasksAssigned}`
|
|
146
|
-
: '\u2014';
|
|
147
|
-
const duration = formatDuration(agent.avgDurationMs);
|
|
148
|
-
|
|
149
|
-
console.log(
|
|
150
|
-
' ' +
|
|
151
|
-
pad(agent.id, 28) +
|
|
152
|
-
pad(String(agent.dispatches), 12) +
|
|
153
|
-
pad(tasks, 8) +
|
|
154
|
-
pad(completed, 12) +
|
|
155
|
-
pad(duration, 14)
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
console.log();
|
|
160
|
-
const { summary } = result;
|
|
161
|
-
const rate = summary.totalTasks > 0
|
|
162
|
-
? `${Math.round(summary.completionRate * 100)}%`
|
|
163
|
-
: '0%';
|
|
164
|
-
console.log(` Summary: ${summary.completedTasks} tasks completed of ${summary.totalTasks} (${rate}), avg ${formatDuration(summary.avgTaskDurationMs)}/task`);
|
|
165
|
-
console.log(` Dispatches: ${summary.totalDispatches} total across ${result.featureCount} features`);
|
|
166
|
-
console.log();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Right-pad a string to a given width.
|
|
171
|
-
*/
|
|
172
|
-
function pad(str, width) {
|
|
173
|
-
return str.length >= width ? str : str + ' '.repeat(width - str.length);
|
|
174
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* audit-dispatch — Display dispatch audit log for a feature
|
|
3
|
-
*
|
|
4
|
-
* Reads dispatchLog from state.json and presents a summary:
|
|
5
|
-
* - Total dispatches
|
|
6
|
-
* - Per-dispatch: timestamp, phase, mode, agents with subagentTypes
|
|
7
|
-
* - Agent coverage: which agents handled which tasks
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* morph-spec audit-dispatch <feature>
|
|
11
|
-
* morph-spec audit-dispatch <feature> --json
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { loadState, stateExists } from '../../core/state/state-manager.js';
|
|
15
|
-
import chalk from 'chalk';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* CLI command: morph-spec audit-dispatch <feature>
|
|
19
|
-
*
|
|
20
|
-
* @param {string} featureName - Feature name
|
|
21
|
-
* @param {Object} [options] - CLI options
|
|
22
|
-
* @param {boolean} [options.json] - Output as JSON instead of table
|
|
23
|
-
*/
|
|
24
|
-
export async function auditDispatchCommand(featureName, options = {}) {
|
|
25
|
-
if (!featureName) {
|
|
26
|
-
console.error(chalk.red('Usage: morph-spec audit-dispatch <feature>'));
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!stateExists()) {
|
|
31
|
-
console.error(chalk.red('No state.json found.'));
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const state = loadState();
|
|
36
|
-
const feature = state.features?.[featureName];
|
|
37
|
-
if (!feature) {
|
|
38
|
-
console.error(chalk.red(`Feature '${featureName}' not found.`));
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const log = feature.dispatchLog || [];
|
|
43
|
-
|
|
44
|
-
if (options.json) {
|
|
45
|
-
console.log(JSON.stringify(log, null, 2));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
console.log(chalk.bold(`\n Dispatch Audit — ${featureName}`));
|
|
50
|
-
console.log(' ' + '─'.repeat(50));
|
|
51
|
-
console.log(` Total dispatches: ${log.length}`);
|
|
52
|
-
|
|
53
|
-
if (log.length === 0) {
|
|
54
|
-
console.log(chalk.gray('\n No dispatch events recorded.\n'));
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
for (let i = 0; i < log.length; i++) {
|
|
59
|
-
const entry = log[i];
|
|
60
|
-
console.log(`\n #${i + 1}: ${entry.timestamp} — ${entry.phase} (${entry.mode})`);
|
|
61
|
-
for (const agent of entry.agents || []) {
|
|
62
|
-
const taskCount = agent.tasks?.length || 0;
|
|
63
|
-
console.log(` ${agent.id} → ${agent.subagentType} (${agent.group}) — ${taskCount} tasks`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Agent coverage summary
|
|
68
|
-
const coverage = {};
|
|
69
|
-
for (const entry of log) {
|
|
70
|
-
for (const agent of entry.agents || []) {
|
|
71
|
-
if (!coverage[agent.id]) coverage[agent.id] = { tasks: 0, dispatches: 0 };
|
|
72
|
-
coverage[agent.id].tasks += agent.tasks?.length || 0;
|
|
73
|
-
coverage[agent.id].dispatches += 1;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
console.log(chalk.bold('\n Agent Coverage:'));
|
|
78
|
-
for (const [id, data] of Object.entries(coverage)) {
|
|
79
|
-
console.log(` ${id}: ${data.tasks} tasks across ${data.dispatches} dispatches`);
|
|
80
|
-
}
|
|
81
|
-
console.log();
|
|
82
|
-
}
|