@luanpdd/kit-mcp 1.35.0 → 1.36.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 (117) hide show
  1. package/bin/cli.js +2 -2
  2. package/bin/mcp.js +6 -6
  3. package/bin/ui.js +74 -74
  4. package/gates/ai-prompt-stability.md +120 -120
  5. package/gates/budget-description.md +68 -68
  6. package/gates/confidence.md +29 -29
  7. package/gates/dependency-check.md +33 -33
  8. package/gates/dept-cycle-prevention.md +179 -179
  9. package/gates/golden-signals-coverage.md +133 -133
  10. package/gates/legacy-refactor-safety.md +178 -178
  11. package/gates/multi-tenant-rls-coverage.md +102 -102
  12. package/gates/no-personal-uuid.md +72 -72
  13. package/gates/obs-agents-mcp-supabase.md +86 -86
  14. package/gates/obs-skills-frontmatter.md +76 -76
  15. package/gates/observability-coverage.md +151 -151
  16. package/gates/omm-no-regression.md +83 -83
  17. package/gates/postmortem-template-required.md +127 -127
  18. package/gates/prr-checklist-coverage.md +128 -128
  19. package/gates/regression.md +32 -32
  20. package/gates/release-pipeline-policy.md +132 -132
  21. package/gates/secrets-scan.md +33 -33
  22. package/gates/service-role-not-in-user-facing.md +113 -113
  23. package/gates/skill-must-include.md +71 -71
  24. package/gates/sync-idempotent.md +62 -62
  25. package/gates/verify-phase-goal.md +34 -34
  26. package/kit/agents/designer-ui.md +216 -216
  27. package/kit/agents/workflow-generator.md +537 -167
  28. package/kit/commands/adicionar-backlog.md +1 -1
  29. package/kit/commands/adicionar-fase.md +1 -1
  30. package/kit/commands/adicionar-tarefa.md +1 -1
  31. package/kit/commands/auditar-observabilidade.md +103 -103
  32. package/kit/commands/auditar-toil.md +129 -129
  33. package/kit/commands/caracterizar-prompt.md +195 -195
  34. package/kit/commands/criar-workflow.md +158 -158
  35. package/kit/commands/definir-perfil.md +1 -1
  36. package/kit/commands/definir-slo.md +108 -108
  37. package/kit/commands/fio.md +1 -1
  38. package/kit/commands/golden-signals.md +142 -142
  39. package/kit/commands/instrumentar-fase.md +200 -200
  40. package/kit/commands/investigar-producao.md +162 -162
  41. package/kit/commands/observabilidade.md +118 -118
  42. package/kit/commands/postmortem.md +179 -179
  43. package/kit/commands/prr.md +205 -205
  44. package/kit/commands/publicar-rapido.md +207 -207
  45. package/kit/commands/risk-budget.md +220 -220
  46. package/kit/commands/sre.md +230 -230
  47. package/kit/file-manifest.json +424 -424
  48. package/kit/framework/references/output-style.md +22 -22
  49. package/kit/hooks/post-apply-migration.js +199 -199
  50. package/kit/hooks/sidecar-tool-publisher.js +210 -210
  51. package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -224
  52. package/kit/skills/_shared-legacy/glossary.md +389 -389
  53. package/kit/skills/_shared-multi-tenant/glossary.md +186 -186
  54. package/kit/skills/_shared-observability/glossary.md +396 -396
  55. package/kit/skills/_shared-sre/glossary.md +712 -712
  56. package/kit/skills/_shared-supabase/glossary.md +234 -234
  57. package/kit/skills/blameless-postmortems/SKILL.md +340 -340
  58. package/kit/skills/burn-rate-alerting/SKILL.md +258 -258
  59. package/kit/skills/cascading-failures/SKILL.md +311 -311
  60. package/kit/skills/core-analysis-loop/SKILL.md +352 -352
  61. package/kit/skills/distributed-tracing/SKILL.md +362 -362
  62. package/kit/skills/dynamic-workflow-authoring/SKILL.md +327 -223
  63. package/kit/skills/eliminating-toil/SKILL.md +243 -243
  64. package/kit/skills/event-based-slos/SKILL.md +296 -296
  65. package/kit/skills/four-golden-signals/SKILL.md +314 -314
  66. package/kit/skills/hermetic-builds/SKILL.md +323 -323
  67. package/kit/skills/legacy-monster-methods/SKILL.md +444 -444
  68. package/kit/skills/llm-as-dependency/SKILL.md +436 -436
  69. package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -396
  70. package/kit/skills/observability-driven-development/SKILL.md +315 -315
  71. package/kit/skills/observability-maturity-model/SKILL.md +222 -222
  72. package/kit/skills/opentelemetry-standard/SKILL.md +351 -351
  73. package/kit/skills/production-readiness-review/SKILL.md +305 -305
  74. package/kit/skills/release-engineering/SKILL.md +367 -367
  75. package/kit/skills/retry-strategies/SKILL.md +372 -372
  76. package/kit/skills/sre-risk-management/SKILL.md +221 -221
  77. package/kit/skills/structured-events/SKILL.md +265 -265
  78. package/kit/skills/supabase-cron-queues/SKILL.md +275 -275
  79. package/kit/skills/supabase-database-functions/SKILL.md +332 -332
  80. package/kit/skills/supabase-declarative-schema/SKILL.md +183 -183
  81. package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -253
  82. package/kit/skills/supabase-postgres-style/SKILL.md +138 -138
  83. package/kit/skills/supabase-storage/SKILL.md +234 -234
  84. package/kit/skills/telemetry-pipelines/SKILL.md +259 -259
  85. package/kit/skills/telemetry-sampling/SKILL.md +256 -256
  86. package/kit/skills/ui-anti-padroes-ia/SKILL.md +261 -261
  87. package/kit/skills/ui-contexto-produto/SKILL.md +248 -248
  88. package/kit/skills/ui-cor-estrategia/SKILL.md +213 -213
  89. package/kit/skills/ui-critica-auditoria/SKILL.md +260 -260
  90. package/kit/skills/ui-motion-funcional/SKILL.md +264 -264
  91. package/kit/skills/ui-ritmo-espacial/SKILL.md +259 -259
  92. package/kit/skills/ui-tipografia/SKILL.md +211 -211
  93. package/package.json +1 -1
  94. package/src/cli/index.js +1114 -1114
  95. package/src/cli/render.js +194 -194
  96. package/src/cli/upgrade-check.js +135 -135
  97. package/src/core/error-redaction.js +76 -76
  98. package/src/core/failures.js +153 -153
  99. package/src/core/gate-runner.js +205 -205
  100. package/src/core/gates.js +82 -82
  101. package/src/core/logger.js +170 -170
  102. package/src/core/manifest-verify.js +174 -174
  103. package/src/core/metrics.js +268 -268
  104. package/src/core/notify.js +60 -60
  105. package/src/core/path-safety.js +141 -141
  106. package/src/core/replays.js +120 -120
  107. package/src/core/ui.js +185 -185
  108. package/src/mcp-server/install.js +149 -149
  109. package/src/mcp-server/roots.js +124 -124
  110. package/src/ui/auto-spawn.js +113 -113
  111. package/src/ui/browser.js +78 -78
  112. package/src/ui/client.js +130 -130
  113. package/src/ui/events.js +65 -65
  114. package/src/ui/lockfile.js +191 -191
  115. package/src/ui/port.js +67 -67
  116. package/src/ui/server.js +547 -547
  117. package/src/ui/wrapper.js +129 -129
