@the-bearded-bear/claude-craft 3.0.2 → 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.
Files changed (30) hide show
  1. package/Dev/i18n/de/Common/agents/ralph-conductor.md +146 -0
  2. package/Dev/i18n/de/Common/commands/ralph-run.md +171 -0
  3. package/Dev/i18n/de/Common/commands/setup-project-context.md +286 -0
  4. package/Dev/i18n/en/Common/agents/ralph-conductor.md +146 -0
  5. package/Dev/i18n/en/Common/commands/ralph-run.md +171 -0
  6. package/Dev/i18n/en/Common/commands/setup-project-context.md +286 -0
  7. package/Dev/i18n/es/Common/agents/ralph-conductor.md +146 -0
  8. package/Dev/i18n/es/Common/commands/ralph-run.md +171 -0
  9. package/Dev/i18n/es/Common/commands/setup-project-context.md +286 -0
  10. package/Dev/i18n/fr/Common/agents/ralph-conductor.md +146 -0
  11. package/Dev/i18n/fr/Common/commands/ralph-run.md +171 -0
  12. package/Dev/i18n/fr/Common/commands/setup-project-context.md +286 -0
  13. package/Dev/i18n/pt/Common/agents/ralph-conductor.md +146 -0
  14. package/Dev/i18n/pt/Common/commands/ralph-run.md +171 -0
  15. package/Dev/i18n/pt/Common/commands/setup-project-context.md +286 -0
  16. package/Tools/Ralph/README.md +303 -0
  17. package/Tools/Ralph/lib/checkpoint.sh +238 -0
  18. package/Tools/Ralph/lib/circuit-breaker.sh +172 -0
  19. package/Tools/Ralph/lib/dod-validator.sh +306 -0
  20. package/Tools/Ralph/lib/loop.sh +232 -0
  21. package/Tools/Ralph/lib/session.sh +234 -0
  22. package/Tools/Ralph/ralph.sh +491 -0
  23. package/Tools/Ralph/templates/ralph.yml.template +178 -0
  24. package/Tools/i18n/ralph/de.sh +147 -0
  25. package/Tools/i18n/ralph/en.sh +147 -0
  26. package/Tools/i18n/ralph/es.sh +147 -0
  27. package/Tools/i18n/ralph/fr.sh +147 -0
  28. package/Tools/i18n/ralph/pt.sh +147 -0
  29. package/cli/index.js +90 -0
  30. package/package.json +1 -1
