@luanpdd/kit-mcp 1.8.1 → 1.10.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 (61) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +97 -1
  3. package/gates/golden-signals-coverage.md +133 -0
  4. package/gates/obs-agents-mcp-supabase.md +86 -0
  5. package/gates/obs-skills-frontmatter.md +76 -0
  6. package/gates/omm-no-regression.md +83 -0
  7. package/gates/postmortem-template-required.md +127 -0
  8. package/gates/prr-checklist-coverage.md +128 -0
  9. package/gates/skill-must-include.md +21 -19
  10. package/kit/agents/burn-rate-forecaster.md +160 -0
  11. package/kit/agents/golden-signals-instrumenter.md +241 -0
  12. package/kit/agents/incident-investigator.md +245 -0
  13. package/kit/agents/observability-instrumenter.md +200 -0
  14. package/kit/agents/omm-auditor.md +251 -0
  15. package/kit/agents/postmortem-writer.md +282 -0
  16. package/kit/agents/prr-conductor.md +288 -0
  17. package/kit/agents/slo-engineer.md +224 -0
  18. package/kit/agents/supabase-architect.md +62 -0
  19. package/kit/agents/supabase-auth-bootstrapper.md +17 -0
  20. package/kit/agents/supabase-edge-fn-writer.md +124 -0
  21. package/kit/agents/supabase-migration-writer.md +98 -0
  22. package/kit/agents/supabase-realtime-implementer.md +23 -0
  23. package/kit/agents/supabase-rls-writer.md +17 -0
  24. package/kit/agents/supabase-storage-implementer.md +174 -0
  25. package/kit/agents/toil-auditor.md +277 -0
  26. package/kit/commands/auditar-marco.md +102 -1
  27. package/kit/commands/auditar-observabilidade.md +103 -0
  28. package/kit/commands/auditar-toil.md +129 -0
  29. package/kit/commands/burn-rate-status.md +140 -0
  30. package/kit/commands/concluir-marco.md +73 -1
  31. package/kit/commands/definir-slo.md +108 -0
  32. package/kit/commands/discutir-fase.md +26 -0
  33. package/kit/commands/forense.md +83 -1
  34. package/kit/commands/golden-signals.md +142 -0
  35. package/kit/commands/instrumentar-fase.md +200 -0
  36. package/kit/commands/investigar-producao.md +162 -0
  37. package/kit/commands/observabilidade.md +116 -0
  38. package/kit/commands/planejar-fase.md +20 -0
  39. package/kit/commands/postmortem.md +179 -0
  40. package/kit/commands/prr.md +205 -0
  41. package/kit/commands/risk-budget.md +220 -0
  42. package/kit/commands/sre.md +227 -0
  43. package/kit/commands/verificar-trabalho.md +26 -0
  44. package/kit/skills/_shared-observability/glossary.md +396 -0
  45. package/kit/skills/_shared-sre/glossary.md +573 -0
  46. package/kit/skills/blameless-postmortems/SKILL.md +340 -0
  47. package/kit/skills/burn-rate-alerting/SKILL.md +258 -0
  48. package/kit/skills/core-analysis-loop/SKILL.md +352 -0
  49. package/kit/skills/distributed-tracing/SKILL.md +362 -0
  50. package/kit/skills/eliminating-toil/SKILL.md +243 -0
  51. package/kit/skills/event-based-slos/SKILL.md +296 -0
  52. package/kit/skills/four-golden-signals/SKILL.md +297 -0
  53. package/kit/skills/observability-driven-development/SKILL.md +315 -0
  54. package/kit/skills/observability-maturity-model/SKILL.md +222 -0
  55. package/kit/skills/opentelemetry-standard/SKILL.md +351 -0
  56. package/kit/skills/production-readiness-review/SKILL.md +305 -0
  57. package/kit/skills/sre-risk-management/SKILL.md +221 -0
  58. package/kit/skills/structured-events/SKILL.md +265 -0
  59. package/kit/skills/telemetry-pipelines/SKILL.md +259 -0
  60. package/kit/skills/telemetry-sampling/SKILL.md +256 -0
  61. package/package.json +1 -1
