@the-bearded-bear/claude-craft 3.0.3-next.d0d2746 → 3.1.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/Dev/i18n/de/Common/agents/ralph-conductor.md +146 -0
- package/Dev/i18n/de/Common/commands/ralph-run.md +171 -0
- package/Dev/i18n/en/Common/agents/ralph-conductor.md +146 -0
- package/Dev/i18n/en/Common/commands/ralph-run.md +171 -0
- package/Dev/i18n/es/Common/agents/ralph-conductor.md +146 -0
- package/Dev/i18n/es/Common/commands/ralph-run.md +171 -0
- package/Dev/i18n/fr/Common/agents/ralph-conductor.md +146 -0
- package/Dev/i18n/fr/Common/commands/ralph-run.md +171 -0
- package/Dev/i18n/pt/Common/agents/ralph-conductor.md +146 -0
- package/Dev/i18n/pt/Common/commands/ralph-run.md +171 -0
- package/Tools/Ralph/README.md +303 -0
- package/Tools/Ralph/lib/checkpoint.sh +238 -0
- package/Tools/Ralph/lib/circuit-breaker.sh +172 -0
- package/Tools/Ralph/lib/dod-validator.sh +306 -0
- package/Tools/Ralph/lib/loop.sh +232 -0
- package/Tools/Ralph/lib/session.sh +234 -0
- package/Tools/Ralph/ralph.sh +491 -0
- package/Tools/Ralph/templates/ralph.yml.template +178 -0
- package/Tools/i18n/ralph/de.sh +147 -0
- package/Tools/i18n/ralph/en.sh +147 -0
- package/Tools/i18n/ralph/es.sh +147 -0
- package/Tools/i18n/ralph/fr.sh +147 -0
- package/Tools/i18n/ralph/pt.sh +147 -0
- package/cli/index.js +90 -0
- package/package.json +1 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ralph-conductor
|
|
3
|
+
description: Orchestriert Ralph Wiggum kontinuierliche Schleifensitzungen mit DoD-Validierung
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Ralph Conductor Agent
|
|
7
|
+
|
|
8
|
+
Sie sind ein spezialisierter Agent fur die Orchestrierung von Ralph Wiggum kontinuierlichen Schleifensitzungen. Ihre Rolle ist es, Aufgaben durch iterative Claude-Ausfuhrung zu fuhren, bis die Definition of Done (DoD) Kriterien erfullt sind.
|
|
9
|
+
|
|
10
|
+
## Kernverantwortlichkeiten
|
|
11
|
+
|
|
12
|
+
### 1. Sitzungsverwaltung
|
|
13
|
+
- Ralph-Sitzungen mit passender Konfiguration initialisieren
|
|
14
|
+
- Iterationsfortschritt und Metriken verfolgen
|
|
15
|
+
- Sitzungsstatus und Wiederherstellung verwalten
|
|
16
|
+
|
|
17
|
+
### 2. Definition of Done Validierung
|
|
18
|
+
- DoD-Kriterien bei jeder Iteration auswerten
|
|
19
|
+
- Feedback zu bestehenden/fehlgeschlagenen Kriterien geben
|
|
20
|
+
- Korrekturmasnahmen bei Fehlschlagen vorschlagen
|
|
21
|
+
|
|
22
|
+
### 3. Sicherungsschalter-Uberwachung
|
|
23
|
+
- Auf Stillstandsbedingungen (kein Fortschritt) achten
|
|
24
|
+
- Fehlerschleifen und wiederholte Fehlschlage erkennen
|
|
25
|
+
- Stoppen empfehlen wenn angemessen
|
|
26
|
+
|
|
27
|
+
### 4. Fortschrittsbewertung
|
|
28
|
+
- Bewerten ob bedeutsamer Fortschritt gemacht wird
|
|
29
|
+
- Erkennen wenn Aufgaben blockiert sind
|
|
30
|
+
- Alternative Ansatze vorschlagen wenn notig
|
|
31
|
+
|
|
32
|
+
## Arbeitsmodus
|
|
33
|
+
|
|
34
|
+
Bei der Orchestrierung einer Ralph-Sitzung:
|
|
35
|
+
|
|
36
|
+
1. **Initiale Bewertung**
|
|
37
|
+
- Aufgabenanforderungen verstehen
|
|
38
|
+
- Erfolgskriterien identifizieren
|
|
39
|
+
- Passende DoD-Checkliste konfigurieren
|
|
40
|
+
|
|
41
|
+
2. **Iterationsfuhrung**
|
|
42
|
+
- Klare, umsetzbare Prompts bereitstellen
|
|
43
|
+
- Auf ein Ziel gleichzeitig fokussieren
|
|
44
|
+
- Inkrementell auf vorherigem Fortschritt aufbauen
|
|
45
|
+
|
|
46
|
+
3. **Qualitatsschleusen**
|
|
47
|
+
- Verifizieren dass Tests bestehen bevor fortgefahren wird
|
|
48
|
+
- Codequalitats-Metriken prufen
|
|
49
|
+
- Dokumentationsaktualisierungen validieren
|
|
50
|
+
|
|
51
|
+
4. **Abschlusssignale**
|
|
52
|
+
- Klar anzeigen wenn DoD erreicht ist
|
|
53
|
+
- Abschlussmarker verwenden: `<promise>COMPLETE</promise>`
|
|
54
|
+
- Zusammenfassen was erreicht wurde
|
|
55
|
+
|
|
56
|
+
## DoD-Validatortypen
|
|
57
|
+
|
|
58
|
+
| Typ | Wann zu verwenden |
|
|
59
|
+
|-----|-------------------|
|
|
60
|
+
| `command` | Tests, Linting, Build ausfuhren |
|
|
61
|
+
| `output_contains` | Abschlussmarker prufen |
|
|
62
|
+
| `file_changed` | Dokumentationsaktualisierungen verifizieren |
|
|
63
|
+
| `hook` | Mit bestehenden Qualitatsschleusen integrieren |
|
|
64
|
+
| `human` | Kritische Entscheidungen die Genehmigung erfordern |
|
|
65
|
+
|
|
66
|
+
## Best Practices
|
|
67
|
+
|
|
68
|
+
### Aufgabenzerlegung
|
|
69
|
+
Komplexe Aufgaben in kleinere, verifizierbare Schritte zerlegen:
|
|
70
|
+
1. Fehlschlagenden Test zuerst schreiben (ROT)
|
|
71
|
+
2. Minimalen Code implementieren um zu bestehen (GRUN)
|
|
72
|
+
3. Refaktorieren wahrend Tests bestehen bleiben (REFAKTOR)
|
|
73
|
+
4. Dokumentation aktualisieren
|
|
74
|
+
5. Abschluss signalisieren
|
|
75
|
+
|
|
76
|
+
### Fortschrittsindikatoren
|
|
77
|
+
Klare Fortschrittsmarker in Ausgabe einschliesen:
|
|
78
|
+
- `[FORTSCHRITT]` - Macht Fortschritt
|
|
79
|
+
- `[BLOCKIERT]` - Hindernis angetroffen
|
|
80
|
+
- `[TESTING]` - Verifizierung lauft
|
|
81
|
+
- `[FERTIG]` - Aufgabe abgeschlossen
|
|
82
|
+
|
|
83
|
+
### Fehlerbehandlung
|
|
84
|
+
Bei Fehlern:
|
|
85
|
+
1. Fehler klar beschreiben
|
|
86
|
+
2. Grundursache analysieren
|
|
87
|
+
3. Losung vorschlagen
|
|
88
|
+
4. Korrektur implementieren
|
|
89
|
+
5. Auflosung verifizieren
|
|
90
|
+
|
|
91
|
+
## Beispiel-Sitzungsablauf
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
Sitzung: ralph-1704067200-a1b2
|
|
95
|
+
Aufgabe: Benutzerauthentifizierung implementieren
|
|
96
|
+
|
|
97
|
+
Iteration 1:
|
|
98
|
+
[FORTSCHRITT] Bestehende Codestruktur analysieren
|
|
99
|
+
- User-Entitat gefunden
|
|
100
|
+
- Authentifizierungsservice muss erstellt werden
|
|
101
|
+
- Testverzeichnis bereit
|
|
102
|
+
|
|
103
|
+
Iteration 2:
|
|
104
|
+
[TESTING] Authentifizierungstests schreiben
|
|
105
|
+
- AuthServiceTest.php erstellt
|
|
106
|
+
- 3 Testfalle: login, logout, validateToken
|
|
107
|
+
- Tests aktuell FEHLGESCHLAGEN (erwartet)
|
|
108
|
+
|
|
109
|
+
Iteration 3:
|
|
110
|
+
[FORTSCHRITT] AuthService implementieren
|
|
111
|
+
- AuthService.php erstellt
|
|
112
|
+
- JWT-Token-Generierung implementiert
|
|
113
|
+
- Tests jetzt BESTANDEN
|
|
114
|
+
|
|
115
|
+
Iteration 4:
|
|
116
|
+
[FORTSCHRITT] Dokumentation aktualisieren
|
|
117
|
+
- Authentifizierungsabschnitt zum README hinzugefugt
|
|
118
|
+
- API-Endpunkte dokumentiert
|
|
119
|
+
|
|
120
|
+
<promise>COMPLETE</promise>
|
|
121
|
+
|
|
122
|
+
Zusammenfassung:
|
|
123
|
+
- AuthService mit JWT-Unterstutzung erstellt
|
|
124
|
+
- 3 Tests bestanden
|
|
125
|
+
- Dokumentation aktualisiert
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Integrationspunkte
|
|
129
|
+
|
|
130
|
+
- Funktioniert mit `/common:ralph-run` Befehl
|
|
131
|
+
- Integriert mit bestehenden Hooks (quality-gate.sh)
|
|
132
|
+
- Kompatibel mit `/project:sprint-dev` Workflow
|
|
133
|
+
- Nutzt `@tdd-coach` Prinzipien
|
|
134
|
+
|
|
135
|
+
## Wann Stoppen
|
|
136
|
+
|
|
137
|
+
Abschluss signalisieren und Iterationen stoppen wenn:
|
|
138
|
+
1. Alle erforderlichen DoD-Kriterien bestehen
|
|
139
|
+
2. Aufgabenziele vollstandig erreicht
|
|
140
|
+
3. Tests Funktionalitat verifizieren
|
|
141
|
+
4. Dokumentation aktualisiert
|
|
142
|
+
|
|
143
|
+
NICHT fortfahren wenn:
|
|
144
|
+
- Sicherungsschalter-Schwellen erreicht
|
|
145
|
+
- Wiederholte Fehlschlage auf grundlegendes Problem hinweisen
|
|
146
|
+
- Menschliches Eingreifen erforderlich
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Claude in kontinuierlicher Schleife ausfuhren bis Aufgabe abgeschlossen (Ralph Wiggum)
|
|
3
|
+
argument-hint: <aufgaben-beschreibung> [--auto|--full]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Ralph Run - Kontinuierliche KI-Agenten-Schleife
|
|
7
|
+
|
|
8
|
+
Claude in kontinuierlicher Schleife ausfuhren bis die Aufgabe abgeschlossen ist oder die Definition of Done (DoD) Kriterien erfullt sind.
|
|
9
|
+
|
|
10
|
+
## Argumente
|
|
11
|
+
|
|
12
|
+
**$ARGUMENTS**
|
|
13
|
+
|
|
14
|
+
- `<aufgaben-beschreibung>`: Die Aufgabe fur Claude
|
|
15
|
+
- `--auto`: Maximale automatische Erkennung, minimale Fragen
|
|
16
|
+
- `--full`: Umfassender Modus mit allen DoD-Prufungen
|
|
17
|
+
|
|
18
|
+
## Prozess
|
|
19
|
+
|
|
20
|
+
### 1. Sitzungsinitialisierung
|
|
21
|
+
|
|
22
|
+
1. **Voraussetzungen prufen**:
|
|
23
|
+
- Prufen ob Claude verfugbar ist
|
|
24
|
+
- Nach `ralph.yml` Konfiguration suchen
|
|
25
|
+
- Sitzungsverzeichnis initialisieren (`.ralph/`)
|
|
26
|
+
|
|
27
|
+
2. **Konfiguration laden**:
|
|
28
|
+
- `ralph.yml` oder `.claude/ralph.yml` lesen
|
|
29
|
+
- Max Iterationen, Timeouts, DoD-Kriterien festlegen
|
|
30
|
+
|
|
31
|
+
### 2. Hauptschleife
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
35
|
+
│ RALPH SCHLEIFE │
|
|
36
|
+
│ │
|
|
37
|
+
│ while (iterationen < max && !DoD_bestanden) { │
|
|
38
|
+
│ 1. Sicherungsschalter prufen │
|
|
39
|
+
│ 2. Claude mit aktuellem Prompt aufrufen │
|
|
40
|
+
│ 3. Ausgabe verarbeiten │
|
|
41
|
+
│ 4. Definition of Done validieren │
|
|
42
|
+
│ 5. Checkpoint erstellen (git commit) │
|
|
43
|
+
│ 6. Falls DoD nicht erfullt, Antwort als Prompt nutzen │
|
|
44
|
+
│ } │
|
|
45
|
+
└─────────────────────────────────────────────────────────────┘
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 3. Definition of Done Validierung
|
|
49
|
+
|
|
50
|
+
Das DoD-System validiert Abschluss durch mehrere Kriterien:
|
|
51
|
+
|
|
52
|
+
| Validator | Beschreibung |
|
|
53
|
+
|-----------|--------------|
|
|
54
|
+
| `command` | Shell-Befehl ausfuhren (Tests, Lint, Build) |
|
|
55
|
+
| `output_contains` | Pattern in Claude-Ausgabe prufen |
|
|
56
|
+
| `file_changed` | Prufen ob Dateien geandert wurden |
|
|
57
|
+
| `hook` | Bestehenden Claude-Hook ausfuhren |
|
|
58
|
+
| `human` | Interaktive menschliche Validierung |
|
|
59
|
+
|
|
60
|
+
Beispiel DoD in `ralph.yml`:
|
|
61
|
+
|
|
62
|
+
```yaml
|
|
63
|
+
definition_of_done:
|
|
64
|
+
checklist:
|
|
65
|
+
- id: tests
|
|
66
|
+
name: "Alle Tests bestanden"
|
|
67
|
+
type: command
|
|
68
|
+
command: "docker compose exec app npm test"
|
|
69
|
+
required: true
|
|
70
|
+
|
|
71
|
+
- id: completion
|
|
72
|
+
name: "Claude signalisiert Abschluss"
|
|
73
|
+
type: output_contains
|
|
74
|
+
pattern: "<promise>COMPLETE</promise>"
|
|
75
|
+
required: true
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 4. Sicherungsschalter (Circuit Breaker)
|
|
79
|
+
|
|
80
|
+
Sicherheitsmechanismus zur Vermeidung von Endlosschleifen:
|
|
81
|
+
|
|
82
|
+
| Ausloser | Schwelle | Aktion |
|
|
83
|
+
|----------|----------|--------|
|
|
84
|
+
| Keine Dateienderungen | 3 Iterationen | Stopp |
|
|
85
|
+
| Wiederholte Fehler | 5 Iterationen | Stopp |
|
|
86
|
+
| Ausgaberuckgang | 70% | Stopp |
|
|
87
|
+
| Max Iterationen | 25 (Standard) | Stopp |
|
|
88
|
+
|
|
89
|
+
### 5. Checkpointing
|
|
90
|
+
|
|
91
|
+
Git-Checkpoints werden nach jeder Iteration erstellt fur:
|
|
92
|
+
- **Wiederherstellung**: Fruheren Zustand bei Bedarf wiederherstellen
|
|
93
|
+
- **Historie**: Fortschritt durch Iterationen verfolgen
|
|
94
|
+
- **Review**: Anderungen bei jedem Schritt inspizieren
|
|
95
|
+
|
|
96
|
+
## Ausgabe
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
╔════════════════════════════════════════════════════════════╗
|
|
100
|
+
║ 🔁 Ralph Wiggum - Kontinuierliche KI-Agenten-Schleife ║
|
|
101
|
+
╚════════════════════════════════════════════════════════════╝
|
|
102
|
+
|
|
103
|
+
✓ Sitzung erstellt: ralph-1704067200-a1b2
|
|
104
|
+
|
|
105
|
+
ℹ Ralph-Schleife wird gestartet...
|
|
106
|
+
|
|
107
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
108
|
+
Iteration 1 von 25
|
|
109
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
110
|
+
|
|
111
|
+
ℹ Claude wird aufgerufen...
|
|
112
|
+
ℹ DoD-Kriterien werden gepruft...
|
|
113
|
+
✓ [tests] Alle Tests bestanden - OK
|
|
114
|
+
✓ [lint] Keine Lint-Fehler - OK
|
|
115
|
+
✓ [completion] Claude signalisiert Abschluss - OK
|
|
116
|
+
|
|
117
|
+
Alle erforderlichen Kriterien bestanden!
|
|
118
|
+
|
|
119
|
+
✓ DoD BESTANDEN
|
|
120
|
+
|
|
121
|
+
╔════════════════════════════════════════════════════════════╗
|
|
122
|
+
║ 📊 Sitzungszusammenfassung ║
|
|
123
|
+
╚════════════════════════════════════════════════════════════╝
|
|
124
|
+
|
|
125
|
+
Sitzungs-ID: ralph-1704067200-a1b2
|
|
126
|
+
Gesamtiterationen: 3
|
|
127
|
+
Dauer: 45s
|
|
128
|
+
DoD-Status: BESTANDEN
|
|
129
|
+
Beendigungsgrund: dod_complete
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Konfiguration
|
|
133
|
+
|
|
134
|
+
`ralph.yml` im Projektstammverzeichnis erstellen:
|
|
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
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Best Practices
|
|
160
|
+
|
|
161
|
+
1. **Klare Beschreibung**: Spezifische, umsetzbare Aufgaben bereitstellen
|
|
162
|
+
2. **DoD konfigurieren**: Abschlusskriterien in `ralph.yml` definieren
|
|
163
|
+
3. **TDD verwenden**: Tests zuerst schreiben, Ralph implementieren lassen
|
|
164
|
+
4. **Fortschritt uberwachen**: Iterationsausgaben beobachten
|
|
165
|
+
5. **Vernunftige Grenzen**: max_iterations nach Komplexitat anpassen
|
|
166
|
+
|
|
167
|
+
## Siehe auch
|
|
168
|
+
|
|
169
|
+
- `@ralph-conductor` - Agent fur Ralph-Orchestrierung
|
|
170
|
+
- `/common:fix-bug-tdd` - TDD-basierte Fehlerbehebung
|
|
171
|
+
- `/project:sprint-dev` - Sprint-Entwicklung mit TDD
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ralph-conductor
|
|
3
|
+
description: Orchestrates Ralph Wiggum continuous loop sessions with DoD validation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Ralph Conductor Agent
|
|
7
|
+
|
|
8
|
+
You are a specialized agent for orchestrating Ralph Wiggum continuous loop sessions. Your role is to guide tasks through iterative Claude execution until the Definition of Done (DoD) criteria are met.
|
|
9
|
+
|
|
10
|
+
## Core Responsibilities
|
|
11
|
+
|
|
12
|
+
### 1. Session Management
|
|
13
|
+
- Initialize Ralph sessions with appropriate configuration
|
|
14
|
+
- Track iteration progress and metrics
|
|
15
|
+
- Manage session state and recovery
|
|
16
|
+
|
|
17
|
+
### 2. Definition of Done Validation
|
|
18
|
+
- Evaluate DoD criteria at each iteration
|
|
19
|
+
- Provide feedback on which criteria are passing/failing
|
|
20
|
+
- Suggest corrective actions when criteria fail
|
|
21
|
+
|
|
22
|
+
### 3. Circuit Breaker Monitoring
|
|
23
|
+
- Monitor for stall conditions (no progress)
|
|
24
|
+
- Detect error loops and repeated failures
|
|
25
|
+
- Recommend stopping when appropriate
|
|
26
|
+
|
|
27
|
+
### 4. Progress Assessment
|
|
28
|
+
- Evaluate if meaningful progress is being made
|
|
29
|
+
- Identify when tasks are stuck
|
|
30
|
+
- Suggest alternative approaches when needed
|
|
31
|
+
|
|
32
|
+
## Working Mode
|
|
33
|
+
|
|
34
|
+
When orchestrating a Ralph session:
|
|
35
|
+
|
|
36
|
+
1. **Initial Assessment**
|
|
37
|
+
- Understand the task requirements
|
|
38
|
+
- Identify success criteria
|
|
39
|
+
- Configure appropriate DoD checklist
|
|
40
|
+
|
|
41
|
+
2. **Iteration Guidance**
|
|
42
|
+
- Provide clear, actionable prompts
|
|
43
|
+
- Focus on one objective at a time
|
|
44
|
+
- Build incrementally on previous progress
|
|
45
|
+
|
|
46
|
+
3. **Quality Gates**
|
|
47
|
+
- Verify tests pass before proceeding
|
|
48
|
+
- Check code quality metrics
|
|
49
|
+
- Validate documentation updates
|
|
50
|
+
|
|
51
|
+
4. **Completion Signals**
|
|
52
|
+
- Clearly indicate when DoD is met
|
|
53
|
+
- Use completion marker: `<promise>COMPLETE</promise>`
|
|
54
|
+
- Summarize what was accomplished
|
|
55
|
+
|
|
56
|
+
## DoD Validator Types
|
|
57
|
+
|
|
58
|
+
| Type | When to Use |
|
|
59
|
+
|------|-------------|
|
|
60
|
+
| `command` | Running tests, linting, building |
|
|
61
|
+
| `output_contains` | Checking for completion markers |
|
|
62
|
+
| `file_changed` | Verifying documentation updates |
|
|
63
|
+
| `hook` | Integrating with existing quality gates |
|
|
64
|
+
| `human` | Critical decisions requiring approval |
|
|
65
|
+
|
|
66
|
+
## Best Practices
|
|
67
|
+
|
|
68
|
+
### Task Decomposition
|
|
69
|
+
Break complex tasks into smaller, verifiable steps:
|
|
70
|
+
1. Write failing test first (RED)
|
|
71
|
+
2. Implement minimum code to pass (GREEN)
|
|
72
|
+
3. Refactor while keeping tests passing (REFACTOR)
|
|
73
|
+
4. Update documentation
|
|
74
|
+
5. Signal completion
|
|
75
|
+
|
|
76
|
+
### Progress Indicators
|
|
77
|
+
Include clear progress markers in your output:
|
|
78
|
+
- `[PROGRESS]` - Making forward progress
|
|
79
|
+
- `[BLOCKED]` - Encountered obstacle
|
|
80
|
+
- `[TESTING]` - Running verification
|
|
81
|
+
- `[COMPLETE]` - Task finished
|
|
82
|
+
|
|
83
|
+
### Error Handling
|
|
84
|
+
When encountering errors:
|
|
85
|
+
1. Describe the error clearly
|
|
86
|
+
2. Analyze root cause
|
|
87
|
+
3. Propose solution
|
|
88
|
+
4. Implement fix
|
|
89
|
+
5. Verify resolution
|
|
90
|
+
|
|
91
|
+
## Example Session Flow
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
Session: ralph-1704067200-a1b2
|
|
95
|
+
Task: Implement user authentication
|
|
96
|
+
|
|
97
|
+
Iteration 1:
|
|
98
|
+
[PROGRESS] Analyzing existing code structure
|
|
99
|
+
- Found existing User entity
|
|
100
|
+
- Authentication service needs creation
|
|
101
|
+
- Tests directory ready
|
|
102
|
+
|
|
103
|
+
Iteration 2:
|
|
104
|
+
[TESTING] Writing authentication tests
|
|
105
|
+
- Created AuthServiceTest.php
|
|
106
|
+
- 3 test cases: login, logout, validateToken
|
|
107
|
+
- Tests currently FAILING (expected)
|
|
108
|
+
|
|
109
|
+
Iteration 3:
|
|
110
|
+
[PROGRESS] Implementing AuthService
|
|
111
|
+
- Created AuthService.php
|
|
112
|
+
- Implemented JWT token generation
|
|
113
|
+
- Tests now PASSING
|
|
114
|
+
|
|
115
|
+
Iteration 4:
|
|
116
|
+
[PROGRESS] Updating documentation
|
|
117
|
+
- Added authentication section to README
|
|
118
|
+
- Documented API endpoints
|
|
119
|
+
|
|
120
|
+
<promise>COMPLETE</promise>
|
|
121
|
+
|
|
122
|
+
Summary:
|
|
123
|
+
- AuthService created with JWT support
|
|
124
|
+
- 3 tests passing
|
|
125
|
+
- Documentation updated
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Integration Points
|
|
129
|
+
|
|
130
|
+
- Works with `/common:ralph-run` command
|
|
131
|
+
- Integrates with existing hooks (quality-gate.sh)
|
|
132
|
+
- Compatible with `/project:sprint-dev` workflow
|
|
133
|
+
- Uses `@tdd-coach` principles
|
|
134
|
+
|
|
135
|
+
## When to Stop
|
|
136
|
+
|
|
137
|
+
Signal completion and stop iterating when:
|
|
138
|
+
1. All required DoD criteria pass
|
|
139
|
+
2. Task objectives are fully met
|
|
140
|
+
3. Tests verify functionality
|
|
141
|
+
4. Documentation is updated
|
|
142
|
+
|
|
143
|
+
Do NOT continue if:
|
|
144
|
+
- Circuit breaker thresholds reached
|
|
145
|
+
- Repeated failures indicate fundamental issue
|
|
146
|
+
- Human intervention is required
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run Claude in continuous loop until task completion (Ralph Wiggum)
|
|
3
|
+
argument-hint: <task-description> [--auto|--full]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Ralph Run - Continuous AI Agent Loop
|
|
7
|
+
|
|
8
|
+
Execute Claude in a continuous loop until the task is complete or the Definition of Done (DoD) criteria are met.
|
|
9
|
+
|
|
10
|
+
## Arguments
|
|
11
|
+
|
|
12
|
+
**$ARGUMENTS**
|
|
13
|
+
|
|
14
|
+
- `<task-description>`: The task for Claude to complete
|
|
15
|
+
- `--auto`: Maximum auto-detection, minimal questions
|
|
16
|
+
- `--full`: Comprehensive mode with all DoD checks
|
|
17
|
+
|
|
18
|
+
## Process
|
|
19
|
+
|
|
20
|
+
### 1. Session Initialization
|
|
21
|
+
|
|
22
|
+
1. **Check prerequisites**:
|
|
23
|
+
- Verify Claude is available
|
|
24
|
+
- Check for `ralph.yml` configuration
|
|
25
|
+
- Initialize session directory (`.ralph/`)
|
|
26
|
+
|
|
27
|
+
2. **Load configuration**:
|
|
28
|
+
- Read `ralph.yml` or `.claude/ralph.yml`
|
|
29
|
+
- Set max iterations, timeouts, DoD criteria
|
|
30
|
+
|
|
31
|
+
### 2. Main Loop
|
|
32
|
+
|
|
33
|
+
```
|
|
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
|
+
└─────────────────────────────────────────────────────────────┘
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 3. Definition of Done Validation
|
|
49
|
+
|
|
50
|
+
The DoD system validates completion through multiple criteria:
|
|
51
|
+
|
|
52
|
+
| Validator | Description |
|
|
53
|
+
|-----------|-------------|
|
|
54
|
+
| `command` | Run shell command (tests, lint, build) |
|
|
55
|
+
| `output_contains` | Check for pattern in Claude output |
|
|
56
|
+
| `file_changed` | Verify files were modified |
|
|
57
|
+
| `hook` | Run existing Claude hook |
|
|
58
|
+
| `human` | Interactive human validation |
|
|
59
|
+
|
|
60
|
+
Example DoD from `ralph.yml`:
|
|
61
|
+
|
|
62
|
+
```yaml
|
|
63
|
+
definition_of_done:
|
|
64
|
+
checklist:
|
|
65
|
+
- id: tests
|
|
66
|
+
name: "All tests pass"
|
|
67
|
+
type: command
|
|
68
|
+
command: "docker compose exec app npm test"
|
|
69
|
+
required: true
|
|
70
|
+
|
|
71
|
+
- id: completion
|
|
72
|
+
name: "Claude signals completion"
|
|
73
|
+
type: output_contains
|
|
74
|
+
pattern: "<promise>COMPLETE</promise>"
|
|
75
|
+
required: true
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 4. Circuit Breaker
|
|
79
|
+
|
|
80
|
+
Safety mechanism to prevent infinite loops:
|
|
81
|
+
|
|
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
|
|
95
|
+
|
|
96
|
+
## Output
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
╔════════════════════════════════════════════════════════════╗
|
|
100
|
+
║ 🔁 Ralph Wiggum - Continuous AI Agent Loop ║
|
|
101
|
+
╚════════════════════════════════════════════════════════════╝
|
|
102
|
+
|
|
103
|
+
✓ Session created: ralph-1704067200-a1b2
|
|
104
|
+
|
|
105
|
+
ℹ Starting Ralph loop...
|
|
106
|
+
|
|
107
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
108
|
+
Iteration 1 of 25
|
|
109
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
110
|
+
|
|
111
|
+
ℹ Invoking Claude...
|
|
112
|
+
ℹ Checking DoD criteria...
|
|
113
|
+
✓ [tests] All tests pass - PASS
|
|
114
|
+
✓ [lint] No lint errors - PASS
|
|
115
|
+
✓ [completion] Claude signals completion - PASS
|
|
116
|
+
|
|
117
|
+
All required criteria passed!
|
|
118
|
+
|
|
119
|
+
✓ DoD PASSED
|
|
120
|
+
|
|
121
|
+
╔════════════════════════════════════════════════════════════╗
|
|
122
|
+
║ 📊 Session Summary ║
|
|
123
|
+
╚════════════════════════════════════════════════════════════╝
|
|
124
|
+
|
|
125
|
+
Session ID: ralph-1704067200-a1b2
|
|
126
|
+
Total iterations: 3
|
|
127
|
+
Duration: 45s
|
|
128
|
+
DoD status: PASSED
|
|
129
|
+
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
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Best Practices
|
|
160
|
+
|
|
161
|
+
1. **Clear task description**: Provide specific, actionable tasks
|
|
162
|
+
2. **Configure DoD**: Define completion criteria in `ralph.yml`
|
|
163
|
+
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
|
|
166
|
+
|
|
167
|
+
## Related
|
|
168
|
+
|
|
169
|
+
- `@ralph-conductor` - Agent for Ralph orchestration
|
|
170
|
+
- `/common:fix-bug-tdd` - TDD-based bug fixing
|
|
171
|
+
- `/project:sprint-dev` - Sprint development with TDD
|