oh-my-claude-sisyphus 3.6.1 → 3.6.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 (308) hide show
  1. package/commands/doctor.md +1 -1
  2. package/commands/psm.md +180 -0
  3. package/dist/__tests__/analytics/analytics-summary.test.d.ts +2 -0
  4. package/dist/__tests__/analytics/analytics-summary.test.d.ts.map +1 -0
  5. package/dist/__tests__/analytics/analytics-summary.test.js +267 -0
  6. package/dist/__tests__/analytics/analytics-summary.test.js.map +1 -0
  7. package/dist/__tests__/analytics/cost-estimator.test.d.ts +2 -0
  8. package/dist/__tests__/analytics/cost-estimator.test.d.ts.map +1 -0
  9. package/dist/__tests__/analytics/cost-estimator.test.js +212 -0
  10. package/dist/__tests__/analytics/cost-estimator.test.js.map +1 -0
  11. package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts +7 -0
  12. package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts.map +1 -0
  13. package/dist/__tests__/hooks/auto-slash-command/executor.test.js +374 -0
  14. package/dist/__tests__/hooks/auto-slash-command/executor.test.js.map +1 -0
  15. package/dist/__tests__/hud/auto-tracking.integration.test.d.ts +2 -0
  16. package/dist/__tests__/hud/auto-tracking.integration.test.d.ts.map +1 -0
  17. package/dist/__tests__/hud/auto-tracking.integration.test.js +12 -0
  18. package/dist/__tests__/hud/auto-tracking.integration.test.js.map +1 -0
  19. package/dist/__tests__/installer.test.js +1 -1
  20. package/dist/__tests__/learned-skills/config.test.d.ts +2 -0
  21. package/dist/__tests__/learned-skills/config.test.d.ts.map +1 -0
  22. package/dist/__tests__/learned-skills/config.test.js +37 -0
  23. package/dist/__tests__/learned-skills/config.test.js.map +1 -0
  24. package/dist/__tests__/learned-skills/detector.test.d.ts +2 -0
  25. package/dist/__tests__/learned-skills/detector.test.d.ts.map +1 -0
  26. package/dist/__tests__/learned-skills/detector.test.js +99 -0
  27. package/dist/__tests__/learned-skills/detector.test.js.map +1 -0
  28. package/dist/__tests__/learned-skills/finder.test.d.ts +2 -0
  29. package/dist/__tests__/learned-skills/finder.test.d.ts.map +1 -0
  30. package/dist/__tests__/learned-skills/finder.test.js +59 -0
  31. package/dist/__tests__/learned-skills/finder.test.js.map +1 -0
  32. package/dist/__tests__/learned-skills/loader.test.d.ts +2 -0
  33. package/dist/__tests__/learned-skills/loader.test.d.ts.map +1 -0
  34. package/dist/__tests__/learned-skills/loader.test.js +69 -0
  35. package/dist/__tests__/learned-skills/loader.test.js.map +1 -0
  36. package/dist/__tests__/learned-skills/parser.test.d.ts +2 -0
  37. package/dist/__tests__/learned-skills/parser.test.d.ts.map +1 -0
  38. package/dist/__tests__/learned-skills/parser.test.js +81 -0
  39. package/dist/__tests__/learned-skills/parser.test.js.map +1 -0
  40. package/dist/__tests__/learned-skills/validator.test.d.ts +2 -0
  41. package/dist/__tests__/learned-skills/validator.test.d.ts.map +1 -0
  42. package/dist/__tests__/learned-skills/validator.test.js +85 -0
  43. package/dist/__tests__/learned-skills/validator.test.js.map +1 -0
  44. package/dist/__tests__/skills.test.js +6 -5
  45. package/dist/__tests__/skills.test.js.map +1 -1
  46. package/dist/agents/codex-agents.d.ts +20 -0
  47. package/dist/agents/codex-agents.d.ts.map +1 -0
  48. package/dist/agents/codex-agents.js +36 -0
  49. package/dist/agents/codex-agents.js.map +1 -0
  50. package/dist/agents/document-writer.d.ts +11 -0
  51. package/dist/agents/document-writer.d.ts.map +1 -0
  52. package/dist/agents/document-writer.js +209 -0
  53. package/dist/agents/document-writer.js.map +1 -0
  54. package/dist/agents/frontend-engineer.d.ts +11 -0
  55. package/dist/agents/frontend-engineer.d.ts.map +1 -0
  56. package/dist/agents/frontend-engineer.js +115 -0
  57. package/dist/agents/frontend-engineer.js.map +1 -0
  58. package/dist/agents/librarian.d.ts +12 -0
  59. package/dist/agents/librarian.d.ts.map +1 -0
  60. package/dist/agents/librarian.js +103 -0
  61. package/dist/agents/librarian.js.map +1 -0
  62. package/dist/agents/metis.d.ts +12 -0
  63. package/dist/agents/metis.d.ts.map +1 -0
  64. package/dist/agents/metis.js +117 -0
  65. package/dist/agents/metis.js.map +1 -0
  66. package/dist/agents/momus.d.ts +12 -0
  67. package/dist/agents/momus.d.ts.map +1 -0
  68. package/dist/agents/momus.js +128 -0
  69. package/dist/agents/momus.js.map +1 -0
  70. package/dist/agents/multimodal-looker.d.ts +11 -0
  71. package/dist/agents/multimodal-looker.d.ts.map +1 -0
  72. package/dist/agents/multimodal-looker.js +70 -0
  73. package/dist/agents/multimodal-looker.js.map +1 -0
  74. package/dist/agents/oracle.d.ts +13 -0
  75. package/dist/agents/oracle.d.ts.map +1 -0
  76. package/dist/agents/oracle.js +191 -0
  77. package/dist/agents/oracle.js.map +1 -0
  78. package/dist/agents/orchestrator-sisyphus.d.ts +11 -0
  79. package/dist/agents/orchestrator-sisyphus.d.ts.map +1 -0
  80. package/dist/agents/orchestrator-sisyphus.js +115 -0
  81. package/dist/agents/orchestrator-sisyphus.js.map +1 -0
  82. package/dist/agents/prometheus.d.ts +12 -0
  83. package/dist/agents/prometheus.d.ts.map +1 -0
  84. package/dist/agents/prometheus.js +195 -0
  85. package/dist/agents/prometheus.js.map +1 -0
  86. package/dist/agents/sisyphus-junior.d.ts +12 -0
  87. package/dist/agents/sisyphus-junior.d.ts.map +1 -0
  88. package/dist/agents/sisyphus-junior.js +93 -0
  89. package/dist/agents/sisyphus-junior.js.map +1 -0
  90. package/dist/cli/analytics.js +0 -0
  91. package/dist/cli/components/CostDashboard.d.ts +15 -0
  92. package/dist/cli/components/CostDashboard.d.ts.map +1 -0
  93. package/dist/cli/components/CostDashboard.js +15 -0
  94. package/dist/cli/components/CostDashboard.js.map +1 -0
  95. package/dist/cli/components/LiveStats.d.ts +16 -0
  96. package/dist/cli/components/LiveStats.d.ts.map +1 -0
  97. package/dist/cli/components/LiveStats.js +16 -0
  98. package/dist/cli/components/LiveStats.js.map +1 -0
  99. package/dist/cli/components/SessionBrowser.d.ts +14 -0
  100. package/dist/cli/components/SessionBrowser.d.ts.map +1 -0
  101. package/dist/cli/components/SessionBrowser.js +14 -0
  102. package/dist/cli/components/SessionBrowser.js.map +1 -0
  103. package/dist/cli/index.js +0 -0
  104. package/dist/cli/tui.d.ts +21 -0
  105. package/dist/cli/tui.d.ts.map +1 -0
  106. package/dist/cli/tui.js +21 -0
  107. package/dist/cli/tui.js.map +1 -0
  108. package/dist/hooks/autopilot/signals.d.ts +20 -0
  109. package/dist/hooks/autopilot/signals.d.ts.map +1 -0
  110. package/dist/hooks/autopilot/signals.js +75 -0
  111. package/dist/hooks/autopilot/signals.js.map +1 -0
  112. package/dist/hooks/autopilot/summary.d.ts +27 -0
  113. package/dist/hooks/autopilot/summary.d.ts.map +1 -0
  114. package/dist/hooks/autopilot/summary.js +160 -0
  115. package/dist/hooks/autopilot/summary.js.map +1 -0
  116. package/dist/hooks/autopilot/transition.d.ts +39 -0
  117. package/dist/hooks/autopilot/transition.d.ts.map +1 -0
  118. package/dist/hooks/autopilot/transition.js +216 -0
  119. package/dist/hooks/autopilot/transition.js.map +1 -0
  120. package/dist/hooks/context-window-limit-recovery/constants.d.ts +28 -0
  121. package/dist/hooks/context-window-limit-recovery/constants.d.ts.map +1 -0
  122. package/dist/hooks/context-window-limit-recovery/constants.js +85 -0
  123. package/dist/hooks/context-window-limit-recovery/constants.js.map +1 -0
  124. package/dist/hooks/context-window-limit-recovery/index.d.ts +62 -0
  125. package/dist/hooks/context-window-limit-recovery/index.d.ts.map +1 -0
  126. package/dist/hooks/context-window-limit-recovery/index.js +201 -0
  127. package/dist/hooks/context-window-limit-recovery/index.js.map +1 -0
  128. package/dist/hooks/context-window-limit-recovery/parser.d.ts +31 -0
  129. package/dist/hooks/context-window-limit-recovery/parser.d.ts.map +1 -0
  130. package/dist/hooks/context-window-limit-recovery/parser.js +241 -0
  131. package/dist/hooks/context-window-limit-recovery/parser.js.map +1 -0
  132. package/dist/hooks/context-window-limit-recovery/types.d.ts +84 -0
  133. package/dist/hooks/context-window-limit-recovery/types.d.ts.map +1 -0
  134. package/dist/hooks/context-window-limit-recovery/types.js +34 -0
  135. package/dist/hooks/context-window-limit-recovery/types.js.map +1 -0
  136. package/dist/hooks/edit-error-recovery/index.d.ts +62 -0
  137. package/dist/hooks/edit-error-recovery/index.d.ts.map +1 -0
  138. package/dist/hooks/edit-error-recovery/index.js +89 -0
  139. package/dist/hooks/edit-error-recovery/index.js.map +1 -0
  140. package/dist/hooks/learned-skills/config.d.ts +53 -0
  141. package/dist/hooks/learned-skills/config.d.ts.map +1 -0
  142. package/dist/hooks/learned-skills/config.js +103 -0
  143. package/dist/hooks/learned-skills/config.js.map +1 -0
  144. package/dist/hooks/learned-skills/constants.d.ts +24 -0
  145. package/dist/hooks/learned-skills/constants.d.ts.map +1 -0
  146. package/dist/hooks/learned-skills/constants.js +26 -0
  147. package/dist/hooks/learned-skills/constants.js.map +1 -0
  148. package/dist/hooks/learned-skills/detection-hook.d.ts +39 -0
  149. package/dist/hooks/learned-skills/detection-hook.d.ts.map +1 -0
  150. package/dist/hooks/learned-skills/detection-hook.js +83 -0
  151. package/dist/hooks/learned-skills/detection-hook.js.map +1 -0
  152. package/dist/hooks/learned-skills/detector.d.ts +30 -0
  153. package/dist/hooks/learned-skills/detector.d.ts.map +1 -0
  154. package/dist/hooks/learned-skills/detector.js +150 -0
  155. package/dist/hooks/learned-skills/detector.js.map +1 -0
  156. package/dist/hooks/learned-skills/finder.d.ts +21 -0
  157. package/dist/hooks/learned-skills/finder.d.ts.map +1 -0
  158. package/dist/hooks/learned-skills/finder.js +117 -0
  159. package/dist/hooks/learned-skills/finder.js.map +1 -0
  160. package/dist/hooks/learned-skills/index.d.ts +62 -0
  161. package/dist/hooks/learned-skills/index.d.ts.map +1 -0
  162. package/dist/hooks/learned-skills/index.js +137 -0
  163. package/dist/hooks/learned-skills/index.js.map +1 -0
  164. package/dist/hooks/learned-skills/loader.d.ts +20 -0
  165. package/dist/hooks/learned-skills/loader.d.ts.map +1 -0
  166. package/dist/hooks/learned-skills/loader.js +107 -0
  167. package/dist/hooks/learned-skills/loader.js.map +1 -0
  168. package/dist/hooks/learned-skills/parser.d.ts +21 -0
  169. package/dist/hooks/learned-skills/parser.d.ts.map +1 -0
  170. package/dist/hooks/learned-skills/parser.js +190 -0
  171. package/dist/hooks/learned-skills/parser.js.map +1 -0
  172. package/dist/hooks/learned-skills/promotion.d.ts +29 -0
  173. package/dist/hooks/learned-skills/promotion.d.ts.map +1 -0
  174. package/dist/hooks/learned-skills/promotion.js +87 -0
  175. package/dist/hooks/learned-skills/promotion.js.map +1 -0
  176. package/dist/hooks/learned-skills/types.d.ts +109 -0
  177. package/dist/hooks/learned-skills/types.d.ts.map +1 -0
  178. package/dist/hooks/learned-skills/types.js +8 -0
  179. package/dist/hooks/learned-skills/types.js.map +1 -0
  180. package/dist/hooks/learned-skills/validator.d.ts +15 -0
  181. package/dist/hooks/learned-skills/validator.d.ts.map +1 -0
  182. package/dist/hooks/learned-skills/validator.js +87 -0
  183. package/dist/hooks/learned-skills/validator.js.map +1 -0
  184. package/dist/hooks/learned-skills/writer.d.ts +27 -0
  185. package/dist/hooks/learned-skills/writer.d.ts.map +1 -0
  186. package/dist/hooks/learned-skills/writer.js +126 -0
  187. package/dist/hooks/learned-skills/writer.js.map +1 -0
  188. package/dist/hooks/mnemosyne/config.d.ts +53 -0
  189. package/dist/hooks/mnemosyne/config.d.ts.map +1 -0
  190. package/dist/hooks/mnemosyne/config.js +103 -0
  191. package/dist/hooks/mnemosyne/config.js.map +1 -0
  192. package/dist/hooks/mnemosyne/constants.d.ts +24 -0
  193. package/dist/hooks/mnemosyne/constants.d.ts.map +1 -0
  194. package/dist/hooks/mnemosyne/constants.js +26 -0
  195. package/dist/hooks/mnemosyne/constants.js.map +1 -0
  196. package/dist/hooks/mnemosyne/detection-hook.d.ts +39 -0
  197. package/dist/hooks/mnemosyne/detection-hook.d.ts.map +1 -0
  198. package/dist/hooks/mnemosyne/detection-hook.js +83 -0
  199. package/dist/hooks/mnemosyne/detection-hook.js.map +1 -0
  200. package/dist/hooks/mnemosyne/detector.d.ts +30 -0
  201. package/dist/hooks/mnemosyne/detector.d.ts.map +1 -0
  202. package/dist/hooks/mnemosyne/detector.js +150 -0
  203. package/dist/hooks/mnemosyne/detector.js.map +1 -0
  204. package/dist/hooks/mnemosyne/finder.d.ts +21 -0
  205. package/dist/hooks/mnemosyne/finder.d.ts.map +1 -0
  206. package/dist/hooks/mnemosyne/finder.js +117 -0
  207. package/dist/hooks/mnemosyne/finder.js.map +1 -0
  208. package/dist/hooks/mnemosyne/index.d.ts +62 -0
  209. package/dist/hooks/mnemosyne/index.d.ts.map +1 -0
  210. package/dist/hooks/mnemosyne/index.js +137 -0
  211. package/dist/hooks/mnemosyne/index.js.map +1 -0
  212. package/dist/hooks/mnemosyne/loader.d.ts +20 -0
  213. package/dist/hooks/mnemosyne/loader.d.ts.map +1 -0
  214. package/dist/hooks/mnemosyne/loader.js +113 -0
  215. package/dist/hooks/mnemosyne/loader.js.map +1 -0
  216. package/dist/hooks/mnemosyne/parser.d.ts +21 -0
  217. package/dist/hooks/mnemosyne/parser.d.ts.map +1 -0
  218. package/dist/hooks/mnemosyne/parser.js +190 -0
  219. package/dist/hooks/mnemosyne/parser.js.map +1 -0
  220. package/dist/hooks/mnemosyne/promotion.d.ts +29 -0
  221. package/dist/hooks/mnemosyne/promotion.d.ts.map +1 -0
  222. package/dist/hooks/mnemosyne/promotion.js +87 -0
  223. package/dist/hooks/mnemosyne/promotion.js.map +1 -0
  224. package/dist/hooks/mnemosyne/types.d.ts +109 -0
  225. package/dist/hooks/mnemosyne/types.d.ts.map +1 -0
  226. package/dist/hooks/mnemosyne/types.js +8 -0
  227. package/dist/hooks/mnemosyne/types.js.map +1 -0
  228. package/dist/hooks/mnemosyne/validator.d.ts +15 -0
  229. package/dist/hooks/mnemosyne/validator.d.ts.map +1 -0
  230. package/dist/hooks/mnemosyne/validator.js +87 -0
  231. package/dist/hooks/mnemosyne/validator.js.map +1 -0
  232. package/dist/hooks/mnemosyne/writer.d.ts +27 -0
  233. package/dist/hooks/mnemosyne/writer.d.ts.map +1 -0
  234. package/dist/hooks/mnemosyne/writer.js +126 -0
  235. package/dist/hooks/mnemosyne/writer.js.map +1 -0
  236. package/dist/hooks/ralph-loop/index.d.ts +116 -0
  237. package/dist/hooks/ralph-loop/index.d.ts.map +1 -0
  238. package/dist/hooks/ralph-loop/index.js +322 -0
  239. package/dist/hooks/ralph-loop/index.js.map +1 -0
  240. package/dist/hooks/ralph-prd/index.d.ts +130 -0
  241. package/dist/hooks/ralph-prd/index.d.ts.map +1 -0
  242. package/dist/hooks/ralph-prd/index.js +310 -0
  243. package/dist/hooks/ralph-prd/index.js.map +1 -0
  244. package/dist/hooks/ralph-progress/index.d.ts +102 -0
  245. package/dist/hooks/ralph-progress/index.d.ts.map +1 -0
  246. package/dist/hooks/ralph-progress/index.js +408 -0
  247. package/dist/hooks/ralph-progress/index.js.map +1 -0
  248. package/dist/hooks/ralph-verifier/index.d.ts +72 -0
  249. package/dist/hooks/ralph-verifier/index.d.ts.map +1 -0
  250. package/dist/hooks/ralph-verifier/index.js +223 -0
  251. package/dist/hooks/ralph-verifier/index.js.map +1 -0
  252. package/dist/hooks/session-recovery/constants.d.ts +56 -0
  253. package/dist/hooks/session-recovery/constants.d.ts.map +1 -0
  254. package/dist/hooks/session-recovery/constants.js +78 -0
  255. package/dist/hooks/session-recovery/constants.js.map +1 -0
  256. package/dist/hooks/session-recovery/index.d.ts +53 -0
  257. package/dist/hooks/session-recovery/index.d.ts.map +1 -0
  258. package/dist/hooks/session-recovery/index.js +321 -0
  259. package/dist/hooks/session-recovery/index.js.map +1 -0
  260. package/dist/hooks/session-recovery/storage.d.ts +76 -0
  261. package/dist/hooks/session-recovery/storage.d.ts.map +1 -0
  262. package/dist/hooks/session-recovery/storage.js +383 -0
  263. package/dist/hooks/session-recovery/storage.js.map +1 -0
  264. package/dist/hooks/session-recovery/types.d.ts +145 -0
  265. package/dist/hooks/session-recovery/types.d.ts.map +1 -0
  266. package/dist/hooks/session-recovery/types.js +8 -0
  267. package/dist/hooks/session-recovery/types.js.map +1 -0
  268. package/dist/hooks/sisyphus-orchestrator/constants.d.ts +23 -0
  269. package/dist/hooks/sisyphus-orchestrator/constants.d.ts.map +1 -0
  270. package/dist/hooks/sisyphus-orchestrator/constants.js +142 -0
  271. package/dist/hooks/sisyphus-orchestrator/constants.js.map +1 -0
  272. package/dist/hooks/sisyphus-orchestrator/index.d.ts +113 -0
  273. package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +1 -0
  274. package/dist/hooks/sisyphus-orchestrator/index.js +309 -0
  275. package/dist/hooks/sisyphus-orchestrator/index.js.map +1 -0
  276. package/dist/hooks/subagent-tracker/index.d.ts +83 -0
  277. package/dist/hooks/subagent-tracker/index.d.ts.map +1 -0
  278. package/dist/hooks/subagent-tracker/index.js +207 -0
  279. package/dist/hooks/subagent-tracker/index.js.map +1 -0
  280. package/dist/hooks/ultraqa-loop/index.d.ts +94 -0
  281. package/dist/hooks/ultraqa-loop/index.d.ts.map +1 -0
  282. package/dist/hooks/ultraqa-loop/index.js +216 -0
  283. package/dist/hooks/ultraqa-loop/index.js.map +1 -0
  284. package/dist/hooks/ultrawork-state/index.d.ts +62 -0
  285. package/dist/hooks/ultrawork-state/index.d.ts.map +1 -0
  286. package/dist/hooks/ultrawork-state/index.js +208 -0
  287. package/dist/hooks/ultrawork-state/index.js.map +1 -0
  288. package/dist/hud/sisyphus-state.d.ts +31 -0
  289. package/dist/hud/sisyphus-state.d.ts.map +1 -0
  290. package/dist/hud/sisyphus-state.js +163 -0
  291. package/dist/hud/sisyphus-state.js.map +1 -0
  292. package/dist/installer/index.d.ts +1 -1
  293. package/dist/installer/index.js +1 -1
  294. package/docs/MIGRATION.md +2 -2
  295. package/docs/design/project-session-manager.md +1033 -0
  296. package/package.json +1 -1
  297. package/skills/doctor/SKILL.md +1 -1
  298. package/skills/project-session-manager/SKILL.md +410 -0
  299. package/skills/project-session-manager/lib/config.sh +86 -0
  300. package/skills/project-session-manager/lib/parse.sh +121 -0
  301. package/skills/project-session-manager/lib/session.sh +132 -0
  302. package/skills/project-session-manager/lib/tmux.sh +103 -0
  303. package/skills/project-session-manager/lib/worktree.sh +171 -0
  304. package/skills/project-session-manager/psm.sh +629 -0
  305. package/skills/project-session-manager/templates/feature.md +56 -0
  306. package/skills/project-session-manager/templates/issue-fix.md +57 -0
  307. package/skills/project-session-manager/templates/pr-review.md +65 -0
  308. package/skills/project-session-manager/templates/projects.json +19 -0
