up-cc 0.1.3 → 0.1.4
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/commands/depurar.md +163 -0
- package/package.json +1 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: up:depurar
|
|
3
|
+
description: Depuracao sistematica com estado persistente entre resets de contexto
|
|
4
|
+
argument-hint: [descricao do problema]
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Bash
|
|
8
|
+
- Task
|
|
9
|
+
- AskUserQuestion
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<objective>
|
|
13
|
+
Depurar problemas usando metodo cientifico com isolamento em subagente.
|
|
14
|
+
|
|
15
|
+
**Papel do orquestrador:** Coletar sintomas, spawnar agente up-depurador, lidar com checkpoints, spawnar continuacoes.
|
|
16
|
+
|
|
17
|
+
**Por que subagente:** Investigacao consome contexto rapidamente (lendo arquivos, formando hipoteses, testando). Contexto fresco de 200k por investigacao. Contexto principal permanece enxuto para interacao com usuario.
|
|
18
|
+
</objective>
|
|
19
|
+
|
|
20
|
+
<context>
|
|
21
|
+
Problema do usuario: $ARGUMENTS
|
|
22
|
+
|
|
23
|
+
Verificar sessoes ativas:
|
|
24
|
+
```bash
|
|
25
|
+
ls .plano/debug/*.md 2>/dev/null | grep -v resolved | head -5
|
|
26
|
+
```
|
|
27
|
+
</context>
|
|
28
|
+
|
|
29
|
+
<process>
|
|
30
|
+
|
|
31
|
+
## 0. Inicializar Contexto
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
INIT=$(node "$HOME/.claude/up/bin/up-tools.cjs" state load)
|
|
35
|
+
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Extrair `commit_docs` do JSON de init.
|
|
39
|
+
|
|
40
|
+
## 1. Verificar Sessoes Ativas
|
|
41
|
+
|
|
42
|
+
Se sessoes ativas existem E sem $ARGUMENTS:
|
|
43
|
+
- Listar sessoes com status, hipotese, proxima acao
|
|
44
|
+
- Usuario escolhe numero para retomar OU descreve novo problema
|
|
45
|
+
|
|
46
|
+
Se $ARGUMENTS fornecido OU usuario descreve novo problema:
|
|
47
|
+
- Continuar para coleta de sintomas
|
|
48
|
+
|
|
49
|
+
## 2. Coletar Sintomas (se novo problema)
|
|
50
|
+
|
|
51
|
+
Usar AskUserQuestion para cada:
|
|
52
|
+
|
|
53
|
+
1. **Comportamento esperado** - O que deveria acontecer?
|
|
54
|
+
2. **Comportamento real** - O que acontece de fato?
|
|
55
|
+
3. **Mensagens de erro** - Algum erro? (colar ou descrever)
|
|
56
|
+
4. **Timeline** - Quando comecou? Ja funcionou antes?
|
|
57
|
+
5. **Reproducao** - Como reproduzir?
|
|
58
|
+
|
|
59
|
+
Apos coletar tudo, confirmar pronto para investigar.
|
|
60
|
+
|
|
61
|
+
## 3. Spawnar Agente up-depurador
|
|
62
|
+
|
|
63
|
+
Preencher prompt e spawnar:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
<objective>
|
|
67
|
+
Investigar problema: {slug}
|
|
68
|
+
|
|
69
|
+
**Resumo:** {trigger}
|
|
70
|
+
</objective>
|
|
71
|
+
|
|
72
|
+
<symptoms>
|
|
73
|
+
expected: {expected}
|
|
74
|
+
actual: {actual}
|
|
75
|
+
errors: {errors}
|
|
76
|
+
reproduction: {reproduction}
|
|
77
|
+
timeline: {timeline}
|
|
78
|
+
</symptoms>
|
|
79
|
+
|
|
80
|
+
<mode>
|
|
81
|
+
symptoms_prefilled: true
|
|
82
|
+
goal: find_and_fix
|
|
83
|
+
</mode>
|
|
84
|
+
|
|
85
|
+
<debug_file>
|
|
86
|
+
Criar: .plano/debug/{slug}.md
|
|
87
|
+
</debug_file>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Agent(
|
|
92
|
+
prompt=filled_prompt,
|
|
93
|
+
subagent_type="up-depurador",
|
|
94
|
+
description="Depurar {slug}"
|
|
95
|
+
)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## 4. Lidar com Retorno do Agente
|
|
99
|
+
|
|
100
|
+
**Se `## ROOT CAUSE FOUND`:**
|
|
101
|
+
- Exibir causa raiz e resumo de evidencias
|
|
102
|
+
- Oferecer opcoes:
|
|
103
|
+
- "Corrigir agora" - spawnar subagente de correcao
|
|
104
|
+
- "Planejar correcao" - sugerir /up:planejar-fase
|
|
105
|
+
- "Correcao manual" - encerrar
|
|
106
|
+
|
|
107
|
+
**Se `## CHECKPOINT REACHED`:**
|
|
108
|
+
- Apresentar detalhes do checkpoint ao usuario
|
|
109
|
+
- Obter resposta do usuario
|
|
110
|
+
- Se tipo `human-verify`:
|
|
111
|
+
- Se usuario confirma corrigido: continuar para agente finalizar/resolver/arquivar
|
|
112
|
+
- Se usuario reporta problemas: continuar para agente retomar investigacao/correcao
|
|
113
|
+
- Spawnar agente de continuacao (ver passo 5)
|
|
114
|
+
|
|
115
|
+
**Se `## INVESTIGATION INCONCLUSIVE`:**
|
|
116
|
+
- Mostrar o que foi verificado e eliminado
|
|
117
|
+
- Oferecer opcoes:
|
|
118
|
+
- "Continuar investigando" - spawnar novo agente com contexto adicional
|
|
119
|
+
- "Investigacao manual" - encerrar
|
|
120
|
+
- "Adicionar mais contexto" - coletar mais sintomas, spawnar novamente
|
|
121
|
+
|
|
122
|
+
## 5. Spawnar Agente de Continuacao (Apos Checkpoint)
|
|
123
|
+
|
|
124
|
+
Quando usuario responde ao checkpoint, spawnar agente fresco:
|
|
125
|
+
|
|
126
|
+
```markdown
|
|
127
|
+
<objective>
|
|
128
|
+
Continuar depuracao {slug}. Evidencias estao no arquivo de debug.
|
|
129
|
+
</objective>
|
|
130
|
+
|
|
131
|
+
<prior_state>
|
|
132
|
+
<files_to_read>
|
|
133
|
+
- .plano/debug/{slug}.md (Estado da sessao de debug)
|
|
134
|
+
</files_to_read>
|
|
135
|
+
</prior_state>
|
|
136
|
+
|
|
137
|
+
<checkpoint_response>
|
|
138
|
+
**Type:** {checkpoint_type}
|
|
139
|
+
**Response:** {user_response}
|
|
140
|
+
</checkpoint_response>
|
|
141
|
+
|
|
142
|
+
<mode>
|
|
143
|
+
goal: find_and_fix
|
|
144
|
+
</mode>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
Agent(
|
|
149
|
+
prompt=continuation_prompt,
|
|
150
|
+
subagent_type="up-depurador",
|
|
151
|
+
description="Continuar depuracao {slug}"
|
|
152
|
+
)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
</process>
|
|
156
|
+
|
|
157
|
+
<success_criteria>
|
|
158
|
+
- [ ] Sessoes ativas verificadas
|
|
159
|
+
- [ ] Sintomas coletados (se novo)
|
|
160
|
+
- [ ] up-depurador spawnado com contexto
|
|
161
|
+
- [ ] Checkpoints tratados corretamente
|
|
162
|
+
- [ ] Causa raiz confirmada antes de corrigir
|
|
163
|
+
</success_criteria>
|