@@ -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
@@ -33,4 +33,105 @@ Glob: .planning/phases/*/*-VERIFICATION.md
33
33
  <process>
34
34
  Execute o workflow audit-milestone de @./.claude/framework/workflows/audit-milestone.md do início ao fim.
35
35
  Preserve todos os checkpoints do workflow (determinação de escopo, leitura de verificações, checagem de integração, cobertura de requisitos, roteamento).
36
- </process>
36
+ </process>
37
+
38
+ <observability_integration>
39
+ **OMM scoring (v1.9 — INT-FW-04):**
40
+
41
+ Quando `workflow.audit_milestone_omm = true` (default), o workflow inclui passo OMM scoring:
42
+
43
+ ```text
44
+ Skill(skill="framework:auditar-observabilidade")
45
+ ```
46
+
47
+ O comando `/auditar-observabilidade` invoca o agente [`omm-auditor`](../agents/omm-auditor.md) que pontua as 5 capacidades (resiliência, qualidade, complexidade, cadência, comportamento) contra o marco anterior. O OMM-REPORT.md gerado é incluído como anexo no MILESTONE-AUDIT.md.
48
+
49
+ Resultado de regression OMM:
50
+ - **0 regressions:** audit aprovado
51
+ - **1+ regressions, blocking=false:** warn explícito; audit aprovado com nota
52
+ - **1+ regressions, blocking=true (`workflow.omm_no_regression=true`):** audit fail → user escolha entre fix lacunas ou aceitar
53
+
54
+ Skill consultada: [`observability-maturity-model`](../skills/observability-maturity-model/SKILL.md).
55
+
56
+ **REQ:** INT-FW-04.
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>
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: auditar-observabilidade
3
+ description: Invoca omm-auditor para gerar OMM-REPORT.md scored. 5 capacidades com trend vs marco anterior. Action items priorizados P0-P3.
4
+ argument-hint: "[--previous <marco>] [--ci]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Task
10
+ ---
11
+
12
+ <objective>
13
+ Gerar OMM-REPORT.md com snapshot scored das 5 capacidades de observabilidade. Aplica skill [`observability-maturity-model`](../skills/observability-maturity-model/SKILL.md) — sintomas qualitativos doing well/poorly por capacidade.
14
+
15
+ **Cria/Atualiza:**
16
+ - `.planning/OMM-REPORT.md` — snapshot atual
17
+ - (Em `/concluir-marco`) `.planning/milestones/<v>/OMM-REPORT.md` — snapshot arquivado
18
+
19
+ **Após:** time tem 5 scores + trend + action items priorizados.
20
+ </objective>
21
+
22
+ <context>
23
+ **Argumentos:** `$ARGUMENTS`
24
+
25
+ **Flags:**
26
+ - `--previous <marco>` — comparar com marco específico (default: detecta automaticamente do MILESTONES.md)
27
+ - `--ci` — modo CI: exit code 0 se OK, 1 se regression em qualquer capacidade
28
+
29
+ **Quando rodar:**
30
+ - Manualmente para snapshot informal
31
+ - Em `/auditar-marco` (audit pre-conclusion) — Phase 35 INT-FW-04
32
+ - Em `/concluir-marco` (gate de regression) — Phase 35 INT-FW-05
33
+ </context>
34
+
35
+ <process>
36
+
37
+ ## 1. Parsear argumentos
38
+
39
+ ```bash
40
+ PREVIOUS=$(echo "$ARGUMENTS" | grep -oE -- '--previous [^ ]+' | awk '{print $2}')
41
+ CI_MODE=$(echo "$ARGUMENTS" | grep -c -- '--ci' || true)
42
+ ```
43
+
44
+ ## 2. Detectar previous milestone
45
+
46
+ ```bash
47
+ if [ -z "$PREVIOUS" ]; then
48
+ # PT-BR: extrair último concluído de MILESTONES.md
49
+ PREVIOUS=$(grep -E '^### v[0-9.]+\b' .planning/MILESTONES.md | head -2 | tail -1 | grep -oE 'v[0-9.]+')
50
+ fi
51
+ ```
52
+
53
+ ## 3. Dispatch para `omm-auditor`
54
+
55
+ ```text
56
+ Task(
57
+ subagent_type="omm-auditor",
58
+ prompt="
59
+ ${PREVIOUS:+previous_milestone: ${PREVIOUS}}
60
+ mode: ${CI_MODE:+ci}snapshot
61
+
62
+ Gerar OMM-REPORT.md com:
63
+ 1. Score 1-5 por capacidade (5 capacidades)
64
+ 2. Trend vs ${PREVIOUS:-último marco}
65
+ 3. Action items priorizados P0-P3
66
+ 4. Regression alerts (se alguma capacidade regrediu)
67
+ 5. Comparação por marco
68
+ "
69
+ )
70
+ ```
71
+
72
+ ## 4. Pós-output
73
+
74
+ ```
75
+ ═══════════════════════════════════════════════════════════
76
+ framework ► AUDITAR-OBSERVABILIDADE
77
+ ═══════════════════════════════════════════════════════════
78
+
79
+ [output do omm-auditor — snapshot inline]
80
+
81
+ OMM-REPORT.md: .planning/OMM-REPORT.md
82
+
83
+ ${CI_MODE:+## CI Mode}
84
+ ${CI_MODE:+Exit code: 0 (OK) / 1 (regression detectada)}
85
+ ```
86
+
87
+ ## 5. Modo `--ci`
88
+
89
+ Se `--ci` setado:
90
+ - Parse OMM-REPORT.md para detectar regression alerts
91
+ - Se ≥ 1 regression → exit 1 (CI fails)
92
+ - Senão → exit 0 (OK)
93
+
94
+ </process>
95
+
96
+ <success_criteria>
97
+ - [ ] omm-auditor invocado via Task
98
+ - [ ] OMM-REPORT.md gerado em `.planning/OMM-REPORT.md`
99
+ - [ ] 5 capacidades scored
100
+ - [ ] Trend calculado vs `--previous` ou auto-detectado
101
+ - [ ] Action items P0-P3 listados
102
+ - [ ] Modo `--ci` exit code apropriado se regression
103
+ </success_criteria>
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: auditar-toil
3
+ description: Invoca toil-auditor — analisa repo + git log + scripts + runbooks; gera .planning/TOIL-AUDIT.md priorizado P0/P1/P2 com esforço de automação.
4
+ argument-hint: "[--time-window 3m] [--team-size N] [--output PATH]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Grep
10
+ - Glob
11
+ - Task
12
+ ---
13
+
14
+ <objective>
15
+ Auditar o repositório atual em busca de **toil** (cap 5 do livro Google SRE) — trabalho manual, repetitivo, automatizável, tático, sem valor durável que escala linear com tráfego/usuários. Invoca o agente [`toil-auditor`](../agents/toil-auditor.md) que aplica a skill [`eliminating-toil`](../skills/eliminating-toil/SKILL.md) — 6 critérios canônicos, regra ≤ 50%, distinção toil vs overhead vs grungy work.
16
+
17
+ **Cria/Atualiza:**
18
+ - `.planning/TOIL-AUDIT.md` — lista priorizada P0/P1/P2 com 6 critérios scored + esforço de automação estimado
19
+
20
+ **Após:** o user tem audit acionável para reduzir toil pelo time. Phase 39 INT-OBS-02 integra ao `omm-auditor` (v1.9) — Capacidade 3 do OMM scoring usa este audit.
21
+ </objective>
22
+
23
+ <context>
24
+ **Argumentos:** `$ARGUMENTS` — todas as flags são opcionais; comando funciona com defaults.
25
+
26
+ **Flags:**
27
+ - `--time-window <Nm|Nd>` — janela de git history a analisar (default: `3m` = 3 meses)
28
+ - `--team-size <N>` — número de pessoas no time (default: inferido via `git shortlog -sn`)
29
+ - `--output <path>` — caminho do output (default: `.planning/TOIL-AUDIT.md`)
30
+ - `--runbooks-paths <p1,p2,...>` — paths customizados de runbooks (default: `runbooks/, docs/runbooks/, ops/, scripts/, .github/workflows/`)
31
+
32
+ **Exemplos:**
33
+ ```
34
+ /auditar-toil # defaults — 3m de git, team auto-detect
35
+ /auditar-toil --time-window 6m --team-size 5 # janela maior + team explícito
36
+ /auditar-toil --output .planning/audit/toil-2026-Q2.md # path customizado
37
+ ```
38
+
39
+ **Pré-requisito:** repositório git inicializado (sem isso, agent skip git log analysis e usa apenas scripts/runbooks).
40
+ </context>
41
+
42
+ <process>
43
+
44
+ ## 1. Parsear argumentos
45
+
46
+ ```bash
47
+ TIME_WINDOW=$(echo "$ARGUMENTS" | grep -oE -- '--time-window [^ ]+' | awk '{print $2}')
48
+ TEAM_SIZE=$(echo "$ARGUMENTS" | grep -oE -- '--team-size [^ ]+' | awk '{print $2}')
49
+ OUTPUT_PATH=$(echo "$ARGUMENTS" | grep -oE -- '--output [^ ]+' | awk '{print $2}')
50
+ RUNBOOKS=$(echo "$ARGUMENTS" | grep -oE -- '--runbooks-paths [^ ]+' | awk '{print $2}')
51
+
52
+ [ -z "$TIME_WINDOW" ] && TIME_WINDOW="3m"
53
+ [ -z "$OUTPUT_PATH" ] && OUTPUT_PATH=".planning/TOIL-AUDIT.md"
54
+
55
+ # PT-BR: criar destination dir
56
+ mkdir -p "$(dirname "$OUTPUT_PATH")"
57
+ ```
58
+
59
+ ## 2. Validar pré-requisitos
60
+
61
+ ```bash
62
+ # PT-BR: detectar git repo (não-bloqueante — agent funciona sem git, só com scripts/runbooks)
63
+ GIT_OK=true
64
+ git rev-parse --git-dir >/dev/null 2>&1 || GIT_OK=false
65
+
66
+ if [ "$GIT_OK" = false ]; then
67
+ echo "⚠ Nenhum repositório git detectado — agent vai pular git log analysis."
68
+ echo " (toil-auditor continuará com scripts/runbooks apenas)"
69
+ fi
70
+
71
+ # PT-BR: verificar se TOIL-AUDIT.md anterior existe (idempotência)
72
+ if [ -f "$OUTPUT_PATH" ]; then
73
+ LAST_DATE=$(grep -m1 '**Audit date:**' "$OUTPUT_PATH" 2>/dev/null | sed 's/.*Audit date:\*\* //' || echo "?")
74
+ echo "ℹ TOIL-AUDIT.md anterior detectado (Audit date: $LAST_DATE)."
75
+ echo " Novo audit vai sobrescrever — agent compara com anterior se preservou histórico."
76
+ fi
77
+ ```
78
+
79
+ ## 3. Dispatch para `toil-auditor`
80
+
81
+ ```text
82
+ Task(
83
+ subagent_type="toil-auditor",
84
+ prompt="
85
+ project_root: .
86
+ output_path: ${OUTPUT_PATH}
87
+ time_window: ${TIME_WINDOW}
88
+ ${TEAM_SIZE:+team_size: ${TEAM_SIZE}}
89
+ ${RUNBOOKS:+runbooks_paths: ${RUNBOOKS}}
90
+
91
+ Aplicar skill eliminating-toil. Etapas:
92
+ 1. Scan: git log normalizado (commits repetitivos), scripts shell em paths canônicos, runbooks (manual ops descritas), README/CONTRIBUTING (manual setup).
93
+ 2. Aplicar 6 critérios canônicos (manual, repetitivo, automatizável, tático, sem valor durável, escala linear) em cada candidato.
94
+ 3. Distinguir toil vs overhead (reuniões/RH — não-elimináveis) vs grungy work (refactor — projeto engineering).
95
+ 4. Priorizar P0/P1/P2 por (frequency × pain) / automation_effort.
96
+ 5. Estimar esforço de automação por candidato (hours/days) + estágio L0-L4 do automation continuum.
97
+ 6. Computar % do tempo do time gasto em toil (regra ≤ 50%).
98
+
99
+ Output: ${OUTPUT_PATH} com tabela priorizada + sumário executivo + recomendações.
100
+ "
101
+ )
102
+ ```
103
+
104
+ ## 4. Pós-output + integração OMM
105
+
106
+ ```
107
+ ═══════════════════════════════════════════════════════════
108
+ framework ► AUDITAR-TOIL ▸ ${OUTPUT_PATH}
109
+ ═══════════════════════════════════════════════════════════
110
+
111
+ [output do toil-auditor — ver Step 5 do agent]
112
+
113
+ ## Próximos passos
114
+ 1. Revisar P0 (alto impacto, baixo esforço) — alvos imediatos para automação
115
+ 2. Se `workflow.audit_milestone_toil=true`, este audit alimenta `/auditar-marco` (Phase 40 INT-FW-V2-03)
116
+ 3. Cross-ref OMM (v1.9 — Capacidade 3 Tech Debt): `/observabilidade omm` consome este audit
117
+ 4. Re-audit recomendado a cada milestone (toil cresce silencioso)
118
+ ```
119
+
120
+ </process>
121
+
122
+ <success_criteria>
123
+ - [ ] $ARGUMENTS parseados (4 flags opcionais com defaults sensatos)
124
+ - [ ] Pré-requisitos validados de forma não-bloqueante (git ausente OK; falta runbooks OK)
125
+ - [ ] `toil-auditor` invocado via `Task(subagent_type=...)` com prompt completo (6 etapas)
126
+ - [ ] `.planning/TOIL-AUDIT.md` (ou `--output` custom) criado pelo agent
127
+ - [ ] Output forwarded transparentemente do agent (sem post-processing)
128
+ - [ ] Próximos passos sugerem cross-ref para `/auditar-marco`, `/observabilidade omm`
129
+ </success_criteria>