@hivehub/rulebook 5.5.1 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/.claude/commands/rulebook-learn-capture.md +41 -48
  2. package/.claude/commands/rulebook-learn-list.md +13 -13
  3. package/README.md +332 -394
  4. package/dist/cli/commands/context-intelligence.d.ts +0 -1
  5. package/dist/cli/commands/context-intelligence.d.ts.map +1 -1
  6. package/dist/cli/commands/context-intelligence.js +12 -33
  7. package/dist/cli/commands/context-intelligence.js.map +1 -1
  8. package/dist/cli/commands/index.d.ts +4 -7
  9. package/dist/cli/commands/index.d.ts.map +1 -1
  10. package/dist/cli/commands/index.js +4 -7
  11. package/dist/cli/commands/index.js.map +1 -1
  12. package/dist/cli/commands/init.d.ts.map +1 -1
  13. package/dist/cli/commands/init.js +40 -81
  14. package/dist/cli/commands/init.js.map +1 -1
  15. package/dist/cli/commands/mcp.d.ts +0 -1
  16. package/dist/cli/commands/mcp.d.ts.map +1 -1
  17. package/dist/cli/commands/mcp.js +1 -7
  18. package/dist/cli/commands/mcp.js.map +1 -1
  19. package/dist/cli/commands/memory.d.ts +7 -1
  20. package/dist/cli/commands/memory.d.ts.map +1 -1
  21. package/dist/cli/commands/memory.js +51 -57
  22. package/dist/cli/commands/memory.js.map +1 -1
  23. package/dist/cli/commands/misc.d.ts +1 -15
  24. package/dist/cli/commands/misc.d.ts.map +1 -1
  25. package/dist/cli/commands/misc.js +36 -215
  26. package/dist/cli/commands/misc.js.map +1 -1
  27. package/dist/cli/commands/plans.d.ts +0 -6
  28. package/dist/cli/commands/plans.d.ts.map +1 -1
  29. package/dist/cli/commands/plans.js +9 -77
  30. package/dist/cli/commands/plans.js.map +1 -1
  31. package/dist/cli/commands/skills.js +6 -6
  32. package/dist/cli/commands/skills.js.map +1 -1
  33. package/dist/cli/commands/task.js +4 -4
  34. package/dist/cli/commands/task.js.map +1 -1
  35. package/dist/cli/commands/update.d.ts.map +1 -1
  36. package/dist/cli/commands/update.js +122 -52
  37. package/dist/cli/commands/update.js.map +1 -1
  38. package/dist/cli/prompts.d.ts.map +1 -1
  39. package/dist/cli/prompts.js +1 -78
  40. package/dist/cli/prompts.js.map +1 -1
  41. package/dist/core/claude/claude-mcp.d.ts +59 -0
  42. package/dist/core/claude/claude-mcp.d.ts.map +1 -0
  43. package/dist/core/claude/claude-mcp.js +220 -0
  44. package/dist/core/claude/claude-mcp.js.map +1 -0
  45. package/dist/core/claude/claude-md-generator.d.ts +52 -0
  46. package/dist/core/claude/claude-md-generator.d.ts.map +1 -0
  47. package/dist/core/claude/claude-md-generator.js +104 -0
  48. package/dist/core/claude/claude-md-generator.js.map +1 -0
  49. package/dist/core/claude/claude-settings-manager.d.ts +44 -0
  50. package/dist/core/claude/claude-settings-manager.d.ts.map +1 -0
  51. package/dist/core/claude/claude-settings-manager.js +194 -0
  52. package/dist/core/claude/claude-settings-manager.js.map +1 -0
  53. package/dist/core/claude-settings-manager.d.ts.map +1 -1
  54. package/dist/core/claude-settings-manager.js +9 -3
  55. package/dist/core/claude-settings-manager.js.map +1 -1
  56. package/dist/core/console/cli-bridge.d.ts +113 -0
  57. package/dist/core/console/cli-bridge.d.ts.map +1 -0
  58. package/dist/core/console/cli-bridge.js +1094 -0
  59. package/dist/core/console/cli-bridge.js.map +1 -0
  60. package/dist/core/detect/detector.d.ts +35 -0
  61. package/dist/core/detect/detector.d.ts.map +1 -0
  62. package/dist/core/detect/detector.js +541 -0
  63. package/dist/core/detect/detector.js.map +1 -0
  64. package/dist/core/docs/docs-generator.d.ts +9 -0
  65. package/dist/core/docs/docs-generator.d.ts.map +1 -0
  66. package/dist/core/docs/docs-generator.js +531 -0
  67. package/dist/core/docs/docs-generator.js.map +1 -0
  68. package/dist/core/docs/mcp-reference-generator.d.ts +13 -0
  69. package/dist/core/docs/mcp-reference-generator.d.ts.map +1 -0
  70. package/dist/core/docs/mcp-reference-generator.js +66 -0
  71. package/dist/core/docs/mcp-reference-generator.js.map +1 -0
  72. package/dist/core/generators/generator.d.ts +54 -0
  73. package/dist/core/generators/generator.d.ts.map +1 -0
  74. package/dist/core/generators/generator.js +1041 -0
  75. package/dist/core/generators/generator.js.map +1 -0
  76. package/dist/core/generators/gitignore-generator.d.ts +13 -0
  77. package/dist/core/generators/gitignore-generator.d.ts.map +1 -0
  78. package/dist/core/generators/gitignore-generator.js +307 -0
  79. package/dist/core/generators/gitignore-generator.js.map +1 -0
  80. package/dist/core/generators/minimal-scaffolder.d.ts +8 -0
  81. package/dist/core/generators/minimal-scaffolder.d.ts.map +1 -0
  82. package/dist/core/generators/minimal-scaffolder.js +51 -0
  83. package/dist/core/generators/minimal-scaffolder.js.map +1 -0
  84. package/dist/core/generators/rules-generator.d.ts +73 -0
  85. package/dist/core/generators/rules-generator.d.ts.map +1 -0
  86. package/dist/core/generators/rules-generator.js +202 -0
  87. package/dist/core/generators/rules-generator.js.map +1 -0
  88. package/dist/core/generators/workflow-generator.d.ts +15 -0
  89. package/dist/core/generators/workflow-generator.d.ts.map +1 -0
  90. package/dist/core/generators/workflow-generator.js +390 -0
  91. package/dist/core/generators/workflow-generator.js.map +1 -0
  92. package/dist/core/ide/multi-tool-generator.d.ts +59 -0
  93. package/dist/core/ide/multi-tool-generator.d.ts.map +1 -0
  94. package/dist/core/ide/multi-tool-generator.js +157 -0
  95. package/dist/core/ide/multi-tool-generator.js.map +1 -0
  96. package/dist/core/ide/opencode-generator.d.ts +72 -0
  97. package/dist/core/ide/opencode-generator.d.ts.map +1 -0
  98. package/dist/core/ide/opencode-generator.js +450 -0
  99. package/dist/core/ide/opencode-generator.js.map +1 -0
  100. package/dist/core/merger.d.ts +1 -1
  101. package/dist/core/merger.d.ts.map +1 -1
  102. package/dist/core/merger.js +5 -5
  103. package/dist/core/merger.js.map +1 -1
  104. package/dist/core/migrator.d.ts +0 -1
  105. package/dist/core/migrator.d.ts.map +1 -1
  106. package/dist/core/migrator.js +4 -29
  107. package/dist/core/migrator.js.map +1 -1
  108. package/dist/core/quality/coverage-checker.d.ts +14 -0
  109. package/dist/core/quality/coverage-checker.d.ts.map +1 -0
  110. package/dist/core/quality/coverage-checker.js +176 -0
  111. package/dist/core/quality/coverage-checker.js.map +1 -0
  112. package/dist/core/quality/dependency-checker.d.ts +21 -0
  113. package/dist/core/quality/dependency-checker.d.ts.map +1 -0
  114. package/dist/core/quality/dependency-checker.js +247 -0
  115. package/dist/core/quality/dependency-checker.js.map +1 -0
  116. package/dist/core/quality/doctor.d.ts +19 -0
  117. package/dist/core/quality/doctor.d.ts.map +1 -0
  118. package/dist/core/quality/doctor.js +163 -0
  119. package/dist/core/quality/doctor.js.map +1 -0
  120. package/dist/core/quality/validator.d.ts +21 -0
  121. package/dist/core/quality/validator.d.ts.map +1 -0
  122. package/dist/core/quality/validator.js +177 -0
  123. package/dist/core/quality/validator.js.map +1 -0
  124. package/dist/core/ralph-scripts.d.ts.map +1 -1
  125. package/dist/core/ralph-scripts.js +7 -6
  126. package/dist/core/ralph-scripts.js.map +1 -1
  127. package/dist/core/skills/skills-manager.d.ts +126 -0
  128. package/dist/core/skills/skills-manager.d.ts.map +1 -0
  129. package/dist/core/skills/skills-manager.js +630 -0
  130. package/dist/core/skills/skills-manager.js.map +1 -0
  131. package/dist/core/state/config-manager.d.ts +86 -0
  132. package/dist/core/state/config-manager.d.ts.map +1 -0
  133. package/dist/core/state/config-manager.js +562 -0
  134. package/dist/core/state/config-manager.js.map +1 -0
  135. package/dist/core/state/override-manager.d.ts +23 -0
  136. package/dist/core/state/override-manager.d.ts.map +1 -0
  137. package/dist/core/state/override-manager.js +82 -0
  138. package/dist/core/state/override-manager.js.map +1 -0
  139. package/dist/core/state/state-writer.d.ts +34 -0
  140. package/dist/core/state/state-writer.d.ts.map +1 -0
  141. package/dist/core/state/state-writer.js +78 -0
  142. package/dist/core/state/state-writer.js.map +1 -0
  143. package/dist/core/state/version-bumper.d.ts +19 -0
  144. package/dist/core/state/version-bumper.d.ts.map +1 -0
  145. package/dist/core/state/version-bumper.js +180 -0
  146. package/dist/core/state/version-bumper.js.map +1 -0
  147. package/dist/core/tasks/decision-manager.d.ts +25 -0
  148. package/dist/core/tasks/decision-manager.d.ts.map +1 -0
  149. package/dist/core/tasks/decision-manager.js +183 -0
  150. package/dist/core/tasks/decision-manager.js.map +1 -0
  151. package/dist/core/tasks/knowledge-manager.d.ts +24 -0
  152. package/dist/core/tasks/knowledge-manager.d.ts.map +1 -0
  153. package/dist/core/tasks/knowledge-manager.js +173 -0
  154. package/dist/core/tasks/knowledge-manager.js.map +1 -0
  155. package/dist/core/tasks/learn-manager.d.ts +27 -0
  156. package/dist/core/tasks/learn-manager.d.ts.map +1 -0
  157. package/dist/core/tasks/learn-manager.js +121 -0
  158. package/dist/core/tasks/learn-manager.js.map +1 -0
  159. package/dist/core/tasks/plans-manager.d.ts +46 -0
  160. package/dist/core/tasks/plans-manager.d.ts.map +1 -0
  161. package/dist/core/tasks/plans-manager.js +158 -0
  162. package/dist/core/tasks/plans-manager.js.map +1 -0
  163. package/dist/core/tasks/task-manager.d.ts +127 -0
  164. package/dist/core/tasks/task-manager.d.ts.map +1 -0
  165. package/dist/core/tasks/task-manager.js +607 -0
  166. package/dist/core/tasks/task-manager.js.map +1 -0
  167. package/dist/core/workspace/project-worker.d.ts +6 -6
  168. package/dist/core/workspace/project-worker.d.ts.map +1 -1
  169. package/dist/core/workspace/project-worker.js +6 -6
  170. package/dist/core/workspace/project-worker.js.map +1 -1
  171. package/dist/index.d.ts +1 -1
  172. package/dist/index.d.ts.map +1 -1
  173. package/dist/index.js +19 -176
  174. package/dist/index.js.map +1 -1
  175. package/dist/mcp/rulebook-server.d.ts.map +1 -1
  176. package/dist/mcp/rulebook-server.js +16 -960
  177. package/dist/mcp/rulebook-server.js.map +1 -1
  178. package/dist/memory/file-search.d.ts +43 -0
  179. package/dist/memory/file-search.d.ts.map +1 -0
  180. package/dist/memory/file-search.js +228 -0
  181. package/dist/memory/file-search.js.map +1 -0
  182. package/dist/memory/file-store.d.ts +99 -0
  183. package/dist/memory/file-store.d.ts.map +1 -0
  184. package/dist/memory/file-store.js +615 -0
  185. package/dist/memory/file-store.js.map +1 -0
  186. package/dist/memory/legacy-migrator.d.ts +27 -0
  187. package/dist/memory/legacy-migrator.d.ts.map +1 -0
  188. package/dist/memory/legacy-migrator.js +185 -0
  189. package/dist/memory/legacy-migrator.js.map +1 -0
  190. package/dist/memory/memory-manager.d.ts +25 -24
  191. package/dist/memory/memory-manager.d.ts.map +1 -1
  192. package/dist/memory/memory-manager.js +97 -140
  193. package/dist/memory/memory-manager.js.map +1 -1
  194. package/dist/memory/memory-types.d.ts +1 -1
  195. package/dist/memory/memory-types.d.ts.map +1 -1
  196. package/dist/types.d.ts +8 -119
  197. package/dist/types.d.ts.map +1 -1
  198. package/dist/utils/file-system.d.ts +22 -0
  199. package/dist/utils/file-system.d.ts.map +1 -1
  200. package/dist/utils/file-system.js +31 -0
  201. package/dist/utils/file-system.js.map +1 -1
  202. package/dist/utils/git-hooks.d.ts.map +1 -1
  203. package/dist/utils/git-hooks.js +3 -2
  204. package/dist/utils/git-hooks.js.map +1 -1
  205. package/package.json +2 -6
  206. package/templates/agents/context-intelligence.md +50 -52
  207. package/templates/cli/OPENCODE.md +85 -18
  208. package/templates/commands/rulebook-learn-capture.md +41 -48
  209. package/templates/commands/rulebook-learn-list.md +13 -13
  210. package/templates/core/AGENTS_LEAN.md +0 -14
  211. package/templates/hooks/check-context-and-handoff.sh +74 -76
  212. package/templates/hooks/enforce-pre-tool.sh +70 -0
  213. package/templates/hooks/enforce-team-for-background-agents.sh +55 -55
  214. package/templates/hooks/on-compact-reinject.sh +34 -34
  215. package/templates/hooks/resume-from-handoff.sh +61 -61
  216. package/templates/hooks/terse-activate.sh +197 -197
  217. package/templates/hooks/terse-mode-tracker.sh +190 -187
  218. package/templates/ides/OPENCODE.md +63 -0
  219. package/templates/skills/cli/opencode/SKILL.md +82 -28
  220. package/.claude/commands/ralph-config.md +0 -112
  221. package/.claude/commands/ralph-history.md +0 -110
  222. package/.claude/commands/ralph-init.md +0 -72
  223. package/.claude/commands/ralph-pause-resume.md +0 -105
  224. package/.claude/commands/ralph-run.md +0 -101
  225. package/.claude/commands/ralph-status.md +0 -76
  226. package/templates/core/RALPH.md +0 -471
  227. package/templates/frameworks/ANGULAR.md +0 -36
  228. package/templates/frameworks/DJANGO.md +0 -83
  229. package/templates/frameworks/ELECTRON.md +0 -147
  230. package/templates/frameworks/FLASK.md +0 -38
  231. package/templates/frameworks/FLUTTER.md +0 -55
  232. package/templates/frameworks/JQUERY.md +0 -32
  233. package/templates/frameworks/LARAVEL.md +0 -38
  234. package/templates/frameworks/NESTJS.md +0 -43
  235. package/templates/frameworks/NEXTJS.md +0 -127
  236. package/templates/frameworks/NUXT.md +0 -40
  237. package/templates/frameworks/RAILS.md +0 -66
  238. package/templates/frameworks/REACT.md +0 -38
  239. package/templates/frameworks/REACT_NATIVE.md +0 -47
  240. package/templates/frameworks/SPRING.md +0 -39
  241. package/templates/frameworks/SYMFONY.md +0 -36
  242. package/templates/frameworks/VUE.md +0 -36
  243. package/templates/frameworks/ZEND.md +0 -35
  244. package/templates/hooks/enforce-mcp-for-tasks.sh +0 -31
  245. package/templates/hooks/enforce-no-deferred.sh +0 -21
  246. package/templates/hooks/enforce-no-shortcuts.sh +0 -31
  247. package/templates/ides/COPILOT.md +0 -37
  248. package/templates/ides/CURSOR.md +0 -43
  249. package/templates/ides/JETBRAINS_AI.md +0 -35
  250. package/templates/ides/REPLIT.md +0 -36
  251. package/templates/ides/TABNINE.md +0 -29
  252. package/templates/ides/VSCODE.md +0 -40
  253. package/templates/ides/WINDSURF.md +0 -36
  254. package/templates/ides/ZED.md +0 -32
  255. package/templates/ides/cursor-mdc/go.mdc +0 -24
  256. package/templates/ides/cursor-mdc/python.mdc +0 -24
  257. package/templates/ides/cursor-mdc/quality.mdc +0 -25
  258. package/templates/ides/cursor-mdc/ralph.mdc +0 -39
  259. package/templates/ides/cursor-mdc/rulebook.mdc +0 -38
  260. package/templates/ides/cursor-mdc/rust.mdc +0 -24
  261. package/templates/ides/cursor-mdc/typescript.mdc +0 -25
  262. package/templates/ralph/ralph-history.bat +0 -4
  263. package/templates/ralph/ralph-history.sh +0 -5
  264. package/templates/ralph/ralph-init.bat +0 -5
  265. package/templates/ralph/ralph-init.sh +0 -5
  266. package/templates/ralph/ralph-pause.bat +0 -5
  267. package/templates/ralph/ralph-pause.sh +0 -5
  268. package/templates/ralph/ralph-run.bat +0 -5
  269. package/templates/ralph/ralph-run.sh +0 -5
  270. package/templates/ralph/ralph-status.bat +0 -4
  271. package/templates/ralph/ralph-status.sh +0 -5
  272. package/templates/services/AZURE_BLOB.md +0 -184
  273. package/templates/services/CASSANDRA.md +0 -239
  274. package/templates/services/DATADOG.md +0 -26
  275. package/templates/services/DOCKER.md +0 -124
  276. package/templates/services/DOCKER_COMPOSE.md +0 -168
  277. package/templates/services/DYNAMODB.md +0 -308
  278. package/templates/services/ELASTICSEARCH.md +0 -347
  279. package/templates/services/GCS.md +0 -178
  280. package/templates/services/HELM.md +0 -194
  281. package/templates/services/INFLUXDB.md +0 -265
  282. package/templates/services/KAFKA.md +0 -341
  283. package/templates/services/KUBERNETES.md +0 -208
  284. package/templates/services/MARIADB.md +0 -183
  285. package/templates/services/MEMCACHED.md +0 -242
  286. package/templates/services/MINIO.md +0 -201
  287. package/templates/services/MONGODB.md +0 -268
  288. package/templates/services/MYSQL.md +0 -358
  289. package/templates/services/NEO4J.md +0 -247
  290. package/templates/services/OPENTELEMETRY.md +0 -25
  291. package/templates/services/ORACLE.md +0 -290
  292. package/templates/services/PINO.md +0 -24
  293. package/templates/services/POSTGRESQL.md +0 -326
  294. package/templates/services/PROMETHEUS.md +0 -33
  295. package/templates/services/RABBITMQ.md +0 -286
  296. package/templates/services/REDIS.md +0 -292
  297. package/templates/services/S3.md +0 -298
  298. package/templates/services/SENTRY.md +0 -23
  299. package/templates/services/SQLITE.md +0 -294
  300. package/templates/services/SQLSERVER.md +0 -294
  301. package/templates/services/WINSTON.md +0 -30
  302. package/templates/skills/frameworks/angular/SKILL.md +0 -46
  303. package/templates/skills/frameworks/django/SKILL.md +0 -93
  304. package/templates/skills/frameworks/electron/SKILL.md +0 -157
  305. package/templates/skills/frameworks/flask/SKILL.md +0 -48
  306. package/templates/skills/frameworks/flutter/SKILL.md +0 -65
  307. package/templates/skills/frameworks/jquery/SKILL.md +0 -42
  308. package/templates/skills/frameworks/laravel/SKILL.md +0 -48
  309. package/templates/skills/frameworks/nestjs/SKILL.md +0 -53
  310. package/templates/skills/frameworks/nextjs/SKILL.md +0 -137
  311. package/templates/skills/frameworks/nuxt/SKILL.md +0 -50
  312. package/templates/skills/frameworks/rails/SKILL.md +0 -76
  313. package/templates/skills/frameworks/react/SKILL.md +0 -48
  314. package/templates/skills/frameworks/react-native/SKILL.md +0 -57
  315. package/templates/skills/frameworks/spring/SKILL.md +0 -49
  316. package/templates/skills/frameworks/symfony/SKILL.md +0 -46
  317. package/templates/skills/frameworks/vue/SKILL.md +0 -46
  318. package/templates/skills/frameworks/zend/SKILL.md +0 -45
  319. package/templates/skills/services/azure-blob/SKILL.md +0 -194
  320. package/templates/skills/services/cassandra/SKILL.md +0 -249
  321. package/templates/skills/services/dynamodb/SKILL.md +0 -318
  322. package/templates/skills/services/elasticsearch/SKILL.md +0 -357
  323. package/templates/skills/services/gcs/SKILL.md +0 -188
  324. package/templates/skills/services/influxdb/SKILL.md +0 -275
  325. package/templates/skills/services/kafka/SKILL.md +0 -351
  326. package/templates/skills/services/mariadb/SKILL.md +0 -193
  327. package/templates/skills/services/memcached/SKILL.md +0 -252
  328. package/templates/skills/services/minio/SKILL.md +0 -211
  329. package/templates/skills/services/mongodb/SKILL.md +0 -278
  330. package/templates/skills/services/mysql/SKILL.md +0 -368
  331. package/templates/skills/services/neo4j/SKILL.md +0 -257
  332. package/templates/skills/services/oracle/SKILL.md +0 -300
  333. package/templates/skills/services/postgresql/SKILL.md +0 -336
  334. package/templates/skills/services/rabbitmq/SKILL.md +0 -296
  335. package/templates/skills/services/redis/SKILL.md +0 -302
  336. package/templates/skills/services/s3/SKILL.md +0 -308
  337. package/templates/skills/services/sqlite/SKILL.md +0 -304
  338. package/templates/skills/services/sqlserver/SKILL.md +0 -304
  339. package/templates/skills/workflows/ralph/SETUP.md +0 -228
  340. package/templates/skills/workflows/ralph/SKILL.md +0 -309
  341. package/templates/skills/workflows/ralph/install.sh +0 -87
  342. package/templates/skills/workflows/ralph/manifest.json +0 -158
