@hustle-together/api-dev-tools 3.12.16 → 4.5.3

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 (180) hide show
  1. package/.claude/adr-requests/.gitkeep +10 -0
  2. package/.claude/agents/adr-researcher.md +109 -0
  3. package/.claude/agents/visual-analyzer.md +183 -0
  4. package/.claude/api-dev-state.json +10 -0
  5. package/.claude/documentation-audit.json +114 -0
  6. package/.claude/registry.json +289 -0
  7. package/.claude/settings.json +45 -1
  8. package/.claude/settings.local.json +1 -7
  9. package/.claude/workflow-logs/None.json +49 -0
  10. package/.claude/workflow-logs/session-20251230-143727.json +106 -0
  11. package/.skills/adr-deep-research/SKILL.md +351 -0
  12. package/.skills/api-create/SKILL.md +34 -20
  13. package/.skills/api-research/SKILL.md +130 -0
  14. package/.skills/docs-update/SKILL.md +205 -0
  15. package/.skills/hustle-brand/SKILL.md +368 -0
  16. package/.skills/hustle-build/SKILL.md +365 -38
  17. package/.skills/parallel-spawn/SKILL.md +212 -0
  18. package/.skills/ralph-continue/SKILL.md +151 -0
  19. package/.skills/ralph-loop/SKILL.md +341 -0
  20. package/.skills/ralph-status/SKILL.md +87 -0
  21. package/.skills/refactor/SKILL.md +59 -0
  22. package/.skills/shadcn/SKILL.md +522 -0
  23. package/.skills/test-all/SKILL.md +210 -0
  24. package/.skills/test-builds/SKILL.md +208 -0
  25. package/.skills/test-debug/SKILL.md +212 -0
  26. package/.skills/test-e2e/SKILL.md +168 -0
  27. package/.skills/test-review/SKILL.md +707 -0
  28. package/.skills/test-unit/SKILL.md +143 -0
  29. package/.skills/test-visual/SKILL.md +301 -0
  30. package/.skills/token-report/SKILL.md +132 -0
  31. package/CHANGELOG.md +488 -0
  32. package/README.md +346 -53
  33. package/bin/cli.js +359 -123
  34. package/hooks/__pycache__/api-workflow-check.cpython-314.pyc +0 -0
  35. package/hooks/__pycache__/auto-answer.cpython-314.pyc +0 -0
  36. package/hooks/__pycache__/cache-research.cpython-314.pyc +0 -0
  37. package/hooks/__pycache__/check-api-routes.cpython-314.pyc +0 -0
  38. package/hooks/__pycache__/check-playwright-setup.cpython-314.pyc +0 -0
  39. package/hooks/__pycache__/check-storybook-setup.cpython-314.pyc +0 -0
  40. package/hooks/__pycache__/check-update.cpython-314.pyc +0 -0
  41. package/hooks/__pycache__/completion-promise-detector.cpython-314.pyc +0 -0
  42. package/hooks/__pycache__/context-capacity-warning.cpython-314.pyc +0 -0
  43. package/hooks/__pycache__/detect-interruption.cpython-314.pyc +0 -0
  44. package/hooks/__pycache__/docs-update-check.cpython-314.pyc +0 -0
  45. package/hooks/__pycache__/enforce-a11y-audit.cpython-314.pyc +0 -0
  46. package/hooks/__pycache__/enforce-brand-guide.cpython-314.pyc +0 -0
  47. package/hooks/__pycache__/enforce-component-type-confirm.cpython-314.pyc +0 -0
  48. package/hooks/__pycache__/enforce-deep-research.cpython-314.pyc +0 -0
  49. package/hooks/__pycache__/enforce-disambiguation.cpython-314.pyc +0 -0
  50. package/hooks/__pycache__/enforce-documentation.cpython-314.pyc +0 -0
  51. package/hooks/__pycache__/enforce-dry-run.cpython-314.pyc +0 -0
  52. package/hooks/__pycache__/enforce-environment.cpython-314.pyc +0 -0
  53. package/hooks/__pycache__/enforce-external-research.cpython-314.pyc +0 -0
  54. package/hooks/__pycache__/enforce-freshness.cpython-314.pyc +0 -0
  55. package/hooks/__pycache__/enforce-interview.cpython-314.pyc +0 -0
  56. package/hooks/__pycache__/enforce-page-components.cpython-314.pyc +0 -0
  57. package/hooks/__pycache__/enforce-page-data-schema.cpython-314.pyc +0 -0
  58. package/hooks/__pycache__/enforce-questions-sourced.cpython-314.pyc +0 -0
  59. package/hooks/__pycache__/enforce-refactor.cpython-314.pyc +0 -0
  60. package/hooks/__pycache__/enforce-research.cpython-314.pyc +0 -0
  61. package/hooks/__pycache__/enforce-schema-from-interview.cpython-314.pyc +0 -0
  62. package/hooks/__pycache__/enforce-schema.cpython-314.pyc +0 -0
  63. package/hooks/__pycache__/enforce-scope.cpython-314.pyc +0 -0
  64. package/hooks/__pycache__/enforce-tdd-red.cpython-314.pyc +0 -0
  65. package/hooks/__pycache__/enforce-ui-disambiguation.cpython-314.pyc +0 -0
  66. package/hooks/__pycache__/enforce-ui-interview.cpython-314.pyc +0 -0
  67. package/hooks/__pycache__/enforce-verify.cpython-314.pyc +0 -0
  68. package/hooks/__pycache__/generate-adr-options.cpython-314.pyc +0 -0
  69. package/hooks/__pycache__/generate-manifest-entry.cpython-314.pyc +0 -0
  70. package/hooks/__pycache__/hook_utils.cpython-314.pyc +0 -0
  71. package/hooks/__pycache__/notify-input-needed.cpython-314.pyc +0 -0
  72. package/hooks/__pycache__/notify-phase-complete.cpython-314.pyc +0 -0
  73. package/hooks/__pycache__/ntfy-on-question.cpython-314.pyc +0 -0
  74. package/hooks/__pycache__/orchestrator-completion.cpython-314.pyc +0 -0
  75. package/hooks/__pycache__/orchestrator-handoff.cpython-314.pyc +0 -0
  76. package/hooks/__pycache__/orchestrator-session-startup.cpython-314.pyc +0 -0
  77. package/hooks/__pycache__/parallel-orchestrator.cpython-314.pyc +0 -0
  78. package/hooks/__pycache__/periodic-reground.cpython-314.pyc +0 -0
  79. package/hooks/__pycache__/project-document-prompt.cpython-314.pyc +0 -0
  80. package/hooks/__pycache__/remote-question-proxy.cpython-314.pyc +0 -0
  81. package/hooks/__pycache__/remote-question-server.cpython-314.pyc +0 -0
  82. package/hooks/__pycache__/run-code-review.cpython-314.pyc +0 -0
  83. package/hooks/__pycache__/run-visual-qa.cpython-314.pyc +0 -0
  84. package/hooks/__pycache__/session-logger.cpython-314.pyc +0 -0
  85. package/hooks/__pycache__/session-startup.cpython-314.pyc +0 -0
  86. package/hooks/__pycache__/track-scope-coverage.cpython-314.pyc +0 -0
  87. package/hooks/__pycache__/track-token-usage.cpython-314.pyc +0 -0
  88. package/hooks/__pycache__/track-tool-use.cpython-314.pyc +0 -0
  89. package/hooks/__pycache__/update-adr-decision.cpython-314.pyc +0 -0
  90. package/hooks/__pycache__/update-api-showcase.cpython-314.pyc +0 -0
  91. package/hooks/__pycache__/update-registry.cpython-314.pyc +0 -0
  92. package/hooks/__pycache__/update-ui-showcase.cpython-314.pyc +0 -0
  93. package/hooks/__pycache__/verify-after-green.cpython-314.pyc +0 -0
  94. package/hooks/__pycache__/verify-implementation.cpython-314.pyc +0 -0
  95. package/hooks/api-workflow-check.py +34 -0
  96. package/hooks/auto-answer.py +97 -20
  97. package/{.claude/hooks → hooks}/completion-promise-detector.py +0 -0
  98. package/{.claude/hooks → hooks}/context-capacity-warning.py +0 -0
  99. package/{.claude/hooks → hooks}/docs-update-check.py +0 -0
  100. package/{.claude/hooks → hooks}/enforce-dry-run.py +0 -0
  101. package/hooks/enforce-external-research.py +25 -0
  102. package/hooks/enforce-interview.py +20 -0
  103. package/{.claude/hooks → hooks}/generate-adr-options.py +0 -0
  104. package/{.claude/hooks → hooks}/hook_utils.py +0 -0
  105. package/hooks/ntfy-on-question.py +15 -2
  106. package/hooks/orchestrator-handoff.py +81 -3
  107. package/{.claude/hooks → hooks}/parallel-orchestrator.py +0 -0
  108. package/hooks/periodic-reground.py +40 -0
  109. package/{.claude/hooks → hooks}/remote-question-server.py +0 -0
  110. package/hooks/run-code-review.py +176 -29
  111. package/{.claude/hooks → hooks}/run-visual-qa.py +0 -0
  112. package/hooks/session-logger.py +27 -1
  113. package/hooks/session-startup.py +113 -0
  114. package/{.claude/hooks → hooks}/update-adr-decision.py +0 -0
  115. package/package.json +1 -1
  116. package/templates/.skills/hustle-interview/SKILL.md +174 -0
  117. package/templates/adr-viewer/_components/ADRViewer.tsx +326 -0
  118. package/templates/api-dev-state.json +33 -1
  119. package/templates/brand-page/page.tsx +645 -0
  120. package/templates/component/Component.visual.spec.ts +30 -24
  121. package/templates/eslint-plugin-zod-schema/index.js +446 -0
  122. package/templates/eslint-plugin-zod-schema/package.json +26 -0
  123. package/templates/github-workflows/security.yml +274 -0
  124. package/templates/hustle-build-defaults.json +53 -1
  125. package/templates/page/page.e2e.test.ts +30 -26
  126. package/templates/performance-budgets.json +63 -5
  127. package/templates/registry.json +279 -3
  128. package/templates/review-dashboard/page.tsx +510 -0
  129. package/templates/settings.json +74 -7
  130. package/templates/ui-showcase/_components/UIShowcase.tsx +47 -0
  131. package/templates/ui-showcase/_components/VisualTestingDashboard.tsx +579 -0
  132. package/.claude/commands/hustle-combine.md +0 -1089
  133. package/.claude/commands/hustle-ui-create-page.md +0 -1078
  134. package/.claude/commands/hustle-ui-create.md +0 -1058
  135. package/.claude/hooks/auto-answer.py +0 -305
  136. package/.claude/hooks/cache-research.py +0 -337
  137. package/.claude/hooks/check-api-routes.py +0 -168
  138. package/.claude/hooks/check-playwright-setup.py +0 -103
  139. package/.claude/hooks/check-storybook-setup.py +0 -81
  140. package/.claude/hooks/check-update.py +0 -132
  141. package/.claude/hooks/detect-interruption.py +0 -165
  142. package/.claude/hooks/enforce-a11y-audit.py +0 -202
  143. package/.claude/hooks/enforce-brand-guide.py +0 -241
  144. package/.claude/hooks/enforce-component-type-confirm.py +0 -97
  145. package/.claude/hooks/enforce-freshness.py +0 -184
  146. package/.claude/hooks/enforce-page-components.py +0 -186
  147. package/.claude/hooks/enforce-page-data-schema.py +0 -155
  148. package/.claude/hooks/enforce-questions-sourced.py +0 -146
  149. package/.claude/hooks/enforce-schema-from-interview.py +0 -248
  150. package/.claude/hooks/enforce-ui-disambiguation.py +0 -108
  151. package/.claude/hooks/enforce-ui-interview.py +0 -130
  152. package/.claude/hooks/generate-manifest-entry.py +0 -1161
  153. package/.claude/hooks/lib/__init__.py +0 -1
  154. package/.claude/hooks/lib/greptile.py +0 -355
  155. package/.claude/hooks/lib/ntfy.py +0 -209
  156. package/.claude/hooks/notify-input-needed.py +0 -73
  157. package/.claude/hooks/notify-phase-complete.py +0 -90
  158. package/.claude/hooks/ntfy-on-question.py +0 -240
  159. package/.claude/hooks/orchestrator-completion.py +0 -313
  160. package/.claude/hooks/orchestrator-handoff.py +0 -267
  161. package/.claude/hooks/orchestrator-session-startup.py +0 -146
  162. package/.claude/hooks/run-code-review.py +0 -393
  163. package/.claude/hooks/session-logger.py +0 -323
  164. package/.claude/hooks/test-orchestrator-reground.py +0 -248
  165. package/.claude/hooks/track-scope-coverage.py +0 -220
  166. package/.claude/hooks/track-token-usage.py +0 -121
  167. package/.claude/hooks/update-api-showcase.py +0 -161
  168. package/.claude/hooks/update-registry.py +0 -352
  169. package/.claude/hooks/update-ui-showcase.py +0 -224
  170. package/.claude/test-auto-answer-bot.py +0 -183
  171. package/.claude/test-completion-detector.py +0 -263
  172. package/.claude/test-orchestrator-state.json +0 -20
  173. package/.claude/test-orchestrator.sh +0 -271
  174. /package/{.claude/commands → commands}/hustle-build.md +0 -0
  175. /package/{.claude/hooks → hooks}/lib/__pycache__/__init__.cpython-314.pyc +0 -0
  176. /package/{.claude/hooks → hooks}/lib/__pycache__/greptile.cpython-314.pyc +0 -0
  177. /package/{.claude/hooks → hooks}/lib/__pycache__/ntfy.cpython-314.pyc +0 -0
  178. /package/{.claude/hooks → hooks}/project-document-prompt.py +0 -0
  179. /package/{.claude/hooks → hooks}/remote-question-proxy.py +0 -0
  180. /package/{.claude/hooks → hooks}/update-testing-checklist.py +0 -0
