@luanpdd/kit-mcp 1.8.1 → 1.9.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 (41) hide show
  1. package/README.md +39 -1
  2. package/gates/obs-agents-mcp-supabase.md +86 -0
  3. package/gates/obs-skills-frontmatter.md +76 -0
  4. package/gates/omm-no-regression.md +83 -0
  5. package/gates/skill-must-include.md +21 -19
  6. package/kit/agents/burn-rate-forecaster.md +160 -0
  7. package/kit/agents/incident-investigator.md +245 -0
  8. package/kit/agents/observability-instrumenter.md +200 -0
  9. package/kit/agents/omm-auditor.md +199 -0
  10. package/kit/agents/slo-engineer.md +224 -0
  11. package/kit/agents/supabase-architect.md +13 -0
  12. package/kit/agents/supabase-auth-bootstrapper.md +17 -0
  13. package/kit/agents/supabase-edge-fn-writer.md +22 -0
  14. package/kit/agents/supabase-migration-writer.md +18 -0
  15. package/kit/agents/supabase-realtime-implementer.md +23 -0
  16. package/kit/agents/supabase-rls-writer.md +17 -0
  17. package/kit/agents/supabase-storage-implementer.md +18 -0
  18. package/kit/commands/auditar-marco.md +22 -1
  19. package/kit/commands/auditar-observabilidade.md +103 -0
  20. package/kit/commands/burn-rate-status.md +140 -0
  21. package/kit/commands/concluir-marco.md +19 -1
  22. package/kit/commands/definir-slo.md +108 -0
  23. package/kit/commands/discutir-fase.md +26 -0
  24. package/kit/commands/forense.md +20 -1
  25. package/kit/commands/instrumentar-fase.md +200 -0
  26. package/kit/commands/investigar-producao.md +162 -0
  27. package/kit/commands/observabilidade.md +116 -0
  28. package/kit/commands/planejar-fase.md +20 -0
  29. package/kit/commands/verificar-trabalho.md +26 -0
  30. package/kit/skills/_shared-observability/glossary.md +396 -0
  31. package/kit/skills/burn-rate-alerting/SKILL.md +258 -0
  32. package/kit/skills/core-analysis-loop/SKILL.md +352 -0
  33. package/kit/skills/distributed-tracing/SKILL.md +362 -0
  34. package/kit/skills/event-based-slos/SKILL.md +274 -0
  35. package/kit/skills/observability-driven-development/SKILL.md +315 -0
  36. package/kit/skills/observability-maturity-model/SKILL.md +222 -0
  37. package/kit/skills/opentelemetry-standard/SKILL.md +351 -0
  38. package/kit/skills/structured-events/SKILL.md +265 -0
  39. package/kit/skills/telemetry-pipelines/SKILL.md +259 -0
  40. package/kit/skills/telemetry-sampling/SKILL.md +256 -0
  41. package/package.json +1 -1
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: investigar-producao
3
+ description: Lança Core Analysis Loop guiado em incidente real — agente incident-investigator usa MCP Supabase, mantém estado em .planning/investigations/, retoma entre resets de contexto.
4
+ argument-hint: "<sintoma em texto livre> [--id <investigation_id>]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Grep
10
+ - Glob
11
+ - Task
12
+ - AskUserQuestion
13
+ ---
14
+
15
+ <objective>
16
+ Lança o agente [`incident-investigator`](../agents/incident-investigator.md) para aplicar o [Core Analysis Loop](../skills/core-analysis-loop/SKILL.md) sobre um incidente. Estado iterativo de hipóteses fica em `.planning/investigations/<id>.md` — permite retomar entre resets de contexto (precedente: `/depurar`).
17
+
18
+ **Cria/Atualiza:**
19
+ - `.planning/investigations/<investigation_id>.md` — trilha de hipóteses validadas/refutadas
20
+
21
+ **Após:** root cause documentado + action items + estado salvo para próxima sessão.
22
+ </objective>
23
+
24
+ <context>
25
+ **Argumentos:** `$ARGUMENTS` — texto livre do sintoma + flags opcionais.
26
+
27
+ **Flags:**
28
+ - `--id <investigation_id>` — retoma investigação existente (pula criação de novo arquivo)
29
+ - `--time-window <Nh|Nd>` — janela de busca (default: 1h)
30
+
31
+ **Exemplos:**
32
+ ```
33
+ /investigar-producao "checkout SLO burn rate = 8 às 14:32"
34
+ /investigar-producao --id incident-2026-05-06-1432-checkout-burn # retomar
35
+ /investigar-producao "tenant acme reportou erros 5xx" --time-window 6h
36
+ ```
37
+
38
+ **Pré-requisito (Full mode):** projeto Supabase configurado, `mcp__supabase__*` disponível.
39
+ </context>
40
+
41
+ <process>
42
+
43
+ ## 1. Parsear argumentos
44
+
45
+ ```bash
46
+ INV_ID=$(echo "$ARGUMENTS" | grep -oE -- '--id [^ ]+' | awk '{print $2}')
47
+ TIME_WINDOW=$(echo "$ARGUMENTS" | grep -oE -- '--time-window [^ ]+' | awk '{print $2}')
48
+ SYMPTOM=$(echo "$ARGUMENTS" | sed -E 's/--(id|time-window) [^ ]+//g' | xargs)
49
+
50
+ [ -z "$TIME_WINDOW" ] && TIME_WINDOW="1h"
51
+ ```
52
+
53
+ ## 2. Validar pré-requisitos
54
+
55
+ ```bash
56
+ mkdir -p .planning/investigations
57
+
58
+ # PT-BR: se --id fornecido, validar arquivo existe
59
+ if [ -n "$INV_ID" ]; then
60
+ INV_FILE=".planning/investigations/${INV_ID}.md"
61
+ if [ ! -f "$INV_FILE" ]; then
62
+ echo "Investigation $INV_ID não existe. Liste com: ls .planning/investigations/"
63
+ exit 1
64
+ fi
65
+ echo "Retomando investigação: $INV_ID"
66
+ fi
67
+
68
+ # PT-BR: se SYMPTOM vazio + sem --id → erro
69
+ if [ -z "$SYMPTOM" ] && [ -z "$INV_ID" ]; then
70
+ echo "Erro: forneça sintoma OU --id <investigation_id>"
71
+ echo "Exemplos:"
72
+ echo " /investigar-producao \"checkout SLO burn rate = 8\""
73
+ echo " /investigar-producao --id incident-2026-05-06-1432-foo"
74
+ exit 1
75
+ fi
76
+ ```
77
+
78
+ ## 3. Detectar `supabase/config.toml`
79
+
80
+ ```bash
81
+ PROJECT_ID=""
82
+ if [ -f supabase/config.toml ]; then
83
+ PROJECT_ID=$(grep -E '^project_id\s*=' supabase/config.toml | sed 's/.*= *"\(.*\)".*/\1/' | head -1)
84
+ fi
85
+ ```
86
+
87
+ ## 4. Listar investigações em aberto (UX)
88
+
89
+ Antes de lançar agente, mostrar contexto de investigações ativas:
90
+
91
+ ```bash
92
+ ls -t .planning/investigations/*.md 2>/dev/null | head -5 | while read f; do
93
+ ID=$(basename "$f" .md)
94
+ STARTED=$(grep '**Started:**' "$f" | head -1 | sed 's/.*Started:\*\* //')
95
+ STATUS=$(grep -E '^## (Root Cause|Status:)' "$f" | head -1)
96
+ printf " %s — %s — %s\n" "$ID" "$STARTED" "$STATUS"
97
+ done
98
+ ```
99
+
100
+ ## 5. Dispatch para `incident-investigator`
101
+
102
+ ```text
103
+ Task(
104
+ subagent_type="incident-investigator",
105
+ prompt="
106
+ ${SYMPTOM:-(retomando $INV_ID)}
107
+
108
+ ${INV_ID:+investigation_id: $INV_ID}
109
+ ${PROJECT_ID:+project_id: $PROJECT_ID}
110
+ time_window: ${TIME_WINDOW}
111
+
112
+ Aplicar Core Analysis Loop até root cause OU lacuna intransponível.
113
+ Salvar estado iterativo em .planning/investigations/{id}.md.
114
+ Documentar todas as hipóteses (validated/refuted/inconclusive) com query + resultado citado.
115
+ "
116
+ )
117
+ ```
118
+
119
+ ## 6. Após retorno do agente
120
+
121
+ Apresentar resumo curto + caminho do arquivo de estado:
122
+
123
+ ```
124
+ ═══════════════════════════════════════════════════════════
125
+ framework ► INVESTIGAR-PRODUCAO ▸ ${INV_ID}
126
+ ═══════════════════════════════════════════════════════════
127
+
128
+ [output do agente — ver agente incident-investigator Step 7]
129
+
130
+ ## Estado salvo
131
+ .planning/investigations/${INV_ID}.md
132
+
133
+ ## Próximos passos
134
+ - Action items listados no Root Cause acima
135
+ - Para abrir loop separado (ex.: "por que tenant acelerou?"):
136
+ /investigar-producao "<novo sintoma>"
137
+ - Para retomar mais tarde:
138
+ /investigar-producao --id ${INV_ID}
139
+ ```
140
+
141
+ ## 7. Pause AskUserQuestion (opcional)
142
+
143
+ Se agente reportou status `INCONCLUSIVE` ou `gaps_found`, perguntar via AskUserQuestion:
144
+
145
+ - header: "Próximo?"
146
+ - question: "Investigation incompleta. O que fazer?"
147
+ - options:
148
+ - "Continuar com hipótese específica" — pede texto livre da hipótese
149
+ - "Pausar — retomar depois" — sai mantendo state
150
+ - "Fechar como inconclusiva" — marca arquivo como `## Status: INCONCLUSIVE` e sai
151
+
152
+ </process>
153
+
154
+ <success_criteria>
155
+ - [ ] Sintoma + investigation_id (novo ou existente) parseados corretamente
156
+ - [ ] Arquivo `.planning/investigations/<id>.md` criado/atualizado
157
+ - [ ] `mcp__supabase__*` invocados em ≥ 1 hipótese (Full mode); ou modo offline declarado
158
+ - [ ] Cada hipótese documentada com Query + Resultado citado
159
+ - [ ] Root cause tem 4 dimensões (WHO/WHERE/WHEN/WHAT) OU status INCONCLUSIVE explícito
160
+ - [ ] Action items concretos listados
161
+ - [ ] Estado retomável: `/investigar-producao --id <id>` recarrega trilha
162
+ </success_criteria>
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: observabilidade
3
+ description: Orquestrador da Suíte Observabilidade — dispatch para agents (instrumenter, investigator, slo-engineer, burn-rate-forecaster, omm-auditor) 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 Observabilidade (v1.9). Recebe subcomando e args, faz dispatch via `Task(subagent_type=...)` para o agent especializado correto. **Único ponto de chain de agents observability** (precedente: `/supabase` em v1.8 — anti-pitfall A10 mantido).
17
+
18
+ **Cria/Atualiza:** o que cada agent invocado cria.
19
+
20
+ **Após:** o usuário tem o output do agent (patches, SLO.md, snapshot OMM, investigation trail, etc.).
21
+ </objective>
22
+
23
+ <execution_context>
24
+ Skills consultadas pelos agents: `kit/skills/_shared-observability/glossary.md` (Phase 29) + `kit/skills/observability-*/SKILL.md` + `kit/skills/structured-events/SKILL.md` + `kit/skills/distributed-tracing/SKILL.md` + `kit/skills/opentelemetry-standard/SKILL.md` + `kit/skills/core-analysis-loop/SKILL.md` + `kit/skills/event-based-slos/SKILL.md` + `kit/skills/burn-rate-alerting/SKILL.md` + `kit/skills/telemetry-sampling/SKILL.md` + `kit/skills/telemetry-pipelines/SKILL.md`.
25
+
26
+ Agents disponíveis: `kit/agents/observability-instrumenter.md` (Phase 30), `kit/agents/incident-investigator.md` (Phase 30), `kit/agents/slo-engineer.md` (Phase 32), `kit/agents/burn-rate-forecaster.md` (Phase 32), `kit/agents/omm-auditor.md` (Phase 34).
27
+ </execution_context>
28
+
29
+ <context>
30
+ **Argumentos:** `$ARGUMENTS` — primeiro token é o subcomando; restante é passado para o agent como prompt.
31
+
32
+ **Subcomandos suportados (sinônimos PT-BR/EN):**
33
+
34
+ | Subcomando | Sinônimos | Agent dispatched |
35
+ |---|---|---|
36
+ | `instrumentar` | `instrument`, `inst` | `observability-instrumenter` |
37
+ | `investigar` | `investigate`, `incident` | `incident-investigator` |
38
+ | `slo` | `definir-slo`, `slo-engineer` | `slo-engineer` |
39
+ | `burn-rate` | `burn`, `burn-rate-forecaster`, `forecast` | `burn-rate-forecaster` |
40
+ | `omm` | `auditar`, `audit`, `maturity` | `omm-auditor` |
41
+ | `help` | `ajuda`, `?` | exibe esta tabela inline |
42
+ </context>
43
+
44
+ <process>
45
+
46
+ ## 1. Parsear subcomando
47
+
48
+ ```bash
49
+ SUBCMD=$(echo "$ARGUMENTS" | awk '{print $1}')
50
+ ARGS=$(echo "$ARGUMENTS" | cut -d' ' -f2-)
51
+ ```
52
+
53
+ **Se `$ARGUMENTS` for vazio ou `SUBCMD` for `help`/`ajuda`/`?`:** exibir tabela de subcomandos inline + exemplo. Sair.
54
+
55
+ ## 2. Resolver sinônimos
56
+
57
+ ```text
58
+ instrumentar, instrument, inst → observability-instrumenter
59
+ investigar, investigate, incident → incident-investigator
60
+ slo, definir-slo, slo-engineer → slo-engineer
61
+ burn-rate, burn, burn-rate-forecaster, forecast → burn-rate-forecaster
62
+ omm, auditar, audit, maturity → omm-auditor
63
+ ```
64
+
65
+ **Se subcomando não resolve:** exibir erro inline com lista de subcomandos válidos. Sair.
66
+
67
+ ```
68
+ ✗ Subcomando desconhecido: '<SUBCMD>'
69
+
70
+ Subcomandos válidos:
71
+ instrumentar / instrument → instrumentar código com OTel + atributos canônicos
72
+ investigar / investigate → Core Analysis Loop em incident
73
+ slo / definir-slo → criar SLO.md + SQL materializar SLI
74
+ burn-rate / forecast → calcular burn rate atual + ETA exhaustão
75
+ omm / auditar → OMM scored 5 capacidades
76
+
77
+ Uso: /observabilidade <subcomando> <args...>
78
+ Exemplo: /observabilidade investigar "checkout SLO burn rate = 8 às 14:32"
79
+ ```
80
+
81
+ ## 3. Detectar `supabase/config.toml` (para agents que usam MCP Supabase)
82
+
83
+ ```bash
84
+ PROJECT_ID=""
85
+ if [ -f supabase/config.toml ]; then
86
+ PROJECT_ID=$(grep -E '^project_id\s*=' supabase/config.toml | sed 's/.*= *"\(.*\)".*/\1/' | head -1)
87
+ fi
88
+ ```
89
+
90
+ ## 4. Dispatch
91
+
92
+ Invocar `Task(subagent_type=<agent_name>, prompt=<built_prompt>)`.
93
+
94
+ **Prompt construído:**
95
+
96
+ ```
97
+ {ARGS}
98
+
99
+ {Se project_id detectado:}
100
+ project_id: {PROJECT_ID}
101
+ ```
102
+
103
+ ## 5. Output
104
+
105
+ Output do agent é o output do command. Sem post-processing — agent já formata estruturado.
106
+
107
+ </process>
108
+
109
+ <success_criteria>
110
+ - [ ] Subcomando resolvido para agent canônico (5 subcomandos × seus sinônimos)
111
+ - [ ] `project_id` extraído de `supabase/config.toml` se presente
112
+ - [ ] Dispatch via `Task(subagent_type=...)` — único ponto de chain
113
+ - [ ] Subcomando inválido → mensagem clara com lista
114
+ - [ ] Subcomando `help`/`ajuda`/`?` → exibe tabela inline
115
+ - [ ] Args após subcomando passam transparentemente para o agent
116
+ </success_criteria>
@@ -45,3 +45,23 @@ Normalizar entrada da fase no passo 2 antes de qualquer pesquisa de diretório.
45
45
  Execute o workflow plan-phase de @./.claude/framework/workflows/plan-phase.md do início ao fim.
