wegho-agentes 4.0.1
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/.agents/AGENT_WORKFLOW.md +528 -0
- package/.agents/AI_COMPATIBILITY.md +332 -0
- package/.agents/CLI.md +222 -0
- package/.agents/README.md +130 -0
- package/.agents/cli.js +389 -0
- package/.agents/code-auditor-agent.ts +333 -0
- package/.agents/config.ts +145 -0
- package/.agents/context-loader.ts +300 -0
- package/.agents/core/agent-parallelizer.test.ts +94 -0
- package/.agents/core/agent-parallelizer.ts +108 -0
- package/.agents/core/architecture-agent.ts +237 -0
- package/.agents/core/base-agent.ts +311 -0
- package/.agents/core/cache-manager.test.ts +147 -0
- package/.agents/core/cache-manager.ts +184 -0
- package/.agents/core/documentation-agent.ts +183 -0
- package/.agents/core/feedback-collector.ts +207 -0
- package/.agents/core/frontend-agent.ts +210 -0
- package/.agents/core/inventory-agent.ts +582 -0
- package/.agents/core/memory-system.ts +397 -0
- package/.agents/core/quality-agent.ts +268 -0
- package/.agents/core/retry-utility.test.ts +165 -0
- package/.agents/core/retry-utility.ts +140 -0
- package/.agents/core/security-agent.ts +217 -0
- package/.agents/core/workflow-validator.test.ts +171 -0
- package/.agents/core/workflow-validator.ts +158 -0
- package/.agents/domains/README.md +53 -0
- package/.agents/domains/logistics/route-agent.ts +177 -0
- package/.agents/domains/news/cms-agent.ts +158 -0
- package/.agents/domains/news/seo-agent.ts +170 -0
- package/.agents/domains/production/production-control-agent.ts +169 -0
- package/.agents/example-learning-system.js +118 -0
- package/.agents/init.ts +164 -0
- package/.agents/memory/architecture-agent/failures.json +1 -0
- package/.agents/memory/architecture-agent/learnings.json +1 -0
- package/.agents/memory/architecture-agent/specialty.md +31 -0
- package/.agents/memory/architecture-agent/successes.json +16 -0
- package/.agents/memory/cms-agent/failures.json +1 -0
- package/.agents/memory/cms-agent/learnings.json +1 -0
- package/.agents/memory/cms-agent/specialty.md +30 -0
- package/.agents/memory/cms-agent/successes.json +16 -0
- package/.agents/memory/documentation-agent/failures.json +1 -0
- package/.agents/memory/documentation-agent/learnings.json +1 -0
- package/.agents/memory/documentation-agent/specialty.md +33 -0
- package/.agents/memory/documentation-agent/successes.json +16 -0
- package/.agents/memory/frontend-agent/failures.json +1 -0
- package/.agents/memory/frontend-agent/learnings.json +1 -0
- package/.agents/memory/frontend-agent/specialty.md +30 -0
- package/.agents/memory/frontend-agent/successes.json +16 -0
- package/.agents/memory/inventory-agent/failures.json +1 -0
- package/.agents/memory/inventory-agent/inventory/index.json +8 -0
- package/.agents/memory/inventory-agent/inventory/types.json +77716 -0
- package/.agents/memory/inventory-agent/inventory/variables.json +405 -0
- package/.agents/memory/inventory-agent/learnings.json +1 -0
- package/.agents/memory/inventory-agent/specialty.md +129 -0
- package/.agents/memory/inventory-agent/successes.json +30 -0
- package/.agents/memory/production-control-agent/failures.json +1 -0
- package/.agents/memory/production-control-agent/learnings.json +1 -0
- package/.agents/memory/production-control-agent/specialty.md +29 -0
- package/.agents/memory/production-control-agent/successes.json +16 -0
- package/.agents/memory/quality-agent/failures.json +16 -0
- package/.agents/memory/quality-agent/learnings.json +1 -0
- package/.agents/memory/quality-agent/specialty.md +31 -0
- package/.agents/memory/quality-agent/successes.json +1 -0
- package/.agents/memory/reference-repositories.json +271 -0
- package/.agents/memory/route-agent/failures.json +1 -0
- package/.agents/memory/route-agent/learnings.json +1 -0
- package/.agents/memory/route-agent/specialty.md +29 -0
- package/.agents/memory/route-agent/successes.json +16 -0
- package/.agents/memory/security-agent/failures.json +1 -0
- package/.agents/memory/security-agent/learnings.json +1 -0
- package/.agents/memory/security-agent/specialty.md +31 -0
- package/.agents/memory/security-agent/successes.json +16 -0
- package/.agents/memory/seo-agent/failures.json +1 -0
- package/.agents/memory/seo-agent/learnings.json +1 -0
- package/.agents/memory/seo-agent/specialty.md +31 -0
- package/.agents/memory/seo-agent/successes.json +16 -0
- package/.agents/orchestrator.ts +438 -0
- package/.agents/project-discovery-agent.ts +342 -0
- package/.agents/security/pentesting-agent.py +387 -0
- package/.agents/security/python-bridge.ts +193 -0
- package/.agents/security/vulnerability-db.json +201 -0
- package/.agents/task-analyzer-agent.ts +346 -0
- package/.agents/test-init-context.js +67 -0
- package/INSTALL.md +300 -0
- package/LICENSE +21 -0
- package/README.md +315 -0
- package/docs/AGENT_RULES.md +292 -0
- package/docs/BUILD_HISTORY.md +65 -0
- package/docs/DESIGN_SYSTEM.md +256 -0
- package/docs/LEARNING_SYSTEM.md +326 -0
- package/docs/SYMBOLS_TREE.md +182 -0
- package/docs/VERSION.md +6 -0
- package/docs/architecture.md +111 -0
- package/package.json +60 -0
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
# Fluxo de Trabalho dos Agentes - Guia Completo
|
|
2
|
+
|
|
3
|
+
## 🎯 Objetivo
|
|
4
|
+
|
|
5
|
+
Este documento define o **fluxo obrigatório** que todos os agentes devem seguir para:
|
|
6
|
+
- Documentar modificações
|
|
7
|
+
- Salvar na memória
|
|
8
|
+
- Ler histórico
|
|
9
|
+
- Consultar repositórios de referência
|
|
10
|
+
- Aprender com experiências passadas
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📋 Fluxo Completo de Execução
|
|
15
|
+
|
|
16
|
+
### 1️⃣ INICIALIZAÇÃO
|
|
17
|
+
|
|
18
|
+
Quando um agente é criado:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// Exemplo: Frontend Agent
|
|
22
|
+
const agent = new FrontEndAgent('.agents/memory');
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**O que acontece automaticamente:**
|
|
26
|
+
|
|
27
|
+
1. ✅ Cria pasta `.agents/memory/frontend-agent/`
|
|
28
|
+
2. ✅ Cria `specialty.md` com especialidade padrão
|
|
29
|
+
3. ✅ Cria `successes.json` vazio `[]`
|
|
30
|
+
4. ✅ Cria `failures.json` vazio `[]`
|
|
31
|
+
5. ✅ Cria `learnings.json` vazio `[]`
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### 2️⃣ ANTES DE EXECUTAR TAREFA
|
|
36
|
+
|
|
37
|
+
**Passo 1: Consultar Memória**
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
// Buscar casos similares
|
|
41
|
+
const similarCases = this.memory.getSimilarCases(
|
|
42
|
+
this.agentName,
|
|
43
|
+
taskDescription,
|
|
44
|
+
5 // limite
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// Exibir para o usuário
|
|
48
|
+
if (similarCases.length > 0) {
|
|
49
|
+
console.log(`💭 Encontrei ${similarCases.length} caso(s) similar(es):`);
|
|
50
|
+
similarCases.forEach((case_, index) => {
|
|
51
|
+
const emoji = case_.result === 'success' ? '✅' : '❌';
|
|
52
|
+
console.log(` ${index + 1}. ${emoji} ${case_.taskDescription}`);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Passo 2: Obter Recomendações**
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
// Buscar aprendizados relevantes
|
|
61
|
+
const recommendations = this.memory.getRecommendations(
|
|
62
|
+
this.agentName,
|
|
63
|
+
taskDescription
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
// Exibir para o usuário
|
|
67
|
+
if (recommendations.length > 0) {
|
|
68
|
+
console.log(`💡 Recomendações baseadas em aprendizados:`);
|
|
69
|
+
recommendations.forEach((rec, index) => {
|
|
70
|
+
console.log(` ${index + 1}. ${rec}`);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Passo 3: Consultar Repositórios de Referência**
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// Carregar repositórios públicos
|
|
79
|
+
const referenceRepos = JSON.parse(
|
|
80
|
+
fs.readFileSync('.agents/memory/reference-repositories.json', 'utf-8')
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
// Exemplo: Frontend Agent consulta React
|
|
84
|
+
const reactDocs = referenceRepos.repositories.react.docs;
|
|
85
|
+
console.log(`📚 Consultando: ${reactDocs}`);
|
|
86
|
+
|
|
87
|
+
// Exemplo: Security Agent consulta OWASP
|
|
88
|
+
const owaspTop10 = referenceRepos.security_resources.owasp_top_10.url;
|
|
89
|
+
console.log(`🔒 Consultando: ${owaspTop10}`);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### 3️⃣ DURANTE A EXECUÇÃO
|
|
95
|
+
|
|
96
|
+
**Aplicar Recomendações**
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
async executeTask(taskDescription: string, context: TaskContext): Promise<TaskResult> {
|
|
100
|
+
// 1. Aplicar aprendizados anteriores
|
|
101
|
+
const learnings = this.memory.loadMemory(this.agentName).learnings;
|
|
102
|
+
|
|
103
|
+
// 2. Executar validações
|
|
104
|
+
const issues: string[] = [];
|
|
105
|
+
const warnings: string[] = [];
|
|
106
|
+
const recommendations: string[] = [];
|
|
107
|
+
|
|
108
|
+
// 3. Validar baseado em aprendizados
|
|
109
|
+
for (const learning of learnings) {
|
|
110
|
+
if (learning.confidence > 0.7) {
|
|
111
|
+
// Aplicar recomendação com alta confiança
|
|
112
|
+
recommendations.push(learning.recommendation);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 4. Retornar resultado
|
|
117
|
+
return {
|
|
118
|
+
success: issues.length === 0,
|
|
119
|
+
details: '...',
|
|
120
|
+
issues,
|
|
121
|
+
warnings,
|
|
122
|
+
recommendations
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### 4️⃣ APÓS EXECUTAR TAREFA
|
|
130
|
+
|
|
131
|
+
**Passo 1: Registrar Resultado**
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// Sucesso
|
|
135
|
+
if (result.success) {
|
|
136
|
+
this.memory.recordSuccess(
|
|
137
|
+
this.agentName,
|
|
138
|
+
taskDescription,
|
|
139
|
+
context,
|
|
140
|
+
result.details,
|
|
141
|
+
userFeedback // opcional
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Falha
|
|
146
|
+
else {
|
|
147
|
+
this.memory.recordFailure(
|
|
148
|
+
this.agentName,
|
|
149
|
+
taskDescription,
|
|
150
|
+
context,
|
|
151
|
+
result.details,
|
|
152
|
+
userFeedback // opcional
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**O que é salvo automaticamente:**
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"id": "1737594123456-abc123",
|
|
162
|
+
"timestamp": "2026-01-22T23:00:00.000Z",
|
|
163
|
+
"taskDescription": "Validar componente de login",
|
|
164
|
+
"context": {
|
|
165
|
+
"files": ["components/Login.tsx"],
|
|
166
|
+
"areas": ["frontend", "security"],
|
|
167
|
+
"complexity": "medium"
|
|
168
|
+
},
|
|
169
|
+
"result": "success",
|
|
170
|
+
"details": "Validação concluída sem problemas",
|
|
171
|
+
"userFeedback": null
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### 5️⃣ COLETAR FEEDBACK DO USUÁRIO
|
|
178
|
+
|
|
179
|
+
**Quando o usuário fornece feedback:**
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
await orchestrator.provideFeedback(taskId, 'frontend-agent', {
|
|
183
|
+
satisfied: true,
|
|
184
|
+
likes: [
|
|
185
|
+
'Validação com Zod implementada',
|
|
186
|
+
'Estados de loading/error incluídos'
|
|
187
|
+
],
|
|
188
|
+
dislikes: [],
|
|
189
|
+
suggestions: ['Adicionar animações']
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**O que acontece:**
|
|
194
|
+
|
|
195
|
+
1. ✅ Atualiza entrada em `successes.json` ou `failures.json`
|
|
196
|
+
2. ✅ Gera aprendizados em `learnings.json`
|
|
197
|
+
|
|
198
|
+
**Aprendizados gerados:**
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"id": "learning-1",
|
|
203
|
+
"pattern": "Repetir: Validação com Zod",
|
|
204
|
+
"description": "Usuário gostou de: Validação com Zod",
|
|
205
|
+
"recommendation": "Continuar fazendo: Validação com Zod",
|
|
206
|
+
"confidence": 0.5,
|
|
207
|
+
"occurrences": 1,
|
|
208
|
+
"lastSeen": "2026-01-22T23:00:00.000Z",
|
|
209
|
+
"examples": ["1737594123456-abc123"]
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### 6️⃣ APRENDIZADO CONTÍNUO
|
|
216
|
+
|
|
217
|
+
**Quando o mesmo padrão aparece novamente:**
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
// Aprendizado existente
|
|
221
|
+
const existing = memory.learnings.find(l => l.pattern === pattern);
|
|
222
|
+
|
|
223
|
+
if (existing) {
|
|
224
|
+
existing.occurrences++; // Incrementa
|
|
225
|
+
existing.lastSeen = new Date();
|
|
226
|
+
existing.confidence = Math.min(1, existing.confidence + 0.1); // Aumenta confiança
|
|
227
|
+
existing.examples.push(newExampleId);
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Evolução da confiança:**
|
|
232
|
+
|
|
233
|
+
- 1ª ocorrência: `confidence = 0.5`
|
|
234
|
+
- 2ª ocorrência: `confidence = 0.6`
|
|
235
|
+
- 3ª ocorrência: `confidence = 0.7`
|
|
236
|
+
- ...
|
|
237
|
+
- 5ª ocorrência: `confidence = 0.9`
|
|
238
|
+
- Máximo: `confidence = 1.0`
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 📂 Estrutura de Arquivos
|
|
243
|
+
|
|
244
|
+
### `specialty.md`
|
|
245
|
+
|
|
246
|
+
Define a especialidade do agente:
|
|
247
|
+
|
|
248
|
+
```markdown
|
|
249
|
+
# Frontend Agent - Especialidade
|
|
250
|
+
|
|
251
|
+
## Responsabilidades
|
|
252
|
+
- Validar componentes React/Next.js
|
|
253
|
+
- Garantir acessibilidade (WCAG 2.1)
|
|
254
|
+
...
|
|
255
|
+
|
|
256
|
+
## Expertise
|
|
257
|
+
- React, Next.js, TypeScript
|
|
258
|
+
...
|
|
259
|
+
|
|
260
|
+
## Regras
|
|
261
|
+
- Componentes < 500 linhas
|
|
262
|
+
- Sempre incluir estados: loading, error, empty
|
|
263
|
+
...
|
|
264
|
+
|
|
265
|
+
## Tarefas Típicas
|
|
266
|
+
- Criar/validar componentes UI
|
|
267
|
+
...
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### `successes.json`
|
|
271
|
+
|
|
272
|
+
Array de sucessos:
|
|
273
|
+
|
|
274
|
+
```json
|
|
275
|
+
[
|
|
276
|
+
{
|
|
277
|
+
"id": "unique-id",
|
|
278
|
+
"timestamp": "ISO-8601",
|
|
279
|
+
"taskDescription": "string",
|
|
280
|
+
"context": { "files": [], "areas": [], "complexity": "low|medium|high" },
|
|
281
|
+
"result": "success",
|
|
282
|
+
"details": "string",
|
|
283
|
+
"userFeedback": { "satisfied": true, "likes": [], "dislikes": [], "suggestions": [] }
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### `failures.json`
|
|
289
|
+
|
|
290
|
+
Array de falhas (mesma estrutura, `result: "failure"`):
|
|
291
|
+
|
|
292
|
+
```json
|
|
293
|
+
[
|
|
294
|
+
{
|
|
295
|
+
"id": "unique-id",
|
|
296
|
+
"timestamp": "ISO-8601",
|
|
297
|
+
"taskDescription": "string",
|
|
298
|
+
"context": { ... },
|
|
299
|
+
"result": "failure",
|
|
300
|
+
"details": "string com motivo da falha",
|
|
301
|
+
"userFeedback": { "satisfied": false, "dislikes": [...], ... }
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### `learnings.json`
|
|
307
|
+
|
|
308
|
+
Array de aprendizados:
|
|
309
|
+
|
|
310
|
+
```json
|
|
311
|
+
[
|
|
312
|
+
{
|
|
313
|
+
"id": "learning-id",
|
|
314
|
+
"pattern": "Repetir: Feature X" ou "Evitar: Problema Y",
|
|
315
|
+
"description": "Usuário gostou/não gostou de: ...",
|
|
316
|
+
"recommendation": "Continuar fazendo / Evitar fazer: ...",
|
|
317
|
+
"confidence": 0.0-1.0,
|
|
318
|
+
"occurrences": number,
|
|
319
|
+
"lastSeen": "ISO-8601",
|
|
320
|
+
"examples": ["task-id-1", "task-id-2"]
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## 🔄 Fluxo de Leitura
|
|
328
|
+
|
|
329
|
+
### Carregar Memória Completa
|
|
330
|
+
|
|
331
|
+
```typescript
|
|
332
|
+
const memory = this.memory.loadMemory(this.agentName);
|
|
333
|
+
|
|
334
|
+
console.log(`Sucessos: ${memory.successes.length}`);
|
|
335
|
+
console.log(`Falhas: ${memory.failures.length}`);
|
|
336
|
+
console.log(`Aprendizados: ${memory.learnings.length}`);
|
|
337
|
+
console.log(`Taxa de sucesso: ${(memory.stats.successRate * 100).toFixed(1)}%`);
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Buscar Casos Específicos
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
// Por similaridade
|
|
344
|
+
const similar = this.memory.getSimilarCases(agentName, 'criar componente', 5);
|
|
345
|
+
|
|
346
|
+
// Por resultado
|
|
347
|
+
const allSuccesses = memory.successes;
|
|
348
|
+
const allFailures = memory.failures;
|
|
349
|
+
|
|
350
|
+
// Por data
|
|
351
|
+
const recent = memory.successes.filter(s => {
|
|
352
|
+
const date = new Date(s.timestamp);
|
|
353
|
+
const dayAgo = new Date(Date.now() - 24 * 60 * 60 * 1000);
|
|
354
|
+
return date > dayAgo;
|
|
355
|
+
});
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Filtrar Aprendizados
|
|
359
|
+
|
|
360
|
+
```typescript
|
|
361
|
+
// Alta confiança
|
|
362
|
+
const highConfidence = memory.learnings.filter(l => l.confidence > 0.7);
|
|
363
|
+
|
|
364
|
+
// Mais recentes
|
|
365
|
+
const recent = memory.learnings.sort((a, b) =>
|
|
366
|
+
new Date(b.lastSeen).getTime() - new Date(a.lastSeen).getTime()
|
|
367
|
+
).slice(0, 10);
|
|
368
|
+
|
|
369
|
+
// Por padrão
|
|
370
|
+
const positivePatterns = memory.learnings.filter(l => l.pattern.startsWith('Repetir:'));
|
|
371
|
+
const negativePatterns = memory.learnings.filter(l => l.pattern.startsWith('Evitar:'));
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## 🌐 Uso de Repositórios de Referência
|
|
377
|
+
|
|
378
|
+
### Carregar Repositórios
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
const repos = JSON.parse(
|
|
382
|
+
fs.readFileSync('.agents/memory/reference-repositories.json', 'utf-8')
|
|
383
|
+
);
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### Por Agente
|
|
387
|
+
|
|
388
|
+
**Frontend Agent:**
|
|
389
|
+
```typescript
|
|
390
|
+
const react = repos.repositories.react;
|
|
391
|
+
const nextjs = repos.repositories.nextjs;
|
|
392
|
+
const tailwind = repos.repositories.tailwindcss;
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
**Security Agent:**
|
|
396
|
+
```typescript
|
|
397
|
+
const owasp = repos.security_resources.owasp_top_10;
|
|
398
|
+
const owaspCheatSheets = repos.security_resources.owasp_cheat_sheets;
|
|
399
|
+
const dompurify = repos.repositories.dompurify;
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Quality Agent:**
|
|
403
|
+
```typescript
|
|
404
|
+
const eslint = repos.repositories.eslint;
|
|
405
|
+
const prettier = repos.repositories.prettier;
|
|
406
|
+
const jest = repos.repositories.jest;
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**Architecture Agent:**
|
|
410
|
+
```typescript
|
|
411
|
+
const cleanCode = repos.best_practices.clean_code;
|
|
412
|
+
const nodeBestPractices = repos.best_practices.node_best_practices;
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
**Documentation Agent:**
|
|
416
|
+
```typescript
|
|
417
|
+
const mdn = repos.documentation_sources.mdn;
|
|
418
|
+
const webDev = repos.documentation_sources.web_dev;
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## ✅ Checklist Obrigatório
|
|
424
|
+
|
|
425
|
+
Antes de cada execução, o agente DEVE:
|
|
426
|
+
|
|
427
|
+
- [ ] Consultar memória para casos similares
|
|
428
|
+
- [ ] Obter recomendações de aprendizados
|
|
429
|
+
- [ ] Consultar repositórios de referência relevantes
|
|
430
|
+
- [ ] Aplicar aprendizados com alta confiança (>0.7)
|
|
431
|
+
|
|
432
|
+
Após cada execução, o agente DEVE:
|
|
433
|
+
|
|
434
|
+
- [ ] Registrar resultado (sucesso ou falha)
|
|
435
|
+
- [ ] Incluir contexto completo (files, areas, complexity)
|
|
436
|
+
- [ ] Aguardar feedback do usuário (opcional)
|
|
437
|
+
- [ ] Gerar aprendizados baseado em feedback
|
|
438
|
+
|
|
439
|
+
Periodicamente, o agente DEVE:
|
|
440
|
+
|
|
441
|
+
- [ ] Limpar entradas antigas (manter últimas 1000)
|
|
442
|
+
- [ ] Consolidar aprendizados similares
|
|
443
|
+
- [ ] Atualizar confiança baseado em novas ocorrências
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
## 🎯 Exemplo Completo
|
|
448
|
+
|
|
449
|
+
```typescript
|
|
450
|
+
// 1. INICIALIZAÇÃO
|
|
451
|
+
const agent = new FrontEndAgent('.agents/memory');
|
|
452
|
+
|
|
453
|
+
// 2. EXECUTAR COM MEMÓRIA
|
|
454
|
+
const result = await agent.executeWithMemory(
|
|
455
|
+
'Validar componente de login',
|
|
456
|
+
{
|
|
457
|
+
files: ['components/Login.tsx'],
|
|
458
|
+
areas: ['frontend', 'security'],
|
|
459
|
+
complexity: 'medium'
|
|
460
|
+
}
|
|
461
|
+
);
|
|
462
|
+
|
|
463
|
+
// 3. FORNECER FEEDBACK
|
|
464
|
+
await orchestrator.provideFeedback(taskId, 'frontend-agent', {
|
|
465
|
+
satisfied: true,
|
|
466
|
+
likes: ['Validação com Zod', 'Estados de loading/error'],
|
|
467
|
+
dislikes: [],
|
|
468
|
+
suggestions: ['Adicionar animações']
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
// 4. PRÓXIMA EXECUÇÃO USA APRENDIZADOS
|
|
472
|
+
const result2 = await agent.executeWithMemory(
|
|
473
|
+
'Validar componente de registro',
|
|
474
|
+
{ ... }
|
|
475
|
+
);
|
|
476
|
+
// Agente automaticamente aplica: "Usar Zod", "Incluir estados"
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## 📊 Métricas de Sucesso
|
|
482
|
+
|
|
483
|
+
Cada agente deve manter:
|
|
484
|
+
|
|
485
|
+
- **Taxa de Sucesso**: `successes / (successes + failures)`
|
|
486
|
+
- **Total de Tarefas**: `successes.length + failures.length`
|
|
487
|
+
- **Aprendizados Ativos**: `learnings.filter(l => l.confidence > 0.7).length`
|
|
488
|
+
- **Última Atualização**: `stats.lastUpdated`
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
492
|
+
## 🚨 Regras Importantes
|
|
493
|
+
|
|
494
|
+
1. **NUNCA** modificar arquivos de memória manualmente
|
|
495
|
+
2. **SEMPRE** usar `MemorySystem` para leitura/escrita
|
|
496
|
+
3. **SEMPRE** incluir contexto completo ao registrar
|
|
497
|
+
4. **SEMPRE** consultar memória antes de executar
|
|
498
|
+
5. **SEMPRE** aplicar aprendizados com alta confiança
|
|
499
|
+
6. **SEMPRE** consultar repositórios de referência relevantes
|
|
500
|
+
|
|
501
|
+
---
|
|
502
|
+
|
|
503
|
+
## 📝 Resumo
|
|
504
|
+
|
|
505
|
+
**Fluxo Simplificado:**
|
|
506
|
+
|
|
507
|
+
```
|
|
508
|
+
1. Inicializar → Criar estrutura de memória
|
|
509
|
+
2. Consultar → Casos similares + Recomendações + Repositórios
|
|
510
|
+
3. Executar → Aplicar aprendizados
|
|
511
|
+
4. Registrar → Salvar resultado
|
|
512
|
+
5. Feedback → Gerar aprendizados
|
|
513
|
+
6. Repetir → Melhorar continuamente
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
**Arquivos por Agente:**
|
|
517
|
+
- `specialty.md` - Especialidade (criado automaticamente)
|
|
518
|
+
- `successes.json` - Sucessos (atualizado automaticamente)
|
|
519
|
+
- `failures.json` - Falhas (atualizado automaticamente)
|
|
520
|
+
- `learnings.json` - Aprendizados (atualizado com feedback)
|
|
521
|
+
|
|
522
|
+
**Repositórios Compartilhados:**
|
|
523
|
+
- `reference-repositories.json` - 27 recursos públicos (todos os agentes)
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
**Versão**: 1.0
|
|
528
|
+
**Última Atualização**: 2026-01-22
|