@hanzlaa/rcode 2.1.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 (676) hide show
  1. package/AGENTS.md +120 -0
  2. package/CLAUDE.md +120 -0
  3. package/CONTRIBUTING.md +298 -0
  4. package/README.md +436 -0
  5. package/cli/config.js +142 -0
  6. package/cli/context.js +213 -0
  7. package/cli/dashboard.js +38 -0
  8. package/cli/digest.js +66 -0
  9. package/cli/doctor.js +283 -0
  10. package/cli/github-sync.js +1016 -0
  11. package/cli/index.js +113 -0
  12. package/cli/install.js +946 -0
  13. package/cli/lib/config.cjs +334 -0
  14. package/cli/lib/fsutil.cjs +76 -0
  15. package/cli/lib/github.cjs +365 -0
  16. package/cli/lib/manifest.cjs +240 -0
  17. package/cli/lib/memory-bank.cjs +348 -0
  18. package/cli/lib/model-profiles.cjs +169 -0
  19. package/cli/lib/prompts.cjs +355 -0
  20. package/cli/postinstall.js +32 -0
  21. package/cli/set-mode.js +94 -0
  22. package/cli/set-profile.js +80 -0
  23. package/cli/show-model.js +82 -0
  24. package/cli/team.js +35 -0
  25. package/cli/tiers.js +49 -0
  26. package/cli/uninstall.js +600 -0
  27. package/cli/update.js +373 -0
  28. package/package.json +60 -0
  29. package/rihal/agents/rihal-advisor-researcher.md +116 -0
  30. package/rihal/agents/rihal-ahmed.md +66 -0
  31. package/rihal/agents/rihal-architect.md +79 -0
  32. package/rihal/agents/rihal-assumptions-analyzer.md +117 -0
  33. package/rihal/agents/rihal-code-fixer.md +74 -0
  34. package/rihal/agents/rihal-code-reviewer.md +75 -0
  35. package/rihal/agents/rihal-codebase-mapper.md +170 -0
  36. package/rihal/agents/rihal-debugger.md +140 -0
  37. package/rihal/agents/rihal-deviation-analyzer.md +74 -0
  38. package/rihal/agents/rihal-docs-auditor.md +77 -0
  39. package/rihal/agents/rihal-edge-case-hunter.md +75 -0
  40. package/rihal/agents/rihal-executor.md +113 -0
  41. package/rihal/agents/rihal-fatima.md +68 -0
  42. package/rihal/agents/rihal-haitham.md +75 -0
  43. package/rihal/agents/rihal-hanzla.md +59 -0
  44. package/rihal/agents/rihal-hussain-pm.md +82 -0
  45. package/rihal/agents/rihal-integration-checker.md +455 -0
  46. package/rihal/agents/rihal-khalid.md +59 -0
  47. package/rihal/agents/rihal-layla.md +57 -0
  48. package/rihal/agents/rihal-mariam.md +58 -0
  49. package/rihal/agents/rihal-nasser.md +57 -0
  50. package/rihal/agents/rihal-noor.md +60 -0
  51. package/rihal/agents/rihal-nyquist-auditor.md +182 -0
  52. package/rihal/agents/rihal-omar.md +57 -0
  53. package/rihal/agents/rihal-phase-researcher.md +84 -0
  54. package/rihal/agents/rihal-planner.md +176 -0
  55. package/rihal/agents/rihal-profiler.md +74 -0
  56. package/rihal/agents/rihal-project-researcher.md +80 -0
  57. package/rihal/agents/rihal-remediation-planner.md +78 -0
  58. package/rihal/agents/rihal-research-synthesizer.md +253 -0
  59. package/rihal/agents/rihal-roadmapper.md +73 -0
  60. package/rihal/agents/rihal-sadiq.md +72 -0
  61. package/rihal/agents/rihal-security-adversary.md +82 -0
  62. package/rihal/agents/rihal-security-auditor.md +78 -0
  63. package/rihal/agents/rihal-sprint-checker.md +124 -0
  64. package/rihal/agents/rihal-tech-writer.md +80 -0
  65. package/rihal/agents/rihal-ui-auditor.md +81 -0
  66. package/rihal/agents/rihal-ui-designer.md +6 -0
  67. package/rihal/agents/rihal-ux-designer.md +83 -0
  68. package/rihal/agents/rihal-verifier.md +124 -0
  69. package/rihal/agents/rihal-waleed.md +60 -0
  70. package/rihal/agents/rihal-yousef.md +78 -0
  71. package/rihal/agents/rihal-zahra.md +62 -0
  72. package/rihal/agents/rihal-zayd.md +78 -0
  73. package/rihal/agents/rules/codebase-mapper/detailed-guide.md +615 -0
  74. package/rihal/agents/rules/debugger/checkpoint-recovery.md +272 -0
  75. package/rihal/agents/rules/debugger/debug-session-state.md +261 -0
  76. package/rihal/agents/rules/debugger/hypothesis-templates.md +330 -0
  77. package/rihal/agents/rules/debugger/investigation-protocol.md +298 -0
  78. package/rihal/agents/rules/debugger/scientific-method.md +317 -0
  79. package/rihal/agents/rules/executor/authentication-gates.md +202 -0
  80. package/rihal/agents/rules/executor/deviation-rules.md +191 -0
  81. package/rihal/agents/rules/executor/execution-flow.md +116 -0
  82. package/rihal/agents/rules/executor/self-check.md +241 -0
  83. package/rihal/agents/rules/executor/stub-detection.md +267 -0
  84. package/rihal/agents/rules/executor/summary-creation.md +76 -0
  85. package/rihal/agents/rules/executor/task-commit-protocol.md +283 -0
  86. package/rihal/agents/rules/executor/tdd-flow.md +294 -0
  87. package/rihal/agents/rules/phase-researcher/detailed-guide.md +628 -0
  88. package/rihal/agents/rules/planner/common-patterns.md +373 -0
  89. package/rihal/agents/rules/planner/dependency-analysis.md +195 -0
  90. package/rihal/agents/rules/planner/goal-backward-thinking.md +220 -0
  91. package/rihal/agents/rules/planner/sprint-verification.md +202 -0
  92. package/rihal/agents/rules/planner/task-templates.md +296 -0
  93. package/rihal/agents/rules/project-researcher/detailed-guide.md +589 -0
  94. package/rihal/agents/rules/roadmapper/detailed-guide.md +620 -0
  95. package/rihal/agents/rules/sprint-checker/dimensions.md +414 -0
  96. package/rihal/agents/rules/sprint-checker/process.md +377 -0
  97. package/rihal/agents/rules/verifier/anti-patterns.md +94 -0
  98. package/rihal/agents/rules/verifier/artifact-verification.md +69 -0
  99. package/rihal/agents/rules/verifier/behavioral-spot-checks.md +49 -0
  100. package/rihal/agents/rules/verifier/context-loading.md +84 -0
  101. package/rihal/agents/rules/verifier/data-flow-trace.md +65 -0
  102. package/rihal/agents/rules/verifier/gap-output.md +51 -0
  103. package/rihal/agents/rules/verifier/key-links.md +56 -0
  104. package/rihal/agents/rules/verifier/requirements-coverage.md +28 -0
  105. package/rihal/agents/rules/verifier/verification-report.md +131 -0
  106. package/rihal/bin/lib/code-references.cjs +196 -0
  107. package/rihal/bin/lib/config.cjs +146 -0
  108. package/rihal/bin/lib/council-panel.cjs +501 -0
  109. package/rihal/bin/lib/roadmap.cjs +256 -0
  110. package/rihal/bin/lib/verify.cjs +118 -0
  111. package/rihal/bin/rihal-hooks.cjs +204 -0
  112. package/rihal/bin/rihal-tools.cjs +3554 -0
  113. package/rihal/brain/README.md +38 -0
  114. package/rihal/brain/best-practices/no-autonomous-bypass.md +37 -0
  115. package/rihal/brain/best-practices/research-citation-rule.md +39 -0
  116. package/rihal/brain/best-practices/state-sync-rule.md +43 -0
  117. package/rihal/brain/sources.yaml +59 -0
  118. package/rihal/commands/add-phase.md +18 -0
  119. package/rihal/commands/add-tests.md +18 -0
  120. package/rihal/commands/add-todo.md +8 -0
  121. package/rihal/commands/analyze-dependencies.md +11 -0
  122. package/rihal/commands/audit-fix.md +14 -0
  123. package/rihal/commands/audit-milestone.md +12 -0
  124. package/rihal/commands/audit-uat.md +18 -0
  125. package/rihal/commands/autonomous.md +19 -0
  126. package/rihal/commands/brainstorm.md +11 -0
  127. package/rihal/commands/chain.md +8 -0
  128. package/rihal/commands/check-implementation-readiness.md +8 -0
  129. package/rihal/commands/check-todos.md +18 -0
  130. package/rihal/commands/cleanup.md +18 -0
  131. package/rihal/commands/code-review-fix.md +14 -0
  132. package/rihal/commands/code-review.md +14 -0
  133. package/rihal/commands/complete-milestone.md +12 -0
  134. package/rihal/commands/config.md +8 -0
  135. package/rihal/commands/correct-course.md +8 -0
  136. package/rihal/commands/council.md +25 -0
  137. package/rihal/commands/create-epics-and-stories.md +8 -0
  138. package/rihal/commands/create-story.md +8 -0
  139. package/rihal/commands/dashboard.md +10 -0
  140. package/rihal/commands/debug.md +8 -0
  141. package/rihal/commands/decisions.md +10 -0
  142. package/rihal/commands/dev-story.md +8 -0
  143. package/rihal/commands/diff.md +10 -0
  144. package/rihal/commands/discuss-phase-power.md +11 -0
  145. package/rihal/commands/discuss-phase.md +19 -0
  146. package/rihal/commands/discuss.md +23 -0
  147. package/rihal/commands/do.md +22 -0
  148. package/rihal/commands/docs-update.md +14 -0
  149. package/rihal/commands/document-project.md +8 -0
  150. package/rihal/commands/enable-hooks.md +11 -0
  151. package/rihal/commands/execute-sprint.md +13 -0
  152. package/rihal/commands/execute.md +19 -0
  153. package/rihal/commands/explore.md +14 -0
  154. package/rihal/commands/export-to-github.md +11 -0
  155. package/rihal/commands/forensics.md +11 -0
  156. package/rihal/commands/from-template.md +11 -0
  157. package/rihal/commands/health.md +10 -0
  158. package/rihal/commands/help.md +8 -0
  159. package/rihal/commands/import.md +12 -0
  160. package/rihal/commands/inbox.md +12 -0
  161. package/rihal/commands/init.md +14 -0
  162. package/rihal/commands/insert-phase.md +11 -0
  163. package/rihal/commands/install.md +10 -0
  164. package/rihal/commands/karpathy-audit.md +12 -0
  165. package/rihal/commands/list-plans.md +11 -0
  166. package/rihal/commands/list-workspaces.md +10 -0
  167. package/rihal/commands/map-codebase.md +14 -0
  168. package/rihal/commands/milestone-summary.md +11 -0
  169. package/rihal/commands/new-milestone.md +12 -0
  170. package/rihal/commands/new-project-research.md +11 -0
  171. package/rihal/commands/new-project-roadmap.md +11 -0
  172. package/rihal/commands/new-project.md +13 -0
  173. package/rihal/commands/new-workspace.md +12 -0
  174. package/rihal/commands/next.md +19 -0
  175. package/rihal/commands/note.md +12 -0
  176. package/rihal/commands/notify-test.md +10 -0
  177. package/rihal/commands/pause-work.md +8 -0
  178. package/rihal/commands/plan-milestone-gaps.md +18 -0
  179. package/rihal/commands/plan.md +19 -0
  180. package/rihal/commands/plant-seed.md +18 -0
  181. package/rihal/commands/pr-branch.md +18 -0
  182. package/rihal/commands/profile-user.md +8 -0
  183. package/rihal/commands/progress.md +19 -0
  184. package/rihal/commands/quick.md +14 -0
  185. package/rihal/commands/remove-phase.md +18 -0
  186. package/rihal/commands/remove-workspace.md +11 -0
  187. package/rihal/commands/replay.md +11 -0
  188. package/rihal/commands/report.md +10 -0
  189. package/rihal/commands/rerun.md +11 -0
  190. package/rihal/commands/research-phase.md +18 -0
  191. package/rihal/commands/resume-work.md +8 -0
  192. package/rihal/commands/review-adversarial.md +8 -0
  193. package/rihal/commands/review-edge-case-hunter.md +8 -0
  194. package/rihal/commands/review.md +18 -0
  195. package/rihal/commands/scan.md +14 -0
  196. package/rihal/commands/secure-phase.md +14 -0
  197. package/rihal/commands/session-report.md +10 -0
  198. package/rihal/commands/settings.md +8 -0
  199. package/rihal/commands/ship.md +18 -0
  200. package/rihal/commands/show.md +10 -0
  201. package/rihal/commands/sprint-planning.md +20 -0
  202. package/rihal/commands/sprint-status.md +21 -0
  203. package/rihal/commands/stats.md +10 -0
  204. package/rihal/commands/status.md +21 -0
  205. package/rihal/commands/ui-phase.md +8 -0
  206. package/rihal/commands/ui-review.md +8 -0
  207. package/rihal/commands/undo.md +14 -0
  208. package/rihal/commands/update.md +11 -0
  209. package/rihal/commands/validate-phase.md +18 -0
  210. package/rihal/commands/verify-phase.md +18 -0
  211. package/rihal/commands/verify-work.md +19 -0
  212. package/rihal/commands/why.md +10 -0
  213. package/rihal/commands/workstream.md +11 -0
  214. package/rihal/config/model-profiles.json +226 -0
  215. package/rihal/config/model-profiles.schema.json +36 -0
  216. package/rihal/config.yaml +39 -0
  217. package/rihal/digests/README.md +50 -0
  218. package/rihal/digests/fatima.md +24 -0
  219. package/rihal/digests/hussain-pm.md +24 -0
  220. package/rihal/digests/mariam.md +24 -0
  221. package/rihal/digests/sadiq.md +24 -0
  222. package/rihal/digests/waleed.md +24 -0
  223. package/rihal/modules/core.yaml +101 -0
  224. package/rihal/modules/discovery.yaml +50 -0
  225. package/rihal/modules/execution.yaml +66 -0
  226. package/rihal/references/brain-methods.csv +9 -0
  227. package/rihal/references/checklist-architect.md +146 -0
  228. package/rihal/references/checklist-change.md +136 -0
  229. package/rihal/references/checklist-pm.md +154 -0
  230. package/rihal/references/checklist-po-master.md +100 -0
  231. package/rihal/references/checklist-story-dod.md +75 -0
  232. package/rihal/references/checklist-story-draft.md +53 -0
  233. package/rihal/references/checkpoints-index.md +53 -0
  234. package/rihal/references/checkpoints.md +778 -0
  235. package/rihal/references/codebase-grounding.md +76 -0
  236. package/rihal/references/command-redirect-format.md +62 -0
  237. package/rihal/references/commit-conventions.md +125 -0
  238. package/rihal/references/common-bug-patterns-index.md +44 -0
  239. package/rihal/references/common-bug-patterns.md +621 -0
  240. package/rihal/references/context-budget.md +104 -0
  241. package/rihal/references/continuation-format.md +249 -0
  242. package/rihal/references/council-protocol.md +91 -0
  243. package/rihal/references/domain-probes.md +213 -0
  244. package/rihal/references/elicitation-methods.csv +16 -0
  245. package/rihal/references/execution-protocol.md +155 -0
  246. package/rihal/references/gate-prompts.md +212 -0
  247. package/rihal/references/gates.md +127 -0
  248. package/rihal/references/git-integration.md +159 -0
  249. package/rihal/references/git-planning-commit.md +185 -0
  250. package/rihal/references/karpathy-guidelines.md +79 -0
  251. package/rihal/references/model-profiles.md +90 -0
  252. package/rihal/references/no-unauthorized-git-ops.md +73 -0
  253. package/rihal/references/output-format.md +319 -0
  254. package/rihal/references/output-realism.md +52 -0
  255. package/rihal/references/project-types.yaml +270 -0
  256. package/rihal/references/questioning.md +163 -0
  257. package/rihal/references/response-style.md +81 -0
  258. package/rihal/references/state-schema.md +366 -0
  259. package/rihal/references/tdd.md +263 -0
  260. package/rihal/references/thinking-models-debug.md +126 -0
  261. package/rihal/references/thinking-models-planning.md +127 -0
  262. package/rihal/references/ui-brand.md +254 -0
  263. package/rihal/references/verification-patterns-index.md +76 -0
  264. package/rihal/references/verification-patterns.md +612 -0
  265. package/rihal/references/workstream-flag.md +166 -0
  266. package/rihal/skills/SKILLS_INDEX.md +114 -0
  267. package/rihal/skills/_shared/no-autonomous-bypass.md +37 -0
  268. package/rihal/skills/_shared/research-citation-rule.md +39 -0
  269. package/rihal/skills/_shared/state-sync-rule.md +43 -0
  270. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/SKILL.md +31 -0
  271. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/domain-steps/step-01-init.md +137 -0
  272. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/domain-steps/step-02-domain-analysis.md +229 -0
  273. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/domain-steps/step-03-competitive-landscape.md +238 -0
  274. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/domain-steps/step-04-regulatory-focus.md +206 -0
  275. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/domain-steps/step-05-technical-trends.md +234 -0
  276. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/domain-steps/step-06-research-synthesis.md +444 -0
  277. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/research.template.md +29 -0
  278. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/workflow.md +49 -0
  279. package/rihal/skills/actions/1-analysis/research/rihal-market-research/SKILL.md +30 -0
  280. package/rihal/skills/actions/1-analysis/research/rihal-market-research/research.template.md +29 -0
  281. package/rihal/skills/actions/1-analysis/research/rihal-market-research/steps/step-01-init.md +184 -0
  282. package/rihal/skills/actions/1-analysis/research/rihal-market-research/steps/step-02-customer-behavior.md +239 -0
  283. package/rihal/skills/actions/1-analysis/research/rihal-market-research/steps/step-03-customer-pain-points.md +251 -0
  284. package/rihal/skills/actions/1-analysis/research/rihal-market-research/steps/step-04-customer-decisions.md +261 -0
  285. package/rihal/skills/actions/1-analysis/research/rihal-market-research/steps/step-05-competitive-analysis.md +173 -0
  286. package/rihal/skills/actions/1-analysis/research/rihal-market-research/steps/step-06-research-completion.md +478 -0
  287. package/rihal/skills/actions/1-analysis/research/rihal-market-research/workflow.md +49 -0
  288. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/SKILL.md +31 -0
  289. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/research.template.md +29 -0
  290. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/technical-steps/step-01-init.md +137 -0
  291. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/technical-steps/step-02-technical-overview.md +239 -0
  292. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/technical-steps/step-03-integration-patterns.md +248 -0
  293. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/technical-steps/step-04-architectural-patterns.md +202 -0
  294. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/technical-steps/step-05-implementation-research.md +233 -0
  295. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/technical-steps/step-06-research-synthesis.md +487 -0
  296. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/workflow.md +50 -0
  297. package/rihal/skills/actions/1-analysis/rihal-document-project/SKILL.md +30 -0
  298. package/rihal/skills/actions/1-analysis/rihal-document-project/checklist.md +245 -0
  299. package/rihal/skills/actions/1-analysis/rihal-document-project/documentation-requirements.csv +12 -0
  300. package/rihal/skills/actions/1-analysis/rihal-document-project/instructions.md +128 -0
  301. package/rihal/skills/actions/1-analysis/rihal-document-project/templates/deep-dive-template.md +345 -0
  302. package/rihal/skills/actions/1-analysis/rihal-document-project/templates/index-template.md +169 -0
  303. package/rihal/skills/actions/1-analysis/rihal-document-project/templates/project-overview-template.md +103 -0
  304. package/rihal/skills/actions/1-analysis/rihal-document-project/templates/project-scan-report-schema.json +160 -0
  305. package/rihal/skills/actions/1-analysis/rihal-document-project/templates/source-tree-template.md +135 -0
  306. package/rihal/skills/actions/1-analysis/rihal-document-project/workflow.md +27 -0
  307. package/rihal/skills/actions/1-analysis/rihal-document-project/workflows/deep-dive-instructions.md +299 -0
  308. package/rihal/skills/actions/1-analysis/rihal-document-project/workflows/deep-dive-workflow.md +34 -0
  309. package/rihal/skills/actions/1-analysis/rihal-document-project/workflows/full-scan-instructions.md +1107 -0
  310. package/rihal/skills/actions/1-analysis/rihal-document-project/workflows/full-scan-workflow.md +34 -0
  311. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +120 -0
  312. package/rihal/skills/actions/1-analysis/rihal-prfaq/agents/artifact-analyzer.md +60 -0
  313. package/rihal/skills/actions/1-analysis/rihal-prfaq/agents/web-researcher.md +49 -0
  314. package/rihal/skills/actions/1-analysis/rihal-prfaq/assets/prfaq-template.md +62 -0
  315. package/rihal/skills/actions/1-analysis/rihal-prfaq/references/customer-faq.md +55 -0
  316. package/rihal/skills/actions/1-analysis/rihal-prfaq/references/internal-faq.md +51 -0
  317. package/rihal/skills/actions/1-analysis/rihal-prfaq/references/press-release.md +60 -0
  318. package/rihal/skills/actions/1-analysis/rihal-prfaq/references/verdict.md +79 -0
  319. package/rihal/skills/actions/1-analysis/rihal-prfaq/rihal-manifest.json +16 -0
  320. package/rihal/skills/actions/1-analysis/rihal-product-brief/SKILL.md +112 -0
  321. package/rihal/skills/actions/1-analysis/rihal-product-brief/agents/artifact-analyzer.md +60 -0
  322. package/rihal/skills/actions/1-analysis/rihal-product-brief/agents/opportunity-reviewer.md +44 -0
  323. package/rihal/skills/actions/1-analysis/rihal-product-brief/agents/skeptic-reviewer.md +44 -0
  324. package/rihal/skills/actions/1-analysis/rihal-product-brief/agents/web-researcher.md +49 -0
  325. package/rihal/skills/actions/1-analysis/rihal-product-brief/prompts/contextual-discovery.md +57 -0
  326. package/rihal/skills/actions/1-analysis/rihal-product-brief/prompts/draft-and-review.md +86 -0
  327. package/rihal/skills/actions/1-analysis/rihal-product-brief/prompts/finalize.md +75 -0
  328. package/rihal/skills/actions/1-analysis/rihal-product-brief/prompts/guided-elicitation.md +70 -0
  329. package/rihal/skills/actions/1-analysis/rihal-product-brief/resources/brief-template.md +60 -0
  330. package/rihal/skills/actions/1-analysis/rihal-product-brief/rihal-manifest.json +17 -0
  331. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +30 -0
  332. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/steps/step-01-validate-prerequisites.md +255 -0
  333. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/steps/step-02-design-epics.md +212 -0
  334. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/steps/step-03-create-stories.md +255 -0
  335. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/steps/step-04-final-validation.md +131 -0
  336. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/templates/epics-template.md +61 -0
  337. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/workflow.md +54 -0
  338. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +39 -0
  339. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/README.md +30 -0
  340. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-01-init.md +62 -0
  341. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-02-outcomes.md +64 -0
  342. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-03-sequencing.md +65 -0
  343. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-04-windows.md +60 -0
  344. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-05-kill-criteria.md +59 -0
  345. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-06-phase-stubs.md +56 -0
  346. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-07-backlog.md +44 -0
  347. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-08-write-roadmap.md +58 -0
  348. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-09-state-sync.md +62 -0
  349. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-10-complete.md +56 -0
  350. package/rihal/skills/actions/2-plan/rihal-create-milestone/workflow.md +93 -0
  351. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +40 -0
  352. package/rihal/skills/actions/2-plan/rihal-create-prd/data/domain-complexity.csv +15 -0
  353. package/rihal/skills/actions/2-plan/rihal-create-prd/data/prd-purpose.md +197 -0
  354. package/rihal/skills/actions/2-plan/rihal-create-prd/data/project-types.csv +11 -0
  355. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-01-init.md +178 -0
  356. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-01b-continue.md +161 -0
  357. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-02-discovery.md +208 -0
  358. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-02b-vision.md +142 -0
  359. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-02c-executive-summary.md +158 -0
  360. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-03-success.md +214 -0
  361. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-04-journeys.md +201 -0
  362. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-05-domain.md +194 -0
  363. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-06-innovation.md +211 -0
  364. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-07-project-type.md +222 -0
  365. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-08-scoping.md +216 -0
  366. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-09-functional.md +219 -0
  367. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-10-nonfunctional.md +230 -0
  368. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-11-polish.md +221 -0
  369. package/rihal/skills/actions/2-plan/rihal-create-prd/steps-c/step-12-complete.md +115 -0
  370. package/rihal/skills/actions/2-plan/rihal-create-prd/templates/prd-template.md +10 -0
  371. package/rihal/skills/actions/2-plan/rihal-create-prd/workflow.md +64 -0
  372. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +31 -0
  373. package/rihal/skills/actions/2-plan/rihal-create-story/checklist.md +357 -0
  374. package/rihal/skills/actions/2-plan/rihal-create-story/discover-inputs.md +88 -0
  375. package/rihal/skills/actions/2-plan/rihal-create-story/template.md +49 -0
  376. package/rihal/skills/actions/2-plan/rihal-create-story/workflow.md +380 -0
  377. package/rihal/skills/actions/2-plan/rihal-create-ux-design/SKILL.md +31 -0
  378. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-01-init.md +135 -0
  379. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-01b-continue.md +127 -0
  380. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-02-discovery.md +190 -0
  381. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-03-core-experience.md +217 -0
  382. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-04-emotional-response.md +220 -0
  383. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-05-inspiration.md +235 -0
  384. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-06-design-system.md +253 -0
  385. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-07-defining-experience.md +255 -0
  386. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-08-visual-foundation.md +225 -0
  387. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-09-design-directions.md +225 -0
  388. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-10-user-journeys.md +242 -0
  389. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-11-component-strategy.md +249 -0
  390. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-12-ux-patterns.md +238 -0
  391. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-13-responsive-accessibility.md +265 -0
  392. package/rihal/skills/actions/2-plan/rihal-create-ux-design/steps/step-14-complete.md +171 -0
  393. package/rihal/skills/actions/2-plan/rihal-create-ux-design/ux-design-template.md +13 -0
  394. package/rihal/skills/actions/2-plan/rihal-create-ux-design/workflow.md +36 -0
  395. package/rihal/skills/actions/2-plan/rihal-edit-prd/SKILL.md +30 -0
  396. package/rihal/skills/actions/2-plan/rihal-edit-prd/steps-e/step-e-01-discovery.md +242 -0
  397. package/rihal/skills/actions/2-plan/rihal-edit-prd/steps-e/step-e-01b-legacy-conversion.md +204 -0
  398. package/rihal/skills/actions/2-plan/rihal-edit-prd/steps-e/step-e-02-review.md +245 -0
  399. package/rihal/skills/actions/2-plan/rihal-edit-prd/steps-e/step-e-03-edit.md +250 -0
  400. package/rihal/skills/actions/2-plan/rihal-edit-prd/steps-e/step-e-04-complete.md +165 -0
  401. package/rihal/skills/actions/2-plan/rihal-edit-prd/workflow.md +63 -0
  402. package/rihal/skills/actions/2-plan/rihal-frontend-design/SKILL.md +169 -0
  403. package/rihal/skills/actions/2-plan/rihal-validate-prd/SKILL.md +29 -0
  404. package/rihal/skills/actions/2-plan/rihal-validate-prd/data/domain-complexity.csv +15 -0
  405. package/rihal/skills/actions/2-plan/rihal-validate-prd/data/prd-purpose.md +197 -0
  406. package/rihal/skills/actions/2-plan/rihal-validate-prd/data/project-types.csv +11 -0
  407. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-01-discovery.md +221 -0
  408. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-02-format-detection.md +188 -0
  409. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-02b-parity-check.md +206 -0
  410. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-03-density-validation.md +171 -0
  411. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-04-brief-coverage-validation.md +211 -0
  412. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-05-measurability-validation.md +225 -0
  413. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-06-traceability-validation.md +214 -0
  414. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-07-implementation-leakage-validation.md +202 -0
  415. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-08-domain-compliance-validation.md +240 -0
  416. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-09-project-type-validation.md +260 -0
  417. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-10-smart-validation.md +206 -0
  418. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-11-holistic-quality-validation.md +261 -0
  419. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-12-completeness-validation.md +239 -0
  420. package/rihal/skills/actions/2-plan/rihal-validate-prd/steps-v/step-v-13-report-complete.md +229 -0
  421. package/rihal/skills/actions/2-plan/rihal-validate-prd/workflow.md +62 -0
  422. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/SKILL.md +30 -0
  423. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/steps/step-01-document-discovery.md +179 -0
  424. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/steps/step-02-prd-analysis.md +168 -0
  425. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/steps/step-03-epic-coverage-validation.md +169 -0
  426. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/steps/step-04-ux-alignment.md +129 -0
  427. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/steps/step-05-epic-quality-review.md +241 -0
  428. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/steps/step-06-final-assessment.md +126 -0
  429. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/templates/readiness-report-template.md +4 -0
  430. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/workflow.md +49 -0
  431. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/SKILL.md +32 -0
  432. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/architecture-decision-template.md +12 -0
  433. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/data/domain-complexity.csv +13 -0
  434. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/data/project-types.csv +7 -0
  435. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/steps/step-01-init.md +153 -0
  436. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/steps/step-01b-continue.md +173 -0
  437. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/steps/step-02-context.md +224 -0
  438. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/steps/step-03-starter.md +329 -0
  439. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/steps/step-04-decisions.md +318 -0
  440. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/steps/step-05-patterns.md +359 -0
  441. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/steps/step-06-structure.md +379 -0
  442. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/steps/step-07-validation.md +359 -0
  443. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/steps/step-08-complete.md +76 -0
  444. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/workflow.md +38 -0
  445. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/SKILL.md +31 -0
  446. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/project-context-template.md +21 -0
  447. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/steps/step-01-discover.md +186 -0
  448. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/steps/step-02-generate.md +321 -0
  449. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/steps/step-03-complete.md +278 -0
  450. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/workflow.md +43 -0
  451. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +48 -0
  452. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/generate-trail.md +38 -0
  453. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/step-01-orientation.md +105 -0
  454. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/step-02-walkthrough.md +89 -0
  455. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/step-03-detail-pass.md +106 -0
  456. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/step-04-testing.md +74 -0
  457. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/step-05-wrapup.md +24 -0
  458. package/rihal/skills/actions/4-implementation/rihal-code-review/SKILL.md +31 -0
  459. package/rihal/skills/actions/4-implementation/rihal-code-review/steps/step-01-gather-context.md +62 -0
  460. package/rihal/skills/actions/4-implementation/rihal-code-review/steps/step-02-review.md +34 -0
  461. package/rihal/skills/actions/4-implementation/rihal-code-review/steps/step-03-triage.md +49 -0
  462. package/rihal/skills/actions/4-implementation/rihal-code-review/steps/step-04-present.md +129 -0
  463. package/rihal/skills/actions/4-implementation/rihal-code-review/workflow.md +55 -0
  464. package/rihal/skills/actions/4-implementation/rihal-correct-course/SKILL.md +29 -0
  465. package/rihal/skills/actions/4-implementation/rihal-correct-course/checklist.md +288 -0
  466. package/rihal/skills/actions/4-implementation/rihal-correct-course/workflow.md +267 -0
  467. package/rihal/skills/actions/4-implementation/rihal-dev-story/SKILL.md +36 -0
  468. package/rihal/skills/actions/4-implementation/rihal-dev-story/checklist.md +80 -0
  469. package/rihal/skills/actions/4-implementation/rihal-dev-story/workflow.md +450 -0
  470. package/rihal/skills/actions/4-implementation/rihal-qa-generate-e2e-tests/SKILL.md +31 -0
  471. package/rihal/skills/actions/4-implementation/rihal-qa-generate-e2e-tests/checklist.md +33 -0
  472. package/rihal/skills/actions/4-implementation/rihal-qa-generate-e2e-tests/workflow.md +136 -0
  473. package/rihal/skills/actions/4-implementation/rihal-retrospective/SKILL.md +30 -0
  474. package/rihal/skills/actions/4-implementation/rihal-retrospective/workflow.md +1479 -0
  475. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/SKILL.md +77 -0
  476. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/steps/step-01-target.md +17 -0
  477. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/steps/step-02-safety.md +35 -0
  478. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/steps/step-03-clone.md +50 -0
  479. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/steps/step-04-post-setup.md +44 -0
  480. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +35 -0
  481. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/checklist.md +43 -0
  482. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/sprint-status-template.yaml +56 -0
  483. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/workflow.md +284 -0
  484. package/rihal/skills/actions/4-implementation/rihal-sprint-status/SKILL.md +30 -0
  485. package/rihal/skills/actions/4-implementation/rihal-sprint-status/workflow.md +261 -0
  486. package/rihal/skills/agents/ahmed-hassani-director/SKILL.md +121 -0
  487. package/rihal/skills/agents/fatima-qa/SKILL.md +106 -0
  488. package/rihal/skills/agents/fatima-qa/skill-manifest.yaml +11 -0
  489. package/rihal/skills/agents/haitham-frontend/SKILL.md +120 -0
  490. package/rihal/skills/agents/hanzla-engineer/SKILL.md +109 -0
  491. package/rihal/skills/agents/hanzla-engineer/skill-manifest.yaml +11 -0
  492. package/rihal/skills/agents/hussain-pm/SKILL.md +107 -0
  493. package/rihal/skills/agents/hussain-pm/skill-manifest.yaml +11 -0
  494. package/rihal/skills/agents/hussain-sm/SKILL.md +104 -0
  495. package/rihal/skills/agents/hussain-sm/skill-manifest.yaml +11 -0
  496. package/rihal/skills/agents/layla-designer/SKILL.md +96 -0
  497. package/rihal/skills/agents/layla-designer/skill-manifest.yaml +11 -0
  498. package/rihal/skills/agents/majlis-council/SKILL.md +179 -0
  499. package/rihal/skills/agents/mariam-marketing/SKILL.md +133 -0
  500. package/rihal/skills/agents/nasser-eng-manager/SKILL.md +125 -0
  501. package/rihal/skills/agents/noor-writer/SKILL.md +104 -0
  502. package/rihal/skills/agents/noor-writer/explain-concept.md +20 -0
  503. package/rihal/skills/agents/noor-writer/mermaid-gen.md +20 -0
  504. package/rihal/skills/agents/noor-writer/skill-manifest.yaml +11 -0
  505. package/rihal/skills/agents/noor-writer/validate-doc.md +19 -0
  506. package/rihal/skills/agents/noor-writer/write-document.md +20 -0
  507. package/rihal/skills/agents/raees-orchestrator/SKILL.md +154 -0
  508. package/rihal/skills/agents/sadiq-analyst/SKILL.md +106 -0
  509. package/rihal/skills/agents/sadiq-analyst/skill-manifest.yaml +11 -0
  510. package/rihal/skills/agents/waleed-architect/SKILL.md +106 -0
  511. package/rihal/skills/agents/waleed-architect/skill-manifest.yaml +11 -0
  512. package/rihal/skills/agents/yousef-backend/SKILL.md +136 -0
  513. package/rihal/skills/agents/zahra-branding/SKILL.md +141 -0
  514. package/rihal/skills/agents/zayd-ml/SKILL.md +124 -0
  515. package/rihal/skills/core/module-help.csv +11 -0
  516. package/rihal/skills/core/module.yaml +25 -0
  517. package/rihal/skills/core/rihal-advanced-elicitation/SKILL.md +155 -0
  518. package/rihal/skills/core/rihal-advanced-elicitation/methods.csv +51 -0
  519. package/rihal/skills/core/rihal-advanced-elicitation/rihal-advanced-elicitation/SKILL.md +148 -0
  520. package/rihal/skills/core/rihal-advanced-elicitation/rihal-advanced-elicitation/methods.csv +51 -0
  521. package/rihal/skills/core/rihal-brainstorming/SKILL.md +82 -0
  522. package/rihal/skills/core/rihal-brainstorming/brain-methods.csv +62 -0
  523. package/rihal/skills/core/rihal-brainstorming/steps/step-01-session-setup.md +214 -0
  524. package/rihal/skills/core/rihal-brainstorming/steps/step-01b-continue.md +124 -0
  525. package/rihal/skills/core/rihal-brainstorming/steps/step-02a-user-selected.md +229 -0
  526. package/rihal/skills/core/rihal-brainstorming/steps/step-02b-ai-recommended.md +239 -0
  527. package/rihal/skills/core/rihal-brainstorming/steps/step-02c-random-selection.md +211 -0
  528. package/rihal/skills/core/rihal-brainstorming/steps/step-02d-progressive-flow.md +266 -0
  529. package/rihal/skills/core/rihal-brainstorming/steps/step-03-technique-execution.md +401 -0
  530. package/rihal/skills/core/rihal-brainstorming/steps/step-04-idea-organization.md +305 -0
  531. package/rihal/skills/core/rihal-brainstorming/template.md +15 -0
  532. package/rihal/skills/core/rihal-brainstorming/workflow.md +53 -0
  533. package/rihal/skills/core/rihal-clone-website/SKILL.md +395 -0
  534. package/rihal/skills/core/rihal-distillator/SKILL.md +205 -0
  535. package/rihal/skills/core/rihal-distillator/agents/distillate-compressor.md +116 -0
  536. package/rihal/skills/core/rihal-distillator/agents/round-trip-reconstructor.md +68 -0
  537. package/rihal/skills/core/rihal-distillator/resources/compression-rules.md +51 -0
  538. package/rihal/skills/core/rihal-distillator/resources/distillate-format-reference.md +227 -0
  539. package/rihal/skills/core/rihal-distillator/resources/splitting-strategy.md +78 -0
  540. package/rihal/skills/core/rihal-distillator/scripts/analyze_sources.py +300 -0
  541. package/rihal/skills/core/rihal-distillator/scripts/tests/test_analyze_sources.py +204 -0
  542. package/rihal/skills/core/rihal-editorial-review-prose/SKILL.md +108 -0
  543. package/rihal/skills/core/rihal-editorial-review-structure/SKILL.md +193 -0
  544. package/rihal/skills/core/rihal-help/SKILL.md +91 -0
  545. package/rihal/skills/core/rihal-index-docs/SKILL.md +80 -0
  546. package/rihal/skills/core/rihal-init/SKILL.md +119 -0
  547. package/rihal/skills/core/rihal-init/resources/core-module.yaml +25 -0
  548. package/rihal/skills/core/rihal-init/scripts/rihal_init.py +593 -0
  549. package/rihal/skills/core/rihal-init/scripts/tests/test_rihal_init.py +329 -0
  550. package/rihal/skills/core/rihal-party-mode/SKILL.md +77 -0
  551. package/rihal/skills/core/rihal-party-mode/steps/step-01-agent-loading.md +138 -0
  552. package/rihal/skills/core/rihal-party-mode/steps/step-02-discussion-orchestration.md +187 -0
  553. package/rihal/skills/core/rihal-party-mode/steps/step-03-graceful-exit.md +167 -0
  554. package/rihal/skills/core/rihal-party-mode/workflow.md +190 -0
  555. package/rihal/skills/core/rihal-review-adversarial-general/SKILL.md +55 -0
  556. package/rihal/skills/core/rihal-review-edge-case-hunter/SKILL.md +81 -0
  557. package/rihal/skills/core/rihal-shard-doc/SKILL.md +119 -0
  558. package/rihal/skills/core/rihal-shard-doc/rihal-shard-doc/SKILL.md +122 -0
  559. package/rihal/team.yaml +343 -0
  560. package/rihal/templates/UI-SPEC.md +127 -0
  561. package/rihal/templates/documentation-requirements.csv +11 -0
  562. package/rihal/templates/github/bug-template.md +53 -0
  563. package/rihal/templates/github/epic-template.md +57 -0
  564. package/rihal/templates/github/feature-template.md +55 -0
  565. package/rihal/templates/github/task-template.md +52 -0
  566. package/rihal/templates/milestone.md +147 -0
  567. package/rihal/templates/projects/api-backend/PROJECT.md +37 -0
  568. package/rihal/templates/projects/api-backend/REQUIREMENTS.md +38 -0
  569. package/rihal/templates/projects/api-backend/ROADMAP.md +92 -0
  570. package/rihal/templates/projects/api-backend/template.yaml +17 -0
  571. package/rihal/templates/projects/mobile-app/PROJECT.md +37 -0
  572. package/rihal/templates/projects/mobile-app/REQUIREMENTS.md +32 -0
  573. package/rihal/templates/projects/mobile-app/ROADMAP.md +93 -0
  574. package/rihal/templates/projects/mobile-app/template.yaml +17 -0
  575. package/rihal/templates/projects/saas-b2b/PROJECT.md +40 -0
  576. package/rihal/templates/projects/saas-b2b/REQUIREMENTS.md +38 -0
  577. package/rihal/templates/projects/saas-b2b/ROADMAP.md +95 -0
  578. package/rihal/templates/projects/saas-b2b/template.yaml +18 -0
  579. package/rihal/templates/settings-hooks.json +36 -0
  580. package/rihal/templates/sprint.md +70 -0
  581. package/rihal/workflows/add-phase.md +112 -0
  582. package/rihal/workflows/add-tests.md +351 -0
  583. package/rihal/workflows/add-todo.md +181 -0
  584. package/rihal/workflows/analyze-dependencies.md +138 -0
  585. package/rihal/workflows/audit-fix.md +190 -0
  586. package/rihal/workflows/audit-milestone.md +155 -0
  587. package/rihal/workflows/audit-uat.md +109 -0
  588. package/rihal/workflows/autonomous.md +992 -0
  589. package/rihal/workflows/brainstorm.md +203 -0
  590. package/rihal/workflows/chain.md +188 -0
  591. package/rihal/workflows/check-implementation-readiness.md +193 -0
  592. package/rihal/workflows/check-todos.md +177 -0
  593. package/rihal/workflows/cleanup.md +152 -0
  594. package/rihal/workflows/code-review-fix.md +529 -0
  595. package/rihal/workflows/code-review.md +566 -0
  596. package/rihal/workflows/complete-milestone.md +836 -0
  597. package/rihal/workflows/config.md +105 -0
  598. package/rihal/workflows/correct-course.md +190 -0
  599. package/rihal/workflows/council.md +565 -0
  600. package/rihal/workflows/create-epics-and-stories.md +373 -0
  601. package/rihal/workflows/create-story.md +297 -0
  602. package/rihal/workflows/dashboard.md +102 -0
  603. package/rihal/workflows/debug.md +256 -0
  604. package/rihal/workflows/decisions.md +107 -0
  605. package/rihal/workflows/dev-story.md +432 -0
  606. package/rihal/workflows/diff.md +74 -0
  607. package/rihal/workflows/discuss-phase-power.md +325 -0
  608. package/rihal/workflows/discuss-phase.md +1201 -0
  609. package/rihal/workflows/discuss.md +227 -0
  610. package/rihal/workflows/do.md +175 -0
  611. package/rihal/workflows/docs-update.md +261 -0
  612. package/rihal/workflows/document-project.md +180 -0
  613. package/rihal/workflows/enable-hooks.md +102 -0
  614. package/rihal/workflows/execute-sprint.md +514 -0
  615. package/rihal/workflows/execute.md +1478 -0
  616. package/rihal/workflows/explore.md +171 -0
  617. package/rihal/workflows/export-to-github.md +174 -0
  618. package/rihal/workflows/forensics.md +201 -0
  619. package/rihal/workflows/from-template.md +173 -0
  620. package/rihal/workflows/health.md +194 -0
  621. package/rihal/workflows/help.md +318 -0
  622. package/rihal/workflows/import.md +306 -0
  623. package/rihal/workflows/inbox.md +418 -0
  624. package/rihal/workflows/init.md +245 -0
  625. package/rihal/workflows/insert-phase.md +116 -0
  626. package/rihal/workflows/install.md +85 -0
  627. package/rihal/workflows/karpathy-audit.md +409 -0
  628. package/rihal/workflows/list-plans.md +146 -0
  629. package/rihal/workflows/list-workspaces.md +115 -0
  630. package/rihal/workflows/map-codebase.md +449 -0
  631. package/rihal/workflows/milestone-summary.md +206 -0
  632. package/rihal/workflows/new-milestone.md +616 -0
  633. package/rihal/workflows/new-project-research.md +262 -0
  634. package/rihal/workflows/new-project-roadmap.md +446 -0
  635. package/rihal/workflows/new-project.md +1503 -0
  636. package/rihal/workflows/new-workspace.md +167 -0
  637. package/rihal/workflows/next.md +162 -0
  638. package/rihal/workflows/note.md +156 -0
  639. package/rihal/workflows/notify-test.md +113 -0
  640. package/rihal/workflows/pause-work.md +243 -0
  641. package/rihal/workflows/plan-milestone-gaps.md +273 -0
  642. package/rihal/workflows/plan.md +1262 -0
  643. package/rihal/workflows/plant-seed.md +169 -0
  644. package/rihal/workflows/pr-branch.md +129 -0
  645. package/rihal/workflows/profile-user.md +162 -0
  646. package/rihal/workflows/progress.md +184 -0
  647. package/rihal/workflows/quick.md +105 -0
  648. package/rihal/workflows/remove-phase.md +155 -0
  649. package/rihal/workflows/remove-workspace.md +158 -0
  650. package/rihal/workflows/replay.md +160 -0
  651. package/rihal/workflows/rerun.md +77 -0
  652. package/rihal/workflows/research-phase.md +82 -0
  653. package/rihal/workflows/resume-work.md +326 -0
  654. package/rihal/workflows/review-adversarial.md +180 -0
  655. package/rihal/workflows/review-edge-case-hunter.md +214 -0
  656. package/rihal/workflows/review.md +281 -0
  657. package/rihal/workflows/scan.md +135 -0
  658. package/rihal/workflows/secure-phase.md +196 -0
  659. package/rihal/workflows/session-report.md +187 -0
  660. package/rihal/workflows/settings.md +185 -0
  661. package/rihal/workflows/ship.md +237 -0
  662. package/rihal/workflows/show.md +63 -0
  663. package/rihal/workflows/sprint-planning.md +166 -0
  664. package/rihal/workflows/sprint-status.md +124 -0
  665. package/rihal/workflows/stats.md +141 -0
  666. package/rihal/workflows/status.md +116 -0
  667. package/rihal/workflows/ui-phase.md +148 -0
  668. package/rihal/workflows/ui-review.md +130 -0
  669. package/rihal/workflows/undo.md +426 -0
  670. package/rihal/workflows/update.md +185 -0
  671. package/rihal/workflows/validate-phase.md +174 -0
  672. package/rihal/workflows/verify-phase.md +375 -0
  673. package/rihal/workflows/verify-work.md +717 -0
  674. package/rihal/workflows/why.md +130 -0
  675. package/rihal/workflows/workstream.md +197 -0
  676. package/server/dashboard.js +632 -0