46
46
  Preserve todos os checkpoints do workflow (validação, pesquisa, planejamento, loop de verificação, roteamento).
47
47
  </process>
48
+
49
+ <observability_integration>
50
+ **Integração com ODD plan-checker gate (v1.9):**
51
+
52
+ Quando `workflow.observability_plan_gate = true` (default para fases voltadas ao usuário), o `plan-checker` invocado neste workflow inclui uma checagem extra:
53
+
54
+ 1. Lê `<observability>` section do CONTEXT.md (criado por `/discutir-fase` ou `/instrumentar-fase`)
55
+ 2. Verifica que as 4 perguntas pré-PR estão respondidas (consulta skill [`observability-driven-development`](../skills/observability-driven-development/SKILL.md)):
56
+ - Faz o que esperei? → INSTRUMENTATION.md tem `result.success` documentado?
57
+ - Compara à versão anterior? → `build_id` em todo span planejado?
58
+ - Usuários estão usando? → identidade (`user.id`/`tenant_id`/`customer.tier`) presente?
59
+ - Anomalias emergem? → `error.type` enum + `branch_taken` planejados?
60
+ 3. Se alguma pergunta ausente: VERIFICATION.md status = `gaps_found`, sugerindo invocar `/instrumentar-fase` para gerar INSTRUMENTATION.md.
61
+
62
+ **Fases de infraestrutura pura** (skip discuss already detectou): pula gate silenciosamente.
63
+
64
+ **Quando há observability gate enabled e gap encontrado:** o user pode (a) `/instrumentar-fase` antes de prosseguir; ou (b) editar manualmente CONTEXT.md `<observability>` section; ou (c) override via `--skip-observability-gate`.
65
+
66
+ **REQ:** INT-FW-02.
67
+ </observability_integration>
@@ -36,3 +36,29 @@ Arquivos de contexto são resolvidos dentro do workflow (`init verify-work`) e d
36
36
  Execute o workflow verify-work de @./.claude/framework/workflows/verify-work.md do início ao fim.
