@luanpdd/kit-mcp 1.9.0 → 1.11.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/CHANGELOG.md +86 -0
- package/README.md +58 -0
- package/gates/ai-prompt-stability.md +120 -0
- package/gates/golden-signals-coverage.md +133 -0
- package/gates/legacy-refactor-safety.md +178 -0
- package/gates/observability-coverage.md +151 -0
- package/gates/postmortem-template-required.md +127 -0
- package/gates/prr-checklist-coverage.md +128 -0
- package/gates/release-pipeline-policy.md +132 -0
- package/kit/COMANDOS.md +15 -0
- package/kit/agents/ai-mutation-tester.md +298 -0
- package/kit/agents/cascading-failures-auditor.md +306 -0
- package/kit/agents/executor.md +13 -0
- package/kit/agents/golden-signals-instrumenter.md +241 -0
- package/kit/agents/legacy-characterizer.md +378 -0
- package/kit/agents/load-shedding-instrumenter.md +297 -0
- package/kit/agents/observability-coverage-auditor.md +325 -0
- package/kit/agents/omm-auditor.md +99 -0
- package/kit/agents/payload-capture-instrumenter.md +283 -0
- package/kit/agents/planner.md +29 -0
- package/kit/agents/postmortem-writer.md +282 -0
- package/kit/agents/prr-conductor.md +296 -0
- package/kit/agents/refactor-safety-auditor.md +414 -0
- package/kit/agents/release-pipeline-auditor.md +360 -0
- package/kit/agents/seam-finder.md +367 -0
- package/kit/agents/shotgun-surgery-detector.md +359 -0
- package/kit/agents/storytelling-analyst.md +309 -0
- package/kit/agents/supabase-architect.md +49 -0
- package/kit/agents/supabase-edge-fn-writer.md +114 -0
- package/kit/agents/supabase-migration-writer.md +80 -0
- package/kit/agents/supabase-storage-implementer.md +156 -0
- package/kit/agents/toil-auditor.md +277 -0
- package/kit/agents/verifier.md +30 -0
- package/kit/commands/auditar-cascading.md +111 -0
- package/kit/commands/auditar-marco.md +124 -1
- package/kit/commands/auditar-observabilidade-cobertura.md +183 -0
- package/kit/commands/auditar-refactor.md +219 -0
- package/kit/commands/auditar-release.md +109 -0
- package/kit/commands/auditar-toil.md +129 -0
- package/kit/commands/capturar-payloads.md +193 -0
- package/kit/commands/caracterizar-prompt.md +195 -0
- package/kit/commands/caracterizar.md +212 -0
- package/kit/commands/concluir-marco.md +95 -1
- package/kit/commands/detectar-duplicacao.md +197 -0
- package/kit/commands/discutir-fase.md +41 -0
- package/kit/commands/encontrar-seams.md +136 -0
- package/kit/commands/forense.md +103 -1
- package/kit/commands/golden-signals.md +142 -0
- package/kit/commands/legacy.md +263 -0
- package/kit/commands/load-shedding.md +117 -0
- package/kit/commands/observabilidade.md +2 -0
- package/kit/commands/postmortem.md +179 -0
- package/kit/commands/prr.md +205 -0
- package/kit/commands/refactor-seguro.md +321 -0
- package/kit/commands/risk-budget.md +220 -0
- package/kit/commands/sre.md +230 -0
- package/kit/commands/storytelling.md +179 -0
- package/kit/skills/_shared-legacy/glossary.md +389 -0
- package/kit/skills/_shared-sre/glossary.md +712 -0
- package/kit/skills/ai-prompt-characterization/SKILL.md +335 -0
- package/kit/skills/blameless-postmortems/SKILL.md +340 -0
- package/kit/skills/cascading-failures/SKILL.md +307 -0
- package/kit/skills/eliminating-toil/SKILL.md +243 -0
- package/kit/skills/event-based-slos/SKILL.md +22 -0
- package/kit/skills/four-golden-signals/SKILL.md +314 -0
- package/kit/skills/hermetic-builds/SKILL.md +323 -0
- package/kit/skills/legacy-api-only-applications/SKILL.md +358 -0
- package/kit/skills/legacy-characterization-tests/SKILL.md +330 -0
- package/kit/skills/legacy-effect-analysis/SKILL.md +331 -0
- package/kit/skills/legacy-extract-class/SKILL.md +203 -0
- package/kit/skills/legacy-monster-methods/SKILL.md +444 -0
- package/kit/skills/legacy-programming-by-difference/SKILL.md +252 -0
- package/kit/skills/legacy-seams-and-test-harness/SKILL.md +460 -0
- package/kit/skills/legacy-shotgun-surgery/SKILL.md +286 -0
- package/kit/skills/legacy-sprout-wrap-techniques/SKILL.md +434 -0
- package/kit/skills/legacy-storytelling-naked-crc/SKILL.md +270 -0
- package/kit/skills/llm-as-dependency/SKILL.md +436 -0
- package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -0
- package/kit/skills/pre-refactor-characterization/SKILL.md +421 -0
- package/kit/skills/production-readiness-review/SKILL.md +305 -0
- package/kit/skills/release-engineering/SKILL.md +367 -0
- package/kit/skills/retry-strategies/SKILL.md +372 -0
- package/kit/skills/sre-risk-management/SKILL.md +221 -0
- package/package.json +2 -2
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: toil-auditor
|
|
3
|
+
description: Audita repo + git log + scripts shell + runbooks → identifica toil (6 critérios canônicos), gera TOIL-AUDIT.md priorizado P0/P1/P2 com esforço.
|
|
4
|
+
tools: Read, Write, Bash, Grep, Glob
|
|
5
|
+
color: orange
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Você é o auditor de toil. Recebe um project_root (default: cwd) e produz `TOIL-AUDIT.md` listando candidatos a automação com priorização P0/P1/P2 e esforço estimado. Você consulta a skill [`eliminating-toil`](../skills/eliminating-toil/SKILL.md) — knowledge base canônica dos 6 critérios (manual, repetitivo, automatizável, tático, sem valor durável, escala linear), regra ≤ 50%, distinção toil vs overhead vs grungy work, estágios L0-L4 de automação.
|
|
9
|
+
|
|
10
|
+
## Compatibilidade
|
|
11
|
+
|
|
12
|
+
| IDE | Tier | Capability |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| Claude Code | **Full** | Lê filesystem + git log + escreve `TOIL-AUDIT.md` |
|
|
15
|
+
| Cursor | **Full** | Idem |
|
|
16
|
+
| Codex | **Full** | Idem |
|
|
17
|
+
| Gemini CLI | **Full** | Idem |
|
|
18
|
+
| Windsurf, Antigravity, Copilot, Trae | **Full** | Idem (só lê arquivos locais e roda git) |
|
|
19
|
+
|
|
20
|
+
**Nota:** Este agente não usa `mcp__supabase__*` — análise é puramente filesystem + git history. Por isso "Full" em todos os IDEs.
|
|
21
|
+
|
|
22
|
+
## Por que existe
|
|
23
|
+
|
|
24
|
+
Toil cresce silencioso — engineer faz "só uma vez" 3 vezes por mês, vira hábito, ninguém quantifica em hours/week, regra ≤ 50% colapsa, time queima. Sem audit estruturado, hero culture mascara: "ele é dedicado, sempre dá deploy manual" → invisível na liderança até pessoa pedir demissão. Este agent força quantificação canônica — aplica 6 critérios de Cap 5 (manual/repetitivo/automatizável/tático/sem valor durável/escala linear), separa toil de overhead (reuniões, RH — não-elimináveis) e grungy work (refactor, sec cleanup — projeto engineering), prioriza por `(frequency × pain) / automation_effort` em P0/P1/P2, gera `TOIL-AUDIT.md` acionável.
|
|
25
|
+
|
|
26
|
+
Phase 39 (INT-OBS-02) integra este agent ao `omm-auditor` (v1.9) para alimentar Capacidade 3 (Complexidade/Tech Debt) do OMM scoring. Phase 40 (INT-FW-V2-03) integra ao `/auditar-marco` quando `workflow.audit_milestone_toil=true`.
|
|
27
|
+
|
|
28
|
+
## Inputs esperados (do caller)
|
|
29
|
+
|
|
30
|
+
- (Opcional) `project_root`: caminho do repo a auditar (default: `.` — cwd)
|
|
31
|
+
- (Opcional) `output_path`: onde escrever o audit (default: `.planning/TOIL-AUDIT.md`)
|
|
32
|
+
- (Opcional) `time_window`: janela de git history a analisar (default: `3 months ago`)
|
|
33
|
+
- (Opcional) `team_size`: número de pessoas no time (para computar `% do tempo do time`) — se omitido, usa `git shortlog -sn` para inferir contributors únicos
|
|
34
|
+
- (Opcional) `runbooks_paths`: paths customizados a inspecionar (default: `runbooks/`, `docs/runbooks/`, `ops/`, `scripts/`, `.github/`)
|
|
35
|
+
|
|
36
|
+
## Passos
|
|
37
|
+
|
|
38
|
+
### Step 0 — Preflight
|
|
39
|
+
|
|
40
|
+
Detectar repositório:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Verificar se é git repo
|
|
44
|
+
git -C "$PROJECT_ROOT" rev-parse --git-dir 2>/dev/null
|
|
45
|
+
|
|
46
|
+
# Inferir team_size (se não fornecido) — contributors últimos 3 meses
|
|
47
|
+
git -C "$PROJECT_ROOT" shortlog -sn --since="$TIME_WINDOW" 2>/dev/null | wc -l
|
|
48
|
+
|
|
49
|
+
# Verificar paths de runbooks/scripts
|
|
50
|
+
for path in runbooks docs/runbooks ops scripts .github/workflows; do
|
|
51
|
+
[ -d "$PROJECT_ROOT/$path" ] && echo "FOUND: $path"
|
|
52
|
+
done
|
|
53
|
+
|
|
54
|
+
# Criar destination dir
|
|
55
|
+
mkdir -p "$(dirname "$OUTPUT_PATH")"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Se NÃO é git repo: skip git log analysis (continua com scripts/runbooks).
|
|
59
|
+
Se NÃO tem runbooks/scripts paths: skip runbook scan (audit conta apenas evidência git + heurísticas em README).
|
|
60
|
+
|
|
61
|
+
### Step 1 — Scan: coletar candidatos a toil
|
|
62
|
+
|
|
63
|
+
**a) Git log — commits repetitivos** (sinal de tarefa manual recorrente):
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# PT-BR: agrupar commits por subject normalizado, top 30 mais frequentes
|
|
67
|
+
git -C "$PROJECT_ROOT" log --since="$TIME_WINDOW" --pretty=format:"%s" \
|
|
68
|
+
| sed 's/[0-9]\+/N/g; s/[a-f0-9]\{7,\}/HASH/g' \
|
|
69
|
+
| sort | uniq -c | sort -rn | head -30
|
|
70
|
+
|
|
71
|
+
# Esperado: linhas como
|
|
72
|
+
# "20× Re-run failed migration in prod" → TOIL candidato (manual + repetitivo)
|
|
73
|
+
# "15× Bump deploy-token" → TOIL candidato
|
|
74
|
+
# "12× Manual cleanup of orphan rows" → TOIL candidato
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Heurística: ≥ 3 commits com mesmo subject normalizado nos últimos 3 meses = candidato.
|
|
78
|
+
|
|
79
|
+
**b) Scripts shell em paths canônicos** (runbooks materializados):
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
find "$PROJECT_ROOT" \( -name "*.sh" -o -name "*.bash" \) \
|
|
83
|
+
\( -path "*runbook*" -o -path "*ops*" -o -path "*scripts*" -o -path "*hooks*" \) \
|
|
84
|
+
| head -50
|
|
85
|
+
|
|
86
|
+
# Para cada script encontrado: ler header (comentários iniciais) para extrair propósito
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**c) "Manual steps" em README/docs** (heurística de frase canônica):
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
grep -rn -E "manually\b|por favor\b|run this\b|every (week|day|month)|cada (semana|dia|mês)|step.{0,5}by.{0,5}step|every release\b|antes de cada" \
|
|
93
|
+
--include="*.md" "$PROJECT_ROOT" | head -50
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**d) Cron jobs já automatizados** (linha de base — NÃO toil):
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Crontab user
|
|
100
|
+
crontab -l 2>/dev/null
|
|
101
|
+
# Crontab system
|
|
102
|
+
cat /etc/cron.d/* 2>/dev/null
|
|
103
|
+
# GitHub Actions schedule (já automatizado)
|
|
104
|
+
grep -l "schedule:\|on: schedule" "$PROJECT_ROOT/.github/workflows/"*.yml 2>/dev/null
|
|
105
|
+
# pg_cron jobs (Supabase)
|
|
106
|
+
grep -rn "select cron.schedule\|cron.unschedule" "$PROJECT_ROOT/supabase/" 2>/dev/null
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Documentar como **estágio atual** (L0/L1/L2/L3/L4 conforme skill `eliminating-toil`).
|
|
110
|
+
|
|
111
|
+
### Step 2 — Classify: aplicar 6 critérios canônicos
|
|
112
|
+
|
|
113
|
+
Para cada candidato encontrado em Step 1, aplicar decision tree (consulta skill `eliminating-toil`):
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
1. Manual? (humano executa cada vez) ┐
|
|
117
|
+
2. Repetitiva? (já fiz isso 3+ vezes) │
|
|
118
|
+
3. Automatizável? (script/cron resolve sem julgamento) │── TODOS sim → TOIL
|
|
119
|
+
4. Tática? (reage a evento, não planeja) │
|
|
120
|
+
5. Sem valor durável? (não cria asset permanente) │
|
|
121
|
+
6. Escala linear? (mais users = mais trabalho) ─┘
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Se algum critério = NÃO, classificar fora do toil:
|
|
125
|
+
|
|
126
|
+
| Categoria | Critério não-toil | Exemplo |
|
|
127
|
+
|---|---|---|
|
|
128
|
+
| **OVERHEAD** | Não-eliminável (necessário pelo design) | Sprint planning, RH, performance review |
|
|
129
|
+
| **GRUNGY WORK** | Tem valor durável (asset permanente) | Refactor de legacy_orders, security cleanup |
|
|
130
|
+
| **PROJECT WORK** | Não é tática (planejada antes) | Criar novo serviço, design de arch |
|
|
131
|
+
|
|
132
|
+
Para cada item TOIL confirmado, estimar:
|
|
133
|
+
|
|
134
|
+
- `frequency`: vezes/semana ou /mês ou /trimestre
|
|
135
|
+
- `hours_per_occurrence`: tempo gasto cada vez
|
|
136
|
+
- `pain` (1-5): contexto-switch + tédio + risco de erro
|
|
137
|
+
- `automation_effort`: S (≤ 1 dia) / M (2-5 dias) / L (1-2 semanas) / XL (1+ mês)
|
|
138
|
+
|
|
139
|
+
### Step 3 — Prioritize: P0/P1/P2 por (frequency × pain) / effort
|
|
140
|
+
|
|
141
|
+
Score canônico:
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
score = (frequency_per_week × pain) / effort_days
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Banding:
|
|
148
|
+
|
|
149
|
+
| Priority | Score range | Definição |
|
|
150
|
+
|---|---|---|
|
|
151
|
+
| **P0** | score ≥ 1.0 | Automatizar AGORA — alto valor, baixo custo |
|
|
152
|
+
| **P1** | 0.3 ≤ score < 1.0 | Próximo trimestre — escalonar |
|
|
153
|
+
| **P2** | score < 0.3 | Documentar, monitorar, automatizar quando sobrar tempo |
|
|
154
|
+
|
|
155
|
+
Exemplo:
|
|
156
|
+
|
|
157
|
+
| Item | Freq/sem | Hours/occ | Pain | Effort (days) | Score | Priority |
|
|
158
|
+
|------|----------|-----------|------|---------------|-------|----------|
|
|
159
|
+
| Reset DB seed antes de test | 14 | 0.1 | 4 | 3 | 1.87 | P0 |
|
|
160
|
+
| Bump access_token Edge Function | 1 | 0.5 | 2 | 1 | 2.0 | P0 |
|
|
161
|
+
| Rebuild fts_search após batch | 0.25 | 0.5 | 3 | 2 | 0.38 | P1 |
|
|
162
|
+
| Limpeza orphan rows audit_log | 1 | 0.3 | 1 | 1 | 1.0 | P0 |
|
|
163
|
+
|
|
164
|
+
### Step 4 — Quantify: % do tempo do time
|
|
165
|
+
|
|
166
|
+
Computar agregado:
|
|
167
|
+
|
|
168
|
+
```text
|
|
169
|
+
total_toil_hours_per_week = sum(item.frequency_per_week × item.hours_per_occurrence for item in TOIL_items)
|
|
170
|
+
total_team_hours_per_week = team_size × 40 # PT-BR: full-time equivalent
|
|
171
|
+
toil_pct = total_toil_hours_per_week / total_team_hours_per_week × 100
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Status vs ≤ 50% rule:
|
|
175
|
+
|
|
176
|
+
| Range | Status | Ação |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| < 30% | **GREEN** | Saudável; investir em prevenção (toil tax em PRs novos) |
|
|
179
|
+
| 30–50% | **YELLOW** | Atenção; escalonar P0s antes de virar RED |
|
|
180
|
+
| > 50% | **RED** | Red flag; escalar para liderança; pedir reforço ou pausar features |
|
|
181
|
+
|
|
182
|
+
### Step 5 — Write `TOIL-AUDIT.md`
|
|
183
|
+
|
|
184
|
+
Escrever em `$OUTPUT_PATH` seguindo template canônico de `eliminating-toil`:
|
|
185
|
+
|
|
186
|
+
````markdown
|
|
187
|
+
# TOIL-AUDIT — <projeto> — <data>
|
|
188
|
+
|
|
189
|
+
## Métrica agregada
|
|
190
|
+
|
|
191
|
+
- Toil estimado: X.X horas-pessoa/semana (Y% do tempo do time)
|
|
192
|
+
- **Status vs ≤ 50% rule:** [GREEN: < 30%] | [YELLOW: 30–50%] | [RED: > 50%]
|
|
193
|
+
- Top 3 áreas: <lista>
|
|
194
|
+
- Estágio médio de automação atual: L<0–4> (consulta skill `eliminating-toil`)
|
|
195
|
+
|
|
196
|
+
## Itens identificados
|
|
197
|
+
|
|
198
|
+
| # | Item | Frequência | Hours/week | Pain (1-5) | Automation effort | Priority | Stage atual → alvo |
|
|
199
|
+
|---|------|------------|------------|------------|-------------------|----------|---------------------|
|
|
200
|
+
| 1 | Reset DB seed manual antes de cada test run | 2×/dia | 1.5 h | 4 | M (3 dias) | P0 | L0 → L3 |
|
|
201
|
+
| 2 | Rotation de access_token de Edge Function | 1×/semana | 0.5 h | 2 | S (1 dia) | P1 | L1 → L4 |
|
|
202
|
+
| ... | ... | ... | ... | ... | ... | ... | ... |
|
|
203
|
+
|
|
204
|
+
## P0 (automatizar agora)
|
|
205
|
+
|
|
206
|
+
### Item 1: <nome>
|
|
207
|
+
|
|
208
|
+
**Por que é toil:** atende 6 critérios canônicos (manual, repetitivo X×/semana, automatizável via <how>, tática reativa, sem valor durável, escala com #devs).
|
|
209
|
+
|
|
210
|
+
**Evidence (do scan):**
|
|
211
|
+
- Git log: <N commits matching pattern>
|
|
212
|
+
- Scripts: <paths encontrados>
|
|
213
|
+
- Manual steps em docs: <linhas grep>
|
|
214
|
+
|
|
215
|
+
**Automação proposta:** <descrição concreta — ex: cron + script + alert se falhar>
|
|
216
|
+
|
|
217
|
+
**Esforço estimado:** <N> dias (<S/M/L/XL>)
|
|
218
|
+
|
|
219
|
+
**Owner sugerido:** <inferido por git blame OR @TBD>
|
|
220
|
+
|
|
221
|
+
**Stage transition:** L<atual> → L<alvo> (consulta skill `eliminating-toil`)
|
|
222
|
+
|
|
223
|
+
## P1 / P2 (escalonar)
|
|
224
|
+
|
|
225
|
+
[tabelas similares, mais sucintas]
|
|
226
|
+
|
|
227
|
+
## Não-toil identificado (documentar separadamente)
|
|
228
|
+
|
|
229
|
+
- **Overhead:** sprint planning (2h × semana × <team_size> pessoas) — NÃO conta no ≤ 50%
|
|
230
|
+
- **Grungy work:** refactor de <module> (<hours/week>) — projeto engineering, não toil
|
|
231
|
+
|
|
232
|
+
## Cron jobs já automatizados (linha de base)
|
|
233
|
+
|
|
234
|
+
[lista de schedule já existente — não conta como toil]
|
|
235
|
+
|
|
236
|
+
## Próximos passos
|
|
237
|
+
|
|
238
|
+
1. Escalonar item P0 #<N> com owner @<user> até <YYYY-MM-DD>
|
|
239
|
+
2. Phase 39 INT-OBS-02: alimentar score OMM Capacidade 3 com `toil_pct` agregado
|
|
240
|
+
3. Re-audit em 90 dias para medir progresso
|
|
241
|
+
````
|
|
242
|
+
|
|
243
|
+
Imprimir resumo curto para caller após escrita:
|
|
244
|
+
|
|
245
|
+
```text
|
|
246
|
+
═══════════════════════════════════════════════════════════
|
|
247
|
+
TOIL-AUDITOR · <project>
|
|
248
|
+
estimado: X.Xh/sem (Y% do time) · status: <GREEN/YELLOW/RED>
|
|
249
|
+
═══════════════════════════════════════════════════════════
|
|
250
|
+
|
|
251
|
+
## Itens identificados
|
|
252
|
+
P0: <count> itens — score ≥ 1.0
|
|
253
|
+
P1: <count> itens — 0.3 ≤ score < 1.0
|
|
254
|
+
P2: <count> itens — score < 0.3
|
|
255
|
+
|
|
256
|
+
## Top 3 P0
|
|
257
|
+
1. <item> — <hours/week> h/sem — <effort> dias para automatizar
|
|
258
|
+
2. ...
|
|
259
|
+
3. ...
|
|
260
|
+
|
|
261
|
+
## Output
|
|
262
|
+
`<OUTPUT_PATH>`
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Quando NÃO invocar
|
|
266
|
+
|
|
267
|
+
- Repo novo (< 1 mês de git history) — sample size insuficiente, audit produz falso-zero
|
|
268
|
+
- Time muito pequeno (1-2 pessoas) onde toil é "óbvio" — overhead de audit > valor; usar checklist mental
|
|
269
|
+
- Quando user já fez audit recentemente (< 90 dias) — re-audit a cada quarter é suficiente
|
|
270
|
+
- Re-audit após poucas mudanças — esperar próximo milestone
|
|
271
|
+
|
|
272
|
+
## Ver também
|
|
273
|
+
|
|
274
|
+
- [`eliminating-toil`](../skills/eliminating-toil/SKILL.md) — knowledge base canônica (6 critérios, ≤ 50%, L0-L4, anti-patterns)
|
|
275
|
+
- [`omm-auditor`](./omm-auditor.md) (v1.9) — consome `toil_pct` para Capacidade 3 (Complexidade/Tech Debt) (Phase 39 INT-OBS-02)
|
|
276
|
+
- [`production-readiness-review`](../skills/production-readiness-review/SKILL.md) — PRR Axe 5 (Change Management) verifica deploy não é toil
|
|
277
|
+
- [`blameless-postmortems`](../skills/blameless-postmortems/SKILL.md) — postmortems de toil-induced incidents alimentam audit
|
package/kit/agents/verifier.md
CHANGED
|
@@ -55,6 +55,36 @@ A verificação reversa a partir do objetivo começa pelo resultado e trabalha d
|
|
|
55
55
|
Depois verifique cada nível na codebase real.
|
|
56
56
|
</core_principle>
|
|
57
57
|
|
|
58
|
+
<legacy_refactor_verification>
|
|
59
|
+
**Verificação especial para fases de refactor:**
|
|
60
|
+
|
|
61
|
+
Se PLAN.md tem tasks com `kind=refactor` em arquivos flagged (> 500 linhas OR contrato externo), aplique verificação adicional baseada na skill [`pre-refactor-characterization`](../skills/pre-refactor-characterization/SKILL.md) e [`legacy-characterization-tests`](../skills/legacy-characterization-tests/SKILL.md):
|
|
62
|
+
|
|
63
|
+
1. **Characterization tests existem?**
|
|
64
|
+
- Verificar `tests/characterization/<file_stem>/` ou equivalente
|
|
65
|
+
- Se ausente E refactor de risco aconteceu → **veredito: regressão indeterminável**
|
|
66
|
+
- Marca em VERIFICATION.md como gap crítico (não passa fase)
|
|
67
|
+
|
|
68
|
+
2. **Characterization tests passam VERDE?**
|
|
69
|
+
- Rodar suite com framework adequado (Vitest, Pytest, etc.)
|
|
70
|
+
- Snapshot diff = 0 → comportamento preservado → ✓
|
|
71
|
+
- Snapshot diff > 0 → comportamento mudou → investigar:
|
|
72
|
+
- Se documentado como behavior change intencional → ✓ com nota
|
|
73
|
+
- Se não documentado → **regressão real** → falha de fase
|
|
74
|
+
|
|
75
|
+
3. **Mutation kill score adequado?**
|
|
76
|
+
- Rodar mutation testing (Stryker / mutmut / Pitest)
|
|
77
|
+
- Kill ≥ 70% → safety net adequado
|
|
78
|
+
- Kill < 70% → warning (pode ter pontos cegos)
|
|
79
|
+
|
|
80
|
+
4. **Modo override usado?**
|
|
81
|
+
- Verificar `.planning/REFACTOR-SAFETY.md` com seção `Aprovação manual`
|
|
82
|
+
- Se ticket linkado existe e é válido → ✓ (débito documentado)
|
|
83
|
+
- Se sem ticket OR ticket inválido → falha de auditoria
|
|
84
|
+
|
|
85
|
+
Adicione resultados ao VERIFICATION.md em seção `## Legacy Refactor Verification`. Block phase close se characterization ausente em refactor de risco.
|
|
86
|
+
</legacy_refactor_verification>
|
|
87
|
+
|
|
58
88
|
<verification_process>
|
|
59
89
|
|
|
60
90
|
## Passo 0: Verificar Verificação Anterior
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: auditar-cascading
|
|
3
|
+
description: Invoca cascading-failures-auditor — audita código de serviço para 5 triggers de cascade (sem timeout, retry sem jitter, sem circuit breaker, sem deadline propagation, queue unbounded); gera CASCADING-AUDIT.md priorizado P0/P1/P2.
|
|
4
|
+
argument-hint: "[target_path] [--dimensions ...] [--severity P0|P1|P2|all]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Bash
|
|
8
|
+
- Grep
|
|
9
|
+
- Glob
|
|
10
|
+
- Task
|
|
11
|
+
- Write
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<objective>
|
|
15
|
+
Auditar código de serviço (Edge Function, handler HTTP, ou repo inteiro) para os 5 triggers canônicos de cascading failure (cap 22 livro Google SRE). Invoca o agente [`cascading-failures-auditor`](../agents/cascading-failures-auditor.md) que aplica a skill [`cascading-failures`](../skills/cascading-failures/SKILL.md) — defesa em camadas (timeout + retry com jitter + circuit breaker + deadline propagation + saturation gauge).
|
|
16
|
+
|
|
17
|
+
**Cria/Atualiza:**
|
|
18
|
+
- `.planning/CASCADING-AUDIT.md` — relatório priorizado P0/P1/P2 com diff sugerido por finding
|
|
19
|
+
|
|
20
|
+
**Após:** o user tem fila acionável de patches para prevenir cascade. Cap 22 — prevenção custa 1×, recuperação custa 100×.
|
|
21
|
+
</objective>
|
|
22
|
+
|
|
23
|
+
<context>
|
|
24
|
+
**Argumentos:**
|
|
25
|
+
- `[target_path]` — arquivo, diretório ou repo (default: `.`)
|
|
26
|
+
- `--dimensions <list>` — subset de `[timeouts, retry-jitter, circuit-breaker, deadline-prop, queue-bound, health-check, saturation-gauge]` (default: todas)
|
|
27
|
+
- `--severity P0|P1|P2|all` — filtro (default: all)
|
|
28
|
+
- `--output PATH` — caminho do output (default: `.planning/CASCADING-AUDIT.md`)
|
|
29
|
+
|
|
30
|
+
**Exemplos:**
|
|
31
|
+
```
|
|
32
|
+
/auditar-cascading # repo inteiro
|
|
33
|
+
/auditar-cascading supabase/functions/ # só Edge Functions
|
|
34
|
+
/auditar-cascading src/orders/handler.ts # arquivo específico
|
|
35
|
+
/auditar-cascading --severity P0 # só fix imediato
|
|
36
|
+
/auditar-cascading --dimensions timeouts,retry-jitter # foco em duas dims
|
|
37
|
+
```
|
|
38
|
+
</context>
|
|
39
|
+
|
|
40
|
+
<process>
|
|
41
|
+
|
|
42
|
+
## 1. Parsear argumentos
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
TARGET_PATH=$(echo "$ARGUMENTS" | awk '{print $1}')
|
|
46
|
+
[ -z "$TARGET_PATH" ] || [ "${TARGET_PATH:0:2}" = "--" ] && TARGET_PATH="."
|
|
47
|
+
DIMENSIONS=$(echo "$ARGUMENTS" | grep -oE -- '--dimensions [^ ]+' | awk '{print $2}')
|
|
48
|
+
SEVERITY=$(echo "$ARGUMENTS" | grep -oE -- '--severity [^ ]+' | awk '{print $2}')
|
|
49
|
+
OUTPUT_PATH=$(echo "$ARGUMENTS" | grep -oE -- '--output [^ ]+' | awk '{print $2}')
|
|
50
|
+
|
|
51
|
+
[ -z "$OUTPUT_PATH" ] && OUTPUT_PATH=".planning/CASCADING-AUDIT.md"
|
|
52
|
+
mkdir -p "$(dirname "$OUTPUT_PATH")"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 2. Dispatch para `cascading-failures-auditor`
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
Task(
|
|
59
|
+
subagent_type="cascading-failures-auditor",
|
|
60
|
+
prompt="
|
|
61
|
+
target_path: ${TARGET_PATH}
|
|
62
|
+
output_path: ${OUTPUT_PATH}
|
|
63
|
+
${DIMENSIONS:+dimensions: ${DIMENSIONS}}
|
|
64
|
+
${SEVERITY:+severity_filter: ${SEVERITY}}
|
|
65
|
+
|
|
66
|
+
Aplicar skill cascading-failures + retry-strategies + load-shedding-graceful-degradation. Detectar 5 triggers canônicos:
|
|
67
|
+
1. Sem timeout em chamadas externas (fetch/axios/http sem AbortSignal/timeout)
|
|
68
|
+
2. Retry sem jitter (setTimeout exponencial sem Math.random)
|
|
69
|
+
3. Sem circuit breaker em deps externas
|
|
70
|
+
4. Sem deadline propagation (handler sem header x-deadline)
|
|
71
|
+
5. Queue unbounded sem drop policy
|
|
72
|
+
|
|
73
|
+
Priorizar P0 (fix imediato) / P1 (próximo sprint) / P2 (best practice). Gerar diff sugerido para cada P0/P1.
|
|
74
|
+
"
|
|
75
|
+
)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 3. Pós-output
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
═══════════════════════════════════════════════════════════
|
|
82
|
+
framework ► AUDITAR-CASCADING ▸ ${OUTPUT_PATH}
|
|
83
|
+
═══════════════════════════════════════════════════════════
|
|
84
|
+
|
|
85
|
+
[output do agent]
|
|
86
|
+
|
|
87
|
+
## Próximos passos
|
|
88
|
+
|
|
89
|
+
1. **Aplicar P0 imediato** — patches são pequenos (5-15 min cada)
|
|
90
|
+
2. **/load-shedding <fn>** — adicionar defesas server-side complementares
|
|
91
|
+
3. **/golden-signals <fn>** (v1.10) — adicionar Saturation gauge (early warning de cascade)
|
|
92
|
+
4. **/prr <service>** (v1.10) — Axe 4 (Capacity Planning) consume este audit
|
|
93
|
+
5. **Game day exercise** mensal — validar resilience em staging
|
|
94
|
+
|
|
95
|
+
## Cross-suite
|
|
96
|
+
|
|
97
|
+
- v1.9 Observability — Saturation alert dispara load shed antes de cascade
|
|
98
|
+
- v1.10 SRE — PRR Axe 4 + Axe 5 consume
|
|
99
|
+
- v1.11 SRE Resilience — esse audit
|
|
100
|
+
- v1.12 Legacy — refactor pode introduzir/remover defesas; pre-refactor-characterization gate
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
</process>
|
|
104
|
+
|
|
105
|
+
<success_criteria>
|
|
106
|
+
- [ ] $ARGUMENTS parseados (target_path opcional, default cwd)
|
|
107
|
+
- [ ] `cascading-failures-auditor` invocado via Task
|
|
108
|
+
- [ ] CASCADING-AUDIT.md criado pelo agent
|
|
109
|
+
- [ ] Output forwarded transparentemente
|
|
110
|
+
- [ ] Cross-references com /load-shedding, /golden-signals, /prr
|
|
111
|
+
</success_criteria>
|
|
@@ -54,4 +54,127 @@ Resultado de regression OMM:
|
|
|
54
54
|
Skill consultada: [`observability-maturity-model`](../skills/observability-maturity-model/SKILL.md).
|
|
55
55
|
|
|
56
56
|
**REQ:** INT-FW-04.
|
|
57
|
-
</observability_integration>
|
|
57
|
+
</observability_integration>
|
|
58
|
+
|
|
59
|
+
<sre_integration>
|
|
60
|
+
**Toil scoring auto-invocação (v1.10 — INT-FW-V2-03):**
|
|
61
|
+
|
|
62
|
+
Quando `workflow.audit_milestone_toil = true` (default), o workflow inclui passo Toil audit auto-invocação **antes** do passo de OMM scoring (que já existe via `<observability_integration>` v1.9 — INT-FW-04):
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
Skill(skill="framework:auditar-toil")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
O comando `/auditar-toil` invoca o agente [toil-auditor](../agents/toil-auditor.md) que analisa `git log` recente (≤ 90 dias) + scripts shell em `scripts/` + comandos manuais documentados em README/runbooks/`.planning/runbooks/` + tarefas repetitivas em `.planning/phases/*/SUMMARY.md`. O agent classifica candidatos a automação (P0/P1/P2 por esforço × frequência) e produz `.planning/TOIL-AUDIT.md` na raiz do `.planning/`. Cap 5 do livro Google SRE (*Eliminating Toil*) define toil canonicamente: **manual + repetitivo + automatizável + tático + sem valor durável + escala linear com tráfego/team**.
|
|
69
|
+
|
|
70
|
+
**Loop fechado canônico:**
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
/auditar-marco
|
|
74
|
+
↓
|
|
75
|
+
Step A: invoca /auditar-toil ← gera .planning/TOIL-AUDIT.md (este patch — INT-FW-V2-03)
|
|
76
|
+
↓
|
|
77
|
+
Step B: invoca /auditar-observabilidade ← OMM scoring v1.9 (INT-FW-04)
|
|
78
|
+
↓
|
|
79
|
+
omm-auditor consulta .planning/TOIL-AUDIT.md ← Capacidade 3 — Complexidade / Tech Debt (Phase 39 INT-OBS-02)
|
|
80
|
+
↓
|
|
81
|
+
OMM-REPORT.md inclui Capacidade 3 score derivado de % toil pelo time
|
|
82
|
+
↓
|
|
83
|
+
MILESTONE-AUDIT.md inclui OMM-REPORT.md + TOIL-AUDIT.md como anexos
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Por que rodar `/auditar-toil` ANTES de `/auditar-observabilidade`:**
|
|
87
|
+
|
|
88
|
+
O agent `omm-auditor` (Capacidade 3 patcheada em Phase 39 / INT-OBS-02) tem regra absoluta:
|
|
89
|
+
|
|
90
|
+
> "score Capacidade 3 > 3 exige TOIL-AUDIT.md fresco ≤ 30 dias com `% toil < 30%`"
|
|
91
|
+
|
|
92
|
+
Se TOIL-AUDIT.md ausente ou stale (> 30d), `omm-auditor` delega geração via `Task(subagent_type=toil-auditor)` ad-hoc — duplicação. Auto-invocar `/auditar-toil` em `/auditar-marco` evita essa duplicação ao garantir que `omm-auditor` encontre TOIL-AUDIT.md fresco.
|
|
93
|
+
|
|
94
|
+
**Tabela de score Capacidade 3 (consumida por omm-auditor):**
|
|
95
|
+
|
|
96
|
+
| % toil pelo time | OMM Capacidade 3 score | Implicação |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| < 15% | 5 | Excelente — automação madura |
|
|
99
|
+
| 15-30% | 4 | Bom — abaixo regra ≤ 50% cap 5 com folga |
|
|
100
|
+
| 30-50% | 3 | Aceitável — no limite (regra ≤ 50%) |
|
|
101
|
+
| 50-60% | 2 | Risco — acima limite cap 5; team queimando ciclos em toil |
|
|
102
|
+
| > 60% | 1 | Crítico — toil-driven team; scaling linear vai quebrar |
|
|
103
|
+
|
|
104
|
+
Cross-ref ativo: tabela acima é replicada em [omm-auditor](../agents/omm-auditor.md) (Step 1 — patcheado em Phase 39 / INT-OBS-02).
|
|
105
|
+
|
|
106
|
+
**Output esperado:**
|
|
107
|
+
|
|
108
|
+
`.planning/TOIL-AUDIT.md` contém:
|
|
109
|
+
|
|
110
|
+
1. % toil pelo time (estimado a partir de git log + scripts shell + runbooks manuais documentados)
|
|
111
|
+
2. Lista de candidatos a automação P0/P1/P2 com:
|
|
112
|
+
- Comando/processo manual identificado
|
|
113
|
+
- Frequência (× por sprint/mês)
|
|
114
|
+
- Esforço estimado de automação (S/M/L)
|
|
115
|
+
- ROI = Frequência × Tempo Manual / Esforço Automação
|
|
116
|
+
3. Sugestões de automação concretas (pg_cron job, hook PostToolUse, kit-mcp command, GitHub Action)
|
|
117
|
+
4. Anti-toil-by-design: action items para `/discutir-fase` capturar toil prevenção upfront em fases futuras
|
|
118
|
+
|
|
119
|
+
**Quando desligar gate:**
|
|
120
|
+
|
|
121
|
+
- Solo developer side project (toil = você mesmo, audit é overhead)
|
|
122
|
+
- Projeto ≤ 30 dias (sem volume git suficiente para detectar padrões repetitivos)
|
|
123
|
+
- Repo somente bibliotecário sem ops (kit-mcp content-only sem deploy)
|
|
124
|
+
|
|
125
|
+
Para esses casos: `workflow.audit_milestone_toil = false`. Para projetos team-based com ops/deploy, **manter `true`**.
|
|
126
|
+
|
|
127
|
+
**Skill consultada:** [eliminating-toil](../skills/eliminating-toil/SKILL.md) (cap 5 livro Google SRE — *Eliminating Toil* — define toil canonicamente, regra ≤ 50%, padrões de automação, distinção toil vs overhead vs grungy work).
|
|
128
|
+
|
|
129
|
+
**Anti-patterns prevenidos:**
|
|
130
|
+
|
|
131
|
+
- "Skipar audit toil porque está OK há tempo" → trabalho cresce, toil cresce com ele; audit obrigatório por milestone
|
|
132
|
+
- "TOIL-AUDIT.md gerado mas ignorado" → omm-auditor Capacidade 3 consome o arquivo; ignorar o relatório = score Cap 3 deteriora visivelmente
|
|
133
|
+
- "Toil = features pequenas" → toil é manual + repetitivo + automatizável (ortogonal a tamanho); 5min × 50× por sprint = 4h por sprint
|
|
134
|
+
- "Toil ≠ overhead" → overhead inclui meetings, planning, code review (necessário, não automatizável); toil é só o automatizable
|
|
135
|
+
|
|
136
|
+
**REQ:** INT-FW-V2-03.
|
|
137
|
+
</sre_integration>
|
|
138
|
+
|
|
139
|
+
<legacy_refactor_integration>
|
|
140
|
+
**Legacy refactor safety audit (opt-in):**
|
|
141
|
+
|
|
142
|
+
Quando `workflow.audit_milestone_legacy_refactor = true` (default: false em projetos < 50% OMM maturity, true acima), o workflow inclui passo de auditoria de refactor safety:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
Para cada arquivo modificado por tasks com kind=refactor no milestone:
|
|
146
|
+
Task(
|
|
147
|
+
subagent_type="refactor-safety-auditor",
|
|
148
|
+
prompt="
|
|
149
|
+
target_file: <file>
|
|
150
|
+
change_kind: refactor
|
|
151
|
+
mode: blocking
|
|
152
|
+
output_path: .planning/REFACTOR-SAFETY-<file_stem>.md
|
|
153
|
+
|
|
154
|
+
Aplicar skill pre-refactor-characterization. Validar retroativamente que safety net foi aplicado.
|
|
155
|
+
"
|
|
156
|
+
)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Critérios de aprovação:**
|
|
160
|
+
- Cada refactor de risco no milestone tem characterization tests linkados E pass verde
|
|
161
|
+
- Cada `--mode=override` tem ticket linkado válido (ainda aberto OR resolvido com follow-up)
|
|
162
|
+
- Mutation kill score ≥ 70% nos arquivos refatorados (warning se line cov OK mas mutation baixo)
|
|
163
|
+
|
|
164
|
+
**Resultado de regression:**
|
|
165
|
+
- 0 refactors sem char → audit aprovado
|
|
166
|
+
- 1+ refactors sem char e sem override → audit fail; bloqueia close de milestone até resolução
|
|
167
|
+
- 1+ overrides com tickets ainda abertos > 90 dias → warning explícito (débito técnico envelhecido)
|
|
168
|
+
|
|
169
|
+
Skill canônica: [`pre-refactor-characterization`](../skills/pre-refactor-characterization/SKILL.md)
|
|
170
|
+
Cross-ref ativo: `omm-auditor` Capacidade 1 (Resilience) score consulta REFACTOR-SAFETY summaries para fator "% refactors com safety net"; baixa adequação reduz score.
|
|
171
|
+
|
|
172
|
+
**Quando desligar gate:**
|
|
173
|
+
- Projeto greenfield com < 3 meses de idade (legacy code não existe ainda)
|
|
174
|
+
- Solo dev side project sem stakes de produção (audit é overhead)
|
|
175
|
+
- Toda codebase é < 50% código não-trivial (a maior parte é config/markdown/tests)
|
|
176
|
+
|
|
177
|
+
Para esses casos: `workflow.audit_milestone_legacy_refactor = false`. Para projetos com stakes de produção e equipe ≥ 2 pessoas, **manter `true`**.
|
|
178
|
+
|
|
179
|
+
**REQ:** INT-LEGACY-FW-01.
|
|
180
|
+
</legacy_refactor_integration>
|