maestro-bundle 1.3.0 → 1.4.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 (118) hide show
  1. package/README.md +125 -37
  2. package/package.json +1 -1
  3. package/src/cli.mjs +7 -4
  4. package/templates/bundle-ai-agents/skills/agent-orchestration/SKILL.md +107 -41
  5. package/templates/bundle-ai-agents/skills/agent-orchestration/references/graph-patterns.md +50 -0
  6. package/templates/bundle-ai-agents/skills/agent-orchestration/references/routing-strategies.md +47 -0
  7. package/templates/bundle-ai-agents/skills/api-design/SKILL.md +125 -16
  8. package/templates/bundle-ai-agents/skills/api-design/references/pydantic-patterns.md +72 -0
  9. package/templates/bundle-ai-agents/skills/api-design/references/rest-conventions.md +51 -0
  10. package/templates/bundle-ai-agents/skills/clean-architecture/SKILL.md +113 -21
  11. package/templates/bundle-ai-agents/skills/clean-architecture/references/dependency-injection.md +60 -0
  12. package/templates/bundle-ai-agents/skills/clean-architecture/references/layer-rules.md +56 -0
  13. package/templates/bundle-ai-agents/skills/context-engineering/SKILL.md +104 -36
  14. package/templates/bundle-ai-agents/skills/context-engineering/references/compression-techniques.md +76 -0
  15. package/templates/bundle-ai-agents/skills/context-engineering/references/context-budget-calculator.md +45 -0
  16. package/templates/bundle-ai-agents/skills/database-modeling/SKILL.md +146 -19
  17. package/templates/bundle-ai-agents/skills/database-modeling/references/index-strategies.md +48 -0
  18. package/templates/bundle-ai-agents/skills/database-modeling/references/naming-conventions.md +27 -0
  19. package/templates/bundle-ai-agents/skills/docker-containerization/SKILL.md +124 -15
  20. package/templates/bundle-ai-agents/skills/docker-containerization/references/compose-patterns.md +97 -0
  21. package/templates/bundle-ai-agents/skills/docker-containerization/references/dockerfile-checklist.md +37 -0
  22. package/templates/bundle-ai-agents/skills/eval-testing/SKILL.md +113 -25
  23. package/templates/bundle-ai-agents/skills/eval-testing/references/eval-types.md +52 -0
  24. package/templates/bundle-ai-agents/skills/eval-testing/references/golden-dataset-template.md +59 -0
  25. package/templates/bundle-ai-agents/skills/memory-management/SKILL.md +112 -28
  26. package/templates/bundle-ai-agents/skills/memory-management/references/memory-tiers.md +41 -0
  27. package/templates/bundle-ai-agents/skills/memory-management/references/namespace-conventions.md +41 -0
  28. package/templates/bundle-ai-agents/skills/prompt-engineering/SKILL.md +139 -47
  29. package/templates/bundle-ai-agents/skills/prompt-engineering/references/anti-patterns.md +59 -0
  30. package/templates/bundle-ai-agents/skills/prompt-engineering/references/prompt-templates.md +75 -0
  31. package/templates/bundle-ai-agents/skills/rag-pipeline/SKILL.md +104 -27
  32. package/templates/bundle-ai-agents/skills/rag-pipeline/references/chunking-strategies.md +27 -0
  33. package/templates/bundle-ai-agents/skills/rag-pipeline/references/embedding-models.md +31 -0
  34. package/templates/bundle-ai-agents/skills/rag-pipeline/references/rag-evaluation.md +39 -0
  35. package/templates/bundle-ai-agents/skills/testing-strategy/SKILL.md +127 -18
  36. package/templates/bundle-ai-agents/skills/testing-strategy/references/fixture-patterns.md +81 -0
  37. package/templates/bundle-ai-agents/skills/testing-strategy/references/naming-conventions.md +69 -0
  38. package/templates/bundle-base/skills/branch-strategy/SKILL.md +134 -21
  39. package/templates/bundle-base/skills/branch-strategy/references/branch-rules.md +40 -0
  40. package/templates/bundle-base/skills/code-review/SKILL.md +123 -38
  41. package/templates/bundle-base/skills/code-review/references/review-checklist.md +45 -0
  42. package/templates/bundle-base/skills/commit-pattern/SKILL.md +98 -39
  43. package/templates/bundle-base/skills/commit-pattern/references/conventional-commits.md +40 -0
  44. package/templates/bundle-data-pipeline/skills/data-preprocessing/SKILL.md +110 -19
  45. package/templates/bundle-data-pipeline/skills/data-preprocessing/references/pandas-cheatsheet.md +63 -0
  46. package/templates/bundle-data-pipeline/skills/data-preprocessing/references/pandera-schemas.md +44 -0
  47. package/templates/bundle-data-pipeline/skills/docker-containerization/SKILL.md +132 -16
  48. package/templates/bundle-data-pipeline/skills/docker-containerization/references/compose-patterns.md +82 -0
  49. package/templates/bundle-data-pipeline/skills/docker-containerization/references/dockerfile-best-practices.md +57 -0
  50. package/templates/bundle-data-pipeline/skills/feature-engineering/SKILL.md +143 -45
  51. package/templates/bundle-data-pipeline/skills/feature-engineering/references/encoding-guide.md +41 -0
  52. package/templates/bundle-data-pipeline/skills/feature-engineering/references/scaling-guide.md +38 -0
  53. package/templates/bundle-data-pipeline/skills/mlops-pipeline/SKILL.md +156 -37
  54. package/templates/bundle-data-pipeline/skills/mlops-pipeline/references/mlflow-commands.md +69 -0
  55. package/templates/bundle-data-pipeline/skills/model-training/SKILL.md +152 -33
  56. package/templates/bundle-data-pipeline/skills/model-training/references/evaluation-metrics.md +52 -0
  57. package/templates/bundle-data-pipeline/skills/model-training/references/model-selection-guide.md +41 -0
  58. package/templates/bundle-data-pipeline/skills/rag-pipeline/SKILL.md +127 -39
  59. package/templates/bundle-data-pipeline/skills/rag-pipeline/references/chunking-strategies.md +51 -0
  60. package/templates/bundle-data-pipeline/skills/rag-pipeline/references/embedding-models.md +49 -0
  61. package/templates/bundle-frontend-spa/skills/authentication/SKILL.md +196 -13
  62. package/templates/bundle-frontend-spa/skills/authentication/references/jwt-security.md +41 -0
  63. package/templates/bundle-frontend-spa/skills/component-design/SKILL.md +191 -41
  64. package/templates/bundle-frontend-spa/skills/component-design/references/accessibility-checklist.md +41 -0
  65. package/templates/bundle-frontend-spa/skills/component-design/references/tailwind-patterns.md +65 -0
  66. package/templates/bundle-frontend-spa/skills/e2e-testing/SKILL.md +241 -79
  67. package/templates/bundle-frontend-spa/skills/e2e-testing/references/playwright-selectors.md +66 -0
  68. package/templates/bundle-frontend-spa/skills/e2e-testing/references/test-patterns.md +82 -0
  69. package/templates/bundle-frontend-spa/skills/integration-api/SKILL.md +221 -31
  70. package/templates/bundle-frontend-spa/skills/integration-api/references/api-patterns.md +81 -0
  71. package/templates/bundle-frontend-spa/skills/react-patterns/SKILL.md +195 -70
  72. package/templates/bundle-frontend-spa/skills/react-patterns/references/component-checklist.md +22 -0
  73. package/templates/bundle-frontend-spa/skills/react-patterns/references/hook-patterns.md +63 -0
  74. package/templates/bundle-frontend-spa/skills/responsive-layout/SKILL.md +162 -22
  75. package/templates/bundle-frontend-spa/skills/responsive-layout/references/breakpoint-guide.md +63 -0
  76. package/templates/bundle-frontend-spa/skills/state-management/SKILL.md +158 -30
  77. package/templates/bundle-frontend-spa/skills/state-management/references/react-query-config.md +64 -0
  78. package/templates/bundle-frontend-spa/skills/state-management/references/state-patterns.md +78 -0
  79. package/templates/bundle-jhipster-microservices/skills/ci-cd-pipeline/SKILL.md +135 -45
  80. package/templates/bundle-jhipster-microservices/skills/ci-cd-pipeline/references/gitlab-ci-templates.md +93 -0
  81. package/templates/bundle-jhipster-microservices/skills/clean-architecture/SKILL.md +87 -21
  82. package/templates/bundle-jhipster-microservices/skills/clean-architecture/references/layer-rules.md +78 -0
  83. package/templates/bundle-jhipster-microservices/skills/ddd-tactical/SKILL.md +94 -25
  84. package/templates/bundle-jhipster-microservices/skills/ddd-tactical/references/ddd-patterns.md +48 -0
  85. package/templates/bundle-jhipster-microservices/skills/jhipster-angular/SKILL.md +63 -21
  86. package/templates/bundle-jhipster-microservices/skills/jhipster-angular/references/angular-microservices.md +40 -0
  87. package/templates/bundle-jhipster-microservices/skills/jhipster-angular/references/angular-structure.md +59 -0
  88. package/templates/bundle-jhipster-microservices/skills/jhipster-docker-k8s/SKILL.md +125 -91
  89. package/templates/bundle-jhipster-microservices/skills/jhipster-docker-k8s/references/docker-k8s-commands.md +68 -0
  90. package/templates/bundle-jhipster-microservices/skills/jhipster-entities/SKILL.md +72 -20
  91. package/templates/bundle-jhipster-microservices/skills/jhipster-entities/references/cross-service-entities.md +36 -0
  92. package/templates/bundle-jhipster-microservices/skills/jhipster-entities/references/jdl-types.md +56 -0
  93. package/templates/bundle-jhipster-microservices/skills/jhipster-gateway/SKILL.md +80 -8
  94. package/templates/bundle-jhipster-microservices/skills/jhipster-gateway/references/gateway-config.md +43 -0
  95. package/templates/bundle-jhipster-microservices/skills/jhipster-kafka/SKILL.md +115 -22
  96. package/templates/bundle-jhipster-microservices/skills/jhipster-kafka/references/kafka-events.md +39 -0
  97. package/templates/bundle-jhipster-microservices/skills/jhipster-registry/SKILL.md +92 -23
  98. package/templates/bundle-jhipster-microservices/skills/jhipster-registry/references/consul-config.md +61 -0
  99. package/templates/bundle-jhipster-microservices/skills/jhipster-service/SKILL.md +81 -18
  100. package/templates/bundle-jhipster-microservices/skills/jhipster-service/references/service-patterns.md +40 -0
  101. package/templates/bundle-jhipster-microservices/skills/testing-strategy/SKILL.md +101 -20
  102. package/templates/bundle-jhipster-microservices/skills/testing-strategy/references/test-naming.md +55 -0
  103. package/templates/bundle-jhipster-monorepo/skills/clean-architecture/SKILL.md +87 -21
  104. package/templates/bundle-jhipster-monorepo/skills/clean-architecture/references/layer-rules.md +78 -0
  105. package/templates/bundle-jhipster-monorepo/skills/ddd-tactical/SKILL.md +94 -25
  106. package/templates/bundle-jhipster-monorepo/skills/ddd-tactical/references/ddd-patterns.md +48 -0
  107. package/templates/bundle-jhipster-monorepo/skills/jhipster-angular/SKILL.md +99 -52
  108. package/templates/bundle-jhipster-monorepo/skills/jhipster-angular/references/angular-structure.md +59 -0
  109. package/templates/bundle-jhipster-monorepo/skills/jhipster-entities/SKILL.md +89 -36
  110. package/templates/bundle-jhipster-monorepo/skills/jhipster-entities/references/jdl-types.md +56 -0
  111. package/templates/bundle-jhipster-monorepo/skills/jhipster-liquibase/SKILL.md +123 -23
  112. package/templates/bundle-jhipster-monorepo/skills/jhipster-liquibase/references/liquibase-operations.md +95 -0
  113. package/templates/bundle-jhipster-monorepo/skills/jhipster-security/SKILL.md +106 -19
  114. package/templates/bundle-jhipster-monorepo/skills/jhipster-security/references/security-checklist.md +47 -0
  115. package/templates/bundle-jhipster-monorepo/skills/jhipster-spring/SKILL.md +84 -16
  116. package/templates/bundle-jhipster-monorepo/skills/jhipster-spring/references/spring-layers.md +41 -0
  117. package/templates/bundle-jhipster-monorepo/skills/testing-strategy/SKILL.md +101 -20
  118. package/templates/bundle-jhipster-monorepo/skills/testing-strategy/references/test-naming.md +55 -0
