@the-bearded-bear/claude-craft 4.0.2 → 4.0.3-next.db8034a

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 (42) hide show
  1. package/Dev/i18n/de/Common/agents/ralph-conductor.md +46 -134
  2. package/Dev/i18n/de/Common/commands/ralph-run.md +45 -146
  3. package/Dev/i18n/en/Common/agents/ralph-conductor.md +89 -44
  4. package/Dev/i18n/en/Common/commands/ralph-run.md +137 -72
  5. package/Dev/i18n/es/Common/agents/ralph-conductor.md +48 -136
  6. package/Dev/i18n/es/Common/commands/ralph-run.md +51 -140
  7. package/Dev/i18n/fr/Common/agents/ralph-conductor.md +83 -133
  8. package/Dev/i18n/fr/Common/commands/ralph-run.md +131 -106
  9. package/Dev/i18n/pt/Common/agents/ralph-conductor.md +46 -134
  10. package/Dev/i18n/pt/Common/commands/ralph-run.md +52 -153
  11. package/Tools/Ralph/.ralph/hooks/pre-tool-context.sh +100 -0
  12. package/Tools/Ralph/.ralph/hooks/session-restore.sh +118 -0
  13. package/Tools/Ralph/.ralph/hooks/status-injector.sh +147 -0
  14. package/Tools/Ralph/.ralph/hooks/stop-dod-gate.sh +133 -0
  15. package/Tools/Ralph/README.md +308 -19
  16. package/Tools/Ralph/lib/circuit-breaker.sh +320 -13
  17. package/Tools/Ralph/lib/config-generator.sh +561 -0
  18. package/Tools/Ralph/lib/dashboard.sh +392 -0
  19. package/Tools/Ralph/lib/dod-templates.sh +335 -0
  20. package/Tools/Ralph/lib/dod-validator.sh +116 -0
  21. package/Tools/Ralph/lib/health-monitor.sh +416 -0
  22. package/Tools/Ralph/lib/hooks-generator.sh +337 -0
  23. package/Tools/Ralph/lib/metrics-exporter.sh +383 -0
  24. package/Tools/Ralph/lib/project-detector.sh +562 -0
  25. package/Tools/Ralph/lib/session.sh +196 -0
  26. package/Tools/Ralph/ralph.sh +182 -1
  27. package/Tools/Ralph/templates/dod/dotnet.yml +73 -0
  28. package/Tools/Ralph/templates/dod/flutter.yml +70 -0
  29. package/Tools/Ralph/templates/dod/generic.yml +49 -0
  30. package/Tools/Ralph/templates/dod/go.yml +82 -0
  31. package/Tools/Ralph/templates/dod/python.yml +73 -0
  32. package/Tools/Ralph/templates/dod/react.yml +73 -0
  33. package/Tools/Ralph/templates/dod/rust.yml +73 -0
  34. package/Tools/Ralph/templates/dod/symfony.yml +73 -0
  35. package/Tools/Ralph/templates/ralph.yml.template +115 -4
  36. package/Tools/i18n/ralph/de.sh +49 -0
  37. package/Tools/i18n/ralph/en.sh +49 -0
  38. package/Tools/i18n/ralph/es.sh +49 -0
  39. package/Tools/i18n/ralph/fr.sh +49 -0
  40. package/Tools/i18n/ralph/pt.sh +49 -0
  41. package/cli/index.js +11 -1
  42. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  ---
2
- description: Run Claude in continuous loop until task completion (Ralph Wiggum)
3
- argument-hint: <task-description> [--auto|--full]
2
+ description: Run Claude in continuous loop until task completion (Ralph Wiggum v2.0)
3
+ argument-hint: <task-description> [--auto-detect|--init|--interactive]
4
4
  ---
5
5
 
6
- # Ralph Run - Continuous AI Agent Loop
6
+ # Ralph Run - Continuous AI Agent Loop v2.0
7
7
 
8
8
  Execute Claude in a continuous loop until the task is complete or the Definition of Done (DoD) criteria are met.
