@hivehub/rulebook 4.0.0 → 4.2.0

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