oh-my-claude-sisyphus 3.8.14 → 3.8.16

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 (150) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +9 -11
  4. package/bridge/mcp-server.cjs +180 -180
  5. package/commands/autopilot.md +2 -6
  6. package/commands/hud.md +7 -2
  7. package/commands/ralph.md +3 -3
  8. package/commands/ultrapilot.md +2 -6
  9. package/dist/__tests__/delegation-enforcement-levels.test.js +0 -1
  10. package/dist/__tests__/delegation-enforcement-levels.test.js.map +1 -1
  11. package/dist/__tests__/hooks/learner/parser.test.d.ts +5 -0
  12. package/dist/__tests__/hooks/learner/parser.test.d.ts.map +1 -0
  13. package/dist/__tests__/hooks/learner/parser.test.js +201 -0
  14. package/dist/__tests__/hooks/learner/parser.test.js.map +1 -0
  15. package/dist/__tests__/hud/cwd.test.d.ts +2 -0
  16. package/dist/__tests__/hud/cwd.test.d.ts.map +1 -0
  17. package/dist/__tests__/hud/cwd.test.js +62 -0
  18. package/dist/__tests__/hud/cwd.test.js.map +1 -0
  19. package/dist/__tests__/hud/defaults.test.d.ts +2 -0
  20. package/dist/__tests__/hud/defaults.test.d.ts.map +1 -0
  21. package/dist/__tests__/hud/defaults.test.js +21 -0
  22. package/dist/__tests__/hud/defaults.test.js.map +1 -0
  23. package/dist/__tests__/hud/render.test.d.ts +2 -0
  24. package/dist/__tests__/hud/render.test.d.ts.map +1 -0
  25. package/dist/__tests__/hud/render.test.js +141 -0
  26. package/dist/__tests__/hud/render.test.js.map +1 -0
  27. package/dist/__tests__/hud/thinking.test.d.ts +2 -0
  28. package/dist/__tests__/hud/thinking.test.d.ts.map +1 -0
  29. package/dist/__tests__/hud/thinking.test.js +32 -0
  30. package/dist/__tests__/hud/thinking.test.js.map +1 -0
  31. package/dist/__tests__/mnemosyne/parser.test.js +1 -1
  32. package/dist/__tests__/mnemosyne/parser.test.js.map +1 -1
  33. package/dist/features/continuation-enforcement.js +1 -1
  34. package/dist/features/state-manager/index.d.ts.map +1 -1
  35. package/dist/features/state-manager/index.js +7 -4
  36. package/dist/features/state-manager/index.js.map +1 -1
  37. package/dist/features/verification/example.d.ts.map +1 -1
  38. package/dist/features/verification/example.js +4 -2
  39. package/dist/features/verification/example.js.map +1 -1
  40. package/dist/hooks/bridge.d.ts.map +1 -1
  41. package/dist/hooks/bridge.js +4 -24
  42. package/dist/hooks/bridge.js.map +1 -1
  43. package/dist/hooks/index.d.ts +1 -1
  44. package/dist/hooks/index.d.ts.map +1 -1
  45. package/dist/hooks/index.js +1 -1
  46. package/dist/hooks/index.js.map +1 -1
  47. package/dist/hooks/learner/parser.d.ts.map +1 -1
  48. package/dist/hooks/learner/parser.js +12 -5
  49. package/dist/hooks/learner/parser.js.map +1 -1
  50. package/dist/hooks/mode-registry/index.d.ts +2 -0
  51. package/dist/hooks/mode-registry/index.d.ts.map +1 -1
  52. package/dist/hooks/mode-registry/index.js +8 -19
  53. package/dist/hooks/mode-registry/index.js.map +1 -1
  54. package/dist/hooks/persistent-mode/index.d.ts +1 -1
  55. package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
  56. package/dist/hooks/persistent-mode/index.js +5 -33
  57. package/dist/hooks/persistent-mode/index.js.map +1 -1
  58. package/dist/hooks/ralph/index.d.ts +1 -1
  59. package/dist/hooks/ralph/index.d.ts.map +1 -1
  60. package/dist/hooks/ralph/index.js +1 -1
  61. package/dist/hooks/ralph/index.js.map +1 -1
  62. package/dist/hooks/ralph/loop.d.ts +1 -9
  63. package/dist/hooks/ralph/loop.d.ts.map +1 -1
  64. package/dist/hooks/ralph/loop.js +1 -37
  65. package/dist/hooks/ralph/loop.js.map +1 -1
  66. package/dist/hooks/ralph/prd.js +1 -1
  67. package/dist/hooks/ralph/verifier.d.ts +4 -5
  68. package/dist/hooks/ralph/verifier.d.ts.map +1 -1
  69. package/dist/hooks/ralph/verifier.js +7 -10
  70. package/dist/hooks/ralph/verifier.js.map +1 -1
  71. package/dist/hooks/session-end/index.d.ts +13 -0
  72. package/dist/hooks/session-end/index.d.ts.map +1 -1
  73. package/dist/hooks/session-end/index.js +69 -0
  74. package/dist/hooks/session-end/index.js.map +1 -1
  75. package/dist/hooks/ultrawork/index.d.ts +2 -2
  76. package/dist/hooks/ultrawork/index.d.ts.map +1 -1
  77. package/dist/hooks/ultrawork/index.js +2 -46
  78. package/dist/hooks/ultrawork/index.js.map +1 -1
  79. package/dist/hud/elements/cwd.d.ts +15 -0
  80. package/dist/hud/elements/cwd.d.ts.map +1 -0
  81. package/dist/hud/elements/cwd.js +39 -0
  82. package/dist/hud/elements/cwd.js.map +1 -0
  83. package/dist/hud/elements/index.d.ts +1 -0
  84. package/dist/hud/elements/index.d.ts.map +1 -1
  85. package/dist/hud/elements/index.js +1 -0
  86. package/dist/hud/elements/index.js.map +1 -1
  87. package/dist/hud/elements/thinking.d.ts +7 -5
  88. package/dist/hud/elements/thinking.d.ts.map +1 -1
  89. package/dist/hud/elements/thinking.js +18 -6
  90. package/dist/hud/elements/thinking.js.map +1 -1
  91. package/dist/hud/index.js +5 -3
  92. package/dist/hud/index.js.map +1 -1
  93. package/dist/hud/omc-state.d.ts +1 -1
  94. package/dist/hud/omc-state.d.ts.map +1 -1
  95. package/dist/hud/omc-state.js +14 -31
  96. package/dist/hud/omc-state.js.map +1 -1
  97. package/dist/hud/render.d.ts +9 -0
  98. package/dist/hud/render.d.ts.map +1 -1
  99. package/dist/hud/render.js +27 -7
  100. package/dist/hud/render.js.map +1 -1
  101. package/dist/hud/state.d.ts +2 -2
  102. package/dist/hud/state.d.ts.map +1 -1
  103. package/dist/hud/state.js +4 -33
  104. package/dist/hud/state.js.map +1 -1
  105. package/dist/hud/transcript.d.ts +4 -1
  106. package/dist/hud/transcript.d.ts.map +1 -1
  107. package/dist/hud/transcript.js +4 -9
  108. package/dist/hud/transcript.js.map +1 -1
  109. package/dist/hud/types.d.ts +20 -1
  110. package/dist/hud/types.d.ts.map +1 -1
  111. package/dist/hud/types.js +38 -9
  112. package/dist/hud/types.js.map +1 -1
  113. package/dist/installer/hooks.d.ts +1 -1
  114. package/dist/installer/hooks.d.ts.map +1 -1
  115. package/dist/installer/hooks.js +1 -1
  116. package/docs/AGENTS.md +100 -0
  117. package/docs/ARCHITECTURE.md +11 -7
  118. package/docs/CLAUDE.md +1 -3
  119. package/docs/DELEGATION-ENFORCER.md +1 -2
  120. package/docs/MIGRATION.md +1 -1
  121. package/docs/REFERENCE.md +29 -9
  122. package/docs/SYNC-SYSTEM.md +0 -2
  123. package/package.json +1 -1
  124. package/scripts/persistent-mode.mjs +88 -61
  125. package/scripts/test-mutual-exclusion.ts +3 -3
  126. package/skills/AGENTS.md +59 -44
  127. package/skills/autopilot/SKILL.md +0 -2
  128. package/skills/cancel/SKILL.md +13 -32
  129. package/skills/ecomode/SKILL.md +0 -1
  130. package/skills/hud/SKILL.md +3 -2
  131. package/skills/ralph/SKILL.md +9 -19
  132. package/skills/ultrawork/SKILL.md +0 -1
  133. package/templates/hooks/persistent-mode.mjs +78 -40
  134. package/agents/AGENTS.md +0 -144
  135. package/dist/hooks/clear-suggestions/constants.d.ts +0 -54
  136. package/dist/hooks/clear-suggestions/constants.d.ts.map +0 -1
  137. package/dist/hooks/clear-suggestions/constants.js +0 -102
  138. package/dist/hooks/clear-suggestions/constants.js.map +0 -1
  139. package/dist/hooks/clear-suggestions/index.d.ts +0 -61
  140. package/dist/hooks/clear-suggestions/index.d.ts.map +0 -1
  141. package/dist/hooks/clear-suggestions/index.js +0 -282
  142. package/dist/hooks/clear-suggestions/index.js.map +0 -1
  143. package/dist/hooks/clear-suggestions/triggers.d.ts +0 -65
  144. package/dist/hooks/clear-suggestions/triggers.d.ts.map +0 -1
  145. package/dist/hooks/clear-suggestions/triggers.js +0 -222
  146. package/dist/hooks/clear-suggestions/triggers.js.map +0 -1
  147. package/dist/hooks/clear-suggestions/types.d.ts +0 -92
  148. package/dist/hooks/clear-suggestions/types.d.ts.map +0 -1
  149. package/dist/hooks/clear-suggestions/types.js +0 -9
  150. package/dist/hooks/clear-suggestions/types.js.map +0 -1