@@ -0,0 +1,408 @@
1
+ /**
2
+ * Ralph Progress Log Support
3
+ *
4
+ * Implements append-only progress tracking using progress.txt format from original Ralph.
5
+ * This provides memory persistence between ralph iterations.
6
+ *
7
+ * Structure:
8
+ * - Codebase Patterns section at top (consolidated learnings)
9
+ * - Per-story progress entries appended
10
+ * - Learnings captured for future iterations
11
+ */
12
+ import { existsSync, readFileSync, writeFileSync, appendFileSync, mkdirSync } from 'fs';
13
+ import { join } from 'path';
14
+ // ============================================================================
15
+ // Constants
16
+ // ============================================================================
17
+ export const PROGRESS_FILENAME = 'progress.txt';
18
+ export const PATTERNS_HEADER = '## Codebase Patterns';
19
+ export const ENTRY_SEPARATOR = '---';
20
+ // ============================================================================
21
+ // File Operations
22
+ // ============================================================================
23
+ /**
24
+ * Get the path to progress.txt in a directory
25
+ */
26
+ export function getProgressPath(directory) {
27
+ return join(directory, PROGRESS_FILENAME);
28
+ }
29
+ /**
30
+ * Get the path to progress.txt in .omc subdirectory
31
+ */
32
+ export function getOmcProgressPath(directory) {
33
+ return join(directory, '.omc', PROGRESS_FILENAME);
34
+ }
35
+ /**
36
+ * Find progress.txt in a directory (checks both root and .omc)
37
+ */
38
+ export function findProgressPath(directory) {
39
+ const rootPath = getProgressPath(directory);
40
+ if (existsSync(rootPath)) {
41
+ return rootPath;
42
+ }
43
+ const omcPath = getOmcProgressPath(directory);
44
+ if (existsSync(omcPath)) {
45
+ return omcPath;
46
+ }
47
+ return null;
48
+ }
49
+ /**
50
+ * Read raw progress.txt content
51
+ */
52
+ export function readProgressRaw(directory) {
53
+ const progressPath = findProgressPath(directory);
54
+ if (!progressPath) {
55
+ return null;
56
+ }
57
+ try {
58
+ return readFileSync(progressPath, 'utf-8');
59
+ }
60
+ catch {
61
+ return null;
62
+ }
63
+ }
64
+ /**
65
+ * Parse progress.txt content into structured format
66
+ */
67
+ export function parseProgress(content) {
68
+ const lines = content.split('\n');
69
+ const patterns = [];
70
+ const entries = [];
71
+ let startedAt = '';
72
+ let inPatterns = false;
73
+ let currentEntry = null;
74
+ let currentSection = '';
75
+ for (let i = 0; i < lines.length; i++) {
76
+ const line = lines[i];
77
+ const trimmed = line.trim();
78
+ // Check for started timestamp
79
+ if (trimmed.startsWith('Started:')) {
80
+ startedAt = trimmed.replace('Started:', '').trim();
81
+ continue;
82
+ }
83
+ // Check for patterns section
84
+ if (trimmed === PATTERNS_HEADER) {
85
+ inPatterns = true;
86
+ continue;
87
+ }
88
+ // Check for separator (ends patterns section, separates entries)
89
+ if (trimmed === ENTRY_SEPARATOR) {
90
+ inPatterns = false;
91
+ if (currentEntry && currentEntry.storyId) {
92
+ entries.push(currentEntry);
93
+ }
94
+ currentEntry = null;
95
+ currentSection = '';
96
+ continue;
97
+ }
98
+ // Parse patterns
99
+ if (inPatterns && trimmed.startsWith('-')) {
100
+ patterns.push({
101
+ pattern: trimmed.slice(1).trim()
102
+ });
103
+ continue;
104
+ }
105
+ // Parse entry header (## [Date] - [Story ID])
106
+ const headerMatch = trimmed.match(/^##\s*\[(.+?)\]\s*-\s*(.+)$/);
107
+ if (headerMatch) {
108
+ if (currentEntry && currentEntry.storyId) {
109
+ entries.push(currentEntry);
110
+ }
111
+ currentEntry = {
112
+ timestamp: headerMatch[1],
113
+ storyId: headerMatch[2],
114
+ implementation: [],
115
+ filesChanged: [],
116
+ learnings: []
117
+ };
118
+ currentSection = '';
119
+ continue;
120
+ }
121
+ // Parse sections within entry
122
+ if (currentEntry) {
123
+ if (trimmed.toLowerCase().includes('learnings')) {
124
+ currentSection = 'learnings';
125
+ continue;
126
+ }
127
+ if (trimmed.toLowerCase().includes('files changed') || trimmed.toLowerCase().includes('files:')) {
128
+ currentSection = 'files';
129
+ continue;
130
+ }
131
+ if (trimmed.startsWith('-') || trimmed.startsWith('*')) {
132
+ const item = trimmed.slice(1).trim();
133
+ if (currentSection === 'learnings') {
134
+ currentEntry.learnings.push(item);
135
+ }
136
+ else if (currentSection === 'files') {
137
+ currentEntry.filesChanged.push(item);
138
+ }
139
+ else {
140
+ currentEntry.implementation.push(item);
141
+ }
142
+ }
143
+ }
144
+ }
145
+ // Don't forget the last entry
146
+ if (currentEntry && currentEntry.storyId) {
147
+ entries.push(currentEntry);
148
+ }
149
+ return {
150
+ patterns,
151
+ entries,
152
+ startedAt
153
+ };
154
+ }
155
+ /**
156
+ * Read and parse progress.txt
157
+ */
158
+ export function readProgress(directory) {
159
+ const content = readProgressRaw(directory);
160
+ if (!content) {
161
+ return null;
162
+ }
163
+ return parseProgress(content);
164
+ }
165
+ // ============================================================================
166
+ // Progress Operations
167
+ // ============================================================================
168
+ /**
169
+ * Initialize a new progress.txt file
170
+ */
171
+ export function initProgress(directory) {
172
+ const omcDir = join(directory, '.omc');
173
+ if (!existsSync(omcDir)) {
174
+ try {
175
+ mkdirSync(omcDir, { recursive: true });
176
+ }
177
+ catch {
178
+ return false;
179
+ }
180
+ }
181
+ const progressPath = getOmcProgressPath(directory);
182
+ const now = new Date().toISOString();
183
+ const content = `# Ralph Progress Log
184
+ Started: ${now}
185
+
186
+ ${PATTERNS_HEADER}
187
+ (No patterns discovered yet)
188
+
189
+ ${ENTRY_SEPARATOR}
190
+
191
+ `;
192
+ try {
193
+ writeFileSync(progressPath, content);
194
+ return true;
195
+ }
196
+ catch {
197
+ return false;
198
+ }
199
+ }
200
+ /**
201
+ * Append a progress entry
202
+ */
203
+ export function appendProgress(directory, entry) {
204
+ let progressPath = findProgressPath(directory);
205
+ if (!progressPath) {
206
+ // Initialize if doesn't exist
207
+ if (!initProgress(directory)) {
208
+ return false;
209
+ }
210
+ progressPath = getOmcProgressPath(directory);
211
+ }
212
+ const now = new Date().toISOString();
213
+ const dateStr = now.split('T')[0];
214
+ const timeStr = now.split('T')[1].slice(0, 5);
215
+ const lines = [
216
+ '',
217
+ `## [${dateStr} ${timeStr}] - ${entry.storyId}`,
218
+ ''
219
+ ];
220
+ if (entry.implementation.length > 0) {
221
+ lines.push('**What was implemented:**');
222
+ entry.implementation.forEach(item => {
223
+ lines.push(`- ${item}`);
224
+ });
225
+ lines.push('');
226
+ }
227
+ if (entry.filesChanged.length > 0) {
228
+ lines.push('**Files changed:**');
229
+ entry.filesChanged.forEach(file => {
230
+ lines.push(`- ${file}`);
231
+ });
232
+ lines.push('');
233
+ }
234
+ if (entry.learnings.length > 0) {
235
+ lines.push('**Learnings for future iterations:**');
236
+ entry.learnings.forEach(learning => {
237
+ lines.push(`- ${learning}`);
238
+ });
239
+ lines.push('');
240
+ }
241
+ lines.push(ENTRY_SEPARATOR);
242
+ lines.push('');
243
+ try {
244
+ appendFileSync(progressPath, lines.join('\n'));
245
+ return true;
246
+ }
247
+ catch {
248
+ return false;
249
+ }
250
+ }
251
+ /**
252
+ * Add a codebase pattern to the patterns section
253
+ * @param retryCount - Internal retry counter to prevent infinite recursion
254
+ */
255
+ export function addPattern(directory, pattern, retryCount = 0) {
256
+ // Guard against infinite recursion
257
+ if (retryCount > 1) {
258
+ return false;
259
+ }
260
+ const progressPath = findProgressPath(directory);
261
+ if (!progressPath) {
262
+ // Initialize if doesn't exist
263
+ if (!initProgress(directory)) {
264
+ return false;
265
+ }
266
+ // Retry once after initialization
267
+ return addPattern(directory, pattern, retryCount + 1);
268
+ }
269
+ try {
270
+ let content = readFileSync(progressPath, 'utf-8');
271
+ // Remove placeholder if present (do this FIRST before calculating positions)
272
+ content = content.replace('(No patterns discovered yet)\n', '');
273
+ // Find the patterns section and add the new pattern
274
+ const patternsSectionStart = content.indexOf(PATTERNS_HEADER);
275
+ if (patternsSectionStart === -1) {
276
+ return false;
277
+ }
278
+ // Find the first separator after patterns
279
+ const separatorPos = content.indexOf(ENTRY_SEPARATOR, patternsSectionStart);
280
+ if (separatorPos === -1) {
281
+ return false;
282
+ }
283
+ // Insert the pattern before the separator
284
+ const before = content.slice(0, separatorPos);
285
+ const after = content.slice(separatorPos);
286
+ const newContent = before + `- ${pattern}\n\n` + after;
287
+ writeFileSync(progressPath, newContent);
288
+ return true;
289
+ }
290
+ catch {
291
+ return false;
292
+ }
293
+ }
294
+ /**
295
+ * Get patterns from progress.txt for injection into context
296
+ */
297
+ export function getPatterns(directory) {
298
+ const progress = readProgress(directory);
299
+ if (!progress) {
300
+ return [];
301
+ }
302
+ return progress.patterns.map(p => p.pattern);
303
+ }
304
+ /**
305
+ * Get recent learnings for context injection
306
+ */
307
+ export function getRecentLearnings(directory, limit = 5) {
308
+ const progress = readProgress(directory);
309
+ if (!progress) {
310
+ return [];
311
+ }
312
+ const learnings = [];
313
+ const recentEntries = progress.entries.slice(-limit);
314
+ for (const entry of recentEntries) {
315
+ learnings.push(...entry.learnings);
316
+ }
317
+ return learnings;
318
+ }
319
+ // ============================================================================
320
+ // Formatting
321
+ // ============================================================================
322
+ /**
323
+ * Format patterns for context injection
324
+ */
325
+ export function formatPatternsForContext(directory) {
326
+ const patterns = getPatterns(directory);
327
+ if (patterns.length === 0) {
328
+ return '';
329
+ }
330
+ const lines = [
331
+ '<codebase-patterns>',
332
+ '',
333
+ '## Known Patterns from Previous Iterations',
334
+ ''
335
+ ];
336
+ patterns.forEach(pattern => {
337
+ lines.push(`- ${pattern}`);
338
+ });
339
+ lines.push('');
340
+ lines.push('</codebase-patterns>');
341
+ lines.push('');
342
+ return lines.join('\n');
343
+ }
344
+ /**
345
+ * Format recent progress for context injection
346
+ */
347
+ export function formatProgressForContext(directory, limit = 3) {
348
+ const progress = readProgress(directory);
349
+ if (!progress || progress.entries.length === 0) {
350
+ return '';
351
+ }
352
+ const recent = progress.entries.slice(-limit);
353
+ const lines = [
354
+ '<recent-progress>',
355
+ '',
356
+ '## Recent Progress',
357
+ ''
358
+ ];
359
+ for (const entry of recent) {
360
+ lines.push(`### ${entry.storyId} (${entry.timestamp})`);
361
+ if (entry.implementation.length > 0) {
362
+ entry.implementation.forEach(item => {
363
+ lines.push(`- ${item}`);
364
+ });
365
+ }
366
+ lines.push('');
367
+ }
368
+ lines.push('</recent-progress>');
369
+ lines.push('');
370
+ return lines.join('\n');
371
+ }
372
+ /**
373
+ * Format learnings for context injection
374
+ */
375
+ export function formatLearningsForContext(directory) {
376
+ const learnings = getRecentLearnings(directory, 10);
377
+ if (learnings.length === 0) {
378
+ return '';
379
+ }
380
+ const lines = [
381
+ '<learnings>',
382
+ '',
383
+ '## Learnings from Previous Iterations',
384
+ ''
385
+ ];
386
+ // Deduplicate learnings
387
+ const unique = [...new Set(learnings)];
388
+ unique.forEach(learning => {
389
+ lines.push(`- ${learning}`);
390
+ });
391
+ lines.push('');
392
+ lines.push('</learnings>');
393
+ lines.push('');
394
+ return lines.join('\n');
395
+ }
396
+ /**
397
+ * Get full context injection for ralph
398
+ */
399
+ export function getProgressContext(directory) {
400
+ const patterns = formatPatternsForContext(directory);
401
+ const learnings = formatLearningsForContext(directory);
402
+ const recent = formatProgressForContext(directory, 2);
403
+ if (!patterns && !learnings && !recent) {
404
+ return '';
405
+ }
406
+ return [patterns, learnings, recent].filter(Boolean).join('\n');
407
+ }
408
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/ralph-progress/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxF,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAmC5B,+EAA+E;AAC/E,YAAY;A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IACZ,CAAC;IAED,MAAM,KAAK,GAAG;QACZ,aAAa;QACb,EAAE;QACF,uCAAuC;QACvC,EAAE;KACH,CAAC;IAEF,wBAAwB;IACxB,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;IACvC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QACxB,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAClD,MAAM,QAAQ,GAAG,wBAAwB,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,SAAS,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,wBAAwB,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAEtD,IAAI,CAAC,QAAQ,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Ralph Verifier
3
+ *
4
+ * Adds architect verification to ralph completion claims.
5
+ * When ralph outputs a completion promise, instead of immediately
6
+ * accepting it, we trigger an architect verification phase.
7
+ *
8
+ * Flow:
9
+ * 1. Ralph outputs <promise>TASK_COMPLETE</promise>
10
+ * 2. System detects this and enters verification mode
11
+ * 3. Architect agent is invoked to verify the work
12
+ * 4. If architect approves -> truly complete
13
+ * 5. If architect finds flaws -> continue ralph with architect feedback
14
+ */
15
+ export interface VerificationState {
16
+ /** Whether verification is pending */
17
+ pending: boolean;
18
+ /** The completion claim that triggered verification */
19
+ completion_claim: string;
20
+ /** Number of verification attempts */
21
+ verification_attempts: number;
22
+ /** Max verification attempts before force-accepting */
23
+ max_verification_attempts: number;
24
+ /** Architect feedback from last verification */
25
+ architect_feedback?: string;
26
+ /** Whether architect approved */
27
+ architect_approved?: boolean;
28
+ /** Timestamp of verification request */
29
+ requested_at: string;
30
+ /** Original ralph task */
31
+ original_task: string;
32
+ }
33
+ /**
34
+ * Read verification state
35
+ */
36
+ export declare function readVerificationState(directory: string): VerificationState | null;
37
+ /**
38
+ * Write verification state
39
+ */
40
+ export declare function writeVerificationState(directory: string, state: VerificationState): boolean;
41
+ /**
42
+ * Clear verification state
43
+ */
44
+ export declare function clearVerificationState(directory: string): boolean;
45
+ /**
46
+ * Start verification process
47
+ */
48
+ export declare function startVerification(directory: string, completionClaim: string, originalTask: string): VerificationState;
49
+ /**
50
+ * Record architect feedback
51
+ */
52
+ export declare function recordArchitectFeedback(directory: string, approved: boolean, feedback: string): VerificationState | null;
53
+ /**
54
+ * Generate architect verification prompt
55
+ */
56
+ export declare function getArchitectVerificationPrompt(state: VerificationState): string;
57
+ /**
58
+ * Generate continuation prompt after architect rejection
59
+ */
60
+ export declare function getArchitectRejectionContinuationPrompt(state: VerificationState): string;
61
+ /**
62
+ * Check if text contains architect approval
63
+ */
64
+ export declare function detectArchitectApproval(text: string): boolean;
65
+ /**
66
+ * Check if text contains architect rejection indicators
67
+ */
68
+ export declare function detectArchitectRejection(text: string): {
69
+ rejected: boolean;
70
+ feedback: string;
71
+ };
72
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/ralph-verifier/index.ts"],"names":[],"mappings":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