@hivehub/rulebook 5.4.1 → 5.5.1

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 (418) hide show
  1. package/.claude/commands/analysis.md +35 -35
  2. package/.claude/commands/continue.md +33 -33
  3. package/.claude/commands/ralph-config.md +112 -112
  4. package/.claude/commands/ralph-history.md +110 -110
  5. package/.claude/commands/ralph-init.md +72 -72
  6. package/.claude/commands/ralph-pause-resume.md +105 -105
  7. package/.claude/commands/ralph-run.md +101 -101
  8. package/.claude/commands/ralph-status.md +76 -76
  9. package/.claude/commands/rulebook-decision-create.md +55 -55
  10. package/.claude/commands/rulebook-decision-list.md +15 -15
  11. package/.claude/commands/rulebook-knowledge-add.md +41 -41
  12. package/.claude/commands/rulebook-knowledge-list.md +15 -15
  13. package/.claude/commands/rulebook-learn-capture.md +48 -48
  14. package/.claude/commands/rulebook-learn-list.md +13 -13
  15. package/.claude/commands/rulebook-memory-save.md +48 -48
  16. package/.claude/commands/rulebook-memory-search.md +47 -47
  17. package/.claude/commands/rulebook-task-apply.md +67 -67
  18. package/.claude/commands/rulebook-task-archive.md +94 -94
  19. package/.claude/commands/rulebook-task-create.md +93 -93
  20. package/.claude/commands/rulebook-task-list.md +42 -42
  21. package/.claude/commands/rulebook-task-show.md +52 -52
  22. package/.claude/commands/rulebook-task-validate.md +53 -53
  23. package/.claude-plugin/marketplace.json +28 -28
  24. package/.claude-plugin/plugin.json +8 -8
  25. package/README.md +394 -393
  26. package/dist/core/generator.d.ts +1 -1
  27. package/dist/core/generator.d.ts.map +1 -1
  28. package/dist/core/generator.js +1 -0
  29. package/dist/core/generator.js.map +1 -1
  30. package/dist/hooks/terse-activate.d.ts +59 -0
  31. package/dist/hooks/terse-activate.d.ts.map +1 -0
  32. package/dist/hooks/terse-activate.js +149 -0
  33. package/dist/hooks/terse-activate.js.map +1 -0
  34. package/dist/hooks/terse-config.d.ts +51 -0
  35. package/dist/hooks/terse-config.d.ts.map +1 -0
  36. package/dist/hooks/terse-config.js +130 -0
  37. package/dist/hooks/terse-config.js.map +1 -0
  38. package/dist/hooks/terse-mode-tracker.d.ts +78 -0
  39. package/dist/hooks/terse-mode-tracker.d.ts.map +1 -0
  40. package/dist/hooks/terse-mode-tracker.js +213 -0
  41. package/dist/hooks/terse-mode-tracker.js.map +1 -0
  42. package/dist/index.js +0 -0
  43. package/dist/mcp/rulebook-server.js +0 -0
  44. package/package.json +21 -22
  45. package/templates/agents/accessibility-reviewer.md +43 -43
  46. package/templates/agents/api-designer.md +42 -42
  47. package/templates/agents/architect.md +51 -51
  48. package/templates/agents/build-engineer.md +36 -36
  49. package/templates/agents/code-reviewer.md +47 -47
  50. package/templates/agents/compiler/codegen-debugger.md +34 -34
  51. package/templates/agents/compiler/stdlib-engineer.md +28 -28
  52. package/templates/agents/compiler/test-coverage-guardian.md +31 -31
  53. package/templates/agents/context-intelligence.md +52 -52
  54. package/templates/agents/database-architect.md +41 -41
  55. package/templates/agents/devops-engineer.md +42 -42
  56. package/templates/agents/docs-writer.md +38 -38
  57. package/templates/agents/game-engine/cpp-core-expert.md +35 -35
  58. package/templates/agents/game-engine/render-engineer.md +22 -22
  59. package/templates/agents/game-engine/shader-engineer.md +38 -38
  60. package/templates/agents/game-engine/systems-integration.md +43 -43
  61. package/templates/agents/generic/code-reviewer.md +41 -41
  62. package/templates/agents/generic/docs-writer.md +25 -25
  63. package/templates/agents/generic/project-manager.md +36 -36
  64. package/templates/agents/generic/researcher.md +34 -34
  65. package/templates/agents/generic/test-engineer.md +41 -41
  66. package/templates/agents/i18n-engineer.md +42 -42
  67. package/templates/agents/implementer.md +42 -42
  68. package/templates/agents/migration-engineer.md +42 -42
  69. package/templates/agents/mobile/platform-specialist.md +22 -22
  70. package/templates/agents/mobile/ui-engineer.md +22 -22
  71. package/templates/agents/performance-engineer.md +49 -49
  72. package/templates/agents/refactoring-agent.md +41 -41
  73. package/templates/agents/researcher.md +38 -38
  74. package/templates/agents/security-reviewer.md +40 -40
  75. package/templates/agents/team-lead.md +37 -37
  76. package/templates/agents/tester.md +48 -48
  77. package/templates/agents/ux-reviewer.md +43 -43
  78. package/templates/agents/web-app/api-designer.md +22 -22
  79. package/templates/agents/web-app/backend-engineer.md +30 -30
  80. package/templates/agents/web-app/database-engineer.md +22 -22
  81. package/templates/agents/web-app/frontend-engineer.md +29 -29
  82. package/templates/agents/web-app/security-reviewer.md +32 -32
  83. package/templates/ci/rulebook-review.yml +26 -26
  84. package/templates/cli/AIDER.md +49 -49
  85. package/templates/cli/AMAZON_Q.md +25 -25
  86. package/templates/cli/AUGGIE.md +32 -32
  87. package/templates/cli/CLAUDE.md +117 -117
  88. package/templates/cli/CLINE.md +99 -99
  89. package/templates/cli/CODEBUDDY.md +20 -20
  90. package/templates/cli/CODEIUM.md +20 -20
  91. package/templates/cli/CODEX.md +21 -21
  92. package/templates/cli/CONTINUE.md +34 -34
  93. package/templates/cli/CURSOR_CLI.md +62 -62
  94. package/templates/cli/FACTORY.md +18 -18
  95. package/templates/cli/GEMINI.md +35 -35
  96. package/templates/cli/KILOCODE.md +18 -18
  97. package/templates/cli/OPENCODE.md +18 -18
  98. package/templates/cli/_GENERIC_TEMPLATE.md +29 -29
  99. package/templates/commands/rulebook-decision-create.md +55 -55
  100. package/templates/commands/rulebook-decision-list.md +15 -15
  101. package/templates/commands/rulebook-knowledge-add.md +41 -41
  102. package/templates/commands/rulebook-knowledge-list.md +15 -15
  103. package/templates/commands/rulebook-learn-capture.md +48 -48
  104. package/templates/commands/rulebook-learn-list.md +13 -13
  105. package/templates/commands/rulebook-memory-save.md +48 -48
  106. package/templates/commands/rulebook-memory-search.md +47 -47
  107. package/templates/commands/rulebook-task-apply.md +67 -67
  108. package/templates/commands/rulebook-task-archive.md +94 -94
  109. package/templates/commands/rulebook-task-create.md +93 -93
  110. package/templates/commands/rulebook-task-list.md +42 -42
  111. package/templates/commands/rulebook-task-show.md +52 -52
  112. package/templates/commands/rulebook-task-validate.md +53 -53
  113. package/templates/compact-context/_default.md +23 -23
  114. package/templates/compact-context/cpp.md +26 -26
  115. package/templates/compact-context/go.md +26 -26
  116. package/templates/compact-context/python.md +26 -26
  117. package/templates/compact-context/rust.md +28 -28
  118. package/templates/compact-context/typescript.md +29 -29
  119. package/templates/core/AGENTS_LEAN.md +26 -1
  120. package/templates/core/AGENTS_OVERRIDE.md +16 -16
  121. package/templates/core/AGENT_AUTOMATION.md +296 -296
  122. package/templates/core/CLAUDE_MD_v2.md +90 -71
  123. package/templates/core/DAG.md +304 -304
  124. package/templates/core/DECISIONS.md +38 -38
  125. package/templates/core/DOCUMENTATION_RULES.md +36 -36
  126. package/templates/core/KNOWLEDGE.md +49 -49
  127. package/templates/core/MULTI_AGENT.md +74 -74
  128. package/templates/core/PLANS.md +28 -28
  129. package/templates/core/QUALITY_ENFORCEMENT.md +68 -68
  130. package/templates/core/RALPH.md +471 -471
  131. package/templates/core/RULEBOOK.md +1947 -1947
  132. package/templates/core/TIER1_PROHIBITIONS.md +154 -154
  133. package/templates/core/TOKEN_OPTIMIZATION.md +49 -49
  134. package/templates/frameworks/ANGULAR.md +36 -36
  135. package/templates/frameworks/DJANGO.md +83 -83
  136. package/templates/frameworks/ELECTRON.md +147 -147
  137. package/templates/frameworks/FLASK.md +38 -38
  138. package/templates/frameworks/FLUTTER.md +55 -55
  139. package/templates/frameworks/JQUERY.md +32 -32
  140. package/templates/frameworks/LARAVEL.md +38 -38
  141. package/templates/frameworks/NESTJS.md +43 -43
  142. package/templates/frameworks/NEXTJS.md +127 -127
  143. package/templates/frameworks/NUXT.md +40 -40
  144. package/templates/frameworks/RAILS.md +66 -66
  145. package/templates/frameworks/REACT.md +38 -38
  146. package/templates/frameworks/REACT_NATIVE.md +47 -47
  147. package/templates/frameworks/SPRING.md +39 -39
  148. package/templates/frameworks/SYMFONY.md +36 -36
  149. package/templates/frameworks/VUE.md +36 -36
  150. package/templates/frameworks/ZEND.md +35 -35
  151. package/templates/git/CI_CD_PATTERNS.md +661 -661
  152. package/templates/git/GITHUB_ACTIONS.md +728 -728
  153. package/templates/git/GITLAB_CI.md +730 -730
  154. package/templates/git/GIT_WORKFLOW.md +1192 -1192
  155. package/templates/git/SECRETS_MANAGEMENT.md +585 -585
  156. package/templates/hooks/COMMIT_MSG.md +530 -530
  157. package/templates/hooks/POST_CHECKOUT.md +546 -546
  158. package/templates/hooks/PREPARE_COMMIT_MSG.md +619 -619
  159. package/templates/hooks/PRE_COMMIT.md +414 -414
  160. package/templates/hooks/PRE_PUSH.md +601 -601
  161. package/templates/hooks/check-context-and-handoff.ps1 +58 -58
  162. package/templates/hooks/check-context-and-handoff.sh +76 -76
  163. package/templates/hooks/enforce-team-for-background-agents.ps1 +63 -63
  164. package/templates/hooks/enforce-team-for-background-agents.sh +55 -55
  165. package/templates/hooks/on-compact-reinject.sh +34 -34
  166. package/templates/hooks/resume-from-handoff.ps1 +40 -40
  167. package/templates/hooks/resume-from-handoff.sh +61 -61
  168. package/templates/hooks/terse-activate.ps1 +143 -143
  169. package/templates/hooks/terse-activate.sh +197 -197
  170. package/templates/hooks/terse-mode-tracker.ps1 +153 -153
  171. package/templates/hooks/terse-mode-tracker.sh +187 -187
  172. package/templates/ides/CONTINUE_RULES.md +16 -16
  173. package/templates/ides/COPILOT.md +37 -37
  174. package/templates/ides/COPILOT_INSTRUCTIONS.md +23 -23
  175. package/templates/ides/CURSOR.md +43 -43
  176. package/templates/ides/GEMINI_RULES.md +17 -17
  177. package/templates/ides/JETBRAINS_AI.md +35 -35
  178. package/templates/ides/REPLIT.md +36 -36
  179. package/templates/ides/TABNINE.md +29 -29
  180. package/templates/ides/VSCODE.md +40 -40
  181. package/templates/ides/WINDSURF.md +36 -36
  182. package/templates/ides/WINDSURF_RULES.md +14 -14
  183. package/templates/ides/ZED.md +32 -32
  184. package/templates/ides/cursor-mdc/go.mdc +24 -24
  185. package/templates/ides/cursor-mdc/python.mdc +24 -24
  186. package/templates/ides/cursor-mdc/quality.mdc +25 -25
  187. package/templates/ides/cursor-mdc/ralph.mdc +39 -39
  188. package/templates/ides/cursor-mdc/rulebook.mdc +38 -38
  189. package/templates/ides/cursor-mdc/rust.mdc +24 -24
  190. package/templates/ides/cursor-mdc/typescript.mdc +25 -25
  191. package/templates/languages/C.md +333 -333
  192. package/templates/languages/CPP.md +743 -743
  193. package/templates/languages/CSHARP.md +417 -417
  194. package/templates/languages/ELIXIR.md +454 -454
  195. package/templates/languages/ERLANG.md +361 -361
  196. package/templates/languages/GO.md +645 -645
  197. package/templates/languages/HASKELL.md +177 -177
  198. package/templates/languages/JAVA.md +607 -607
  199. package/templates/languages/JAVASCRIPT.md +631 -631
  200. package/templates/languages/JULIA.md +97 -97
  201. package/templates/languages/KOTLIN.md +511 -511
  202. package/templates/languages/LISP.md +100 -100
  203. package/templates/languages/LUA.md +74 -74
  204. package/templates/languages/OBJECTIVEC.md +90 -90
  205. package/templates/languages/PHP.md +416 -416
  206. package/templates/languages/PYTHON.md +682 -682
  207. package/templates/languages/RUBY.md +421 -421
  208. package/templates/languages/RUST.md +477 -477
  209. package/templates/languages/SAS.md +73 -73
  210. package/templates/languages/SCALA.md +348 -348
  211. package/templates/languages/SOLIDITY.md +580 -580
  212. package/templates/languages/SQL.md +137 -137
  213. package/templates/languages/SWIFT.md +466 -466
  214. package/templates/languages/TYPESCRIPT.md +591 -591
  215. package/templates/languages/ZIG.md +265 -265
  216. package/templates/modules/ATLASSIAN.md +255 -255
  217. package/templates/modules/CONTEXT7.md +54 -54
  218. package/templates/modules/FIGMA.md +267 -267
  219. package/templates/modules/GITHUB_MCP.md +64 -64
  220. package/templates/modules/GRAFANA.md +328 -328
  221. package/templates/modules/MEMORY.md +126 -126
  222. package/templates/modules/NOTION.md +247 -247
  223. package/templates/modules/PLAYWRIGHT.md +90 -90
  224. package/templates/modules/RULEBOOK_MCP.md +208 -208
  225. package/templates/modules/SERENA.md +337 -337
  226. package/templates/modules/SUPABASE.md +223 -223
  227. package/templates/modules/SYNAP.md +69 -69
  228. package/templates/modules/VECTORIZER.md +63 -63
  229. package/templates/modules/sequential-thinking.md +42 -42
  230. package/templates/ralph/ralph-history.bat +4 -4
  231. package/templates/ralph/ralph-history.sh +5 -5
  232. package/templates/ralph/ralph-init.bat +5 -5
  233. package/templates/ralph/ralph-init.sh +5 -5
  234. package/templates/ralph/ralph-pause.bat +5 -5
  235. package/templates/ralph/ralph-pause.sh +5 -5
  236. package/templates/ralph/ralph-run.bat +5 -5
  237. package/templates/ralph/ralph-run.sh +5 -5
  238. package/templates/ralph/ralph-status.bat +4 -4
  239. package/templates/ralph/ralph-status.sh +5 -5
  240. package/templates/rules/consult-analysis-before-implementing.md +23 -23
  241. package/templates/rules/cpp.md +46 -46
  242. package/templates/rules/csharp.md +44 -44
  243. package/templates/rules/diagnostic-first.md +39 -39
  244. package/templates/rules/fail-twice-escalate.md +46 -46
  245. package/templates/rules/follow-task-sequence.md +36 -36
  246. package/templates/rules/git-safety.md +29 -29
  247. package/templates/rules/go.md +40 -40
  248. package/templates/rules/incremental-implementation.md +56 -56
  249. package/templates/rules/incremental-tests.md +29 -29
  250. package/templates/rules/java.md +43 -43
  251. package/templates/rules/javascript.md +39 -39
  252. package/templates/rules/knowledge-base-usage.md +41 -41
  253. package/templates/rules/multi-agent-teams.md +75 -75
  254. package/templates/rules/no-deferred.md +31 -31
  255. package/templates/rules/no-shortcuts.md +30 -30
  256. package/templates/rules/python.md +43 -43
  257. package/templates/rules/research-first.md +30 -30
  258. package/templates/rules/respect-handoff-trigger.md +41 -41
  259. package/templates/rules/rust.md +40 -40
  260. package/templates/rules/sequential-editing.md +21 -21
  261. package/templates/rules/session-workflow.md +24 -24
  262. package/templates/rules/task-decomposition.md +32 -32
  263. package/templates/rules/typescript.md +40 -40
  264. package/templates/services/AZURE_BLOB.md +184 -184
  265. package/templates/services/CASSANDRA.md +239 -239
  266. package/templates/services/DATADOG.md +26 -26
  267. package/templates/services/DOCKER.md +124 -124
  268. package/templates/services/DOCKER_COMPOSE.md +168 -168
  269. package/templates/services/DYNAMODB.md +308 -308
  270. package/templates/services/ELASTICSEARCH.md +347 -347
  271. package/templates/services/GCS.md +178 -178
  272. package/templates/services/HELM.md +194 -194
  273. package/templates/services/INFLUXDB.md +265 -265
  274. package/templates/services/KAFKA.md +341 -341
  275. package/templates/services/KUBERNETES.md +208 -208
  276. package/templates/services/MARIADB.md +183 -183
  277. package/templates/services/MEMCACHED.md +242 -242
  278. package/templates/services/MINIO.md +201 -201
  279. package/templates/services/MONGODB.md +268 -268
  280. package/templates/services/MYSQL.md +358 -358
  281. package/templates/services/NEO4J.md +247 -247
  282. package/templates/services/OPENTELEMETRY.md +25 -25
  283. package/templates/services/ORACLE.md +290 -290
  284. package/templates/services/PINO.md +24 -24
  285. package/templates/services/POSTGRESQL.md +326 -326
  286. package/templates/services/PROMETHEUS.md +33 -33
  287. package/templates/services/RABBITMQ.md +286 -286
  288. package/templates/services/REDIS.md +292 -292
  289. package/templates/services/S3.md +298 -298
  290. package/templates/services/SENTRY.md +23 -23
  291. package/templates/services/SQLITE.md +294 -294
  292. package/templates/services/SQLSERVER.md +294 -294
  293. package/templates/services/WINSTON.md +30 -30
  294. package/templates/skills/cli/aider/SKILL.md +59 -59
  295. package/templates/skills/cli/amazon-q/SKILL.md +35 -35
  296. package/templates/skills/cli/auggie/SKILL.md +42 -42
  297. package/templates/skills/cli/claude/SKILL.md +42 -42
  298. package/templates/skills/cli/cline/SKILL.md +42 -42
  299. package/templates/skills/cli/codebuddy/SKILL.md +30 -30
  300. package/templates/skills/cli/codeium/SKILL.md +30 -30
  301. package/templates/skills/cli/codex/SKILL.md +31 -31
  302. package/templates/skills/cli/continue/SKILL.md +44 -44
  303. package/templates/skills/cli/cursor-cli/SKILL.md +38 -38
  304. package/templates/skills/cli/factory/SKILL.md +28 -28
  305. package/templates/skills/cli/gemini/SKILL.md +45 -45
  306. package/templates/skills/cli/kilocode/SKILL.md +28 -28
  307. package/templates/skills/cli/opencode/SKILL.md +28 -28
  308. package/templates/skills/core/agent-automation/SKILL.md +194 -194
  309. package/templates/skills/core/dag/SKILL.md +314 -314
  310. package/templates/skills/core/documentation-rules/SKILL.md +46 -46
  311. package/templates/skills/core/karpathy-guidelines/SKILL.md +93 -0
  312. package/templates/skills/core/quality-enforcement/SKILL.md +78 -78
  313. package/templates/skills/core/rulebook/SKILL.md +176 -176
  314. package/templates/skills/core/rulebook-terse/SKILL.md +116 -116
  315. package/templates/skills/core/rulebook-terse-commit/SKILL.md +96 -96
  316. package/templates/skills/core/rulebook-terse-review/SKILL.md +112 -112
  317. package/templates/skills/dev/accessibility/SKILL.md +17 -17
  318. package/templates/skills/dev/analysis/SKILL.md +19 -19
  319. package/templates/skills/dev/api-design/SKILL.md +15 -15
  320. package/templates/skills/dev/architect/SKILL.md +17 -17
  321. package/templates/skills/dev/build-fix/SKILL.md +17 -17
  322. package/templates/skills/dev/db-design/SKILL.md +15 -15
  323. package/templates/skills/dev/debug/SKILL.md +16 -16
  324. package/templates/skills/dev/deploy/SKILL.md +17 -17
  325. package/templates/skills/dev/docs/SKILL.md +17 -17
  326. package/templates/skills/dev/handoff/SKILL.md +27 -27
  327. package/templates/skills/dev/migrate/SKILL.md +15 -15
  328. package/templates/skills/dev/perf/SKILL.md +17 -17
  329. package/templates/skills/dev/refactor/SKILL.md +17 -17
  330. package/templates/skills/dev/research/SKILL.md +14 -14
  331. package/templates/skills/dev/review/SKILL.md +18 -18
  332. package/templates/skills/dev/security-audit/SKILL.md +17 -17
  333. package/templates/skills/frameworks/angular/SKILL.md +46 -46
  334. package/templates/skills/frameworks/django/SKILL.md +93 -93
  335. package/templates/skills/frameworks/electron/SKILL.md +157 -157
  336. package/templates/skills/frameworks/flask/SKILL.md +48 -48
  337. package/templates/skills/frameworks/flutter/SKILL.md +65 -65
  338. package/templates/skills/frameworks/jquery/SKILL.md +42 -42
  339. package/templates/skills/frameworks/laravel/SKILL.md +48 -48
  340. package/templates/skills/frameworks/nestjs/SKILL.md +53 -53
  341. package/templates/skills/frameworks/nextjs/SKILL.md +137 -137
  342. package/templates/skills/frameworks/nuxt/SKILL.md +50 -50
  343. package/templates/skills/frameworks/rails/SKILL.md +76 -76
  344. package/templates/skills/frameworks/react/SKILL.md +48 -48
  345. package/templates/skills/frameworks/react-native/SKILL.md +57 -57
  346. package/templates/skills/frameworks/spring/SKILL.md +49 -49
  347. package/templates/skills/frameworks/symfony/SKILL.md +46 -46
  348. package/templates/skills/frameworks/vue/SKILL.md +46 -46
  349. package/templates/skills/frameworks/zend/SKILL.md +45 -45
  350. package/templates/skills/ides/copilot/SKILL.md +47 -47
  351. package/templates/skills/ides/cursor/SKILL.md +53 -53
  352. package/templates/skills/ides/jetbrains-ai/SKILL.md +45 -45
  353. package/templates/skills/ides/replit/SKILL.md +46 -46
  354. package/templates/skills/ides/tabnine/SKILL.md +39 -39
  355. package/templates/skills/ides/vscode/SKILL.md +50 -50
  356. package/templates/skills/ides/windsurf/SKILL.md +46 -46
  357. package/templates/skills/ides/zed/SKILL.md +42 -42
  358. package/templates/skills/languages/c/SKILL.md +343 -343
  359. package/templates/skills/languages/cpp/SKILL.md +753 -753
  360. package/templates/skills/languages/csharp/SKILL.md +427 -427
  361. package/templates/skills/languages/elixir/SKILL.md +464 -464
  362. package/templates/skills/languages/erlang/SKILL.md +371 -371
  363. package/templates/skills/languages/go/SKILL.md +655 -655
  364. package/templates/skills/languages/haskell/SKILL.md +187 -187
  365. package/templates/skills/languages/java/SKILL.md +617 -617
  366. package/templates/skills/languages/javascript/SKILL.md +641 -641
  367. package/templates/skills/languages/julia/SKILL.md +107 -107
  368. package/templates/skills/languages/kotlin/SKILL.md +521 -521
  369. package/templates/skills/languages/lisp/SKILL.md +110 -110
  370. package/templates/skills/languages/lua/SKILL.md +84 -84
  371. package/templates/skills/languages/objectivec/SKILL.md +100 -100
  372. package/templates/skills/languages/php/SKILL.md +426 -426
  373. package/templates/skills/languages/python/SKILL.md +692 -692
  374. package/templates/skills/languages/ruby/SKILL.md +431 -431
  375. package/templates/skills/languages/rust/SKILL.md +487 -487
  376. package/templates/skills/languages/sas/SKILL.md +83 -83
  377. package/templates/skills/languages/scala/SKILL.md +358 -358
  378. package/templates/skills/languages/solidity/SKILL.md +590 -590
  379. package/templates/skills/languages/sql/SKILL.md +147 -147
  380. package/templates/skills/languages/swift/SKILL.md +476 -476
  381. package/templates/skills/languages/typescript/SKILL.md +302 -302
  382. package/templates/skills/languages/zig/SKILL.md +275 -275
  383. package/templates/skills/modules/atlassian/SKILL.md +265 -265
  384. package/templates/skills/modules/context7/SKILL.md +64 -64
  385. package/templates/skills/modules/figma/SKILL.md +277 -277
  386. package/templates/skills/modules/github-mcp/SKILL.md +74 -74
  387. package/templates/skills/modules/grafana/SKILL.md +338 -338
  388. package/templates/skills/modules/memory/SKILL.md +73 -73
  389. package/templates/skills/modules/notion/SKILL.md +257 -257
  390. package/templates/skills/modules/playwright/SKILL.md +100 -100
  391. package/templates/skills/modules/rulebook-mcp/SKILL.md +166 -166
  392. package/templates/skills/modules/serena/SKILL.md +347 -347
  393. package/templates/skills/modules/supabase/SKILL.md +233 -233
  394. package/templates/skills/modules/synap/SKILL.md +79 -79
  395. package/templates/skills/modules/vectorizer/SKILL.md +73 -73
  396. package/templates/skills/services/azure-blob/SKILL.md +194 -194
  397. package/templates/skills/services/cassandra/SKILL.md +249 -249
  398. package/templates/skills/services/dynamodb/SKILL.md +318 -318
  399. package/templates/skills/services/elasticsearch/SKILL.md +357 -357
  400. package/templates/skills/services/gcs/SKILL.md +188 -188
  401. package/templates/skills/services/influxdb/SKILL.md +275 -275
  402. package/templates/skills/services/kafka/SKILL.md +351 -351
  403. package/templates/skills/services/mariadb/SKILL.md +193 -193
  404. package/templates/skills/services/memcached/SKILL.md +252 -252
  405. package/templates/skills/services/minio/SKILL.md +211 -211
  406. package/templates/skills/services/mongodb/SKILL.md +278 -278
  407. package/templates/skills/services/mysql/SKILL.md +368 -368
  408. package/templates/skills/services/neo4j/SKILL.md +257 -257
  409. package/templates/skills/services/oracle/SKILL.md +300 -300
  410. package/templates/skills/services/postgresql/SKILL.md +336 -336
  411. package/templates/skills/services/rabbitmq/SKILL.md +296 -296
  412. package/templates/skills/services/redis/SKILL.md +302 -302
  413. package/templates/skills/services/s3/SKILL.md +308 -308
  414. package/templates/skills/services/sqlite/SKILL.md +304 -304
  415. package/templates/skills/services/sqlserver/SKILL.md +304 -304
  416. package/templates/skills/workflows/ralph/SKILL.md +309 -309
  417. package/templates/skills/workflows/ralph/install.sh +87 -87
  418. package/templates/skills/workflows/ralph/manifest.json +158 -158