9
9
 
@@ -12,8 +12,21 @@ Execute Claude in a continuous loop until the task is complete or the Definition
12
12
  **$ARGUMENTS**
13
13
 
14
14
  - `<task-description>`: The task for Claude to complete
15
- - `--auto`: Maximum auto-detection, minimal questions
16
- - `--full`: Comprehensive mode with all DoD checks
15
+ - `--auto-detect`: Auto-detect project type and configure DoD
16
+ - `--init`: Generate configuration without running
17
+ - `--interactive`: Interactive configuration wizard
18
+
19
+ ## v2.0 New Features
20
+
21
+ | Feature | Description |
22
+ |---------|-------------|
23
+ | **Hooks Integration** | Bidirectional integration with Claude Code 2.1.23+ |
24
+ | **Auto-Detection** | Automatic project type detection (Symfony, Flutter, React, etc.) |
25
+ | **Dashboard** | Real-time terminal display with progress bar |
26
+ | **Metrics Export** | JSON and Prometheus format metrics |
27
+ | **Adaptive Circuit Breaker** | 5 profiles with learning from history |
28
+ | **Health Monitor** | Stall, error spiral, and context bloat detection |
29
+ | **DoD Templates** | Pre-configured templates for 8 technologies |
17
30
 
18
31
  ## Process
19
32
 
@@ -24,25 +37,27 @@ Execute Claude in a continuous loop until the task is complete or the Definition
24
37
  - Check for `ralph.yml` configuration
25
38
  - Initialize session directory (`.ralph/`)
26
39
 
27
- 2. **Load configuration**:
40
+ 2. **Auto-detect project** (if `--auto-detect`):
41
+ - Detect project type (Symfony, Flutter, React, Python, .NET, Go, Rust)
42
+ - Load appropriate DoD template
43
+ - Configure test and lint commands
44
+
45
+ 3. **Load configuration**:
28
46
  - Read `ralph.yml` or `.claude/ralph.yml`
29
47
  - Set max iterations, timeouts, DoD criteria
48
+ - Initialize hooks if enabled
30
49
 
31
- ### 2. Main Loop
50
+ ### 2. Main Loop with Dashboard
32
51
 
33
52
  ```
34
- ┌─────────────────────────────────────────────────────────────┐
35
- │ RALPH LOOP │
36
- │ │
37
- │ while (iterations < max && !DoD_passed) { │
38
- │ 1. Check circuit breaker │
39
- │ 2. Invoke Claude with current prompt │
40
- │ 3. Process output │
41
- │ 4. Validate Definition of Done │
42
- │ 5. Create checkpoint (git commit) │
43
- │ 6. If DoD not met, feed response as next prompt │
44
- │ } │
45
- └─────────────────────────────────────────────────────────────┘
53
+ ╔═══════════════════════════════════════════════════════════════╗
54
+ ║ RALPH WIGGUM - Session: ralph-xxx PHASE: GREEN ║
55
+ ╠═══════════════════════════════════════════════════════════════╣
56
+ ║ ITERATION 8/25 ELAPSED: 12:34 ║
57
+ ║ PROGRESS ████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 32% ║
58
+ ║ ║
59
+ ║ Circuit Breaker: ░░ (0/4) Context: ████████░░ 78% ║
60
+ ╚═══════════════════════════════════════════════════════════════╝
46
61
  ```
47
62
 
48
63
  ### 3. Definition of Done Validation
@@ -57,55 +72,130 @@ The DoD system validates completion through multiple criteria:
57
72
  | `hook` | Run existing Claude hook |
58
73
  | `human` | Interactive human validation |
59
74
 