@@ -0,0 +1,212 @@
1
+ ---
2
+ name: parallel-spawn
3
+ description: Spawn multiple Task agents in parallel for concurrent workflow execution across git worktrees
4
+ license: MIT
5
+ compatibility: Requires Claude Code with Task tool, git worktrees support
6
+ metadata:
7
+ version: "4.5.0"
8
+ category: "workflow"
9
+ tags: ['parallel', 'concurrent', 'worktree', 'agents', 'orchestration']
10
+ author: "Hustle Together"
11
+ allowed-tools: Task Read Write Bash TodoWrite
12
+ model: sonnet
13
+ ---
14
+
15
+ # Parallel Spawn
16
+
17
+ Coordinate parallel agent execution across git worktrees for concurrent workflow processing.
18
+
19
+ ## Usage
20
+
21
+ ```
22
+ /parallel-spawn api:users api:products api:analytics
23
+ /parallel-spawn component:chart component:table page:dashboard
24
+ ```
25
+
26
+ Format: `type:name` where type is `api`, `component`, or `page`
27
+
28
+ ## How It Works
29
+
30
+ 1. **Interview Once** - Shared decisions are collected upfront
31
+ 2. **Create Worktrees** - Each workflow gets its own git worktree
32
+ 3. **Spawn Agents** - Background Task agents run in parallel
33
+ 4. **Monitor Progress** - Track completion with /parallel-status
34
+ 5. **Merge Results** - Combine all changes back to main branch
35
+
36
+ ## Example Session
37
+
38
+ ```
39
+ User: /parallel-spawn api:users api:products api:orders
40
+
41
+ AI: Setting up 3 parallel workflows...
42
+
43
+ ┌─────────────────────────────────────────────────────────────────┐
44
+ │ PARALLEL EXECUTION SETUP │
45
+ ├─────────────────────────────────────────────────────────────────┤
46
+ │ │
47
+ │ Workflows to spawn: │
48
+ │ └─ api:users │
49
+ │ └─ api:products │
50
+ │ └─ api:orders │
51
+ │ │
52
+ │ Shared interview required first! │
53
+ │ │
54
+ └─────────────────────────────────────────────────────────────────┘
55
+
56
+ Before spawning, I need to collect shared decisions that will apply
57
+ to ALL workflows:
58
+
59
+ 1. Authentication method?
60
+ [1] API Key
61
+ [2] Bearer Token
62
+ [3] OAuth 2.0
63
+
64
+ 2. Error handling strategy?
65
+ [1] Fail-fast
66
+ [2] Partial success
67
+ [3] Retry with backoff
68
+
69
+ ... (shared interview)
70
+
71
+ AI: Creating worktrees and spawning agents...
72
+
73
+ [Spawns 3 Task agents in parallel with run_in_background: true]
74
+
75
+ Parallel execution started! Monitor with /parallel-status
76
+ ```
77
+
78
+ ## Implementation
79
+
80
+ <claude-commands-template>
81
+ When /parallel-spawn is invoked:
82
+
83
+ ### 1. Parse Workflows
84
+
85
+ Extract workflow definitions from the command:
86
+ ```python
87
+ workflows = []
88
+ for match in re.findall(r'(api|component|page):(\w+)', args):
89
+ workflows.append({"type": match[0], "name": match[1]})
90
+ ```
91
+
92
+ ### 2. Collect Shared Decisions
93
+
94
+ Before spawning, conduct ONE shared interview:
95
+
96
+ ```
97
+ ┌─────────────────────────────────────────────────────────────────┐
98
+ │ SHARED INTERVIEW │
99
+ ├─────────────────────────────────────────────────────────────────┤
100
+ │ │
101
+ │ These decisions apply to ALL {len(workflows)} workflows: │
102
+ │ │
103
+ │ [Questions based on workflow types] │
104
+ │ │
105
+ └─────────────────────────────────────────────────────────────────┘
106
+ ```
107
+
108
+ Use AskUserQuestion with options based on hustle-build-defaults.json.
109
+
110
+ ### 3. Create Worktrees
111
+
112
+ For each workflow, create an isolated git worktree:
113
+
114
+ ```bash
115
+ # Create worktree with new branch
116
+ git worktree add ../parallel-users-0 -b parallel-users-0
117
+
118
+ # Copy shared decisions
119
+ cp .claude/shared-decisions.json ../parallel-users-0/.claude/
120
+ ```
121
+
122
+ ### 4. Update State
123
+
124
+ Save parallel execution state:
125
+ ```json
126
+ {
127
+ "parallel_execution": {
128
+ "enabled": true,
129
+ "worktrees": [
130
+ {"name": "parallel-users-0", "path": "../parallel-users-0", "status": "pending"},
131
+ {"name": "parallel-products-1", "path": "../parallel-products-1", "status": "pending"},
132
+ {"name": "parallel-orders-2", "path": "../parallel-orders-2", "status": "pending"}
133
+ ],
134
+ "shared_decisions": {
135
+ "auth_required": true,
136
+ "error_handling": "partial-success"
137
+ }
138
+ }
139
+ }
140
+ ```
141
+
142
+ ### 5. Spawn Task Agents
143
+
144
+ **CRITICAL: Spawn all agents in a SINGLE message with multiple Task tool calls!**
145
+
146
+ ```
147
+ Call Task tool 3 times in ONE message:
148
+
149
+ Task 1:
150
+ subagent_type: "general-purpose"
151
+ prompt: "Execute api-create users in worktree parallel-users-0..."
152
+ run_in_background: true
153
+
154
+ Task 2:
155
+ subagent_type: "general-purpose"
156
+ prompt: "Execute api-create products in worktree parallel-products-1..."
157
+ run_in_background: true
158
+
159
+ Task 3:
160
+ subagent_type: "general-purpose"
161
+ prompt: "Execute api-create orders in worktree parallel-orders-2..."
162
+ run_in_background: true
163
+ ```
164
+
165
+ ### 6. Monitor Completion
166
+
167
+ Use TaskOutput with block=false to check status:
168
+
169
+ ```
170
+ For each background agent ID:
171
+ TaskOutput(task_id=agent_id, block=false)
172
+
173
+ Update worktree status based on results.
174
+ ```
175
+
176
+ ### 7. Merge When Complete
177
+
178
+ When all agents complete:
179
+
180
+ ```bash
181
+ # Merge each worktree branch
182
+ git merge parallel-users-0 --no-ff -m "Merge parallel: users API"
183
+ git merge parallel-products-1 --no-ff -m "Merge parallel: products API"
184
+ git merge parallel-orders-2 --no-ff -m "Merge parallel: orders API"
185
+
186
+ # Clean up worktrees
187
+ git worktree remove ../parallel-users-0
188
+ git worktree remove ../parallel-products-1
189
+ git worktree remove ../parallel-orders-2
190
+ ```
191
+ </claude-commands-template>
192
+
193
+ ## Related Commands
194
+
195
+ - `/parallel-status` - Check parallel execution progress
196
+ - `/parallel-merge` - Merge all completed worktrees
197
+ - `/parallel-abort` - Cancel parallel execution and clean up
198
+ - `/ralph-status` - Check individual agent loop status
199
+
200
+ ## Configuration
201
+
202
+ In `hustle-build-defaults.json`:
203
+
204
+ ```json
205
+ {
206
+ "parallel": {
207
+ "max_worktrees": 5,
208
+ "auto_merge": false,
209
+ "cleanup_on_error": true
210
+ }
211
+ }
212
+ ```
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: ralph-continue
3
+ description: Continue or resume a paused Ralph Wiggum autonomous loop from its last state
4
+ license: MIT
5
+ compatibility: Requires Claude Code with hook_utils.py
6
+ metadata:
7
+ version: "4.5.0"
8
+ category: "workflow"
9
+ tags: ['ralph', 'autonomous', 'loop', 'resume', 'continue']
10
+ author: "Hustle Together"
11
+ allowed-tools: Read Write Task
12
+ model: sonnet
13
+ ---
14
+
15
+ # Ralph Continue
16
+
17
+ Resume a paused or interrupted Ralph Wiggum autonomous loop.
18
+
19
+ ## Usage
20
+
21
+ ```
22
+ /ralph-continue # Continue current workflow
23
+ /ralph-continue [workflow-id] # Resume specific workflow by ID
24
+ /ralph-continue --list # List resumable workflows
25
+ ```
26
+
27
+ ## What It Does
28
+
29
+ 1. **Clear Active Promise** - Removes any pending completion promise so the loop continues
30
+ 2. **Reset Iteration Counter** - Optionally reset phase iterations if stuck
31
+ 3. **Resume From Last State** - Pick up where the workflow left off
32
+ 4. **Restore Archived Workflows** - Can restore from workflow-logs if session ended
33
+
34
+ ## Examples
35
+
36
+ ### Continue After Promise Detection
37
+
38
+ When a `<promise>DONE</promise>` was detected but you want to keep going:
39
+
40
+ ```
41
+ /ralph-continue
42
+ ```
43
+
44
+ This clears the active promise and lets the autonomous loop continue.
45
+
46
+ ### Resume Interrupted Session
47
+
48
+ If your session ended mid-workflow:
49
+
50
+ ```
51
+ /ralph-continue session-20251230-143022
52
+ ```
53
+
54
+ This restores the workflow state from the archived log.
55
+
56
+ ### List Available Workflows
57
+
58
+ ```
59
+ /ralph-continue --list
60
+ ```
61
+
62
+ Output:
63
+ ```
64
+ ┌─────────────────────────────────────────────────────────────────┐
65
+ │ RESUMABLE WORKFLOWS │
66
+ ├─────────────────────────────────────────────────────────────────┤
67
+ │ │
68
+ │ Active: │
69
+ │ └─ session-20251230-150000 (user-api) - tdd_green phase │
70
+ │ │
71
+ │ Archived: │
72
+ │ └─ session-20251230-143022 - last activity: 14:45:00 │
73
+ │ └─ session-20251229-091500 - last activity: 09:30:00 (stale) │
74
+ │ │
75
+ └─────────────────────────────────────────────────────────────────┘
76
+ ```
77
+
78
+ ## Implementation
79
+
80
+ <claude-commands-template>
81
+ When /ralph-continue is invoked:
82
+
83
+ ### Without Arguments (Continue Current)
84
+
85
+ 1. Load completion-promises.json:
86
+ ```python
87
+ promise_state = load_promise_state()
88
+ ```
89
+
90
+ 2. Clear active promise:
91
+ ```python
92
+ promise_state['active_promise'] = None
93
+ save_promise_state(promise_state)
94
+ ```
95
+
96
+ 3. Load api-dev-state.json and find current phase
97
+
98
+ 4. Output continuation message:
99
+ ```
100
+ ✓ Cleared active promise
101
+ ✓ Continuing from phase: {current_phase}
102
+ ✓ Iteration {current} / {max}
103
+
104
+ The autonomous loop will now continue.
105
+ Output <promise>DONE</promise> when complete.
106
+ ```
107
+
108
+ 5. If in autonomous mode, re-invoke the current phase skill
109
+
110
+ ### With Workflow ID (Resume Specific)
111
+
112
+ 1. Use hook_utils.handle_resume(workflow_id):
113
+ ```python
114
+ from hook_utils import handle_resume
115
+ state, message = handle_resume(workflow_id)
116
+ ```
117
+
118
+ 2. If state found:
119
+ - Display what phase will resume
120
+ - Ask user to confirm
121
+ - If confirmed, re-invoke the workflow
122
+
123
+ 3. If not found:
124
+ - Show error and list available workflows
125
+
126
+ ### With --list Flag
127
+
128
+ 1. Use hook_utils.list_resumable_workflows():
129
+ ```python
130
+ from hook_utils import list_resumable_workflows
131
+ workflows = list_resumable_workflows()
132
+ ```
133
+
134
+ 2. Display formatted list as shown above
135
+
136
+ ### Reset Iterations (Optional Flag)
137
+
138
+ If `--reset-iterations` is passed:
139
+ ```python
140
+ from hook_utils import reset_phase_iterations
141
+ reset_phase_iterations()
142
+ ```
143
+
144
+ This clears all iteration counters, useful if max-iterations was hit.
145
+ </claude-commands-template>
146
+
147
+ ## Related Commands
148
+
149
+ - `/ralph-status` - Check current loop status
150
+ - `/api-create --resume [id]` - Resume with full workflow context
151
+ - `/hustle-build --resume [id]` - Resume build workflow
@@ -0,0 +1,341 @@
1
+ ---
2
+ name: ralph-loop
3
+ description: Start an autonomous loop with completion promise detection (Ralph Wiggum pattern)
4
+ license: MIT
5
+ compatibility: Requires Claude Code with completion-promise-detector hook
6
+ metadata:
7
+ version: "1.0.0"
8
+ category: "autonomous"
9
+ tags: ["ralph-wiggum", "autonomous", "loop", "continuous"]
10
+ author: "Hustle Together"
11
+ references:
12
+ - https://ghuntley.com/ralph/
13
+ - docs/CLAUDE_CODE_BEST_PRACTICES.md
14
+ allowed-tools: Bash Read Write Edit Grep Glob Task TodoWrite AskUserQuestion
15
+ ---
16
+
17
+ # Ralph Wiggum Autonomous Loop
18
+
19
+ Start a self-terminating autonomous loop. The agent works continuously until it outputs a completion promise signal, then gracefully stops.
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ /ralph-loop [task description]
25
+ /ralph-loop --promise [CUSTOM] [task description]
26
+ /ralph-loop --max [N] [task description]
27
+ /ralph-continue
28
+ /ralph-status
29
+ ```
30
+
31
+ ## Arguments
32
+
33
+ - `$ARGUMENTS` - The task to complete autonomously
34
+ - `--promise [WORD]` - Custom completion word (default: DONE)
35
+ - `--max [N]` - Maximum iterations before forced stop (safety net)
36
+
37
+ ## How It Works
38
+
39
+ ```
40
+ ┌─────────────────────────────────────────────────────────────────┐
41
+ │ RALPH WIGGUM PATTERN │
42
+ ├─────────────────────────────────────────────────────────────────┤
43
+ │ │
44
+ │ ┌──────────────────────────────────────────────────────────┐ │
45
+ │ │ AUTONOMOUS LOOP │ │
46
+ │ │ │ │
47
+ │ │ 1. Agent works on task │ │
48
+ │ │ 2. Agent self-evaluates progress │ │
49
+ │ │ 3. If done → Output <promise>DONE</promise> │ │
50
+ │ │ 4. If not done → Continue working │ │
51
+ │ │ 5. Hook detects promise → Graceful termination │ │
52
+ │ │ │ │
53
+ │ └──────────────────────────────────────────────────────────┘ │
54
+ │ │ │
55
+ │ ▼ │
56
+ │ ┌──────────────────────────────────────────────────────────┐ │
57
+ │ │ COMPLETION PROMISE DETECTOR │ │
58
+ │ │ │ │
59
+ │ │ Monitors all tool outputs for: │ │
60
+ │ │ - <promise>DONE</promise> │ │
61
+ │ │ - <promise>FIXED</promise> │ │
62
+ │ │ - <promise>COMPLETE</promise> │ │
63
+ │ │ - Custom promises via --promise flag │ │
64
+ │ │ │ │
65
+ │ └──────────────────────────────────────────────────────────┘ │
66
+ │ │
67
+ └─────────────────────────────────────────────────────────────────┘
68
+ ```
69
+
70
+ ## Built-in Completion Promises
71
+
72
+ | Promise | Use Case |
73
+ |---------|----------|
74
+ | `DONE` / `COMPLETE` / `FINISHED` | General task completion |
75
+ | `FIXED` / `RESOLVED` / `SOLVED` | Bug fixing |
76
+ | `REFACTORED` / `CLEANED` / `IMPROVED` | Code improvement |
77
+ | `TESTED` / `VERIFIED` / `VALIDATED` | Testing tasks |
78
+ | `DEPLOYED` / `SHIPPED` / `RELEASED` | Deployment tasks |
79
+
80
+ ## Phase 1: Parse Arguments
81
+
82
+ Extract from `$ARGUMENTS`:
83
+
84
+ 1. **Task Description** - What to accomplish
85
+ 2. **Custom Promise** - If `--promise` specified
86
+ 3. **Max Iterations** - If `--max` specified
87
+
88
+ ## Phase 2: Initialize Loop
89
+
90
+ 1. **Create Todo List:**
91
+ - Main task objective
92
+ - Sub-tasks as identified
93
+
94
+ 2. **Set Loop Parameters:**
95
+ ```json
96
+ {
97
+ "task": "[description]",
98
+ "completion_promise": "DONE",
99
+ "max_iterations": null,
100
+ "started_at": "[timestamp]",
101
+ "iteration": 0
102
+ }
103
+ ```
104
+
105
+ 3. **Output Initialization:**
106
+ ```
107
+ ═══════════════════════════════════════════════════════════════
108
+ RALPH WIGGUM LOOP STARTED
109
+ ═══════════════════════════════════════════════════════════════
110
+
111
+ Task: [description]
112
+ Completion Signal: <promise>DONE</promise>
113
+ Max Iterations: [N or unlimited]
114
+
115
+ The loop will continue until you output the completion signal.
116
+ Use /ralph-status to check progress.
117
+ Use /ralph-continue to override a detected promise.
118
+ ═══════════════════════════════════════════════════════════════
119
+ ```
120
+
121
+ ## Phase 3: Execute Loop
122
+
123
+ Work on the task using this pattern:
124
+
125
+ ```markdown
126
+ ## Iteration [N]
127
+
128
+ ### Current State
129
+ - What has been done
130
+ - What remains
131
+
132
+ ### This Iteration
133
+ 1. [Action 1]
134
+ 2. [Action 2]
135
+ 3. [Action 3]
136
+
137
+ ### Self-Evaluation
138
+ - [ ] Task requirement 1 met?
139
+ - [ ] Task requirement 2 met?
140
+ - [ ] All tests passing?
141
+ - [ ] Code review clean?
142
+
143
+ ### Decision
144
+ If ALL requirements met:
145
+ → Output: <promise>DONE</promise>
146
+ Else:
147
+ → Continue to next iteration
148
+ ```
149
+
150
+ ## Phase 4: Completion
151
+
152
+ When outputting a completion promise:
153
+
154
+ ```markdown
155
+ ## Task Complete
156
+
157
+ ### Summary
158
+ - What was accomplished
159
+ - Files changed
160
+ - Tests status
161
+
162
+ ### Verification
163
+ - [x] Requirement 1
164
+ - [x] Requirement 2
165
+ - [x] All tests pass
166
+
167
+ <promise>DONE</promise>
168
+ ```
169
+
170
+ The hook will detect this and allow graceful termination.
171
+
172
+ ---
173
+
174
+ ## Example Prompts
175
+
176
+ ### Feature Development
177
+ ```
178
+ /ralph-loop "Implement user authentication with JWT tokens
179
+
180
+ Requirements:
181
+ - Login endpoint at /api/auth/login
182
+ - Register endpoint at /api/auth/register
183
+ - JWT token generation and validation
184
+ - Password hashing with bcrypt
185
+ - All tests passing
186
+
187
+ Output <promise>DONE</promise> when all requirements met and tests pass."
188
+ ```
189
+
190
+ ### Bug Fixing
191
+ ```
192
+ /ralph-loop --promise FIXED "Fix the memory leak in the WebSocket handler
193
+
194
+ Steps:
195
+ 1. Identify the leak source
196
+ 2. Implement fix
197
+ 3. Add regression test
198
+ 4. Verify with memory profiler
199
+
200
+ Output <promise>FIXED</promise> when the leak is resolved."
201
+ ```
202
+
203
+ ### Refactoring
204
+ ```
205
+ /ralph-loop --max 25 "Refactor the payment module to use the new API client
206
+
207
+ Checklist:
208
+ - [ ] Update all API calls
209
+ - [ ] Maintain backward compatibility
210
+ - [ ] Update tests
211
+ - [ ] Update documentation
212
+
213
+ Output <promise>REFACTORED</promise> when complete."
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Commands
219
+
220
+ ### /ralph-continue
221
+
222
+ Override a detected promise and continue the loop:
223
+
224
+ ```
225
+ /ralph-continue
226
+ ```
227
+
228
+ Use when:
229
+ - Promise was output prematurely
230
+ - More work needed despite signal
231
+ - Testing the loop behavior
232
+
233
+ ### /ralph-status
234
+
235
+ Check current loop status:
236
+
237
+ ```
238
+ /ralph-status
239
+ ```
240
+
241
+ Shows:
242
+ - Active promise (if any)
243
+ - Recent promise history
244
+ - Current iteration count
245
+
246
+ ---
247
+
248
+ ## Best Practices
249
+
250
+ ### 1. Clear Requirements
251
+
252
+ Always specify clear, verifiable requirements:
253
+
254
+ ```markdown
255
+ Requirements:
256
+ - [ ] Feature X implemented
257
+ - [ ] Unit tests with >80% coverage
258
+ - [ ] E2E test for happy path
259
+ - [ ] No TypeScript errors
260
+ - [ ] ESLint passing
261
+ ```
262
+
263
+ ### 2. Self-Evaluation Checkpoints
264
+
265
+ Include explicit checkpoints in your prompt:
266
+
267
+ ```markdown
268
+ Before outputting DONE, verify:
269
+ 1. All requirements in the list above are checked
270
+ 2. `pnpm test` passes
271
+ 3. `pnpm lint` passes
272
+ 4. `pnpm build` succeeds
273
+ ```
274
+
275
+ ### 3. Use Max Iterations as Safety Net
276
+
277
+ Always set a reasonable max for complex tasks:
278
+
279
+ ```
280
+ /ralph-loop --max 50 "Complex refactoring task..."
281
+ ```
282
+
283
+ ### 4. Combine with Test Skills
284
+
285
+ ```
286
+ /ralph-loop "Implement feature X
287
+
288
+ After implementation, run:
289
+ - /test-unit
290
+ - /test-e2e
291
+
292
+ Only output <promise>DONE</promise> when ALL tests pass."
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Integration with Hustle Build
298
+
299
+ The `/hustle-build --auto` mode uses Ralph Wiggum internally:
300
+
301
+ ```
302
+ /hustle-build --auto --max-iterations 10 "Build a photo gallery"
303
+ ```
304
+
305
+ This:
306
+ 1. Starts autonomous build loop
307
+ 2. Uses completion promise detection
308
+ 3. Falls back to max-iterations if needed
309
+
310
+ ---
311
+
312
+ ## Troubleshooting
313
+
314
+ ### Promise Not Detected
315
+
316
+ Ensure exact format: `<promise>DONE</promise>`
317
+ - Must have angle brackets
318
+ - Must be uppercase
319
+ - No extra whitespace inside tags
320
+
321
+ ### Loop Won't Stop
322
+
323
+ Check:
324
+ 1. `/ralph-status` - Is promise active?
325
+ 2. Hook enabled in settings?
326
+ 3. Try `/ralph-continue` then manually stop
327
+
328
+ ### Infinite Loop
329
+
330
+ Safety measures:
331
+ 1. Use `--max [N]` flag
332
+ 2. Context window will eventually fill
333
+ 3. Manual Ctrl+C always works
334
+
335
+ ---
336
+
337
+ ## See Also
338
+
339
+ - [Completion Promise Detector Hook](../../hooks/completion-promise-detector.py)
340
+ - [CLAUDE_CODE_BEST_PRACTICES.md](../../docs/CLAUDE_CODE_BEST_PRACTICES.md) - Ralph Wiggum section
341
+ - [/hustle-build skill](../hustle-build/SKILL.md) - Uses this pattern internally