@@ -1,1947 +1,1947 @@
1
- <!-- RULEBOOK:START -->
2
- # Rulebook Task Management
3
-
4
- **CRITICAL**: Use Rulebook's built-in task management system for spec-driven development of new features and breaking changes.
5
-
6
- ## When to Use
7
-
8
- Create tasks for:
9
- - ✅ New features/capabilities
10
- - ✅ Breaking changes
11
- - ✅ Architecture changes
12
- - ✅ Performance/security work
13
-
14
- Skip for:
15
- - ❌ Bug fixes (restore intended behavior)
16
- - ❌ Typos, formatting, comments
17
- - ❌ Dependency updates (non-breaking)
18
-
19
- ## Persistent Memory Integration
20
-
21
- **IMPORTANT**: Task management is tightly integrated with persistent memory system for cross-session context:
22
-
23
- ### Task Completion and Memory
24
- When a task is marked as completed:
25
- 1. **Auto-save to memory** (if enabled): Key learnings, patterns, gotchas from task specs are captured
26
- 2. **Search past tasks**: Before creating similar tasks, search memory for past implementations:
27
- ```bash
28
- rulebook memory search "authentication" --type feature
29
- ```
30
- 3. **Update implementation faster**: Reference past solutions documented in memory
31
-
32
- ### Memory during Task Development
33
- As you work on a task:
34
- - **Save discoveries**: Use `rulebook memory save` to capture patterns and gotchas
35
- - **Reference past context**: Search memory for related implementations
36
- - **Document decisions**: Save architectural choices for future developers
37
-
38
- ## ⚠️ CRITICAL: Task Creation is MANDATORY Before Implementation
39
-
40
- **ABSOLUTE RULE**: You MUST create a task BEFORE implementing ANY feature.
41
-
42
- ### Why This Matters
43
-
44
- **Without task registration:**
45
- - ❌ Tasks can be lost in context
46
- - ❌ No tracking of implementation progress
47
- - ❌ No record of what was done and why
48
- - ❌ Difficult to resume work after context loss
49
- - ❌ No validation of completion criteria
50
-
51
- **With task registration:**
52
- - ✅ All features are tracked and documented
53
- - ✅ Progress is visible and measurable
54
- - ✅ Implementation history is preserved
55
- - ✅ Easy to resume work from any point
56
- - ✅ Clear completion criteria
57
-
58
- ### MANDATORY Workflow
59
-
60
- **NEVER start implementation without creating a task first:**
61
-
62
- ```bash
63
- # ❌ WRONG: Starting implementation directly
64
- # ... writing code without task ...
65
-
66
- # ✅ CORRECT: Create task first
67
- rulebook task create <task-id>
68
- # Write proposal.md
69
- # Write tasks.md
70
- # Write spec deltas
71
- rulebook task validate <task-id>
72
- # NOW you can start implementation
73
- ```
74
-
75
- ### Task Creation Before Any Feature Request
76
-
77
- **When a feature is requested:**
78
-
79
- 1. **STOP** - Do not start coding
80
- 2. **Create task** - `rulebook task create <task-id>`
81
- 3. **Plan** - Write proposal.md and tasks.md
82
- 4. **Spec** - Write spec deltas
83
- 5. **Validate** - `rulebook task validate <task-id>`
84
- 6. **THEN** - Start implementation
85
-
86
- **Example:**
87
- ```
88
- User: "Add user authentication feature"
89
-
90
- ❌ WRONG: Start coding immediately
91
- ✅ CORRECT:
92
- 1. rulebook task create add-user-authentication
93
- 2. Write proposal.md explaining why and what
94
- 3. Write tasks.md with implementation checklist
95
- 4. Write specs/core/spec.md with requirements
96
- 5. rulebook task validate add-user-authentication
97
- 6. NOW start implementing
98
- ```
99
-
100
- ## CRITICAL: Task Creation Workflow
101
-
102
- **MANDATORY STEPS** - Follow in this exact order:
103
-
104
- ### Step 1: Check Context7 MCP (MANDATORY)
105
-
106
- **BEFORE creating ANY task, you MUST:**
107
-
108
- 1. **Query Context7 for OpenSpec documentation** (Rulebook uses OpenSpec-compatible format):
109
- ```
110
- @Context7 /fission-ai/openspec task creation format spec structure
111
- ```
112
-
113
- 2. **Review official format requirements**:
114
- - Spec delta file format
115
- - Requirement structure
116
- - Scenario formatting
117
- - Delta headers (ADDED/MODIFIED/REMOVED/RENAMED)
118
-
119
- 3. **Verify format requirements**:
120
- - Scenario MUST use `#### Scenario:` (4 hashtags, NOT 3, NOT bullets)
121
- - Requirements MUST use `### Requirement: [Name]`
122
- - MUST include SHALL/MUST statement after requirement name
123
- - MUST include at least one scenario per requirement
124
- - Purpose section MUST have minimum 20 characters
125
-
126
- **Why This Matters:**
127
- Most AI assistants create tasks with incorrect formats (wrong scenario headers, missing SHALL statements, incomplete deltas). Context7 provides the official format documentation that prevents validation failures.
128
-
129
- ### Step 2: Explore Current State
130
-
131
- ```bash
132
- # List existing tasks
133
- rulebook task list
134
-
135
- # List active changes
136
- rulebook task list --active
137
-
138
- # View task details
139
- rulebook task show <task-id>
140
- ```
141
-
142
- ### Step 3: Choose Task ID
143
-
144
- - Use **verb-led** kebab-case: `add-auth`, `update-api`, `remove-feature`, `refactor-module`
145
- - Must be unique (check existing tasks)
146
- - Descriptive and focused (one capability per task)
147
-
148
- ### Step 4: Create Task Structure
149
-
150
- ```bash
151
- # Create new task
152
- rulebook task create <task-id>
153
-
154
- # This creates:
155
- # /.rulebook/tasks/<task-id>/
156
- # ├── proposal.md # Why and what changes
157
- # ├── tasks.md # Implementation checklist
158
- # ├── design.md # Technical decisions (optional)
159
- # └── specs/
160
- # └── <module>/
161
- # └── spec.md # Delta showing additions/modifications
162
- ```
163
-
164
- ### Step 5: Write Proposal
165
-
166
- **File**: `/.rulebook/tasks/<task-id>/proposal.md`
167
-
168
- ```markdown
169
- # Proposal: Task Name
170
-
171
- ## Why
172
- Minimum 20 characters explaining why this change is needed.
173
- Provide context, motivation, and business/technical rationale.
174
-
175
- ## What Changes
176
- Detailed description of what will change:
177
- - Specific components affected
178
- - New features or capabilities
179
- - Breaking changes (if any)
180
- - Migration path (if applicable)
181
-
182
- ## Impact
183
- - Affected specs: list spec names
184
- - Affected code: list files/modules
185
- - Breaking change: YES/NO
186
- - User benefit: describe benefits
187
- ```
188
-
189
- ### Step 6: Write Tasks Checklist
190
-
191
- **File**: `/.rulebook/tasks/<task-id>/tasks.md`
192
-
193
- ```markdown
194
- ## 1. Implementation Phase
195
- - [ ] 1.1 First task item
196
- - [ ] 1.2 Second task item
197
-
198
- ## 2. Testing Phase
199
- - [ ] 2.1 Write unit tests
200
- - [ ] 2.2 Write integration tests
201
-
202
- ## 3. Documentation Phase
203
- - [ ] 3.1 Update README
204
- - [ ] 3.2 Update CHANGELOG
205
- ```
206
-
207
- **⚠️ CRITICAL: Sequential Execution Rule**
208
-
209
- When implementing tasks from `tasks.md`, you MUST execute items **in the exact order listed**:
210
-
211
- 1. Find the FIRST unchecked item (`- [ ]`) — implement THAT one
212
- 2. Mark it `[x]` when done
213
- 3. Move to the NEXT unchecked item
214
- 4. **NEVER** skip ahead, reorder, or cherry-pick tasks
215
- 5. **NEVER** start a later phase before the current phase is 100% complete
216
-
217
- **The task list is an ORDER, not a MENU.** The human defined the sequence deliberately. Follow it.
218
-
219
- ### Step 7: Write Spec Delta
220
-
221
- **File**: `/.rulebook/tasks/<task-id>/specs/<module>/spec.md`
222
-
223
- **CRITICAL FORMAT REQUIREMENTS:**
224
-
225
- ```markdown
226
- # Specification Name
227
-
228
- ## ADDED Requirements
229
-
230
- ### Requirement: Feature Name
231
- The system SHALL/MUST do something specific and testable.
232
- Every requirement needs SHALL or MUST keyword.
233
-
234
- #### Scenario: Scenario Name
235
- Given some precondition
236
- When an action occurs
237
- Then an expected outcome happens
238
-
239
- ## MODIFIED Requirements
240
-
241
- ### Requirement: Existing Feature
242
- The system SHALL/MUST do something modified.
243
-
244
- #### Scenario: Modified scenario
245
- Given updated precondition
246
- When action occurs
247
- Then new expected outcome
248
-
249
- ## REMOVED Requirements
250
-
251
- ### Requirement: Deprecated Feature
252
- [Description of what is being removed]
253
-
254
- ## RENAMED Requirements
255
- - FROM: `### Requirement: Old Name`
256
- - TO: `### Requirement: New Name`
257
- ```
258
-
259
- **Format Rules:**
260
- - ✅ Purpose section: Minimum 20 characters
261
- - ✅ Requirements: Must contain SHALL or MUST
262
- - ✅ Scenarios: Use `#### Scenario:` (4 hashtags)
263
- - ✅ Scenarios: Use Given/When/Then structure
264
- - ✅ Deltas: Use ADDED/MODIFIED/REMOVED/RENAMED headers
265
- - ❌ NEVER use 3 hashtags for scenarios
266
- - ❌ NEVER use bullet points for scenarios
267
- - ❌ NEVER omit SHALL/MUST from requirements
268
-
269
- ### Step 8: Validate Task
270
-
271
- ```bash
272
- # Validate task format
273
- rulebook task validate <task-id>
274
-
275
- # Validate with strict mode (recommended)
276
- rulebook task validate <task-id> --strict
277
-
278
- # Validate all tasks
279
- rulebook task validate --all
280
- ```
281
-
282
- **Validation checks:**
283
- - Purpose section length (≥20 chars)
284
- - Requirement keywords (SHALL/MUST)
285
- - Scenario format (4 hashtags)
286
- - Given/When/Then structure
287
- - Delta headers format
288
-
289
- ### Step 9: Update Task Status
290
-
291
- ```bash
292
- # Mark task as in progress
293
- rulebook task update <task-id> --status in-progress
294
-
295
- # Update task progress
296
- rulebook task update <task-id> --progress 50
297
-
298
- # Mark task as completed
299
- rulebook task update <task-id> --status completed
300
- ```
301
-
302
- ### Step 10: Archive Completed Task
303
-
304
- ```bash
305
- # Archive completed task
306
- rulebook task archive <task-id>
307
-
308
- # Archive without prompts
309
- rulebook task archive <task-id> --yes
310
- ```
311
-
312
- **Archive process:**
313
- 1. Validates task format
314
- 2. Checks task completion status
315
- 3. Applies spec deltas to main specifications
316
- 4. Moves task to `/.rulebook/tasks/archive/YYYY-MM-DD-<task-id>/`
317
- 5. Updates related specifications
318
-
319
- ## 🚨 MANDATORY: Deferred Items → Tasks Rule
320
-
321
- **ABSOLUTE RULE — NO EXCEPTIONS**: Whenever a task is archived with items marked as "Deferred" or "Phase X+", you MUST immediately create Rulebook tasks for those deferred items **before archiving**.
322
-
323
- ### The Deferred Items Protocol
324
-
325
- ```
326
- ❌ WRONG — defer without creating task:
327
- 1. Archive task with "- [ ] D1. feature X — deferred Phase 4"
328
- → Feature X is now forgotten forever
329
-
330
- ✅ CORRECT — defer with tracking:
331
- 1. Add "- [ ] D1. feature X — deferred Phase 4" to tasks.md
332
- 2. Call rulebook_task_create("phase4-feature-x")
333
- 3. Write tasks.md for the new task with full context
334
- 4. THEN call rulebook_task_archive
335
- ```
336
-
337
- ### tasks.md Format for Archived Tasks
338
-
339
- ```markdown
340
- ## 1. Implemented Feature
341
-
342
- - [x] 1.1 Thing that was done
343
- - [x] 1.2 Another thing done
344
-
345
- ## Deferred to Phase N (reason: dependency not ready)
346
-
347
- - [ ] D1. Feature X — deferred (reason) ← task phase4-feature-x MUST exist
348
- - [ ] D2. Feature Y — deferred (reason) ← task phaseN-feature-y MUST exist
349
- ```
350
-
351
- ### Archive Checklist (ALL must be done before `rulebook_task_archive`)
352
-
353
- ```
354
- □ 1. tasks.md uses - [x] for implemented, - [ ] for deferred
355
- □ 2. Each deferred item has a "Phase N" target
356
- □ 3. A rulebook task exists for EVERY deferred item or group
357
- □ 4. The new deferred tasks have tasks.md with full context
358
- □ 5. THEN call rulebook_task_archive
359
- ```
360
-
361
- ## Task Format Examples
362
-
363
- ### Correct Format ✅
364
-
365
- ```markdown
366
- # Auth Specification
367
-
368
- ## ADDED Requirements
369
-
370
- ### Requirement: Two-Factor Authentication
371
- The system MUST require a second factor during login for enhanced security.
372
-
373
- #### Scenario: OTP required
374
- Given a user submits valid credentials
375
- When authentication starts
376
- Then an OTP challenge is required
377
-
378
- #### Scenario: OTP verification
379
- Given a user receives an OTP code
380
- When they submit the correct OTP
381
- Then they are authenticated successfully
382
- ```
383
-
384
- ### Incorrect Format ❌
385
-
386
- ```markdown
387
- # Auth Specification
388
-
389
- ## Requirements
390
-
391
- ### Requirement: Two-Factor Authentication
392
- The system requires a second factor. # ❌ Missing SHALL/MUST
393
-
394
- #### Scenario: OTP required # ❌ Only 3 hashtags
395
- - WHEN user submits credentials # ❌ Using bullets instead of Given/When/Then
396
- - THEN OTP challenge is required
397
- ```
398
-
399
- ## Common Pitfalls & How to Avoid Them
400
-
401
- ### Top 5 Mistakes AI Assistants Make
402
-
403
- 1. **Wrong Scenario Headers**
404
- - ❌ `### Scenario:` (3 hashtags)
405
- - ✅ `#### Scenario:` (4 hashtags)
406
-
407
- 2. **Missing SHALL/MUST Keywords**
408
- - ❌ "The system provides authentication"
409
- - ✅ "The system SHALL provide authentication"
410
-
411
- 3. **Using Bullets for Scenarios**
412
- - ❌ `- WHEN user does X THEN Y happens`
413
- - ✅ `Given X\nWhen Y\nThen Z`
414
-
415
- 4. **Incomplete Purpose Section**
416
- - ❌ "Auth system" (too short)
417
- - ✅ "Authentication system for secure user access with JWT tokens and session management" (≥20 chars)
418
-
419
- 5. **Wrong Delta Headers**
420
- - ❌ `## New Requirements` or `## Changes`
421
- - ✅ `## ADDED Requirements`, `## MODIFIED Requirements`, etc.
422
-
423
- ## Integration with AGENT_AUTOMATION
424
-
425
- **CRITICAL**: After implementing a task, follow AGENT_AUTOMATION workflow:
426
-
427
- 1. Run quality checks (lint, test, type-check, build)
428
- 2. Update task status in `tasks.md`
429
- 3. Update documentation (ROADMAP, CHANGELOG, specs)
430
- 4. Commit with conventional commit format
431
- 5. Archive task when complete
432
-
433
- ## ⚠️ CRITICAL: Git Hooks Will Block Commits with Problems
434
-
435
- **ABSOLUTE RULE**: Pre-commit and pre-push hooks will **BLOCK** any commit attempt if there are:
436
- - ❌ Lint errors or warnings
437
- - ❌ Test failures
438
- - ❌ Type check errors
439
- - ❌ Formatting issues
440
- - ❌ Coverage below thresholds
441
-
442
- ### Why This Matters
443
-
444
- **DO NOT attempt to commit code with problems:**
445
- - ❌ `git commit` will **FAIL** if lint has errors
446
- - ❌ `git commit` will **FAIL** if tests are failing
447
- - ❌ `git push` will **FAIL** if pre-push checks fail
448
- - ❌ You will waste time trying to commit broken code
449
- - ❌ The hooks will reject your commit automatically
450
-
451
- **ALWAYS fix problems BEFORE attempting to commit:**
452
- - ✅ Run `npm run lint` and fix ALL errors/warnings first
453
- - ✅ Run `npm test` and ensure ALL tests pass
454
- - ✅ Run `npm run type-check` and fix ALL type errors
455
- - ✅ Run `npm run format` if formatting is required
456
- - ✅ Run `npm test -- --coverage` and ensure coverage thresholds are met
457
- - ✅ **ONLY THEN** attempt `git commit`
458
-
459
- ### Mandatory Pre-Commit Workflow
460
-
461
- **BEFORE every commit, you MUST:**
462
-
463
- ```bash
464
- # 1. Fix lint errors FIRST (highest priority)
465
- npm run lint
466
- # Fix ALL errors and warnings
467
- # If lint fails, commit will be blocked
468
-
469
- # 2. Fix test failures SECOND
470
- npm test
471
- # Fix ALL failing tests
472
- # If tests fail, commit will be blocked
473
-
474
- # 3. Fix type errors THIRD
475
- npm run type-check
476
- # Fix ALL type errors
477
- # If type check fails, commit will be blocked
478
-
479
- # 4. Fix formatting (if required)
480
- npm run format
481
- # Apply formatting fixes
482
-
483
- # 5. Verify coverage (if required by hooks)
484
- npm test -- --coverage
485
- # Ensure coverage thresholds are met
486
-
487
- # 6. ONLY AFTER all checks pass, attempt commit
488
- git add .
489
- git commit -m "feat: your commit message"
490
- # This will now succeed because all checks passed
491
- ```
492
-
493
- ### What Happens If You Try to Commit with Problems
494
-
495
- **Example of blocked commit:**
496
-
497
- ```bash
498
- $ git commit -m "feat: add new feature"
499
-
500
- 🔍 Running TypeScript/JavaScript pre-commit checks...
501
- → Type checking...
502
- → Linting...
503
-
504
- /mnt/f/project/src/feature.ts
505
- 42:19 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
506
-
507
- ✖ 1 problem (1 error, 0 warnings)
508
-
509
- ❌ Commit blocked: Lint errors found
510
- ```
511
-
512
- **You MUST fix the error before committing:**
513
-
514
- ```bash
515
- # Fix the lint error
516
- # ... edit code to fix the issue ...
517
-
518
- # Run lint again to verify
519
- npm run lint
520
- # ✅ All checks pass
521
-
522
- # NOW commit will succeed
523
- git commit -m "feat: add new feature"
524
- # ✅ Commit successful
525
- ```
526
-
527
- ### ⚠️ CRITICAL: NEVER Use --no-verify to Bypass Hooks
528
-
529
- **ABSOLUTE PROHIBITION**: You MUST NEVER use `--no-verify` or `--no-gpg-sign` flags to bypass git hooks.
530
-
531
- **FORBIDDEN COMMANDS:**
532
- - ❌ `git commit --no-verify` - **NEVER USE THIS**
533
- - ❌ `git commit -n` - **NEVER USE THIS** (short form of --no-verify)
534
- - ❌ `git push --no-verify` - **NEVER USE THIS**
535
- - ❌ Any flag that skips pre-commit or pre-push hooks
536
-
537
- ### Why This Is Prohibited
538
-
539
- **Using `--no-verify` defeats the entire purpose of quality gates:**
540
- - ❌ Allows broken code to be committed
541
- - ❌ Bypasses all quality checks (lint, test, type-check)
542
- - ❌ Introduces technical debt and bugs
543
- - ❌ Violates project quality standards
544
- - ❌ Can break the build for other developers
545
- - ❌ Makes code review harder (reviewers see broken code)
546
-
547
- **The hooks exist for a reason:**
548
- - ✅ They protect code quality
549
- - ✅ They prevent bugs from entering the codebase
550
- - ✅ They ensure consistency across the project
551
- - ✅ They catch errors before they reach production
552
-
553
- ### What to Do Instead
554
-
555
- **If you're tempted to use `--no-verify`, it means:**
556
- 1. **You have problems that need fixing** - Fix them first
557
- 2. **You're trying to commit too early** - Complete the work properly
558
- 3. **You're rushing** - Slow down and do it right
559
-
560
- **Correct approach:**
561
-
562
- ```bash
563
- # ❌ WRONG: Trying to bypass hooks
564
- git commit --no-verify -m "feat: add feature"
565
- # This is FORBIDDEN - never do this
566
-
567
- # ✅ CORRECT: Fix problems first, then commit
568
- npm run lint
569
- # Fix all errors...
570
-
571
- npm test
572
- # Fix all failing tests...
573
-
574
- npm run type-check
575
- # Fix all type errors...
576
-
577
- # NOW commit (hooks will pass)
578
- git commit -m "feat: add feature"
579
- # ✅ Commit successful - all checks passed
580
- ```
581
-
582
- ### Summary
583
-
584
- **CRITICAL RULES:**
585
- - ⚠️ **NEVER** attempt to commit code with lint errors - hooks will block it
586
- - ⚠️ **NEVER** attempt to commit code with test failures - hooks will block it
587
- - ⚠️ **NEVER** attempt to commit code with type errors - hooks will block it
588
- - ⚠️ **NEVER** use `--no-verify` or any flag to bypass hooks - **ABSOLUTELY FORBIDDEN**
589
- - ⚠️ **ALWAYS** fix ALL problems BEFORE attempting to commit
590
- - ⚠️ **ALWAYS** run quality checks manually before `git commit`
591
- - ⚠️ **ALWAYS** ensure all checks pass before committing
592
-
593
- **The hooks are there to protect code quality - they will NOT let broken code through. Always resolve problems first, then commit. Bypassing hooks is strictly prohibited and defeats the purpose of quality gates.**
594
-
595
- ## MANDATORY: Task List Updates During Implementation
596
-
597
- **CRITICAL RULE**: You MUST update the task list (`tasks.md`) immediately after completing and testing each implementation step.
598
-
599
- ### When to Update Task List
600
-
601
- **ALWAYS update `tasks.md` when:**
602
- - ✅ You complete a task item (mark as `[x]`)
603
- - ✅ You finish implementing a feature and it's tested
604
- - ✅ You complete a test suite
605
- - ✅ You finish documentation updates
606
- - ✅ You verify the implementation works correctly
607
-
608
- **NEVER commit without updating `tasks.md` if you've made progress on a task.**
609
-
610
- ### How to Update Task List
611
-
612
- 1. **After Implementation**:
613
- ```markdown
614
- ## 1. Implementation Phase
615
- - [x] 1.1 Create task manager module # ✅ Mark as done
616
- - [x] 1.2 Add validation logic # ✅ Mark as done
617
- - [ ] 1.3 Add archive functionality # Still pending
618
- ```
619
-
620
- 2. **After Testing**:
621
- ```markdown
622
- ## 2. Testing Phase
623
- - [x] 2.1 Write unit tests # ✅ Tests written and passing
624
- - [x] 2.2 Write integration tests # ✅ Tests written and passing
625
- - [ ] 2.3 Add E2E tests # Still pending
626
- ```
627
-
628
- 3. **After Documentation**:
629
- ```markdown
630
- ## 3. Documentation Phase
631
- - [x] 3.1 Update README # ✅ Updated
632
- - [x] 3.2 Update CHANGELOG # ✅ Updated
633
- - [ ] 3.3 Update API docs # Still pending
634
- ```
635
-
636
- ### Workflow: Implement → Test → Verify Coverage → Update Tasks → Commit → Next Task
637
-
638
- **MANDATORY SEQUENCE** for every implementation:
639
-
640
- ```bash
641
- # 1. Implement the feature
642
- # ... write code ...
643
-
644
- # 2. Test the implementation
645
- npm test
646
- npm run lint
647
- npm run type-check
648
-
649
- # 3. Verify test coverage (CRITICAL)
650
- npm test -- --coverage
651
- # Check coverage thresholds are met
652
- # Fix any coverage gaps before proceeding
653
-
654
- # 4. Update tasks.md IMMEDIATELY after successful tests and coverage check
655
- # Mark completed items as [x] in tasks.md
656
- # Update task status if needed
657
-
658
- # 5. Verify task status is updated before moving to next task
659
- rulebook task show <task-id>
660
- # Confirm status reflects current progress
661
-
662
- # 6. Commit locally (BACKUP - do this frequently)
663
- git add .
664
- git commit -m "feat: implement task manager validation
665
-
666
- - Complete task 1.2: Add validation logic
667
- - All tests passing
668
- - Coverage verified: 95%
669
- - Updated tasks.md"
670
-
671
- # 7. Keep remote repository updated (if configured)
672
- # Check if remote is configured
673
- git remote -v
674
-
675
- # If remote exists, push regularly
676
- git push origin <branch-name>
677
-
678
- # If no remote configured, see setup instructions below
679
-
680
- # 8. Only then proceed to next task
681
- # Follow priority order (most critical first)
682
- ```
683
-
684
- ## ⚠️ CRITICAL: Frequent Local Commits for Backup
685
-
686
- **ABSOLUTE RULE**: Commit locally frequently, even if just for backup purposes.
687
-
688
- ### Why Frequent Commits Matter
689
-
690
- **Without frequent commits:**
691
- - ❌ Risk of losing work if system crashes
692
- - ❌ No recovery point if something goes wrong
693
- - ❌ Difficult to revert to previous working state
694
- - ❌ Lost context if session is interrupted
695
-
696
- **With frequent commits:**
697
- - ✅ Work is backed up locally
698
- - ✅ Easy to recover from mistakes
699
- - ✅ Can revert to any previous state
700
- - ✅ Progress is preserved
701
-
702
- ### When to Commit Locally
703
-
704
- **Commit locally whenever you:**
705
- - ✅ Complete a task item (even if not fully tested)
706
- - ✅ Finish implementing a feature (before full testing)
707
- - ✅ Fix a bug or issue
708
- - ✅ Update documentation
709
- - ✅ Make significant progress
710
- - ✅ Feel the need for a backup point
711
- - ✅ Are about to try something risky
712
- - ✅ Are switching to a different task
713
-
714
- **Commit frequency:**
715
- - **Minimum**: After completing each task item
716
- - **Recommended**: Every 15-30 minutes of active work
717
- - **Maximum**: As often as you feel necessary for safety
718
-
719
- ### Local Commit Workflow
720
-
721
- ```bash
722
- # Quick local commit (backup)
723
- git add .
724
- git commit -m "wip: progress on task 1.2
725
-
726
- - Implemented validation logic
727
- - Still testing
728
- - Backup commit"
729
-
730
- # Or more descriptive
731
- git add .
732
- git commit -m "feat: add validation logic (WIP)
733
-
734
- - Task 1.2 in progress
735
- - Core validation implemented
736
- - Tests pending
737
- - Backup before continuing"
738
- ```
739
-
740
- ### Commit Message Format for Backup Commits
741
-
742
- **For work-in-progress commits:**
743
- ```bash
744
- git commit -m "wip: <brief description>
745
-
746
- - What was done
747
- - Current status
748
- - Next steps"
749
- ```
750
-
751
- **For completed task items:**
752
- ```bash
753
- git commit -m "feat: <feature description>
754
-
755
- - Complete task X.Y: <task name>
756
- - All tests passing
757
- - Coverage verified
758
- - Updated tasks.md"
759
- ```
760
-
761
- ## ⚠️ CRITICAL: Keep Remote Repository Updated
762
-
763
- **MANDATORY**: Keep your remote repository synchronized with local work.
764
-
765
- ### Check Remote Configuration
766
-
767
- **First, check if remote is configured:**
768
- ```bash
769
- git remote -v
770
- ```
771
-
772
- **If you see output like:**
773
- ```
774
- origin https://github.com/user/repo.git (fetch)
775
- origin https://github.com/user/repo.git (push)
776
- ```
777
- ✅ Remote is configured - proceed to push regularly
778
-
779
- **If you see no output or error:**
780
- ❌ No remote configured - see setup instructions below
781
-
782
- ### Push to Remote Regularly
783
-
784
- **After local commits, push to remote:**
785
- ```bash
786
- # Push current branch
787
- git push origin <branch-name>
788
-
789
- # Or push current branch (if tracking is set)
790
- git push
791
-
792
- # Push with tags
793
- git push --tags
794
- ```
795
-
796
- **Recommended push frequency:**
797
- - **Minimum**: After completing a task
798
- - **Recommended**: After every 2-3 local commits
799
- - **Maximum**: After every local commit (if working solo)
800
-
801
- ### Remote Repository Setup
802
-
803
- **If no remote repository is configured:**
804
-
805
- #### Option 1: GitHub (Recommended)
806
-
807
- 1. **Create repository on GitHub:**
808
- - Go to https://github.com/new
809
- - Create a new repository
810
- - **DO NOT** initialize with README, .gitignore, or license (if you already have local repo)
811
-
812
- 2. **Add remote and push:**
813
- ```bash
814
- # Add remote (replace with your repository URL)
815
- git remote add origin https://github.com/username/repo-name.git
816
-
817
- # Or using SSH
818
- git remote add origin git@github.com:username/repo-name.git
819
-
820
- # Push to remote
821
- git push -u origin main
822
- # Or 'master' if that's your default branch
823
- ```
824
-
825
- 3. **Verify:**
826
- ```bash
827
- git remote -v
828
- git push
829
- ```
830
-
831
- **GitHub Setup Guide:**
832
- - **Official Guide**: https://docs.github.com/en/get-started/quickstart/create-a-repo
833
- - **Adding Remote**: https://docs.github.com/en/get-started/getting-started-with-git/managing-remote-repositories
834
-
835
- #### Option 2: GitLab
836
-
837
- 1. **Create repository on GitLab:**
838
- - Go to https://gitlab.com/projects/new
839
- - Create a new project
840
- - **DO NOT** initialize with README (if you already have local repo)
841
-
842
- 2. **Add remote and push:**
843
- ```bash
844
- git remote add origin https://gitlab.com/username/repo-name.git
845
- git push -u origin main
846
- ```
847
-
848
- **GitLab Setup Guide:**
849
- - **Official Guide**: https://docs.gitlab.com/ee/gitlab-basics/create-project.html
850
-
851
- #### Option 3: Bitbucket
852
-
853
- 1. **Create repository on Bitbucket:**
854
- - Go to https://bitbucket.org/repo/create
855
- - Create a new repository
856
-
857
- 2. **Add remote and push:**
858
- ```bash
859
- git remote add origin https://bitbucket.org/username/repo-name.git
860
- git push -u origin main
861
- ```
862
-
863
- **Bitbucket Setup Guide:**
864
- - **Official Guide**: https://support.atlassian.com/bitbucket-cloud/docs/create-a-git-repository/
865
-
866
- #### Option 4: Self-Hosted Git Server
867
-
868
- **If using self-hosted Git server:**
869
- ```bash
870
- # Add remote
871
- git remote add origin <your-git-server-url>
872
-
873
- # Push
874
- git push -u origin main
875
- ```
876
-
877
- ### Verify Remote is Working
878
-
879
- **After setting up remote:**
880
- ```bash
881
- # Check remote configuration
882
- git remote -v
883
-
884
- # Test push
885
- git push origin main
886
-
887
- # If successful, you'll see:
888
- # "Enumerating objects: X, done."
889
- # "Writing objects: 100% (X/X), done."
890
- ```
891
-
892
- ### Troubleshooting Remote Issues
893
-
894
- **Error: "remote origin already exists"**
895
- ```bash
896
- # Remove existing remote
897
- git remote remove origin
898
-
899
- # Add new remote
900
- git remote add origin <new-url>
901
- ```
902
-
903
- **Error: "authentication failed"**
904
- - Check your credentials
905
- - Use SSH keys for better security
906
- - See: https://docs.github.com/en/authentication/connecting-to-github-with-ssh
907
-
908
- **Error: "repository not found"**
909
- - Verify repository URL is correct
910
- - Check you have access to the repository
911
- - Ensure repository exists on remote server
912
-
913
- ### Best Practices for Remote Sync
914
-
915
- **DO's ✅:**
916
- - ✅ Push to remote after completing tasks
917
- - ✅ Push before switching branches
918
- - ✅ Push before trying risky changes
919
- - ✅ Push at end of work session
920
- - ✅ Use descriptive commit messages
921
- - ✅ Keep commits atomic (one logical change per commit)
922
-
923
- **DON'Ts ❌:**
924
- - ❌ Don't push broken code (test first)
925
- - ❌ Don't push sensitive information (API keys, passwords)
926
- - ❌ Don't force push to shared branches
927
- - ❌ Don't skip pushing for extended periods
928
- - ❌ Don't commit without meaningful messages
929
-
930
- ### Automated Backup Reminder
931
-
932
- **Set up reminders to push regularly:**
933
- ```bash
934
- # Add to your shell profile (.bashrc, .zshrc, etc.)
935
- alias git-backup='git add . && git commit -m "backup: $(date +%Y-%m-%d\ %H:%M:%S)" && git push'
936
-
937
- # Use: git-backup (quick backup and push)
938
- ```
939
-
940
- ### Summary: Backup and Remote Sync Workflow
941
-
942
- **Complete workflow:**
943
- 1. **Work locally** - Make changes
944
- 2. **Test changes** - Ensure they work
945
- 3. **Commit locally** - `git commit` (backup)
946
- 4. **Update tasks.md** - Mark progress
947
- 5. **Push to remote** - `git push` (if remote configured)
948
- 6. **Continue work** - Next task
949
-
950
- **If no remote:**
951
- 1. **Set up remote** - Follow instructions above
952
- 2. **Push initial code** - `git push -u origin main`
953
- 3. **Continue regular pushes** - After each commit or task
954
-
955
- ### Priority Order: Most Critical First
956
-
957
- **ALWAYS follow this priority order when continuing implementation:**
958
-
959
- 1. **Tests** (HIGHEST PRIORITY)
960
- - Write tests for the feature
961
- - Ensure all tests pass
962
- - Verify test coverage meets thresholds
963
-
964
- 2. **Coverage Verification** (CRITICAL)
965
- - Run coverage check: `npm test -- --coverage`
966
- - Fix any coverage gaps
967
- - Ensure coverage thresholds are met
968
-
969
- 3. **Update Task Status** (MANDATORY)
970
- - Mark completed items as `[x]` in `tasks.md`
971
- - Update task status if needed
972
- - Document what was completed
973
-
974
- 4. **Next Task** (Only after above steps)
975
- - Move to next most critical task
976
- - Follow same sequence
977
-
978
- **Example Priority Order:**
979
-
980
- ```markdown
981
- ## Priority Order (Most Critical First)
982
-
983
- ### 1. Testing (CRITICAL - Do First)
984
- - [ ] 1.1 Write unit tests for core functionality
985
- - [ ] 1.2 Write integration tests
986
- - [ ] 1.3 Verify test coverage ≥ 95%
987
-
988
- ### 2. Coverage Verification (CRITICAL - Do Second)
989
- - [ ] 2.1 Run coverage check
990
- - [ ] 2.2 Fix coverage gaps
991
- - [ ] 2.3 Verify thresholds met
992
-
993
- ### 3. Task Status Update (MANDATORY - Do Third)
994
- - [ ] 3.1 Update tasks.md with completed items
995
- - [ ] 3.2 Update task status
996
- - [ ] 3.3 Document completion
997
-
998
- ### 4. Next Implementation (Only After Above)
999
- - [ ] 4.1 Move to next critical task
1000
- - [ ] 4.2 Follow same sequence
1001
- ```
1002
-
1003
- ### Never Skip Steps
1004
-
1005
- **CRITICAL RULES:**
1006
- - ❌ NEVER proceed to next task without updating current task status
1007
- - ❌ NEVER skip test coverage verification
1008
- - ❌ NEVER mark tasks complete without tests passing
1009
- - ❌ NEVER implement without creating task first
1010
- - ✅ ALWAYS update task status before moving to next task
1011
- - ✅ ALWAYS verify coverage before marking task complete
1012
- - ✅ ALWAYS follow priority order (most critical first)
1013
-
1014
- ### Task Status Tracking
1015
-
1016
- **Track progress in `tasks.md`:**
1017
-
1018
- ```markdown
1019
- ## Progress Summary
1020
- - Total tasks: 15
1021
- - Completed: 8
1022
- - In progress: 2
1023
- - Pending: 5
1024
- - Blocked: 0
1025
-
1026
- ## Current Status
1027
- - ✅ Implementation Phase: 80% complete (4/5 tasks)
1028
- - ⏳ Testing Phase: 50% complete (2/4 tasks)
1029
- - ⏸️ Documentation Phase: 0% complete (0/3 tasks)
1030
- ```
1031
-
1032
- ### Validation Before Committing
1033
-
1034
- **BEFORE every commit, verify:**
1035
- - [ ] All completed tasks are marked as `[x]` in `tasks.md`
1036
- - [ ] Task status reflects current progress
1037
- - [ ] No tasks are marked complete without implementation
1038
- - [ ] All tests pass for completed tasks
1039
- - [ ] Test coverage meets thresholds (run `npm test -- --coverage`)
1040
- - [ ] Task status updated before moving to next task
1041
- - [ ] Documentation is updated for completed features
1042
-
1043
- ### Task Status Update Before Next Task
1044
-
1045
- **CRITICAL RULE**: You MUST update task status in `tasks.md` BEFORE moving to the next task.
1046
-
1047
- **Why:**
1048
- - Prevents loss of progress tracking
1049
- - Ensures context is preserved
1050
- - Makes it easy to resume work
1051
- - Provides clear progress visibility
1052
-
1053
- **Workflow:**
1054
- ```bash
1055
- # 1. Complete current task item
1056
- # ... implementation ...
1057
-
1058
- # 2. Test and verify coverage
1059
- npm test
1060
- npm test -- --coverage
1061
-
1062
- # 3. Update tasks.md IMMEDIATELY
1063
- # Mark as [x] and add status comment
1064
-
1065
- # 4. Verify update
1066
- rulebook task show <task-id>
1067
- # Confirm status is updated
1068
-
1069
- # 5. ONLY THEN proceed to next task
1070
- # Follow priority order (most critical first)
1071
- ```
1072
-
1073
- **Example:**
1074
- ```markdown
1075
- ## 1. Implementation Phase
1076
- - [x] 1.1 Create task manager module <!-- tested, coverage: 95% -->
1077
- - [x] 1.2 Add validation logic <!-- tested, coverage: 92%, status: complete -->
1078
- - [ ] 1.3 Add archive functionality <!-- next: will start after status update -->
1079
- ```
1080
-
1081
- ## Task Archiving Workflow
1082
-
1083
- **CRITICAL**: Archive tasks ONLY after full completion and validation.
1084
-
1085
- ### When to Archive
1086
-
1087
- **Archive a task when:**
1088
- - ✅ All items in `tasks.md` are marked as `[x]`
1089
- - ✅ All tests pass (unit, integration, E2E)
1090
- - ✅ Code review is complete (if applicable)
1091
- - ✅ Documentation is updated (README, CHANGELOG, specs)
1092
- - ✅ Task format is validated (`rulebook task validate <task-id>`)
1093
- - ✅ Spec deltas have been applied to main specifications
1094
-
1095
- **NEVER archive a task that is:**
1096
- - ❌ Partially complete
1097
- - ❌ Missing tests
1098
- - ❌ Failing validation
1099
- - ❌ Missing documentation
1100
-
1101
- ### Archive Process
1102
-
1103
- **Step-by-step archive workflow:**
1104
-
1105
- ```bash
1106
- # 1. Verify all tasks are complete
1107
- rulebook task show <task-id>
1108
- # Check that all items in tasks.md are [x]
1109
-
1110
- # 2. Run all quality checks
1111
- npm test
1112
- npm run lint
1113
- npm run type-check
1114
- npm run build
1115
-
1116
- # 3. Validate task format
1117
- rulebook task validate <task-id>
1118
-
1119
- # 4. Update final documentation
1120
- # - Update CHANGELOG.md
1121
- # - Update README.md if needed
1122
- # - Update any affected documentation
1123
-
1124
- # 5. Archive the task
1125
- rulebook task archive <task-id>
1126
-
1127
- # 6. Verify archive
1128
- rulebook task list --archived
1129
- # Task should appear in archived list
1130
- ```
1131
-
1132
- ### Post-Archive Actions
1133
-
1134
- **After archiving, ensure:**
1135
- - ✅ Spec deltas are applied to main specifications
1136
- - ✅ CHANGELOG.md is updated with the change
1137
- - ✅ Any breaking changes are documented
1138
- - ✅ Migration guides are created (if needed)
1139
- - ✅ Related tasks are unblocked (if any)
1140
-
1141
- ### Archive Location
1142
-
1143
- **Archived tasks are moved to:**
1144
- ```
1145
- /.rulebook/tasks/archive/YYYY-MM-DD-<task-id>/
1146
- ```
1147
-
1148
- **Structure:**
1149
- ```
1150
- /.rulebook/tasks/archive/2025-11-13-add-auth/
1151
- ├── proposal.md
1152
- ├── tasks.md # All items marked [x]
1153
- ├── design.md
1154
- └── specs/
1155
- └── core/
1156
- └── spec.md
1157
- ```
1158
-
1159
- ## Task Creation Best Practices
1160
-
1161
- ### Task ID Naming
1162
-
1163
- **Use verb-led kebab-case:**
1164
- - ✅ `add-user-authentication`
1165
- - ✅ `refactor-task-manager`
1166
- - ✅ `update-api-validation`
1167
- - ✅ `remove-legacy-code`
1168
- - ❌ `user-auth` (not descriptive)
1169
- - ❌ `task_manager` (use kebab-case)
1170
- - ❌ `new-feature` (too generic)
1171
-
1172
- ### Task Scope
1173
-
1174
- **One capability per task:**
1175
- - ✅ Good: `add-email-notifications`
1176
- - ❌ Bad: `add-email-notifications-and-sms-and-push` (too broad)
1177
-
1178
- **Break large tasks into smaller ones:**
1179
- - ✅ `add-email-notifications`
1180
- - ✅ `add-sms-notifications`
1181
- - ✅ `add-push-notifications`
1182
-
1183
- ### Task Checklist Structure
1184
-
1185
- **Organize tasks by phase:**
1186
-
1187
- ```markdown
1188
- ## 1. Planning & Design
1189
- - [ ] 1.1 Research existing solutions
1190
- - [ ] 1.2 Design architecture
1191
- - [ ] 1.3 Create technical spec
1192
-
1193
- ## 2. Implementation
1194
- - [ ] 2.1 Create core module
1195
- - [ ] 2.2 Add validation logic
1196
- - [ ] 2.3 Integrate with existing system
1197
-
1198
- ## 3. Testing
1199
- - [ ] 3.1 Write unit tests
1200
- - [ ] 3.2 Write integration tests
1201
- - [ ] 3.3 Test edge cases
1202
-
1203
- ## 4. Documentation
1204
- - [ ] 4.1 Update README
1205
- - [ ] 4.2 Update CHANGELOG
1206
- - [ ] 4.3 Add code comments
1207
-
1208
- ## 5. Cleanup
1209
- - [ ] 5.1 Remove debug code
1210
- - [ ] 5.2 Remove unused imports
1211
- - [ ] 5.3 Final code review
1212
- ```
1213
-
1214
- ## Continuous Task Updates
1215
-
1216
- **CRITICAL**: Update `tasks.md` continuously, not just at the end.
1217
-
1218
- ### Real-Time Updates
1219
-
1220
- **Update as you work:**
1221
- 1. **Start task**: Mark as `[ ]` (if not already)
1222
- 2. **Begin implementation**: Add comment `<!-- in progress -->`
1223
- 3. **Complete implementation**: Mark as `[x]`
1224
- 4. **Test passes**: Add comment `<!-- tested -->`
1225
- 5. **Ready for review**: Add comment `<!-- ready for review -->`
1226
-
1227
- **Example:**
1228
- ```markdown
1229
- ## 1. Implementation
1230
- - [x] 1.1 Create task manager module <!-- tested -->
1231
- - [x] 1.2 Add validation logic <!-- tested, ready for review -->
1232
- - [ ] 1.3 Add archive functionality <!-- in progress -->
1233
- ```
1234
-
1235
- ### Progress Tracking
1236
-
1237
- **Add progress indicators:**
1238
- ```markdown
1239
- ## Progress: 60% (9/15 tasks complete)
1240
-
1241
- ## 1. Implementation Phase: 100% ✅
1242
- - [x] 1.1 Task 1
1243
- - [x] 1.2 Task 2
1244
- - [x] 1.3 Task 3
1245
-
1246
- ## 2. Testing Phase: 50% ⏳
1247
- - [x] 2.1 Unit tests
1248
- - [x] 2.2 Integration tests
1249
- - [ ] 2.3 E2E tests
1250
-
1251
- ## 3. Documentation Phase: 0% ⏸️
1252
- - [ ] 3.1 README
1253
- - [ ] 3.2 CHANGELOG
1254
- - [ ] 3.3 API docs
1255
- ```
1256
-
1257
- ## Task Validation Before Archive
1258
-
1259
- **MANDATORY checks before archiving:**
1260
-
1261
- ```bash
1262
- # 1. Format validation
1263
- rulebook task validate <task-id>
1264
- # Must pass all format checks
1265
-
1266
- # 2. Completion check
1267
- # All items in tasks.md must be [x]
1268
-
1269
- # 3. Test coverage
1270
- npm test -- --coverage
1271
- # Must meet coverage thresholds
1272
-
1273
- # 4. Code quality
1274
- npm run lint
1275
- npm run type-check
1276
- # Must pass all checks
1277
-
1278
- # 5. Build verification
1279
- npm run build
1280
- # Must build successfully
1281
- ```
1282
-
1283
- ## Summary: Task Lifecycle
1284
-
1285
- **Complete task lifecycle:**
1286
-
1287
- 1. **Create** (MANDATORY FIRST STEP): `rulebook task create <task-id>`
1288
- - ⚠️ NEVER start implementation without creating task first
1289
- - ⚠️ Tasks without registration can be lost in context
1290
-
1291
- 2. **Plan**: Write proposal.md and tasks.md
1292
- - Define why, what, and how
1293
- - Create implementation checklist
1294
-
1295
- 3. **Design**: Write design.md (if needed)
1296
- - Technical decisions
1297
- - Architecture choices
1298
-
1299
- 4. **Spec**: Write spec deltas in specs/
1300
- - OpenSpec-compatible format
1301
- - Requirements with SHALL/MUST
1302
-
1303
- 5. **Validate**: `rulebook task validate <task-id>`
1304
- - Format validation
1305
- - Structure verification
1306
-
1307
- 6. **Implement**: Write code, following priority order
1308
- - Most critical tasks first
1309
- - Update tasks.md as you go
1310
-
1311
- 7. **Test** (HIGHEST PRIORITY): Write tests, verify coverage
1312
- - All tests must pass
1313
- - Coverage must meet thresholds
1314
- - Mark tested items in tasks.md
1315
-
1316
- 8. **Update Status** (MANDATORY): Update task status before next task
1317
- - Mark completed items as `[x]`
1318
- - Update status in tasks.md
1319
- - Verify status update
1320
-
1321
- 9. **Document**: Update docs, mark in tasks.md
1322
- - README, CHANGELOG, specs
1323
-
1324
- 10. **Validate**: Final validation before archive
1325
- - All checks pass
1326
- - Coverage verified
1327
-
1328
- 11. **Archive**: `rulebook task archive <task-id>`
1329
- - Move to archive
1330
- - Apply spec deltas
1331
-
1332
- **CRITICAL REMINDERS:**
1333
- - ⚠️ **ALWAYS create task BEFORE implementation** - without registration, tasks can be lost
1334
- - ⚠️ **ALWAYS follow priority order** - most critical first (tests, coverage, status update)
1335
- - ⚠️ **ALWAYS update task status before next task** - prevents context loss
1336
- - ⚠️ **ALWAYS verify coverage** - run `npm test -- --coverage` before marking complete
1337
- - ⚠️ **ALWAYS commit locally frequently** - even for backup, prevents work loss
1338
- - ⚠️ **ALWAYS keep remote repository updated** - push regularly if remote is configured
1339
- - ⚠️ **ALWAYS update `tasks.md` at EVERY step**, not just at the end!
1340
-
1341
- ## Best Practices
1342
-
1343
- ### DO's ✅
1344
-
1345
- - **ALWAYS** create task BEFORE implementing any feature
1346
- - **ALWAYS** check Context7 MCP before creating tasks
1347
- - **ALWAYS** validate task format before committing
1348
- - **ALWAYS** use SHALL/MUST in requirements
1349
- - **ALWAYS** use 4 hashtags for scenarios
1350
- - **ALWAYS** use Given/When/Then structure
1351
- - **ALWAYS** follow priority order (most critical first)
1352
- - **ALWAYS** write tests first (highest priority)
1353
- - **ALWAYS** verify test coverage before marking complete
1354
- - **ALWAYS** commit locally frequently (even for backup)
1355
- - **ALWAYS** keep remote repository updated (push regularly)
1356
- - **ALWAYS** update task status before moving to next task
1357
- - **ALWAYS** update task status during implementation
1358
- - **ALWAYS** archive completed tasks
1359
- - **ALWAYS** document breaking changes in proposal
1360
-
1361
- ### DON'Ts ❌
1362
-
1363
- - **NEVER** start implementation without creating task first
1364
- - **NEVER** skip task registration (tasks can be lost in context)
1365
- - **NEVER** proceed to next task without updating current task status
1366
- - **NEVER** skip test coverage verification
1367
- - **NEVER** mark tasks complete without tests passing
1368
- - **NEVER** skip local commits (commit frequently for backup)
1369
- - **NEVER** let remote repository get out of sync (push regularly)
1370
- - **NEVER** commit sensitive information (API keys, passwords)
1371
- - **NEVER** force push to shared branches
1372
- - **NEVER** create tasks without checking Context7 format
1373
- - **NEVER** use 3 hashtags for scenarios
1374
- - **NEVER** omit SHALL/MUST from requirements
1375
- - **NEVER** use bullet points for scenarios
1376
- - **NEVER** skip validation
1377
- - **NEVER** leave tasks unarchived after completion
1378
- - **NEVER** mix formats (stick to OpenSpec-compatible format)
1379
- - **NEVER** ignore priority order (always do most critical first)
1380
-
1381
- ## CLI Commands Reference
1382
-
1383
- ### Task Management Commands
1384
-
1385
- #### `rulebook task create <task-id>`
1386
-
1387
- Create a new Rulebook task with OpenSpec-compatible format.
1388
-
1389
- **Usage:**
1390
- ```bash
1391
- rulebook task create add-user-authentication
1392
- ```
1393
-
1394
- **What it does:**
1395
- - Creates `/.rulebook/tasks/<task-id>/` directory
1396
- - Generates `proposal.md` template
1397
- - Generates `tasks.md` template
1398
- - Creates `specs/` directory for spec deltas
1399
-
1400
- **Requirements:**
1401
- - Task ID must be unique (verb-led kebab-case)
1402
- - Context7 MCP must be available (for format validation)
1403
-
1404
- **Example:**
1405
- ```bash
1406
- $ rulebook task create add-email-notifications
1407
- ✅ Task add-email-notifications created successfully
1408
- Location: .rulebook/tasks/add-email-notifications/
1409
-
1410
- ⚠️ Remember to:
1411
- 1. Check Context7 MCP for OpenSpec format requirements
1412
- 2. Fill in proposal.md (minimum 20 characters in "Why" section)
1413
- 3. Add tasks to tasks.md
1414
- 4. Create spec deltas in specs/*/spec.md
1415
- 5. Validate with: rulebook task validate add-email-notifications
1416
- ```
1417
-
1418
- **Error Handling:**
1419
- - `Task <task-id> already exists`: Choose a different task ID or archive existing task
1420
-
1421
- ---
1422
-
1423
- #### `rulebook task list [--archived]`
1424
-
1425
- List all Rulebook tasks (active and optionally archived).
1426
-
1427
- **Usage:**
1428
- ```bash
1429
- # List active tasks only
1430
- rulebook task list
1431
-
1432
- # List including archived tasks
1433
- rulebook task list --archived
1434
- ```
1435
-
1436
- **Output:**
1437
- - Active tasks with status (pending, in-progress, completed, blocked)
1438
- - Archived tasks with archive date (if --archived flag is used)
1439
-
1440
- **Example:**
1441
- ```bash
1442
- $ rulebook task list
1443
-
1444
- 📋 Rulebook Tasks
1445
-
1446
- Active Tasks:
1447
- pending add-user-authentication - Add user authentication feature
1448
- in-progress refactor-api-validation - Refactor API validation logic
1449
- completed update-documentation - Update project documentation
1450
-
1451
- $ rulebook task list --archived
1452
-
1453
- 📋 Rulebook Tasks
1454
-
1455
- Active Tasks:
1456
- pending add-user-authentication - Add user authentication feature
1457
-
1458
- Archived Tasks:
1459
- archived 2025-01-15-add-email-notifications - Add email notifications (2025-01-15)
1460
- ```
1461
-
1462
- **Task Status Values:**
1463
- - `pending`: Task not started
1464
- - `in-progress`: Task being worked on
1465
- - `completed`: Task finished (ready for archive)
1466
- - `blocked`: Task blocked by dependency
1467
-
1468
- ---
1469
-
1470
- #### `rulebook task show <task-id>`
1471
-
1472
- Show detailed information about a specific task.
1473
-
1474
- **Usage:**
1475
- ```bash
1476
- rulebook task show add-user-authentication
1477
- ```
1478
-
1479
- **Output:**
1480
- - Task ID and title
1481
- - Status (pending, in-progress, completed, blocked)
1482
- - Created and updated dates
1483
- - Archive date (if archived)
1484
- - Proposal summary (first 500 characters)
1485
- - Spec files list
1486
-
1487
- **Example:**
1488
- ```bash
1489
- $ rulebook task show add-user-authentication
1490
-
1491
- 📋 Task: add-user-authentication
1492
-
1493
- Title: add-user-authentication
1494
- Status: pending
1495
- Created: 2025-01-15T10:30:00.000Z
1496
- Updated: 2025-01-15T10:30:00.000Z
1497
-
1498
- Proposal:
1499
- # Proposal: Add User Authentication
1500
-
1501
- ## Why
1502
- We need to implement secure user authentication to protect user accounts and enable personalized features. This will include JWT token-based authentication with refresh tokens and password hashing using bcrypt...
1503
-
1504
- Specs:
1505
- core/spec.md (1234 chars)
1506
- ```
1507
-
1508
- **Error Handling:**
1509
- - `Task <task-id> not found`: Verify task ID exists with `rulebook task list`
1510
-
1511
- ---
1512
-
1513
- #### `rulebook task validate <task-id>`
1514
-
1515
- Validate task format against OpenSpec-compatible requirements.
1516
-
1517
- **Usage:**
1518
- ```bash
1519
- rulebook task validate add-user-authentication
1520
- ```
1521
-
1522
- **Validation Checks:**
1523
- - Purpose section length (≥20 characters)
1524
- - Requirement keywords (SHALL/MUST)
1525
- - Scenario format (4 hashtags, not 3)
1526
- - Given/When/Then structure
1527
- - Delta headers format (ADDED/MODIFIED/REMOVED/RENAMED)
1528
-
1529
- **Example:**
1530
- ```bash
1531
- $ rulebook task validate add-user-authentication
1532
- ✅ Task add-user-authentication is valid
1533
-
1534
- ⚠️ Warnings:
1535
- - Scenario in core/spec.md should use Given/When/Then structure
1536
- ```
1537
-
1538
- **Error Example:**
1539
- ```bash
1540
- $ rulebook task validate invalid-task
1541
- ❌ Task invalid-task validation failed
1542
-
1543
- Errors:
1544
- - Scenarios in core/spec.md must use 4 hashtags (####), not 3 (###)
1545
- - Requirement in core/spec.md missing SHALL or MUST keyword: ### Requirement: Auth
1546
- - Purpose section (## Why) must have at least 20 characters
1547
- ```
1548
-
1549
- **Error Handling:**
1550
- - Fix all errors before proceeding
1551
- - Warnings are informational but don't block archiving
1552
-
1553
- ---
1554
-
1555
- #### `rulebook task archive <task-id> [--skip-validation]`
1556
-
1557
- Archive a completed task and apply spec deltas to main specifications.
1558
-
1559
- **Usage:**
1560
- ```bash
1561
- # Archive with validation (recommended)
1562
- rulebook task archive add-user-authentication
1563
-
1564
- # Archive without validation (use with caution)
1565
- rulebook task archive add-user-authentication --skip-validation
1566
- ```
1567
-
1568
- **Archive Process:**
1569
- 1. Validates task format (unless `--skip-validation` is used)
1570
- 2. Checks task completion status
1571
- 3. Applies spec deltas to main specifications
1572
- 4. Moves task to `/.rulebook/tasks/archive/YYYY-MM-DD-<task-id>/`
1573
- 5. Updates related specifications
1574
-
1575
- **Example:**
1576
- ```bash
1577
- $ rulebook task archive add-user-authentication
1578
- ✅ Task add-user-authentication archived successfully
1579
- ```
1580
-
1581
- **Error Handling:**
1582
- - `Task validation failed`: Fix validation errors before archiving
1583
- - `Task <task-id> not found`: Verify task ID exists
1584
- - `Archive <archive-name> already exists`: Archive with that date already exists
1585
-
1586
- **Important:**
1587
- - Only archive tasks that are fully completed
1588
- - All items in `tasks.md` should be marked as `[x]`
1589
- - All tests should pass
1590
- - Documentation should be updated
1591
-
1592
- ---
1593
-
1594
- ### Core Rulebook Commands
1595
-
1596
- #### `rulebook init [--minimal] [--light] [--yes]`
1597
-
1598
- Initialize Rulebook for current project.
1599
-
1600
- **Usage:**
1601
- ```bash
1602
- # Interactive mode
1603
- rulebook init
1604
-
1605
- # Minimal setup (essentials only)
1606
- rulebook init --minimal
1607
-
1608
- # Light mode (no quality enforcement)
1609
- rulebook init --light
1610
-
1611
- # Skip prompts, use defaults
1612
- rulebook init --yes
1613
- ```
1614
-
1615
- **What it does:**
1616
- - Detects languages, frameworks, and MCP modules
1617
- - Generates AGENTS.md with AI assistant rules
1618
- - Creates `/rulebook/` directory with templates
1619
- - Creates/updates `.gitignore` automatically
1620
- - Optionally installs Git hooks
1621
- - Generates Cursor commands (if Cursor is selected IDE)
1622
-
1623
- ---
1624
-
1625
- #### `rulebook update [--yes] [--minimal] [--light]`
1626
-
1627
- Update AGENTS.md and .rulebook to latest version.
1628
-
1629
- **Usage:**
1630
- ```bash
1631
- # Interactive mode
1632
- rulebook update
1633
-
1634
- # Skip confirmation
1635
- rulebook update --yes
1636
-
1637
- # Minimal mode
1638
- rulebook update --minimal
1639
-
1640
- # Light mode
1641
- rulebook update --light
1642
- ```
1643
-
1644
- **What it does:**
1645
- - Migrates OpenSpec tasks to Rulebook format (if OpenSpec exists)
1646
- - Migrates OpenSpec archives to Rulebook format
1647
- - Removes OpenSpec commands from `.cursor/commands/`
1648
- - Updates AGENTS.md with latest templates
1649
- - Merges templates while preserving customizations
1650
- - Updates Cursor commands (if Cursor is selected IDE)
1651
-
1652
- ---
1653
-
1654
- #### `rulebook validate`
1655
-
1656
- Validate project structure against Rulebook standards.
1657
-
1658
- **Usage:**
1659
- ```bash
1660
- rulebook validate
1661
- ```
1662
-
1663
- **Validation Checks:**
1664
- - AGENTS.md presence and format
1665
- - Rulebook directory structure
1666
- - Documentation structure
1667
- - Tests directory
1668
- - Score calculation (0-100)
1669
-
1670
- ---
1671
-
1672
- #### `rulebook health`
1673
-
1674
- Check project health score.
1675
-
1676
- **Usage:**
1677
- ```bash
1678
- rulebook health
1679
- ```
1680
-
1681
- **Categories Scored:**
1682
- - Quality (linting, formatting, code quality)
1683
- - Testing (test coverage, test quality)
1684
- - Security (vulnerabilities, secrets)
1685
- - Documentation (README, docs/, comments)
1686
-
1687
- **Score Range:** 0-100
1688
-
1689
- ---
1690
-
1691
- #### `rulebook workflows`
1692
-
1693
- Generate GitHub Actions workflows for detected languages.
1694
-
1695
- **Usage:**
1696
- ```bash
1697
- rulebook workflows
1698
- ```
1699
-
1700
- **What it does:**
1701
- - Creates `.github/workflows/` directory
1702
- - Generates language-specific workflows (test, lint, publish)
1703
- - Adds codespell workflow for spelling checks
1704
-
1705
- ---
1706
-
1707
- #### `rulebook check-deps`
1708
-
1709
- Check for outdated and vulnerable dependencies.
1710
-
1711
- **Usage:**
1712
- ```bash
1713
- rulebook check-deps
1714
- ```
1715
-
1716
- **Supported Package Managers:**
1717
- - npm (package.json)
1718
- - Cargo (Cargo.toml)
1719
- - pip (requirements.txt, pyproject.toml)
1720
- - Go modules (go.mod)
1721
-
1722
- ---
1723
-
1724
- #### `rulebook check-coverage [-t <threshold>]`
1725
-
1726
- Check test coverage against threshold.
1727
-
1728
- **Usage:**
1729
- ```bash
1730
- # Default threshold (95%)
1731
- rulebook check-coverage
1732
-
1733
- # Custom threshold
1734
- rulebook check-coverage -t 80
1735
- ```
1736
-
1737
- ---
1738
-
1739
- #### `rulebook generate-docs [--yes]`
1740
-
1741
- Generate documentation structure and standard files.
1742
-
1743
- **Usage:**
1744
- ```bash
1745
- # Interactive mode
1746
- rulebook generate-docs
1747
-
1748
- # Skip prompts
1749
- rulebook generate-docs --yes
1750
- ```
1751
-
1752
- ---
1753
-
1754
- #### `rulebook version <major|minor|patch>`
1755
-
1756
- Bump project version (semantic versioning).
1757
-
1758
- **Usage:**
1759
- ```bash
1760
- rulebook version major # 1.0.0 -> 2.0.0
1761
- rulebook version minor # 1.0.0 -> 1.1.0
1762
- rulebook version patch # 1.0.0 -> 1.0.1
1763
- ```
1764
-
1765
- ---
1766
-
1767
- #### `rulebook changelog [-v <version>]`
1768
-
1769
- Generate changelog from git commits.
1770
-
1771
- **Usage:**
1772
- ```bash
1773
- # Auto-detect version
1774
- rulebook changelog
1775
-
1776
- # Specify version
1777
- rulebook changelog -v 1.0.0
1778
- ```
1779
-
1780
- ---
1781
-
1782
- #### `rulebook fix`
1783
-
1784
- Auto-fix common project issues.
1785
-
1786
- **Usage:**
1787
- ```bash
1788
- rulebook fix
1789
- ```
1790
-
1791
- ---
1792
-
1793
- ### Advanced Commands (Beta)
1794
-
1795
- #### `rulebook watcher`
1796
-
1797
- Start modern full-screen console watcher for task progress.
1798
-
1799
- **Usage:**
1800
- ```bash
1801
- rulebook watcher
1802
- ```
1803
-
1804
- **Features:**
1805
- - Live task progress tracking
1806
- - Activity log with timestamps
1807
- - System status monitoring
1808
- - Auto-refresh every 2 seconds
1809
-
1810
- ---
1811
-
1812
- #### `rulebook agent [--dry-run] [--tool <name>] [--iterations <n>] [--watch]`
1813
-
1814
- Start autonomous agent for managing AI CLI workflows.
1815
-
1816
- **Usage:**
1817
- ```bash
1818
- # Dry run (simulate without changes)
1819
- rulebook agent --dry-run
1820
-
1821
- # Specify CLI tool
1822
- rulebook agent --tool cursor-agent
1823
-
1824
- # Set max iterations
1825
- rulebook agent --iterations 10
1826
-
1827
- # Enable watcher mode
1828
- rulebook agent --watch
1829
- ```
1830
-
1831
- ---
1832
-
1833
- #### `rulebook config [--show] [--set <key=value>] [--feature <name> --enable|--disable]`
1834
-
1835
- Manage Rulebook configuration.
1836
-
1837
- **Usage:**
1838
- ```bash
1839
- # Show current config
1840
- rulebook config --show
1841
-
1842
- # Set config value
1843
- rulebook config --set rulebookDir=custom-rulebook
1844
-
1845
- # Enable feature
1846
- rulebook config --feature watcher --enable
1847
-
1848
- # Disable feature
1849
- rulebook config --feature agent --disable
1850
- ```
1851
-
1852
- ## Migration from OpenSpec
1853
-
1854
- If your project previously used OpenSpec:
1855
-
1856
- 1. **Automatic Migration**: Run `rulebook update` to automatically migrate OpenSpec tasks to Rulebook format
1857
- 2. **Manual Migration**: Tasks in `/openspec/changes/` will be moved to `/.rulebook/tasks/`
1858
- 3. **Format Compatibility**: Rulebook uses OpenSpec-compatible format, so existing tasks remain valid
1859
-
1860
- ## Context7 MCP Requirement
1861
-
1862
- **CRITICAL**: Context7 MCP is REQUIRED for task creation.
1863
-
1864
- **Why**:
1865
- - Ensures correct format by fetching official OpenSpec documentation
1866
- - Prevents common format errors made by AI assistants
1867
- - Provides up-to-date format requirements
1868
-
1869
- **If Context7 MCP is not available:**
1870
- - Task creation will fail with clear error message
1871
- - You must configure Context7 MCP before creating tasks
1872
- - See `/rulebook/CONTEXT7.md` for setup instructions
1873
-
1874
- ## Troubleshooting
1875
-
1876
- ### Validation Errors
1877
-
1878
- **Error**: "Requirement must contain SHALL or MUST keyword"
1879
- - **Fix**: Add SHALL or MUST to requirement text
1880
- - **Example**: Change "The system provides authentication" to "The system SHALL provide authentication"
1881
-
1882
- **Error**: "Scenario must use 4 hashtags"
1883
- - **Fix**: Change `### Scenario:` to `#### Scenario:` (at start of line)
1884
- - **Note**: Validation only checks headers at start of line, not in text content
1885
-
1886
- **Error**: "Purpose section too short"
1887
- - **Fix**: Expand "Why" section in proposal.md to at least 20 characters
1888
- - **Example**: "Auth system" → "Authentication system for secure user access with JWT tokens and session management"
1889
-
1890
- **Error**: "Scenario must use Given/When/Then structure"
1891
- - **Fix**: Replace bullet points with Given/When/Then format
1892
- - **Example**:
1893
- ```markdown
1894
- #### Scenario: User login
1895
- Given a user has valid credentials
1896
- When they submit the login form
1897
- Then they are authenticated successfully
1898
- ```
1899
-
1900
- ### Task Creation Errors
1901
-
1902
- **Error**: "Context7 MCP not available"
1903
- - **Fix**: Configure Context7 MCP in your MCP configuration file
1904
- - **See**: `/rulebook/CONTEXT7.md` for setup instructions
1905
-
1906
- **Error**: "Task ID already exists"
1907
- - **Fix**: Choose a different task ID or archive existing task
1908
- - **Check**: Use `rulebook task list` to see existing tasks
1909
-
1910
- ### Task Archive Errors
1911
-
1912
- **Error**: "Task validation failed"
1913
- - **Fix**: Run `rulebook task validate <task-id>` to see all errors
1914
- - **Fix**: Address all validation errors before archiving
1915
- - **Option**: Use `--skip-validation` flag only if you're certain the task is valid
1916
-
1917
- **Error**: "Archive <archive-name> already exists"
1918
- - **Fix**: Archive with that date already exists
1919
- - **Check**: Use `rulebook task list --archived` to see archived tasks
1920
-
1921
- ### Command Errors
1922
-
1923
- **Error**: "Task <task-id> not found"
1924
- - **Fix**: Verify task ID exists with `rulebook task list`
1925
- - **Check**: Ensure you're in the correct project directory
1926
-
1927
- **Error**: "No tasks found"
1928
- - **Fix**: Create a task first with `rulebook task create <task-id>`
1929
- - **Check**: Verify `/.rulebook/tasks/` directory exists
1930
-
1931
- ### Migration Errors
1932
-
1933
- **Error**: "Failed to migrate task"
1934
- - **Fix**: Check error message for specific issue
1935
- - **Check**: Verify OpenSpec task structure is correct
1936
- - **Fix**: Manually migrate if automatic migration fails
1937
-
1938
- **Error**: "Failed to read OpenSpec changes directory"
1939
- - **Fix**: Verify `/openspec/changes/` directory exists
1940
- - **Check**: Ensure you have read permissions
1941
-
1942
- ## Examples
1943
-
1944
- See `/.rulebook/tasks/` directory for examples of correctly formatted tasks.
1945
-
1946
- <!-- RULEBOOK:END -->
1947
-
1
+ <!-- RULEBOOK:START -->
2
+ # Rulebook Task Management
3
+
4
+ **CRITICAL**: Use Rulebook's built-in task management system for spec-driven development of new features and breaking changes.
5
+
6
+ ## When to Use
7
+
8
+ Create tasks for:
9
+ - ✅ New features/capabilities
10
+ - ✅ Breaking changes
11
+ - ✅ Architecture changes
12
+ - ✅ Performance/security work
13
+
14
+ Skip for:
15
+ - ❌ Bug fixes (restore intended behavior)
16
+ - ❌ Typos, formatting, comments
17
+ - ❌ Dependency updates (non-breaking)
18
+
19
+ ## Persistent Memory Integration
20
+
21
+ **IMPORTANT**: Task management is tightly integrated with persistent memory system for cross-session context:
22
+
23
+ ### Task Completion and Memory
24
+ When a task is marked as completed:
25
+ 1. **Auto-save to memory** (if enabled): Key learnings, patterns, gotchas from task specs are captured
26
+ 2. **Search past tasks**: Before creating similar tasks, search memory for past implementations:
27
+ ```bash
28
+ rulebook memory search "authentication" --type feature
29
+ ```
30
+ 3. **Update implementation faster**: Reference past solutions documented in memory
31
+
32
+ ### Memory during Task Development
33
+ As you work on a task:
34
+ - **Save discoveries**: Use `rulebook memory save` to capture patterns and gotchas
35
+ - **Reference past context**: Search memory for related implementations
36
+ - **Document decisions**: Save architectural choices for future developers
37
+
38
+ ## ⚠️ CRITICAL: Task Creation is MANDATORY Before Implementation
39
+
40
+ **ABSOLUTE RULE**: You MUST create a task BEFORE implementing ANY feature.
41
+
42
+ ### Why This Matters
43
+
44
+ **Without task registration:**
45
+ - ❌ Tasks can be lost in context
46
+ - ❌ No tracking of implementation progress
47
+ - ❌ No record of what was done and why
48
+ - ❌ Difficult to resume work after context loss
49
+ - ❌ No validation of completion criteria
50
+
51
+ **With task registration:**
52
+ - ✅ All features are tracked and documented
53
+ - ✅ Progress is visible and measurable
54
+ - ✅ Implementation history is preserved
55
+ - ✅ Easy to resume work from any point
56
+ - ✅ Clear completion criteria
57
+
58
+ ### MANDATORY Workflow
59
+
60
+ **NEVER start implementation without creating a task first:**
61
+
62
+ ```bash
63
+ # ❌ WRONG: Starting implementation directly
64
+ # ... writing code without task ...
65
+
66
+ # ✅ CORRECT: Create task first
67
+ rulebook task create <task-id>
68
+ # Write proposal.md
69
+ # Write tasks.md
70
+ # Write spec deltas
71
+ rulebook task validate <task-id>
72
+ # NOW you can start implementation
73
+ ```
74
+
75
+ ### Task Creation Before Any Feature Request
76
+
77
+ **When a feature is requested:**
78
+
79
+ 1. **STOP** - Do not start coding
80
+ 2. **Create task** - `rulebook task create <task-id>`
81
+ 3. **Plan** - Write proposal.md and tasks.md
82
+ 4. **Spec** - Write spec deltas
83
+ 5. **Validate** - `rulebook task validate <task-id>`
84
+ 6. **THEN** - Start implementation
85
+
86
+ **Example:**
87
+ ```
88
+ User: "Add user authentication feature"
89
+
90
+ ❌ WRONG: Start coding immediately
91
+ ✅ CORRECT:
92
+ 1. rulebook task create add-user-authentication
93
+ 2. Write proposal.md explaining why and what
94
+ 3. Write tasks.md with implementation checklist
95
+ 4. Write specs/core/spec.md with requirements
96
+ 5. rulebook task validate add-user-authentication
97
+ 6. NOW start implementing
98
+ ```
99
+
100
+ ## CRITICAL: Task Creation Workflow
101
+
102
+ **MANDATORY STEPS** - Follow in this exact order:
103
+
104
+ ### Step 1: Check Context7 MCP (MANDATORY)
105
+
106
+ **BEFORE creating ANY task, you MUST:**
107
+
108
+ 1. **Query Context7 for OpenSpec documentation** (Rulebook uses OpenSpec-compatible format):
109
+ ```
110
+ @Context7 /fission-ai/openspec task creation format spec structure
111
+ ```
112
+
113
+ 2. **Review official format requirements**:
114
+ - Spec delta file format
115
+ - Requirement structure
116
+ - Scenario formatting
117
+ - Delta headers (ADDED/MODIFIED/REMOVED/RENAMED)
118
+
119
+ 3. **Verify format requirements**:
120
+ - Scenario MUST use `#### Scenario:` (4 hashtags, NOT 3, NOT bullets)
121
+ - Requirements MUST use `### Requirement: [Name]`
122
+ - MUST include SHALL/MUST statement after requirement name
123
+ - MUST include at least one scenario per requirement
124
+ - Purpose section MUST have minimum 20 characters
125
+
126
+ **Why This Matters:**
127
+ Most AI assistants create tasks with incorrect formats (wrong scenario headers, missing SHALL statements, incomplete deltas). Context7 provides the official format documentation that prevents validation failures.
128
+
129
+ ### Step 2: Explore Current State
130
+
131
+ ```bash
132
+ # List existing tasks
133
+ rulebook task list
134
+
135
+ # List active changes
136
+ rulebook task list --active
137
+
138
+ # View task details
139
+ rulebook task show <task-id>
140
+ ```
141
+
142
+ ### Step 3: Choose Task ID
143
+
144
+ - Use **verb-led** kebab-case: `add-auth`, `update-api`, `remove-feature`, `refactor-module`
145
+ - Must be unique (check existing tasks)
146
+ - Descriptive and focused (one capability per task)
147
+
148
+ ### Step 4: Create Task Structure
149
+
150
+ ```bash
151
+ # Create new task
152
+ rulebook task create <task-id>
153
+
154
+ # This creates:
155
+ # /.rulebook/tasks/<task-id>/
156
+ # ├── proposal.md # Why and what changes
157
+ # ├── tasks.md # Implementation checklist
158
+ # ├── design.md # Technical decisions (optional)
159
+ # └── specs/
160
+ # └── <module>/
161
+ # └── spec.md # Delta showing additions/modifications
162
+ ```
163
+
164
+ ### Step 5: Write Proposal
165
+
166
+ **File**: `/.rulebook/tasks/<task-id>/proposal.md`
167
+
168
+ ```markdown
169
+ # Proposal: Task Name
170
+
171
+ ## Why
172
+ Minimum 20 characters explaining why this change is needed.
173
+ Provide context, motivation, and business/technical rationale.
174
+
175
+ ## What Changes
176
+ Detailed description of what will change:
177
+ - Specific components affected
178
+ - New features or capabilities
179
+ - Breaking changes (if any)
180
+ - Migration path (if applicable)
181
+
182
+ ## Impact
183
+ - Affected specs: list spec names
184
+ - Affected code: list files/modules
185
+ - Breaking change: YES/NO
186
+ - User benefit: describe benefits
187
+ ```
188
+
189
+ ### Step 6: Write Tasks Checklist
190
+
191
+ **File**: `/.rulebook/tasks/<task-id>/tasks.md`
192
+
193
+ ```markdown
194
+ ## 1. Implementation Phase
195
+ - [ ] 1.1 First task item
196
+ - [ ] 1.2 Second task item
197
+
198
+ ## 2. Testing Phase
199
+ - [ ] 2.1 Write unit tests
200
+ - [ ] 2.2 Write integration tests
201
+
202
+ ## 3. Documentation Phase
203
+ - [ ] 3.1 Update README
204
+ - [ ] 3.2 Update CHANGELOG
205
+ ```
206
+
207
+ **⚠️ CRITICAL: Sequential Execution Rule**
208
+
209
+ When implementing tasks from `tasks.md`, you MUST execute items **in the exact order listed**:
210
+
211
+ 1. Find the FIRST unchecked item (`- [ ]`) — implement THAT one
212
+ 2. Mark it `[x]` when done
213
+ 3. Move to the NEXT unchecked item
214
+ 4. **NEVER** skip ahead, reorder, or cherry-pick tasks
215
+ 5. **NEVER** start a later phase before the current phase is 100% complete
216
+
217
+ **The task list is an ORDER, not a MENU.** The human defined the sequence deliberately. Follow it.
218
+
219
+ ### Step 7: Write Spec Delta
220
+
221
+ **File**: `/.rulebook/tasks/<task-id>/specs/<module>/spec.md`
222
+
223
+ **CRITICAL FORMAT REQUIREMENTS:**
224
+
225
+ ```markdown
226
+ # Specification Name
227
+
228
+ ## ADDED Requirements
229
+
230
+ ### Requirement: Feature Name
231
+ The system SHALL/MUST do something specific and testable.
232
+ Every requirement needs SHALL or MUST keyword.
233
+
234
+ #### Scenario: Scenario Name
235
+ Given some precondition
236
+ When an action occurs
237
+ Then an expected outcome happens
238
+
239
+ ## MODIFIED Requirements
240
+
241
+ ### Requirement: Existing Feature
242
+ The system SHALL/MUST do something modified.
243
+
244
+ #### Scenario: Modified scenario
245
+ Given updated precondition
246
+ When action occurs
247
+ Then new expected outcome
248
+
249
+ ## REMOVED Requirements
250
+
251
+ ### Requirement: Deprecated Feature
252
+ [Description of what is being removed]
253
+
254
+ ## RENAMED Requirements
255
+ - FROM: `### Requirement: Old Name`
256
+ - TO: `### Requirement: New Name`
257
+ ```
258
+
259
+ **Format Rules:**
260
+ - ✅ Purpose section: Minimum 20 characters
261
+ - ✅ Requirements: Must contain SHALL or MUST
262
+ - ✅ Scenarios: Use `#### Scenario:` (4 hashtags)
263
+ - ✅ Scenarios: Use Given/When/Then structure
264
+ - ✅ Deltas: Use ADDED/MODIFIED/REMOVED/RENAMED headers
265
+ - ❌ NEVER use 3 hashtags for scenarios
266
+ - ❌ NEVER use bullet points for scenarios
267
+ - ❌ NEVER omit SHALL/MUST from requirements
268
+
269
+ ### Step 8: Validate Task
270
+
271
+ ```bash
272
+ # Validate task format
273
+ rulebook task validate <task-id>
274
+
275
+ # Validate with strict mode (recommended)
276
+ rulebook task validate <task-id> --strict
277
+
278
+ # Validate all tasks
279
+ rulebook task validate --all
280
+ ```
281
+
282
+ **Validation checks:**
283
+ - Purpose section length (≥20 chars)
284
+ - Requirement keywords (SHALL/MUST)
285
+ - Scenario format (4 hashtags)
286
+ - Given/When/Then structure
287
+ - Delta headers format
288
+
289
+ ### Step 9: Update Task Status
290
+
291
+ ```bash
292
+ # Mark task as in progress
293
+ rulebook task update <task-id> --status in-progress
294
+
295
+ # Update task progress
296
+ rulebook task update <task-id> --progress 50
297
+
298
+ # Mark task as completed
299
+ rulebook task update <task-id> --status completed
300
+ ```
301
+
302
+ ### Step 10: Archive Completed Task
303
+
304
+ ```bash
305
+ # Archive completed task
306
+ rulebook task archive <task-id>
307
+
308
+ # Archive without prompts
309
+ rulebook task archive <task-id> --yes
310
+ ```
311
+
312
+ **Archive process:**
313
+ 1. Validates task format
314
+ 2. Checks task completion status
315
+ 3. Applies spec deltas to main specifications
316
+ 4. Moves task to `/.rulebook/tasks/archive/YYYY-MM-DD-<task-id>/`
317
+ 5. Updates related specifications
318
+
319
+ ## 🚨 MANDATORY: Deferred Items → Tasks Rule
320
+
321
+ **ABSOLUTE RULE — NO EXCEPTIONS**: Whenever a task is archived with items marked as "Deferred" or "Phase X+", you MUST immediately create Rulebook tasks for those deferred items **before archiving**.
322
+
323
+ ### The Deferred Items Protocol
324
+
325
+ ```
326
+ ❌ WRONG — defer without creating task:
327
+ 1. Archive task with "- [ ] D1. feature X — deferred Phase 4"
328
+ → Feature X is now forgotten forever
329
+
330
+ ✅ CORRECT — defer with tracking:
331
+ 1. Add "- [ ] D1. feature X — deferred Phase 4" to tasks.md
332
+ 2. Call rulebook_task_create("phase4-feature-x")
333
+ 3. Write tasks.md for the new task with full context
334
+ 4. THEN call rulebook_task_archive
335
+ ```
336
+
337
+ ### tasks.md Format for Archived Tasks
338
+
339
+ ```markdown
340
+ ## 1. Implemented Feature
341
+
342
+ - [x] 1.1 Thing that was done
343
+ - [x] 1.2 Another thing done
344
+
345
+ ## Deferred to Phase N (reason: dependency not ready)
346
+
347
+ - [ ] D1. Feature X — deferred (reason) ← task phase4-feature-x MUST exist
348
+ - [ ] D2. Feature Y — deferred (reason) ← task phaseN-feature-y MUST exist
349
+ ```
350
+
351
+ ### Archive Checklist (ALL must be done before `rulebook_task_archive`)
352
+
353
+ ```
354
+ □ 1. tasks.md uses - [x] for implemented, - [ ] for deferred
355
+ □ 2. Each deferred item has a "Phase N" target
356
+ □ 3. A rulebook task exists for EVERY deferred item or group
357
+ □ 4. The new deferred tasks have tasks.md with full context
358
+ □ 5. THEN call rulebook_task_archive
359
+ ```
360
+
361
+ ## Task Format Examples
362
+
363
+ ### Correct Format ✅
364
+
365
+ ```markdown
366
+ # Auth Specification
367
+
368
+ ## ADDED Requirements
369
+
370
+ ### Requirement: Two-Factor Authentication
371
+ The system MUST require a second factor during login for enhanced security.
372
+
373
+ #### Scenario: OTP required
374
+ Given a user submits valid credentials
375
+ When authentication starts
376
+ Then an OTP challenge is required
377
+
378
+ #### Scenario: OTP verification
379
+ Given a user receives an OTP code
380
+ When they submit the correct OTP
381
+ Then they are authenticated successfully
382
+ ```
383
+
384
+ ### Incorrect Format ❌
385
+
386
+ ```markdown
387
+ # Auth Specification
388
+
389
+ ## Requirements
390
+
391
+ ### Requirement: Two-Factor Authentication
392
+ The system requires a second factor. # ❌ Missing SHALL/MUST
393
+
394
+ #### Scenario: OTP required # ❌ Only 3 hashtags
395
+ - WHEN user submits credentials # ❌ Using bullets instead of Given/When/Then
396
+ - THEN OTP challenge is required
397
+ ```
398
+
399
+ ## Common Pitfalls & How to Avoid Them
400
+
401
+ ### Top 5 Mistakes AI Assistants Make
402
+
403
+ 1. **Wrong Scenario Headers**
404
+ - ❌ `### Scenario:` (3 hashtags)
405
+ - ✅ `#### Scenario:` (4 hashtags)
406
+
407
+ 2. **Missing SHALL/MUST Keywords**
408
+ - ❌ "The system provides authentication"
409
+ - ✅ "The system SHALL provide authentication"
410
+
411
+ 3. **Using Bullets for Scenarios**
412
+ - ❌ `- WHEN user does X THEN Y happens`
413
+ - ✅ `Given X\nWhen Y\nThen Z`
414
+
415
+ 4. **Incomplete Purpose Section**
416
+ - ❌ "Auth system" (too short)
417
+ - ✅ "Authentication system for secure user access with JWT tokens and session management" (≥20 chars)
418
+
419
+ 5. **Wrong Delta Headers**
420
+ - ❌ `## New Requirements` or `## Changes`
421
+ - ✅ `## ADDED Requirements`, `## MODIFIED Requirements`, etc.
422
+
423
+ ## Integration with AGENT_AUTOMATION
424
+
425
+ **CRITICAL**: After implementing a task, follow AGENT_AUTOMATION workflow:
426
+
427
+ 1. Run quality checks (lint, test, type-check, build)
428
+ 2. Update task status in `tasks.md`
429
+ 3. Update documentation (ROADMAP, CHANGELOG, specs)
430
+ 4. Commit with conventional commit format
431
+ 5. Archive task when complete
432
+
433
+ ## ⚠️ CRITICAL: Git Hooks Will Block Commits with Problems
434
+
435
+ **ABSOLUTE RULE**: Pre-commit and pre-push hooks will **BLOCK** any commit attempt if there are:
436
+ - ❌ Lint errors or warnings
437
+ - ❌ Test failures
438
+ - ❌ Type check errors
439
+ - ❌ Formatting issues
440
+ - ❌ Coverage below thresholds
441
+
442
+ ### Why This Matters
443
+
444
+ **DO NOT attempt to commit code with problems:**
445
+ - ❌ `git commit` will **FAIL** if lint has errors
446
+ - ❌ `git commit` will **FAIL** if tests are failing
447
+ - ❌ `git push` will **FAIL** if pre-push checks fail
448
+ - ❌ You will waste time trying to commit broken code
449
+ - ❌ The hooks will reject your commit automatically
450
+
451
+ **ALWAYS fix problems BEFORE attempting to commit:**
452
+ - ✅ Run `npm run lint` and fix ALL errors/warnings first
453
+ - ✅ Run `npm test` and ensure ALL tests pass
454
+ - ✅ Run `npm run type-check` and fix ALL type errors
455
+ - ✅ Run `npm run format` if formatting is required
456
+ - ✅ Run `npm test -- --coverage` and ensure coverage thresholds are met
457
+ - ✅ **ONLY THEN** attempt `git commit`
458
+
459
+ ### Mandatory Pre-Commit Workflow
460
+
461
+ **BEFORE every commit, you MUST:**
462
+
463
+ ```bash
464
+ # 1. Fix lint errors FIRST (highest priority)
465
+ npm run lint
466
+ # Fix ALL errors and warnings
467
+ # If lint fails, commit will be blocked
468
+
469
+ # 2. Fix test failures SECOND
470
+ npm test
471
+ # Fix ALL failing tests
472
+ # If tests fail, commit will be blocked
473
+
474
+ # 3. Fix type errors THIRD
475
+ npm run type-check
476
+ # Fix ALL type errors
477
+ # If type check fails, commit will be blocked
478
+
479
+ # 4. Fix formatting (if required)
480
+ npm run format
481
+ # Apply formatting fixes
482
+
483
+ # 5. Verify coverage (if required by hooks)
484
+ npm test -- --coverage
485
+ # Ensure coverage thresholds are met
486
+
487
+ # 6. ONLY AFTER all checks pass, attempt commit
488
+ git add .
489
+ git commit -m "feat: your commit message"
490
+ # This will now succeed because all checks passed
491
+ ```
492
+
493
+ ### What Happens If You Try to Commit with Problems
494
+
495
+ **Example of blocked commit:**
496
+
497
+ ```bash
498
+ $ git commit -m "feat: add new feature"
499
+
500
+ 🔍 Running TypeScript/JavaScript pre-commit checks...
501
+ → Type checking...
502
+ → Linting...
503
+
504
+ /mnt/f/project/src/feature.ts
505
+ 42:19 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
506
+
507
+ ✖ 1 problem (1 error, 0 warnings)
508
+
509
+ ❌ Commit blocked: Lint errors found
510
+ ```
511
+
512
+ **You MUST fix the error before committing:**
513
+
514
+ ```bash
515
+ # Fix the lint error
516
+ # ... edit code to fix the issue ...
517
+
518
+ # Run lint again to verify
519
+ npm run lint
520
+ # ✅ All checks pass
521
+
522
+ # NOW commit will succeed
523
+ git commit -m "feat: add new feature"
524
+ # ✅ Commit successful
525
+ ```
526
+
527
+ ### ⚠️ CRITICAL: NEVER Use --no-verify to Bypass Hooks
528
+
529
+ **ABSOLUTE PROHIBITION**: You MUST NEVER use `--no-verify` or `--no-gpg-sign` flags to bypass git hooks.
530
+
531
+ **FORBIDDEN COMMANDS:**
532
+ - ❌ `git commit --no-verify` - **NEVER USE THIS**
533
+ - ❌ `git commit -n` - **NEVER USE THIS** (short form of --no-verify)
534
+ - ❌ `git push --no-verify` - **NEVER USE THIS**
535
+ - ❌ Any flag that skips pre-commit or pre-push hooks
536
+
537
+ ### Why This Is Prohibited
538
+
539
+ **Using `--no-verify` defeats the entire purpose of quality gates:**
540
+ - ❌ Allows broken code to be committed
541
+ - ❌ Bypasses all quality checks (lint, test, type-check)
542
+ - ❌ Introduces technical debt and bugs
543
+ - ❌ Violates project quality standards
544
+ - ❌ Can break the build for other developers
545
+ - ❌ Makes code review harder (reviewers see broken code)
546
+
547
+ **The hooks exist for a reason:**
548
+ - ✅ They protect code quality
549
+ - ✅ They prevent bugs from entering the codebase
550
+ - ✅ They ensure consistency across the project
551
+ - ✅ They catch errors before they reach production
552
+
553
+ ### What to Do Instead
554
+
555
+ **If you're tempted to use `--no-verify`, it means:**
556
+ 1. **You have problems that need fixing** - Fix them first
557
+ 2. **You're trying to commit too early** - Complete the work properly
558
+ 3. **You're rushing** - Slow down and do it right
559
+
560
+ **Correct approach:**
561
+
562
+ ```bash
563
+ # ❌ WRONG: Trying to bypass hooks
564
+ git commit --no-verify -m "feat: add feature"
565
+ # This is FORBIDDEN - never do this
566
+
567
+ # ✅ CORRECT: Fix problems first, then commit
568
+ npm run lint
569
+ # Fix all errors...
570
+
571
+ npm test
572
+ # Fix all failing tests...
573
+
574
+ npm run type-check
575
+ # Fix all type errors...
576
+
577
+ # NOW commit (hooks will pass)
578
+ git commit -m "feat: add feature"
579
+ # ✅ Commit successful - all checks passed
580
+ ```
581
+
582
+ ### Summary
583
+
584
+ **CRITICAL RULES:**
585
+ - ⚠️ **NEVER** attempt to commit code with lint errors - hooks will block it
586
+ - ⚠️ **NEVER** attempt to commit code with test failures - hooks will block it
587
+ - ⚠️ **NEVER** attempt to commit code with type errors - hooks will block it
588
+ - ⚠️ **NEVER** use `--no-verify` or any flag to bypass hooks - **ABSOLUTELY FORBIDDEN**
589
+ - ⚠️ **ALWAYS** fix ALL problems BEFORE attempting to commit
590
+ - ⚠️ **ALWAYS** run quality checks manually before `git commit`
591
+ - ⚠️ **ALWAYS** ensure all checks pass before committing
592
+
593
+ **The hooks are there to protect code quality - they will NOT let broken code through. Always resolve problems first, then commit. Bypassing hooks is strictly prohibited and defeats the purpose of quality gates.**
594
+
595
+ ## MANDATORY: Task List Updates During Implementation
596
+
597
+ **CRITICAL RULE**: You MUST update the task list (`tasks.md`) immediately after completing and testing each implementation step.
598
+
599
+ ### When to Update Task List
600
+
601
+ **ALWAYS update `tasks.md` when:**
602
+ - ✅ You complete a task item (mark as `[x]`)
603
+ - ✅ You finish implementing a feature and it's tested
604
+ - ✅ You complete a test suite
605
+ - ✅ You finish documentation updates
606
+ - ✅ You verify the implementation works correctly
607
+
608
+ **NEVER commit without updating `tasks.md` if you've made progress on a task.**
609
+
610
+ ### How to Update Task List
611
+
612
+ 1. **After Implementation**:
613
+ ```markdown
614
+ ## 1. Implementation Phase
615
+ - [x] 1.1 Create task manager module # ✅ Mark as done
616
+ - [x] 1.2 Add validation logic # ✅ Mark as done
617
+ - [ ] 1.3 Add archive functionality # Still pending
618
+ ```
619
+
620
+ 2. **After Testing**:
621
+ ```markdown
622
+ ## 2. Testing Phase
623
+ - [x] 2.1 Write unit tests # ✅ Tests written and passing
624
+ - [x] 2.2 Write integration tests # ✅ Tests written and passing
625
+ - [ ] 2.3 Add E2E tests # Still pending
626
+ ```
627
+
628
+ 3. **After Documentation**:
629
+ ```markdown
630
+ ## 3. Documentation Phase
631
+ - [x] 3.1 Update README # ✅ Updated
632
+ - [x] 3.2 Update CHANGELOG # ✅ Updated
633
+ - [ ] 3.3 Update API docs # Still pending
634
+ ```
635
+
636
+ ### Workflow: Implement → Test → Verify Coverage → Update Tasks → Commit → Next Task
637
+
638
+ **MANDATORY SEQUENCE** for every implementation:
639
+
640
+ ```bash
641
+ # 1. Implement the feature
642
+ # ... write code ...
643
+
644
+ # 2. Test the implementation
645
+ npm test
646
+ npm run lint
647
+ npm run type-check
648
+
649
+ # 3. Verify test coverage (CRITICAL)
650
+ npm test -- --coverage
651
+ # Check coverage thresholds are met
652
+ # Fix any coverage gaps before proceeding
653
+
654
+ # 4. Update tasks.md IMMEDIATELY after successful tests and coverage check
655
+ # Mark completed items as [x] in tasks.md
656
+ # Update task status if needed
657
+
658
+ # 5. Verify task status is updated before moving to next task
659
+ rulebook task show <task-id>
660
+ # Confirm status reflects current progress
661
+
662
+ # 6. Commit locally (BACKUP - do this frequently)
663
+ git add .
664
+ git commit -m "feat: implement task manager validation
665
+
666
+ - Complete task 1.2: Add validation logic
667
+ - All tests passing
668
+ - Coverage verified: 95%
669
+ - Updated tasks.md"
670
+
671
+ # 7. Keep remote repository updated (if configured)
672
+ # Check if remote is configured
673
+ git remote -v
674
+
675
+ # If remote exists, push regularly
676
+ git push origin <branch-name>
677
+
678
+ # If no remote configured, see setup instructions below
679
+
680
+ # 8. Only then proceed to next task
681
+ # Follow priority order (most critical first)
682
+ ```
683
+
684
+ ## ⚠️ CRITICAL: Frequent Local Commits for Backup
685
+
686
+ **ABSOLUTE RULE**: Commit locally frequently, even if just for backup purposes.
687
+
688
+ ### Why Frequent Commits Matter
689
+
690
+ **Without frequent commits:**
691
+ - ❌ Risk of losing work if system crashes
692
+ - ❌ No recovery point if something goes wrong
693
+ - ❌ Difficult to revert to previous working state
694
+ - ❌ Lost context if session is interrupted
695
+
696
+ **With frequent commits:**
697
+ - ✅ Work is backed up locally
698
+ - ✅ Easy to recover from mistakes
699
+ - ✅ Can revert to any previous state
700
+ - ✅ Progress is preserved
701
+
702
+ ### When to Commit Locally
703
+
704
+ **Commit locally whenever you:**
705
+ - ✅ Complete a task item (even if not fully tested)
706
+ - ✅ Finish implementing a feature (before full testing)
707
+ - ✅ Fix a bug or issue
708
+ - ✅ Update documentation
709
+ - ✅ Make significant progress
710
+ - ✅ Feel the need for a backup point
711
+ - ✅ Are about to try something risky
712
+ - ✅ Are switching to a different task
713
+
714
+ **Commit frequency:**
715
+ - **Minimum**: After completing each task item
716
+ - **Recommended**: Every 15-30 minutes of active work
717
+ - **Maximum**: As often as you feel necessary for safety
718
+
719
+ ### Local Commit Workflow
720
+
721
+ ```bash
722
+ # Quick local commit (backup)
723
+ git add .
724
+ git commit -m "wip: progress on task 1.2
725
+
726
+ - Implemented validation logic
727
+ - Still testing
728
+ - Backup commit"
729
+
730
+ # Or more descriptive
731
+ git add .
732
+ git commit -m "feat: add validation logic (WIP)
733
+
734
+ - Task 1.2 in progress
735
+ - Core validation implemented
736
+ - Tests pending
737
+ - Backup before continuing"
738
+ ```
739
+
740
+ ### Commit Message Format for Backup Commits
741
+
742
+ **For work-in-progress commits:**
743
+ ```bash
744
+ git commit -m "wip: <brief description>
745
+
746
+ - What was done
747
+ - Current status
748
+ - Next steps"
749
+ ```
750
+
751
+ **For completed task items:**
752
+ ```bash
753
+ git commit -m "feat: <feature description>
754
+
755
+ - Complete task X.Y: <task name>
756
+ - All tests passing
757
+ - Coverage verified
758
+ - Updated tasks.md"
759
+ ```
760
+
761
+ ## ⚠️ CRITICAL: Keep Remote Repository Updated
762
+
763
+ **MANDATORY**: Keep your remote repository synchronized with local work.
764
+
765
+ ### Check Remote Configuration
766
+
767
+ **First, check if remote is configured:**
768
+ ```bash
769
+ git remote -v
770
+ ```
771
+
772
+ **If you see output like:**
773
+ ```
774
+ origin https://github.com/user/repo.git (fetch)
775
+ origin https://github.com/user/repo.git (push)
776
+ ```
777
+ ✅ Remote is configured - proceed to push regularly
778
+
779
+ **If you see no output or error:**
780
+ ❌ No remote configured - see setup instructions below
781
+
782
+ ### Push to Remote Regularly
783
+
784
+ **After local commits, push to remote:**
785
+ ```bash
786
+ # Push current branch
787
+ git push origin <branch-name>
788
+
789
+ # Or push current branch (if tracking is set)
790
+ git push
791
+
792
+ # Push with tags
793
+ git push --tags
794
+ ```
795
+
796
+ **Recommended push frequency:**
797
+ - **Minimum**: After completing a task
798
+ - **Recommended**: After every 2-3 local commits
799
+ - **Maximum**: After every local commit (if working solo)
800
+
801
+ ### Remote Repository Setup
802
+
803
+ **If no remote repository is configured:**
804
+
805
+ #### Option 1: GitHub (Recommended)
806
+
807
+ 1. **Create repository on GitHub:**
808
+ - Go to https://github.com/new
809
+ - Create a new repository
810
+ - **DO NOT** initialize with README, .gitignore, or license (if you already have local repo)
811
+
812
+ 2. **Add remote and push:**
813
+ ```bash
814
+ # Add remote (replace with your repository URL)
815
+ git remote add origin https://github.com/username/repo-name.git
816
+
817
+ # Or using SSH
818
+ git remote add origin git@github.com:username/repo-name.git
819
+
820
+ # Push to remote
821
+ git push -u origin main
822
+ # Or 'master' if that's your default branch
823
+ ```
824
+
825
+ 3. **Verify:**
826
+ ```bash
827
+ git remote -v
828
+ git push
829
+ ```
830
+
831
+ **GitHub Setup Guide:**
832
+ - **Official Guide**: https://docs.github.com/en/get-started/quickstart/create-a-repo
833
+ - **Adding Remote**: https://docs.github.com/en/get-started/getting-started-with-git/managing-remote-repositories
834
+
835
+ #### Option 2: GitLab
836
+
837
+ 1. **Create repository on GitLab:**
838
+ - Go to https://gitlab.com/projects/new
839
+ - Create a new project
840
+ - **DO NOT** initialize with README (if you already have local repo)
841
+
842
+ 2. **Add remote and push:**
843
+ ```bash
844
+ git remote add origin https://gitlab.com/username/repo-name.git
845
+ git push -u origin main
846
+ ```
847
+
848
+ **GitLab Setup Guide:**
849
+ - **Official Guide**: https://docs.gitlab.com/ee/gitlab-basics/create-project.html
850
+
851
+ #### Option 3: Bitbucket
852
+
853
+ 1. **Create repository on Bitbucket:**
854
+ - Go to https://bitbucket.org/repo/create
855
+ - Create a new repository
856
+
857
+ 2. **Add remote and push:**
858
+ ```bash
859
+ git remote add origin https://bitbucket.org/username/repo-name.git
860
+ git push -u origin main
861
+ ```
862
+
863
+ **Bitbucket Setup Guide:**
864
+ - **Official Guide**: https://support.atlassian.com/bitbucket-cloud/docs/create-a-git-repository/
865
+
866
+ #### Option 4: Self-Hosted Git Server
867
+
868
+ **If using self-hosted Git server:**
869
+ ```bash
870
+ # Add remote
871
+ git remote add origin <your-git-server-url>
872
+
873
+ # Push
874
+ git push -u origin main
875
+ ```
876
+
877
+ ### Verify Remote is Working
878
+
879
+ **After setting up remote:**
880
+ ```bash
881
+ # Check remote configuration
882
+ git remote -v
883
+
884
+ # Test push
885
+ git push origin main
886
+
887
+ # If successful, you'll see:
888
+ # "Enumerating objects: X, done."
889
+ # "Writing objects: 100% (X/X), done."
890
+ ```
891
+
892
+ ### Troubleshooting Remote Issues
893
+
894
+ **Error: "remote origin already exists"**
895
+ ```bash
896
+ # Remove existing remote
897
+ git remote remove origin
898
+
899
+ # Add new remote
900
+ git remote add origin <new-url>
901
+ ```
902
+
903
+ **Error: "authentication failed"**
904
+ - Check your credentials
905
+ - Use SSH keys for better security
906
+ - See: https://docs.github.com/en/authentication/connecting-to-github-with-ssh
907
+
908
+ **Error: "repository not found"**
909
+ - Verify repository URL is correct
910
+ - Check you have access to the repository
911
+ - Ensure repository exists on remote server
912
+
913
+ ### Best Practices for Remote Sync
914
+
915
+ **DO's ✅:**
916
+ - ✅ Push to remote after completing tasks
917
+ - ✅ Push before switching branches
918
+ - ✅ Push before trying risky changes
919
+ - ✅ Push at end of work session
920
+ - ✅ Use descriptive commit messages
921
+ - ✅ Keep commits atomic (one logical change per commit)
922
+
923
+ **DON'Ts ❌:**
924
+ - ❌ Don't push broken code (test first)
925
+ - ❌ Don't push sensitive information (API keys, passwords)
926
+ - ❌ Don't force push to shared branches
927
+ - ❌ Don't skip pushing for extended periods
928
+ - ❌ Don't commit without meaningful messages
929
+
930
+ ### Automated Backup Reminder
931
+
932
+ **Set up reminders to push regularly:**
933
+ ```bash
934
+ # Add to your shell profile (.bashrc, .zshrc, etc.)
935
+ alias git-backup='git add . && git commit -m "backup: $(date +%Y-%m-%d\ %H:%M:%S)" && git push'
936
+
937
+ # Use: git-backup (quick backup and push)
938
+ ```
939
+
940
+ ### Summary: Backup and Remote Sync Workflow
941
+
942
+ **Complete workflow:**
943
+ 1. **Work locally** - Make changes
944
+ 2. **Test changes** - Ensure they work
945
+ 3. **Commit locally** - `git commit` (backup)
946
+ 4. **Update tasks.md** - Mark progress
947
+ 5. **Push to remote** - `git push` (if remote configured)
948
+ 6. **Continue work** - Next task
949
+
950
+ **If no remote:**
951
+ 1. **Set up remote** - Follow instructions above
952
+ 2. **Push initial code** - `git push -u origin main`
953
+ 3. **Continue regular pushes** - After each commit or task
954
+
955
+ ### Priority Order: Most Critical First
956
+
957
+ **ALWAYS follow this priority order when continuing implementation:**
958
+
959
+ 1. **Tests** (HIGHEST PRIORITY)
960
+ - Write tests for the feature
961
+ - Ensure all tests pass
962
+ - Verify test coverage meets thresholds
963
+
964
+ 2. **Coverage Verification** (CRITICAL)
965
+ - Run coverage check: `npm test -- --coverage`
966
+ - Fix any coverage gaps
967
+ - Ensure coverage thresholds are met
968
+
969
+ 3. **Update Task Status** (MANDATORY)
970
+ - Mark completed items as `[x]` in `tasks.md`
971
+ - Update task status if needed
972
+ - Document what was completed
973
+
974
+ 4. **Next Task** (Only after above steps)
975
+ - Move to next most critical task
976
+ - Follow same sequence
977
+
978
+ **Example Priority Order:**
979
+
980
+ ```markdown
981
+ ## Priority Order (Most Critical First)
982
+
983
+ ### 1. Testing (CRITICAL - Do First)
984
+ - [ ] 1.1 Write unit tests for core functionality
985
+ - [ ] 1.2 Write integration tests
986
+ - [ ] 1.3 Verify test coverage ≥ 95%
987
+
988
+ ### 2. Coverage Verification (CRITICAL - Do Second)
989
+ - [ ] 2.1 Run coverage check
990
+ - [ ] 2.2 Fix coverage gaps
991
+ - [ ] 2.3 Verify thresholds met
992
+
993
+ ### 3. Task Status Update (MANDATORY - Do Third)
994
+ - [ ] 3.1 Update tasks.md with completed items
995
+ - [ ] 3.2 Update task status
996
+ - [ ] 3.3 Document completion
997
+
998
+ ### 4. Next Implementation (Only After Above)
999
+ - [ ] 4.1 Move to next critical task
1000
+ - [ ] 4.2 Follow same sequence
1001
+ ```
1002
+
1003
+ ### Never Skip Steps
1004
+
1005
+ **CRITICAL RULES:**
1006
+ - ❌ NEVER proceed to next task without updating current task status
1007
+ - ❌ NEVER skip test coverage verification
1008
+ - ❌ NEVER mark tasks complete without tests passing
1009
+ - ❌ NEVER implement without creating task first
1010
+ - ✅ ALWAYS update task status before moving to next task
1011
+ - ✅ ALWAYS verify coverage before marking task complete
1012
+ - ✅ ALWAYS follow priority order (most critical first)
1013
+
1014
+ ### Task Status Tracking
1015
+
1016
+ **Track progress in `tasks.md`:**
1017
+
1018
+ ```markdown
1019
+ ## Progress Summary
1020
+ - Total tasks: 15
1021
+ - Completed: 8
1022
+ - In progress: 2
1023
+ - Pending: 5
1024
+ - Blocked: 0
1025
+
1026
+ ## Current Status
1027
+ - ✅ Implementation Phase: 80% complete (4/5 tasks)
1028
+ - ⏳ Testing Phase: 50% complete (2/4 tasks)
1029
+ - ⏸️ Documentation Phase: 0% complete (0/3 tasks)
1030
+ ```
1031
+
1032
+ ### Validation Before Committing
1033
+
1034
+ **BEFORE every commit, verify:**
1035
+ - [ ] All completed tasks are marked as `[x]` in `tasks.md`
1036
+ - [ ] Task status reflects current progress
1037
+ - [ ] No tasks are marked complete without implementation
1038
+ - [ ] All tests pass for completed tasks
1039
+ - [ ] Test coverage meets thresholds (run `npm test -- --coverage`)
1040
+ - [ ] Task status updated before moving to next task
1041
+ - [ ] Documentation is updated for completed features
1042
+
1043
+ ### Task Status Update Before Next Task
1044
+
1045
+ **CRITICAL RULE**: You MUST update task status in `tasks.md` BEFORE moving to the next task.
1046
+
1047
+ **Why:**
1048
+ - Prevents loss of progress tracking
1049
+ - Ensures context is preserved
1050
+ - Makes it easy to resume work
1051
+ - Provides clear progress visibility
1052
+
1053
+ **Workflow:**
1054
+ ```bash
1055
+ # 1. Complete current task item
1056
+ # ... implementation ...
1057
+
1058
+ # 2. Test and verify coverage
1059
+ npm test
1060
+ npm test -- --coverage
1061
+
1062
+ # 3. Update tasks.md IMMEDIATELY
1063
+ # Mark as [x] and add status comment
1064
+
1065
+ # 4. Verify update
1066
+ rulebook task show <task-id>
1067
+ # Confirm status is updated
1068
+
1069
+ # 5. ONLY THEN proceed to next task
1070
+ # Follow priority order (most critical first)
1071
+ ```
1072
+
1073
+ **Example:**
1074
+ ```markdown
1075
+ ## 1. Implementation Phase
1076
+ - [x] 1.1 Create task manager module <!-- tested, coverage: 95% -->
1077
+ - [x] 1.2 Add validation logic <!-- tested, coverage: 92%, status: complete -->
1078
+ - [ ] 1.3 Add archive functionality <!-- next: will start after status update -->
1079
+ ```
1080
+
1081
+ ## Task Archiving Workflow
1082
+
1083
+ **CRITICAL**: Archive tasks ONLY after full completion and validation.
1084
+
1085
+ ### When to Archive
1086
+
1087
+ **Archive a task when:**
1088
+ - ✅ All items in `tasks.md` are marked as `[x]`
1089
+ - ✅ All tests pass (unit, integration, E2E)
1090
+ - ✅ Code review is complete (if applicable)
1091
+ - ✅ Documentation is updated (README, CHANGELOG, specs)
1092
+ - ✅ Task format is validated (`rulebook task validate <task-id>`)
1093
+ - ✅ Spec deltas have been applied to main specifications
1094
+
1095
+ **NEVER archive a task that is:**
1096
+ - ❌ Partially complete
1097
+ - ❌ Missing tests
1098
+ - ❌ Failing validation
1099
+ - ❌ Missing documentation
1100
+
1101
+ ### Archive Process
1102
+
1103
+ **Step-by-step archive workflow:**
1104
+
1105
+ ```bash
1106
+ # 1. Verify all tasks are complete
1107
+ rulebook task show <task-id>
1108
+ # Check that all items in tasks.md are [x]
1109
+
1110
+ # 2. Run all quality checks
1111
+ npm test
1112
+ npm run lint
1113
+ npm run type-check
1114
+ npm run build
1115
+
1116
+ # 3. Validate task format
1117
+ rulebook task validate <task-id>
1118
+
1119
+ # 4. Update final documentation
1120
+ # - Update CHANGELOG.md
1121
+ # - Update README.md if needed
1122
+ # - Update any affected documentation
1123
+
1124
+ # 5. Archive the task
1125
+ rulebook task archive <task-id>
1126
+
1127
+ # 6. Verify archive
1128
+ rulebook task list --archived
1129
+ # Task should appear in archived list
1130
+ ```
1131
+
1132
+ ### Post-Archive Actions
1133
+
1134
+ **After archiving, ensure:**
1135
+ - ✅ Spec deltas are applied to main specifications
1136
+ - ✅ CHANGELOG.md is updated with the change
1137
+ - ✅ Any breaking changes are documented
1138
+ - ✅ Migration guides are created (if needed)
1139
+ - ✅ Related tasks are unblocked (if any)
1140
+
1141
+ ### Archive Location
1142
+
1143
+ **Archived tasks are moved to:**
1144
+ ```
1145
+ /.rulebook/tasks/archive/YYYY-MM-DD-<task-id>/
1146
+ ```
1147
+
1148
+ **Structure:**
1149
+ ```
1150
+ /.rulebook/tasks/archive/2025-11-13-add-auth/
1151
+ ├── proposal.md
1152
+ ├── tasks.md # All items marked [x]
1153
+ ├── design.md
1154
+ └── specs/
1155
+ └── core/
1156
+ └── spec.md
1157
+ ```
1158
+
1159
+ ## Task Creation Best Practices
1160
+
1161
+ ### Task ID Naming
1162
+
1163
+ **Use verb-led kebab-case:**
1164
+ - ✅ `add-user-authentication`
1165
+ - ✅ `refactor-task-manager`
1166
+ - ✅ `update-api-validation`
1167
+ - ✅ `remove-legacy-code`
1168
+ - ❌ `user-auth` (not descriptive)
1169
+ - ❌ `task_manager` (use kebab-case)
1170
+ - ❌ `new-feature` (too generic)
1171
+
1172
+ ### Task Scope
1173
+
1174
+ **One capability per task:**
1175
+ - ✅ Good: `add-email-notifications`
1176
+ - ❌ Bad: `add-email-notifications-and-sms-and-push` (too broad)
1177
+
1178
+ **Break large tasks into smaller ones:**
1179
+ - ✅ `add-email-notifications`
1180
+ - ✅ `add-sms-notifications`
1181
+ - ✅ `add-push-notifications`
1182
+
1183
+ ### Task Checklist Structure
1184
+
1185
+ **Organize tasks by phase:**
1186
+
1187
+ ```markdown
1188
+ ## 1. Planning & Design
1189
+ - [ ] 1.1 Research existing solutions
1190
+ - [ ] 1.2 Design architecture
1191
+ - [ ] 1.3 Create technical spec
1192
+
1193
+ ## 2. Implementation
1194
+ - [ ] 2.1 Create core module
1195
+ - [ ] 2.2 Add validation logic
1196
+ - [ ] 2.3 Integrate with existing system
1197
+
1198
+ ## 3. Testing
1199
+ - [ ] 3.1 Write unit tests
1200
+ - [ ] 3.2 Write integration tests
1201
+ - [ ] 3.3 Test edge cases
1202
+
1203
+ ## 4. Documentation
1204
+ - [ ] 4.1 Update README
1205
+ - [ ] 4.2 Update CHANGELOG
1206
+ - [ ] 4.3 Add code comments
1207
+
1208
+ ## 5. Cleanup
1209
+ - [ ] 5.1 Remove debug code
1210
+ - [ ] 5.2 Remove unused imports
1211
+ - [ ] 5.3 Final code review
1212
+ ```
1213
+
1214
+ ## Continuous Task Updates
1215
+
1216
+ **CRITICAL**: Update `tasks.md` continuously, not just at the end.
1217
+
1218
+ ### Real-Time Updates
1219
+
1220
+ **Update as you work:**
1221
+ 1. **Start task**: Mark as `[ ]` (if not already)
1222
+ 2. **Begin implementation**: Add comment `<!-- in progress -->`
1223
+ 3. **Complete implementation**: Mark as `[x]`
1224
+ 4. **Test passes**: Add comment `<!-- tested -->`
1225
+ 5. **Ready for review**: Add comment `<!-- ready for review -->`
1226
+
1227
+ **Example:**
1228
+ ```markdown
1229
+ ## 1. Implementation
1230
+ - [x] 1.1 Create task manager module <!-- tested -->
1231
+ - [x] 1.2 Add validation logic <!-- tested, ready for review -->
1232
+ - [ ] 1.3 Add archive functionality <!-- in progress -->
1233
+ ```
1234
+
1235
+ ### Progress Tracking
1236
+
1237
+ **Add progress indicators:**
1238
+ ```markdown
1239
+ ## Progress: 60% (9/15 tasks complete)
1240
+
1241
+ ## 1. Implementation Phase: 100% ✅
1242
+ - [x] 1.1 Task 1
1243
+ - [x] 1.2 Task 2
1244
+ - [x] 1.3 Task 3
1245
+
1246
+ ## 2. Testing Phase: 50% ⏳
1247
+ - [x] 2.1 Unit tests
1248
+ - [x] 2.2 Integration tests
1249
+ - [ ] 2.3 E2E tests
1250
+
1251
+ ## 3. Documentation Phase: 0% ⏸️
1252
+ - [ ] 3.1 README
1253
+ - [ ] 3.2 CHANGELOG
1254
+ - [ ] 3.3 API docs
1255
+ ```
1256
+
1257
+ ## Task Validation Before Archive
1258
+
1259
+ **MANDATORY checks before archiving:**
1260
+
1261
+ ```bash
1262
+ # 1. Format validation
1263
+ rulebook task validate <task-id>
1264
+ # Must pass all format checks
1265
+
1266
+ # 2. Completion check
1267
+ # All items in tasks.md must be [x]
1268
+
1269
+ # 3. Test coverage
1270
+ npm test -- --coverage
1271
+ # Must meet coverage thresholds
1272
+
1273
+ # 4. Code quality
1274
+ npm run lint
1275
+ npm run type-check
1276
+ # Must pass all checks
1277
+
1278
+ # 5. Build verification
1279
+ npm run build
1280
+ # Must build successfully
1281
+ ```
1282
+
1283
+ ## Summary: Task Lifecycle
1284
+
1285
+ **Complete task lifecycle:**
1286
+
1287
+ 1. **Create** (MANDATORY FIRST STEP): `rulebook task create <task-id>`
1288
+ - ⚠️ NEVER start implementation without creating task first
1289
+ - ⚠️ Tasks without registration can be lost in context
1290
+
1291
+ 2. **Plan**: Write proposal.md and tasks.md
1292
+ - Define why, what, and how
1293
+ - Create implementation checklist
1294
+
1295
+ 3. **Design**: Write design.md (if needed)
1296
+ - Technical decisions
1297
+ - Architecture choices
1298
+
1299
+ 4. **Spec**: Write spec deltas in specs/
1300
+ - OpenSpec-compatible format
1301
+ - Requirements with SHALL/MUST
1302
+
1303
+ 5. **Validate**: `rulebook task validate <task-id>`
1304
+ - Format validation
1305
+ - Structure verification
1306
+
1307
+ 6. **Implement**: Write code, following priority order
1308
+ - Most critical tasks first
1309
+ - Update tasks.md as you go
1310
+
1311
+ 7. **Test** (HIGHEST PRIORITY): Write tests, verify coverage
1312
+ - All tests must pass
1313
+ - Coverage must meet thresholds
1314
+ - Mark tested items in tasks.md
1315
+
1316
+ 8. **Update Status** (MANDATORY): Update task status before next task
1317
+ - Mark completed items as `[x]`
1318
+ - Update status in tasks.md
1319
+ - Verify status update
1320
+
1321
+ 9. **Document**: Update docs, mark in tasks.md
1322
+ - README, CHANGELOG, specs
1323
+
1324
+ 10. **Validate**: Final validation before archive
1325
+ - All checks pass
1326
+ - Coverage verified
1327
+
1328
+ 11. **Archive**: `rulebook task archive <task-id>`
1329
+ - Move to archive
1330
+ - Apply spec deltas
1331
+
1332
+ **CRITICAL REMINDERS:**
1333
+ - ⚠️ **ALWAYS create task BEFORE implementation** - without registration, tasks can be lost
1334
+ - ⚠️ **ALWAYS follow priority order** - most critical first (tests, coverage, status update)
1335
+ - ⚠️ **ALWAYS update task status before next task** - prevents context loss
1336
+ - ⚠️ **ALWAYS verify coverage** - run `npm test -- --coverage` before marking complete
1337
+ - ⚠️ **ALWAYS commit locally frequently** - even for backup, prevents work loss
1338
+ - ⚠️ **ALWAYS keep remote repository updated** - push regularly if remote is configured
1339
+ - ⚠️ **ALWAYS update `tasks.md` at EVERY step**, not just at the end!
1340
+
1341
+ ## Best Practices
1342
+
1343
+ ### DO's ✅
1344
+
1345
+ - **ALWAYS** create task BEFORE implementing any feature
1346
+ - **ALWAYS** check Context7 MCP before creating tasks
1347
+ - **ALWAYS** validate task format before committing
1348
+ - **ALWAYS** use SHALL/MUST in requirements
1349
+ - **ALWAYS** use 4 hashtags for scenarios
1350
+ - **ALWAYS** use Given/When/Then structure
1351
+ - **ALWAYS** follow priority order (most critical first)
1352
+ - **ALWAYS** write tests first (highest priority)
1353
+ - **ALWAYS** verify test coverage before marking complete
1354
+ - **ALWAYS** commit locally frequently (even for backup)
1355
+ - **ALWAYS** keep remote repository updated (push regularly)
1356
+ - **ALWAYS** update task status before moving to next task
1357
+ - **ALWAYS** update task status during implementation
1358
+ - **ALWAYS** archive completed tasks
1359
+ - **ALWAYS** document breaking changes in proposal
1360
+
1361
+ ### DON'Ts ❌
1362
+
1363
+ - **NEVER** start implementation without creating task first
1364
+ - **NEVER** skip task registration (tasks can be lost in context)
1365
+ - **NEVER** proceed to next task without updating current task status
1366
+ - **NEVER** skip test coverage verification
1367
+ - **NEVER** mark tasks complete without tests passing
1368
+ - **NEVER** skip local commits (commit frequently for backup)
1369
+ - **NEVER** let remote repository get out of sync (push regularly)
1370
+ - **NEVER** commit sensitive information (API keys, passwords)
1371
+ - **NEVER** force push to shared branches
1372
+ - **NEVER** create tasks without checking Context7 format
1373
+ - **NEVER** use 3 hashtags for scenarios
1374
+ - **NEVER** omit SHALL/MUST from requirements
1375
+ - **NEVER** use bullet points for scenarios
1376
+ - **NEVER** skip validation
1377
+ - **NEVER** leave tasks unarchived after completion
1378
+ - **NEVER** mix formats (stick to OpenSpec-compatible format)
1379
+ - **NEVER** ignore priority order (always do most critical first)
1380
+
1381
+ ## CLI Commands Reference
1382
+
1383
+ ### Task Management Commands
1384
+
1385
+ #### `rulebook task create <task-id>`
1386
+
1387
+ Create a new Rulebook task with OpenSpec-compatible format.
1388
+
1389
+ **Usage:**
1390
+ ```bash
1391
+ rulebook task create add-user-authentication
1392
+ ```
1393
+
1394
+ **What it does:**
1395
+ - Creates `/.rulebook/tasks/<task-id>/` directory
1396
+ - Generates `proposal.md` template
1397
+ - Generates `tasks.md` template
1398
+ - Creates `specs/` directory for spec deltas
1399
+
1400
+ **Requirements:**
1401
+ - Task ID must be unique (verb-led kebab-case)
1402
+ - Context7 MCP must be available (for format validation)
1403
+
1404
+ **Example:**
1405
+ ```bash
1406
+ $ rulebook task create add-email-notifications
1407
+ ✅ Task add-email-notifications created successfully
1408
+ Location: .rulebook/tasks/add-email-notifications/
1409
+
1410
+ ⚠️ Remember to:
1411
+ 1. Check Context7 MCP for OpenSpec format requirements
1412
+ 2. Fill in proposal.md (minimum 20 characters in "Why" section)
1413
+ 3. Add tasks to tasks.md
1414
+ 4. Create spec deltas in specs/*/spec.md
1415
+ 5. Validate with: rulebook task validate add-email-notifications
1416
+ ```
1417
+
1418
+ **Error Handling:**
1419
+ - `Task <task-id> already exists`: Choose a different task ID or archive existing task
1420
+
1421
+ ---
1422
+
1423
+ #### `rulebook task list [--archived]`
1424
+
1425
+ List all Rulebook tasks (active and optionally archived).
1426
+
1427
+ **Usage:**
1428
+ ```bash
1429
+ # List active tasks only
1430
+ rulebook task list
1431
+
1432
+ # List including archived tasks
1433
+ rulebook task list --archived
1434
+ ```
1435
+
1436
+ **Output:**
1437
+ - Active tasks with status (pending, in-progress, completed, blocked)
1438
+ - Archived tasks with archive date (if --archived flag is used)
1439
+
1440
+ **Example:**
1441
+ ```bash
1442
+ $ rulebook task list
1443
+
1444
+ 📋 Rulebook Tasks
1445
+
1446
+ Active Tasks:
1447
+ pending add-user-authentication - Add user authentication feature
1448
+ in-progress refactor-api-validation - Refactor API validation logic
1449
+ completed update-documentation - Update project documentation
1450
+
1451
+ $ rulebook task list --archived
1452
+
1453
+ 📋 Rulebook Tasks
1454
+
1455
+ Active Tasks:
1456
+ pending add-user-authentication - Add user authentication feature
1457
+
1458
+ Archived Tasks:
1459
+ archived 2025-01-15-add-email-notifications - Add email notifications (2025-01-15)
1460
+ ```
1461
+
1462
+ **Task Status Values:**
1463
+ - `pending`: Task not started
1464
+ - `in-progress`: Task being worked on
1465
+ - `completed`: Task finished (ready for archive)
1466
+ - `blocked`: Task blocked by dependency
1467
+
1468
+ ---
1469
+
1470
+ #### `rulebook task show <task-id>`
1471
+
1472
+ Show detailed information about a specific task.
1473
+
1474
+ **Usage:**
1475
+ ```bash
1476
+ rulebook task show add-user-authentication
1477
+ ```
1478
+
1479
+ **Output:**
1480
+ - Task ID and title
1481
+ - Status (pending, in-progress, completed, blocked)
1482
+ - Created and updated dates
1483
+ - Archive date (if archived)
1484
+ - Proposal summary (first 500 characters)
1485
+ - Spec files list
1486
+
1487
+ **Example:**
1488
+ ```bash
1489
+ $ rulebook task show add-user-authentication
1490
+
1491
+ 📋 Task: add-user-authentication
1492
+
1493
+ Title: add-user-authentication
1494
+ Status: pending
1495
+ Created: 2025-01-15T10:30:00.000Z
1496
+ Updated: 2025-01-15T10:30:00.000Z
1497
+
1498
+ Proposal:
1499
+ # Proposal: Add User Authentication
1500
+
1501
+ ## Why
1502
+ We need to implement secure user authentication to protect user accounts and enable personalized features. This will include JWT token-based authentication with refresh tokens and password hashing using bcrypt...
1503
+
1504
+ Specs:
1505
+ core/spec.md (1234 chars)
1506
+ ```
1507
+
1508
+ **Error Handling:**
1509
+ - `Task <task-id> not found`: Verify task ID exists with `rulebook task list`
1510
+
1511
+ ---
1512
+
1513
+ #### `rulebook task validate <task-id>`
1514
+
1515
+ Validate task format against OpenSpec-compatible requirements.
1516
+
1517
+ **Usage:**
1518
+ ```bash
1519
+ rulebook task validate add-user-authentication
1520
+ ```
1521
+
1522
+ **Validation Checks:**
1523
+ - Purpose section length (≥20 characters)
1524
+ - Requirement keywords (SHALL/MUST)
1525
+ - Scenario format (4 hashtags, not 3)
1526
+ - Given/When/Then structure
1527
+ - Delta headers format (ADDED/MODIFIED/REMOVED/RENAMED)
1528
+
1529
+ **Example:**
1530
+ ```bash
1531
+ $ rulebook task validate add-user-authentication
1532
+ ✅ Task add-user-authentication is valid
1533
+
1534
+ ⚠️ Warnings:
1535
+ - Scenario in core/spec.md should use Given/When/Then structure
1536
+ ```
1537
+
1538
+ **Error Example:**
1539
+ ```bash
1540
+ $ rulebook task validate invalid-task
1541
+ ❌ Task invalid-task validation failed
1542
+
1543
+ Errors:
1544
+ - Scenarios in core/spec.md must use 4 hashtags (####), not 3 (###)
1545
+ - Requirement in core/spec.md missing SHALL or MUST keyword: ### Requirement: Auth
1546
+ - Purpose section (## Why) must have at least 20 characters
1547
+ ```
1548
+
1549
+ **Error Handling:**
1550
+ - Fix all errors before proceeding
1551
+ - Warnings are informational but don't block archiving
1552
+
1553
+ ---
1554
+
1555
+ #### `rulebook task archive <task-id> [--skip-validation]`
1556
+
1557
+ Archive a completed task and apply spec deltas to main specifications.
1558
+
1559
+ **Usage:**
1560
+ ```bash
1561
+ # Archive with validation (recommended)
1562
+ rulebook task archive add-user-authentication
1563
+
1564
+ # Archive without validation (use with caution)
1565
+ rulebook task archive add-user-authentication --skip-validation
1566
+ ```
1567
+
1568
+ **Archive Process:**
1569
+ 1. Validates task format (unless `--skip-validation` is used)
1570
+ 2. Checks task completion status
1571
+ 3. Applies spec deltas to main specifications
1572
+ 4. Moves task to `/.rulebook/tasks/archive/YYYY-MM-DD-<task-id>/`
1573
+ 5. Updates related specifications
1574
+
1575
+ **Example:**
1576
+ ```bash
1577
+ $ rulebook task archive add-user-authentication
1578
+ ✅ Task add-user-authentication archived successfully
1579
+ ```
1580
+
1581
+ **Error Handling:**
1582
+ - `Task validation failed`: Fix validation errors before archiving
1583
+ - `Task <task-id> not found`: Verify task ID exists
1584
+ - `Archive <archive-name> already exists`: Archive with that date already exists
1585
+
1586
+ **Important:**
1587
+ - Only archive tasks that are fully completed
1588
+ - All items in `tasks.md` should be marked as `[x]`
1589
+ - All tests should pass
1590
+ - Documentation should be updated
1591
+
1592
+ ---
1593
+
1594
+ ### Core Rulebook Commands
1595
+
1596
+ #### `rulebook init [--minimal] [--light] [--yes]`
1597
+
1598
+ Initialize Rulebook for current project.
1599
+
1600
+ **Usage:**
1601
+ ```bash
1602
+ # Interactive mode
1603
+ rulebook init
1604
+
1605
+ # Minimal setup (essentials only)
1606
+ rulebook init --minimal
1607
+
1608
+ # Light mode (no quality enforcement)
1609
+ rulebook init --light
1610
+
1611
+ # Skip prompts, use defaults
1612
+ rulebook init --yes
1613
+ ```
1614
+
1615
+ **What it does:**
1616
+ - Detects languages, frameworks, and MCP modules
1617
+ - Generates AGENTS.md with AI assistant rules
1618
+ - Creates `/rulebook/` directory with templates
1619
+ - Creates/updates `.gitignore` automatically
1620
+ - Optionally installs Git hooks
1621
+ - Generates Cursor commands (if Cursor is selected IDE)
1622
+
1623
+ ---
1624
+
1625
+ #### `rulebook update [--yes] [--minimal] [--light]`
1626
+
1627
+ Update AGENTS.md and .rulebook to latest version.
1628
+
1629
+ **Usage:**
1630
+ ```bash
1631
+ # Interactive mode
1632
+ rulebook update
1633
+
1634
+ # Skip confirmation
1635
+ rulebook update --yes
1636
+
1637
+ # Minimal mode
1638
+ rulebook update --minimal
1639
+
1640
+ # Light mode
1641
+ rulebook update --light
1642
+ ```
1643
+
1644
+ **What it does:**
1645
+ - Migrates OpenSpec tasks to Rulebook format (if OpenSpec exists)
1646
+ - Migrates OpenSpec archives to Rulebook format
1647
+ - Removes OpenSpec commands from `.cursor/commands/`
1648
+ - Updates AGENTS.md with latest templates
1649
+ - Merges templates while preserving customizations
1650
+ - Updates Cursor commands (if Cursor is selected IDE)
1651
+
1652
+ ---
1653
+
1654
+ #### `rulebook validate`
1655
+
1656
+ Validate project structure against Rulebook standards.
1657
+
1658
+ **Usage:**
1659
+ ```bash
1660
+ rulebook validate
1661
+ ```
1662
+
1663
+ **Validation Checks:**
1664
+ - AGENTS.md presence and format
1665
+ - Rulebook directory structure
1666
+ - Documentation structure
1667
+ - Tests directory
1668
+ - Score calculation (0-100)
1669
+
1670
+ ---
1671
+
1672
+ #### `rulebook health`
1673
+
1674
+ Check project health score.
1675
+
1676
+ **Usage:**
1677
+ ```bash
1678
+ rulebook health
1679
+ ```
1680
+
1681
+ **Categories Scored:**
1682
+ - Quality (linting, formatting, code quality)
1683
+ - Testing (test coverage, test quality)
1684
+ - Security (vulnerabilities, secrets)
1685
+ - Documentation (README, docs/, comments)
1686
+
1687
+ **Score Range:** 0-100
1688
+
1689
+ ---
1690
+
1691
+ #### `rulebook workflows`
1692
+
1693
+ Generate GitHub Actions workflows for detected languages.
1694
+
1695
+ **Usage:**
1696
+ ```bash
1697
+ rulebook workflows
1698
+ ```
1699
+
1700
+ **What it does:**
1701
+ - Creates `.github/workflows/` directory
1702
+ - Generates language-specific workflows (test, lint, publish)
1703
+ - Adds codespell workflow for spelling checks
1704
+
1705
+ ---
1706
+
1707
+ #### `rulebook check-deps`
1708
+
1709
+ Check for outdated and vulnerable dependencies.
1710
+
1711
+ **Usage:**
1712
+ ```bash
1713
+ rulebook check-deps
1714
+ ```
1715
+
1716
+ **Supported Package Managers:**
1717
+ - npm (package.json)
1718
+ - Cargo (Cargo.toml)
1719
+ - pip (requirements.txt, pyproject.toml)
1720
+ - Go modules (go.mod)
1721
+
1722
+ ---
1723
+
1724
+ #### `rulebook check-coverage [-t <threshold>]`
1725
+
1726
+ Check test coverage against threshold.
1727
+
1728
+ **Usage:**
1729
+ ```bash
1730
+ # Default threshold (95%)
1731
+ rulebook check-coverage
1732
+
1733
+ # Custom threshold
1734
+ rulebook check-coverage -t 80
1735
+ ```
1736
+
1737
+ ---
1738
+
1739
+ #### `rulebook generate-docs [--yes]`
1740
+
1741
+ Generate documentation structure and standard files.
1742
+
1743
+ **Usage:**
1744
+ ```bash
1745
+ # Interactive mode
1746
+ rulebook generate-docs
1747
+
1748
+ # Skip prompts
1749
+ rulebook generate-docs --yes
1750
+ ```
1751
+
1752
+ ---
1753
+
1754
+ #### `rulebook version <major|minor|patch>`
1755
+
1756
+ Bump project version (semantic versioning).
1757
+
1758
+ **Usage:**
1759
+ ```bash
1760
+ rulebook version major # 1.0.0 -> 2.0.0
1761
+ rulebook version minor # 1.0.0 -> 1.1.0
1762
+ rulebook version patch # 1.0.0 -> 1.0.1
1763
+ ```
1764
+
1765
+ ---
1766
+
1767
+ #### `rulebook changelog [-v <version>]`
1768
+
1769
+ Generate changelog from git commits.
1770
+
1771
+ **Usage:**
1772
+ ```bash
1773
+ # Auto-detect version
1774
+ rulebook changelog
1775
+
1776
+ # Specify version
1777
+ rulebook changelog -v 1.0.0
1778
+ ```
1779
+
1780
+ ---
1781
+
1782
+ #### `rulebook fix`
1783
+
1784
+ Auto-fix common project issues.
1785
+
1786
+ **Usage:**
1787
+ ```bash
1788
+ rulebook fix
1789
+ ```
1790
+
1791
+ ---
1792
+
1793
+ ### Advanced Commands (Beta)
1794
+
1795
+ #### `rulebook watcher`
1796
+
1797
+ Start modern full-screen console watcher for task progress.
1798
+
1799
+ **Usage:**
1800
+ ```bash
1801
+ rulebook watcher
1802
+ ```
1803
+
1804
+ **Features:**
1805
+ - Live task progress tracking
1806
+ - Activity log with timestamps
1807
+ - System status monitoring
1808
+ - Auto-refresh every 2 seconds
1809
+
1810
+ ---
1811
+
1812
+ #### `rulebook agent [--dry-run] [--tool <name>] [--iterations <n>] [--watch]`
1813
+
1814
+ Start autonomous agent for managing AI CLI workflows.
1815
+
1816
+ **Usage:**
1817
+ ```bash
1818
+ # Dry run (simulate without changes)
1819
+ rulebook agent --dry-run
1820
+
1821
+ # Specify CLI tool
1822
+ rulebook agent --tool cursor-agent
1823
+
1824
+ # Set max iterations
1825
+ rulebook agent --iterations 10
1826
+
1827
+ # Enable watcher mode
1828
+ rulebook agent --watch
1829
+ ```
1830
+
1831
+ ---
1832
+
1833
+ #### `rulebook config [--show] [--set <key=value>] [--feature <name> --enable|--disable]`
1834
+
1835
+ Manage Rulebook configuration.
1836
+
1837
+ **Usage:**
1838
+ ```bash
1839
+ # Show current config
1840
+ rulebook config --show
1841
+
1842
+ # Set config value
1843
+ rulebook config --set rulebookDir=custom-rulebook
1844
+
1845
+ # Enable feature
1846
+ rulebook config --feature watcher --enable
1847
+
1848
+ # Disable feature
1849
+ rulebook config --feature agent --disable
1850
+ ```
1851
+
1852
+ ## Migration from OpenSpec
1853
+
1854
+ If your project previously used OpenSpec:
1855
+
1856
+ 1. **Automatic Migration**: Run `rulebook update` to automatically migrate OpenSpec tasks to Rulebook format
1857
+ 2. **Manual Migration**: Tasks in `/openspec/changes/` will be moved to `/.rulebook/tasks/`
1858
+ 3. **Format Compatibility**: Rulebook uses OpenSpec-compatible format, so existing tasks remain valid
1859
+
1860
+ ## Context7 MCP Requirement
1861
+
1862
+ **CRITICAL**: Context7 MCP is REQUIRED for task creation.
1863
+
1864
+ **Why**:
1865
+ - Ensures correct format by fetching official OpenSpec documentation
1866
+ - Prevents common format errors made by AI assistants
1867
+ - Provides up-to-date format requirements
1868
+
1869
+ **If Context7 MCP is not available:**
1870
+ - Task creation will fail with clear error message
1871
+ - You must configure Context7 MCP before creating tasks
1872
+ - See `/rulebook/CONTEXT7.md` for setup instructions
1873
+
1874
+ ## Troubleshooting
1875
+
1876
+ ### Validation Errors
1877
+
1878
+ **Error**: "Requirement must contain SHALL or MUST keyword"
1879
+ - **Fix**: Add SHALL or MUST to requirement text
1880
+ - **Example**: Change "The system provides authentication" to "The system SHALL provide authentication"
1881
+
1882
+ **Error**: "Scenario must use 4 hashtags"
1883
+ - **Fix**: Change `### Scenario:` to `#### Scenario:` (at start of line)
1884
+ - **Note**: Validation only checks headers at start of line, not in text content
1885
+
1886
+ **Error**: "Purpose section too short"
1887
+ - **Fix**: Expand "Why" section in proposal.md to at least 20 characters
1888
+ - **Example**: "Auth system" → "Authentication system for secure user access with JWT tokens and session management"
1889
+
1890
+ **Error**: "Scenario must use Given/When/Then structure"
1891
+ - **Fix**: Replace bullet points with Given/When/Then format
1892
+ - **Example**:
1893
+ ```markdown
1894
+ #### Scenario: User login
1895
+ Given a user has valid credentials
1896
+ When they submit the login form
1897
+ Then they are authenticated successfully
1898
+ ```
1899
+
1900
+ ### Task Creation Errors
1901
+
1902
+ **Error**: "Context7 MCP not available"
1903
+ - **Fix**: Configure Context7 MCP in your MCP configuration file
1904
+ - **See**: `/rulebook/CONTEXT7.md` for setup instructions
1905
+
1906
+ **Error**: "Task ID already exists"
1907
+ - **Fix**: Choose a different task ID or archive existing task
1908
+ - **Check**: Use `rulebook task list` to see existing tasks
1909
+
1910
+ ### Task Archive Errors
1911
+
1912
+ **Error**: "Task validation failed"
1913
+ - **Fix**: Run `rulebook task validate <task-id>` to see all errors
1914
+ - **Fix**: Address all validation errors before archiving
1915
+ - **Option**: Use `--skip-validation` flag only if you're certain the task is valid
1916
+
1917
+ **Error**: "Archive <archive-name> already exists"
1918
+ - **Fix**: Archive with that date already exists
1919
+ - **Check**: Use `rulebook task list --archived` to see archived tasks
1920
+
1921
+ ### Command Errors
1922
+
1923
+ **Error**: "Task <task-id> not found"
1924
+ - **Fix**: Verify task ID exists with `rulebook task list`
1925
+ - **Check**: Ensure you're in the correct project directory
1926
+
1927
+ **Error**: "No tasks found"
1928
+ - **Fix**: Create a task first with `rulebook task create <task-id>`
1929
+ - **Check**: Verify `/.rulebook/tasks/` directory exists
1930
+
1931
+ ### Migration Errors
1932
+
1933
+ **Error**: "Failed to migrate task"
1934
+ - **Fix**: Check error message for specific issue
1935
+ - **Check**: Verify OpenSpec task structure is correct
1936
+ - **Fix**: Manually migrate if automatic migration fails
1937
+
1938
+ **Error**: "Failed to read OpenSpec changes directory"
1939
+ - **Fix**: Verify `/openspec/changes/` directory exists
1940
+ - **Check**: Ensure you have read permissions
1941
+
1942
+ ## Examples
1943
+
1944
+ See `/.rulebook/tasks/` directory for examples of correctly formatted tasks.
1945
+
1946
+ <!-- RULEBOOK:END -->
1947
+