37
37
  Preserve todos os gates do workflow (gerenciamento de sessão, apresentação de testes, diagnóstico, planejamento de correções, roteamento).
38
38
  </process>
39
+
40
+ <observability_integration>
41
+ **Integração com Core Analysis Loop em logs reais (v1.9):**
42
+
43
+ Quando `workflow.observability_uat_validation = true` (default) e o projeto tem MCP Supabase disponível, o workflow inclui passo de validação observacional após UAT conversacional:
44
+
45
+ 1. Para cada test passing no UAT, invocar o agente [`incident-investigator`](../agents/incident-investigator.md) em modo "validation":
46
+ ```
47
+ Task(subagent_type="incident-investigator", prompt="
48
+ mode: validation
49
+ symptom: validar que feature de Phase {N} efetivamente emitiu spans/eventos esperados
50
+ time_window: última 1h
51
+ expected_attributes: {result.success: true, build_id: {current_build}}
52
+ ")
53
+ ```
54
+ 2. O agente queryará via `mcp__supabase__get_logs` ou `mcp__supabase__execute_sql` para confirmar:
55
+ - Spans com nome esperado existem
56
+ - Atributos canônicos foram emitidos (não só código existe — comportamento real)
57
+ - `result.success` baseline está dentro do esperado
58
+ 3. Se confirmado: UAT.md inclui evidência observacional (não só "funciona em UI"). Status `passed` ✓.
59
+ 4. Se ausente: UAT.md flag `human_needed` com sugestão "verificar instrumentação não está pegando".
60
+
61
+ **Skill consultada:** [`core-analysis-loop`](../skills/core-analysis-loop/SKILL.md) — para o caso de UAT falhar e precisar investigar.
62
+
63
+ **REQ:** INT-FW-03.
64
+ </observability_integration>