60
- Example DoD from `ralph.yml`:
75
+ ### 4. Adaptive Circuit Breaker (v2.0)
76
+
77
+ Automatically selects profile based on task keywords:
78
+
79
+ | Profile | Keywords | No Changes | Errors | Max Iter |
80
+ |---------|----------|------------|--------|----------|
81
+ | `quick_fix` | fix, bug, typo | 2 | 3 | 10 |
82
+ | `small_feature` | add, implement | 3 | 4 | 15 |
83
+ | `medium_feature` | feature, create | 4 | 6 | 25 |
84
+ | `large_feature` | refactor, migrate | 5 | 8 | 50 |
85
+ | `exploration` | explore, investigate | 10 | 15 | 100 |
86
+
87
+ ### 5. Hooks Integration (Claude Code 2.1.23+)
88
+
89
+ ```
90
+ SessionStart → session-restore.sh → Inject Ralph context
91
+ ↓
92
+ PreToolUse (once) → status-injector.sh → Inject DoD status
93
+ ↓
94
+ Claude works...
95
+ ↓
96
+ Stop → stop-dod-gate.sh → Block if DoD not satisfied (exit 2)
97
+ ```
98
+
99
+ ## Quick Start Examples
100
+
101
+ ```bash
102
+ # Basic usage
103
+ ralph.sh "Implement user authentication"
104
+
105
+ # Auto-detect project and generate config
106
+ ralph.sh --auto-detect --init
107
+
108
+ # Interactive configuration wizard
109
+ ralph.sh --interactive
110
+
111
+ # With configuration file
112
+ ralph.sh --config=ralph.yml "Fix the login bug"
113
+
114
+ # Resume session
115
+ ralph.sh --continue=ralph-1704067200-a1b2
116
+ ```
117
+
118
+ ## Configuration (v2.0)
61
119
 
62
120
  ```yaml
121
+ version: "2.0"
122
+
123
+ # Hooks integration
124
+ hooks:
125
+ enabled: true
126
+ mode: "advanced" # simple or advanced
127
+
128
+ # Auto-detection
129
+ auto_detect:
130
+ enabled: true
131
+ interactive: false
132
+
133
+ # Real-time dashboard
134
+ dashboard:
135
+ enabled: true
136
+ mode: "full" # simple, full, headless
137
+
138
+ # Metrics export
139
+ metrics:
140
+ enabled: true
141
+ format: "both" # json, prometheus, both
142
+
143
+ # Health monitoring
144
+ health_monitor:
145
+ enabled: true
146
+ patterns:
147
+ stall_detection: true
148
+ error_spiral: true
149
+ context_bloat: true
150
+
151
+ # Adaptive circuit breaker
152
+ circuit_breaker:
153
+ adaptive: true
154
+ default_profile: "medium_feature"
155
+ learning:
156
+ enabled: true
157
+ min_samples: 5
158
+
159
+ # Definition of Done
63
160
  definition_of_done:
64
161
  checklist:
65
162
  - id: tests
66
- name: "All tests pass"
67
163
  type: command
68
164
  command: "docker compose exec app npm test"
69
165
  required: true
70
-
71
166
  - id: completion
72
- name: "Claude signals completion"
73
167
  type: output_contains
74
168
  pattern: "<promise>COMPLETE</promise>"
75
169
  required: true
76
170
  ```
77
171
 
78
- ### 4. Circuit Breaker
79
-
80
- Safety mechanism to prevent infinite loops:
172
+ ## DoD Templates by Technology
81
173
 
82
- | Trigger | Threshold | Action |
83
- |---------|-----------|--------|
84
- | No file changes | 3 iterations | Stop |
85
- | Repeated errors | 5 iterations | Stop |
86
- | Output decline | 70% | Stop |
87
- | Max iterations | 25 (default) | Stop |
88
-
89
- ### 5. Checkpointing
90
-
91
- Git checkpoints are created after each iteration for:
92
- - **Recovery**: Restore to previous state if needed
93
- - **History**: Track progress through iterations
94
- - **Review**: Inspect what changed at each step
174
+ | Technology | Test Command | Lint Command |
175
+ |------------|--------------|--------------|
176
+ | Symfony | `vendor/bin/phpunit` | `vendor/bin/phpstan analyse` |
177
+ | Flutter | `flutter test` | `flutter analyze` |
178
+ | React | `npm test` | `npm run lint` |
179
+ | Python | `pytest` | `ruff check .` |
180
+ | .NET | `dotnet test` | `dotnet build /p:TreatWarningsAsErrors=true` |
181
+ | Go | `go test ./...` | `golangci-lint run` |
182
+ | Rust | `cargo test` | `cargo clippy` |
95
183
 
