@polymorphism-tech/morph-spec 4.2.0 → 4.3.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/bin/morph-spec.js +283 -8
- package/bin/validate.js +4 -4
- package/docs/{v3.0 → next-generation}/AGENTS.md +1 -1
- package/docs/next-generation/CONTEXT-OPTIMIZATION.md +267 -0
- package/docs/next-generation/EXECUTION-FLOW.md +274 -0
- package/docs/next-generation/META-PROMPTS.md +235 -0
- package/docs/next-generation/MIGRATION-GUIDE.md +253 -0
- package/docs/next-generation/THREAD-MANAGEMENT.md +240 -0
- package/package.json +5 -5
- package/src/commands/agents/agents-fuse.js +96 -0
- package/src/commands/agents/micro-agent.js +112 -0
- package/src/commands/agents/spawn-team.js +69 -4
- package/src/commands/agents/squad-template.js +146 -0
- package/src/commands/analytics/analytics.js +176 -0
- package/src/commands/context/context-prime.js +63 -0
- package/src/commands/context/core-four.js +54 -0
- package/src/commands/mcp/mcp.js +102 -0
- package/src/commands/project/detect-agents.js +1 -1
- package/src/commands/project/doctor.js +573 -356
- package/src/commands/project/init.js +1 -1
- package/src/commands/project/update.js +1 -1
- package/src/commands/state/advance-phase.js +433 -416
- package/src/commands/templates/template-render.js +80 -1
- package/src/commands/threads/thread-template.js +103 -0
- package/src/commands/threads/threads.js +261 -0
- package/src/commands/trust/trust.js +205 -0
- package/src/{orchestrator.js → core/orchestrator.js} +8 -8
- package/src/core/state/state-manager.js +18 -2
- package/src/core/workflows/workflow-detector.js +100 -2
- package/src/lib/agents/micro-agent-factory.js +161 -0
- package/src/lib/analytics/analytics-engine.js +345 -0
- package/src/lib/checkpoints/checkpoint-hooks.js +293 -258
- package/src/lib/context/context-bundler.js +240 -0
- package/src/lib/context/context-optimizer.js +212 -0
- package/src/lib/context/context-tracker.js +273 -0
- package/src/lib/context/core-four-tracker.js +201 -0
- package/src/lib/context/mcp-optimizer.js +200 -0
- package/src/lib/execution/fusion-executor.js +304 -0
- package/src/lib/execution/parallel-executor.js +270 -0
- package/src/lib/generators/context-generator.js +3 -3
- package/src/lib/generators/recap-generator.js +2 -2
- package/src/lib/hooks/hook-executor.js +169 -0
- package/src/lib/hooks/stop-hook-executor.js +286 -0
- package/src/lib/hops/hop-composer.js +221 -0
- package/src/lib/threads/thread-coordinator.js +238 -0
- package/src/lib/threads/thread-manager.js +317 -0
- package/src/lib/tracking/artifact-trail.js +202 -0
- package/src/lib/trust/trust-manager.js +269 -0
- package/src/lib/validators/design-system/design-system-validator.js +2 -2
- package/src/lib/validators/validation-runner.js +6 -6
- package/stacks/blazor-azure/.morph/config/agents.json +72 -3
- package/stacks/nextjs-supabase/.morph/config/agents.json +3 -3
- package/CLAUDE.md +0 -993
- package/docs/llm-interaction-config.md +0 -735
- package/docs/v3.0/EXECUTION-FLOW.md +0 -1304
- package/src/commands/utils/migrate-state.js +0 -158
- package/src/commands/utils/upgrade.js +0 -346
- package/src/lib/validators/architecture-validator.js +0 -60
- package/src/lib/validators/content-validator.js +0 -164
- package/src/lib/validators/package-validator.js +0 -61
- package/src/lib/validators/ui-contrast-validator.js +0 -44
- package/stacks/blazor-azure/.claude/commands/morph-apply.md +0 -221
- package/stacks/blazor-azure/.claude/commands/morph-archive.md +0 -79
- package/stacks/blazor-azure/.claude/commands/morph-deploy.md +0 -529
- package/stacks/blazor-azure/.claude/commands/morph-infra.md +0 -209
- package/stacks/blazor-azure/.claude/commands/morph-preflight.md +0 -227
- package/stacks/blazor-azure/.claude/commands/morph-proposal.md +0 -122
- package/stacks/blazor-azure/.claude/commands/morph-status.md +0 -86
- package/stacks/blazor-azure/.claude/commands/morph-troubleshoot.md +0 -122
- package/stacks/blazor-azure/.claude/skills/level-0-meta/README.md +0 -7
- package/stacks/blazor-azure/.claude/skills/level-0-meta/code-review.md +0 -226
- package/stacks/blazor-azure/.claude/skills/level-0-meta/morph-checklist.md +0 -117
- package/stacks/blazor-azure/.claude/skills/level-0-meta/simulation-checklist.md +0 -77
- package/stacks/blazor-azure/.claude/skills/level-1-workflows/README.md +0 -7
- package/stacks/blazor-azure/.claude/skills/level-1-workflows/morph-replicate.md +0 -213
- package/stacks/blazor-azure/.claude/skills/level-1-workflows/phase-clarify.md +0 -131
- package/stacks/blazor-azure/.claude/skills/level-1-workflows/phase-design.md +0 -213
- package/stacks/blazor-azure/.claude/skills/level-1-workflows/phase-setup.md +0 -106
- package/stacks/blazor-azure/.claude/skills/level-1-workflows/phase-tasks.md +0 -164
- package/stacks/blazor-azure/.claude/skills/level-1-workflows/phase-uiux.md +0 -169
- package/stacks/blazor-azure/.claude/skills/level-2-domains/README.md +0 -14
- package/stacks/blazor-azure/.claude/skills/level-2-domains/ai-agents/ai-system-architect.md +0 -192
- package/stacks/blazor-azure/.claude/skills/level-2-domains/architecture/po-pm-advisor.md +0 -197
- package/stacks/blazor-azure/.claude/skills/level-2-domains/architecture/prompt-engineer.md +0 -189
- package/stacks/blazor-azure/.claude/skills/level-2-domains/architecture/seo-growth-hacker.md +0 -320
- package/stacks/blazor-azure/.claude/skills/level-2-domains/architecture/standards-architect.md +0 -156
- package/stacks/blazor-azure/.claude/skills/level-2-domains/backend/api-designer.md +0 -59
- package/stacks/blazor-azure/.claude/skills/level-2-domains/backend/dotnet-senior.md +0 -77
- package/stacks/blazor-azure/.claude/skills/level-2-domains/backend/ef-modeler.md +0 -58
- package/stacks/blazor-azure/.claude/skills/level-2-domains/backend/hangfire-orchestrator.md +0 -126
- package/stacks/blazor-azure/.claude/skills/level-2-domains/backend/ms-agent-expert.md +0 -45
- package/stacks/blazor-azure/.claude/skills/level-2-domains/frontend/blazor-builder.md +0 -210
- package/stacks/blazor-azure/.claude/skills/level-2-domains/frontend/nextjs-expert.md +0 -154
- package/stacks/blazor-azure/.claude/skills/level-2-domains/frontend/ui-ux-designer.md +0 -191
- package/stacks/blazor-azure/.claude/skills/level-2-domains/infrastructure/azure-architect.md +0 -142
- package/stacks/blazor-azure/.claude/skills/level-2-domains/infrastructure/azure-deploy-specialist.md +0 -699
- package/stacks/blazor-azure/.claude/skills/level-2-domains/infrastructure/bicep-architect.md +0 -126
- package/stacks/blazor-azure/.claude/skills/level-2-domains/infrastructure/container-specialist.md +0 -131
- package/stacks/blazor-azure/.claude/skills/level-2-domains/infrastructure/devops-engineer.md +0 -119
- package/stacks/blazor-azure/.claude/skills/level-2-domains/integrations/asaas-financial.md +0 -130
- package/stacks/blazor-azure/.claude/skills/level-2-domains/integrations/azure-identity.md +0 -142
- package/stacks/blazor-azure/.claude/skills/level-2-domains/integrations/clerk-auth.md +0 -108
- package/stacks/blazor-azure/.claude/skills/level-2-domains/integrations/hangfire-orchestrator.md +0 -64
- package/stacks/blazor-azure/.claude/skills/level-2-domains/integrations/resend-email.md +0 -119
- package/stacks/blazor-azure/.claude/skills/level-2-domains/quality/code-analyzer.md +0 -235
- package/stacks/blazor-azure/.claude/skills/level-2-domains/quality/testing-specialist.md +0 -126
- package/stacks/blazor-azure/.claude/skills/level-3-technologies/README.md +0 -7
- package/stacks/blazor-azure/.claude/skills/level-4-patterns/README.md +0 -7
- package/stacks/blazor-azure/.morph/archive/.gitkeep +0 -25
- package/stacks/blazor-azure/.morph/features/.gitkeep +0 -25
- package/stacks/blazor-azure/.morph/schemas/agent.schema.json +0 -296
- package/stacks/blazor-azure/.morph/schemas/tasks.schema.json +0 -220
- package/stacks/blazor-azure/.morph/specs/.gitkeep +0 -20
- package/stacks/blazor-azure/.morph/test-infra/example.bicep +0 -59
- package/stacks/nextjs-supabase/.claude/commands/morph-apply.md +0 -221
- package/stacks/nextjs-supabase/.claude/commands/morph-archive.md +0 -79
- package/stacks/nextjs-supabase/.claude/commands/morph-deploy.md +0 -529
- package/stacks/nextjs-supabase/.claude/commands/morph-infra.md +0 -209
- package/stacks/nextjs-supabase/.claude/commands/morph-preflight.md +0 -227
- package/stacks/nextjs-supabase/.claude/commands/morph-proposal.md +0 -122
- package/stacks/nextjs-supabase/.claude/commands/morph-status.md +0 -86
- package/stacks/nextjs-supabase/.claude/commands/morph-troubleshoot.md +0 -122
- package/stacks/nextjs-supabase/.claude/settings.local.json +0 -6
- package/stacks/nextjs-supabase/.claude/skills/level-2-domains/backend/dotnet-supabase.md +0 -244
- package/stacks/nextjs-supabase/.claude/skills/level-2-domains/frontend/nextjs-supabase.md +0 -335
- package/stacks/nextjs-supabase/.claude/skills/level-2-domains/infrastructure/easypanel-deployer.md +0 -189
- package/stacks/nextjs-supabase/.claude/skills/level-2-domains/integrations/supabase-expert.md +0 -50
- /package/docs/{v3.0 → next-generation}/ANALYSIS.md +0 -0
- /package/docs/{v3.0 → next-generation}/ARCHITECTURE.md +0 -0
- /package/docs/{v3.0 → next-generation}/FEATURES.md +0 -0
- /package/docs/{v3.0 → next-generation}/README.md +0 -0
- /package/docs/{v3.0 → next-generation}/ROADMAP.md +0 -0
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
# MORPH UI/UX Design - FASE 1.5
|
|
2
|
-
|
|
3
|
-
> INTERNAL: Workflow skill used by /morph-proposal during automated phase orchestration. Not a user command.
|
|
4
|
-
|
|
5
|
-
Fase condicional para features com front-end. Coleta requisitos de UI/UX, gera wireframes, specs de componentes e fluxos de usuário.
|
|
6
|
-
|
|
7
|
-
## Pré-requisitos
|
|
8
|
-
|
|
9
|
-
- [ ] FASE 1 (Setup) concluída
|
|
10
|
-
- [ ] Feature tem keywords de UI detectadas (blazor, ui, component, page, dashboard, wizard, form, chart)
|
|
11
|
-
- [ ] `uiux-designer` agent ativado
|
|
12
|
-
|
|
13
|
-
## Workflow
|
|
14
|
-
|
|
15
|
-
### Passo 0: Verificar Design System Existe
|
|
16
|
-
|
|
17
|
-
**CRITICAL:** Antes de iniciar a FASE UI/UX, verifique se um design system existe:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npx morph-spec detect-agents "{feature description}"
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Se nenhum design system for detectado (verificar output):
|
|
24
|
-
|
|
25
|
-
1. **Opção A - Scaffold automático:**
|
|
26
|
-
- O sistema criará automaticamente um design system ao avançar para implementação
|
|
27
|
-
- Você pode gerar manualmente agora: `npx morph-spec generate design-system`
|
|
28
|
-
|
|
29
|
-
2. **Opção B - Criar manualmente:**
|
|
30
|
-
- Crie `.morph/project/design-system.md` (project-level, compartilhado)
|
|
31
|
-
- Ou `.morph/project/outputs/{feature}/ui-design-system.md` (feature-specific)
|
|
32
|
-
|
|
33
|
-
3. **Opção C - Scan existing CSS:**
|
|
34
|
-
- Se o projeto já tem CSS com variáveis: `npx morph-spec generate design-system --scan`
|
|
35
|
-
|
|
36
|
-
**⚠️ IMPORTANTE:**
|
|
37
|
-
- Design system é **obrigatório** para features UI
|
|
38
|
-
- Gate automático bloqueará implementação (FASE 5) se design system não existir
|
|
39
|
-
- Melhor criar agora para garantir consistência visual
|
|
40
|
-
|
|
41
|
-
### Passo 1: Detectar Se Fase É Necessária
|
|
42
|
-
|
|
43
|
-
Verifique se agentes ativos incluem `uiux-designer`:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
npx morph-spec state get {feature-name}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Se `uiux-designer` NÃO estiver nos `activeAgents`, pule esta fase e continue para FASE 2 (Design).
|
|
50
|
-
|
|
51
|
-
### Passo 2: Coletar Input do Usuário
|
|
52
|
-
|
|
53
|
-
**SEMPRE perguntar ao usuário PRIMEIRO:**
|
|
54
|
-
|
|
55
|
-
1. **Layout e estilo**:
|
|
56
|
-
- Você tem alguma ideia de layout em mente?
|
|
57
|
-
- Tem alguma referência visual? (sites, apps, screenshots)
|
|
58
|
-
- Como imagina o fluxo do usuário?
|
|
59
|
-
|
|
60
|
-
2. **Componentes e interações**:
|
|
61
|
-
- Quais os principais componentes desta tela/página?
|
|
62
|
-
- Quais estados precisam ser considerados? (loading, error, empty, success)
|
|
63
|
-
|
|
64
|
-
3. **Imagens de referência**:
|
|
65
|
-
- Tem imagens de exemplo que eu possa analisar?
|
|
66
|
-
- Se SIM: use Read tool para ler screenshots e extrair padrões
|
|
67
|
-
|
|
68
|
-
### Passo 3: Decidir Biblioteca UI
|
|
69
|
-
|
|
70
|
-
Escolha entre **Fluent UI Blazor** (recomendado para AI-first) ou **MudBlazor** (componentes complexos):
|
|
71
|
-
|
|
72
|
-
**Critérios:**
|
|
73
|
-
- Fluent UI: Para dashboards, forms simples, AI components, Microsoft design language
|
|
74
|
-
- MudBlazor: Para data grids avançadas, charts complexos, material design
|
|
75
|
-
|
|
76
|
-
**Documente a decisão em `decisions.md`.**
|
|
77
|
-
|
|
78
|
-
### Passo 4: Gerar Deliverables
|
|
79
|
-
|
|
80
|
-
Crie os seguintes arquivos em `.morph/project/outputs/{feature}/`:
|
|
81
|
-
|
|
82
|
-
#### 4.1. `ui-design-system.md`
|
|
83
|
-
|
|
84
|
-
**Se design system project-level existe (`.morph/project/design-system.md`):**
|
|
85
|
-
- Referencie-o nos specs: "Uses project design system at .morph/project/design-system.md"
|
|
86
|
-
- Crie `ui-design-system.md` apenas se houver cores/componentes **específicos** da feature
|
|
87
|
-
|
|
88
|
-
**Se não existe:**
|
|
89
|
-
- Crie design system feature-level completo com:
|
|
90
|
-
- Paleta de cores (primary, secondary, accent, semantic)
|
|
91
|
-
- Tipografia (heading scales, body text, code)
|
|
92
|
-
- Spacing e layout (grid, margins, paddings)
|
|
93
|
-
- Componentes base (buttons, inputs, cards)
|
|
94
|
-
|
|
95
|
-
#### 4.2. `ui-mockups.md`
|
|
96
|
-
|
|
97
|
-
Wireframes ASCII + descrições:
|
|
98
|
-
- Layout geral de cada tela/página
|
|
99
|
-
- Posicionamento de componentes
|
|
100
|
-
- Responsividade (desktop, tablet, mobile)
|
|
101
|
-
- Estados (loading, error, empty, success)
|
|
102
|
-
|
|
103
|
-
#### 4.3. `ui-components.md`
|
|
104
|
-
|
|
105
|
-
Specs técnicas de componentes Fluent UI/MudBlazor:
|
|
106
|
-
- Componente a usar (FluentButton, MudDataGrid, etc.)
|
|
107
|
-
- Props e configurações
|
|
108
|
-
- Eventos e bindings
|
|
109
|
-
- Validações e estados
|
|
110
|
-
|
|
111
|
-
#### 4.4. `ui-flows.md`
|
|
112
|
-
|
|
113
|
-
Fluxos de usuário completos:
|
|
114
|
-
- User stories
|
|
115
|
-
- Diagramas de fluxo (texto/ASCII)
|
|
116
|
-
- Edge cases (o que acontece se...?)
|
|
117
|
-
- Validações e feedback
|
|
118
|
-
|
|
119
|
-
### Passo 5: Validar Acessibilidade e Responsividade
|
|
120
|
-
|
|
121
|
-
Documente nos arquivos UI:
|
|
122
|
-
- **WCAG 2.1 Level AA** compliance
|
|
123
|
-
- Contraste de cores adequado
|
|
124
|
-
- Labels acessíveis para screen readers
|
|
125
|
-
- Navegação por teclado
|
|
126
|
-
- **Responsive breakpoints**
|
|
127
|
-
- Desktop (>1200px)
|
|
128
|
-
- Tablet (768px - 1199px)
|
|
129
|
-
- Mobile (<768px)
|
|
130
|
-
|
|
131
|
-
### Passo 6: Atualizar State
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
npx morph-spec state set {feature-name} phase uiux-design
|
|
135
|
-
npx morph-spec state mark-output {feature-name} ui-design-system
|
|
136
|
-
npx morph-spec state mark-output {feature-name} ui-mockups
|
|
137
|
-
npx morph-spec state mark-output {feature-name} ui-components
|
|
138
|
-
npx morph-spec state mark-output {feature-name} ui-flows
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## Outputs Gerados
|
|
142
|
-
|
|
143
|
-
- `.morph/project/outputs/{feature}/ui-design-system.md`
|
|
144
|
-
- `.morph/project/outputs/{feature}/ui-mockups.md`
|
|
145
|
-
- `.morph/project/outputs/{feature}/ui-components.md`
|
|
146
|
-
- `.morph/project/outputs/{feature}/ui-flows.md`
|
|
147
|
-
- `.morph/project/outputs/{feature}/decisions.md` (atualizado com ADR UI library)
|
|
148
|
-
|
|
149
|
-
## PAUSA OBRIGATÓRIA
|
|
150
|
-
|
|
151
|
-
Apresente ao usuário 3 ações sugeridas:
|
|
152
|
-
|
|
153
|
-
1. **Aprovar UI/UX e prosseguir para design técnico**
|
|
154
|
-
2. **Ajustar wireframes/componentes de telas específicas**
|
|
155
|
-
3. **Revisar biblioteca UI escolhida (Fluent UI / MudBlazor)**
|
|
156
|
-
|
|
157
|
-
## Critérios de Avanço
|
|
158
|
-
|
|
159
|
-
- [x] Input do usuário coletado (layout, referências)
|
|
160
|
-
- [x] Biblioteca UI escolhida e justificada (ADR)
|
|
161
|
-
- [x] 4 deliverables criados (design-system, mockups, components, flows)
|
|
162
|
-
- [x] Acessibilidade WCAG 2.1 documentada
|
|
163
|
-
- [x] Responsividade especificada
|
|
164
|
-
- [x] State atualizado
|
|
165
|
-
- [x] Usuário aprovou UI/UX
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
Continuar automaticamente para FASE 2 (Design) após aprovação.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Level 2: Domains
|
|
2
|
-
|
|
3
|
-
Domain expertise skills organized by squad.
|
|
4
|
-
|
|
5
|
-
**Purpose:** Skills that provide deep domain knowledge (backend, frontend, infra, quality, ai-agents, integrations).
|
|
6
|
-
|
|
7
|
-
**Squads:**
|
|
8
|
-
- backend/ - Backend Squad (led by dotnet-senior)
|
|
9
|
-
- frontend/ - Frontend Squad (led by ui-designer)
|
|
10
|
-
- infrastructure/ - Infrastructure Squad (led by azure-architect)
|
|
11
|
-
- quality/ - Quality Squad (coordinated by standards-architect)
|
|
12
|
-
- ai-agents/ - AI/Agent specialists
|
|
13
|
-
- integrations/ - External integration specialists
|
|
14
|
-
- architecture/ - Architecture and planning
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
# AI System Architect
|
|
2
|
-
|
|
3
|
-
Expert in agentic system architecture, multi-agent orchestration, and RAG pipelines.
|
|
4
|
-
|
|
5
|
-
> **Layer:** 2 | **Load:** on-keyword | **Keywords:** orchestration, multi-agent, rag, vector search, embedding, agentic, memory, reasoning
|
|
6
|
-
|
|
7
|
-
> **Ref:** `framework/standards/ai-agents/workflows.md` — Workflow patterns with AgentWorkflowBuilder
|
|
8
|
-
> **Ref:** `framework/standards/ai-agents/production.md` — Middleware, A2A, MCP, caching
|
|
9
|
-
> **Ref:** `framework/standards/backend/database/vector-search-rag.md` — Vector Search + RAG with EF Core 10
|
|
10
|
-
|
|
11
|
-
## Responsibilities
|
|
12
|
-
|
|
13
|
-
1. Design scalable agentic architectures
|
|
14
|
-
2. Define orchestration patterns (workflows, inter-agent communication)
|
|
15
|
-
3. Implement RAG pipelines (chunking, embedding, retrieval)
|
|
16
|
-
4. Select patterns from 20 agentic design patterns
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## 20 Agentic Design Patterns
|
|
21
|
-
|
|
22
|
-
| # | Pattern | Use Case | When to Use | Key Trade-off |
|
|
23
|
-
|---|---------|----------|-------------|---------------|
|
|
24
|
-
| 1 | **Prompt Chaining** | Multi-step processing | Data transformation, pipelines | Modular vs context explosion |
|
|
25
|
-
| 2 | **Routing** | Direct to specialist | Multiple domains | Specialization vs misrouting |
|
|
26
|
-
| 3 | **Parallelization** | Independent chunks | Large-scale processing | Speed vs coordination complexity |
|
|
27
|
-
| 4 | **Reflection** | Draft → critique → refine | Quality control, creative tasks | Quality vs cost (limit 3 iterations) |
|
|
28
|
-
| 5 | **Tool Use** | External tool calls | Multi-step workflows | Quality vs misfire propagation |
|
|
29
|
-
| 6 | **Planning** | Step-by-step before execute | Goal-oriented workflows | Strategic vs setup complexity |
|
|
30
|
-
| 7 | **Multi-Agent Collaboration** | Specialized agents + manager | Iterative refinement, dev | Specialization vs extensive testing |
|
|
31
|
-
| 8 | **Memory Management** | Short/episodic/long-term | Continuity, personalization | Context preservation vs privacy risk |
|
|
32
|
-
| 9 | **Learning & Adaptation** | Feedback → update prompts | Continuous improvement | Improvement vs learning wrong things |
|
|
33
|
-
| 10 | **Goal Setting & Monitoring** | SMART goals + metrics | Complex projects, autonomous ops | Efficiency vs goal conflicts |
|
|
34
|
-
| 11 | **Exception Handling** | Retry + exponential backoff | Production systems | Visibility vs infra complexity |
|
|
35
|
-
| 12 | **Human-in-the-Loop** | Human review for high-risk | Compliance, edge cases | Trust vs latency |
|
|
36
|
-
| 13 | **Knowledge Retrieval (RAG)** | Chunk + embed + search | Private/proprietary data | Accuracy vs infra to maintain |
|
|
37
|
-
| 14 | **Inter-Agent Communication** | Structured messaging (A2A) | Enterprise, distributed | Fault isolation vs extreme complexity |
|
|
38
|
-
| 15 | **Resource-Aware Optimization** | Route by complexity/cost | Cost-sensitive, high volume | Cost reduction vs tuning effort |
|
|
39
|
-
| 16 | **Reasoning Techniques** | CoT, ToT, Self-Consistency | Complex problems, math | Robust vs token-heavy (rarely needed) |
|
|
40
|
-
| 17 | **Evaluation & Monitoring** | Quality gates, drift detection | Production, enterprise | Reliability vs alert fatigue |
|
|
41
|
-
| 18 | **Guardrails & Safety** | PII, injection, malicious check | Public-facing systems | Risk mitigation vs false positives |
|
|
42
|
-
| 19 | **Prioritization** | Score by value/risk/effort | Dynamic environments, task mgmt | Adaptability vs context switching |
|
|
43
|
-
| 20 | **Exploration & Discovery** | Broad knowledge exploration | Research, competitive analysis | Innovation vs resource-heavy |
|
|
44
|
-
|
|
45
|
-
### Common Pattern Combinations
|
|
46
|
-
|
|
47
|
-
| Combination | Use Case |
|
|
48
|
-
|------------|----------|
|
|
49
|
-
| Prompt Chaining + Reflection | Content generation with quality control |
|
|
50
|
-
| Routing + Tool Use | Customer service with integrations |
|
|
51
|
-
| Planning + Multi-Agent | Complex development projects |
|
|
52
|
-
| Memory + Learning | Personalized assistants that evolve |
|
|
53
|
-
| Parallelization + Exception Handling | Data processing at scale |
|
|
54
|
-
| Human-in-Loop + Guardrails | Critical systems with compliance |
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Microsoft Agent Framework Orchestration
|
|
59
|
-
|
|
60
|
-
### Workflow Patterns
|
|
61
|
-
|
|
62
|
-
```csharp
|
|
63
|
-
// Sequential — pipeline processing
|
|
64
|
-
Workflow sequential = AgentWorkflowBuilder.BuildSequential(researcher, analyst, writer);
|
|
65
|
-
AIAgent seqAgent = await sequential.AsAgentAsync();
|
|
66
|
-
|
|
67
|
-
// GroupChat — iterative refinement with manager
|
|
68
|
-
Workflow groupChat = AgentWorkflowBuilder
|
|
69
|
-
.CreateGroupChatBuilderWith(agents =>
|
|
70
|
-
new AgentWorkflowBuilder.RoundRobinGroupChatManager(agents)
|
|
71
|
-
{ MaximumIterationCount = 3 })
|
|
72
|
-
.AddParticipants(writer, editor, reviewer)
|
|
73
|
-
.Build();
|
|
74
|
-
|
|
75
|
-
// Handoff — dynamic routing
|
|
76
|
-
var handoff = AgentWorkflowBuilder.StartHandoffWith(triageAgent)
|
|
77
|
-
.WithHandoffs(triageAgent, [specialistA, specialistB])
|
|
78
|
-
.WithHandoff(specialistA, triageAgent)
|
|
79
|
-
.WithHandoff(specialistB, triageAgent)
|
|
80
|
-
.Build();
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### A2A Protocol
|
|
84
|
-
|
|
85
|
-
```csharp
|
|
86
|
-
app.MapA2A(agent, "/a2a/agent-name", agentCard: new()
|
|
87
|
-
{
|
|
88
|
-
Name = "Agent Name",
|
|
89
|
-
Description = "What this agent does.",
|
|
90
|
-
Version = "1.0"
|
|
91
|
-
});
|
|
92
|
-
// Discovery: GET /a2a/agent-name/v1/card
|
|
93
|
-
// Message: POST /a2a/agent-name/v1/message:stream
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Small Specialized Agents > Monolithic Agent
|
|
97
|
-
|
|
98
|
-
Design principle: each agent has one clear responsibility, composed via workflows.
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## RAG Pipeline with Microsoft Stack
|
|
103
|
-
|
|
104
|
-
### Architecture
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
Extraction → Staging (Blob) → Chunking → Embedding → Indexing (AI Search) → Retrieval
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Chunking Strategies
|
|
111
|
-
|
|
112
|
-
| Strategy | Method | Best For |
|
|
113
|
-
|----------|--------|----------|
|
|
114
|
-
| Paragraph Splitter | By paragraphs | General text |
|
|
115
|
-
| Markdown Header Splitter | By headers (#, ##) | Documentation |
|
|
116
|
-
| Token-based Splitter | By token count | Fixed-size chunks |
|
|
117
|
-
| Semantic Splitter | By semantic similarity | Highest quality |
|
|
118
|
-
|
|
119
|
-
**Principle:** Test ALL strategies and rank by metrics (avg similarity score, token count, relevance).
|
|
120
|
-
|
|
121
|
-
### Agent Framework Integration
|
|
122
|
-
|
|
123
|
-
```csharp
|
|
124
|
-
[Description("Searches knowledge base")]
|
|
125
|
-
public async Task<SearchResult[]> SearchKnowledgeAsync(
|
|
126
|
-
[Description("Search query")] string query, CancellationToken ct = default)
|
|
127
|
-
{
|
|
128
|
-
var embedding = await _embeddings.GenerateAsync(query, ct);
|
|
129
|
-
var results = await _searchClient.SearchAsync<KnowledgeChunk>(query,
|
|
130
|
-
new SearchOptions { VectorSearch = new() {
|
|
131
|
-
Queries = { new VectorizedQuery(embedding) { KNearestNeighborsCount = 5 } }
|
|
132
|
-
}}, ct);
|
|
133
|
-
return results.Value.GetResults().ToArray();
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Why Staging in Blob Storage?
|
|
138
|
-
|
|
139
|
-
Immutability, versioning, low cost, fallback on processing bugs, audit trail.
|
|
140
|
-
|
|
141
|
-
### Key Insight
|
|
142
|
-
|
|
143
|
-
**LLM comes LAST.** 80% of RAG work happens before the model is called (extraction, chunking, embedding, evaluation).
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## When NOT to Use Agent Framework
|
|
148
|
-
|
|
149
|
-
| Scenario | Use Instead |
|
|
150
|
-
|----------|------------|
|
|
151
|
-
| Single LLM call resolves | `IChatClient` directly |
|
|
152
|
-
| No tools needed | `ChatClient.GetResponseAsync()` |
|
|
153
|
-
| Model < 3B params | Tool calling unreliable |
|
|
154
|
-
| Just summarization/translation | No agent needed |
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## Checklist
|
|
159
|
-
|
|
160
|
-
### System Design
|
|
161
|
-
- [ ] Patterns selected and justified
|
|
162
|
-
- [ ] Orchestration pattern chosen (Sequential/Concurrent/GroupChat/Handoff/Magentic)
|
|
163
|
-
- [ ] Specialized agents mapped with clear responsibilities
|
|
164
|
-
|
|
165
|
-
### RAG Pipeline (if applicable)
|
|
166
|
-
- [ ] Data source identified and accessible
|
|
167
|
-
- [ ] Staging in Blob Storage configured
|
|
168
|
-
- [ ] Multiple chunking strategies tested and ranked
|
|
169
|
-
- [ ] Azure AI Search index configured (vector + hybrid)
|
|
170
|
-
|
|
171
|
-
### Orchestration
|
|
172
|
-
- [ ] Workflow built with `AgentWorkflowBuilder`
|
|
173
|
-
- [ ] Error handling via middleware
|
|
174
|
-
- [ ] OpenTelemetry monitoring enabled
|
|
175
|
-
|
|
176
|
-
### Security & Cost
|
|
177
|
-
- [ ] Guardrails implemented (PII, injection, malicious content)
|
|
178
|
-
- [ ] Resource-Aware Optimization (model selection by complexity)
|
|
179
|
-
- [ ] Token usage monitored and costs documented
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
## References
|
|
184
|
-
|
|
185
|
-
- [Microsoft Agent Framework](https://learn.microsoft.com/agent-framework/)
|
|
186
|
-
- [Azure AI Search](https://learn.microsoft.com/azure/search/)
|
|
187
|
-
- [GitHub: microsoft/agent-framework](https://github.com/microsoft/agent-framework)
|
|
188
|
-
- `.wiki/ai/20-agentic-design-patterns.md` — Full 20 patterns reference
|
|
189
|
-
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
# PO/PM Advisor
|
|
2
|
-
|
|
3
|
-
Especialista em requisitos, priorização e gestão de produto para clarificar features e ROI.
|
|
4
|
-
|
|
5
|
-
## Responsabilidades
|
|
6
|
-
|
|
7
|
-
1. **Clarificar requisitos** ambíguos ou incompletos
|
|
8
|
-
2. **Priorizar features** por valor de negócio
|
|
9
|
-
3. **Calcular ROI** e esforço estimado
|
|
10
|
-
4. **Definir critérios** de aceitação
|
|
11
|
-
|
|
12
|
-
## Triggers
|
|
13
|
-
|
|
14
|
-
Keywords: `unclear`, `requirements`, `priority`, `ROI`, `mvp`, `scope`, `acceptance criteria`, `user story`
|
|
15
|
-
|
|
16
|
-
## Framework de Clarificação
|
|
17
|
-
|
|
18
|
-
### Perguntas Essenciais
|
|
19
|
-
|
|
20
|
-
Quando receber uma feature request ambígua, faça estas perguntas:
|
|
21
|
-
|
|
22
|
-
1. **Quem?** - Qual o usuário/persona principal?
|
|
23
|
-
2. **O quê?** - O que exatamente deve acontecer?
|
|
24
|
-
3. **Por quê?** - Qual problema resolve? Qual o valor?
|
|
25
|
-
4. **Quando?** - Urgência? Deadline externo?
|
|
26
|
-
5. **Como medir?** - Como saberemos que funcionou?
|
|
27
|
-
|
|
28
|
-
### Template de User Story
|
|
29
|
-
|
|
30
|
-
```markdown
|
|
31
|
-
## User Story: {Nome da Feature}
|
|
32
|
-
|
|
33
|
-
**Como** {persona/usuário},
|
|
34
|
-
**Eu quero** {ação/funcionalidade},
|
|
35
|
-
**Para que** {benefício/valor}.
|
|
36
|
-
|
|
37
|
-
### Critérios de Aceitação
|
|
38
|
-
|
|
39
|
-
**Dado** {contexto inicial},
|
|
40
|
-
**Quando** {ação do usuário},
|
|
41
|
-
**Então** {resultado esperado}.
|
|
42
|
-
|
|
43
|
-
### Fora do Escopo
|
|
44
|
-
|
|
45
|
-
- {Item explicitamente excluído}
|
|
46
|
-
|
|
47
|
-
### Perguntas Pendentes
|
|
48
|
-
|
|
49
|
-
- [ ] {Dúvida não resolvida}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Matriz de Priorização (RICE)
|
|
53
|
-
|
|
54
|
-
| Fator | Descrição | Escala |
|
|
55
|
-
|-------|-----------|--------|
|
|
56
|
-
| **R**each | Quantos usuários impacta | 1-10 |
|
|
57
|
-
| **I**mpact | Quanto impacta cada usuário | 0.25, 0.5, 1, 2, 3 |
|
|
58
|
-
| **C**onfidence | Confiança nas estimativas | 0-100% |
|
|
59
|
-
| **E**ffort | Pessoa-semanas de trabalho | 1+ |
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
RICE Score = (Reach × Impact × Confidence) / Effort
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Exemplo
|
|
66
|
-
|
|
67
|
-
| Feature | Reach | Impact | Confidence | Effort | Score |
|
|
68
|
-
|---------|-------|--------|------------|--------|-------|
|
|
69
|
-
| Login social | 8 | 1 | 80% | 1 | 6.4 |
|
|
70
|
-
| Dashboard | 5 | 2 | 90% | 3 | 3.0 |
|
|
71
|
-
| Export PDF | 3 | 0.5 | 100% | 0.5 | 3.0 |
|
|
72
|
-
| Dark mode | 4 | 0.25 | 100% | 1 | 1.0 |
|
|
73
|
-
|
|
74
|
-
## MVP vs Nice-to-Have
|
|
75
|
-
|
|
76
|
-
### Critérios para MVP
|
|
77
|
-
|
|
78
|
-
1. **Resolve o problema core** do usuário
|
|
79
|
-
2. **Diferencia** da concorrência
|
|
80
|
-
3. **Validável** em 2-4 semanas
|
|
81
|
-
4. **Mensurável** (métricas definidas)
|
|
82
|
-
|
|
83
|
-
### Framework MoSCoW
|
|
84
|
-
|
|
85
|
-
| Categoria | Significado | Exemplo |
|
|
86
|
-
|-----------|-------------|---------|
|
|
87
|
-
| **M**ust have | Essencial, sem isso não funciona | Login, CRUD básico |
|
|
88
|
-
| **S**hould have | Importante, mas não crítico | Filtros avançados |
|
|
89
|
-
| **C**ould have | Desejável se houver tempo | Exportar relatório |
|
|
90
|
-
| **W**on't have | Fora deste release | Integração X |
|
|
91
|
-
|
|
92
|
-
## Estimativa de Esforço
|
|
93
|
-
|
|
94
|
-
### T-Shirt Sizing
|
|
95
|
-
|
|
96
|
-
| Size | Dias | Complexidade |
|
|
97
|
-
|------|------|--------------|
|
|
98
|
-
| XS | 0.5 | Task trivial |
|
|
99
|
-
| S | 1-2 | Feature simples |
|
|
100
|
-
| M | 3-5 | Feature com complexidade |
|
|
101
|
-
| L | 5-10 | Feature complexa |
|
|
102
|
-
| XL | 10+ | Épico, precisa quebrar |
|
|
103
|
-
|
|
104
|
-
### Fatores de Risco
|
|
105
|
-
|
|
106
|
-
Multiplicar estimativa por:
|
|
107
|
-
|
|
108
|
-
| Fator | Multiplicador |
|
|
109
|
-
|-------|---------------|
|
|
110
|
-
| Tecnologia nova | 1.5x |
|
|
111
|
-
| Integração externa | 1.3x |
|
|
112
|
-
| Requisitos vagos | 1.5x |
|
|
113
|
-
| Primeiro da equipe | 1.3x |
|
|
114
|
-
|
|
115
|
-
## Template de ADR (Architecture Decision Record)
|
|
116
|
-
|
|
117
|
-
```markdown
|
|
118
|
-
# ADR-{XXX}: {Título da Decisão}
|
|
119
|
-
|
|
120
|
-
## Status
|
|
121
|
-
{PROPOSED | ACCEPTED | DEPRECATED | SUPERSEDED}
|
|
122
|
-
|
|
123
|
-
## Contexto
|
|
124
|
-
{Situação que requer decisão}
|
|
125
|
-
|
|
126
|
-
## Opções Consideradas
|
|
127
|
-
|
|
128
|
-
### Opção 1: {Nome}
|
|
129
|
-
- Prós: ...
|
|
130
|
-
- Contras: ...
|
|
131
|
-
- Custo: ...
|
|
132
|
-
|
|
133
|
-
### Opção 2: {Nome}
|
|
134
|
-
- Prós: ...
|
|
135
|
-
- Contras: ...
|
|
136
|
-
- Custo: ...
|
|
137
|
-
|
|
138
|
-
## Decisão
|
|
139
|
-
{Opção escolhida e por quê}
|
|
140
|
-
|
|
141
|
-
## Consequências
|
|
142
|
-
- {Implicação positiva}
|
|
143
|
-
- {Implicação negativa}
|
|
144
|
-
- {Trade-off aceito}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
## Cálculo de ROI
|
|
148
|
-
|
|
149
|
-
```markdown
|
|
150
|
-
## ROI Estimado: {Feature}
|
|
151
|
-
|
|
152
|
-
### Benefícios (anual)
|
|
153
|
-
- Aumento de conversão: R$ X
|
|
154
|
-
- Redução de suporte: R$ Y
|
|
155
|
-
- Economia de tempo: R$ Z
|
|
156
|
-
- **Total Benefícios**: R$ (X+Y+Z)
|
|
157
|
-
|
|
158
|
-
### Custos
|
|
159
|
-
- Desenvolvimento: R$ A (horas × rate)
|
|
160
|
-
- Infraestrutura: R$ B/mês × 12
|
|
161
|
-
- Manutenção: R$ C/ano
|
|
162
|
-
- **Total Custos**: R$ (A+B+C)
|
|
163
|
-
|
|
164
|
-
### ROI
|
|
165
|
-
**ROI = (Benefícios - Custos) / Custos × 100**
|
|
166
|
-
|
|
167
|
-
ROI = (X+Y+Z - A+B+C) / (A+B+C) × 100 = **{N}%**
|
|
168
|
-
|
|
169
|
-
### Payback
|
|
170
|
-
**Meses = Custo Inicial / (Benefício Mensal - Custo Mensal)**
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Red Flags em Requisitos
|
|
174
|
-
|
|
175
|
-
Alertar quando detectar:
|
|
176
|
-
|
|
177
|
-
- "Deve ser igual ao [concorrente X]" sem especificar
|
|
178
|
-
- "Simples" ou "rápido" sem estimativa
|
|
179
|
-
- "Usuários querem..." sem evidência
|
|
180
|
-
- Escopo crescente sem priorização
|
|
181
|
-
- Deadline impossível sem trade-offs
|
|
182
|
-
|
|
183
|
-
## Checklist de Requisitos
|
|
184
|
-
|
|
185
|
-
- [ ] Persona/usuário definido
|
|
186
|
-
- [ ] Problema claramente articulado
|
|
187
|
-
- [ ] Valor de negócio quantificado
|
|
188
|
-
- [ ] Critérios de aceitação escritos
|
|
189
|
-
- [ ] Fora do escopo explícito
|
|
190
|
-
- [ ] Dependências mapeadas
|
|
191
|
-
- [ ] Riscos identificados
|
|
192
|
-
- [ ] Estimativa de esforço
|
|
193
|
-
- [ ] Prioridade definida (RICE/MoSCoW)
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
*MORPH-SPEC by Polymorphism Tech*
|