package/README.md CHANGED
@@ -1,83 +1,171 @@
1
1
  # maestro-bundle
2
2
 
3
- Um comando. Bundle instalado. Agente governado. Funciona com **qualquer editor AI**.
3
+ Um comando. Bundle instalado. Agente governado. [GitHub Spec Kit](https://github.com/github/spec-kit) configurado.
4
4
 
5
5
  ```bash
6
6
  npx maestro-bundle ai-agents claude
7
7
  ```
8
8
 
9
+ ## O que faz
10
+
11
+ 1. Instala **AGENTS.md** + **skills** no formato correto do seu editor
12
+ 2. Instala o [GitHub Spec Kit](https://github.com/github/spec-kit) (`specify-cli@v0.4.3`) no projeto
13
+ 3. Roda `specify init` que registra os commands `/speckit.*` no editor
14
+ 4. Integra o `constitution.md` do bundle com os princípios do projeto
15
+
16
+ O dev abre o editor e já tem skills + `/speckit.specify` funcionando.
17
+
9
18
  ## Editores suportados
10
19
 
11
20
  | Editor | Comando | O que instala |
12
21
  |---|---|---|
13
- | **Claude Code** | `npx maestro-bundle <bundle> claude` | `CLAUDE.md` + `.claude/rules/` |
14
- | **Cursor** | `npx maestro-bundle <bundle> cursor` | `.cursorrules` + `.cursor/rules/` |
15
- | **OpenAI Codex** | `npx maestro-bundle <bundle> codex` | `AGENTS.md` |
22
+ | **Claude Code** | `npx maestro-bundle <bundle> claude` | `CLAUDE.md` + `.claude/skills/` + `.claude/commands/speckit.*` |
23
+ | **Cursor** | `npx maestro-bundle <bundle> cursor` | `AGENTS.md` + `.cursor/skills/` + `.cursor/commands/speckit.*` |
24
+ | **OpenAI Codex** | `npx maestro-bundle <bundle> codex` | `AGENTS.md` + `.agents/skills/speckit-*` |
16
25
  | **GitHub Copilot** | `npx maestro-bundle <bundle> copilot` | `.github/copilot-instructions.md` + `.github/instructions/` |
17
26
  | **Windsurf** | `npx maestro-bundle <bundle> windsurf` | `.windsurfrules` |
18
- | **Todos** | `npx maestro-bundle <bundle> all` | Tudo acima de uma vez |
27
+ | **Todos** | `npx maestro-bundle <bundle> all` | Tudo acima no mesmo repo |
19
28
 
20
29
  ## Bundles disponíveis
21
30
 
22
31
  ```bash
23
- npx maestro-bundle ai-agents claude # Agentes AI com LangChain
24
- npx maestro-bundle jhipster-monorepo cursor # JHipster monolítico
25
- npx maestro-bundle jhipster-microservices all # JHipster microsserviços
26
- npx maestro-bundle data-pipeline codex # Pipeline dados/ML
27
- npx maestro-bundle frontend-spa copilot # React SPA
32
+ npx maestro-bundle ai-agents claude # Python + LangChain + LangGraph + FastAPI
33
+ npx maestro-bundle jhipster-monorepo cursor # Java 21 + Spring Boot + Angular
34
+ npx maestro-bundle jhipster-microservices codex # Java 21 + Spring Boot + Kafka + K8s
35
+ npx maestro-bundle data-pipeline copilot # Python + Pandas + Scikit-learn + MLflow
36
+ npx maestro-bundle frontend-spa windsurf # React + TypeScript + Tailwind + Vite
28
37
  ```
29
38
 
30
39
  ## O que acontece
31
40
 
32
41
  ```
33
- $ npx maestro-bundle ai-agents all
42
+ $ npx maestro-bundle ai-agents claude
34
43
 
35
44
  Bundle: Sistema Multi-Agente com AI
36
- Editor: Claude Code, Cursor, OpenAI Codex, GitHub Copilot, Windsurf
45
+ Editor: Claude Code
37
46
 
38
- ✔ Claude Code: CLAUDE.md + AGENTS.md, 14 rules em .claude/rules/
39
- Cursor: .cursorrules, 14 rules em .cursor/rules/
40
- OpenAI Codex: AGENTS.md
41
- GitHub Copilot: .github/copilot-instructions.md, 14 rules em .github/instructions/
42
- Windsurf: .windsurfrules
43
- 14 skills canônicas
44
- ✔ .spec/constitution.md (GitHub Spec Kit)
45
- ✔ Spec Kit instalado
47
+ ✔ Claude Code: AGENTS.md, CLAUDE.md @AGENTS.md, 14 skills em .claude/skills/
48
+ 14 skills canônicas em skills/
49
+ references/ pronto
50
+ specify-cli v0.4.3 instalado
51
+ Spec Kit inicializado (/speckit.* commands disponíveis)
52
+ Constitution do bundle integrado ao Spec Kit
46
53
 
47
54
  Pronto!
55
+
56
+ Comandos SDD disponíveis no editor:
57
+ /speckit.constitution — Definir princípios do projeto
58
+ /speckit.specify — Especificar O QUE e POR QUÊ
59
+ /speckit.plan — Planejar arquitetura e stack
60
+ /speckit.tasks — Quebrar em tasks atômicas
61
+ /speckit.implement — Executar as tasks
62
+
63
+ Próximo passo:
64
+ Abra o projeto no editor AI e use /speckit.specify para começar
65
+ ```
66
+
67
+ ## Estrutura instalada por editor
68
+
69
+ ### Claude Code
70
+
71
+ ```
72
+ seu-projeto/
73
+ ├── CLAUDE.md # @AGENTS.md (aponta pro AGENTS.md)
74
+ ├── AGENTS.md # Instruções do bundle
75
+ ├── .claude/
76
+ │ ├── skills/ # Skills do bundle
77
+ │ │ ├── rag-pipeline/SKILL.md
78
+ │ │ ├── clean-architecture/SKILL.md
79
+ │ │ ├── commit-pattern/SKILL.md
80
+ │ │ └── ...
81
+ │ └── commands/ # Commands do Spec Kit (gerado pelo specify init)
82
+ │ ├── speckit.constitution.md
83
+ │ ├── speckit.specify.md
84
+ │ ├── speckit.plan.md
85
+ │ ├── speckit.tasks.md
86
+ │ └── speckit.implement.md
87
+ ├── .specify/ # Spec Kit (templates, scripts, constitution)
88
+ │ ├── memory/constitution.md
89
+ │ ├── scripts/
90
+ │ └── templates/
91
+ ├── skills/ # Skills canônicas (para Deep Agents)
92
+ └── references/
93
+ ```
94
+
95
+ ### Cursor
96
+
97
+ ```
98
+ seu-projeto/
99
+ ├── AGENTS.md # Instruções (Cursor lê automaticamente)
100
+ ├── .cursor/
101
+ │ ├── skills/ # Skills do bundle
102
+ │ │ ├── rag-pipeline/SKILL.md
103
+ │ │ └── ...
104
+ │ └── commands/ # Commands do Spec Kit
105
+ │ ├── speckit.specify.md
106
+ │ └── ...
107
+ ├── .specify/
108
+ ├── skills/
109
+ └── references/
48
110
  ```
49
111
 
50
- ## Onde cada editor procura
112
+ ### OpenAI Codex
51
113
 
52
114
  ```
53
115
  seu-projeto/
54
- ├── CLAUDE.md Claude Code
55
- ├── AGENTS.md ← Codex, agents.md universal
56
- ├── .cursorrules ← Cursor
57
- ├── .windsurfrules ← Windsurf
58
- ├── .claude/rules/*.md ← Claude Code (skills como rules)
59
- ├── .cursor/rules/*.md ← Cursor (skills como rules)
60
- ├── .github/copilot-instructions.md ← Copilot
61
- ├── .github/instructions/*.instructions.md Copilot (skills)
62
- ├── .spec/constitution.md ← GitHub Spec Kit (SDD)
63
- ├── skills/ ← Canônicas (Deep Agents, referência)
64
- │ ├── rag-pipeline/SKILL.md
65
- │ ├── clean-architecture/SKILL.md
66
- │ └── ...
67
- └── references/ ← Docs sob demanda
116
+ ├── AGENTS.md # Instruções (Codex lê automaticamente)
117
+ ├── .agents/
118
+ │ └── skills/ # Commands do Spec Kit (como skills)
119
+ ├── speckit-constitution/SKILL.md
120
+ ├── speckit-specify/SKILL.md
121
+ │ └── ...
122
+ ├── .specify/
123
+ ├── skills/ # Skills canônicas
124
+ └── references/
68
125
  ```
69
126
 
127
+ ## GitHub Spec Kit — SDD no editor
128
+
129
+ O bundle instala automaticamente o [GitHub Spec Kit](https://github.com/github/spec-kit) no projeto. Isso significa que ao abrir o editor o dev já pode usar:
130
+
131
+ | Command | O que faz |
132
+ |---|---|
133
+ | `/speckit.constitution` | Definir princípios e padrões do projeto |
134
+ | `/speckit.specify` | Especificar O QUE construir e POR QUÊ |
135
+ | `/speckit.plan` | Planejar arquitetura, stack, decisões técnicas |
136
+ | `/speckit.tasks` | Quebrar em tasks atômicas implementáveis |
137
+ | `/speckit.implement` | Executar todas as tasks |
138
+ | `/speckit.clarify` | Fazer perguntas para desambiguar requisitos |
139
+ | `/speckit.analyze` | Verificar consistência entre artefatos |
140
+ | `/speckit.checklist` | Gerar checklists de qualidade |
141
+
142
+ O fluxo SDD garante que ninguém sai codando sem spec:
143
+
144
+ ```
145
+ /speckit.specify → /speckit.plan → /speckit.tasks → /speckit.implement
146
+ ```
147
+
148
+ ## Pré-requisitos
149
+
150
+ - **Node.js 18+** (para rodar o npx)
151
+ - **Git** (para o specify init)
152
+ - **uv** ou **pip** (para instalar o specify-cli — o bundle tenta instalar automaticamente)
153
+
70
154
  ## Uso avançado
71
155
 
72
156
  ```bash
73
157
  # Instalar em diretório específico
74
158
  npx maestro-bundle jhipster-monorepo cursor ./meu-projeto
75
159
 
160
+ # Instalar para todos os editores (time usa editores diferentes)
161
+ npx maestro-bundle ai-agents all
162
+
76
163
  # Ver bundles e editores disponíveis
77
164
  npx maestro-bundle --help
78
165
  ```
79
166
 
80
167
  ## Links
81
168
 
82
- - [AGENTS.md spec](https://agents.md/) — Padrão universal para instruções de agentes
83
- - [GitHub Spec Kit](https://github.com/github/spec-kit) — SDD (Specification-Driven Development)
169
+ - [AGENTS.md](https://agents.md/) — Padrão universal para instruções de agentes AI
170
+ - [GitHub Spec Kit](https://github.com/github/spec-kit) — Specification-Driven Development
171
+ - [Agent Skills](https://agentskills.io) — Padrão aberto para skills de agentes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-bundle",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Instala bundles de governança para projetos com AI agents. Um comando, tudo configurado.",
5
5
  "bin": {
6
6
  "maestro-bundle": "./src/cli.mjs"
package/src/cli.mjs CHANGED
@@ -323,7 +323,7 @@ async function main() {
323
323
  // Mapear editor para flag --ai do specify
324
324
  const aiFlags = {
325
325
  claude: "claude",
326
- cursor: "cursor",
326
+ cursor: "cursor-agent",
327
327
  codex: "codex",
328
328
  copilot: "copilot",
329
329
  windsurf: "windsurf",
@@ -370,10 +370,13 @@ async function main() {
370
370
  let specInitOk = false;
371
371
 
372
372
  // Precisa de "y" piped pois specify pede confirmação se dir não vazio
373
- // Usar --script sh para evitar dependência de pwsh no Windows
373
+ // --script sh para evitar dependência de pwsh no Windows
374
+ // --ai-skills necessário para codex
375
+ const extraFlags = primaryEditor === "codex" ? " --ai-skills" : "";
374
376
  const initCmds = [
375
- `echo y | specify init . --ai ${aiFlag} --script sh`,
376
- `echo y | specify init . --ai ${aiFlag}`,
377
+ `echo y | specify init . --ai ${aiFlag}${extraFlags} --script sh --force`,
378
+ `echo y | specify init . --ai ${aiFlag}${extraFlags} --script sh`,
379
+ `echo y | specify init . --ai ${aiFlag}${extraFlags}`,
377
380
  ];
378
381
  for (const cmd of initCmds) {
379
382
  try {
@@ -1,24 +1,35 @@
1
1
  ---
2
2
  name: agent-orchestration
3
- description: Criar sistemas multi-agente com LangGraph incluindo orquestrador, subagentes, roteamento e delegação. Use quando precisar coordenar múltiplos agentes, criar times de agentes, ou implementar orquestração com LangGraph.
3
+ description: Build multi-agent systems with LangGraph including orchestrator, subagents, routing, and delegation. Use when coordinating multiple agents, creating agent teams, or implementing orchestration workflows.
4
+ version: 1.0.0
5
+ author: Maestro
4
6
  ---
5
7
 
6
- # Orquestração de Agentes
8
+ # Agent Orchestration
7
9
 
8
- ## Arquitetura Multi-Agente
10
+ Design and implement multi-agent systems where an orchestrator coordinates specialized subagents through task planning, intelligent routing, compliance validation, and human-in-the-loop approval.
9
11
 
10
- ```
11
- Orquestrador (LangGraph StateGraph)
12
- ├── Router Node decide qual agente executar
13
- ├── Agent Frontend executa tasks de frontend
14
- ├── Agent Backend executa tasks de backend
15
- ├── Agent DevOps executa tasks de infra
16
- ├── Validator Node → valida compliance com bundle
17
- ├── Human Review → interrupt para aprovação
18
- └── Merger Node mergea branches dos agentes
19
- ```
12
+ ## When to Use
13
+ - Coordinating multiple specialized agents (frontend, backend, devops)
14
+ - Implementing task decomposition and delegation workflows
15
+ - Building a LangGraph StateGraph with routing logic
16
+ - Adding human-in-the-loop approval gates for destructive operations
17
+ - Creating agent pipelines that validate compliance before merging work
18
+
19
+ ## Available Operations
20
+ 1. Define orchestrator state schema
21
+ 2. Build the orchestrator graph with nodes and edges
22
+ 3. Implement intelligent task routing
23
+ 4. Delegate tasks to specialized subagents
24
+ 5. Add compliance validation nodes
25
+ 6. Wire up human-in-the-loop interrupt gates
26
+ 7. Merge work from multiple agent branches
20
27
 
21
- ## AgentState
28
+ ## Multi-Step Workflow
29
+
30
+ ### Step 1: Define the Orchestrator State
31
+
32
+ Create a typed state schema that tracks the full lifecycle of a demand.
22
33
 
23
34
  ```python
24
35
  from typing import TypedDict, Annotated, Literal
@@ -36,14 +47,17 @@ class OrchestratorState(TypedDict):
36
47
  final_status: str
37
48
  ```
38
49
 
39
- ## Grafo do Orquestrador
50
+ ### Step 2: Build the Graph Structure
51
+
52
+ Wire up the orchestrator nodes and conditional edges.
40
53
 
41
54
  ```python
42
55
  from langgraph.graph import StateGraph, START, END
56
+ from langgraph.checkpoint.postgres import PostgresSaver
43
57
 
44
58
  graph = StateGraph(OrchestratorState)
45
59
 
46
- # Nós
60
+ # Add nodes
47
61
  graph.add_node("analyze_demand", analyze_demand_node)
48
62
  graph.add_node("plan_tasks", plan_tasks_node)
49
63
  graph.add_node("route_to_agent", route_to_agent_node)
@@ -52,7 +66,7 @@ graph.add_node("validate_compliance", validate_compliance_node)
52
66
  graph.add_node("human_review", human_review_node)
53
67
  graph.add_node("merge_work", merge_work_node)
54
68
 
55
- # Edges
69
+ # Wire edges
56
70
  graph.add_edge(START, "analyze_demand")
57
71
  graph.add_edge("analyze_demand", "plan_tasks")
58
72
  graph.add_edge("plan_tasks", "route_to_agent")
@@ -71,14 +85,37 @@ graph.add_edge("merge_work", END)
71
85
  app = graph.compile(checkpointer=PostgresSaver(conn))
72
86
  ```
73
87
 
74
- ## Delegação para subagentes
88
+ ### Step 3: Implement Intelligent Routing
89
+
90
+ Route tasks to the right subagent based on keywords or LLM classification.
91
+
92
+ ```python
93
+ def route_to_agent(state: OrchestratorState) -> dict:
94
+ task = state["task_plan"][state["current_task_index"]]
95
+
96
+ routing_map = {
97
+ "frontend": ["ui", "component", "screen", "react", "css"],
98
+ "backend": ["api", "endpoint", "database", "service", "entity"],
99
+ "devops": ["deploy", "pipeline", "docker", "k8s", "ci"],
100
+ }
101
+
102
+ for agent_type, keywords in routing_map.items():
103
+ if any(kw in task["description"].lower() for kw in keywords):
104
+ return {"assigned_agents": {task["id"]: agent_type}}
105
+
106
+ # Fallback: use LLM to decide
107
+ return {"assigned_agents": {task["id"]: llm_route(task)}}
108
+ ```
109
+
110
+ ### Step 4: Delegate to Subagents
111
+
112
+ Each subagent has its own graph, tools, and worktree.
75
113
 
76
114
  ```python
77
115
  async def execute_agent_node(state: OrchestratorState):
78
116
  task = state["task_plan"][state["current_task_index"]]
79
117
  agent_type = state["assigned_agents"][task["id"]]
80
118
 
81
- # Cada agente tem seu próprio grafo/tools
82
119
  agent = agent_registry.get(agent_type)
83
120
  result = await agent.ainvoke({
84
121
  "task": task,
@@ -95,28 +132,9 @@ async def execute_agent_node(state: OrchestratorState):
95
132
  }
96
133
  ```
97
134
 
98
- ## Roteamento inteligente
99
-
100
- ```python
101
- def route_to_agent(state: OrchestratorState) -> dict:
102
- """Decide qual tipo de agente executar baseado na task"""
103
- task = state["task_plan"][state["current_task_index"]]
104
-
105
- routing_map = {
106
- "frontend": ["ui", "componente", "tela", "react", "css"],
107
- "backend": ["api", "endpoint", "banco", "service", "entity"],
108
- "devops": ["deploy", "pipeline", "docker", "k8s", "ci"],
109
- }
110
-
111
- for agent_type, keywords in routing_map.items():
112
- if any(kw in task["description"].lower() for kw in keywords):
113
- return {"assigned_agents": {task["id"]: agent_type}}
114
-
115
- # Fallback: usar LLM para decidir
116
- return {"assigned_agents": {task["id"]: llm_route(task)}}
117
- ```
135
+ ### Step 5: Add Human-in-the-Loop Approval
118
136
 
119
- ## Human-in-the-loop
137
+ Use LangGraph interrupts for merge approval gates.
120
138
 
121
139
  ```python
122
140
  from langgraph.types import interrupt
@@ -126,7 +144,55 @@ def human_review_node(state: OrchestratorState):
126
144
  "type": "merge_approval",
127
145
  "branches": state["branch_status"],
128
146
  "compliance": state["compliance_results"],
129
- "message": "Aprovar merge dos branches?"
147
+ "message": "Approve merging branches?"
130
148
  })
131
149
  return {"needs_human_review": False, "final_status": approval["decision"]}
132
150
  ```
151
+
152
+ ### Step 6: Run and Test the Orchestrator
153
+
154
+ ```bash
155
+ # Run the orchestrator with a test demand
156
+ python -m orchestrator.run --demand "Create CRUD for demands with REST API and React UI"
157
+
158
+ # Verify the graph structure
159
+ python -c "from orchestrator.graph import app; app.get_graph().print_ascii()"
160
+ ```
161
+
162
+ ## Resources
163
+ - `references/graph-patterns.md` - Common LangGraph graph patterns for orchestration
164
+ - `references/routing-strategies.md` - Detailed routing strategies and fallback mechanisms
165
+
166
+ ## Examples
167
+
168
+ ### Example 1: Decompose and Execute a Full-Stack Demand
169
+ User asks: "Set up an orchestrator that decomposes a demand into frontend and backend tasks and delegates them."
170
+ Response approach:
171
+ 1. Define OrchestratorState with task_plan and assigned_agents
172
+ 2. Create analyze_demand node that uses LLM to break down the demand
173
+ 3. Create plan_tasks node that structures tasks with dependencies
174
+ 4. Implement keyword-based routing for frontend vs backend
175
+ 5. Wire up execute_agent to delegate each task to the right subagent
176
+ 6. Add compliance validation before merge
177
+
178
+ ### Example 2: Add a New Agent Type
179
+ User asks: "Add a QA agent that runs tests after backend tasks complete."
180
+ Response approach:
181
+ 1. Create a QA agent graph with test-running tools
182
+ 2. Register it in the agent_registry
183
+ 3. Add "qa" keywords to the routing map (e.g., "test", "quality", "coverage")
184
+ 4. Add a conditional edge from execute_agent to route QA tasks after backend
185
+
186
+ ### Example 3: Implement Parallel Agent Execution
187
+ User asks: "Make frontend and backend agents run in parallel instead of sequentially."
188
+ Response approach:
189
+ 1. Use LangGraph's `Send` API to fan out to multiple agents simultaneously
190
+ 2. Add a `join_results` node that waits for all parallel branches
191
+ 3. Wire conditional edges from join_results to validate_compliance
192
+
193
+ ## Notes
194
+ - Always use a checkpointer (PostgresSaver) so the orchestrator can resume after failures
195
+ - Each subagent should operate in its own git worktree to avoid conflicts
196
+ - Compliance validation should run before any merge operation
197
+ - Human review gates are mandatory for destructive operations (merges, deployments)
198
+ - Use thread_id based on demand_id for consistent state across invocations
@@ -0,0 +1,50 @@
1
+ # Graph Patterns Reference
2
+
3
+ ## Common LangGraph Orchestration Patterns
4
+
5
+ ### 1. Sequential Pipeline
6
+ ```
7
+ START -> analyze -> plan -> execute -> validate -> END
8
+ ```
9
+ Best for: Simple workflows with no branching.
10
+
11
+ ### 2. Router Pattern
12
+ ```
13
+ START -> analyze -> router --(frontend)--> agent_frontend -> merge
14
+ \--(backend)---> agent_backend -> merge
15
+ \--(devops)----> agent_devops -> merge
16
+ ```
17
+ Best for: Task delegation to specialized agents.
18
+
19
+ ### 3. Loop with Exit Condition
20
+ ```
21
+ START -> plan -> execute -> check_done --(more tasks)--> execute
22
+ \--(all done)---> validate -> END
23
+ ```
24
+ Best for: Iterating through a task list.
25
+
26
+ ### 4. Fan-Out / Fan-In (Parallel)
27
+ ```python
28
+ from langgraph.types import Send
29
+
30
+ def fan_out(state):
31
+ return [Send("execute_agent", {"task": t}) for t in state["task_plan"]]
32
+ ```
33
+ Best for: Independent tasks that can run concurrently.
34
+
35
+ ### 5. Human-in-the-Loop Gate
36
+ ```python
37
+ from langgraph.types import interrupt
38
+
39
+ def approval_gate(state):
40
+ result = interrupt({"message": "Approve?", "data": state["summary"]})
41
+ return {"approved": result["decision"] == "yes"}
42
+ ```
43
+ Best for: Destructive operations requiring human approval.
44
+
45
+ ## State Design Principles
46
+
47
+ - Use `Annotated[list, add_messages]` for message accumulation.
48
+ - Use `dict[str, str]` for mappings that grow over time (branch_status, assigned_agents).
49
+ - Keep state flat -- avoid deeply nested structures.
50
+ - Include a `current_task_index` integer for loop-based task execution.
@@ -0,0 +1,47 @@
1
+ # Routing Strategies Reference
2
+
3
+ ## Strategy 1: Keyword-Based Routing
4
+
5
+ Fast, deterministic, zero-cost. Use as primary router.
6
+
7
+ ```python
8
+ routing_map = {
9
+ "frontend": ["ui", "component", "screen", "react", "css", "layout", "form"],
10
+ "backend": ["api", "endpoint", "database", "service", "entity", "migration"],
11
+ "devops": ["deploy", "pipeline", "docker", "k8s", "ci", "monitoring"],
12
+ "qa": ["test", "coverage", "quality", "e2e", "integration test"],
13
+ }
14
+ ```
15
+
16
+ ## Strategy 2: LLM-Based Routing (Fallback)
17
+
18
+ Use when keywords are ambiguous. Costs tokens but handles edge cases.
19
+
20
+ ```python
21
+ async def llm_route(task: dict) -> str:
22
+ response = await llm.ainvoke(f"""
23
+ Classify this task into exactly one category: frontend, backend, devops, qa.
24
+ Task: {task['description']}
25
+ Respond with just the category name.
26
+ """)
27
+ return response.content.strip().lower()
28
+ ```
29
+
30
+ ## Strategy 3: Embedding Similarity
31
+
32
+ Pre-embed descriptions for each agent type, route by cosine similarity.
33
+
34
+ ```python
35
+ agent_descriptions = {
36
+ "frontend": "UI components, React, CSS, forms, layouts, user interactions",
37
+ "backend": "REST APIs, business logic, database operations, services",
38
+ "devops": "Docker, CI/CD, deployments, infrastructure, monitoring",
39
+ }
40
+ ```
41
+
42
+ ## Fallback Chain
43
+
44
+ 1. Try keyword match first (fastest).
45
+ 2. If no match, try embedding similarity (medium cost).
46
+ 3. If confidence < 0.7, use LLM routing (highest cost, best accuracy).
47
+ 4. If LLM is uncertain, default to "backend" and flag for human review.