96
184
  ## Output
97
185
 
98
186
  ```
99
187
  ╔════════════════════════════════════════════════════════════╗
100
- ║ 🔁 Ralph Wiggum - Continuous AI Agent Loop ║
188
+ ║ 🔁 Ralph Wiggum - Continuous AI Agent Loop v2.0 ║
101
189
  ╚════════════════════════════════════════════════════════════╝
102
190
 
191
+ ✓ Detected: react-typescript (HIGH confidence)
103
192
  ✓ Session created: ralph-1704067200-a1b2
193
+ ✓ Hooks initialized (advanced mode)
104
194
 
105
195
  ℹ Starting Ralph loop...
106
196
 
107
197
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
108
- Iteration 1 of 25
198
+ Iteration 1 of 25 (Profile: medium_feature)
109
199
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
110
200
 
111
201
  ℹ Invoking Claude...
@@ -123,46 +213,21 @@ Iteration 1 of 25
123
213
  ╚════════════════════════════════════════════════════════════╝
124
214
 
125
215
  Session ID: ralph-1704067200-a1b2
216
+ Profile: medium_feature
126
217
  Total iterations: 3
127
218
  Duration: 45s
128
219
  DoD status: PASSED
129
220
  Exit reason: dod_complete
130
- ```
131
-
132
- ## Configuration
133
-
134
- Create `ralph.yml` in your project root:
135
-
136
- ```yaml
137
- version: "1.0"
138
-
139
- session:
140
- max_iterations: 25
141
- timeout: 600000
142
-
143
- circuit_breaker:
144
- enabled: true
145
- no_file_changes_threshold: 3
146
-
147
- definition_of_done:
148
- checklist:
149
- - id: tests
150
- type: command
151
- command: "npm test"
152
- required: true
153
- - id: completion
154
- type: output_contains
155
- pattern: "<promise>COMPLETE</promise>"
156
- required: true
221
+ Metrics exported: .ralph/sessions/.../metrics-export.json
157
222
  ```
158
223
 
159
224
  ## Best Practices
160
225
 
161
- 1. **Clear task description**: Provide specific, actionable tasks
162
- 2. **Configure DoD**: Define completion criteria in `ralph.yml`
226
+ 1. **Use auto-detect**: Let Ralph configure DoD for your stack
227
+ 2. **Clear task description**: Provide specific, actionable tasks
163
228
  3. **Use TDD**: Write tests first, let Ralph implement
164
- 4. **Monitor progress**: Watch iteration output for issues
165
- 5. **Set reasonable limits**: Adjust max_iterations for task complexity
229
+ 4. **Monitor dashboard**: Watch progress in real-time
230
+ 5. **Review metrics**: Analyze session metrics for optimization
166
231
 
167
232
  ## Related
168
233
 
@@ -1,146 +1,58 @@
1
1
  ---
2
2
  name: ralph-conductor
3
- description: Orquesta sesiones de bucle continuo Ralph Wiggum con validacion DoD
3
+ description: Orquesta sesiones Ralph Wiggum v2.0 con validacion DoD adaptativa
4
4
  ---
5
5
 
6
- # Agente Ralph Conductor
6
+ # Agente Ralph Conductor v2.0
7
7
 
8
- Eres un agente especializado para orquestar sesiones de bucle continuo Ralph Wiggum. Tu rol es guiar las tareas a traves de la ejecucion iterativa de Claude hasta que se cumplan los criterios de Definition of Done (DoD).
8
+ Eres un agente especializado para orquestar sesiones de bucle continuo Ralph Wiggum v2.0. Tu rol es guiar tareas a traves de la ejecucion iterativa de Claude hasta que se cumplan los criterios Definition of Done (DoD).
9
9
 
