@hivehub/rulebook 4.2.2 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) 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 +15 -1
  19. package/dist/cli/commands.d.ts.map +1 -1
  20. package/dist/cli/commands.js +43 -18
  21. package/dist/cli/commands.js.map +1 -1
  22. package/dist/core/claude-mcp.d.ts +10 -2
  23. package/dist/core/claude-mcp.d.ts.map +1 -1
  24. package/dist/core/claude-mcp.js +48 -9
  25. package/dist/core/claude-mcp.js.map +1 -1
  26. package/dist/core/config-manager.d.ts.map +1 -1
  27. package/dist/core/config-manager.js +1 -2
  28. package/dist/core/config-manager.js.map +1 -1
  29. package/dist/core/generator.d.ts +13 -0
  30. package/dist/core/generator.d.ts.map +1 -1
  31. package/dist/core/generator.js +283 -28
  32. package/dist/core/generator.js.map +1 -1
  33. package/dist/core/indexer/background-indexer.d.ts.map +1 -1
  34. package/dist/core/indexer/background-indexer.js +10 -3
  35. package/dist/core/indexer/background-indexer.js.map +1 -1
  36. package/dist/core/workspace/workspace-manager.d.ts.map +1 -1
  37. package/dist/core/workspace/workspace-manager.js +2 -6
  38. package/dist/core/workspace/workspace-manager.js.map +1 -1
  39. package/dist/index.js +1 -3
  40. package/dist/index.js.map +1 -1
  41. package/dist/mcp/rulebook-server.d.ts.map +1 -1
  42. package/dist/mcp/rulebook-server.js +23 -10
  43. package/dist/mcp/rulebook-server.js.map +1 -1
  44. package/package.json +21 -22
  45. package/templates/agents/accessibility-reviewer.md +43 -0
  46. package/templates/agents/api-designer.md +42 -0
  47. package/templates/agents/architect.md +51 -0
  48. package/templates/agents/build-engineer.md +36 -0
  49. package/templates/agents/code-reviewer.md +47 -0
  50. package/templates/agents/database-architect.md +41 -0
  51. package/templates/agents/devops-engineer.md +42 -0
  52. package/templates/agents/docs-writer.md +38 -0
  53. package/templates/agents/i18n-engineer.md +42 -0
  54. package/templates/agents/implementer.md +38 -35
  55. package/templates/agents/migration-engineer.md +42 -0
  56. package/templates/agents/performance-engineer.md +49 -0
  57. package/templates/agents/refactoring-agent.md +41 -0
  58. package/templates/agents/researcher.md +38 -34
  59. package/templates/agents/security-reviewer.md +40 -0
  60. package/templates/agents/team-lead.md +37 -34
  61. package/templates/agents/tester.md +45 -42
  62. package/templates/agents/ux-reviewer.md +43 -0
  63. package/templates/ci/rulebook-review.yml +26 -26
  64. package/templates/cli/AIDER.md +49 -49
  65. package/templates/cli/AMAZON_Q.md +25 -25
  66. package/templates/cli/AUGGIE.md +32 -32
  67. package/templates/cli/CLAUDE.md +117 -117
  68. package/templates/cli/CLINE.md +99 -99
  69. package/templates/cli/CODEBUDDY.md +20 -20
  70. package/templates/cli/CODEIUM.md +20 -20
  71. package/templates/cli/CODEX.md +21 -21
  72. package/templates/cli/CONTINUE.md +34 -34
  73. package/templates/cli/CURSOR_CLI.md +62 -62
  74. package/templates/cli/FACTORY.md +18 -18
  75. package/templates/cli/GEMINI.md +35 -35
  76. package/templates/cli/KILOCODE.md +18 -18
  77. package/templates/cli/OPENCODE.md +18 -18
  78. package/templates/cli/_GENERIC_TEMPLATE.md +29 -29
  79. package/templates/commands/rulebook-memory-save.md +48 -48
  80. package/templates/commands/rulebook-memory-search.md +47 -47
  81. package/templates/commands/rulebook-task-apply.md +67 -67
  82. package/templates/commands/rulebook-task-archive.md +94 -94
  83. package/templates/commands/rulebook-task-create.md +93 -93
  84. package/templates/commands/rulebook-task-list.md +42 -42
  85. package/templates/commands/rulebook-task-show.md +52 -52
  86. package/templates/commands/rulebook-task-validate.md +53 -53
  87. package/templates/core/AGENTS_LEAN.md +25 -25
  88. package/templates/core/AGENTS_OVERRIDE.md +16 -16
  89. package/templates/core/AGENT_AUTOMATION.md +288 -288
  90. package/templates/core/DAG.md +304 -304
  91. package/templates/core/DOCUMENTATION_RULES.md +36 -36
  92. package/templates/core/MULTI_AGENT.md +74 -74
  93. package/templates/core/PLANS.md +28 -28
  94. package/templates/core/QUALITY_ENFORCEMENT.md +68 -68
  95. package/templates/core/RALPH.md +471 -471
  96. package/templates/core/RULEBOOK.md +1935 -1935
  97. package/templates/frameworks/ANGULAR.md +36 -36
  98. package/templates/frameworks/DJANGO.md +83 -83
  99. package/templates/frameworks/ELECTRON.md +147 -147
  100. package/templates/frameworks/FLASK.md +38 -38
  101. package/templates/frameworks/FLUTTER.md +55 -55
  102. package/templates/frameworks/JQUERY.md +32 -32
  103. package/templates/frameworks/LARAVEL.md +38 -38
  104. package/templates/frameworks/NESTJS.md +43 -43
  105. package/templates/frameworks/NEXTJS.md +127 -127
  106. package/templates/frameworks/NUXT.md +40 -40
  107. package/templates/frameworks/RAILS.md +66 -66
  108. package/templates/frameworks/REACT.md +38 -38
  109. package/templates/frameworks/REACT_NATIVE.md +47 -47
  110. package/templates/frameworks/SPRING.md +39 -39
  111. package/templates/frameworks/SYMFONY.md +36 -36
  112. package/templates/frameworks/VUE.md +36 -36
  113. package/templates/frameworks/ZEND.md +35 -35
  114. package/templates/git/CI_CD_PATTERNS.md +661 -661
  115. package/templates/git/GITHUB_ACTIONS.md +728 -728
  116. package/templates/git/GITLAB_CI.md +730 -730
  117. package/templates/git/GIT_WORKFLOW.md +1157 -1157
  118. package/templates/git/SECRETS_MANAGEMENT.md +585 -585
  119. package/templates/hooks/COMMIT_MSG.md +530 -530
  120. package/templates/hooks/POST_CHECKOUT.md +546 -546
  121. package/templates/hooks/PREPARE_COMMIT_MSG.md +619 -619
  122. package/templates/hooks/PRE_COMMIT.md +414 -414
  123. package/templates/hooks/PRE_PUSH.md +601 -601
  124. package/templates/ides/CONTINUE_RULES.md +16 -16
  125. package/templates/ides/COPILOT.md +37 -37
  126. package/templates/ides/COPILOT_INSTRUCTIONS.md +23 -23
  127. package/templates/ides/CURSOR.md +43 -43
  128. package/templates/ides/GEMINI_RULES.md +17 -17
  129. package/templates/ides/JETBRAINS_AI.md +35 -35
  130. package/templates/ides/REPLIT.md +36 -36
  131. package/templates/ides/TABNINE.md +29 -29
  132. package/templates/ides/VSCODE.md +40 -40
  133. package/templates/ides/WINDSURF.md +36 -36
  134. package/templates/ides/WINDSURF_RULES.md +14 -14
  135. package/templates/ides/ZED.md +32 -32
  136. package/templates/ides/cursor-mdc/go.mdc +24 -24
  137. package/templates/ides/cursor-mdc/python.mdc +24 -24
  138. package/templates/ides/cursor-mdc/quality.mdc +25 -25
  139. package/templates/ides/cursor-mdc/ralph.mdc +39 -39
  140. package/templates/ides/cursor-mdc/rulebook.mdc +38 -38
  141. package/templates/ides/cursor-mdc/rust.mdc +24 -24
  142. package/templates/ides/cursor-mdc/typescript.mdc +25 -25
  143. package/templates/languages/C.md +333 -333
  144. package/templates/languages/CPP.md +743 -743
  145. package/templates/languages/CSHARP.md +417 -417
  146. package/templates/languages/ELIXIR.md +454 -454
  147. package/templates/languages/ERLANG.md +361 -361
  148. package/templates/languages/GO.md +645 -645
  149. package/templates/languages/HASKELL.md +177 -177
  150. package/templates/languages/JAVA.md +607 -607
  151. package/templates/languages/JAVASCRIPT.md +631 -631
  152. package/templates/languages/JULIA.md +97 -97
  153. package/templates/languages/KOTLIN.md +511 -511
  154. package/templates/languages/LISP.md +100 -100
  155. package/templates/languages/LUA.md +74 -74
  156. package/templates/languages/OBJECTIVEC.md +90 -90
  157. package/templates/languages/PHP.md +416 -416
  158. package/templates/languages/PYTHON.md +682 -682
  159. package/templates/languages/RUBY.md +421 -421
  160. package/templates/languages/RUST.md +477 -477
  161. package/templates/languages/SAS.md +73 -73
  162. package/templates/languages/SCALA.md +348 -348
  163. package/templates/languages/SOLIDITY.md +580 -580
  164. package/templates/languages/SQL.md +137 -137
  165. package/templates/languages/SWIFT.md +466 -466
  166. package/templates/languages/TYPESCRIPT.md +591 -591
  167. package/templates/languages/ZIG.md +265 -265
  168. package/templates/modules/ATLASSIAN.md +255 -255
  169. package/templates/modules/CONTEXT7.md +54 -54
  170. package/templates/modules/FIGMA.md +267 -267
  171. package/templates/modules/GITHUB_MCP.md +64 -64
  172. package/templates/modules/GRAFANA.md +328 -328
  173. package/templates/modules/MEMORY.md +126 -126
  174. package/templates/modules/NOTION.md +247 -247
  175. package/templates/modules/PLAYWRIGHT.md +90 -90
  176. package/templates/modules/RULEBOOK_MCP.md +156 -156
  177. package/templates/modules/SERENA.md +337 -337
  178. package/templates/modules/SUPABASE.md +223 -223
  179. package/templates/modules/SYNAP.md +69 -69
  180. package/templates/modules/VECTORIZER.md +63 -63
  181. package/templates/modules/sequential-thinking.md +42 -42
  182. package/templates/ralph/ralph-history.bat +4 -4
  183. package/templates/ralph/ralph-history.sh +5 -5
  184. package/templates/ralph/ralph-init.bat +5 -5
  185. package/templates/ralph/ralph-init.sh +5 -5
  186. package/templates/ralph/ralph-pause.bat +5 -5
  187. package/templates/ralph/ralph-pause.sh +5 -5
  188. package/templates/ralph/ralph-run.bat +5 -5
  189. package/templates/ralph/ralph-run.sh +5 -5
  190. package/templates/ralph/ralph-status.bat +4 -4
  191. package/templates/ralph/ralph-status.sh +5 -5
  192. package/templates/services/AZURE_BLOB.md +184 -184
  193. package/templates/services/CASSANDRA.md +239 -239
  194. package/templates/services/DATADOG.md +26 -26
  195. package/templates/services/DOCKER.md +124 -124
  196. package/templates/services/DOCKER_COMPOSE.md +168 -168
  197. package/templates/services/DYNAMODB.md +308 -308
  198. package/templates/services/ELASTICSEARCH.md +347 -347
  199. package/templates/services/GCS.md +178 -178
  200. package/templates/services/HELM.md +194 -194
  201. package/templates/services/INFLUXDB.md +265 -265
  202. package/templates/services/KAFKA.md +341 -341
  203. package/templates/services/KUBERNETES.md +208 -208
  204. package/templates/services/MARIADB.md +183 -183
  205. package/templates/services/MEMCACHED.md +242 -242
  206. package/templates/services/MINIO.md +201 -201
  207. package/templates/services/MONGODB.md +268 -268
  208. package/templates/services/MYSQL.md +358 -358
  209. package/templates/services/NEO4J.md +247 -247
  210. package/templates/services/OPENTELEMETRY.md +25 -25
  211. package/templates/services/ORACLE.md +290 -290
  212. package/templates/services/PINO.md +24 -24
  213. package/templates/services/POSTGRESQL.md +326 -326
  214. package/templates/services/PROMETHEUS.md +33 -33
  215. package/templates/services/RABBITMQ.md +286 -286
  216. package/templates/services/REDIS.md +292 -292
  217. package/templates/services/S3.md +298 -298
  218. package/templates/services/SENTRY.md +23 -23
  219. package/templates/services/SQLITE.md +294 -294
  220. package/templates/services/SQLSERVER.md +294 -294
  221. package/templates/services/WINSTON.md +30 -30
  222. package/templates/skills/cli/aider/SKILL.md +59 -59
  223. package/templates/skills/cli/amazon-q/SKILL.md +35 -35
  224. package/templates/skills/cli/auggie/SKILL.md +42 -42
  225. package/templates/skills/cli/claude/SKILL.md +42 -42
  226. package/templates/skills/cli/cline/SKILL.md +42 -42
  227. package/templates/skills/cli/codebuddy/SKILL.md +30 -30
  228. package/templates/skills/cli/codeium/SKILL.md +30 -30
  229. package/templates/skills/cli/codex/SKILL.md +31 -31
  230. package/templates/skills/cli/continue/SKILL.md +44 -44
  231. package/templates/skills/cli/cursor-cli/SKILL.md +38 -38
  232. package/templates/skills/cli/factory/SKILL.md +28 -28
  233. package/templates/skills/cli/gemini/SKILL.md +45 -45
  234. package/templates/skills/cli/kilocode/SKILL.md +28 -28
  235. package/templates/skills/cli/opencode/SKILL.md +28 -28
  236. package/templates/skills/core/agent-automation/SKILL.md +194 -194
  237. package/templates/skills/core/dag/SKILL.md +314 -314
  238. package/templates/skills/core/documentation-rules/SKILL.md +46 -46
  239. package/templates/skills/core/quality-enforcement/SKILL.md +78 -78
  240. package/templates/skills/core/rulebook/SKILL.md +176 -176
  241. package/templates/skills/dev/accessibility/SKILL.md +17 -0
  242. package/templates/skills/dev/api-design/SKILL.md +15 -0
  243. package/templates/skills/dev/architect/SKILL.md +17 -0
  244. package/templates/skills/dev/build-fix/SKILL.md +17 -0
  245. package/templates/skills/dev/db-design/SKILL.md +15 -0
  246. package/templates/skills/dev/debug/SKILL.md +16 -0
  247. package/templates/skills/dev/deploy/SKILL.md +17 -0
  248. package/templates/skills/dev/docs/SKILL.md +17 -0
  249. package/templates/skills/dev/migrate/SKILL.md +15 -0
  250. package/templates/skills/dev/perf/SKILL.md +17 -0
  251. package/templates/skills/dev/refactor/SKILL.md +17 -0
  252. package/templates/skills/dev/research/SKILL.md +14 -0
  253. package/templates/skills/dev/review/SKILL.md +18 -0
  254. package/templates/skills/dev/security-audit/SKILL.md +17 -0
  255. package/templates/skills/frameworks/angular/SKILL.md +46 -46
  256. package/templates/skills/frameworks/django/SKILL.md +93 -93
  257. package/templates/skills/frameworks/electron/SKILL.md +157 -157
  258. package/templates/skills/frameworks/flask/SKILL.md +48 -48
  259. package/templates/skills/frameworks/flutter/SKILL.md +65 -65
  260. package/templates/skills/frameworks/jquery/SKILL.md +42 -42
  261. package/templates/skills/frameworks/laravel/SKILL.md +48 -48
  262. package/templates/skills/frameworks/nestjs/SKILL.md +53 -53
  263. package/templates/skills/frameworks/nextjs/SKILL.md +137 -137
  264. package/templates/skills/frameworks/nuxt/SKILL.md +50 -50
  265. package/templates/skills/frameworks/rails/SKILL.md +76 -76
  266. package/templates/skills/frameworks/react/SKILL.md +48 -48
  267. package/templates/skills/frameworks/react-native/SKILL.md +57 -57
  268. package/templates/skills/frameworks/spring/SKILL.md +49 -49
  269. package/templates/skills/frameworks/symfony/SKILL.md +46 -46
  270. package/templates/skills/frameworks/vue/SKILL.md +46 -46
  271. package/templates/skills/frameworks/zend/SKILL.md +45 -45
  272. package/templates/skills/ides/copilot/SKILL.md +47 -47
  273. package/templates/skills/ides/cursor/SKILL.md +53 -53
  274. package/templates/skills/ides/jetbrains-ai/SKILL.md +45 -45
  275. package/templates/skills/ides/replit/SKILL.md +46 -46
  276. package/templates/skills/ides/tabnine/SKILL.md +39 -39
  277. package/templates/skills/ides/vscode/SKILL.md +50 -50
  278. package/templates/skills/ides/windsurf/SKILL.md +46 -46
  279. package/templates/skills/ides/zed/SKILL.md +42 -42
  280. package/templates/skills/languages/c/SKILL.md +343 -343
  281. package/templates/skills/languages/cpp/SKILL.md +753 -753
  282. package/templates/skills/languages/csharp/SKILL.md +427 -427
  283. package/templates/skills/languages/elixir/SKILL.md +464 -464
  284. package/templates/skills/languages/erlang/SKILL.md +371 -371
  285. package/templates/skills/languages/go/SKILL.md +655 -655
  286. package/templates/skills/languages/haskell/SKILL.md +187 -187
  287. package/templates/skills/languages/java/SKILL.md +617 -617
  288. package/templates/skills/languages/javascript/SKILL.md +641 -641
  289. package/templates/skills/languages/julia/SKILL.md +107 -107
  290. package/templates/skills/languages/kotlin/SKILL.md +521 -521
  291. package/templates/skills/languages/lisp/SKILL.md +110 -110
  292. package/templates/skills/languages/lua/SKILL.md +84 -84
  293. package/templates/skills/languages/objectivec/SKILL.md +100 -100
  294. package/templates/skills/languages/php/SKILL.md +426 -426
  295. package/templates/skills/languages/python/SKILL.md +692 -692
  296. package/templates/skills/languages/ruby/SKILL.md +431 -431
  297. package/templates/skills/languages/rust/SKILL.md +487 -487
  298. package/templates/skills/languages/sas/SKILL.md +83 -83
  299. package/templates/skills/languages/scala/SKILL.md +358 -358
  300. package/templates/skills/languages/solidity/SKILL.md +590 -590
  301. package/templates/skills/languages/sql/SKILL.md +147 -147
  302. package/templates/skills/languages/swift/SKILL.md +476 -476
  303. package/templates/skills/languages/typescript/SKILL.md +302 -302
  304. package/templates/skills/languages/zig/SKILL.md +275 -275
  305. package/templates/skills/modules/atlassian/SKILL.md +265 -265
  306. package/templates/skills/modules/context7/SKILL.md +64 -64
  307. package/templates/skills/modules/figma/SKILL.md +277 -277
  308. package/templates/skills/modules/github-mcp/SKILL.md +74 -74
  309. package/templates/skills/modules/grafana/SKILL.md +338 -338
  310. package/templates/skills/modules/memory/SKILL.md +73 -73
  311. package/templates/skills/modules/notion/SKILL.md +257 -257
  312. package/templates/skills/modules/playwright/SKILL.md +100 -100
  313. package/templates/skills/modules/rulebook-mcp/SKILL.md +166 -166
  314. package/templates/skills/modules/serena/SKILL.md +347 -347
  315. package/templates/skills/modules/supabase/SKILL.md +233 -233
  316. package/templates/skills/modules/synap/SKILL.md +79 -79
  317. package/templates/skills/modules/vectorizer/SKILL.md +73 -73
  318. package/templates/skills/services/azure-blob/SKILL.md +194 -194
  319. package/templates/skills/services/cassandra/SKILL.md +249 -249
  320. package/templates/skills/services/dynamodb/SKILL.md +318 -318
  321. package/templates/skills/services/elasticsearch/SKILL.md +357 -357
  322. package/templates/skills/services/gcs/SKILL.md +188 -188
  323. package/templates/skills/services/influxdb/SKILL.md +275 -275
  324. package/templates/skills/services/kafka/SKILL.md +351 -351
  325. package/templates/skills/services/mariadb/SKILL.md +193 -193
  326. package/templates/skills/services/memcached/SKILL.md +252 -252
  327. package/templates/skills/services/minio/SKILL.md +211 -211
  328. package/templates/skills/services/mongodb/SKILL.md +278 -278
  329. package/templates/skills/services/mysql/SKILL.md +368 -368
  330. package/templates/skills/services/neo4j/SKILL.md +257 -257
  331. package/templates/skills/services/oracle/SKILL.md +300 -300
  332. package/templates/skills/services/postgresql/SKILL.md +336 -336
  333. package/templates/skills/services/rabbitmq/SKILL.md +296 -296
  334. package/templates/skills/services/redis/SKILL.md +302 -302
  335. package/templates/skills/services/s3/SKILL.md +308 -308
  336. package/templates/skills/services/sqlite/SKILL.md +304 -304
  337. package/templates/skills/services/sqlserver/SKILL.md +304 -304
  338. package/templates/skills/workflows/ralph/SKILL.md +309 -309
  339. package/templates/skills/workflows/ralph/install.sh +87 -87
  340. package/templates/skills/workflows/ralph/manifest.json +158 -158
@@ -1,1935 +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
- ## 🚨 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
-
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
+