@@ -1,258 +1,258 @@
1
- ---
2
- name: burn-rate-alerting
3
- description: Use ao calcular burn rate predictive — lookahead/baseline window com fator 4×, context-aware vs short-term, fórmula de extrapolação para alert page vs ticket.
4
- ---
5
-
6
- # Observabilidade — Burn Rate Alerting
7
-
8
- ## Quando usar
9
-
10
- LLM carrega esta skill ao configurar alertas SLO ou avaliar burn rate. Trigger phrases:
11
-
12
- - "burn rate alert", "burn rate forecast"
13
- - "lookahead window", "baseline window"
14
- - "predictive vs context-aware"
15
- - "quando paginar vs quando criar ticket"
16
- - "extrapolar exhaustão de budget"
17
-
18
- ## Fórmula canônica
19
-
20
- ```
21
- burn_rate = error_rate / (1 - SLO_target)
22
- ```
23
-
24
- | Burn rate | Significado |
25
- |---|---|
26
- | 1× | Budget durará exatamente a janela do SLO |
27
- | 2× | Budget acabará em metade da janela |
28
- | 10× | Budget acabará em 1/10 da janela |
29
- | 100× | Budget esgotado em horas, não dias |
30
-
31
- **Predictive forecast (Cap 13 p145):**
32
-
33
- ```
34
- projected_remaining_at_lookahead = current_remaining - (burn_rate_now × lookahead_window)
35
- ALERT iff projected_remaining_at_lookahead < 0
36
- ```
37
-
38
- ## Regras absolutas
39
-
40
- - **Lookahead ≤ 4× baseline** — extrapolar 4 horas a partir de baseline 1h é confiável; extrapolar 1 dia a partir de 1h é flappy. (Sem ajuste de seasonality)
41
- - **Sliding window 30d** para o SLO — alinha com customer memory (skill [`event-based-slos`](../skills/event-based-slos/SKILL.md))
42
- - **2 alertas por SLO** — short-term (page) + long-term (ticket). Não 1 só, não 5+.
43
- - **Short-term: lookahead 4h, baseline 1h** — paga on-call em horas
44
- - **Long-term: lookahead 3d, baseline 18h** — abre ticket, não acorda alguém
45
- - **Context-aware vs short-term** — escolher por trade-off de custo vs sensibilidade. Default short-term para a maioria; context-aware se "10% restante = mais urgente que 90%".
46
- - **Não alertar zero-level** — se você só alerta quando budget = 0, não há tempo de reagir. Use predictive sempre.
47
-
48
- ## Patterns canônicos
49
-
50
- ### Pattern: 2 alertas canônicos por SLO
51
-
52
- ```yaml
53
- # PT-BR: para SLO 99.9% checkout_success com window 30d
54
- slo: checkout_success
55
- target: 0.999
56
- window: 30d_sliding
57
-
58
- alerts:
59
- # PT-BR: PAGE — paginar on-call (urgent)
60
- - name: short_term_burn
61
- type: predictive
62
- lookahead: 4h # PT-BR: forecast 4h à frente
63
- baseline: 1h # PT-BR: 4× regra (4h ≤ 4× 1h ✓)
64
- severity: page
65
- threshold_burn_rate: 14.4 # PT-BR: 4h × 14.4 = ~58h, esgota budget de 30d×0.001 = 43.2min em <4h
66
- routing: pagerduty:on-call
67
-
68
- # PT-BR: TICKET — criar ticket Jira/Linear (não-urgent)
69
- - name: long_term_burn
70
- type: predictive
71
- lookahead: 3d
72
- baseline: 18h # PT-BR: 4× regra (3d ≤ 4× 18h = 72h ✓)
73
- severity: ticket
74
- threshold_burn_rate: 1.0 # PT-BR: 1× = vai esgotar em 30d se continuar
75
- routing: jira:engineering
76
- ```
77
-
78
- ### Pattern: query de burn rate atual (Postgres)
79
-
80
- ```sql
81
- -- PT-BR: burn rate atual em janela baseline (último 1h)
82
- -- Para SLO 99.9% checkout_success
83
- with baseline as (
84
- select
85
- sum(good) as good,
86
- sum(bad) as bad,
87
- sum(total) as total
88
- from obs.sli_checkout_success
89
- where bucket > now() - interval '1 hour' -- baseline window
90
- )
91
- select
92
- total,
93
- bad,
94
- bad::float / nullif(total, 0) as error_rate,
95
- (bad::float / nullif(total, 0)) / (1 - 0.999) as burn_rate,
96
- case
97
- when bad::float / nullif(total, 0) >= 0.0144 then 'PAGE' -- burn_rate ≥ 14.4
98
- when bad::float / nullif(total, 0) >= 0.001 then 'TICKET' -- burn_rate ≥ 1
99
- else 'OK'
100
- end as alert_status
101
- from baseline;
102
- ```
103
-
104
- ### Pattern: predictive forecast — esgotamento
105
-
106
- ```sql
107
- -- PT-BR: ETA exhaustão do budget em horas
108
- with current_state as (
109
- select
110
- sum(case when bucket > now() - interval '30 days' then bad else 0 end) as bad_30d,
111
- sum(case when bucket > now() - interval '30 days' then total else 0 end) as total_30d,
112
- sum(case when bucket > now() - interval '1 hour' then bad else 0 end) as bad_1h,
113
- sum(case when bucket > now() - interval '1 hour' then total else 0 end) as total_1h
114
- from obs.sli_checkout_success
115
- )
116
- select
117
- -- PT-BR: budget restante em eventos
118
- (1 - 0.999) * total_30d - bad_30d as remaining_budget,
119
- -- PT-BR: taxa atual de queima (eventos/hora)
120
- bad_1h::float / 1 as burn_per_hour,
121
- -- PT-BR: ETA = budget restante / taxa
122
- case
123
- when bad_1h = 0 then 'NO_BURN'
124
- else round(((1 - 0.999) * total_30d - bad_30d) / nullif(bad_1h, 0))::text || 'h'
125
- end as eta_to_exhaustion
126
- from current_state;
127
- ```
128
-
129
- ### Pattern: context-aware vs short-term
130
-
131
- ```text
132
- SHORT-TERM (cheap):
133
- - Olha apenas baseline window (último 1h)
134
- - Não considera quanto budget já foi gasto
135
- - Mais barato; default para maioria
136
- - Pode causar false positive se budget está cheio (90% restante)
137
-
138
- CONTEXT-AWARE (expensive):
139
- - Considera budget remanescente
140
- - "Remaining budget × tolerable_burn_rate ≥ lookahead × current_burn_rate"
141
- - Mais caro (query SLO total + recente)
142
- - Recomendado para SLOs de alto risco onde 10% restante > 90% restante
143
- ```
144
-
145
- ### Pattern: dashboard de burn rate (Markdown gerado por `/burn-rate-status`)
146
-
147
- ```markdown
148
- # Burn Rate Status — 2026-05-06 14:32 UTC
149
-
150
- | SLO | Target | Window | Budget gasto | Burn rate atual | ETA exhaustão | Ação |
151
- |---|---|---|---|---|---|---|
152
- | checkout_success | 99.9% | 30d sliding | 23% | 1.4× | 12d | informativo |
153
- | login_success | 99.95% | 30d sliding | 78% | 8.0× | 4h | **PAGE on-call** |
154
- | search_latency | 99% | 30d sliding | 15% | 0.7× | — | OK |
155
- | admin_panel | (sem SLO) | — | — | — | — | — |
156
- ```
157
-
158
- ### Pattern: tightening alerts gradualmente
159
-
160
- ```text
161
- SEMANA 1: SLO + alerts em test channel (não real page)
162
- SEMANA 2: SLO + alerts em low-priority email
163
- SEMANA 3-4: validar que SLO detecta incidents reais
164
- SEMANA 5+: alerts SLO viram primários, threshold antigos para test channel
165
- SEMANA 8+: deletar threshold antigos completamente
166
-
167
- PT-BR: case study Honeycomb (Cap 12 p135) — SLO detectou outage 8h antes
168
- de threshold tradicional alertar. Confiança = deletar antigos.
169
- ```
170
-
171
- ## Anti-patterns
172
-
173
- ### ANTI: 1 alerta apenas (zero-level)
174
-
175
- ```text
176
- ANTI: alert dispara quando budget == 0 (totalmente exausto)
177
-
178
- PROBLEMA: você não tem tempo de reagir. Budget zerou, SLO violado, cliente afetado.
179
-
180
- CERTO: 2 alertas:
181
- - Short-term: burn rate 14.4× → page (4h de runway)
182
- - Long-term: burn rate 1× → ticket (3d de runway)
183
- ```
184
-
185
- ### ANTI: lookahead >> baseline
186
-
187
- ```text
188
- ANTI: lookahead 1d a partir de baseline 1h (24×)
189
-
190
- PROBLEMA: extrapolação linear de janela curta para janela longa é inválida.
191
- Ciclos diários, semanais, sazonalidades distorcem.
192
- Alert flappa (entra/sai a cada hora).
193
-
194
- CERTO: lookahead ≤ 4× baseline (regra empírica do livro p145)
195
- Para alertar 1d à frente: baseline ≥ 6h
196
- ```
197
-
198
- ### ANTI: burn rate threshold = 1×
199
-
200
- ```text
201
- ANTI: page on-call quando burn rate >= 1× (igual à taxa que esgota a janela)
202
-
203
- PROBLEMA: 1× sustained durante 1 mês = budget zerou ao final.
204
- Time tem 30d para reagir. NÃO é page-worthy.
205
-
206
- CERTO: page = 14.4× (esgota em 4h, ação imediata)
207
- ticket = 1× (esgota em 30d, ação planejada)
208
- ```
209
-
210
- ### ANTI: burn rate calculation com janela errada
211
-
212
- ```text
213
- ANTI: calcular burn rate sobre janela inteira de SLO (30d)
214
-
215
- PROBLEMA: smooth out spikes recentes. Você vê "compliance ok 99.7%" mesmo
216
- quando última 1h queimou 30% do budget. Reage tarde.
217
-
218
- CERTO: burn rate sobre baseline window (1h ou 18h), comparado ao SLO inteiro
219
- para avaliar remaining budget.
220
- ```
221
-
222
- ### ANTI: ignorar seasonality
223
-
224
- ```text
225
- ANTI: alertar 1d à frente sem considerar que sábado tem 1/3 do tráfego
226
-
227
- PROBLEMA: false positive sexta à noite (sábado vai ser baixo);
228
- false negative segunda de manhã (sábado foi baixo, segunda explode).
229
-
230
- CERTO: ou (a) usar baseline window grande o suficiente para capturar 1 ciclo
231
- (≥ 24h cobre dia/noite; ≥ 7d cobre semana);
232
- ou (b) modelar seasonality (cíclico) — context-aware burn alerts
233
- que conhecem padrões.
234
- ```
235
-
236
- ## Verificação
237
-
238
- Antes de promover burn alerts a produção:
239
-
240
- 1. **2 alertas por SLO** — short-term (page) + long-term (ticket)
241
- 2. **Lookahead ≤ 4× baseline** — verifique aritmética em cada
242
- 3. **Threshold burn rate calculado** — `target=99.9% → page=14.4×, ticket=1×`
243
- 4. **Routing nomeado** — `pagerduty:on-call` ou `jira:engineering`
244
- 5. **Test channel primeiro** — 1+ semana em low-priority antes de promover
245
- 6. **SLO já provou valor** — detectou incident antes de threshold antigo
246
- 7. **Documentação** — runbook de "o que fazer quando alert dispara"
247
-
248
- ---
249
-
250
- ## Ver também
251
-
252
- - `kit/skills/_shared-observability/glossary.md` — burn rate, lookahead/baseline
253
- - `kit/skills/event-based-slos/SKILL.md` — SLO definition
254
- - `kit/skills/core-analysis-loop/SKILL.md` — investigar root cause após alert
255
- - `kit/agents/burn-rate-forecaster.md` — agente que calcula via SQL
256
- - `kit/commands/burn-rate-status.md` — comando que invoca forecaster
257
-
258
- *Material-fonte: Observability Engineering (O'Reilly, 2022) — Cap 13: "Acting on and Debugging SLO-Based Alerts".*
1
+ ---
2
+ name: burn-rate-alerting
3
+ description: Use ao calcular burn rate predictive — lookahead/baseline window com fator 4×, context-aware vs short-term, fórmula de extrapolação para alert page vs ticket.
4
+ ---
5
+
6
+ # Observabilidade — Burn Rate Alerting
7
+
8
+ ## Quando usar
9
+
10
+ LLM carrega esta skill ao configurar alertas SLO ou avaliar burn rate. Trigger phrases:
11
+
12
+ - "burn rate alert", "burn rate forecast"
13
+ - "lookahead window", "baseline window"
14
+ - "predictive vs context-aware"
15
+ - "quando paginar vs quando criar ticket"
16
+ - "extrapolar exhaustão de budget"
17
+
18
+ ## Fórmula canônica
19
+
20
+ ```
21
+ burn_rate = error_rate / (1 - SLO_target)
22
+ ```
23
+
24
+ | Burn rate | Significado |
25
+ |---|---|
26
+ | 1× | Budget durará exatamente a janela do SLO |
27
+ | 2× | Budget acabará em metade da janela |
28
+ | 10× | Budget acabará em 1/10 da janela |
29
+ | 100× | Budget esgotado em horas, não dias |
30
+
31
+ **Predictive forecast (Cap 13 p145):**
32
+
33
+ ```
34
+ projected_remaining_at_lookahead = current_remaining - (burn_rate_now × lookahead_window)
35
+ ALERT iff projected_remaining_at_lookahead < 0
36
+ ```
37
+
38
+ ## Regras absolutas
39
+
40
+ - **Lookahead ≤ 4× baseline** — extrapolar 4 horas a partir de baseline 1h é confiável; extrapolar 1 dia a partir de 1h é flappy. (Sem ajuste de seasonality)
41
+ - **Sliding window 30d** para o SLO — alinha com customer memory (skill [`event-based-slos`](../skills/event-based-slos/SKILL.md))
42
+ - **2 alertas por SLO** — short-term (page) + long-term (ticket). Não 1 só, não 5+.
43
+ - **Short-term: lookahead 4h, baseline 1h** — paga on-call em horas
44
+ - **Long-term: lookahead 3d, baseline 18h** — abre ticket, não acorda alguém
45
+ - **Context-aware vs short-term** — escolher por trade-off de custo vs sensibilidade. Default short-term para a maioria; context-aware se "10% restante = mais urgente que 90%".
46
+ - **Não alertar zero-level** — se você só alerta quando budget = 0, não há tempo de reagir. Use predictive sempre.
47
+
48
+ ## Patterns canônicos
49
+
50
+ ### Pattern: 2 alertas canônicos por SLO
51
+
52
+ ```yaml
53
+ # PT-BR: para SLO 99.9% checkout_success com window 30d
54
+ slo: checkout_success
55
+ target: 0.999
56
+ window: 30d_sliding
57
+
58
+ alerts:
59
+ # PT-BR: PAGE — paginar on-call (urgent)
60
+ - name: short_term_burn
61
+ type: predictive
62
+ lookahead: 4h # PT-BR: forecast 4h à frente
63
+ baseline: 1h # PT-BR: 4× regra (4h ≤ 4× 1h ✓)
64
+ severity: page
65
+ threshold_burn_rate: 14.4 # PT-BR: 4h × 14.4 = ~58h, esgota budget de 30d×0.001 = 43.2min em <4h
66
+ routing: pagerduty:on-call
67
+
68
+ # PT-BR: TICKET — criar ticket Jira/Linear (não-urgent)
69
+ - name: long_term_burn
70
+ type: predictive
71
+ lookahead: 3d
72
+ baseline: 18h # PT-BR: 4× regra (3d ≤ 4× 18h = 72h ✓)
73
+ severity: ticket
74
+ threshold_burn_rate: 1.0 # PT-BR: 1× = vai esgotar em 30d se continuar
75
+ routing: jira:engineering
76
+ ```
77
+
78
+ ### Pattern: query de burn rate atual (Postgres)
79
+
80
+ ```sql
81
+ -- PT-BR: burn rate atual em janela baseline (último 1h)
82
+ -- Para SLO 99.9% checkout_success
83
+ with baseline as (
84
+ select
85
+ sum(good) as good,
86
+ sum(bad) as bad,
87
+ sum(total) as total
88
+ from obs.sli_checkout_success
89
+ where bucket > now() - interval '1 hour' -- baseline window
90
+ )
91
+ select
92
+ total,
93
+ bad,
94
+ bad::float / nullif(total, 0) as error_rate,
95
+ (bad::float / nullif(total, 0)) / (1 - 0.999) as burn_rate,
96
+ case
97
+ when bad::float / nullif(total, 0) >= 0.0144 then 'PAGE' -- burn_rate ≥ 14.4
98
+ when bad::float / nullif(total, 0) >= 0.001 then 'TICKET' -- burn_rate ≥ 1
99
+ else 'OK'
100
+ end as alert_status
101
+ from baseline;
102
+ ```
103
+
104
+ ### Pattern: predictive forecast — esgotamento
105
+
106
+ ```sql
107
+ -- PT-BR: ETA exhaustão do budget em horas
108
+ with current_state as (
109
+ select
110
+ sum(case when bucket > now() - interval '30 days' then bad else 0 end) as bad_30d,
111
+ sum(case when bucket > now() - interval '30 days' then total else 0 end) as total_30d,
112
+ sum(case when bucket > now() - interval '1 hour' then bad else 0 end) as bad_1h,
113
+ sum(case when bucket > now() - interval '1 hour' then total else 0 end) as total_1h
114
+ from obs.sli_checkout_success
115
+ )
116
+ select
117
+ -- PT-BR: budget restante em eventos
118
+ (1 - 0.999) * total_30d - bad_30d as remaining_budget,
119
+ -- PT-BR: taxa atual de queima (eventos/hora)
120
+ bad_1h::float / 1 as burn_per_hour,
121
+ -- PT-BR: ETA = budget restante / taxa
122
+ case
123
+ when bad_1h = 0 then 'NO_BURN'
124
+ else round(((1 - 0.999) * total_30d - bad_30d) / nullif(bad_1h, 0))::text || 'h'
125
+ end as eta_to_exhaustion
126
+ from current_state;
127
+ ```
128
+
129
+ ### Pattern: context-aware vs short-term
130
+
131
+ ```text
132
+ SHORT-TERM (cheap):
133
+ - Olha apenas baseline window (último 1h)
134
+ - Não considera quanto budget já foi gasto
135
+ - Mais barato; default para maioria
136
+ - Pode causar false positive se budget está cheio (90% restante)
137
+
138
+ CONTEXT-AWARE (expensive):
139
+ - Considera budget remanescente
140
+ - "Remaining budget × tolerable_burn_rate ≥ lookahead × current_burn_rate"
141
+ - Mais caro (query SLO total + recente)
142
+ - Recomendado para SLOs de alto risco onde 10% restante > 90% restante
143
+ ```
144
+
145
+ ### Pattern: dashboard de burn rate (Markdown gerado por `/burn-rate-status`)
146
+
147
+ ```markdown
148
+ # Burn Rate Status — 2026-05-06 14:32 UTC
149
+
150
+ | SLO | Target | Window | Budget gasto | Burn rate atual | ETA exhaustão | Ação |
151
+ |---|---|---|---|---|---|---|
152
+ | checkout_success | 99.9% | 30d sliding | 23% | 1.4× | 12d | informativo |
153
+ | login_success | 99.95% | 30d sliding | 78% | 8.0× | 4h | **PAGE on-call** |
154
+ | search_latency | 99% | 30d sliding | 15% | 0.7× | — | OK |
155
+ | admin_panel | (sem SLO) | — | — | — | — | — |
156
+ ```
157
+
158
+ ### Pattern: tightening alerts gradualmente
159
+
160
+ ```text
161
+ SEMANA 1: SLO + alerts em test channel (não real page)
162
+ SEMANA 2: SLO + alerts em low-priority email
163
+ SEMANA 3-4: validar que SLO detecta incidents reais
164
+ SEMANA 5+: alerts SLO viram primários, threshold antigos para test channel
165
+ SEMANA 8+: deletar threshold antigos completamente
166
+
167
+ PT-BR: case study Honeycomb (Cap 12 p135) — SLO detectou outage 8h antes
168
+ de threshold tradicional alertar. Confiança = deletar antigos.
169
+ ```
170
+
171
+ ## Anti-patterns
172
+
173
+ ### ANTI: 1 alerta apenas (zero-level)
174
+
175
+ ```text
176
+ ANTI: alert dispara quando budget == 0 (totalmente exausto)
177
+
178
+ PROBLEMA: você não tem tempo de reagir. Budget zerou, SLO violado, cliente afetado.
179
+
180
+ CERTO: 2 alertas:
181
+ - Short-term: burn rate 14.4× → page (4h de runway)
182
+ - Long-term: burn rate 1× → ticket (3d de runway)
183
+ ```
184
+
185
+ ### ANTI: lookahead >> baseline
186
+
187
+ ```text
188
+ ANTI: lookahead 1d a partir de baseline 1h (24×)
189
+
190
+ PROBLEMA: extrapolação linear de janela curta para janela longa é inválida.
191
+ Ciclos diários, semanais, sazonalidades distorcem.
192
+ Alert flappa (entra/sai a cada hora).
193
+
194
+ CERTO: lookahead ≤ 4× baseline (regra empírica do livro p145)
195
+ Para alertar 1d à frente: baseline ≥ 6h
196
+ ```
197
+
198
+ ### ANTI: burn rate threshold = 1×
199
+
200
+ ```text
201
+ ANTI: page on-call quando burn rate >= 1× (igual à taxa que esgota a janela)
202
+
203
+ PROBLEMA: 1× sustained durante 1 mês = budget zerou ao final.
204
+ Time tem 30d para reagir. NÃO é page-worthy.
205
+
206
+ CERTO: page = 14.4× (esgota em 4h, ação imediata)
207
+ ticket = 1× (esgota em 30d, ação planejada)
208
+ ```
209
+
210
+ ### ANTI: burn rate calculation com janela errada
211
+
212
+ ```text
213
+ ANTI: calcular burn rate sobre janela inteira de SLO (30d)
214
+
215
+ PROBLEMA: smooth out spikes recentes. Você vê "compliance ok 99.7%" mesmo
216
+ quando última 1h queimou 30% do budget. Reage tarde.
217
+
218
+ CERTO: burn rate sobre baseline window (1h ou 18h), comparado ao SLO inteiro
219
+ para avaliar remaining budget.
220
+ ```
221
+
222
+ ### ANTI: ignorar seasonality
223
+
224
+ ```text
225
+ ANTI: alertar 1d à frente sem considerar que sábado tem 1/3 do tráfego
226
+
227
+ PROBLEMA: false positive sexta à noite (sábado vai ser baixo);
228
+ false negative segunda de manhã (sábado foi baixo, segunda explode).
229
+
230
+ CERTO: ou (a) usar baseline window grande o suficiente para capturar 1 ciclo
231
+ (≥ 24h cobre dia/noite; ≥ 7d cobre semana);
232
+ ou (b) modelar seasonality (cíclico) — context-aware burn alerts
233
+ que conhecem padrões.
234
+ ```
235
+
236
+ ## Verificação
237
+
238
+ Antes de promover burn alerts a produção:
239
+
240
+ 1. **2 alertas por SLO** — short-term (page) + long-term (ticket)
241
+ 2. **Lookahead ≤ 4× baseline** — verifique aritmética em cada
242
+ 3. **Threshold burn rate calculado** — `target=99.9% → page=14.4×, ticket=1×`
243
+ 4. **Routing nomeado** — `pagerduty:on-call` ou `jira:engineering`
244
+ 5. **Test channel primeiro** — 1+ semana em low-priority antes de promover
245
+ 6. **SLO já provou valor** — detectou incident antes de threshold antigo
246
+ 7. **Documentação** — runbook de "o que fazer quando alert dispara"
247
+
248
+ ---
249
+
250
+ ## Ver também
251
+
252
+ - `kit/skills/_shared-observability/glossary.md` — burn rate, lookahead/baseline
253
+ - `kit/skills/event-based-slos/SKILL.md` — SLO definition
254
+ - `kit/skills/core-analysis-loop/SKILL.md` — investigar root cause após alert
255
+ - `kit/agents/burn-rate-forecaster.md` — agente que calcula via SQL
256
+ - `kit/commands/burn-rate-status.md` — comando que invoca forecaster
257
+
258
+ *Material-fonte: Observability Engineering (O'Reilly, 2022) — Cap 13: "Acting on and Debugging SLO-Based Alerts".*