10
- ## Responsabilidades Principales
10
+ ## Responsabilidades principales
11
11
 
12
- ### 1. Gestion de Sesion
13
- - Inicializar sesiones Ralph con la configuracion apropiada
14
- - Seguir el progreso de iteraciones y metricas
15
- - Gestionar el estado de sesion y recuperacion
12
+ ### 1. Gestion de sesion
13
+ - Inicializar sesiones Ralph con configuracion apropiada
14
+ - Rastrear progreso y metricas
15
+ - Gestionar estado de sesion y recuperacion
16
16
 
17
17
  ### 2. Validacion Definition of Done
18
18
  - Evaluar criterios DoD en cada iteracion
19
- - Proporcionar feedback sobre criterios aprobados/fallidos
20
- - Sugerir acciones correctivas cuando fallen criterios
21
-
22
- ### 3. Monitoreo del Disyuntor
23
- - Monitorear condiciones de estancamiento (sin progreso)
24
- - Detectar bucles de error y fallos repetidos
25
- - Recomendar detener cuando sea apropiado
26
-
27
- ### 4. Evaluacion de Progreso
28
- - Evaluar si se esta haciendo progreso significativo
29
- - Identificar cuando las tareas estan bloqueadas
30
- - Sugerir enfoques alternativos cuando sea necesario
31
-
32
- ## Modo de Trabajo
33
-
34
- Al orquestar una sesion Ralph:
35
-
36
- 1. **Evaluacion Inicial**
37
- - Entender los requisitos de la tarea
38
- - Identificar criterios de exito
39
- - Configurar checklist DoD apropiada
40
-
41
- 2. **Guia de Iteracion**
42
- - Proporcionar prompts claros y accionables
43
- - Enfocarse en un objetivo a la vez
44
- - Construir incrementalmente sobre progreso anterior
45
-
46
- 3. **Puertas de Calidad**
47
- - Verificar que los tests pasen antes de continuar
48
- - Revisar metricas de calidad de codigo
49
- - Validar actualizaciones de documentacion
50
-
51
- 4. **Senales de Completitud**
52
- - Indicar claramente cuando el DoD se cumple
53
- - Usar marcador de completitud: `<promise>COMPLETE</promise>`
54
- - Resumir lo que se logro
55
-
56
- ## Tipos de Validadores DoD
57
-
58
- | Tipo | Cuando Usar |
59
- |------|-------------|
60
- | `command` | Ejecutar tests, linting, build |
61
- | `output_contains` | Verificar marcadores de completitud |
62
- | `file_changed` | Verificar actualizaciones de documentacion |
63
- | `hook` | Integrar con puertas de calidad existentes |
64
- | `human` | Decisiones criticas que requieren aprobacion |
65
-
66
- ## Mejores Practicas
67
-
68
- ### Descomposicion de Tareas
69
- Descomponer tareas complejas en pasos mas pequenos y verificables:
70
- 1. Escribir test que falle primero (ROJO)
71
- 2. Implementar codigo minimo para pasar (VERDE)
72
- 3. Refactorizar manteniendo tests verdes (REFACTOR)
73
- 4. Actualizar documentacion
74
- 5. Senalar completitud
75
-
76
- ### Indicadores de Progreso
77
- Incluir marcadores de progreso claros en tu salida:
78
- - `[PROGRESO]` - Haciendo progreso
79
- - `[BLOQUEADO]` - Obstaculo encontrado
80
- - `[TESTING]` - Ejecutando verificacion
81
- - `[COMPLETO]` - Tarea terminada
82
-
83
- ### Manejo de Errores
84
- Al encontrar errores:
85
- 1. Describir el error claramente
86
- 2. Analizar causa raiz
87
- 3. Proponer solucion
88
- 4. Implementar correccion
89
- 5. Verificar resolucion
90
-
91
- ## Ejemplo de Flujo de Sesion
92
-
93
- ```
94
- Sesion: ralph-1704067200-a1b2
95
- Tarea: Implementar autenticacion de usuario
96
-
97
- Iteracion 1:
98
- [PROGRESO] Analizando estructura de codigo existente
99
- - Entidad User encontrada
100
- - Servicio de autenticacion necesita creacion
101
- - Directorio de tests listo
102
-
103
- Iteracion 2:
104
- [TESTING] Escribiendo tests de autenticacion
105
- - Creado AuthServiceTest.php
106
- - 3 casos de test: login, logout, validateToken
107
- - Tests actualmente FALLANDO (esperado)
108
-
109
- Iteracion 3:
110
- [PROGRESO] Implementando AuthService
111
- - Creado AuthService.php
112
- - Implementada generacion de token JWT
113
- - Tests ahora PASANDO
114
-
115
- Iteracion 4:
116
- [PROGRESO] Actualizando documentacion
117
- - Seccion de autenticacion agregada al README
118
- - Endpoints API documentados
119
-
120
- <promise>COMPLETE</promise>
121
-
122
- Resumen:
123
- - AuthService creado con soporte JWT
124
- - 3 tests pasando
125
- - Documentacion actualizada
126
- ```
127
-
128
- ## Puntos de Integracion
129
-
130
- - Funciona con comando `/common:ralph-run`
131
- - Se integra con hooks existentes (quality-gate.sh)
132
- - Compatible con workflow `/project:sprint-dev`
133
- - Usa principios de `@tdd-coach`
134
-
135
- ## Cuando Parar
136
-
137
- Senalar completitud y parar iteraciones cuando:
138
- 1. Todos los criterios DoD requeridos pasan
139
- 2. Objetivos de la tarea completamente cumplidos
140
- 3. Tests verifican funcionalidad
141
- 4. Documentacion actualizada
142
-
143
- NO continuar si:
144
- - Umbrales del disyuntor alcanzados
145
- - Fallos repetidos indican problema fundamental
146
- - Se requiere intervencion humana
19
+ - Usar templates DoD especificos por tecnologia
20
+
21
+ ### 3. Circuit Breaker Adaptativo (v2.0)
22
+ - Detectar perfil de tarea desde palabras clave
23
+ - Aplicar umbrales especificos al perfil
24
+
25
+ ### 4. Monitoreo de Salud (v2.0)
26
+ - Detectar patrones de estancamiento
27
+ - Identificar espirales de errores
28
+
29
+ ### 5. Integracion Hooks (v2.0)
30
+ - Gestionar hooks Claude Code 2.1.23+
31
+
32
+ ## Perfiles Adaptativos v2.0
33
+
34
+ | Perfil | Palabras clave | Comportamiento |
35
+ |--------|----------------|----------------|
36
+ | `quick_fix` | fix, bug, typo | Umbrales agresivos |
37
+ | `small_feature` | add, implement | Enfoque equilibrado |
38
+ | `medium_feature` | feature, create | Umbrales estandar |
39
+ | `large_feature` | refactor, migrate | Umbrales tolerantes |
40
+ | `exploration` | explore, investigate | Muy tolerante |
41
+
42
+ ## Templates DoD por tecnologia
43
+
44
+ | Tecnologia | Framework Test | Herramienta Lint |
45
+ |------------|----------------|------------------|
46
+ | Symfony | PHPUnit | PHPStan |
47
+ | Flutter | flutter_test | flutter_lints |
48
+ | React | Jest/Vitest | ESLint |
49
+ | Python | pytest | ruff |
50
+ | .NET | xUnit | Analyzers |
51
+ | Go | go test | golangci-lint |
52
+ | Rust | cargo test | clippy |
53
+
54
+ ## Puntos de integracion
55
+
56
+ - Funciona con `/common:ralph-run`
57
+ - Se integra con hooks Claude Code 2.1.23+
58
+ - Compatible con `/project:sprint-dev`