@@ -136,7 +136,6 @@ When ecomode completes (all verification passes):
136
136
  ```bash
137
137
  # Delete ecomode state files
138
138
  rm -f .omc/state/ecomode-state.json
139
- rm -f ~/.claude/ecomode-state.json
140
139
  ```
141
140
 
142
141
  This ensures clean state for future sessions. Stale state files with `active: false` should not be left behind.
@@ -246,7 +246,7 @@ HUD config is stored at: `~/.claude/.omc/hud-config.json`
246
246
 
247
247
  ## Manual Configuration
248
248
 
249
- You can manually edit the config file:
249
+ You can manually edit the config file. Each option can be set individually - any unset values will use defaults.
250
250
 
251
251
  ```json
252
252
  {
@@ -262,7 +262,8 @@ You can manually edit the config file:
262
262
  "backgroundTasks": true,
263
263
  "todos": true,
264
264
  "showCache": true,
265
- "showCost": true
265
+ "showCost": true,
266
+ "maxOutputLines": 4
266
267
  },
267
268
  "thresholds": {
268
269
  "contextWarning": 70,
@@ -176,10 +176,10 @@ When you believe the task is complete:
176
176
 
177
177
  2. **Wait for Architect's assessment**
178
178
 
179
- 3. **If Architect approves**: Output `<promise>{{PROMISE}}</promise>`
179
+ 3. **If Architect approves**: Run `/oh-my-claudecode:cancel` to cleanly exit ralph mode
180
180
  4. **If Architect finds issues**: Fix them, then repeat verification
181
181
 
182
- DO NOT output the completion promise without Architect verification.
182
+ DO NOT exit without Architect verification.
183
183
 
184
184
  ## ZERO TOLERANCE
185
185
 
@@ -190,31 +190,21 @@ DO NOT output the completion promise without Architect verification.
190
190
 
191
191
  ## STATE CLEANUP ON COMPLETION
192
192
 
193
- **IMPORTANT: Delete state files on successful completion - do NOT just set `active: false`**
193
+ **IMPORTANT: Use the cancel skill for proper state cleanup**
194
194
 
195
- When outputting the completion promise after Architect verification:
195
+ When work is complete and Architect verification passes, run `/oh-my-claudecode:cancel` to cleanly exit ralph mode. This handles:
196
+ - Deletion of ralph state files (both local and global)
197
+ - Cleanup of linked ultrawork or ecomode state
198
+ - Proper termination of the ralph loop
196
199
 
197
- ```bash
198
- # Delete ralph state file (and linked ultrawork if applicable)
199
- rm -f .omc/state/ralph-state.json
200
- rm -f .omc/state/ralph-verification.json
201
- rm -f ~/.claude/ralph-state.json
202
-
203
- # If ultrawork was linked, delete it too
204
- rm -f .omc/state/ultrawork-state.json
205
- rm -f ~/.claude/ultrawork-state.json
206
- ```
207
-
208
- This ensures clean state for future sessions. Stale state files with `active: false` should not be left behind.
200
+ This ensures clean state for future sessions without leaving stale state files behind.
209
201
 
210
202
  ## INSTRUCTIONS
211
203
 
212
204
  - Review your progress so far
213
205
  - Continue from where you left off
214
206
  - Use parallel execution and background tasks
215
- - When FULLY complete AND Architect verified:
216
- 1. Clean up state files (delete ralph-state.json, ultrawork-state.json)
217
- 2. Output: <promise>{{PROMISE}}</promise>
207
+ - When FULLY complete AND Architect verified: Run `/oh-my-claudecode:cancel` to cleanly exit and clean up all state files
218
208
  - Do not stop until the task is truly done
219
209
 
220
210
  Original task:
@@ -100,7 +100,6 @@ When all verification passes and work is complete:
100
100
  ```bash