@@ -0,0 +1,1262 @@
1
+ <purpose>
2
+ Create executable phase prompts (SPRINT.md files) for a roadmap phase with integrated research and verification. Default flow: Research (if needed) -> Plan -> Verify -> Done. Orchestrates rihal-phase-researcher, rihal-planner, and rihal-sprint-checker agents with a revision loop (max 3 iterations).
3
+ </purpose>
4
+
5
+ <output_format>
6
+ Open with banner:
7
+
8
+ ```
9
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
10
+ RIHAL ► PLANNING PHASE {NN}
11
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
12
+ ```
13
+
14
+ TaskCreate at start:
15
+ - TaskCreate: "Load phase scope and context"
16
+ - TaskCreate: "Research phase (if enabled)"
17
+ - TaskCreate: "Spawn rihal-planner → SPRINT.md"
18
+ - TaskCreate: "Run rihal-sprint-checker verification"
19
+ - TaskCreate: "Revise plan (up to 3 iterations)" — only if checker flags issues
20
+ - TaskCreate: "Commit SPRINT.md + update state"
21
+
22
+ Spawning indicators:
23
+ ```
24
+ ◆ Spawning rihal-phase-researcher...
25
+ ✓ Research complete: RESEARCH.md ({N} lines)
26
+
27
+ ◆ Spawning rihal-planner...
28
+ ✓ Planner complete: SPRINT.md ({N} stories, {M} points)
29
+
30
+ ◆ Spawning rihal-sprint-checker...
31
+ ✓ Check complete: {PASS|PARTIAL|FAIL} — see CHECK.md
32
+ ```
33
+
34
+ Closure:
35
+ ```
36
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
37
+ RIHAL ► PLAN READY ✓ ({N} stories, {M} points)
38
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
39
+ ```
40
+ End with Next Up routing to /rihal:execute.
41
+ </output_format>
42
+
43
+ <required_reading>
44
+ @.rihal/references/output-format.md
45
+ Read all files referenced by the invoking prompt's execution_context before starting.
46
+
47
+ @.rihal/references/ui-brand.md
48
+ @.rihal/references/revision-loop.md
49
+ @.rihal/references/gate-prompts.md
50
+ @.rihal/references/agent-contracts.md
51
+ @.rihal/references/gates.md
52
+ </required_reading>
53
+
54
+ <available_agent_types>
55
+ Valid Rihal subagent types (use exact names — do not fall back to 'general-purpose'):
56
+ - rihal-phase-researcher — Researches technical approaches for a phase
57
+ - rihal-planner — Creates detailed plans from phase scope
58
+ - rihal-sprint-checker — Reviews plan quality before execution
59
+ </available_agent_types>
60
+
61
+ <process>
62
+
63
+ ## 1. Initialize
64
+
65
+ Load all context in one call (paths only to minimize orchestrator context):
66
+
67
+ ```bash
68
+ INIT=$(node ".rihal/bin/rihal-tools.cjs" init sprint-plan "$PHASE")
69
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
70
+ AGENT_SKILLS_RESEARCHER=$(node ".rihal/bin/rihal-tools.cjs" agent-skills rihal-researcher 2>/dev/null)
71
+ AGENT_SKILLS_PLANNER=$(node ".rihal/bin/rihal-tools.cjs" agent-skills rihal-planner 2>/dev/null)
72
+ AGENT_SKILLS_CHECKER=$(node ".rihal/bin/rihal-tools.cjs" agent-skills rihal-checker 2>/dev/null)
73
+ CONTEXT_WINDOW=$(node ".rihal/bin/rihal-tools.cjs" config-get context_window 2>/dev/null || echo "200000")
74
+ ```
75
+
76
+ When `CONTEXT_WINDOW >= 500000`, the planner prompt includes prior phase CONTEXT.md files so cross-phase decisions are consistent (e.g., "use library X for all data fetching" from Phase 2 is visible to Phase 5's planner).
77
+
78
+ Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `nyquist_validation_enabled`, `commit_docs`, `text_mode`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_reviews`, `has_plans`, `plan_count`, `planning_exists`, `roadmap_exists`, `phase_req_ids`, `response_language`.
79
+
80
+ **If `response_language` is set:** Include `response_language: {value}` in all spawned subagent prompts so any user-facing output stays in the configured language.
81
+
82
+ **File paths (for <files_to_read> blocks):** `state_path`, `roadmap_path`, `requirements_path`, `context_path`, `research_path`, `verification_path`, `uat_path`, `reviews_path`. These are null if files don't exist.
83
+
84
+ **If `planning_exists` is false:** Error — run `/rihal:new-project` first.
85
+
86
+ ## 2. Parse and Normalize Arguments
87
+
88
+ Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--prd <filepath>`, `--reviews`, `--text`).
89
+
90
+ Set `TEXT_MODE=true` if `--text` is present in $ARGUMENTS OR `text_mode` from init JSON is `true`. When `TEXT_MODE` is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for Claude Code remote sessions (`/rc` mode) where TUI menus don't work through the Claude App.
91
+
92
+ Extract `--prd <filepath>` from $ARGUMENTS. If present, set PRD_FILE to the filepath.
93
+
94
+ **Detect gaps mode:**
95
+ ```bash
96
+ if [[ "$ARGUMENTS" =~ (^|[[:space:]])--gaps($|[[:space:]]) ]]; then
97
+ GAPS_MODE=true
98
+ else
99
+ GAPS_MODE=false
100
+ fi
101
+ ```
102
+
103
+ When `GAPS_MODE=true`, the workflow switches to **gap-closure planning**: read the phase's VERIFICATION.md, extract verification gaps classified `gap_found` or `partial`, and produce a single new numbered plan file (`NNN-NN-PLAN.md`) that closes them. Research, CONTEXT.md gating, and VALIDATION.md creation are skipped — gaps are grounded in already-shipped code, not new design work.
104
+
105
+ **If no phase number:** Detect next unplanned phase from roadmap.
106
+
107
+ **If `phase_found` is false:** Validate phase exists in ROADMAP.md. If valid, create the directory using `phase_slug` and `padded_phase` from init:
108
+ ```bash
109
+ mkdir -p ".planning/phases/${padded_phase}-${phase_slug}"
110
+ ```
111
+
112
+ **Existing artifacts from init:** `has_research`, `has_plans`, `plan_count`.
113
+
114
+ ## 2.5. Validate `--reviews` Prerequisite
115
+
116
+ **Skip if:** No `--reviews` flag.
117
+
118
+ **If `--reviews` AND `--gaps`:** Error — cannot combine `--reviews` with `--gaps`. These are conflicting modes.
119
+
120
+ **If `--reviews` AND `has_reviews` is false (no REVIEWS.md in phase dir):**
121
+
122
+ Error:
123
+ ```
124
+ No REVIEWS.md found for Phase {N}. Run reviews first:
125
+
126
+ /rihal:review --phase {N}
127
+
128
+ Then re-run /rihal:sprint-plan {N} --reviews
129
+ ```
130
+ Exit workflow.
131
+
132
+ ## 3. Validate Phase
133
+
134
+ ```bash
135
+ PHASE_INFO=$(node ".rihal/bin/rihal-tools.cjs" roadmap get-phase "${PHASE}")
136
+ ```
137
+
138
+ **If `found` is false:** Error with available phases. **If `found` is true:** Extract `phase_number`, `phase_name`, `goal` from JSON.
139
+
140
+ ## 3.5. Handle PRD Express Path
141
+
142
+ **Skip if:** No `--prd` flag in arguments.
143
+
144
+ **If `--prd <filepath>` provided:**
145
+
146
+ 1. Read the PRD file:
147
+ ```bash
148
+ PRD_CONTENT=$(cat "$PRD_FILE" 2>/dev/null)
149
+ if [ -z "$PRD_CONTENT" ]; then
150
+ echo "Error: PRD file not found: $PRD_FILE"
151
+ exit 1
152
+ fi
153
+ ```
154
+
155
+ 2. Display banner:
156
+ ```
157
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
158
+ Rihal ► PRD EXPRESS PATH
159
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
160
+
161
+ Using PRD: {PRD_FILE}
162
+ Generating CONTEXT.md from requirements...
163
+ ```
164
+
165
+ 3. Parse the PRD content and generate CONTEXT.md. The orchestrator should:
166
+ - Extract all requirements, user stories, acceptance criteria, and constraints from the PRD
167
+ - Map each to a locked decision (everything in the PRD is treated as a locked decision)
168
+ - Identify any areas the PRD doesn't cover and mark as "Claude's Discretion"
169
+ - **Extract canonical refs** from ROADMAP.md for this phase, plus any specs/ADRs referenced in the PRD — expand to full file paths (MANDATORY)
170
+ - Create CONTEXT.md in the phase directory
171
+
172
+ 4. Write CONTEXT.md:
173
+ ```markdown
174
+ # Phase [X]: [Name] - Context
175
+
176
+ **Gathered:** [date]
177
+ **Status:** Ready for planning
178
+ **Source:** PRD Express Path ({PRD_FILE})
179
+
180
+ <domain>
181
+ ## Phase Boundary
182
+
183
+ [Extracted from PRD — what this phase delivers]
184
+
185
+ </domain>
186
+
187
+ <decisions>
188
+ ## Implementation Decisions
189
+
190
+ {For each requirement/story/criterion in the PRD:}
191
+ ### [Category derived from content]
192
+ - [Requirement as locked decision]
193
+
194
+ ### Claude's Discretion
195
+ [Areas not covered by PRD — implementation details, technical choices]
196
+
197
+ </decisions>
198
+
199
+ <canonical_refs>
200
+ ## Canonical References
201
+
202
+ **Downstream agents MUST read these before planning or implementing.**
203
+
204
+ [MANDATORY. Extract from ROADMAP.md and any docs referenced in the PRD.
205
+ Use full relative paths. Group by topic area.]
206
+
207
+ ### [Topic area]
208
+ - `path/to/spec-or-adr.md` — [What it decides/defines]
209
+
210
+ [If no external specs: "No external specs — requirements fully captured in decisions above"]
211
+
212
+ </canonical_refs>
213
+
214
+ <specifics>
215
+ ## Specific Ideas
216
+
217
+ [Any specific references, examples, or concrete requirements from PRD]
218
+
219
+ </specifics>
220
+
221
+ <deferred>
222
+ ## Deferred Ideas
223
+
224
+ [Items in PRD explicitly marked as future/v2/out-of-scope]
225
+ [If none: "None — PRD covers phase scope"]
226
+
227
+ </deferred>
228
+
229
+ ---
230
+
231
+ *Phase: XX-name*
232
+ *Context gathered: [date] via PRD Express Path*
233
+ ```
234
+
235
+ 5. Commit:
236
+ ```bash
237
+ node ".rihal/bin/rihal-tools.cjs" commit "docs(${padded_phase}): generate context from PRD" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
238
+ ```
239
+
240
+ 6. Set `context_content` to the generated CONTEXT.md content and continue to step 5 (Handle Research).
241
+
242
+ **Effect:** This completely bypasses step 4 (Load CONTEXT.md) since we just created it. The rest of the workflow (research, planning, verification) proceeds normally with the PRD-derived context.
243
+
244
+ ## 3.6. Handle `--gaps` Mode
245
+
246
+ **Skip unless:** `GAPS_MODE=true`.
247
+
248
+ **Purpose:** Read `NNN-VERIFICATION.md`, extract failing/partial gaps, count existing plan files, and prepare a `gap_list` payload to feed the planner. On completion, control flow continues at step 8 (skipping CONTEXT.md gating, research, and validation-strategy creation).
249
+
250
+ **Step 1: Locate VERIFICATION.md**
251
+
252
+ ```bash
253
+ PHASE_DIR=$(node ".rihal/bin/rihal-tools.cjs" roadmap get-phase "${PHASE}" --pick dir 2>/dev/null || echo "")
254
+ # Fallback if --pick dir not supported. TODO(#118): expose roadmap --pick dir cleanly.
255
+ if [[ -z "$PHASE_DIR" ]]; then
256
+ PHASE_DIR=$(ls -d .planning/phases/${padded_phase}-* 2>/dev/null | head -1)
257
+ fi
258
+
259
+ VERIFICATION_FILE=$(ls "${PHASE_DIR}"/*-VERIFICATION.md 2>/dev/null | head -1)
260
+ ```
261
+
262
+ **If `VERIFICATION_FILE` is empty:**
263
+ ```
264
+ Error: No VERIFICATION.md found for Phase {X}. Gap-closure planning requires the phase to have run through the verifier first.
265
+
266
+ Try:
267
+ /rihal:execute {X} ${Rihal_WS} # run or re-run execution + verification
268
+ ```
269
+ Exit workflow.
270
+
271
+ **Step 2: Extract gaps from VERIFICATION.md**
272
+
273
+ Parse the file for gap entries with `status: gap_found` or `status: partial`. Inspect these sections:
274
+ - `## Automated Gap` (or `## Automated Gaps`)
275
+ - `## Human Verification Required`
276
+ - Any findings block that includes a `status:` field set to `gap_found` or `partial`
277
+
278
+ Collect into `GAP_LIST` (an ordered list where each entry has: id, title, expected, actual, status, source_section, severity if present).
279
+
280
+ If `GAP_LIST` is empty, display:
281
+ ```
282
+ Phase {X} VERIFICATION.md contains no gap_found or partial items — nothing to close.
283
+ Report: {VERIFICATION_FILE}
284
+ ```
285
+ Exit workflow.
286
+
287
+ **Step 3: Determine next plan number**
288
+
289
+ ```bash
290
+ EXISTING_PLAN_COUNT=$(ls "${PHASE_DIR}"/*-PLAN.md 2>/dev/null | wc -l | tr -d ' ')
291
+ NEXT_PLAN_NUMBER=$(printf "%02d" $((EXISTING_PLAN_COUNT + 1)))
292
+ PADDED_PHASE=$(printf "%02d" "${PHASE}")
293
+ GAP_PLAN_FILENAME="${PADDED_PHASE}-${NEXT_PLAN_NUMBER}-PLAN.md"
294
+ GAP_PLAN_PATH="${PHASE_DIR}/${GAP_PLAN_FILENAME}"
295
+ ```
296
+
297
+ If `EXISTING_PLAN_COUNT == 0`, there is no prior execution to reference. Display a warning but proceed — the planner can still close verification gaps.
298
+
299
+ **Step 4: Gather prior plans for planner context**
300
+
301
+ ```bash
302
+ EXISTING_PLAN_FILES=$(ls "${PHASE_DIR}"/*-PLAN.md 2>/dev/null | tr '\n' ' ')
303
+ EXISTING_SUMMARY_FILES=$(ls "${PHASE_DIR}"/*-SUMMARY.md 2>/dev/null | tr '\n' ' ')
304
+ ```
305
+
306
+ **Step 5: Display banner**
307
+
308
+ ```
309
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
310
+ Rihal ► GAP-CLOSURE PLANNING — Phase {X}
311
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
312
+
313
+ Verification report: {VERIFICATION_FILE}
314
+ Gaps to close: {count(GAP_LIST)}
315
+ Existing plans: {EXISTING_PLAN_COUNT}
316
+ New plan file: {GAP_PLAN_FILENAME}
317
+ ```
318
+
319
+ **Step 6: Skip ahead**
320
+
321
+ Control flow jumps directly to step 8 (Spawn rihal-planner). Steps 4 (CONTEXT.md), 5 (Research), and 5.5 (Validation) are ALL skipped when `GAPS_MODE=true`.
322
+
323
+ Step 8 will consume these variables when filling the planner prompt:
324
+ - `GAP_LIST` — serialized list of gaps (id, title, expected, actual, status)
325
+ - `GAP_PLAN_PATH` — exact output path the planner must write
326
+ - `EXISTING_PLAN_FILES` / `EXISTING_SUMMARY_FILES` — prior phase context
327
+ - `VERIFICATION_FILE` — authoritative source-of-truth
328
+
329
+ After the planner returns, the existing plan-checker / revision loop (step 10 onward) runs unchanged — gap plans are verified just like normal plans.
330
+
331
+ ## 4. Load CONTEXT.md
332
+
333
+ **Skip if:** PRD express path was used (CONTEXT.md already created in step 3.5) OR `GAPS_MODE=true` (gap closure is grounded in VERIFICATION.md, not CONTEXT.md).
334
+
335
+ Check `context_path` from init JSON.
336
+
337
+ If `context_path` is not null, display: `Using phase context from: ${context_path}`
338
+
339
+ **If `context_path` is null (no CONTEXT.md exists):**
340
+
341
+ Read discuss mode for context gate label:
342
+ ```bash
343
+ DISCUSS_MODE=$(node ".rihal/bin/rihal-tools.cjs" config-get workflow.discuss_mode 2>/dev/null || echo "discuss")
344
+ ```
345
+
346
+ If `TEXT_MODE` is true, present as a plain-text numbered list:
347
+ ```
348
+ No CONTEXT.md found for Phase {X}. Plans will use research and requirements only — your design preferences won't be included.
349
+
350
+ 1. Continue without context — Plan using research + requirements only
351
+ [If DISCUSS_MODE is "assumptions":]
352
+ 2. Gather context (assumptions mode) — Analyze codebase and surface assumptions before planning
353
+ [If DISCUSS_MODE is "discuss" or unset:]
354
+ 2. Run discuss-phase first — Capture design decisions before planning
355
+
356
+ Enter number:
357
+ ```
358
+
359
+ Otherwise use AskUserQuestion:
360
+ - header: "No context"
361
+ - question: "No CONTEXT.md found for Phase {X}. Plans will use research and requirements only — your design preferences won't be included. Continue or capture context first?"
362
+ - options:
363
+ - "Continue without context" — Plan using research + requirements only
364
+ If `DISCUSS_MODE` is `"assumptions"`:
365
+ - "Gather context (assumptions mode)" — Analyze codebase and surface assumptions before planning
366
+ If `DISCUSS_MODE` is `"discuss"` (or unset):
367
+ - "Run discuss-phase first" — Capture design decisions before planning
368
+
369
+ If "Continue without context": Proceed to step 5.
370
+ If "Run discuss-phase first":
371
+ **IMPORTANT:** Do NOT invoke discuss-phase as a nested Skill/Task call — AskUserQuestion
372
+ does not work correctly in nested subcontexts (#1009). Instead, display the command
373
+ and exit so the user runs it as a top-level command:
374
+ ```
375
+ Run this command first, then re-run /rihal:sprint-plan {X} ${Rihal_WS}:
376
+
377
+ /rihal:discuss-phase {X} ${Rihal_WS}
378
+ ```
379
+ **Exit the sprint-plan workflow. Do not continue.**
380
+
381
+ ## 5. Handle Research
382
+
383
+ **Skip if:** `--gaps` flag or `--skip-research` flag or `--reviews` flag.
384
+
385
+ **If `has_research` is true (from init) AND no `--research` flag:** Use existing, skip to step 6.
386
+
387
+ **If RESEARCH.md missing OR `--research` flag:**
388
+
389
+ **If no explicit flag (`--research` or `--skip-research`) and not `--auto`:**
390
+ Ask the user whether to research, with a contextual recommendation based on the phase:
391
+
392
+ If `TEXT_MODE` is true, present as a plain-text numbered list:
393
+ ```
394
+ Research before planning Phase {X}: {phase_name}?
395
+
396
+ 1. Research first (Recommended) — Investigate domain, patterns, and dependencies before planning. Best for new features, unfamiliar integrations, or architectural changes.
397
+ 2. Skip research — Plan directly from context and requirements. Best for bug fixes, simple refactors, or well-understood tasks.
398
+
399
+ Enter number:
400
+ ```
401
+
402
+ Otherwise use AskUserQuestion:
403
+ ```
404
+ AskUserQuestion([
405
+ {
406
+ question: "Research before planning Phase {X}: {phase_name}?",
407
+ header: "Research",
408
+ multiSelect: false,
409
+ options: [
410
+ { label: "Research first (Recommended)", description: "Investigate domain, patterns, and dependencies before planning. Best for new features, unfamiliar integrations, or architectural changes." },
411
+ { label: "Skip research", description: "Plan directly from context and requirements. Best for bug fixes, simple refactors, or well-understood tasks." }
412
+ ]
413
+ }
414
+ ])
415
+ ```
416
+
417
+ If user selects "Skip research": skip to step 6.
418
+
419
+ **If `--auto` and `research_enabled` is false:** Skip research silently (preserves automated behavior).
420
+
421
+ Display banner:
422
+ ```
423
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
424
+ Rihal ► RESEARCHING PHASE {X}
425
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
426
+
427
+ ◆ Spawning researcher...
428
+ ```
429
+
430
+ ### Spawn rihal-phase-researcher
431
+
432
+ ```bash
433
+ PHASE_DESC=$(node ".rihal/bin/rihal-tools.cjs" roadmap get-phase "${PHASE}" --pick section)
434
+ ```
435
+
436
+ Research prompt:
437
+
438
+ ```markdown
439
+ <objective>
440
+ Research how to implement Phase {phase_number}: {phase_name}
441
+ Answer: "What do I need to know to PLAN this phase well?"
442
+ </objective>
443
+
444
+ <files_to_read>
445
+ - {context_path} (USER DECISIONS from /rihal:discuss-phase)
446
+ - {requirements_path} (Project requirements)
447
+ - {state_path} (Project decisions and history)
448
+ </files_to_read>
449
+
450
+ ${AGENT_SKILLS_RESEARCHER}
451
+
452
+ <additional_context>
453
+ **Phase description:** {phase_description}
454
+ **Phase requirement IDs (MUST address):** {phase_req_ids}
455
+
456
+ **Project instructions:** Read ./CLAUDE.md if exists — follow project-specific guidelines
457
+ **Project skills:** Check .claude/skills/ or .agents/skills/ directory (if either exists) — read SKILL.md files, research should account for project skill patterns
458
+ </additional_context>
459
+
460
+ <output>
461
+ Write to: {phase_dir}/{phase_num}-RESEARCH.md
462
+ </output>
463
+ ```
464
+
465
+ ```
466
+ Task(
467
+ prompt=research_prompt,
468
+ subagent_type="rihal-phase-researcher",
469
+ model="{researcher_model}",
470
+ description="Research Phase {phase}"
471
+ )
472
+ ```
473
+
474
+ ### Handle Researcher Return
475
+
476
+ - **`## RESEARCH COMPLETE`:** Display confirmation, continue to step 6
477
+ - **`## RESEARCH BLOCKED`:** Display blocker, offer: 1) Provide context, 2) Skip research, 3) Abort
478
+
479
+ ## 5.5. Create Validation Strategy
480
+
481
+ Skip if `nyquist_validation_enabled` is false OR `research_enabled` is false.
482
+
483
+ If `research_enabled` is false and `nyquist_validation_enabled` is true: warn "Nyquist validation enabled but research disabled — VALIDATION.md cannot be created without RESEARCH.md. Plans will lack validation requirements (Dimension 8)." Continue to step 6.
484
+
485
+ **But Nyquist is not applicable for this run** when all of the following are true:
486
+ - `research_enabled` is false
487
+ - `has_research` is false
488
+ - no `--research` flag was provided
489
+
490
+ In that case: **skip validation-strategy creation entirely**. Do **not** expect `RESEARCH.md` or `VALIDATION.md` for this run, and continue to Step 6.
491
+
492
+ ```bash
493
+ grep -l "## Validation Architecture" "${PHASE_DIR}"/*-RESEARCH.md 2>/dev/null || true
494
+ ```
495
+
496
+ **If found:**
497
+ 1. Read template: `.rihal/templates/VALIDATION.md`
498
+ 2. Write to `${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md` (use Write tool)
499
+ 3. Fill frontmatter: `{N}` → phase number, `{phase-slug}` → slug, `{date}` → current date
500
+ 4. Verify:
501
+ ```bash
502
+ test -f "${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md" && echo "VALIDATION_CREATED=true" || echo "VALIDATION_CREATED=false"
503
+ ```
504
+ 5. If `VALIDATION_CREATED=false`: STOP — do not proceed to Step 6
505
+ 6. If `commit_docs`: `commit "docs(phase-${PHASE}): add validation strategy"`
506
+
507
+ **If not found:** Warn and continue — plans may fail Dimension 8.
508
+
509
+ ## 5.55. Security Threat Model Gate
510
+
511
+ > Skip if `workflow.security_enforcement` is explicitly `false`. Absent = enabled.
512
+
513
+ ```bash
514
+ SECURITY_CFG=$(node ".rihal/bin/rihal-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
515
+ SECURITY_ASVS=$(node ".rihal/bin/rihal-tools.cjs" config-get workflow.security_asvs_level --raw 2>/dev/null || echo "1")
516
+ SECURITY_BLOCK=$(node ".rihal/bin/rihal-tools.cjs" config-get workflow.security_block_on --raw 2>/dev/null || echo "high")
517
+ ```
518
+
519
+ **If `SECURITY_CFG` is `false`:** Skip to step 5.6.
520
+
521
+ **If `SECURITY_CFG` is `true`:** Display banner:
522
+
523
+ ```
524
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
525
+ Rihal ► SECURITY THREAT MODEL REQUIRED (ASVS L{SECURITY_ASVS})
526
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
527
+
528
+ Each SPRINT.md must include a <threat_model> block.
529
+ Block on: {SECURITY_BLOCK} severity threats.
530
+ Opt out: set security_enforcement: false in .planning/config.json
531
+ ```
532
+
533
+ Continue to step 5.6. Security config is passed to the planner in step 8.
534
+
535
+ ## 5.6. UI Design Contract Gate
536
+
537
+ > Skip if `workflow.ui_phase` is explicitly `false` AND `workflow.ui_safety_gate` is explicitly `false` in `.planning/config.json`. If keys are absent, treat as enabled.
538
+
539
+ ```bash
540
+ UI_PHASE_CFG=$(node ".rihal/bin/rihal-tools.cjs" config-get workflow.ui_phase 2>/dev/null || echo "true")
541
+ UI_GATE_CFG=$(node ".rihal/bin/rihal-tools.cjs" config-get workflow.ui_safety_gate 2>/dev/null || echo "true")
542
+ ```
543
+
544
+ **If both are `false`:** Skip to step 6.
545
+
546
+ Check if phase has frontend indicators:
547
+
548
+ ```bash
549
+ PHASE_SECTION=$(node ".rihal/bin/rihal-tools.cjs" roadmap get-phase "${PHASE}" 2>/dev/null)
550
+ echo "$PHASE_SECTION" | grep -iE "UI|interface|frontend|component|layout|page|screen|view|form|dashboard|widget" > /dev/null 2>&1
551
+ HAS_UI=$?
552
+ ```
553
+
554
+ **If `HAS_UI` is 0 (frontend indicators found):**
555
+
556
+ Check for existing UI-SPEC:
557
+ ```bash
558
+ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
559
+ ```
560
+
561
+ **If UI-SPEC.md found:** Set `UI_SPEC_PATH=$UI_SPEC_FILE`. Display: `Using UI design contract: ${UI_SPEC_PATH}`
562
+
563
+ **If UI-SPEC.md missing AND `UI_GATE_CFG` is `true`:**
564
+
565
+ Read auto-chain state:
566
+ ```bash
567
+ AUTO_CHAIN=$(node ".rihal/bin/rihal-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
568
+ ```
569
+
570
+ **If `AUTO_CHAIN` is `true` (running inside a `--chain` or `--auto` pipeline):**
571
+
572
+ Auto-generate UI-SPEC without prompting:
573
+ ```
574
+ Skill(skill="rihal-ui-phase", args="${PHASE} --auto ${Rihal_WS}")
575
+ ```
576
+ After `rihal-ui-phase` returns, re-read:
577
+ ```bash
578
+ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
579
+ UI_SPEC_PATH="${UI_SPEC_FILE}"
580
+ ```
581
+ Continue to step 6.
582
+
583
+ **If `AUTO_CHAIN` is `false` (manual invocation):**
584
+
585
+ If `TEXT_MODE` is true, present as a plain-text numbered list:
586
+ ```
587
+ Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?
588
+
589
+ 1. Generate UI-SPEC first — Run /rihal:ui-phase {N} then re-run /rihal:sprint-plan {N}
590
+ 2. Continue without UI-SPEC
591
+ 3. Not a frontend phase
592
+
593
+ Enter number:
594
+ ```
595
+
596
+ Otherwise use AskUserQuestion:
597
+ - header: "UI Design Contract"
598
+ - question: "Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?"
599
+ - options:
600
+ - "Generate UI-SPEC first" → Display: "Run `/rihal:ui-phase {N} ${Rihal_WS}` then re-run `/rihal:sprint-plan {N} ${Rihal_WS}`". Exit workflow.
601
+ - "Continue without UI-SPEC" → Continue to step 6.
602
+ - "Not a frontend phase" → Continue to step 6.
603
+
604
+ **If `HAS_UI` is 1 (no frontend indicators):** Skip silently to step 5.7.
605
+
606
+ ## 5.7. Schema Push Detection Gate
607
+
608
+ > Detects schema-relevant files in the phase scope and injects a mandatory `[BLOCKING]` schema push task into the plan. Prevents false-positive verification where build/types pass because TypeScript types come from config, not the live database.
609
+
610
+ Check if any files in the phase scope match schema patterns:
611
+
612
+ ```bash
613
+ PHASE_SECTION=$(node ".rihal/bin/rihal-tools.cjs" roadmap get-phase "${PHASE}" --pick section 2>/dev/null)
614
+ ```
615
+
616
+ Scan `PHASE_SECTION`, `CONTEXT.md` (if loaded), and `RESEARCH.md` (if exists) for file paths matching these ORM patterns:
617
+
618
+ | ORM | File Patterns |
619
+ |-----|--------------|
620
+ | Payload CMS | `src/collections/**/*.ts`, `src/globals/**/*.ts` |
621
+ | Prisma | `prisma/schema.prisma`, `prisma/schema/*.prisma` |
622
+ | Drizzle | `drizzle/schema.ts`, `src/db/schema.ts`, `drizzle/*.ts` |
623
+ | Supabase | `supabase/migrations/*.sql` |
624
+ | TypeORM | `src/entities/**/*.ts`, `src/migrations/**/*.ts` |
625
+
626
+ Also check if any existing SPRINT.md files for this phase already reference these file patterns in `files_modified`.
627
+
628
+ **If schema-relevant files detected:**
629
+
630
+ Set `SCHEMA_PUSH_REQUIRED=true` and `SCHEMA_ORM={detected_orm}`.
631
+
632
+ Determine the push command for the detected ORM:
633
+
634
+ | ORM | Push Command | Non-TTY Workaround |
635
+ |-----|-------------|-------------------|
636
+ | Payload CMS | `npx payload migrate` | `CI=true PAYLOAD_MIGRATING=true npx payload migrate` |
637
+ | Prisma | `npx prisma db push` | `npx prisma db push --accept-data-loss` (if destructive) |
638
+ | Drizzle | `npx drizzle-kit push` | `npx drizzle-kit push` |
639
+ | Supabase | `supabase db push` | Set `SUPABASE_ACCESS_TOKEN` env var |
640
+ | TypeORM | `npx typeorm migration:run` | `npx typeorm migration:run -d src/data-source.ts` |
641
+
642
+ Inject the following into the planner prompt (step 8) as an additional constraint:
643
+
644
+ ```markdown
645
+ <schema_push_requirement>
646
+ **[BLOCKING] Schema Push Required**
647
+
648
+ This phase modifies schema-relevant files ({detected_files}). The planner MUST include
649
+ a `[BLOCKING]` task that runs the database schema push command AFTER all schema file
650
+ modifications are complete but BEFORE verification.
651
+
652
+ - ORM detected: {SCHEMA_ORM}
653
+ - Push command: {push_command}
654
+ - Non-TTY workaround: {env_hint}
655
+ - If push requires interactive prompts that cannot be suppressed, flag the task for
656
+ manual intervention with `autonomous: false`
657
+
658
+ This task is mandatory — the phase CANNOT pass verification without it. Build and
659
+ type checks will pass without the push (types come from config, not the live database),
660
+ creating a false-positive verification state.
661
+ </schema_push_requirement>
662
+ ```
663
+
664
+ Display: `Schema files detected ({SCHEMA_ORM}) — [BLOCKING] push task will be injected into plans`
665
+
666
+ **If no schema-relevant files detected:** Skip silently to step 6.
667
+
668
+ ## 6. Check Existing Plans
669
+
670
+ ```bash
671
+ ls "${PHASE_DIR}"/*-SPRINT.md 2>/dev/null || true
672
+ ```
673
+
674
+ **If exists AND `--reviews` flag:** Skip prompt — go straight to replanning (the purpose of `--reviews` is to replan with review feedback).
675
+
676
+ **If exists AND no `--reviews` flag:** Offer: 1) Add more plans, 2) View existing, 3) Replan from scratch.
677
+
678
+ ## 7. Use Context Paths from INIT
679
+
680
+ Extract from INIT JSON:
681
+
682
+ ```bash
683
+ _rihal_field() { node -e "const o=JSON.parse(process.argv[1]); const v=o[process.argv[2]]; process.stdout.write(v==null?'':String(v))" "$1" "$2"; }
684
+ STATE_PATH=$(_rihal_field "$INIT" state_path)
685
+ ROADMAP_PATH=$(_rihal_field "$INIT" roadmap_path)
686
+ REQUIREMENTS_PATH=$(_rihal_field "$INIT" requirements_path)
687
+ RESEARCH_PATH=$(_rihal_field "$INIT" research_path)
688
+ VERIFICATION_PATH=$(_rihal_field "$INIT" verification_path)
689
+ UAT_PATH=$(_rihal_field "$INIT" uat_path)
690
+ CONTEXT_PATH=$(_rihal_field "$INIT" context_path)
691
+ REVIEWS_PATH=$(_rihal_field "$INIT" reviews_path)
692
+ ```
693
+
694
+ ## 7.5. Verify Nyquist Artifacts
695
+
696
+ Skip if `nyquist_validation_enabled` is false OR `research_enabled` is false.
697
+
698
+ Also skip if all of the following are true:
699
+ - `research_enabled` is false
700
+ - `has_research` is false
701
+ - no `--research` flag was provided
702
+
703
+ In that no-research path, Nyquist artifacts are **not required** for this run.
704
+
705
+ ```bash
706
+ VALIDATION_EXISTS=$(ls "${PHASE_DIR}"/*-VALIDATION.md 2>/dev/null | head -1)
707
+ ```
708
+
709
+ If missing and Nyquist is still enabled/applicable — ask user:
710
+ 1. Re-run: `/rihal:sprint-plan {PHASE} --research ${Rihal_WS}`
711
+ 2. Disable Nyquist with the exact command:
712
+ `node ".rihal/bin/rihal-tools.cjs" config-set workflow.nyquist_validation false`
713
+ 3. Continue anyway (plans fail Dimension 8)
714
+
715
+ Proceed to Step 8 only if user selects 2 or 3.
716
+
717
+ ## 8. Spawn rihal-planner Agent
718
+
719
+ Display banner:
720
+ ```
721
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
722
+ Rihal ► PLANNING PHASE {X}
723
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
724
+
725
+ ◆ Spawning planner...
726
+ ```
727
+
728
+ **Gap-closure planner prompt (when `GAPS_MODE=true`):**
729
+
730
+ When `GAPS_MODE=true`, use the prompt below in place of the standard planner prompt. The planner must emit **exactly one** new plan file at `${GAP_PLAN_PATH}` that closes the listed gaps. Do not create CONTEXT.md or RESEARCH.md references — gaps are grounded in already-shipped code.
731
+
732
+ ```markdown
733
+ <planning_context>
734
+ **Phase:** {phase_number}
735
+ **Mode:** gap_closure
736
+ **Phase goal:** {goal from ROADMAP.md}
737
+
738
+ <files_to_read>
739
+ - {VERIFICATION_FILE} (Authoritative verification report — source of truth for gaps)
740
+ - {state_path} (Project State)
741
+ - {roadmap_path} (Roadmap)
742
+ - {requirements_path} (Requirements)
743
+ - Existing plan files in this phase: {EXISTING_PLAN_FILES}
744
+ - Existing summary files in this phase: {EXISTING_SUMMARY_FILES}
745
+ </files_to_read>
746
+
747
+ ${AGENT_SKILLS_PLANNER}
748
+
749
+ <gap_list>
750
+ {Serialized GAP_LIST — for each gap include id, title, expected behavior, actual behavior, status (gap_found|partial), and source section.}
751
+ </gap_list>
752
+
753
+ <output>
754
+ Write a single new plan file to: {GAP_PLAN_PATH}
755
+
756
+ Frontmatter MUST include:
757
+ ---
758
+ phase: {phase_number}
759
+ plan_number: {NEXT_PLAN_NUMBER}
760
+ gap_closure: true
761
+ wave: 1
762
+ depends_on: []
763
+ files_modified: [...]
764
+ autonomous: true|false
765
+ ---
766
+
767
+ Each gap in the list MUST be addressed by at least one task. Use the anti-shallow execution rules below.
768
+ </output>
769
+ </planning_context>
770
+ ```
771
+
772
+ Proceed to the standard planner Task invocation below, but pass the gap-closure prompt above. After the planner returns, the normal plan-checker / revision loop (step 10+) runs unchanged.
773
+
774
+ ---
775
+
776
+ **Standard planner prompt (when `GAPS_MODE=false`):**
777
+
778
+ Planner prompt:
779
+
780
+ ```markdown
781
+ <planning_context>
782
+ **Phase:** {phase_number}
783
+ **Mode:** {standard | gap_closure | reviews}
784
+
785
+ <files_to_read>
786
+ - {state_path} (Project State)
787
+ - {roadmap_path} (Roadmap)
788
+ - {requirements_path} (Requirements)
789
+ - {context_path} (USER DECISIONS from /rihal:discuss-phase)
790
+ - {research_path} (Technical Research)
791
+ - {verification_path} (Verification Gaps - if --gaps)
792
+ - {uat_path} (UAT Gaps - if --gaps)
793
+ - {reviews_path} (Cross-AI Review Feedback - if --reviews)
794
+ - {UI_SPEC_PATH} (UI Design Contract — visual/interaction specs, if exists)
795
+ ${CONTEXT_WINDOW >= 500000 ? `
796
+ **Cross-phase context (1M model enrichment):**
797
+ - Prior phase CONTEXT.md files (locked decisions from earlier phases — maintain consistency)
798
+ - Prior phase SUMMARY.md files (what was actually built — reuse patterns, avoid duplication)
799
+ ` : ''}
800
+ </files_to_read>
801
+
802
+ ${AGENT_SKILLS_PLANNER}
803
+
804
+ **Phase requirement IDs (every ID MUST appear in a plan's `requirements` field):** {phase_req_ids}
805
+
806
+ **Project instructions:** Read ./CLAUDE.md if exists — follow project-specific guidelines
807
+ **Project skills:** Check .claude/skills/ or .agents/skills/ directory (if either exists) — read SKILL.md files, plans should account for project skill rules
808
+
809
+ </planning_context>
810
+
811
+ <downstream_consumer>
812
+ Output consumed by /rihal:execute-phase. Plans need:
813
+ - Frontmatter (wave, depends_on, files_modified, autonomous)
814
+ - Tasks in XML format with read_first and acceptance_criteria fields (MANDATORY on every task)
815
+ - Verification criteria
816
+ - must_haves for goal-backward verification
817
+ </downstream_consumer>
818
+
819
+ <deep_work_rules>
820
+ ## Anti-Shallow Execution Rules (MANDATORY)
821
+
822
+ Every task MUST include these fields — they are NOT optional:
823
+
824
+ 1. **`<read_first>`** — Files the executor MUST read before touching anything. Always include:
825
+ - The file being modified (so executor sees current state, not assumptions)
826
+ - Any "source of truth" file referenced in CONTEXT.md (reference implementations, existing patterns, config files, schemas)
827
+ - Any file whose patterns, signatures, types, or conventions must be replicated or respected
828
+
829
+ 2. **`<acceptance_criteria>`** — Verifiable conditions that prove the task was done correctly. Rules:
830
+ - Every criterion must be checkable with grep, file read, test command, or CLI output
831
+ - NEVER use subjective language ("looks correct", "properly configured", "consistent with")
832
+ - ALWAYS include exact strings, patterns, values, or command outputs that must be present
833
+ - Examples:
834
+ - Code: `auth.py contains def verify_token(` / `test_auth.py exits 0`
835
+ - Config: `.env.example contains DATABASE_URL=` / `Dockerfile contains HEALTHCHECK`
836
+ - Docs: `README.md contains '## Installation'` / `API.md lists all endpoints`
837
+ - Infra: `deploy.yml has rollback step` / `docker-compose.yml has healthcheck for db`
838
+
839
+ 3. **`<action>`** — Must include CONCRETE values, not references. Rules:
840
+ - NEVER say "align X with Y", "match X to Y", "update to be consistent" without specifying the exact target state
841
+ - ALWAYS include the actual values: config keys, function signatures, SQL statements, class names, import paths, env vars, etc.
842
+ - If CONTEXT.md has a comparison table or expected values, copy them into the action verbatim
843
+ - The executor should be able to complete the task from the action text alone, without needing to read CONTEXT.md or reference files (read_first is for verification, not discovery)
844
+
845
+ **Why this matters:** Executor agents work from the plan text. Vague instructions like "update the config to match production" produce shallow one-line changes. Concrete instructions like "add DATABASE_URL=postgresql://... , set POOL_SIZE=20, add REDIS_URL=redis://..." produce complete work. The cost of verbose plans is far less than the cost of re-doing shallow execution.
846
+ </deep_work_rules>
847
+
848
+ <quality_gate>
849
+ - [ ] SPRINT.md files created in phase directory
850
+ - [ ] Each plan has valid frontmatter
851
+ - [ ] Tasks are specific and actionable
852
+ - [ ] Every task has `<read_first>` with at least the file being modified
853
+ - [ ] Every task has `<acceptance_criteria>` with grep-verifiable conditions
854
+ - [ ] Every `<action>` contains concrete values (no "align X with Y" without specifying what)
855
+ - [ ] Dependencies correctly identified
856
+ - [ ] Waves assigned for parallel execution
857
+ - [ ] must_haves derived from phase goal
858
+ </quality_gate>
859
+ ```
860
+
861
+ ```
862
+ Task(
863
+ prompt=filled_prompt,
864
+ subagent_type="rihal-planner",
865
+ model="{planner_model}",
866
+ description="Plan Phase {phase}"
867
+ )
868
+ ```
869
+
870
+ ## 9. Handle Planner Return
871
+
872
+ - **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): skip to step 13. Otherwise: step 10.
873
+ - **`## PHASE SPLIT RECOMMENDED`:** The planner determined the phase is too complex to implement all user decisions without simplifying them. Handle in step 9b.
874
+ - **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation (step 12)
875
+ - **`## PLANNING INCONCLUSIVE`:** Show attempts, offer: Add context / Retry / Manual
876
+
877
+ ## 9b. Handle Phase Split Recommendation
878
+
879
+ When the planner returns `## PHASE SPLIT RECOMMENDED`, it means the phase has too many decisions to implement at full fidelity within the plan budget. The planner proposes groupings.
880
+
881
+ **Extract from planner return:**
882
+ - Proposed sub-phases (e.g., "17a: processing core (D-01 to D-19)", "17b: billing + config UX (D-20 to D-27)")
883
+ - Which D-XX decisions go in each sub-phase
884
+ - Why the split is necessary (decision count, complexity estimate)
885
+
886
+ **Present to user:**
887
+ ```
888
+ ## Phase {X} is too complex for full-fidelity implementation
889
+
890
+ The planner found {N} decisions that cannot all be implemented without
891
+ simplifying some. Instead of reducing your decisions, we recommend splitting:
892
+
893
+ **Option 1: Split into sub-phases**
894
+ - Phase {X}a: {name} — {D-XX to D-YY} ({N} decisions)
895
+ - Phase {X}b: {name} — {D-XX to D-YY} ({M} decisions)
896
+
897
+ **Option 2: Proceed anyway** (planner will attempt all, quality may degrade)
898
+
899
+ **Option 3: Prioritize** — you choose which decisions to implement now,
900
+ rest become a follow-up phase
901
+ ```
902
+
903
+ Use AskUserQuestion with these 3 options.
904
+
905
+ **If "Split":** Use `/rihal:insert-phase` to create the sub-phases, then replan each.
906
+ **If "Proceed":** Return to planner with instruction to attempt all decisions at full fidelity, accepting more plans/tasks.
907
+ **If "Prioritize":** Use AskUserQuestion (multiSelect) to let user pick which D-XX are "now" vs "later". Create CONTEXT.md for each sub-phase with the selected decisions.
908
+
909
+ ## 10. Spawn rihal-sprint-checker Agent
910
+
911
+ Display banner:
912
+ ```
913
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
914
+ Rihal ► VERIFYING PLANS
915
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
916
+
917
+ ◆ Spawning plan checker...
918
+ ```
919
+
920
+ Checker prompt:
921
+
922
+ ```markdown
923
+ <verification_context>
924
+ **Phase:** {phase_number}
925
+ **Phase Goal:** {goal from ROADMAP}
926
+
927
+ <files_to_read>
928
+ - {PHASE_DIR}/*-SPRINT.md (Plans to verify)
929
+ - {roadmap_path} (Roadmap)
930
+ - {requirements_path} (Requirements)
931
+ - {context_path} (USER DECISIONS from /rihal:discuss-phase)
932
+ - {research_path} (Technical Research — includes Validation Architecture)
933
+ </files_to_read>
934
+
935
+ ${AGENT_SKILLS_CHECKER}
936
+
937
+ **Phase requirement IDs (MUST ALL be covered):** {phase_req_ids}
938
+
939
+ **Project instructions:** Read ./CLAUDE.md if exists — verify plans honor project guidelines
940
+ **Project skills:** Check .claude/skills/ or .agents/skills/ directory (if either exists) — verify plans account for project skill rules
941
+ </verification_context>
942
+
943
+ <expected_output>
944
+ - ## VERIFICATION PASSED — all checks pass
945
+ - ## ISSUES FOUND — structured issue list
946
+ </expected_output>
947
+ ```
948
+
949
+ ```
950
+ Task(
951
+ prompt=checker_prompt,
952
+ subagent_type="rihal-sprint-checker",
953
+ model="{checker_model}",
954
+ description="Verify Phase {phase} plans"
955
+ )
956
+ ```
957
+
958
+ ## 11. Handle Checker Return
959
+
960
+ - **`## VERIFICATION PASSED`:** Display confirmation, proceed to step 13.
961
+ - **`## ISSUES FOUND`:** Display issues, check iteration count, proceed to step 12.
962
+
963
+ **Thinking partner for architectural tradeoffs (conditional):**
964
+ If `features.thinking_partner` is enabled, scan the checker's issues for architectural tradeoff keywords
965
+ ("architecture", "approach", "strategy", "pattern", "vs", "alternative"). If found:
966
+
967
+ ```
968
+ The sprint-checker flagged an architectural decision point:
969
+ {issue description}
970
+
971
+ Brief analysis:
972
+ - Option A: {approach_from_plan} — {pros/cons}
973
+ - Option B: {alternative_approach} — {pros/cons}
974
+ - Recommendation: {choice} aligned with {phase_goal}
975
+
976
+ Apply this to the revision? [Yes] / [No, I'll decide]
977
+ ```
978
+
979
+ If yes: include the recommendation in the revision prompt. If no: proceed to revision loop as normal.
980
+ If thinking_partner disabled: skip this block entirely.
981
+
982
+ ## 12. Revision Loop (Max 3 Iterations)
983
+
984
+ Track `iteration_count` (starts at 1 after initial plan + check).
985
+ Track `prev_issue_count` (initialized to `Infinity` before the loop begins).
986
+ Track `stall_reentry_count` (starts at 0; incremented each time "Adjust approach" re-enters step 8).
987
+
988
+ **If iteration_count < 3:**
989
+
990
+ Parse issue count from checker return: count BLOCKER + WARNING entries in the YAML issues block (structured output from rihal-sprint-checker). If the checker's return contains no YAML issues block (i.e., the plan was approved with no issues), treat `issue_count` as 0 and skip the stall check — the plan passed. Proceed to step 13.
991
+
992
+ Display: `Revision iteration {N}/3 -- {blocker_count} blockers, {warning_count} warnings`
993
+
994
+ **Stall detection:** If `issue_count >= prev_issue_count`:
995
+ Display: `Revision loop stalled — issue count not decreasing ({issue_count} issues remain after {N} iterations)`
996
+
997
+ **If `stall_reentry_count < 2`:**
998
+ Ask user:
999
+ Question: "Issues remain after {N} revision attempts with no progress. Proceed with current output?"
1000
+ Options: "Proceed anyway" | "Adjust approach"
1001
+ If "Proceed anyway": accept current plans and continue to step 13.
1002
+ If "Adjust approach": increment `stall_reentry_count`, open freeform discussion, then re-enter step 8 (full replanning). Note: re-entry resets `iteration_count` and `prev_issue_count` but `stall_reentry_count` persists across re-entries and is capped at 2.
1003
+
1004
+ **If `stall_reentry_count >= 2`:**
1005
+ Display: `Stall persists after 2 re-planning attempts. The following issues could not be resolved automatically:`
1006
+ List the remaining issues from the checker.
1007
+ Suggest: "Consider resolving these issues manually or running `/rihal:debug` to investigate root causes."
1008
+ Options: "Proceed anyway" | "Abandon"
1009
+ If "Proceed anyway": accept current plans and continue to step 13.
1010
+ If "Abandon": stop workflow.
1011
+
1012
+ Set `prev_issue_count = issue_count`.
1013
+
1014
+ Revision prompt:
1015
+
1016
+ ```markdown
1017
+ <revision_context>
1018
+ **Phase:** {phase_number}
1019
+ **Mode:** revision
1020
+
1021
+ <files_to_read>
1022
+ - {PHASE_DIR}/*-SPRINT.md (Existing plans)
1023
+ - {context_path} (USER DECISIONS from /rihal:discuss-phase)
1024
+ </files_to_read>
1025
+
1026
+ ${AGENT_SKILLS_PLANNER}
1027
+
1028
+ **Checker issues:** {structured_issues_from_checker}
1029
+ </revision_context>
1030
+
1031
+ <instructions>
1032
+ Make targeted updates to address checker issues.
1033
+ Do NOT replan from scratch unless issues are fundamental.
1034
+ Return what changed.
1035
+ </instructions>
1036
+ ```
1037
+
1038
+ ```
1039
+ Task(
1040
+ prompt=revision_prompt,
1041
+ subagent_type="rihal-planner",
1042
+ model="{planner_model}",
1043
+ description="Revise Phase {phase} plans"
1044
+ )
1045
+ ```
1046
+
1047
+ After planner returns -> spawn checker again (step 10), increment iteration_count.
1048
+
1049
+ **If iteration_count >= 3:**
1050
+
1051
+ Display: `Max iterations reached. {N} issues remain:` + issue list
1052
+
1053
+ Offer: 1) Force proceed, 2) Provide guidance and retry, 3) Abandon
1054
+
1055
+ ## 13. Requirements Coverage Gate
1056
+
1057
+ After plans pass the checker (or checker is skipped), verify that all phase requirements are covered by at least one plan.
1058
+
1059
+ **Skip if:** `phase_req_ids` is null or TBD (no requirements mapped to this phase).
1060
+
1061
+ **Step 1: Extract requirement IDs claimed by plans**
1062
+ ```bash
1063
+ # Collect all requirement IDs from plan frontmatter
1064
+ PLAN_REQS=$(grep -h "requirements_addressed\|requirements:" ${PHASE_DIR}/*-SPRINT.md 2>/dev/null | tr -d '[]' | tr ',' '\n' | sed 's/^[[:space:]]*//' | sort -u)
1065
+ ```
1066
+
1067
+ **Step 2: Compare against phase requirements from ROADMAP**
1068
+
1069
+ For each REQ-ID in `phase_req_ids`:
1070
+ - If REQ-ID appears in `PLAN_REQS` → covered ✓
1071
+ - If REQ-ID does NOT appear in any plan → uncovered ✗
1072
+
1073
+ **Step 3: Check CONTEXT.md features against plan objectives**
1074
+
1075
+ Read CONTEXT.md `<decisions>` section. Extract feature/capability names. Check each against plan `<objective>` blocks. Features not mentioned in any plan objective → potentially dropped.
1076
+
1077
+ **Step 4: Report**
1078
+
1079
+ If all requirements covered and no dropped features:
1080
+ ```
1081
+ ✓ Requirements coverage: {N}/{N} REQ-IDs covered by plans
1082
+ ```
1083
+ → Proceed to step 14.
1084
+
1085
+ If gaps found:
1086
+ ```
1087
+ ## ⚠ Requirements Coverage Gap
1088
+
1089
+ {M} of {N} phase requirements are not assigned to any plan:
1090
+
1091
+ | REQ-ID | Description | Plans |
1092
+ |--------|-------------|-------|
1093
+ | {id} | {from REQUIREMENTS.md} | None |
1094
+
1095
+ {K} CONTEXT.md features not found in plan objectives:
1096
+ - {feature_name} — described in CONTEXT.md but no plan covers it
1097
+
1098
+ Options:
1099
+ 1. Re-plan to include missing requirements (recommended)
1100
+ 2. Move uncovered requirements to next phase
1101
+ 3. Proceed anyway — accept coverage gaps
1102
+ ```
1103
+
1104
+ If `TEXT_MODE` is true, present as a plain-text numbered list (options already shown in the block above). Otherwise use AskUserQuestion to present the options.
1105
+
1106
+ ## 13b. Record Planning Completion in STATE.md
1107
+
1108
+ After plans pass all gates, record that planning is complete so STATE.md reflects the new phase status:
1109
+
1110
+ ```bash
1111
+ node ".rihal/bin/rihal-tools.cjs" state planned-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}"
1112
+ ```
1113
+
1114
+ This updates STATUS to "Ready to execute", sets the correct plan count, and timestamps Last Activity.
1115
+
1116
+ ## 14. Present Final Status
1117
+
1118
+ Route to `<offer_next>` OR `auto_advance` depending on flags/config.
1119
+
1120
+ ## 15. Auto-Advance Check
1121
+
1122
+ Check for auto-advance trigger:
1123
+
1124
+ 1. Parse `--auto` and `--chain` flags from $ARGUMENTS
1125
+ 2. **Sync chain flag with intent** — if user invoked manually (no `--auto` and no `--chain`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference):
1126
+ ```bash
1127
+ if [[ ! "$ARGUMENTS" =~ --auto ]] && [[ ! "$ARGUMENTS" =~ --chain ]]; then
1128
+ node ".rihal/bin/rihal-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
1129
+ fi
1130
+ ```
1131
+ 3. Read both the chain flag and user preference:
1132
+ ```bash
1133
+ AUTO_CHAIN=$(node ".rihal/bin/rihal-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
1134
+ AUTO_CFG=$(node ".rihal/bin/rihal-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
1135
+ ```
1136
+
1137
+ **If `--auto` or `--chain` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct invocation without prior discuss-phase):
1138
+ ```bash
1139
+ if ([[ "$ARGUMENTS" =~ --auto ]] || [[ "$ARGUMENTS" =~ --chain ]]) && [[ "$AUTO_CHAIN" != "true" ]]; then
1140
+ node ".rihal/bin/rihal-tools.cjs" config-set workflow._auto_chain_active true
1141
+ fi
1142
+ ```
1143
+
1144
+ **If `--auto` or `--chain` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
1145
+
1146
+ Display banner:
1147
+ ```
1148
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1149
+ Rihal ► AUTO-ADVANCING TO EXECUTE
1150
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1151
+
1152
+ Plans ready. Launching execute-phase...
1153
+ ```
1154
+
1155
+ Launch execute-phase using the Skill tool to avoid nested Task sessions (which cause runtime freezes due to deep agent nesting):
1156
+ ```
1157
+ Skill(skill="rihal-execute-phase", args="${PHASE} --auto --no-transition ${Rihal_WS}")
1158
+ ```
1159
+
1160
+ The `--no-transition` flag tells execute-phase to return status after verification instead of chaining further. This keeps the auto-advance chain flat — each phase runs at the same nesting level rather than spawning deeper Task agents.
1161
+
1162
+ **Handle execute-phase return:**
1163
+ - **PHASE COMPLETE** → Display final summary:
1164
+ ```
1165
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1166
+ Rihal ► PHASE ${PHASE} COMPLETE ✓
1167
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1168
+
1169
+ Auto-advance pipeline finished.
1170
+
1171
+ Next: /rihal:discuss-phase ${NEXT_PHASE} --auto ${Rihal_WS}
1172
+ ```
1173
+ - **GAPS FOUND / VERIFICATION FAILED** → Display result, stop chain:
1174
+ ```
1175
+ Auto-advance stopped: Execution needs review.
1176
+
1177
+ Review the output above and continue manually:
1178
+ /rihal:execute-phase ${PHASE} ${Rihal_WS}
1179
+ ```
1180
+
1181
+ **If neither `--auto` nor config enabled:**
1182
+ Route to `<offer_next>` (existing behavior).
1183
+
1184
+ </process>
1185
+
1186
+ <offer_next>
1187
+ Output this markdown directly (not as a code block):
1188
+
1189
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1190
+ Rihal ► PHASE {X} PLANNED ✓
1191
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1192
+
1193
+ **Phase {X}: {Name}** — {N} plan(s) in {M} wave(s)
1194
+
1195
+ | Wave | Plans | What it builds |
1196
+ |------|-------|----------------|
1197
+ | 1 | 01, 02 | [objectives] |
1198
+ | 2 | 03 | [objective] |
1199
+
1200
+ Research: {Completed | Used existing | Skipped}
1201
+ Verification: {Passed | Passed with override | Skipped}
1202
+
1203
+ ───────────────────────────────────────────────────────────────
1204
+
1205
+ ## ▶ Next Up
1206
+
1207
+ **Execute Phase {X}** — run all {N} plans
1208
+
1209
+ /clear then:
1210
+
1211
+ /rihal:execute-phase {X} ${Rihal_WS}
1212
+
1213
+ ───────────────────────────────────────────────────────────────
1214
+
1215
+ **Also available:**
1216
+ - cat .planning/phases/{phase-dir}/*-SPRINT.md — review plans
1217
+ - /rihal:sprint-plan {X} --research — re-research first
1218
+ - /rihal:review --phase {X} --all — peer review plans with external AIs
1219
+ - /rihal:sprint-plan {X} --reviews — replan incorporating review feedback
1220
+
1221
+ ───────────────────────────────────────────────────────────────
1222
+ </offer_next>
1223
+
1224
+ <windows_troubleshooting>
1225
+ **Windows users:** If sprint-plan freezes during agent spawning (common on Windows due to
1226
+ stdio deadlocks with MCP servers — see Claude Code issue anthropics/claude-code#28126):
1227
+
1228
+ 1. **Force-kill:** Close the terminal (Ctrl+C may not work)
1229
+ 2. **Clean up orphaned processes:**
1230
+ ```powershell
1231
+ # Kill orphaned node processes from stale MCP servers
1232
+ Get-Process node -ErrorAction SilentlyContinue | Where-Object {$_.StartTime -lt (Get-Date).AddHours(-1)} | Stop-Process -Force
1233
+ ```
1234
+ 3. **Clean up stale task directories:**
1235
+ ```powershell
1236
+ # Remove stale subagent task dirs (Claude Code never cleans these on crash)
1237
+ Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\tasks\*" -ErrorAction SilentlyContinue
1238
+ ```
1239
+ 4. **Reduce MCP server count:** Temporarily disable non-essential MCP servers in settings.json
1240
+ 5. **Retry:** Restart Claude Code and run `/rihal:sprint-plan` again
1241
+
1242
+ If freezes persist, try `--skip-research` to reduce the agent chain from 3 to 2 agents:
1243
+ ```
1244
+ /rihal:sprint-plan N --skip-research
1245
+ ```
1246
+ </windows_troubleshooting>
1247
+
1248
+ <success_criteria>
1249
+ - [ ] .planning/ directory validated
1250
+ - [ ] Phase validated against roadmap
1251
+ - [ ] Phase directory created if needed
1252
+ - [ ] CONTEXT.md loaded early (step 4) and passed to ALL agents
1253
+ - [ ] Research completed (unless --skip-research or --gaps or exists)
1254
+ - [ ] rihal-phase-researcher spawned with CONTEXT.md
1255
+ - [ ] Existing plans checked
1256
+ - [ ] rihal-planner spawned with CONTEXT.md + RESEARCH.md
1257
+ - [ ] Plans created (PLANNING COMPLETE or CHECKPOINT handled)
1258
+ - [ ] rihal-sprint-checker spawned with CONTEXT.md
1259
+ - [ ] Verification passed OR user override OR max iterations with user decision
1260
+ - [ ] User sees status between agent spawns
1261
+ - [ ] User knows next steps
1262
+ </success_criteria>