@polymorphism-tech/morph-spec 4.13.0 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CLAUDE.md +7 -7
  2. package/README.md +9 -7
  3. package/claude-plugin.json +1 -1
  4. package/docs/CHEATSHEET.md +6 -7
  5. package/docs/QUICKSTART.md +1 -1
  6. package/framework/agents/ai-agents/ai-system-architect.md +2 -0
  7. package/framework/agents/ai-agents/vector-search-expert.md +233 -0
  8. package/framework/agents/architecture/seo-growth-hacker.md +2 -0
  9. package/framework/agents/architecture/standards-architect.md +3 -0
  10. package/framework/agents/backend/dotnet-senior.md +3 -0
  11. package/framework/agents/backend/ef-modeler.md +2 -0
  12. package/framework/agents/backend/hangfire-orchestrator.md +2 -0
  13. package/framework/agents/backend/ms-agent-expert.md +2 -0
  14. package/framework/agents/backend/supabase-expert.md +256 -0
  15. package/framework/agents/frontend/css-specialist.md +2 -0
  16. package/framework/agents/frontend/nextjs-expert.md +3 -0
  17. package/framework/agents/frontend/ui-ux-designer.md +3 -1
  18. package/framework/agents/infrastructure/infra-architect.md +3 -0
  19. package/framework/agents/integrations/asaas-financial.md +2 -0
  20. package/framework/agents/integrations/clerk-auth.md +2 -0
  21. package/framework/agents/integrations/resend-email.md +2 -0
  22. package/framework/agents.json +1077 -1040
  23. package/framework/commands/morph-apply.md +0 -2
  24. package/framework/commands/morph-preflight.md +192 -247
  25. package/framework/commands/morph-proposal.md +210 -238
  26. package/framework/commands/morph-status.md +72 -92
  27. package/framework/phases.json +162 -162
  28. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +1 -1
  29. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +2 -2
  30. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +1 -1
  31. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +1 -1
  32. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +1 -1
  33. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +1 -1
  34. package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +143 -170
  35. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +1 -1
  36. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +1 -1
  37. package/package.json +1 -1
  38. package/src/utils/agents-installer.js +58 -18
  39. package/framework/agents/integrations/hangfire-integration.md +0 -69