@@ -1,228 +0,0 @@
1
- # Ralph Autonomous Loop Setup Guide
2
-
3
- ## Installation
4
-
5
- Ralph is installed as part of `@hivehub/rulebook`. To enable it as a Claude Code skill:
6
-
7
- ### Option 1: Automatic Installation (Recommended)
8
-
9
- ```bash
10
- # During project initialization
11
- rulebook init
12
- # → Select "Ralph Autonomous Loop" when prompted for skills
13
-
14
- # Or enable existing project
15
- rulebook skill enable ralph-autonomous-loop
16
- ```
17
-
18
- ### Option 2: Manual Installation
19
-
20
- ```bash
21
- # 1. Install rulebook (if not already installed)
22
- npm install -g @hivehub/rulebook
23
-
24
- # 2. Run the Ralph skill setup
25
- bash templates/skills/workflows/ralph/install.sh
26
-
27
- # 3. Verify installation
28
- cat .rulebook | grep -A 5 '"ralph"'
29
- ```
30
-
31
- ## Claude Code Integration
32
-
33
- ### Configuration in .cursorrules
34
-
35
- Ralph skill automatically adds to `.cursorrules`:
36
-
37
- ```
38
- ## Ralph Autonomous Loop
39
-
40
- When working with Ralph autonomous loop:
41
-
42
- 1. **Before each iteration**:
43
- - Read .rulebook-ralph/prd.json for task specifications
44
- - Read .rulebook-ralph/progress.txt for past learnings
45
- - Reference recent git commits for architectural context
46
-
47
- 2. **During implementation**:
48
- - Focus on ONE task from PRD
49
- - Apply patterns from progress.txt
50
- - Write tests first (95%+ coverage required)
51
-
52
- 3. **After implementation**:
53
- - Run quality gates: type-check, lint, tests, coverage
54
- - Commit with clear message including iteration number
55
- - Ralph will update progress.txt with learnings
56
-
57
- 4. **Commands**:
58
- - Check status: rulebook ralph status
59
- - View history: rulebook ralph history
60
- - Pause loop: rulebook ralph pause (Ctrl+C)
61
- - Resume: rulebook ralph resume
62
- ```
63
-
64
- ### Enabling in Claude Code
65
-
66
- When you run `npx init` or `rulebook init`, Claude Code will:
67
-
68
- 1. ✅ Detect Ralph skill in `.rulebook` configuration
69
- 2. ✅ Register Ralph commands and MCP tools
70
- 3. ✅ Load Ralph documentation into context
71
- 4. ✅ Enable Ralph-specific prompting
72
-
73
- ### Using Ralph in Claude Code
74
-
75
- ```bash
76
- # After initialization, Ralph is available via:
77
- rulebook ralph <command>
78
-
79
- # Example workflow:
80
- 1. Create tasks
81
- 2. Initialize Ralph
82
- 3. Run autonomous loop
83
- 4. Monitor progress
84
- 5. Review and deploy
85
- ```
86
-
87
- ## Configuration
88
-
89
- ### .rulebook Configuration
90
-
91
- ```json
92
- {
93
- "ralph": {
94
- "enabled": true,
95
- "maxIterations": 10,
96
- "tool": "claude",
97
- "maxContextLoss": 3
98
- }
99
- }
100
- ```
101
-
102
- **Options**:
103
- - `enabled` (boolean): Enable Ralph autonomous loop
104
- - `maxIterations` (number): Max iterations before stopping
105
- - `tool` (string): AI CLI tool ("claude", "amp", "gemini")
106
- - `maxContextLoss` (number): Tolerance for incomplete outputs
107
-
108
- ### Directory Structure
109
-
110
- Ralph creates and uses:
111
-
112
- ```
113
- .rulebook-ralph/
114
- ├── prd.json # Task specifications (auto-generated)
115
- ├── progress.txt # Append-only learning log
116
- └── history/ # Per-iteration metadata
117
- ├── iteration-1.json
118
- ├── iteration-2.json
119
- └── ...
120
- ```
121
-
122
- ## Quick Start
123
-
124
- ```bash
125
- # 1. Create tasks (can be multiple)
126
- rulebook task create implement-auth
127
- rulebook task create add-api-endpoints
128
- rulebook task create write-tests
129
-
130
- # 2. Initialize Ralph
131
- rulebook ralph init
132
- # → Creates .rulebook-ralph/prd.json from tasks
133
- # → Initializes progress.txt
134
-
135
- # 3. Start autonomous loop
136
- rulebook ralph run --max-iterations 10
137
- # → Ralph picks first task
138
- # → Runs Claude Code to implement
139
- # → Runs quality checks
140
- # → Updates task status and progress.txt
141
- # → Repeats for next task
142
-
143
- # 4. Monitor progress
144
- rulebook ralph status # Current status
145
- rulebook ralph history # Iteration history
146
- rulebook ralph history --learnings # What was learned
147
-
148
- # 5. Pause/resume if needed
149
- rulebook ralph pause # Gracefully pause
150
- rulebook ralph resume # Continue later
151
- ```
152
-
153
- ## MCP Server Integration
154
-
155
- Ralph commands are available via MCP for programmatic use:
156
-
157
- ```bash
158
- # Start MCP server
159
- rulebook-mcp
160
-
161
- # Available tools:
162
- # - rulebook_ralph_init: Initialize Ralph
163
- # - rulebook_ralph_run: Start autonomous loop
164
- # - rulebook_ralph_status: Query loop status
165
- # - rulebook_ralph_get_iteration_history: Fetch history
166
- ```
167
-
168
- ## Troubleshooting
169
-
170
- ### Ralph not found after installation
171
-
172
- ```bash
173
- # Ensure @hivehub/rulebook is installed
174
- npm list -g @hivehub/rulebook
175
-
176
- # If not installed
177
- npm install -g @hivehub/rulebook
178
-
179
- # Verify Ralph skill is registered
180
- rulebook skill list | grep ralph
181
- ```
182
-
183
- ### .rulebook configuration not created
184
-
185
- ```bash
186
- # Run init if not already done
187
- rulebook init
188
-
189
- # Manually enable Ralph
190
- rulebook skill enable ralph-autonomous-loop
191
- ```
192
-
193
- ### Claude Code not recognizing Ralph commands
194
-
195
- ```bash
196
- # Ensure .cursorrules is updated
197
- cat .cursorrules | grep -i ralph
198
-
199
- # Manually add Ralph section if missing
200
- echo "
201
- ## Ralph Autonomous Loop
202
- [See SKILL.md for full content]
203
- " >> .cursorrules
204
- ```
205
-
206
- ## Next Steps
207
-
208
- 1. **Read SKILL.md** — Full documentation
209
- 2. **Review manifest.json** — Complete skill specification
210
- 3. **Run examples** — Try the quick start commands
211
- 4. **Monitor iterations** — Use `rulebook ralph history`
212
- 5. **Customize** — Adjust maxIterations, tool, etc. in .rulebook
213
-
214
- ## Documentation
215
-
216
- - **SKILL.md** — Complete Ralph skill documentation
217
- - **manifest.json** — Skill specification and metadata
218
- - **install.sh** — Installation/setup script
219
- - **SETUP.md** — This file
220
-
221
- ## Support
222
-
223
- For issues or questions:
224
-
225
- - Check `rulebook ralph --help`
226
- - Review `rulebook ralph history` for error messages
227
- - See [Ralph GitHub](https://github.com/snarktank/ralph) for pattern details
228
- - Check [Rulebook docs](https://github.com/hivellm/rulebook) for CLI reference
@@ -1,309 +0,0 @@
1
- ---
2
- name: "Ralph Autonomous Loop"
3
- description: "Autonomous AI agent loop for iterative task implementation (@hivehub/rulebook ralph)"
4
- version: "1.0.0"
5
- category: "workflow"
6
- author: "Rulebook"
7
- tags: ["autonomous", "ralph", "iterative", "workflow"]
8
- dependencies: ["rulebook"]
9
- conflicts: []
10
- ---
11
- <!-- RALPH:START -->
12
- # Ralph Autonomous Loop Skill
13
-
14
- **Purpose**: Automate iterative feature implementation using Ralph's autonomous agent loop pattern.
15
-
16
- ## Installation
17
-
18
- Ralph is installed as part of @hivehub/rulebook:
19
-
20
- ```bash
21
- npm install -g @hivehub/rulebook
22
- # or
23
- npx @hivehub/rulebook init
24
- ```
25
-
26
- ## Quick Start
27
-
28
- ### Step 1: Initialize Ralph for Your Project
29
-
30
- ```bash
31
- # Create task specifications in .rulebook/tasks/
32
- rulebook task create my-feature
33
-
34
- # Initialize Ralph
35
- rulebook ralph init
36
-
37
- # This creates:
38
- # - .rulebook-ralph/prd.json (task specifications in PRD format)
39
- # - .rulebook-ralph/progress.txt (learning log across iterations)
40
- # - .rulebook-ralph/history/ (per-iteration metadata)
41
- ```
42
-
43
- ### Step 2: Run Autonomous Loop
44
-
45
- ```bash
46
- # Run with default settings
47
- rulebook ralph run
48
-
49
- # Or with custom iterations and tool
50
- rulebook ralph run --max-iterations 10 --tool claude
51
- ```
52
-
53
- ### Step 3: Monitor Progress
54
-
55
- ```bash
56
- # Check current status
57
- rulebook ralph status
58
-
59
- # View iteration history
60
- rulebook ralph history
61
-
62
- # See learnings discovered
63
- rulebook ralph history --learnings
64
- ```
65
-
66
- ## Understanding the Ralph Loop
67
-
68
- ### Loop Workflow
69
-
70
- ```
71
- 1. Pick highest-priority incomplete task from PRD
72
- 2. Execute AI agent (Claude Code, Cursor, or Gemini)
73
- - Provide full PRD context
74
- - Include progress.txt (learnings from past iterations)
75
- - Include git history (recent commits)
76
- 3. Run quality gates (type-check, lint, tests)
77
- 4. If success:
78
- - Commit changes with iteration metadata
79
- - Update task status to completed
80
- - Record learnings to progress.txt
81
- 5. If failure:
82
- - Mark task as blocked
83
- - Record error and blockers to progress.txt
84
- 6. Repeat until all tasks completed or max iterations reached
85
- ```
86
-
87
- ### Fresh Context Per Iteration
88
-
89
- Each iteration starts fresh:
90
- - New AI agent instance (clean context)
91
- - Memory persists through: git commits, PRD.json, progress.txt
92
- - AI agent reads past learnings to avoid repeating mistakes
93
-
94
- This pattern prevents "context degradation" where AI agent loses track of architectural decisions across many iterations.
95
-
96
- ## Configuration
97
-
98
- ### .rulebook Configuration
99
-
100
- ```json
101
- {
102
- "ralph": {
103
- "enabled": false,
104
- "maxIterations": 10,
105
- "tool": "claude",
106
- "maxContextLoss": 3
107
- }
108
- }
109
- ```
110
-
111
- **Options**:
112
- - `enabled`: Enable Ralph autonomous loop (default: false)
113
- - `maxIterations`: Max iterations before stopping (default: 10)
114
- - `tool`: AI CLI tool to use (default: "claude")
115
- - `"claude"` — Claude Code CLI
116
- - `"amp"` — Amp CLI (for Cursor)
117
- - `"gemini"` — Gemini CLI
118
- - `maxContextLoss`: Tolerance for incomplete agent outputs (default: 3)
119
-
120
- ### PRD Format (.rulebook-ralph/prd.json)
121
-
122
- ```json
123
- {
124
- "tasks": [
125
- {
126
- "id": "task-id",
127
- "title": "Task Title",
128
- "description": "What needs to be done",
129
- "priority": 1,
130
- "status": "pending",
131
- "acceptanceCriteria": [
132
- "Criterion 1",
133
- "Criterion 2"
134
- ],
135
- "estimatedComplexity": "medium"
136
- }
137
- ]
138
- }
139
- ```
140
-
141
- ### Progress Log (.rulebook-ralph/progress.txt)
142
-
143
- Append-only learning log:
144
-
145
- ```
146
- === Iteration 1 ===
147
- Task: implement-auth
148
- Tool: Claude Code
149
- Result: SUCCESS
150
- Learnings:
151
- - Discovered OAuth token refresh pattern (30-min expiry)
152
- - Gotcha: Tokens expire silently, need header check before retry
153
- - Pattern: Use interceptor middleware for transparent refresh
154
-
155
- === Iteration 2 ===
156
- Task: add-caching
157
- Tool: Claude Code
158
- Result: FAILED - Tests failed
159
- Error: Cache invalidation not handling concurrent updates
160
- Blockers: Need to implement distributed cache locking
161
- ```
162
-
163
- ## Usage Patterns
164
-
165
- ### Pattern 1: Progressive Feature Implementation
166
-
167
- Break large features into tasks:
168
-
169
- ```bash
170
- # Create tasks for phases
171
- rulebook task create setup-database
172
- rulebook task create create-api-endpoints
173
- rulebook task create add-authentication
174
- rulebook task create write-tests
175
-
176
- # Initialize Ralph
177
- rulebook ralph init
178
-
179
- # Run autonomous loop — implements all tasks iteratively
180
- rulebook ralph run --max-iterations 20
181
- ```
182
-
183
- ### Pattern 2: Learning Across Iterations
184
-
185
- Ralph learns from past iterations:
186
-
187
- 1. **Iteration 1**: Implements feature A, discovers pattern X
188
- 2. **Progress.txt updated**: Records pattern X
189
- 3. **Iteration 2**: Reads progress.txt, applies pattern X to feature B
190
- 4. **Iteration 3+**: Builds on discovered patterns
191
-
192
- ### Pattern 3: Pause and Resume
193
-
194
- Stop loop gracefully and resume later:
195
-
196
- ```bash
197
- # Start autonomous loop
198
- rulebook ralph run --max-iterations 100
199
-
200
- # (User presses Ctrl+C)
201
- # Loop pauses, state saved
202
-
203
- # Resume later
204
- rulebook ralph resume
205
-
206
- # Continues from last incomplete task with full history
207
- ```
208
-
209
- ## Quality Gates
210
-
211
- Ralph enforces quality checks after each iteration:
212
-
213
- ```bash
214
- # After each implementation, Ralph runs:
215
- npm run type-check # TypeScript compilation
216
- npm run lint # ESLint (0 warnings)
217
- npm run test # All tests (100% pass)
218
- npm run test:coverage # Coverage threshold met (95%)
219
- ```
220
-
221
- **If ANY gate fails**:
222
- - Task marked as `blocked` with error details
223
- - Error recorded to progress.txt
224
- - Loop continues to next task (unless `--strict` mode)
225
-
226
- ## MCP Integration
227
-
228
- Use Ralph via Model Context Protocol:
229
-
230
- ```javascript
231
- // Initialize Ralph
232
- rulebook_ralph_init({ force: false })
233
- → Returns: { success: true, taskCount: 5, prdPath: "..." }
234
-
235
- // Start autonomous loop
236
- rulebook_ralph_run({ maxIterations: 10, tool: "claude" })
237
- → Returns: { success: true, loopId: "loop-123", status: "running" }
238
-
239
- // Query loop status
240
- rulebook_ralph_status()
241
- → Returns: { loopStatus: "running", iteration: 5, currentTask: "task-id", ... }
242
-
243
- // Get iteration history
244
- rulebook_ralph_get_iteration_history({ limit: 10 })
245
- → Returns: { iterations: [...], total: 12 }
246
- ```
247
-
248
- ## Best Practices
249
-
250
- ### DO ✅
251
-
252
- - **Break features into right-sized tasks**: 1-2 context windows each
253
- - **Write clear acceptance criteria**: AI uses these to validate completion
254
- - **Monitor iteration history**: Review learnings and errors
255
- - **Run manual testing**: Ralph is automated but human review is important
256
- - **Commit frequently**: Each iteration commits, creating audit trail
257
- - **Use meaningful task IDs**: Descriptive names help AI understand context
258
-
259
- ### DON'T ❌
260
-
261
- - **Don't create huge tasks**: "Build entire backend" won't fit in one iteration
262
- - **Don't skip acceptance criteria**: AI needs clear completion signals
263
- - **Don't ignore blocked tasks**: Review errors and adjust task sizing
264
- - **Don't run without version control**: You need git history for learning
265
- - **Don't disable quality gates**: Tests catch failures early
266
-
267
- ## Troubleshooting
268
-
269
- ### Loop Stops Early
270
-
271
- **Problem**: Ralph stops before reaching max iterations
272
- **Cause**: All tasks completed (success!) or multiple blockers
273
- **Solution**: Check `rulebook ralph history` for blockers
274
-
275
- ### Same Task Keeps Failing
276
-
277
- **Problem**: Task marked blocked multiple times
278
- **Cause**: Task too large, acceptance criteria unclear, or AI context insufficient
279
- **Solution**:
280
- 1. Break task into smaller subtasks
281
- 2. Clarify acceptance criteria
282
- 3. Add examples to task spec
283
-
284
- ### Quality Gates Failing
285
-
286
- **Problem**: Type-check, lint, or tests fail after implementation
287
- **Cause**: AI-generated code doesn't meet project standards
288
- **Solution**:
289
- 1. Review error details in progress.txt
290
- 2. Update AGENTS.md with clearer standards
291
- 3. Provide more examples in task specs
292
-
293
- ## Next Steps
294
-
295
- 1. **Create tasks**: `rulebook task create <task-id>` (multiple times)
296
- 2. **Initialize Ralph**: `rulebook ralph init`
297
- 3. **Run loop**: `rulebook ralph run --max-iterations N`
298
- 4. **Monitor**: `rulebook ralph status` and `rulebook ralph history`
299
- 5. **Review**: Check generated code and learnings
300
- 6. **Deploy**: Code is committed and ready
301
-
302
- ## References
303
-
304
- - **Ralph Pattern**: https://github.com/snarktank/ralph
305
- - **Task Management**: See `RULEBOOK.md` in AGENTS.md
306
- - **Rulebook CLI**: `rulebook --help`
307
- - **MCP Server**: `rulebook-mcp` (stdio transport)
308
-
309
- <!-- RALPH:END -->
@@ -1,87 +0,0 @@
1
- #!/bin/bash
2
- # Ralph Autonomous Loop Skill Installation
3
- # This script is executed when users run: rulebook init or rulebook skill enable ralph
4
-
5
- set -e
6
-
7
- echo "🔧 Installing Ralph Autonomous Loop Skill..."
8
-
9
- # Check if rulebook is installed
10
- if ! command -v rulebook &> /dev/null; then
11
- echo "❌ Error: @hivehub/rulebook not found"
12
- echo " Install with: npm install -g @hivehub/rulebook"
13
- exit 1
14
- fi
15
-
16
- # Check if .rulebook config exists
17
- if [ ! -f ".rulebook" ]; then
18
- echo "❌ Error: .rulebook config not found"
19
- echo " Run: rulebook init"
20
- exit 1
21
- fi
22
-
23
- # Enable Ralph in .rulebook config
24
- echo "📝 Enabling Ralph in .rulebook..."
25
- if grep -q '"ralph"' .rulebook; then
26
- # Ralph section exists, update enabled flag
27
- sed -i.bak 's/"enabled": false/"enabled": true/g' .rulebook && rm -f .rulebook.bak
28
- else
29
- # Add Ralph section to config
30
- # Insert before closing }
31
- sed -i.bak '$ s/}/,\n "ralph": {\n "enabled": true,\n "maxIterations": 10,\n "tool": "claude",\n "maxContextLoss": 3\n }\n}/' .rulebook && rm -f .rulebook.bak
32
- fi
33
-
34
- # Create Ralph directories
35
- echo "📁 Creating Ralph directories..."
36
- mkdir -p .rulebook-ralph/history
37
-
38
- # Create initial PRD if tasks exist
39
- if [ -d ".rulebook/tasks" ] && [ "$(ls -A .rulebook/tasks)" ]; then
40
- echo "📋 Generating PRD from existing tasks..."
41
- rulebook ralph init || echo "⚠️ Could not auto-generate PRD. Run: rulebook ralph init"
42
- else
43
- echo "💡 No tasks found. Create tasks first: rulebook task create <task-id>"
44
- fi
45
-
46
- # Create .cursorrules entry for Ralph if working with Claude Code
47
- if [ -f ".cursorrules" ]; then
48
- echo "🔗 Updating .cursorrules for Ralph..."
49
- cat >> .cursorrules << 'EOF'
50
-
51
- ## Ralph Autonomous Loop
52
-
53
- When working with Ralph autonomous loop:
54
-
55
- 1. **Before each iteration**:
56
- - Read .rulebook-ralph/prd.json for task specifications
57
- - Read .rulebook-ralph/progress.txt for past learnings
58
- - Reference recent git commits for architectural context
59
-
60
- 2. **During implementation**:
61
- - Focus on ONE task from PRD
62
- - Apply patterns from progress.txt
63
- - Write tests first (95%+ coverage required)
64
-
65
- 3. **After implementation**:
66
- - Run quality gates: type-check, lint, tests, coverage
67
- - Commit with clear message including iteration number
68
- - Ralph will update progress.txt with learnings
69
-
70
- 4. **Commands**:
71
- - Check status: rulebook ralph status
72
- - View history: rulebook ralph history
73
- - Pause loop: rulebook ralph pause (Ctrl+C)
74
- - Resume: rulebook ralph resume
75
- EOF
76
- fi
77
-
78
- echo ""
79
- echo "✅ Ralph Autonomous Loop Skill Installed!"
80
- echo ""
81
- echo "📖 Next steps:"
82
- echo " 1. Create tasks: rulebook task create <task-id>"
83
- echo " 2. Initialize Ralph: rulebook ralph init"
84
- echo " 3. Start loop: rulebook ralph run [--max-iterations N] [--tool claude]"
85
- echo " 4. Monitor: rulebook ralph status"
86
- echo ""
87
- echo "📚 For more info: rulebook ralph --help"