101
101
  # Delete ultrawork state files
102
102
  rm -f .omc/state/ultrawork-state.json
103
- rm -f ~/.claude/ultrawork-state.json
104
103
  ```
105
104
 
106
105
  This ensures clean state for future sessions. Stale state files with `active: false` should not be left behind.
@@ -43,6 +43,31 @@ function writeJsonFile(path, data) {
43
43
  }
44
44
  }
45
45
 
46
+ /**
47
+ * Staleness threshold for mode states (2 hours in milliseconds).
48
+ * States older than this are treated as inactive to prevent stale state
49
+ * from causing the stop hook to malfunction in new sessions.
50
+ */
51
+ const STALE_STATE_THRESHOLD_MS = 2 * 60 * 60 * 1000; // 2 hours
52
+
53
+ /**
54
+ * Check if a state is stale based on its timestamps.
55
+ * A state is considered stale if it hasn't been updated recently.
56
+ * We check both `last_checked_at` and `started_at` - using whichever is more recent.
57
+ */
58
+ function isStaleState(state) {
59
+ if (!state) return true;
60
+
61
+ const lastChecked = state.last_checked_at ? new Date(state.last_checked_at).getTime() : 0;
62
+ const startedAt = state.started_at ? new Date(state.started_at).getTime() : 0;
63
+ const mostRecent = Math.max(lastChecked, startedAt);
64
+
65
+ if (mostRecent === 0) return true; // No valid timestamps
66
+
67
+ const age = Date.now() - mostRecent;
68
+ return age > STALE_STATE_THRESHOLD_MS;
69
+ }
70
+
46
71
  /**
47
72
  * Read state file from local or global location, tracking the source.
48
73
  */
@@ -206,34 +231,37 @@ async function main() {
206
231
  const totalIncomplete = taskCount + todoCount;
207
232
 
208
233
  // Priority 1: Ralph Loop (explicit persistence mode)
209
- if (ralph.state?.active) {
234
+ // Skip if state is stale (older than 2 hours) - prevents blocking new sessions
235
+ if (ralph.state?.active && !isStaleState(ralph.state)) {
210
236
  const iteration = ralph.state.iteration || 1;
211
237
  const maxIter = ralph.state.max_iterations || 100;
212
238
 
213
239
  if (iteration < maxIter) {
214
240
  ralph.state.iteration = iteration + 1;
241
+ ralph.state.last_checked_at = new Date().toISOString();
215
242
  writeJsonFile(ralph.path, ralph.state);
216
243
 
217
244
  console.log(JSON.stringify({
218
- continue: true,
219
- message: `[RALPH LOOP - ITERATION ${iteration + 1}/${maxIter}] Work is NOT done. Continue. When complete, output: <promise>${ralph.state.completion_promise || 'DONE'}</promise>\n${ralph.state.prompt ? `Task: ${ralph.state.prompt}` : ''}`
245
+ decision: 'block',
246
+ reason: `[RALPH LOOP - ITERATION ${iteration + 1}/${maxIter}] Work is NOT done. Continue working.\nWhen FULLY complete (after Architect verification), run /oh-my-claudecode:cancel to cleanly exit ralph mode and clean up all state files. If cancel fails, retry with /oh-my-claudecode:cancel --force.\n${ralph.state.prompt ? `Task: ${ralph.state.prompt}` : ''}`
220
247
  }));
221
248
  return;
222
249
  }
223
250
  }
224
251
 
225
252
  // Priority 2: Autopilot (high-level orchestration)
226
- if (autopilot.state?.active) {
253
+ if (autopilot.state?.active && !isStaleState(autopilot.state)) {
227
254
  const phase = autopilot.state.phase || 'unknown';
228
255
  if (phase !== 'complete') {
229
256
  const newCount = (autopilot.state.reinforcement_count || 0) + 1;
230
257
  if (newCount <= 20) {
231
258
  autopilot.state.reinforcement_count = newCount;
259
+ autopilot.state.last_checked_at = new Date().toISOString();
232
260
  writeJsonFile(autopilot.path, autopilot.state);
233
261
 
234
262
  console.log(JSON.stringify({
235
- continue: true,
236
- message: `[AUTOPILOT - Phase: ${phase}] Autopilot not complete. Continue working.`
263
+ decision: 'block',
264
+ reason: `[AUTOPILOT - Phase: ${phase}] Autopilot not complete. Continue working. When all phases are complete, run /oh-my-claudecode:cancel to cleanly exit and clean up state files. If cancel fails, retry with /oh-my-claudecode:cancel --force.`
237
265
  }));
238
266
  return;
239
267
  }
@@ -241,18 +269,19 @@ async function main() {
241
269
  }
242
270
 
243
271
  // Priority 3: Ultrapilot (parallel autopilot)
244
- if (ultrapilot.state?.active) {
272
+ if (ultrapilot.state?.active && !isStaleState(ultrapilot.state)) {
245
273
  const workers = ultrapilot.state.workers || [];
246
274
  const incomplete = workers.filter(w => w.status !== 'complete' && w.status !== 'failed').length;
247
275
  if (incomplete > 0) {
248
276
  const newCount = (ultrapilot.state.reinforcement_count || 0) + 1;
249
277
  if (newCount <= 20) {
250
278
  ultrapilot.state.reinforcement_count = newCount;
279
+ ultrapilot.state.last_checked_at = new Date().toISOString();
251
280
  writeJsonFile(ultrapilot.path, ultrapilot.state);
252
281
 
253
282
  console.log(JSON.stringify({
254
- continue: true,
255
- message: `[ULTRAPILOT] ${incomplete} workers still running. Continue.`
283
+ decision: 'block',
284
+ reason: `[ULTRAPILOT] ${incomplete} workers still running. Continue working. When all workers complete, run /oh-my-claudecode:cancel to cleanly exit and clean up state files. If cancel fails, retry with /oh-my-claudecode:cancel --force.`
256
285
  }));
257
286
  return;
258
287
  }
@@ -260,17 +289,18 @@ async function main() {
260
289
  }
261
290
 
262
291
  // Priority 4: Swarm (coordinated agents with SQLite)
263
- if (swarmMarker && swarmSummary?.active) {
292
+ if (swarmMarker && swarmSummary?.active && !isStaleState(swarmSummary)) {
264
293
  const pending = (swarmSummary.tasks_pending || 0) + (swarmSummary.tasks_claimed || 0);
265
294
  if (pending > 0) {
266
295
  const newCount = (swarmSummary.reinforcement_count || 0) + 1;
267
296
  if (newCount <= 15) {
268
297
  swarmSummary.reinforcement_count = newCount;
298
+ swarmSummary.last_checked_at = new Date().toISOString();
269
299
  writeJsonFile(join(stateDir, 'swarm-summary.json'), swarmSummary);
270
300
 
271
301
  console.log(JSON.stringify({
272
- continue: true,
273
- message: `[SWARM ACTIVE] ${pending} tasks remain. Continue working.`
302
+ decision: 'block',
303
+ reason: `[SWARM ACTIVE] ${pending} tasks remain. Continue working. When all tasks are done, run /oh-my-claudecode:cancel to cleanly exit and clean up state files. If cancel fails, retry with /oh-my-claudecode:cancel --force.`
274
304
  }));
275
305
  return;
276
306
  }
@@ -278,18 +308,19 @@ async function main() {
278
308
  }
279
309
 
280
310
  // Priority 5: Pipeline (sequential stages)
281
- if (pipeline.state?.active) {
311
+ if (pipeline.state?.active && !isStaleState(pipeline.state)) {
282
312
  const currentStage = pipeline.state.current_stage || 0;
283
313
  const totalStages = pipeline.state.stages?.length || 0;
284
314
  if (currentStage < totalStages) {
285
315
  const newCount = (pipeline.state.reinforcement_count || 0) + 1;
286
316
  if (newCount <= 15) {
287
317
  pipeline.state.reinforcement_count = newCount;
318
+ pipeline.state.last_checked_at = new Date().toISOString();
288
319
  writeJsonFile(pipeline.path, pipeline.state);
289
320
 
290
321
  console.log(JSON.stringify({
291
- continue: true,
292
- message: `[PIPELINE - Stage ${currentStage + 1}/${totalStages}] Pipeline not complete. Continue.`
322
+ decision: 'block',
323
+ reason: `[PIPELINE - Stage ${currentStage + 1}/${totalStages}] Pipeline not complete. Continue working. When all stages complete, run /oh-my-claudecode:cancel to cleanly exit and clean up state files. If cancel fails, retry with /oh-my-claudecode:cancel --force.`
293
324
  }));
294
325
  return;
295
326
  }
@@ -297,16 +328,17 @@ async function main() {
297
328
  }
298
329
 
299
330
  // Priority 6: UltraQA (QA cycling)
300
- if (ultraqa.state?.active) {
331
+ if (ultraqa.state?.active && !isStaleState(ultraqa.state)) {
301
332
  const cycle = ultraqa.state.cycle || 1;
302
333
  const maxCycles = ultraqa.state.max_cycles || 10;
303
334
  if (cycle < maxCycles && !ultraqa.state.all_passing) {
304
335
  ultraqa.state.cycle = cycle + 1;
336
+ ultraqa.state.last_checked_at = new Date().toISOString();
305
337
  writeJsonFile(ultraqa.path, ultraqa.state);
306
338
 
307
339
  console.log(JSON.stringify({
308
- continue: true,
309
- message: `[ULTRAQA - Cycle ${cycle + 1}/${maxCycles}] Tests not all passing. Continue fixing.`
340
+ decision: 'block',
341
+ reason: `[ULTRAQA - Cycle ${cycle + 1}/${maxCycles}] Tests not all passing. Continue fixing. When all tests pass, run /oh-my-claudecode:cancel to cleanly exit and clean up state files. If cancel fails, retry with /oh-my-claudecode:cancel --force.`
310
342
  }));
311
343
  return;
312
344
  }
@@ -314,15 +346,13 @@ async function main() {
314
346
 
315
347
  // Priority 7: Ultrawork - ALWAYS continue while active (not just when tasks exist)
316
348
  // This prevents false stops from bash errors, transient failures, etc.
317
- if (ultrawork.state?.active) {
349
+ if (ultrawork.state?.active && !isStaleState(ultrawork.state)) {
318
350
  const newCount = (ultrawork.state.reinforcement_count || 0) + 1;
319
351
  const maxReinforcements = ultrawork.state.max_reinforcements || 50;
320
352
 
321
353
  if (newCount > maxReinforcements) {
322
- console.log(JSON.stringify({
323
- continue: true,
324
- reason: `[ULTRAWORK ESCAPE] Max reinforcements (${maxReinforcements}) reached. Allowing stop.`
325
- }));
354
+ // Max reinforcements reached - allow stop
355
+ console.log(JSON.stringify({ continue: true }));
326
356
  return;
327
357
  }
328
358
 
@@ -330,48 +360,56 @@ async function main() {
330
360
  ultrawork.state.last_checked_at = new Date().toISOString();
331
361
  writeJsonFile(ultrawork.path, ultrawork.state);
332
362
 
333
- let reason = `[ULTRAWORK #${newCount}] Mode active - continue working.`;
363
+ let reason = `[ULTRAWORK #${newCount}/${maxReinforcements}] Mode active.`;
364
+
334
365
  if (totalIncomplete > 0) {
335
366
  const itemType = taskCount > 0 ? 'Tasks' : 'todos';
336
- reason = `[ULTRAWORK #${newCount}] ${totalIncomplete} incomplete ${itemType}. Continue working.`;
367
+ reason += ` ${totalIncomplete} incomplete ${itemType} remain. Continue working.`;
368
+ } else if (newCount >= 3) {
369
+ // Only suggest cancel after minimum iterations (guard against no-tasks-created scenario)
370
+ reason += ` If all work is complete, run /oh-my-claudecode:cancel to cleanly exit ultrawork mode and clean up state files. If cancel fails, retry with /oh-my-claudecode:cancel --force. Otherwise, continue working.`;
371
+ } else {
372
+ // Early iterations with no tasks yet - just tell LLM to continue
373
+ reason += ` Continue working - create Tasks to track your progress.`;
337
374
  }
375
+
338
376
  if (ultrawork.state.original_prompt) {
339
377
  reason += `\nTask: ${ultrawork.state.original_prompt}`;
340
378
  }
341
379
 
342
- console.log(JSON.stringify({
343
- continue: true,
344
- message: reason
345
- }));
380
+ console.log(JSON.stringify({ decision: 'block', reason }));
346
381
  return;
347
382
  }
