@hivehub/rulebook 1.2.0

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