@@ -1,170 +1,143 @@
1
- # Task Planning Patterns — VSA e DDD
2
-
3
- > Padrões detalhados de task planning para VSA e DDD.
4
- > Referenciado pelos Passos 0.5 e 0.6 de `phase-tasks/SKILL.md`.
5
-
6
- ---
7
-
8
- ## Padrão VSA (Vertical Slice Architecture)
9
-
10
- **Ref:** `framework/standards/architecture/vertical-slice/vertical-slice.md`
11
-
12
- ### Categorias de tasks VSA
13
-
14
- Uma task por slice — Handler + Validator + Endpoint juntos:
15
-
16
- | Categoria | Descrição | Arquivo(s) |
17
- |-----------|-----------|------------|
18
- | **entity** | Entity class + DbSet no ApplicationDbContext | `Entities/{Entity}.cs`, `Database/ApplicationDbContext.cs` |
19
- | **errors** | `{Entity}Errors` static class com factory methods | `Features/{Entity}Feature/{Entity}Errors.cs` |
20
- | **tags** | Constante em ApiTags (se tag nova) | `Constants/ApiTags.cs` |
21
- | **migration** | `dotnet ef migrations add` + `database update` | `Migrations/...` |
22
- | **slice** | Slice completo: Handler (+ Request + Response records) + Validator + Endpoint | `Features/{Entity}Feature/{Op}/{Op}Handler.cs`, `...Validator.cs`, `...Endpoint.cs` |
23
- | **tests** | Unit tests dos handlers | `Tests/Features/{Entity}Feature/...` |
24
- | **docs** | README, Swagger, comentários | — |
25
-
26
- ### Ordem obrigatória (bottom-up VSA)
27
-
28
- ```
29
- T001: Entity + DbContext DbSet
30
- ↓
31
- T002: {Entity}Errors (factory methods)
32
- ↓
33
- T003: ApiTags constant (se tag ainda não existe)
34
- ↓
35
- T004: Migration (Add{Entity} + database update)
36
- ↓
37
- T005: Slice Create{Entity} ← Handler+Validator+Endpoint = 1 task
38
- T006: Slice GetAll{Entity}s ← Handler+Endpoint = 1 task (sem Validator)
39
- T007: Slice Get{Entity}ById ← Handler+Validator+Endpoint = 1 task
40
- T008: Slice Update{Entity} ← Handler+Validator+Endpoint = 1 task
41
- T009: Slice Delete{Entity} ← Handler+Validator+Endpoint = 1 task
42
- ↓
43
- T010+: Slices customizados (operações extra do VSA Blueprint)
44
- ↓
45
- T0NN: Tests
46
- ```
47
-
48
- ### Regras VSA para tasks
49
-
50
- - 1 task = 1 slice completo (Handler + Validator + Endpoint num único task)
51
- - `GetAll` NÃO tem Validator — mencionar explicitamente no task
52
- - Cada task de slice lista os 3 arquivos que devem ser criados no campo `files`
53
- - Entity task deve incluir a linha `DbSet<{Entity}>` no `ApplicationDbContext`
54
- - Migration task é separada da entity task (pode rodar em paralelo com errors + tags)
55
-
56
- ### Exemplos de tasks VSA
57
-
58
- ```json
59
- { "id": "T001", "title": "Criar Entity Book + registrar DbSet no ApplicationDbContext",
60
- "category": "entity", "dependencies": [], "estimatedMinutes": 20,
61
- "files": ["Entities/Book.cs", "Database/ApplicationDbContext.cs"] }
62
-
63
- { "id": "T002", "title": "Criar BookErrors (NotFound + outros factory methods)",
64
- "category": "errors", "dependencies": ["T001"], "estimatedMinutes": 10,
65
- "files": ["Features/BookFeature/BookErrors.cs"] }
66
-
67
- { "id": "T003", "title": "Adicionar ApiTags.Books em Constants/ApiTags.cs",
68
- "category": "tags", "dependencies": [], "estimatedMinutes": 5,
69
- "files": ["Constants/ApiTags.cs"] }
70
-
71
- { "id": "T004", "title": "Criar migration AddBook + aplicar ao banco",
72
- "category": "migration", "dependencies": ["T001"], "estimatedMinutes": 10,
73
- "files": ["Migrations/...AddBook.cs"] }
74
-
75
- { "id": "T005", "title": "Implementar slice CreateBook (Handler + Validator + Endpoint)",
76
- "category": "slice", "dependencies": ["T001", "T002", "T003", "T004"],
77
- "estimatedMinutes": 45,
78
- "files": [
79
- "Features/BookFeature/CreateBook/CreateBookHandler.cs",
80
- "Features/BookFeature/CreateBook/CreateBookValidator.cs",
81
- "Features/BookFeature/CreateBook/CreateBookEndpoint.cs"
82
- ] }
83
-
84
- { "id": "T006", "title": "Implementar slice GetAllBooks (Handler + Endpoint, sem Validator)",
85
- "category": "slice", "dependencies": ["T001", "T004"], "estimatedMinutes": 25,
86
- "files": [
87
- "Features/BookFeature/GetAllBooks/GetAllBooksHandler.cs",
88
- "Features/BookFeature/GetAllBooks/GetAllBooksEndpoint.cs"
89
- ] }
90
- ```
91
-
92
- ---
93
-
94
- ## Padrão DDD — Mapeamento de Níveis para Categorias
95
-
96
- ### Categorias por nível de complexidade
97
-
98
- | Nível | Categorias de Tasks |
99
- |-------|---------------------|
100
- | **1 — CRUD** | `domain` (Entity simples) → `infrastructure` (Repository, EF Config) → `application` (Service CRUD) → `presentation` (API/Page) → `tests` |
101
- | **2 — Business Logic** | `domain` (AggregateRoot, ValueObjects, DomainEvents) → `infrastructure` (Repository, EF Config) → `application` (Commands, Queries, Handlers) → `presentation` (API/Page) → `tests` |
102
- | **3 — Bounded Context** | `domain-bc` (BC setup, Aggregates, Events) → `infrastructure` (BC repositories, EF) → `application` (Commands, Queries, Integration handlers) → `presentation` → `tests` |
103
-
104
- **Nível 1:** Nenhuma task adicional obrigatória — apenas o padrão CRUD nas categorias listadas.
105
-
106
- ### Tasks adicionais obrigatórias por nível
107
-
108
- **Nível 2 apenas:**
109
- - `T{N}: Implementar AggregateRoot {EntityName} com factory method e invariants` (domain)
110
- - `T{N}: Implementar ValueObjects: {lista do Aggregate Blueprint}` (domain)
111
- - `T{N}: Implementar DomainEvents: {lista do Aggregate Blueprint}` (domain)
112
- - `T{N}: Implementar Command Handlers com MediatR` (application)
113
- - `T{N}: Implementar Query Handlers com read models` (application)
114
-
115
- **Nível 3 apenas (além do Nível 2):**
116
- - `T{N}: Configurar namespace/pasta do Bounded Context {BoundedContext}` (infrastructure)
117
- - `T{N}: Implementar Integration Events para comunicação cross-BC` (domain-bc)
118
- - `T{N}: Implementar handlers de Integration Events` (application)
119
-
120
- ---
121
-
122
- ## Estrutura de Task (formato JSON)
123
-
124
- ```json
125
- {
126
- "id": "T001",
127
- "title": "Criar Entity {Nome}",
128
- "description": "Implementar entity {Nome} com propriedades X, Y, Z seguindo padrões EF Core",
129
- "category": "domain",
130
- "dependencies": [],
131
- "estimatedMinutes": 30,
132
- "status": "pending",
133
- "specSections": ["## Domain Model", "## Business Rules"],
134
- "contractInterfaces": ["I{Nome}Repository"],
135
- "files": [
136
- "Domain/Entities/{Nome}.cs",
137
- "Infrastructure/Data/Configurations/{Nome}Configuration.cs"
138
- ]
139
- }
140
- ```
141
-
142
- ## Categorias de Tasks (DDD)
143
-
144
- | Categoria | Descrição | Exemplos |
145
- |-----------|-----------|----------|
146
- | **domain** | Entities, Value Objects, Enums | Entity, DomainException |
147
- | **application** | Services, DTOs, Interfaces | Service, Validator, Mapper |
148
- | **infrastructure** | DbContext, Repositories, External APIs | EF Config, Repository impl |
149
- | **presentation** | Controllers, Pages, Components | API endpoint, Blazor page |
150
- | **tests** | Unit tests, Integration tests | Service tests, API tests |
151
- | **infra** | Bicep, Migrations, Scripts | Azure resources, DB migration |
152
- | **docs** | README, API docs, Swagger | OpenAPI spec, README update |
153
-
154
- ## Ordem de Implementação Bottom-Up
155
-
156
- ```
157
- 1. Domain (Entities, Enums, Value Objects)
158
- ↓
159
- 2. Infrastructure (Repositories, DbContext configs)
160
- ↓
161
- 3. Application (Services, DTOs, Business logic)
162
- ↓
163
- 4. Presentation (Controllers, Pages, Components)
164
- ↓
165
- 5. Tests (Unit → Integration)
166
- ↓
167
- 6. Infra (Bicep, Migrations, Deploy scripts)
168
- ↓
169
- 7. Docs (README, Swagger, Comments)
170
- ```
1
+ # Task Planning Patterns — VSA
2
+
3
+ > Padrões detalhados de task planning para Vertical Slice Architecture.
4
+ > Referenciado pelos Passos 0.5 e 0.6 de `phase-tasks/SKILL.md`.
5
+
6
+ ---
7
+
8
+ ## Padrão VSA (Vertical Slice Architecture)
9
+
10
+ **Ref:** `framework/standards/architecture/vertical-slice/vertical-slice.md`
11
+
12
+ ### Categorias de tasks VSA
13
+
14
+ Uma task por slice — Handler + Validator + Endpoint juntos:
15
+
16
+ | Categoria | Descrição | Arquivo(s) |
17
+ |-----------|-----------|------------|
18
+ | **entity** | Entity class + DbSet no ApplicationDbContext | `Entities/{Entity}.cs`, `Database/ApplicationDbContext.cs` |
19
+ | **errors** | `{Entity}Errors` static class com factory methods | `Features/{Entity}Feature/{Entity}Errors.cs` |
20
+ | **tags** | Constante em ApiTags (se tag nova) | `Constants/ApiTags.cs` |
21
+ | **migration** | `dotnet ef migrations add` + `database update` | `Migrations/...` |
22
+ | **slice** | Slice completo: Handler (+ Request + Response records) + Validator + Endpoint | `Features/{Entity}Feature/{Op}/{Op}Handler.cs`, `...Validator.cs`, `...Endpoint.cs` |
23
+ | **tests** | Unit tests dos handlers | `Tests/Features/{Entity}Feature/...` |
24
+ | **docs** | README, Swagger, comentários | — |
25
+
26
+ ### Ordem obrigatória (bottom-up VSA)
27
+
28
+ ```
29
+ T001: Entity + DbContext DbSet
30
+ ↓
31
+ T002: {Entity}Errors (factory methods)
32
+ ↓
33
+ T003: ApiTags constant (se tag ainda não existe)
34
+ ↓
35
+ T004: Migration (Add{Entity} + database update)
36
+ ↓
37
+ T005: Slice Create{Entity} ← Handler+Validator+Endpoint = 1 task
38
+ T006: Slice GetAll{Entity}s ← Handler+Endpoint = 1 task (sem Validator)
39
+ T007: Slice Get{Entity}ById ← Handler+Validator+Endpoint = 1 task
40
+ T008: Slice Update{Entity} ← Handler+Validator+Endpoint = 1 task
41
+ T009: Slice Delete{Entity} ← Handler+Validator+Endpoint = 1 task
42
+ ↓
43
+ T010+: Slices customizados (operações extra do VSA Blueprint)
44
+ ↓
45
+ T0NN: Tests
46
+ ```
47
+
48
+ ### Regras VSA para tasks
49
+
50
+ - 1 task = 1 slice completo (Handler + Validator + Endpoint num único task)
51
+ - `GetAll` NÃO tem Validator — mencionar explicitamente no task
52
+ - Cada task de slice lista os 3 arquivos que devem ser criados no campo `files`
53
+ - Entity task deve incluir a linha `DbSet<{Entity}>` no `ApplicationDbContext`
54
+ - Migration task é separada da entity task (pode rodar em paralelo com errors + tags)
55
+
56
+ ### Exemplos de tasks VSA
57
+
58
+ ```json
59
+ { "id": "T001", "title": "Criar Entity Book + registrar DbSet no ApplicationDbContext",
60
+ "category": "entity", "dependencies": [], "estimatedMinutes": 20,
61
+ "files": ["Entities/Book.cs", "Database/ApplicationDbContext.cs"] }
62
+
63
+ { "id": "T002", "title": "Criar BookErrors (NotFound + outros factory methods)",
64
+ "category": "errors", "dependencies": ["T001"], "estimatedMinutes": 10,
65
+ "files": ["Features/BookFeature/BookErrors.cs"] }
66
+
67
+ { "id": "T003", "title": "Adicionar ApiTags.Books em Constants/ApiTags.cs",
68
+ "category": "tags", "dependencies": [], "estimatedMinutes": 5,
69
+ "files": ["Constants/ApiTags.cs"] }
70
+
71
+ { "id": "T004", "title": "Criar migration AddBook + aplicar ao banco",
72
+ "category": "migration", "dependencies": ["T001"], "estimatedMinutes": 10,
73
+ "files": ["Migrations/...AddBook.cs"] }
74
+
75
+ { "id": "T005", "title": "Implementar slice CreateBook (Handler + Validator + Endpoint)",
76
+ "category": "slice", "dependencies": ["T001", "T002", "T003", "T004"],
77
+ "estimatedMinutes": 45,
78
+ "files": [
79
+ "Features/BookFeature/CreateBook/CreateBookHandler.cs",
80
+ "Features/BookFeature/CreateBook/CreateBookValidator.cs",
81
+ "Features/BookFeature/CreateBook/CreateBookEndpoint.cs"
82
+ ] }
83
+
84
+ { "id": "T006", "title": "Implementar slice GetAllBooks (Handler + Endpoint, sem Validator)",
85
+ "category": "slice", "dependencies": ["T001", "T004"], "estimatedMinutes": 25,
86
+ "files": [
87
+ "Features/BookFeature/GetAllBooks/GetAllBooksHandler.cs",
88
+ "Features/BookFeature/GetAllBooks/GetAllBooksEndpoint.cs"
89
+ ] }
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Estrutura de Task (formato JSON)
95
+
96
+ ```json
97
+ {
98
+ "id": "T001",
99
+ "title": "Criar Entity {Nome}",
100
+ "description": "Implementar entity {Nome} com propriedades X, Y, Z seguindo padrões EF Core",
101
+ "category": "entity",
102
+ "dependencies": [],
103
+ "estimatedMinutes": 30,
104
+ "status": "pending",
105
+ "specSections": ["## Domain Model", "## Business Rules"],
106
+ "contractInterfaces": ["I{Nome}Repository"],
107
+ "files": [
108
+ "Entities/{Nome}.cs",
109
+ "Database/ApplicationDbContext.cs"
110
+ ]
111
+ }
112
+ ```
113
+
114
+ ## Categorias de Tasks (VSA)
115
+
116
+ | Categoria | Descrição | Exemplos |
117
+ |-----------|-----------|----------|
118
+ | **entity** | Entities, Enums | Entity class, DbSet registration |
119
+ | **errors** | Error factory classes | `{Entity}Errors.cs` |
120
+ | **tags** | API endpoint tags | `ApiTags.cs` constants |
121
+ | **migration** | DB migrations | EF migrations |
122
+ | **slice** | Complete VSA slice | Handler + Validator + Endpoint |
123
+ | **tests** | Unit tests, Integration tests | Handler tests, API tests |
124
+ | **infra** | Docker, Migrations, Scripts | docker-compose, Supabase migrations |
125
+ | **docs** | README, API docs | OpenAPI spec, README update |
126
+
127
+ ## Ordem de Implementação Bottom-Up (VSA)
128
+
129
+ ```
130
+ 1. Entity + DbContext registration
131
+ ↓
132
+ 2. Errors + ApiTags
133
+ ↓
134
+ 3. Migrations
135
+ ↓
136
+ 4. Slices (Handler + Validator + Endpoint per operation)
137
+ ↓
138
+ 5. Tests (Unit → Integration)
139
+ ↓
140
+ 6. Infra (Docker, Supabase migrations)
141
+ ↓
142
+ 7. Docs (README, Swagger)
143
+ ```
@@ -4,7 +4,7 @@ description: MORPH-SPEC Phase 2 (UI/UX). Creates design-system.md, mockups.md, c
4
4
  argument-hint: "[feature-name]"
5
5
  user-invocable: false
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.13.0"
7
+ cliVersion: "4.15.0"
8
8
  ---
9
9
 
10
10
  # MORPH UI/UX Design - Phase 2
@@ -4,7 +4,7 @@ description: Guided workflow for mid-implementation scope escalation — analyze
4
4
  user-invocable: true
5
5
  argument-hint: "[feature-name]"
6
6
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
7
- cliVersion: "4.13.0"
7
+ cliVersion: "4.15.0"
8
8
  ---
9
9
 
10
10
  # Scope Escalation Workflow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polymorphism-tech/morph-spec",
3
- "version": "4.13.0",
3
+ "version": "4.15.0",
4
4
  "description": "MORPH-SPEC: AI-First development framework with validation pipeline and multi-stack support",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -103,23 +103,31 @@ export async function installAgents(projectDir, frameworkDir = 'framework', opti
103
103
  /**
104
104
  * Tier-based defaults for Claude Code subagent frontmatter fields.
105
105
  *
106
- * Tier 1 (Orchestrators): can spawn subagents via Task tool, 30 turns, project memory.
107
- * Tier 2 (Domain Leaders): coordinate specialists but do not spawn subagents, 20 turns, local memory.
106
+ * Tier 1 (Orchestrators): opus model, can spawn subagents via Agent tool, 30 turns, project memory, high effort.
107
+ * Tier 2 (Domain Leaders): sonnet model, coordinate specialists, 20 turns, local memory, medium effort.
108
+ * Tier 3 (Specialists): sonnet model, implementation focus, 15 turns, local memory, medium effort.
109
+ * Tier 4 (Validators): haiku model, read-only scanning, 10 turns, background execution, low effort.
108
110
  */
109
111
  const TIER_DEFAULTS = {
110
112
  1: {
111
- model: 'inherit',
112
- tools: 'Read, Grep, Glob, Bash, Task, Write, Edit',
113
+ model: 'opus',
114
+ tools: 'Read, Grep, Glob, Bash, Agent, Write, Edit',
113
115
  maxTurns: 30,
114
116
  skills: ['morph-checklist'],
115
117
  memory: 'project',
118
+ effort: 'high',
119
+ permissionMode: 'acceptEdits',
120
+ background: false,
116
121
  },
117
122
  2: {
118
- model: 'inherit',
123
+ model: 'sonnet',
119
124
  tools: 'Read, Write, Edit, Bash, Glob, Grep',
120
125
  maxTurns: 20,
121
126
  skills: ['morph-checklist'],
122
127
  memory: 'local',
128
+ effort: 'medium',
129
+ permissionMode: 'acceptEdits',
130
+ background: false,
123
131
  },
124
132
  3: {
125
133
  model: 'sonnet',
@@ -127,6 +135,9 @@ const TIER_DEFAULTS = {
127
135
  maxTurns: 15,
128
136
  skills: [],
129
137
  memory: 'local',
138
+ effort: 'medium',
139
+ permissionMode: 'default',
140
+ background: false,
130
141
  },
131
142
  4: {
132
143
  model: 'haiku',
@@ -134,6 +145,9 @@ const TIER_DEFAULTS = {
134
145
  maxTurns: 10,
135
146
  skills: [],
136
147
  memory: 'project',
148
+ effort: 'low',
149
+ permissionMode: 'plan',
150
+ background: true,
137
151
  },
138
152
  };
139
153
 
@@ -149,10 +163,14 @@ function buildFrontmatter(agent, description) {
149
163
  const defaults = TIER_DEFAULTS[agent.tier] ?? TIER_DEFAULTS[2];
150
164
  const name = agent.title ?? agent.name;
151
165
 
152
- // Allow per-agent tool overrides (e.g., morph-spec-validator needs Bash for npm test)
166
+ // Allow per-agent overrides from teammate config
153
167
  const tools = agent.teammate?.tools ?? defaults.tools;
154
- // Allow per-agent maxTurns override
155
168
  const maxTurns = agent.teammate?.maxTurns ?? defaults.maxTurns;
169
+ const effort = agent.teammate?.effort ?? defaults.effort;
170
+ const permissionMode = agent.teammate?.permissionMode ?? defaults.permissionMode;
171
+ const background = agent.teammate?.background ?? defaults.background;
172
+ // color is a top-level field on the agent (not inside teammate)
173
+ const color = agent.color;
156
174
 
157
175
  const lines = [
158
176
  `name: ${name}`,
@@ -162,6 +180,11 @@ function buildFrontmatter(agent, description) {
162
180
  `maxTurns: ${maxTurns}`,
163
181
  ];
164
182
 
183
+ if (color) lines.push(`color: ${color}`);
184
+ if (effort) lines.push(`effort: ${effort}`);
185
+ if (permissionMode && permissionMode !== 'default') lines.push(`permissionMode: ${permissionMode}`);
186
+ if (background) lines.push(`background: true`);
187
+
165
188
  if (defaults.skills.length > 0) {
166
189
  const skillsList = defaults.skills.map(s => ` - ${s}`).join('\n');
167
190
  lines.push(`skills:`, skillsList);
@@ -183,11 +206,18 @@ const GROUP_TO_CATEGORIES = {
183
206
 
184
207
  function buildDescription(agent) {
185
208
  const role = agent.teammate?.role ?? `Handles ${(agent.domains ?? []).join(', ')}`;
209
+ const triggers = agent.teammate?.triggers;
186
210
  const categories = GROUP_TO_CATEGORIES[agent.group];
187
- const suffix = categories ? ` | Tasks: ${categories}` : '';
188
- const full = `${role}${suffix}`;
211
+
212
+ let desc = role;
213
+ if (triggers) {
214
+ desc += `. Use proactively when: ${triggers}`;
215
+ } else if (categories) {
216
+ desc += ` | Tasks: ${categories}`;
217
+ }
218
+
189
219
  // Truncate to 200 chars for settings display
190
- return full.length > 200 ? full.slice(0, 197) + '...' : full;
220
+ return desc.length > 200 ? desc.slice(0, 197) + '...' : desc;
191
221
  }
192
222
 
193
223
  /**
@@ -232,19 +262,23 @@ function buildBody(agent) {
232
262
  * Handles both inline values and YAML block scalars (>).
233
263
  *
234
264
  * @param {string} rawContent - Raw file content
235
- * @returns {{ name: string|null, description: string|null, allowedTools: string, body: string }}
265
+ * @returns {{ name: string|null, description: string|null, allowedTools: string, color: string|null, effort: string|null, permissionMode: string|null, background: boolean, stacks: string[], body: string }}
236
266
  */
237
267
  export function parseSkillFile(rawContent) {
238
268
  // Normalize CRLF to LF for consistent parsing on Windows
239
269
  const content = rawContent.replace(/\r\n/g, '\n');
240
270
  const match = content.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
241
- if (!match) return { name: null, description: null, allowedTools: 'Read, Write, Edit, Bash, Glob, Grep', body: rawContent };
271
+ if (!match) return { name: null, description: null, allowedTools: 'Read, Write, Edit, Bash, Glob, Grep', color: null, effort: null, permissionMode: null, background: false, body: rawContent };
242
272
 
243
273
  const fm = match[1];
244
274
  const body = match[2];
245
275
 
246
276
  const name = (fm.match(/^name:\s*(.+)$/m) ?? [])[1]?.trim() ?? null;
247
277
  const allowedTools = (fm.match(/^allowed-tools:\s*(.+)$/m) ?? [])[1]?.trim() ?? 'Read, Write, Edit, Bash, Glob, Grep';
278
+ const color = (fm.match(/^color:\s*(.+)$/m) ?? [])[1]?.trim() ?? null;
279
+ const effort = (fm.match(/^effort:\s*(.+)$/m) ?? [])[1]?.trim() ?? null;
280
+ const permissionMode = (fm.match(/^permissionMode:\s*(.+)$/m) ?? [])[1]?.trim() ?? null;
281
+ const background = (fm.match(/^background:\s*(.+)$/m) ?? [])[1]?.trim() === 'true';
248
282
 
249
283
  let description = null;
250
284
  const blockMatch = fm.match(/^description:\s*>\s*\n((?:[ \t]+.*\n?)*)/m);
@@ -256,7 +290,7 @@ export function parseSkillFile(rawContent) {
256
290
  }
257
291
 
258
292
  const stacks = parseStacks(rawContent);
259
- return { name, description, allowedTools, stacks, body };
293
+ return { name, description, allowedTools, color, effort, permissionMode, background, stacks, body };
260
294
  }
261
295
 
262
296
  /**
@@ -281,6 +315,8 @@ export function collectSkillFiles(dir) {
281
315
  /**
282
316
  * Installs domain agent files as native Claude Code subagents
283
317
  * in .claude/agents/ with memory:project, model:sonnet, maxTurns:20.
318
+ * Supports optional CC-native fields (color, effort, permissionMode, background)
319
+ * declared in each domain file's YAML frontmatter.
284
320
  *
285
321
  * @param {string} projectDir - Target project directory
286
322
  * @param {string} frameworkDir - Path to morph-spec framework/ directory
@@ -296,20 +332,24 @@ export async function installDomainAgents(projectDir, frameworkDir = 'framework'
296
332
  const installed = new Set();
297
333
  for (const filePath of collectSkillFiles(domainsDir)) {
298
334
  const raw = readFileSync(filePath, 'utf-8');
299
- const { name, description, allowedTools, stacks, body } = parseSkillFile(raw);
335
+ const { name, description, allowedTools, color, effort, permissionMode, background, stacks, body } = parseSkillFile(raw);
300
336
  if (!name) continue;
301
337
  if (!shouldInstall(stacks, projectTags)) continue;
302
338
 
303
339
  const desc = description ?? `MORPH-SPEC domain agent: ${name}`;
304
- const frontmatter = [
340
+ const lines = [
305
341
  `name: ${name}`,
306
342
  `description: ${desc}`,
307
343
  `model: sonnet`,
308
344
  `tools: ${allowedTools}`,
309
345
  `maxTurns: 20`,
310
- `memory: project`,
311
- '',
312
- ].join('\n');
346
+ ];
347
+ if (color) lines.push(`color: ${color}`);
348
+ if (effort) lines.push(`effort: ${effort}`);
349
+ if (permissionMode && permissionMode !== 'default') lines.push(`permissionMode: ${permissionMode}`);
350
+ if (background) lines.push(`background: true`);
351
+ lines.push(`memory: project`, '');
352
+ const frontmatter = lines.join('\n');
313
353
 
314
354
  // If agents.json already generated morph-{name}.md, append domain content there
315
355
  const agentsJsonFile = `morph-${name}.md`;
@@ -1,69 +0,0 @@
1
- ---
2
- name: hangfire-orchestrator-integration
3
- description: Hangfire integration specialist for connecting background jobs with external services, implementing webhook handlers, and building event-driven workflows in .NET. Use when integrating Hangfire with third-party APIs, processing webhooks asynchronously, or designing event-driven job pipelines.
4
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep
5
- stacks:
6
- - hangfire
7
- ---
8
-
9
- # Hangfire Orchestrator
10
-
11
- **Tier:** 3 (Specialist)
12
- **Always Active:** No
13
- **Keywords:** scheduled, job, background, cron, recurring, batch, queue, hangfire
14
- **Reports to:** dotnet-senior
15
-
16
- ---
17
-
18
- ## Role
19
-
20
- Hangfire specialist for background jobs, scheduled tasks, and asynchronous processing.
21
-
22
- ---
23
-
24
- ## Standards Applied
25
-
26
- ```
27
- framework/standards/backend/integrations/hangfire/setup.md
28
- framework/standards/backend/integrations/hangfire/jobs.md
29
- ```
30
-
31
- ---
32
-
33
- ## Responsibilities
34
-
35
- - Configure Hangfire with SQL Server storage
36
- - Create fire-and-forget jobs
37
- - Schedule recurring jobs with cron expressions
38
- - Implement delayed and continuation jobs
39
- - Use IRepositoryFactory for DbContext in jobs (NOT direct injection)
40
- - Configure Hangfire Dashboard with authentication
41
- - Handle job failures and retries
42
-
43
- ---
44
-
45
- ## When to Use
46
-
47
- - Background processing (emails, reports, cleanup)
48
- - Scheduled tasks (daily/hourly jobs)
49
- - Delayed operations (abandoned cart after 24h)
50
- - Long-running operations outside HTTP request
51
-
52
- ---
53
-
54
- ## Critical Pattern
55
-
56
- **ALWAYS use IRepositoryFactory in Hangfire jobs** - DbContext is scoped to HTTP request and won't exist in background jobs.
57
-
58
- ---
59
-
60
- ## Collaborates With
61
-
62
- - **dotnet-senior** - Service layer triggering jobs
63
- - **ef-modeler** - Repository factory implementation
64
- - **infra-architect** - Hangfire dashboard security (Docker/EasyPanel)
65
- - **resend-email** - Email jobs coordination
66
-
67
- ---
68
-
69
- *MORPH-SPEC by Polymorphism Tech*