348
383
 
349
384
  // Priority 8: Ecomode - ALWAYS continue while active
350
- if (ecomode.state?.active) {
385
+ if (ecomode.state?.active && !isStaleState(ecomode.state)) {
351
386
  const newCount = (ecomode.state.reinforcement_count || 0) + 1;
352
387
  const maxReinforcements = ecomode.state.max_reinforcements || 50;
353
388
 
354
389
  if (newCount > maxReinforcements) {
355
- console.log(JSON.stringify({
356
- continue: true,
357
- reason: `[ECOMODE ESCAPE] Max reinforcements (${maxReinforcements}) reached. Allowing stop.`
358
- }));
390
+ // Max reinforcements reached - allow stop
391
+ console.log(JSON.stringify({ continue: true }));
359
392
  return;
360
393
  }
361
394
 
362
395
  ecomode.state.reinforcement_count = newCount;
396
+ ecomode.state.last_checked_at = new Date().toISOString();
363
397
  writeJsonFile(ecomode.path, ecomode.state);
364
398
 
365
- let reason = `[ECOMODE #${newCount}] Mode active - continue working.`;
399
+ let reason = `[ECOMODE #${newCount}/${maxReinforcements}] Mode active.`;
400
+
366
401
  if (totalIncomplete > 0) {
367
402
  const itemType = taskCount > 0 ? 'Tasks' : 'todos';
368
- reason = `[ECOMODE #${newCount}] ${totalIncomplete} incomplete ${itemType}. Continue working.`;
403
+ reason += ` ${totalIncomplete} incomplete ${itemType} remain. Continue working.`;
404
+ } else if (newCount >= 3) {
405
+ // Only suggest cancel after minimum iterations (guard against no-tasks-created scenario)
406
+ reason += ` If all work is complete, run /oh-my-claudecode:cancel to cleanly exit ecomode and clean up state files. If cancel fails, retry with /oh-my-claudecode:cancel --force. Otherwise, continue working.`;
407
+ } else {
408
+ // Early iterations with no tasks yet - just tell LLM to continue
409
+ reason += ` Continue working - create Tasks to track your progress.`;
369
410
  }
370
411
 
371
- console.log(JSON.stringify({
372
- continue: true,
373
- message: reason
374
- }));
412
+ console.log(JSON.stringify({ decision: 'block', reason }));
375
413
  return;
376
414
  }
377
415
 
package/agents/AGENTS.md DELETED
@@ -1,144 +0,0 @@
1
- <!-- Parent: ../AGENTS.md -->
2
- <!-- Generated: 2026-01-28 | Updated: 2026-01-28 -->
3
-
4
- # agents (Prompt Templates)
5
-
6
- Markdown prompt templates for all 32 agents in oh-my-claudecode.
7
-
8
- ## Purpose
9
-
10
- This directory contains the prompt templates that define agent behavior. Each file is a markdown document with YAML frontmatter for metadata, loaded dynamically by `src/agents/definitions.ts`.
11
-
12
- ## Key Files
13
-
14
- | File | Agent | Model | Purpose |
15
- |------|-------|-------|---------|
16
- | `architect.md` | architect | opus | Architecture, debugging, root cause analysis |
17
- | `architect-medium.md` | architect-medium | sonnet | Moderate analysis tasks |
18
- | `architect-low.md` | architect-low | haiku | Quick code questions |
19
- | `executor.md` | executor | sonnet | Focused task implementation |
20
- | `executor-high.md` | executor-high | opus | Complex multi-file changes |
21
- | `executor-low.md` | executor-low | haiku | Simple single-file tasks |
22
- | `explore.md` | explore | haiku | Fast codebase search |
23
- | `explore-medium.md` | explore-medium | sonnet | Thorough search with reasoning |
24
- | `explore-high.md` | explore-high | opus | Architectural discovery |
25
- | `designer.md` | designer | sonnet | UI/UX, component design |
26
- | `designer-high.md` | designer-high | opus | Complex UI architecture |
27
- | `designer-low.md` | designer-low | haiku | Simple styling tweaks |
28
- | `researcher.md` | researcher | sonnet | Documentation research |
29
- | `researcher-low.md` | researcher-low | haiku | Quick doc lookups |
30
- | `writer.md` | writer | haiku | Technical documentation |
31
- | `vision.md` | vision | sonnet | Image/screenshot analysis |
32
- | `critic.md` | critic | opus | Critical plan review |
33
- | `analyst.md` | analyst | opus | Pre-planning requirements |
34
- | `planner.md` | planner | opus | Strategic planning |
35
- | `qa-tester.md` | qa-tester | sonnet | Interactive CLI testing |
36
- | `qa-tester-high.md` | qa-tester-high | opus | Production-ready QA |
37
- | `scientist.md` | scientist | sonnet | Data analysis |
38
- | `scientist-high.md` | scientist-high | opus | Complex ML/research |
39
- | `scientist-low.md` | scientist-low | haiku | Quick data inspection |
40
- | `security-reviewer.md` | security-reviewer | opus | Security audits |
41
- | `security-reviewer-low.md` | security-reviewer-low | haiku | Quick security scans |
42
- | `build-fixer.md` | build-fixer | sonnet | Build error resolution |
43
- | `build-fixer-low.md` | build-fixer-low | haiku | Simple type errors |
44
- | `tdd-guide.md` | tdd-guide | sonnet | TDD workflow |
45
- | `tdd-guide-low.md` | tdd-guide-low | haiku | Test suggestions |
46
- | `code-reviewer.md` | code-reviewer | opus | Expert code review |
47
- | `code-reviewer-low.md` | code-reviewer-low | haiku | Quick code checks |
48
-
49
- ## For AI Agents
50
-
51
- ### Working In This Directory
52
-
53
- #### Prompt Template Format
54
-
55
- Each file follows this structure:
56
- ```markdown
57
- ---
58
- name: agent-name
59
- description: Brief description of what this agent does
60
- model: opus | sonnet | haiku
61
- tools: [Read, Glob, Grep, ...]
62
- ---
63
-
64
- # Agent Name
65
-
66
- ## Role
67
- What this agent is and its expertise.
68
-
69
- ## Instructions
70
- Detailed instructions for how the agent should behave.
71
-
72
- ## Constraints
73
- What the agent should NOT do.
74
-
75
- ## Output Format
76
- How results should be formatted.
77
- ```
78
-
79
- #### Creating a New Agent Prompt
80
-
81
- 1. Create `new-agent.md` with YAML frontmatter
82
- 2. Define clear role, instructions, and constraints
83
- 3. Reference in `src/agents/definitions.ts`
84
-
85
- #### Tiered Variants
86
-
87
- For model routing, create variants with complexity-appropriate instructions:
88
-
89
- | Tier | File Suffix | Instructions Focus |
90
- |------|-------------|-------------------|
91
- | LOW (Haiku) | `-low.md` | Quick, simple tasks, minimal reasoning |
92
- | MEDIUM (Sonnet) | Base file or `-medium.md` | Standard complexity |
93
- | HIGH (Opus) | `-high.md` | Complex reasoning, deep analysis |
94
-
95
- ### Common Patterns
96
-
97
- **Frontmatter parsing** (in `definitions.ts`):
98
- ```typescript
99
- function loadAgentPrompt(agentName: string): string {
100
- const content = readFileSync(`agents/${agentName}.md`, 'utf-8');
101
- const match = content.match(/^---[\s\S]*?---\s*([\s\S]*)$/);
102
- return match ? match[1].trim() : content.trim();
103
- }
104
- ```
105
-
106
- **Tool assignment by agent type:**
107
- - Read-only: `[Read, Glob, Grep]`
108
- - Analysis: `[Read, Glob, Grep, WebSearch, WebFetch]`
109
- - Execution: `[Read, Glob, Grep, Edit, Write, Bash, TodoWrite]`
110
- - Data: `[Read, Glob, Grep, Bash, python_repl]`
111
-
112
- ### Testing Requirements
113
-
114
- Agent prompts are tested via integration tests that spawn agents and verify behavior.
115
-
116
- ## Dependencies
117
-
118
- ### Internal
119
- - Loaded by `src/agents/definitions.ts`
120
- - Referenced by skill definitions in `skills/`
121
-
122
- ### External
123
- None - pure markdown files.
124
-
125
- ## Agent Categories
126
-
127
- | Category | Agents | Common Tools |
128
- |----------|--------|--------------|
129
- | Analysis | architect, architect-medium, architect-low | Read, Glob, Grep, lsp_diagnostics |
130
- | Execution | executor, executor-low, executor-high | Read, Glob, Grep, Edit, Write, Bash, lsp_diagnostics |
131
- | Search | explore, explore-medium, explore-high | Read, Glob, Grep, ast_grep_search, lsp_document_symbols, lsp_workspace_symbols |
132
- | Research | researcher, researcher-low | WebSearch, WebFetch |
133
- | Frontend | designer, designer-low, designer-high | Edit, Write, Bash |
134
- | Docs | writer | Edit, Write |
135
- | Visual | vision | Read, Glob, Grep |
136
- | Planning | planner, analyst, critic | Read, Glob, Grep |
137
- | Testing | qa-tester, qa-tester-high | Bash, Read, Grep, Glob, TodoWrite, lsp_diagnostics |
138
- | Security | security-reviewer, security-reviewer-low | Read, Grep, Bash |
139
- | Build | build-fixer, build-fixer-low | Read, Glob, Grep, Edit, Write, Bash, lsp_diagnostics, lsp_diagnostics_directory |
140
- | TDD | tdd-guide, tdd-guide-low | Read, Grep, Glob, Bash, lsp_diagnostics |
141
- | Review | code-reviewer, code-reviewer-low | Read, Grep, Glob, Bash, lsp_diagnostics |
142
- | Data | scientist, scientist-low, scientist-high | Read, Glob, Grep, Bash, python_repl |
143
-
144
- <!-- MANUAL: -->
@@ -1,54 +0,0 @@
1
- /**
2
- * Clear Suggestions Constants
3
- *
4
- * Messages, thresholds, and configuration defaults for the
5
- * adaptive /clear suggestions system.
6
- */
7
- /**
8
- * Cooldown period between clear suggestions (5 minutes)
9
- */
10
- export declare const CLEAR_SUGGESTION_COOLDOWN_MS: number;
11
- /**
12
- * Maximum suggestions per session
13
- */
14
- export declare const MAX_CLEAR_SUGGESTIONS = 2;
15
- /**
16
- * Context usage threshold to trigger context+artifacts suggestion (50%)
17
- */
18
- export declare const CONTEXT_THRESHOLD = 0.5;
19
- /**
20
- * Consecutive failure count for degradation signal
21
- */
22
- export declare const FAILURE_THRESHOLD = 3;
23
- /**
24
- * Failure window - only count failures within this window (10 minutes)
25
- */
26
- export declare const FAILURE_WINDOW_MS: number;
27
- /**
28
- * Message for workflow completion trigger
29
- */
30
- export declare const WORKFLOW_COMPLETE_MESSAGE: (modeName: string, artifacts: string) => string;
31
- /**
32
- * Message for architect verification trigger
33
- */
34
- export declare const ARCHITECT_VERIFIED_MESSAGE: (artifacts: string) => string;
35
- /**
36
- * Message for planning complete trigger
37
- */
38
- export declare const PLANNING_COMPLETE_MESSAGE: (artifacts: string) => string;
39
- /**
40
- * Message for context+artifacts trigger
41
- */
42
- export declare const CONTEXT_ARTIFACTS_MESSAGE: (usagePct: number, artifacts: string) => string;
43
- /**
44
- * Message for degradation signals trigger
45
- */
46
- export declare const DEGRADATION_SIGNALS_MESSAGE: (failureCount: number, artifacts: string) => string;
47
- /**
48
- * Format preserved artifacts into a readable list
49
- */
50
- export declare function formatPreservedArtifacts(artifacts: Array<{
51
- type: string;
52
- description: string;
53
- }>): string;
54
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/hooks/clear-suggestions/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,4BAA4B,QAAgB,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,iBAAiB,MAAO,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAiB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAAI,UAAU,MAAM,EAAE,WAAW,MAAM,KAAG,MAU/E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,GAAI,WAAW,MAAM,KAAG,MAU9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAAI,WAAW,MAAM,KAAG,MAU7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAAI,UAAU,MAAM,EAAE,WAAW,MAAM,KAAG,MAU/E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,cAAc,MAAM,EAAE,WAAW,MAAM,KAAG,MAUrF,CAAC;AAEF;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,GACtD,MAAM,CAOR"}
@@ -1,102 +0,0 @@
1
- /**
2
- * Clear Suggestions Constants
3
- *
4
- * Messages, thresholds, and configuration defaults for the
5
- * adaptive /clear suggestions system.
6
- */
7
- /**
8
- * Cooldown period between clear suggestions (5 minutes)
9
- */
10
- export const CLEAR_SUGGESTION_COOLDOWN_MS = 5 * 60 * 1000;
11
- /**
12
- * Maximum suggestions per session
13
- */
14
- export const MAX_CLEAR_SUGGESTIONS = 2;
15
- /**
16
- * Context usage threshold to trigger context+artifacts suggestion (50%)
17
- */
18
- export const CONTEXT_THRESHOLD = 0.50;
19
- /**
20
- * Consecutive failure count for degradation signal
21
- */
22
- export const FAILURE_THRESHOLD = 3;
23
- /**
24
- * Failure window - only count failures within this window (10 minutes)
25
- */
26
- export const FAILURE_WINDOW_MS = 10 * 60 * 1000;
27
- /**
28
- * Message for workflow completion trigger
29
- */
30
- export const WORKFLOW_COMPLETE_MESSAGE = (modeName, artifacts) => `SESSION RESET SUGGESTION
31
-
32
- The **${modeName}** workflow has completed successfully. Starting fresh with /clear would give you:
33
- - A clean context window for your next task
34
- - Faster, more reliable responses
35
- - No stale context from the completed workflow
36
-
37
- ${artifacts}
38
- Type **/clear** to start fresh, or continue working in this session.
39
- `;
40
- /**
41
- * Message for architect verification trigger
42
- */
43
- export const ARCHITECT_VERIFIED_MESSAGE = (artifacts) => `SESSION RESET SUGGESTION
44
-
45
- Architect verification has **passed** - your work is approved. This is an ideal moment to reset:
46
- - The verification cycle consumed significant context
47
- - Your completed work is saved in project files
48
- - A fresh session will be more responsive for the next task
49
-
50
- ${artifacts}
51
- Type **/clear** to start fresh, or continue working in this session.
52
- `;
53
- /**
54
- * Message for planning complete trigger
55
- */
56
- export const PLANNING_COMPLETE_MESSAGE = (artifacts) => `SESSION RESET SUGGESTION
57
-
58
- Planning is **complete** and your plan has been saved to disk. Consider resetting:
59
- - The planning interview used substantial context
60
- - Your plan files are preserved and will be auto-loaded
61
- - Execution will be more reliable in a fresh session
62
-
63
- ${artifacts}
64
- Type **/clear** to start fresh, or continue working in this session.
65
- `;
66
- /**
67
- * Message for context+artifacts trigger
68
- */
69
- export const CONTEXT_ARTIFACTS_MESSAGE = (usagePct, artifacts) => `SESSION RESET SUGGESTION
70
-
71
- Context usage is at **${usagePct}%** but your progress is safely preserved in project files. Consider resetting:
72
- - High context usage can cause degraded performance
73
- - /clear reloads your CLAUDE.md and project context automatically
74
- - Your artifacts will be available in the new session
75
-
76
- ${artifacts}
77
- Type **/clear** to start fresh, or use **/compact** if you want to continue this session.
78
- `;
79
- /**
80
- * Message for degradation signals trigger
81
- */
82
- export const DEGRADATION_SIGNALS_MESSAGE = (failureCount, artifacts) => `SESSION RESET SUGGESTION
83
-
84
- Detected **${failureCount} consecutive failures** which may indicate context degradation. A fresh start could help:
85
- - Accumulated context can cause tool call failures
86
- - /clear gives you a clean slate while preserving all files
87
- - Your work is saved on disk and will not be lost
88
-
89
- ${artifacts}
90
- Type **/clear** to start fresh, or continue troubleshooting in this session.
91
- `;
92
- /**
93
- * Format preserved artifacts into a readable list
94
- */
95
- export function formatPreservedArtifacts(artifacts) {
96
- if (artifacts.length === 0) {
97
- return '';
98
- }
99
- const lines = artifacts.map(a => ` - ${a.description}`);
100
- return `**Preserved artifacts** (available after /clear):\n${lines.join('\n')}\n`;
101
- }
102
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/hooks/clear-suggestions/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,QAAgB,EAAE,SAAiB,EAAU,EAAE,CACvF;;QAEM,QAAQ;;;;;EAKd,SAAS;;CAEV,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,SAAiB,EAAU,EAAE,CACtE;;;;;;;EAOA,SAAS;;CAEV,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,SAAiB,EAAU,EAAE,CACrE;;;;;;;EAOA,SAAS;;CAEV,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,QAAgB,EAAE,SAAiB,EAAU,EAAE,CACvF;;wBAEsB,QAAQ;;;;;EAK9B,SAAS;;CAEV,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,YAAoB,EAAE,SAAiB,EAAU,EAAE,CAC7F;;aAEW,YAAY;;;;;EAKvB,SAAS;;CAEV,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,SAAuD;IAEvD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IACzD,OAAO,sDAAsD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACpF,CAAC"}