@@ -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
@@ -0,0 +1,286 @@
1
+ ---
2
+ name: setup-project-context
3
+ description: Analyze codebase and configure project context interactively
4
+ arguments:
5
+ - name: mode
6
+ description: Detection mode (--auto minimal questions, --full comprehensive)
7
+ required: false
8
+ ---
9
+
10
+ # Setup Project Context
11
+
12
+ Configure `.claude/rules/00-project-context.md` by analyzing the codebase and asking targeted questions.
13
+
14
+ ## Execution
15
+
16
+ ### Phase 1: Automatic Detection
17
+
18
+ Analyze the following files and directories:
19
+
20
+ **Configuration Files:**
21
+ - `package.json` → Node.js project name, dependencies, scripts
22
+ - `composer.json` → PHP project name, dependencies, framework
23
+ - `pubspec.yaml` → Flutter/Dart project name, dependencies
24
+ - `requirements.txt` / `pyproject.toml` → Python dependencies
25
+ - `Cargo.toml` → Rust project
26
+ - `go.mod` → Go module
27
+
28
+ **Environment & Config:**
29
+ - `.env`, `.env.example` → Database, services
30
+ - `config/` → Framework configuration
31
+ - `docker-compose.yml` → Services (DB, Redis, etc.)
32
+
33
+ **Structure:**
34
+ - `src/`, `lib/`, `app/` → Source code location
35
+ - `tests/`, `spec/` → Testing framework
36
+ - `docs/`, `specifications/` → Documentation
37
+ - `.github/`, `.gitlab-ci.yml` → CI/CD
38
+
39
+ **Domain (if applicable):**
40
+ - `src/Entity/`, `src/Domain/` → Business entities (PHP/Symfony)
41
+ - `lib/models/`, `lib/domain/` → Models (Flutter/Dart)
42
+ - `models/`, `schemas/` → Data models
43
+ - `migrations/` → Database schema
44
+
45
+ Display analysis results:
46
+
47
+ ```
48
+ ╔══════════════════════════════════════════════════════════════╗
49
+ ║ PROJECT ANALYSIS RESULTS ║
50
+ ╚══════════════════════════════════════════════════════════════╝
51
+
52
+ ✅ Detected Information:
53
+ ┌─────────────────┬────────────────────────────────┐
54
+ │ Element │ Value │
55
+ ├─────────────────┼────────────────────────────────┤
56
+ │ Project Name │ {detected_name} │
57
+ │ Language │ {detected_language} │
58
+ │ Framework │ {detected_framework} │
59
+ │ Database │ {detected_database} │
60
+ │ Testing │ {detected_testing} │
61
+ │ CI/CD │ {detected_cicd} │
62
+ └─────────────────┴────────────────────────────────┘
63
+
64
+ 📁 Project Structure:
65
+ {detected_structure}
66
+
67
+ 📄 Documentation Found:
68
+ {detected_docs}
69
+
70
+ ❌ Not Detected (will ask):
71
+ - {missing_items}
72
+ ```
73
+
74
+ ### Phase 2: Interactive Questions
75
+
76
+ Ask only for information NOT detected in Phase 1.
77
+ Skip questions if `--auto` mode is used and a reasonable default exists.
78
+
79
+ **Essential Questions:**
80
+
81
+ 1. **Application Type** (if not detected):
82
+ ```
83
+ What type of application is this?
84
+ [ ] REST API [ ] Web Application [ ] Mobile App
85
+ [ ] CLI Tool [ ] Library/Package [ ] Monorepo
86
+ ```
87
+
88
+ 2. **Business Domain**:
89
+ ```
90
+ What is the business domain?
91
+ [ ] E-commerce [ ] SaaS Platform [ ] FinTech
92
+ [ ] HealthTech [ ] EdTech [ ] Social/Community
93
+ [ ] Media/Content [ ] IoT [ ] Other: _____
94
+ ```
95
+
96
+ 3. **Target Users** (2-3 personas):
97
+ ```
98
+ Describe your main users:
99
+
100
+ Primary User:
101
+ > Role: _____
102
+ > Main goal: _____
103
+
104
+ Secondary User (optional):
105
+ > Role: _____
106
+ > Main goal: _____
107
+ ```
108
+
109
+ 4. **Compliance Requirements**:
110
+ ```
111
+ Which compliance requirements apply?
112
+ [ ] GDPR (EU data protection)
113
+ [ ] HIPAA (US healthcare)
114
+ [ ] PCI-DSS (Payment card)
115
+ [ ] SOC2 (Security)
116
+ [ ] None / Not applicable
117
+ ```
118
+
119
+ **Extended Questions** (only with `--full` mode):
120
+
121
+ 5. **Business Goals**:
122
+ ```
123
+ Short-term goals (3-6 months):
124
+ > _____
125
+
126
+ Medium-term goals (6-12 months):
127
+ > _____
128
+ ```
129
+
130
+ 6. **Known Issues/Technical Debt**:
131
+ ```
132
+ Any known issues or technical debt to document?
133
+ > _____
134
+ ```
135
+
136
+ 7. **Glossary Terms**:
137
+ ```
138
+ Key business terms to define (comma-separated):
139
+ > _____
140
+ ```
141
+
142
+ ### Phase 3: Generate Context File
143
+
144
+ Create `.claude/rules/00-project-context.md`:
145
+
146
+ ```markdown
147
+ # Project Context - {PROJECT_NAME}
148
+
149
+ > Auto-generated by `/common:setup-project-context` on {DATE}
150
+ > Review and customize as needed.
151
+
152
+ ## Overview
153
+
154
+ **{PROJECT_NAME}** is a {TYPE} application for the {DOMAIN} domain.
155
+
156
+ {DESCRIPTION_FROM_README_OR_USER}
157
+
158
+ ## Technical Stack
159
+
160
+ | Component | Technology |
161
+ |--------------|----------------------|
162
+ | Language | {LANGUAGE} |
163
+ | Framework | {FRAMEWORK} |
164
+ | Database | {DATABASE} |
165
+ | Cache | {CACHE_IF_DETECTED} |
166
+ | Testing | {TESTING_FRAMEWORKS} |
167
+ | CI/CD | {CICD_PLATFORM} |
168
+
169
+ ## Project Structure
170
+
171
+ ```
172
+ {DETECTED_STRUCTURE}
173
+ ```
174
+
175
+ ## Business Domain
176
+
177
+ ### Core Concepts
178
+
179
+ {ENTITIES_IF_DETECTED}
180
+
181
+ ### Bounded Contexts
182
+
183
+ <!-- Add if using DDD -->
184
+ - Context 1: ...
185
+ - Context 2: ...
186
+
187
+ ## Users & Personas
188
+
189
+ ### {PRIMARY_USER_ROLE}
190
+ - **Goal:** {PRIMARY_USER_GOAL}
191
+ - **Pain points:** To be documented
192
+ - **Key workflows:** To be documented
193
+
194
+ ### {SECONDARY_USER_ROLE}
195
+ - **Goal:** {SECONDARY_USER_GOAL}
196
+ - **Pain points:** To be documented
197
+ - **Key workflows:** To be documented
198
+
199
+ ## Constraints
200
+
201
+ ### Compliance
202
+ {COMPLIANCE_REQUIREMENTS}
203
+
204
+ ### Performance Targets
205
+ - Page load time: < 3s
206
+ - API response time: < 200ms
207
+ - Availability: 99.9%
208
+
209
+ ### Security Requirements
210
+ - OWASP Top 10 compliance
211
+ - Input validation on all endpoints
212
+ - Authentication required for protected resources
213
+
214
+ ## Goals
215
+
216
+ ### Short-term
217
+ {SHORT_TERM_GOALS_OR_PLACEHOLDER}
218
+
219
+ ### Medium-term
220
+ {MEDIUM_TERM_GOALS_OR_PLACEHOLDER}
221
+
222
+ ## Known Issues / Technical Debt
223
+
224
+ {ISSUES_OR_PLACEHOLDER}
225
+
226
+ ## Glossary
227
+
228
+ | Term | Definition |
229
+ |------|------------|
230
+ {GLOSSARY_TERMS_OR_EXAMPLES}
231
+ ```
232
+
233
+ ### Phase 4: Validation & Next Steps
234
+
235
+ Display summary and recommendations:
236
+
237
+ ```
238
+ ╔══════════════════════════════════════════════════════════════╗
239
+ ║ PROJECT CONTEXT GENERATED ║
240
+ ╚══════════════════════════════════════════════════════════════╝
241
+
242
+ ✅ File created: .claude/rules/00-project-context.md
243
+
244
+ Summary:
245
+ ┌─────────────────┬────────────────────────────────┐
246
+ │ Project │ {PROJECT_NAME} │
247
+ │ Type │ {TYPE} │
248
+ │ Stack │ {FRAMEWORK} + {DATABASE} │
249
+ │ Domain │ {DOMAIN} │
250
+ │ Compliance │ {COMPLIANCE} │
251
+ │ Personas │ {COUNT} defined │
252
+ └─────────────────┴────────────────────────────────┘
253
+
254
+ 📋 Recommended Next Steps:
255
+
256
+ 1. Review generated file and complete placeholder sections
257
+ 2. Add detailed bounded contexts if using DDD
258
+ 3. Document key business workflows
259
+ 4. Consider running specialized agents:
260
+ - @database-architect → Document database schema
261
+ - @api-designer → Document API endpoints
262
+ - @security-reviewer → Review security constraints
263
+
264
+ Would you like me to open the file for review?
265
+ ```
266
+
267
+ ## Modes
268
+
269
+ | Mode | Behavior |
270
+ |------|----------|
271
+ | (default) | Detect + essential questions (type, domain, users, compliance) |
272
+ | `--auto` | Maximum auto-detection, skip questions with reasonable defaults |
273
+ | `--full` | All questions including goals, issues, and glossary |
274
+
275
+ ## Examples
276
+
277
+ ```bash
278
+ # Standard mode - balanced detection and questions
279
+ /common:setup-project-context
280
+
281
+ # Auto mode - minimal interaction
282
+ /common:setup-project-context --auto
283
+
284
+ # Full mode - comprehensive questionnaire
285
+ /common:setup-project-context --full
286
+ ```