@luanpdd/kit-mcp 1.9.0 → 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.
- package/CHANGELOG.md +86 -0
- package/README.md +58 -0
- package/gates/golden-signals-coverage.md +133 -0
- package/gates/postmortem-template-required.md +127 -0
- package/gates/prr-checklist-coverage.md +128 -0
- package/kit/agents/golden-signals-instrumenter.md +241 -0
- package/kit/agents/omm-auditor.md +52 -0
- package/kit/agents/postmortem-writer.md +282 -0
- package/kit/agents/prr-conductor.md +288 -0
- package/kit/agents/supabase-architect.md +49 -0
- package/kit/agents/supabase-edge-fn-writer.md +102 -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/commands/auditar-marco.md +81 -1
- package/kit/commands/auditar-toil.md +129 -0
- package/kit/commands/concluir-marco.md +55 -1
- package/kit/commands/forense.md +64 -1
- package/kit/commands/golden-signals.md +142 -0
- package/kit/commands/postmortem.md +179 -0
- package/kit/commands/prr.md +205 -0
- package/kit/commands/risk-budget.md +220 -0
- package/kit/commands/sre.md +227 -0
- package/kit/skills/_shared-sre/glossary.md +573 -0
- package/kit/skills/blameless-postmortems/SKILL.md +340 -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 +297 -0
- package/kit/skills/production-readiness-review/SKILL.md +305 -0
- package/kit/skills/sre-risk-management/SKILL.md +221 -0
- package/package.json +1 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: risk-budget
|
|
3
|
+
description: Exibe error budget atual vs risk continuum (cap 3 SRE) — lê .planning/slos/, posiciona no continuum 99% → 99.999%, aplica sabedoria 99.99% e "as reliable as needs to be".
|
|
4
|
+
argument-hint: "[<slo_name>] [--format table|json]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Bash
|
|
8
|
+
- Grep
|
|
9
|
+
- Glob
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<objective>
|
|
13
|
+
Snapshot read-only de **error budget vs risk continuum** (cap 3 do livro Google SRE) para 1 SLO ou todos. Aplica skill [`sre-risk-management`](../skills/sre-risk-management/SKILL.md) — risk continuum como decisão explícita, error budget como balanço risk × innovation, sabedoria 99.99% (user em smartphone 99% NÃO distingue 99.99% vs 99.999%), "as reliable as needs to be, no more".
|
|
14
|
+
|
|
15
|
+
Lê SLOs definidos em [`event-based-slos`](../skills/event-based-slos/SKILL.md) (v1.9) — `.planning/slos/*.md`. Complementa [`burn-rate-status`](./burn-rate-status.md) (v1.9 — burn rate forecast) com **decisão estratégica** sobre target apropriado.
|
|
16
|
+
|
|
17
|
+
**Cria/Atualiza:** nada — comando read-only.
|
|
18
|
+
|
|
19
|
+
**Após:** o user vê posição de cada SLO no continuum, % budget gasto, custo relativo (1× → 100×+), e recomendação de tier (free/paid/enterprise) consistente com user-perception.
|
|
20
|
+
</objective>
|
|
21
|
+
|
|
22
|
+
<context>
|
|
23
|
+
**Argumentos:** `$ARGUMENTS` — opcional `<slo_name>` para 1 SLO; sem args = todos os SLOs.
|
|
24
|
+
|
|
25
|
+
**Flags:**
|
|
26
|
+
- `--format <table|json>` — output format (default: `table`)
|
|
27
|
+
- `--explain` — incluir bloco "sabedoria 99.99%" + anti-patterns inline (verbose)
|
|
28
|
+
|
|
29
|
+
**Pré-requisito:** SLOs definidos em `.planning/slos/*.md` (v1.9 — comando `/observabilidade slo` ou `/definir-slo`).
|
|
30
|
+
|
|
31
|
+
**Risk continuum canônico** (cap 3, aplicado inline pela skill):
|
|
32
|
+
|
|
33
|
+
| Target | Tolerância 30d | User-perceptible? | Recomendação | Custo relativo |
|
|
34
|
+
|---|---|---|---|---|
|
|
35
|
+
| 99% | 7.2 h | Sim | Tier free, beta, internal | 1× |
|
|
36
|
+
| 99.5% | 3.6 h | Notável | Tier free de produção | 2× |
|
|
37
|
+
| 99.9% | 43.2 min | Aceitável para UX | Tier paid default | 5× |
|
|
38
|
+
| 99.95% | 21.6 min | Quase imperceptível | Tier enterprise / mission-critical | 10× |
|
|
39
|
+
| 99.99% | 4.3 min | Imperceptível em smartphone | Apenas se justificado (raro) | 50×+ |
|
|
40
|
+
| 99.999% | 26 s | NÃO perceptível | NUNCA para user-facing | 100×+ |
|
|
41
|
+
|
|
42
|
+
**Loop pattern:** rodar via skill `loop` para monitoramento contínuo.
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
/loop 1h /risk-budget
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Exemplos:**
|
|
49
|
+
```
|
|
50
|
+
/risk-budget # todos SLOs, formato table
|
|
51
|
+
/risk-budget checkout_success # 1 SLO específico
|
|
52
|
+
/risk-budget --format json # output estruturado
|
|
53
|
+
/risk-budget login_success --explain # com sabedoria 99.99% + anti-patterns inline
|
|
54
|
+
```
|
|
55
|
+
</context>
|
|
56
|
+
|
|
57
|
+
<process>
|
|
58
|
+
|
|
59
|
+
## 1. Parsear argumentos
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
SLO_NAME=$(echo "$ARGUMENTS" | awk '{print $1}' | grep -v '^--' || true)
|
|
63
|
+
FORMAT=$(echo "$ARGUMENTS" | grep -oE -- '--format [^ ]+' | awk '{print $2}')
|
|
64
|
+
EXPLAIN=$(echo "$ARGUMENTS" | grep -c -- '--explain' || echo 0)
|
|
65
|
+
|
|
66
|
+
[ -z "$FORMAT" ] && FORMAT="table"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 2. Listar SLOs
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
if [ -n "$SLO_NAME" ]; then
|
|
73
|
+
SLO_FILES=(".planning/slos/${SLO_NAME}.md")
|
|
74
|
+
else
|
|
75
|
+
SLO_FILES=(.planning/slos/*.md)
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
if [ ${#SLO_FILES[@]} -eq 0 ] || [ ! -f "${SLO_FILES[0]}" ]; then
|
|
79
|
+
echo "Nenhum SLO definido em .planning/slos/."
|
|
80
|
+
echo "Defina um com: /observabilidade slo <feature> (v1.9)"
|
|
81
|
+
exit 0
|
|
82
|
+
fi
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 3. Para cada SLO, extrair metadados + computar posição no continuum
|
|
86
|
+
|
|
87
|
+
Para cada `SLO_FILE`:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
SLO_NAME=$(basename "$SLO_FILE" .md)
|
|
91
|
+
TARGET=$(grep -m1 -oE 'target.*[0-9.]+' "$SLO_FILE" | grep -oE '[0-9.]+')
|
|
92
|
+
WINDOW=$(grep -m1 -oE 'window.*[0-9]+[dh]' "$SLO_FILE" | grep -oE '[0-9]+[dh]' || echo "30d")
|
|
93
|
+
TIER_LABEL=$(grep -m1 'tier:' "$SLO_FILE" | sed 's/.*tier: //' || echo "(unset)")
|
|
94
|
+
OWNER=$(grep -m1 'owner:' "$SLO_FILE" | sed 's/.*owner: //' || echo "(unset)")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Mapear target → posição no risk continuum** (skill `sre-risk-management` Pattern 1):
|
|
98
|
+
|
|
99
|
+
| Target faixa | Posição | Custo relativo | Tier típico | User-perceptible |
|
|
100
|
+
|---|---|---|---|---|
|
|
101
|
+
| < 0.99 | abaixo do continuum (under-spec) | <1× | beta/dev | sim |
|
|
102
|
+
| 0.99 ≤ t < 0.995 | 99% | 1× | free, beta, internal | sim (notável) |
|
|
103
|
+
| 0.995 ≤ t < 0.999 | 99.5% | 2× | free de produção | notável em paths críticos |
|
|
104
|
+
| 0.999 ≤ t < 0.9995 | 99.9% | 5× | paid default | aceitável para UX |
|
|
105
|
+
| 0.9995 ≤ t < 0.9999 | 99.95% | 10× | enterprise/mission-critical | quase imperceptível |
|
|
106
|
+
| 0.9999 ≤ t < 0.99999 | 99.99% | 50×+ | só com checklist 4-perguntas | imperceptível em smartphone |
|
|
107
|
+
| t ≥ 0.99999 | 99.999% | 100×+ | NUNCA para user-facing | NÃO perceptível |
|
|
108
|
+
|
|
109
|
+
**Computar budget gasto** (heurística — leitura grosseira do SLO file):
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# PT-BR: SLO file pode ter linha "**Budget consumido (snapshot):** XX%" atualizada por job
|
|
113
|
+
BUDGET_USED_PCT=$(grep -m1 -oE 'Budget consumido.*[0-9]+%' "$SLO_FILE" | grep -oE '[0-9]+%' || echo "?")
|
|
114
|
+
|
|
115
|
+
# PT-BR: se não, sugerir invocar /burn-rate-status (que tem queries live)
|
|
116
|
+
if [ "$BUDGET_USED_PCT" = "?" ]; then
|
|
117
|
+
BUDGET_USED_PCT="(invoque /burn-rate-status para snapshot live)"
|
|
118
|
+
fi
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Status no continuum** (4 níveis enum — interpretação canônica):
|
|
122
|
+
|
|
123
|
+
- `OPTIMAL` — target apropriado para tier; budget < 50% gasto → "as reliable as needs to be"
|
|
124
|
+
- `OVER-SPEC` — target acima do necessário (ex: tier free com 99.99%) → desperdício; baixar target
|
|
125
|
+
- `UNDER-SPEC` — target abaixo do esperado (ex: enterprise com 99% só) → SLA risk; subir target
|
|
126
|
+
- `BUDGET-EXHAUSTED` — budget < 10% restante → freeze releases; revisitar postmortems
|
|
127
|
+
|
|
128
|
+
## 4. Agregar resultados em tabela
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
═══════════════════════════════════════════════════════════
|
|
132
|
+
framework ► RISK-BUDGET ▸ {timestamp}
|
|
133
|
+
═══════════════════════════════════════════════════════════
|
|
134
|
+
|
|
135
|
+
| SLO | Target | Posição | Tier | Custo relativo | Budget gasto | Status | Decisão |
|
|
136
|
+
|---|---|---|---|---|---|---|---|
|
|
137
|
+
| checkout_success | 99.9% | 99.9% (5×) | paid | 5× | 23% | OPTIMAL | manter |
|
|
138
|
+
| login_success | 99.99% | 99.99% (50×+) | enterprise | 50×+ | 78% | BUDGET-EXHAUSTED | freeze releases; checklist 4-perguntas? |
|
|
139
|
+
| search_latency | 99% | 99% (1×) | free | 1× | 15% | OPTIMAL | manter (tier free OK) |
|
|
140
|
+
| admin_panel | 99.95% | 99.95% (10×) | (?internal) | 10× | 5% | OVER-SPEC | baixar para 99% (internal tool, custo desperdício) |
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Output JSON (`--format json`) — mesmo conteúdo serializado:
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"timestamp": "2026-05-07T...",
|
|
148
|
+
"slos": [
|
|
149
|
+
{
|
|
150
|
+
"name": "checkout_success",
|
|
151
|
+
"target": 0.999,
|
|
152
|
+
"position": "99.9%",
|
|
153
|
+
"cost_multiplier": "5×",
|
|
154
|
+
"tier": "paid",
|
|
155
|
+
"budget_used_pct": 23,
|
|
156
|
+
"status": "OPTIMAL",
|
|
157
|
+
"decision": "manter"
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## 5. Modo `--explain` — sabedoria 99.99% + anti-patterns inline
|
|
164
|
+
|
|
165
|
+
Se `--explain` setado, anexar após tabela:
|
|
166
|
+
|
|
167
|
+
```markdown
|
|
168
|
+
## Sabedoria 99.99% (cap 3)
|
|
169
|
+
|
|
170
|
+
> Smartphone tem ~99% de disponibilidade (sinal cai, bateria acaba, app trava).
|
|
171
|
+
> Usuário em 99% smartphone NÃO distingue serviço 99.99% vs 99.999% — ambos
|
|
172
|
+
> parecem "sempre funcionando" no contexto dele. Cada nove adicional **multiplica
|
|
173
|
+
> custo** mas **divide benefício marginal**. Cliente final (humano em smartphone
|
|
174
|
+
> com ISP residencial ~99%) tem disponibilidade no canal de comunicação inferior
|
|
175
|
+
> à do seu serviço 99.99%. Essa é a sabedoria 99.99%.
|
|
176
|
+
|
|
177
|
+
## Anti-patterns detectados
|
|
178
|
+
|
|
179
|
+
{Para cada SLO em status OVER-SPEC, BUDGET-EXHAUSTED:}
|
|
180
|
+
- **{slo_name}** ({status}): {explicação curta}
|
|
181
|
+
- {ação recomendada}
|
|
182
|
+
|
|
183
|
+
Exemplos:
|
|
184
|
+
- **admin_panel** (OVER-SPEC): tier internal com 99.95% (10× custo). Internal tool não exige tier paid.
|
|
185
|
+
- Ação: editar `.planning/slos/admin_panel.md` → target: 0.99 (1×); ou remover SLO formal (apenas métrica informativa).
|
|
186
|
+
- **login_success** (BUDGET-EXHAUSTED 78%): 99.99% sem checklist 4-perguntas justificada?
|
|
187
|
+
- Ação: revisar Pattern "justificar 99.99%+ excepcional" (skill sre-risk-management); se NÃO atende 4 critérios, baixar para 99.95%.
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## 6. Sugerir próximas ações
|
|
191
|
+
|
|
192
|
+
Se algum SLO em status `BUDGET-EXHAUSTED` ou `OVER-SPEC`:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
## ⚠ Decisões pendentes
|
|
196
|
+
|
|
197
|
+
{Para cada SLO em alerta:}
|
|
198
|
+
- {slo_name} ({status}): {recomendação curta}
|
|
199
|
+
→ /investigar-producao "{slo_name} budget exhausted às {timestamp}" # se BUDGET-EXHAUSTED
|
|
200
|
+
→ editar `.planning/slos/{slo_name}.md` target: {sugestão} # se OVER-SPEC
|
|
201
|
+
|
|
202
|
+
## Cross-refs
|
|
203
|
+
- `/burn-rate-status {slo_name}` — burn rate live (forecast ETA)
|
|
204
|
+
- `/postmortem --incident "..."` — se budget exhausted virou incident
|
|
205
|
+
- `/observabilidade omm` — Capacidade 1 (Embracing Risk) consome este snapshot
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
</process>
|
|
209
|
+
|
|
210
|
+
<success_criteria>
|
|
211
|
+
- [ ] `<slo_name>` opcional + flags `--format` e `--explain` parseadas
|
|
212
|
+
- [ ] SLOs listados via glob `.planning/slos/*.md`
|
|
213
|
+
- [ ] Cada SLO mapeado para posição no risk continuum (1× a 100×+)
|
|
214
|
+
- [ ] 4 status enum: OPTIMAL / OVER-SPEC / UNDER-SPEC / BUDGET-EXHAUSTED
|
|
215
|
+
- [ ] Tabela agregada com 8 colunas (SLO, Target, Posição, Tier, Custo relativo, Budget gasto, Status, Decisão)
|
|
216
|
+
- [ ] Modo `--explain` anexa sabedoria 99.99% + anti-patterns detectados inline
|
|
217
|
+
- [ ] Cross-refs para `/burn-rate-status`, `/postmortem`, `/observabilidade omm` (Capacidade 1 Embracing Risk)
|
|
218
|
+
- [ ] Idempotente — rodável em `/loop` sem state acumulado
|
|
219
|
+
- [ ] Read-only — comando NÃO modifica arquivos
|
|
220
|
+
</success_criteria>
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sre
|
|
3
|
+
description: Orquestrador da Suíte SRE (v1.10) — dispatch para agents (golden-signals-instrumenter, toil-auditor, postmortem-writer, prr-conductor) com sinônimos PT/EN.
|
|
4
|
+
argument-hint: "<subcomando> [args...]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash
|
|
9
|
+
- Grep
|
|
10
|
+
- Glob
|
|
11
|
+
- Task
|
|
12
|
+
- AskUserQuestion
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<objective>
|
|
16
|
+
Orquestrador único da Suíte SRE (v1.10) — terceiro orquestrador da família após [`/supabase`](./supabase.md) (v1.8) e [`/observabilidade`](./observabilidade.md) (v1.9). Recebe subcomando + args, faz dispatch via `Task(subagent_type=...)` para o agent SRE correto. **Único ponto de chain de agents SRE** (anti-pitfall A10 mantido — agents permanecem função pura).
|
|
17
|
+
|
|
18
|
+
**Subcomandos cobrem cap 3, 5, 6, 15, 32 do livro Google SRE:**
|
|
19
|
+
- `golden-signals` — 4 signals universais (cap 6)
|
|
20
|
+
- `auditar-toil`/`audit-toil` — eliminating toil (cap 5)
|
|
21
|
+
- `postmortem` — blameless postmortem (cap 15)
|
|
22
|
+
- `prr` — Production Readiness Review (cap 32)
|
|
23
|
+
- `risk-budget`/`budget` — risk continuum (cap 3)
|
|
24
|
+
|
|
25
|
+
**Cria/Atualiza:** o que cada agent invocado cria (patches OTel, TOIL-AUDIT.md, postmortem, PRR-REPORT.md, snapshot risk-budget).
|
|
26
|
+
|
|
27
|
+
**Após:** o usuário tem o output do agent (instrumentação aplicada, audit, postmortem revisável, PRR scored, ou snapshot de budget).
|
|
28
|
+
</objective>
|
|
29
|
+
|
|
30
|
+
<execution_context>
|
|
31
|
+
Skills consultadas pelos agents (Phase 36): [`kit/skills/sre-risk-management/SKILL.md`](../skills/sre-risk-management/SKILL.md), [`kit/skills/four-golden-signals/SKILL.md`](../skills/four-golden-signals/SKILL.md), [`kit/skills/eliminating-toil/SKILL.md`](../skills/eliminating-toil/SKILL.md), [`kit/skills/blameless-postmortems/SKILL.md`](../skills/blameless-postmortems/SKILL.md), [`kit/skills/production-readiness-review/SKILL.md`](../skills/production-readiness-review/SKILL.md) + glossário em [`kit/skills/_shared-sre/glossary.md`](../skills/_shared-sre/glossary.md).
|
|
32
|
+
|
|
33
|
+
Agents disponíveis (Phase 37):
|
|
34
|
+
- [`golden-signals-instrumenter`](../agents/golden-signals-instrumenter.md) — AGCORE-SRE-01
|
|
35
|
+
- [`toil-auditor`](../agents/toil-auditor.md) — AGCORE-SRE-02
|
|
36
|
+
- [`postmortem-writer`](../agents/postmortem-writer.md) — AGCORE-SRE-03
|
|
37
|
+
- [`prr-conductor`](../agents/prr-conductor.md) — AGCORE-SRE-04
|
|
38
|
+
|
|
39
|
+
**Subcomando `risk-budget`** é caso especial — comando direto (Plan 05 não usa agent); orquestrador delega aplicando skill [`sre-risk-management`](../skills/sre-risk-management/SKILL.md) inline ou re-encaminhando para `/risk-budget`.
|
|
40
|
+
</execution_context>
|
|
41
|
+
|
|
42
|
+
<context>
|
|
43
|
+
**Argumentos:** `$ARGUMENTS` — primeiro token é o subcomando; restante é passado para o agent como prompt.
|
|
44
|
+
|
|
45
|
+
**Subcomandos suportados (sinônimos PT-BR/EN):**
|
|
46
|
+
|
|
47
|
+
| Subcomando | Sinônimos | Agent dispatched | Cap livro |
|
|
48
|
+
|---|---|---|---|
|
|
49
|
+
| `golden-signals` | `signals`, `4signals`, `golden` | `golden-signals-instrumenter` | 6 |
|
|
50
|
+
| `auditar-toil` | `audit-toil`, `toil`, `auditar` | `toil-auditor` | 5 |
|
|
51
|
+
| `postmortem` | `pm`, `post-mortem` | `postmortem-writer` | 15 |
|
|
52
|
+
| `prr` | `production-readiness`, `readiness-review` | `prr-conductor` | 32 |
|
|
53
|
+
| `risk-budget` | `budget`, `risk`, `continuum` | (comando direto — `/risk-budget`) | 3 |
|
|
54
|
+
| `help` | `ajuda`, `?` | exibe esta tabela inline | — |
|
|
55
|
+
|
|
56
|
+
**Roteamento de flags por subcomando:**
|
|
57
|
+
|
|
58
|
+
- `golden-signals <target>` — args passados como `<target>` + flags `--service` `--saturation` `--runtime`
|
|
59
|
+
- `auditar-toil` — flags `--time-window` `--team-size` `--output` `--runbooks-paths`
|
|
60
|
+
- `postmortem` — flags **mutuamente exclusivas** `--from-investigation <id>` OU `--incident "<desc>"` + `--severity`
|
|
61
|
+
- `prr` — flags **mutuamente exclusivas** `--service <name>` OU `--feature "<desc>"` + `--engagement` `--reviewer`
|
|
62
|
+
- `risk-budget` — `[<slo_name>]` opcional + `--format` `--explain`
|
|
63
|
+
|
|
64
|
+
**Exemplos:**
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
/sre golden-signals supabase/functions/process-emails # instrumentar Edge Function
|
|
68
|
+
/sre auditar-toil --time-window 6m # audit toil últimos 6 meses
|
|
69
|
+
/sre postmortem --from-investigation incident-2026-05-06-1432-checkout-burn # continuação de v1.9
|
|
70
|
+
/sre prr --service orders-api --reviewer @sre-lead # PRR de serviço existente
|
|
71
|
+
/sre risk-budget checkout_success --explain # budget + sabedoria 99.99% inline
|
|
72
|
+
/sre help # exibe tabela de subcomandos
|
|
73
|
+
```
|
|
74
|
+
</context>
|
|
75
|
+
|
|
76
|
+
<process>
|
|
77
|
+
|
|
78
|
+
## 1. Parsear subcomando
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
SUBCMD=$(echo "$ARGUMENTS" | awk '{print $1}')
|
|
82
|
+
ARGS=$(echo "$ARGUMENTS" | cut -d' ' -f2-)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Se `$ARGUMENTS` for vazio ou `SUBCMD` for `help`/`ajuda`/`?`:** exibir tabela de subcomandos inline + exemplo de uso. Sair.
|
|
86
|
+
|
|
87
|
+
## 2. Resolver sinônimos para agent canônico
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
golden-signals, signals, 4signals, golden → golden-signals-instrumenter
|
|
91
|
+
auditar-toil, audit-toil, toil, auditar → toil-auditor
|
|
92
|
+
postmortem, pm, post-mortem → postmortem-writer
|
|
93
|
+
prr, production-readiness, readiness-review → prr-conductor
|
|
94
|
+
risk-budget, budget, risk, continuum → (comando direto — /risk-budget)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Se subcomando não resolve:** exibir erro inline com lista de subcomandos válidos. Sair.
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
✗ Subcomando desconhecido: '<SUBCMD>'
|
|
101
|
+
|
|
102
|
+
Subcomandos válidos:
|
|
103
|
+
golden-signals → instrumentar 4 signals OTel (Latency/Traffic/Errors/Saturation)
|
|
104
|
+
auditar-toil → audit toil priorizado P0/P1/P2 + esforço de automação
|
|
105
|
+
postmortem → postmortem blameless 9 seções (--from-investigation OU --incident)
|
|
106
|
+
prr → Production Readiness Review 6 axes (--service OU --feature)
|
|
107
|
+
risk-budget → error budget vs risk continuum + sabedoria 99.99%
|
|
108
|
+
|
|
109
|
+
Uso: /sre <subcomando> <args...>
|
|
110
|
+
Exemplo: /sre prr --service orders-api
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## 3. Detectar `supabase/config.toml` (passar `project_id` para agents que usam MCP)
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
PROJECT_ID=""
|
|
117
|
+
if [ -f supabase/config.toml ]; then
|
|
118
|
+
PROJECT_ID=$(grep -E '^project_id\s*=' supabase/config.toml | sed 's/.*= *"\(.*\)".*/\1/' | head -1)
|
|
119
|
+
fi
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Apenas `prr-conductor` usa `mcp__supabase__*` — outros 3 agents não precisam de `project_id` (instrumentação/audit/postmortem são filesystem only).
|
|
123
|
+
|
|
124
|
+
## 4. Dispatch — caminhos por subcomando
|
|
125
|
+
|
|
126
|
+
### 4a. `golden-signals` → `golden-signals-instrumenter`
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
Task(
|
|
130
|
+
subagent_type="golden-signals-instrumenter",
|
|
131
|
+
prompt="
|
|
132
|
+
${ARGS}
|
|
133
|
+
|
|
134
|
+
Aplicar skill four-golden-signals. Gerar patches OTel para os 4 signals (Latency: histogram bucketed; Traffic: counter; Errors: counter por error.type; Saturation: gauge resource-specific).
|
|
135
|
+
"
|
|
136
|
+
)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 4b. `auditar-toil` → `toil-auditor`
|
|
140
|
+
|
|
141
|
+
```text
|
|
142
|
+
Task(
|
|
143
|
+
subagent_type="toil-auditor",
|
|
144
|
+
prompt="
|
|
145
|
+
project_root: .
|
|
146
|
+
output_path: .planning/TOIL-AUDIT.md
|
|
147
|
+
${ARGS}
|
|
148
|
+
|
|
149
|
+
Aplicar skill eliminating-toil. Scan git log + scripts + runbooks; aplicar 6 critérios canônicos; priorizar P0/P1/P2; estimar esforço de automação L0-L4.
|
|
150
|
+
"
|
|
151
|
+
)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 4c. `postmortem` → `postmortem-writer`
|
|
155
|
+
|
|
156
|
+
Validar mutuamente exclusivos (`--from-investigation` E `--incident` ambos = ERROR; nenhum = AskUserQuestion sugerido).
|
|
157
|
+
|
|
158
|
+
```text
|
|
159
|
+
Task(
|
|
160
|
+
subagent_type="postmortem-writer",
|
|
161
|
+
prompt="
|
|
162
|
+
${ARGS}
|
|
163
|
+
|
|
164
|
+
Aplicar skill blameless-postmortems. Modo conforme flag (--from-investigation lê investigation v1.9; --incident standalone com 9 perguntas guiadas). 9 seções obrigatórias: Summary, Impact, Root Causes, Trigger, Resolution, Detection, Action Items, Lessons Learned, Timeline UTC. Foco em sistema/processo (NUNCA pessoas).
|
|
165
|
+
"
|
|
166
|
+
)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 4d. `prr` → `prr-conductor`
|
|
170
|
+
|
|
171
|
+
Validar mutuamente exclusivos (`--service` E `--feature` ambos = ERROR; nenhum = ERROR com sugestão). Se `--reviewer` ausente: AskUserQuestion (anti-pattern auto-PRR).
|
|
172
|
+
|
|
173
|
+
```text
|
|
174
|
+
Task(
|
|
175
|
+
subagent_type="prr-conductor",
|
|
176
|
+
prompt="
|
|
177
|
+
${ARGS}
|
|
178
|
+
${PROJECT_ID:+project_id: ${PROJECT_ID}}
|
|
179
|
+
|
|
180
|
+
Aplicar skill production-readiness-review. Audit em 6 axes (System Architecture, Instrumentation, Emergency Response, Capacity Planning, Change Management, Performance) — todos obrigatórios. Engagement model conforme outage cost. Modo offline fallback graceful.
|
|
181
|
+
"
|
|
182
|
+
)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### 4e. `risk-budget` → comando direto `/risk-budget`
|
|
186
|
+
|
|
187
|
+
Caso especial — não há agent. Re-encaminhar via shell ou aplicar skill `sre-risk-management` direto.
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# PT-BR: invocar comando /risk-budget passando args
|
|
191
|
+
# Em Claude Code, isso é equivalente a executar o comando file diretamente
|
|
192
|
+
# (orquestrador apenas valida sinônimo e delega)
|
|
193
|
+
/risk-budget ${ARGS}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Alternativa inline (se não há shell call): orquestrador lê `.planning/slos/*.md`, mapeia para tabela continuum (skill `sre-risk-management` Pattern 1), exibe tabela com status (OPTIMAL/OVER-SPEC/UNDER-SPEC/BUDGET-EXHAUSTED).
|
|
197
|
+
|
|
198
|
+
## 5. Output
|
|
199
|
+
|
|
200
|
+
Output do agent (ou do comando direto risk-budget) é o output do orquestrador. Sem post-processing — agent já formata estruturado.
|
|
201
|
+
|
|
202
|
+
## 6. Sugestões de chains comuns (pós-output)
|
|
203
|
+
|
|
204
|
+
Após dispatch, orquestrador pode sugerir chains comuns:
|
|
205
|
+
|
|
206
|
+
| Subcomando rodado | Chain natural |
|
|
207
|
+
|---|---|
|
|
208
|
+
| `golden-signals` | `/sre prr --service <same>` (validar production-readiness) |
|
|
209
|
+
| `auditar-toil` | `/observabilidade omm` (alimentar OMM Capacidade 3) |
|
|
210
|
+
| `postmortem` | `/sre prr --service <affected>` OR `/observabilidade omm` (Capacidade 5 Incident Response) |
|
|
211
|
+
| `prr` | (se Approved) deploy; (se Blocked) fechar P0s e re-PRR |
|
|
212
|
+
| `risk-budget` | `/burn-rate-status` (live forecast) OR `/sre postmortem --incident "..."` se BUDGET-EXHAUSTED |
|
|
213
|
+
|
|
214
|
+
</process>
|
|
215
|
+
|
|
216
|
+
<success_criteria>
|
|
217
|
+
- [ ] Subcomando resolvido para agent canônico (5 subcomandos × seus sinônimos)
|
|
218
|
+
- [ ] `project_id` extraído de `supabase/config.toml` se presente (apenas relevante para `prr`)
|
|
219
|
+
- [ ] Dispatch via `Task(subagent_type=...)` — único ponto de chain (anti-pitfall A10)
|
|
220
|
+
- [ ] Subcomando `risk-budget` delega para comando direto `/risk-budget` (não usa Task)
|
|
221
|
+
- [ ] Subcomando `postmortem` valida `--from-investigation` E `--incident` mutuamente exclusivos antes de dispatch
|
|
222
|
+
- [ ] Subcomando `prr` valida `--service` E `--feature` mutuamente exclusivos + AskUserQuestion para reviewer (anti auto-PRR)
|
|
223
|
+
- [ ] Subcomando inválido → mensagem clara com lista de 5 subcomandos válidos
|
|
224
|
+
- [ ] Subcomando `help`/`ajuda`/`?` → exibe tabela inline com 6 linhas (5 + help)
|
|
225
|
+
- [ ] Args após subcomando passam transparentemente para o agent
|
|
226
|
+
- [ ] Sugestões de chains comuns na tabela final (5 chains documentadas)
|
|
227
|
+
</success_criteria>
|