@hanzlaa/rcode 3.4.3 → 3.4.5

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 (213) hide show
  1. package/AGENTS.md +1 -1
  2. package/CONTRIBUTING.md +63 -1
  3. package/README.md +9 -4
  4. package/cli/generate-command-skills.cjs +5 -5
  5. package/cli/index.js +0 -0
  6. package/cli/install.js +128 -3
  7. package/cli/lib/manifest.cjs +1 -1
  8. package/cli/uninstall.js +8 -0
  9. package/dist/rcode.js +19 -1
  10. package/package.json +16 -17
  11. package/rihal/agents/rihal-ahmed.md +2 -1
  12. package/rihal/agents/rihal-code-fixer.md +46 -0
  13. package/rihal/agents/rihal-code-reviewer.md +46 -1
  14. package/rihal/agents/rihal-deviation-analyzer.md +1 -0
  15. package/rihal/agents/rihal-docs-auditor.md +106 -1
  16. package/rihal/agents/rihal-edge-case-hunter.md +47 -1
  17. package/rihal/agents/rihal-executor.md +1 -1
  18. package/rihal/agents/rihal-khalid.md +40 -1
  19. package/rihal/agents/rihal-layla.md +2 -1
  20. package/rihal/agents/rihal-nasser.md +2 -1
  21. package/rihal/agents/rihal-noor.md +3 -2
  22. package/rihal/agents/rihal-nyquist-auditor.md +1 -1
  23. package/rihal/agents/rihal-phase-researcher.md +46 -1
  24. package/rihal/agents/rihal-planner.md +1 -1
  25. package/rihal/agents/rihal-profiler.md +45 -2
  26. package/rihal/agents/rihal-project-researcher.md +47 -0
  27. package/rihal/agents/rihal-remediation-planner.md +45 -0
  28. package/rihal/agents/rihal-roadmapper.md +46 -0
  29. package/rihal/agents/rihal-security-adversary.md +46 -1
  30. package/rihal/agents/rihal-security-auditor.md +45 -1
  31. package/rihal/agents/rihal-ui-auditor.md +44 -1
  32. package/rihal/agents/rihal-ux-designer.md +41 -1
  33. package/rihal/agents/rihal-zahra.md +2 -1
  34. package/rihal/agents/rihal-zayd.md +2 -1
  35. package/rihal/bin/lib/config.cjs +13 -1
  36. package/rihal/bin/lib/council-panel.cjs +185 -23
  37. package/rihal/bin/lib/roadmap.cjs +27 -2
  38. package/rihal/bin/rihal-tools.cjs +1837 -99
  39. package/rihal/commands/audit.md +2 -2
  40. package/rihal/commands/capture.md +12 -0
  41. package/rihal/commands/diagnose-issues.md +18 -0
  42. package/rihal/commands/discuss-phase-power.md +18 -0
  43. package/rihal/commands/feature-drift.md +18 -0
  44. package/rihal/commands/karpathy-audit.md +18 -0
  45. package/rihal/commands/lens-audit.md +70 -0
  46. package/rihal/commands/new-project-research.md +18 -0
  47. package/rihal/commands/new-project-roadmap.md +18 -0
  48. package/rihal/commands/phase.md +11 -0
  49. package/rihal/references/continuation-format.md +3 -3
  50. package/rihal/references/output-format.md +79 -0
  51. package/rihal/references/revision-loop.md +1 -1
  52. package/rihal/references/verb-dictionary.md +85 -28
  53. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +1 -1
  54. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +12 -2
  55. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/steps/step-04-final-validation.md +12 -0
  56. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +12 -2
  57. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +12 -2
  58. package/rihal/skills/actions/4-implementation/rihal-browser-verify/SKILL.md +1 -1
  59. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +1 -1
  60. package/rihal/skills/actions/4-implementation/rihal-ci/SKILL.md +1 -1
  61. package/rihal/skills/actions/4-implementation/rihal-code-review/SKILL.md +16 -4
  62. package/rihal/skills/actions/4-implementation/rihal-debug/SKILL.md +14 -1
  63. package/rihal/skills/actions/4-implementation/rihal-git-flow/SKILL.md +1 -1
  64. package/rihal/skills/actions/4-implementation/rihal-harden/SKILL.md +1 -1
  65. package/rihal/skills/actions/4-implementation/rihal-incremental/SKILL.md +1 -1
  66. package/rihal/skills/actions/4-implementation/rihal-migrate/SKILL.md +1 -1
  67. package/rihal/skills/actions/4-implementation/rihal-perf/SKILL.md +1 -1
  68. package/rihal/skills/actions/4-implementation/rihal-prove-it/SKILL.md +1 -1
  69. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/steps/step-01-target.md +6 -0
  70. package/rihal/skills/actions/4-implementation/rihal-source-truth/SKILL.md +1 -1
  71. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +14 -3
  72. package/rihal/skills/actions/4-implementation/rihal-trim/SKILL.md +1 -1
  73. package/rihal/skills/agents/ahmed-hassani-director/SKILL.md +15 -1
  74. package/rihal/skills/agents/dalil-scout/SKILL.md +14 -2
  75. package/rihal/skills/agents/fatima-qa/SKILL.md +16 -1
  76. package/rihal/skills/agents/haitham-frontend/SKILL.md +13 -1
  77. package/rihal/skills/agents/hanzla-engineer/SKILL.md +13 -1
  78. package/rihal/skills/agents/hussain-pm/SKILL.md +16 -1
  79. package/rihal/skills/agents/hussain-sm/SKILL.md +14 -1
  80. package/rihal/skills/agents/layla-designer/SKILL.md +13 -1
  81. package/rihal/skills/agents/majlis-council/SKILL.md +16 -1
  82. package/rihal/skills/agents/mariam-marketing/SKILL.md +14 -1
  83. package/rihal/skills/agents/nasser-eng-manager/SKILL.md +16 -1
  84. package/rihal/skills/agents/noor-writer/SKILL.md +15 -1
  85. package/rihal/skills/agents/raees-orchestrator/SKILL.md +15 -1
  86. package/rihal/skills/agents/rihal-cross-platform-auditor/SKILL.md +162 -0
  87. package/rihal/skills/agents/rihal-dep-auditor/SKILL.md +151 -0
  88. package/rihal/skills/agents/rihal-deviation-analyzer/SKILL.md +78 -0
  89. package/rihal/skills/agents/rihal-i18n-auditor/SKILL.md +152 -0
  90. package/rihal/skills/agents/rihal-observability-auditor/SKILL.md +156 -0
  91. package/rihal/skills/agents/sadiq-analyst/SKILL.md +12 -2
  92. package/rihal/skills/agents/waleed-architect/SKILL.md +12 -2
  93. package/rihal/skills/agents/yousef-backend/SKILL.md +12 -2
  94. package/rihal/skills/agents/zahra-branding/SKILL.md +15 -1
  95. package/rihal/skills/agents/zayd-ml/SKILL.md +13 -1
  96. package/rihal/skills/core/rihal-advanced-elicitation/SKILL.md +2 -2
  97. package/rihal/skills/core/rihal-auth-audit/SKILL.md +1 -1
  98. package/rihal/skills/core/rihal-brainstorming/SKILL.md +13 -2
  99. package/rihal/skills/core/rihal-client-gate/SKILL.md +1 -1
  100. package/rihal/skills/core/rihal-clone-website/SKILL.md +11 -1
  101. package/rihal/skills/core/rihal-deploy-unify/SKILL.md +1 -1
  102. package/rihal/skills/core/rihal-distillator/SKILL.md +2 -2
  103. package/rihal/skills/core/rihal-editorial-review-prose/SKILL.md +1 -1
  104. package/rihal/skills/core/rihal-editorial-review-structure/SKILL.md +2 -2
  105. package/rihal/skills/core/rihal-help/SKILL.md +18 -1
  106. package/rihal/skills/core/rihal-incident-record/SKILL.md +1 -1
  107. package/rihal/skills/core/rihal-index-docs/SKILL.md +1 -1
  108. package/rihal/skills/core/rihal-memory-audit/SKILL.md +18 -1
  109. package/rihal/skills/core/rihal-memory-init/SKILL.md +13 -1
  110. package/rihal/skills/core/rihal-memory-update/SKILL.md +13 -1
  111. package/rihal/skills/core/rihal-mvp-graduate/SKILL.md +1 -1
  112. package/rihal/skills/core/rihal-ocr-consistency/SKILL.md +1 -1
  113. package/rihal/skills/core/rihal-rebrand/SKILL.md +1 -1
  114. package/rihal/skills/core/rihal-review-adversarial-general/SKILL.md +1 -1
  115. package/rihal/skills/core/rihal-review-edge-case-hunter/SKILL.md +17 -1
  116. package/rihal/skills/core/rihal-shard-doc/SKILL.md +1 -1
  117. package/rihal/skills/core/rihal-theme-system/SKILL.md +1 -1
  118. package/rihal/team.yaml +0 -7
  119. package/rihal/templates/RESEARCH.md +84 -0
  120. package/rihal/templates/VALIDATION.md +45 -0
  121. package/rihal/templates/memory/INDEX.md +1 -0
  122. package/rihal/templates/memory/project/design-system.md +128 -0
  123. package/rihal/templates/summary.md +33 -3
  124. package/rihal/workflows/add-tests.md +1 -1
  125. package/rihal/workflows/add-todo.md +6 -0
  126. package/rihal/workflows/analyze-dependencies.md +6 -0
  127. package/rihal/workflows/audit-fix.md +12 -0
  128. package/rihal/workflows/audit-milestone.md +2 -2
  129. package/rihal/workflows/audit.md +23 -14
  130. package/rihal/workflows/autonomous-smart-discuss.md +247 -0
  131. package/rihal/workflows/autonomous.md +54 -267
  132. package/rihal/workflows/capture.md +60 -0
  133. package/rihal/workflows/chain.md +1 -1
  134. package/rihal/workflows/code-review-fix.md +6 -3
  135. package/rihal/workflows/code-review.md +34 -10
  136. package/rihal/workflows/complete-milestone.md +17 -8
  137. package/rihal/workflows/correct-course.md +6 -0
  138. package/rihal/workflows/council.md +37 -23
  139. package/rihal/workflows/create-architecture.md +31 -0
  140. package/rihal/workflows/create-epics-and-stories.md +7 -1
  141. package/rihal/workflows/create-prd.md +25 -0
  142. package/rihal/workflows/dashboard.md +1 -1
  143. package/rihal/workflows/debug.md +8 -0
  144. package/rihal/workflows/decisions.md +1 -1
  145. package/rihal/workflows/diff.md +6 -0
  146. package/rihal/workflows/discuss-phase-discuss-areas.md +271 -0
  147. package/rihal/workflows/discuss-phase.md +27 -266
  148. package/rihal/workflows/do.md +51 -12
  149. package/rihal/workflows/docs-update.md +3 -0
  150. package/rihal/workflows/document-project.md +7 -1
  151. package/rihal/workflows/edit-prd.md +31 -0
  152. package/rihal/workflows/enable-hooks.md +1 -1
  153. package/rihal/workflows/execute-regression-gates.md +131 -0
  154. package/rihal/workflows/execute-sprint.md +31 -2
  155. package/rihal/workflows/execute-verify-phase-goal.md +136 -0
  156. package/rihal/workflows/execute-waves.md +404 -0
  157. package/rihal/workflows/execute.md +101 -642
  158. package/rihal/workflows/feature-drift.md +243 -0
  159. package/rihal/workflows/forensics.md +10 -2
  160. package/rihal/workflows/health.md +65 -16
  161. package/rihal/workflows/help.md +36 -9
  162. package/rihal/workflows/import.md +17 -3
  163. package/rihal/workflows/init.md +20 -10
  164. package/rihal/workflows/install.md +2 -10
  165. package/rihal/workflows/lens-audit.md +689 -0
  166. package/rihal/workflows/map-codebase.md +7 -1
  167. package/rihal/workflows/memory-audit.md +67 -5
  168. package/rihal/workflows/memory-distill.md +10 -0
  169. package/rihal/workflows/memory-init.md +4 -0
  170. package/rihal/workflows/memory-update.md +4 -0
  171. package/rihal/workflows/new-milestone.md +7 -1
  172. package/rihal/workflows/new-project-create-roadmap.md +176 -0
  173. package/rihal/workflows/new-project-define-requirements.md +160 -0
  174. package/rihal/workflows/new-project-research-decision.md +247 -0
  175. package/rihal/workflows/new-project.md +3 -557
  176. package/rihal/workflows/note.md +1 -1
  177. package/rihal/workflows/phase.md +54 -0
  178. package/rihal/workflows/plan-milestone-gaps.md +1 -1
  179. package/rihal/workflows/plan-prd-express.md +108 -0
  180. package/rihal/workflows/plan-research-validation.md +313 -0
  181. package/rihal/workflows/plan-spawn-planner.md +204 -0
  182. package/rihal/workflows/plan.md +91 -532
  183. package/rihal/workflows/plant-seed.md +1 -1
  184. package/rihal/workflows/pr-branch.md +1 -1
  185. package/rihal/workflows/profile-user.md +1 -1
  186. package/rihal/workflows/quick.md +3 -3
  187. package/rihal/workflows/remove-phase.md +6 -1
  188. package/rihal/workflows/remove-workspace.md +6 -0
  189. package/rihal/workflows/rerun.md +1 -1
  190. package/rihal/workflows/research-phase.md +4 -2
  191. package/rihal/workflows/resume-work.md +8 -3
  192. package/rihal/workflows/retrospective.md +31 -0
  193. package/rihal/workflows/review-adversarial.md +12 -0
  194. package/rihal/workflows/review.md +6 -0
  195. package/rihal/workflows/scaffold-project.md +31 -0
  196. package/rihal/workflows/scan.md +10 -0
  197. package/rihal/workflows/secure-phase.md +15 -2
  198. package/rihal/workflows/session-report.md +32 -7
  199. package/rihal/workflows/ship.md +7 -2
  200. package/rihal/workflows/show.md +6 -0
  201. package/rihal/workflows/sprint-status.md +4 -4
  202. package/rihal/workflows/status.md +2 -2
  203. package/rihal/workflows/ui-phase.md +1 -1
  204. package/rihal/workflows/undo.md +2 -3
  205. package/rihal/workflows/update.md +2 -2
  206. package/rihal/workflows/validate-phase.md +1 -1
  207. package/rihal/workflows/validate-prd.md +31 -0
  208. package/rihal/workflows/verify-phase.md +38 -5
  209. package/rihal/workflows/verify-work.md +25 -11
  210. package/rihal/workflows/workstream.md +20 -8
  211. package/server/lib/html/client.js +13 -63
  212. package/server/lib/html/shell.js +0 -1
  213. package/server/lib/scanner.js +33 -2
@@ -146,7 +146,7 @@ node ".rihal/bin/rihal-tools.cjs" commit "docs: plant seed — {$IDEA}" --files
146
146
 
147
147
  <step name="confirm">
148
148
  ```
149
- Seed planted: SEED-{PADDED}
149
+ Seed planted: SEED-{PADDED}
150
150
 
151
151
  "{$IDEA}"
152
152
  Trigger: {$TRIGGER}
@@ -104,7 +104,7 @@ PR_COMMITS=$(git rev-list --count "$TARGET".."$PR_BRANCH")
104
104
 
105
105
  Display results:
106
106
  ```
107
- PR branch created: {PR_BRANCH}
107
+ PR branch created: {PR_BRANCH}
108
108
 
109
109
  Original: {AHEAD} commits, {ORIGINAL_FILES} files
110
110
  PR branch: {PR_COMMITS} commits, {TOTAL_FILES} files
@@ -137,7 +137,7 @@ node .rihal/bin/rihal-tools.cjs state set-user-profile --json '{json-string}'
137
137
 
138
138
  Print:
139
139
  ```
140
- Profile saved: {profile_path}
140
+ Profile saved: {profile_path}
141
141
 
142
142
  Dimensions:
143
143
  • Communication: {communication}
@@ -142,7 +142,7 @@ Common blocker types:
142
142
  At the end of the loop, summarise:
143
143
 
144
144
  ```
145
- Loop complete: {N} done · {M} skipped · {K} blocked
145
+ Loop complete: {N} done · {M} skipped · {K} blocked
146
146
  Done: {bullet list with commit hashes}
147
147
  Skipped: {bullet list with reasons}
148
148
  Blocked: {bullet list with what info is needed}
@@ -165,7 +165,7 @@ If `.planning/STATE.md` exists with a "Quick Tasks Completed" table, append:
165
165
 
166
166
  ```bash
167
167
  if grep -q "Quick Tasks Completed" .planning/STATE.md 2>/dev/null; then
168
- echo "| $(date +%Y-%m-%d) | quick | $TASK | |" >> .planning/STATE.md
168
+ echo "| $(date +%Y-%m-%d) | quick | $TASK | |" >> .planning/STATE.md
169
169
  fi
170
170
  ```
171
171
 
@@ -176,7 +176,7 @@ Skip silently if the table doesn't exist.
176
176
  Report completion:
177
177
 
178
178
  ```
179
- Done: {what was changed}
179
+ Done: {what was changed}
180
180
  Commit: {short hash}
181
181
  Files: {list of changed files}
182
182
  ```
@@ -29,10 +29,15 @@ Exit.
29
29
  Load phase operation context:
30
30
 
31
31
  ```bash
32
- INIT=$(node ".rihal/bin/rihal-tools.cjs" init phase-op "${target}")
32
+ INIT=$(node ".rihal/bin/rihal-tools.cjs" init phase-op "${target}" 2>/dev/null)
33
33
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
34
34
  ```
35
35
 
36
+ If `INIT` is empty or `INIT.ok` is false, print error and exit:
37
+ ```
38
+ Error: rihal-tools init failed. Verify .rihal/ is installed and state.json is valid.
39
+ ```
40
+
36
41
  Extract: `phase_found`, `phase_dir`, `phase_number`, `commit_docs`, `roadmap_exists`.
37
42
 
38
43
  Also read STATE.md and ROADMAP.md content for parsing current position.
@@ -94,6 +94,12 @@ echo "✓ Workspace archived: $ARCHIVE_PATH"
94
94
  ## Step 5 — Delete workspace directory
95
95
 
96
96
  ```bash
97
+ PROJECT_ROOT="$(pwd)"
98
+ REAL_WS="$(realpath "$WORKSPACE_PATH" 2>/dev/null || echo "")"
99
+ if [[ -z "$REAL_WS" || "$REAL_WS" != "$PROJECT_ROOT"/* ]]; then
100
+ echo "⚠ SECURITY: workspace path '$WORKSPACE_PATH' escapes project root — aborting"
101
+ exit 1
102
+ fi
97
103
  rm -rf "$WORKSPACE_PATH"
98
104
  ```
99
105
 
@@ -55,7 +55,7 @@ Write updated state.json back
55
55
 
56
56
  ## Step 3: Invoke Execute
57
57
 
58
- Route to `/rihal-execute-phase {target.id}`
58
+ Route to `/rihal-execute {target.id}`
59
59
 
60
60
  The executor will:
61
61
  - See status=pending in state.json
@@ -39,9 +39,11 @@ If exists: Offer update/view/skip options.
39
39
  ## Step 3: Gather Phase Context
40
40
 
41
41
  ```bash
42
- INIT=$(node ".rihal/bin/rihal-tools.cjs" init phase-op "${PHASE}")
42
+ INIT=$(node ".rihal/bin/rihal-tools.cjs" init phase-op "${PHASE}" 2>/dev/null)
43
43
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
44
- # Extract: phase_dir, padded_phase, phase_number, state_path, requirements_path, context_path
44
+ # If INIT is empty or INIT.ok is false: print "Error: rihal-tools init failed." and exit.
45
+ # Extract: phase_dir, padded_phase, phase_number, state_path, requirements_path, context_path, response_language
46
+ # If response_language is set, include "Respond in {value}." in all spawned subagent prompts.
45
47
  AGENT_SKILLS_RESEARCHER=$(node ".rihal/bin/rihal-tools.cjs" agent-skills rihal-researcher 2>/dev/null)
46
48
  ```
47
49
 
@@ -20,10 +20,15 @@ Instantly restore full project context so "Where were we?" has an immediate, com
20
20
  Load all context in one call:
21
21
 
22
22
  ```bash
23
- INIT=$(node ".rihal/bin/rihal-tools.cjs" init resume)
23
+ INIT=$(node ".rihal/bin/rihal-tools.cjs" init resume 2>/dev/null)
24
24
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
25
25
  ```
26
26
 
27
+ If `INIT` is empty or `INIT.ok` is false, print error and exit:
28
+ ```
29
+ Error: rihal-tools init failed. Is .rihal/ installed? Run: npx @hanzlaa/rcode install
30
+ ```
31
+
27
32
  Parse JSON for: `state_exists`, `roadmap_exists`, `project_exists`, `planning_exists`, `has_interrupted_agent`, `interrupted_agent_id`, `commit_docs`.
28
33
 
29
34
  **If `state_exists` is true:** Proceed to load_state
@@ -200,7 +205,7 @@ What would you like to do?
200
205
  [Primary action based on state - e.g.:]
201
206
  1. Resume interrupted agent [if interrupted agent found]
202
207
  OR
203
- 1. Execute phase (/rihal-execute-phase {phase} ${Rihal_WS})
208
+ 1. Execute phase (/rihal-execute {phase} ${Rihal_WS})
204
209
  OR
205
210
  1. Discuss Phase 3 context (/rihal-discuss-phase 3 ${Rihal_WS}) [if CONTEXT.md missing]
206
211
  OR
@@ -237,7 +242,7 @@ Based on user selection, route to appropriate workflow:
237
242
 
238
243
  `/clear` then:
239
244
 
240
- `/rihal-execute-phase {phase} ${Rihal_WS}`
245
+ `/rihal-execute {phase} ${Rihal_WS}`
241
246
 
242
247
  ---
243
248
  ```
@@ -0,0 +1,31 @@
1
+ # Workflow: rihal-retrospective
2
+
3
+ <purpose>
4
+ Run an epic retrospective and produce owned action items. Delegates to the rihal-retrospective skill.
5
+ </purpose>
6
+
7
+ ## Execution
8
+
9
+ Locate and follow the installed skill:
10
+
11
+ ```bash
12
+ find .rihal/skills/actions -path "*rihal-retrospective/workflow.md" 2>/dev/null | head -1
13
+ ```
14
+
15
+ Read and follow the workflow at that path. If the path is empty:
16
+
17
+ ```
18
+ Skill not installed — run: npx @hanzlaa/rcode install
19
+ ```
20
+
21
+ ## On Completion
22
+
23
+ /rihal-correct-course — act on retrospective findings
24
+ /rihal-plan {next} — plan the next phase with retro learnings applied
25
+ /rihal-note — capture retro summary in project memory
26
+
27
+ ## ▶ Next Up
28
+
29
+ - **Retrospective complete:** `/rihal-new-milestone` — start the next milestone
30
+ - **Review project state:** `/rihal-progress` — see current roadmap position
31
+ - **Archive milestone:** `/rihal-complete-milestone` — if not already done
@@ -178,3 +178,15 @@ Critical findings filed as blocking AC. High findings as optional tasks.
178
178
  - If subagent fails: provide template adversarial review structure
179
179
  - If files too large: split review across multiple components
180
180
  - If no findings: report "No vulnerabilities found" (document assumptions)
181
+
182
+ ## On Completion
183
+
184
+ /rihal-plan {phase} --reviews — incorporate findings into next plan
185
+ /rihal-code-review-fix — apply suggested fixes
186
+ /rihal-council — escalate contested findings to the full council
187
+
188
+ ## ▶ Next Up
189
+
190
+ - **Vulnerabilities found:** Address security findings, re-run `/rihal-review-adversarial`
191
+ - **Clean report:** `/rihal-verify-phase {phase}` — full verification
192
+ - **Ship:** `/rihal-ship {phase}` — package the phase
@@ -279,3 +279,9 @@ Clean up temp files.
279
279
  - [ ] Temp files cleaned up
280
280
  - [ ] User knows how to use feedback (/rihal-plan --reviews)
281
281
  </success_criteria>
282
+
283
+ ## ▶ Next Up
284
+
285
+ - **Issues found:** Fix identified problems, then re-run `/rihal-review`
286
+ - **Review passed:** `/rihal-ship {phase}` — package phase for shipping
287
+ - **Security concern:** `/rihal-secure-phase {phase}` — targeted security review
@@ -0,0 +1,31 @@
1
+ # Workflow: rihal-scaffold-project
2
+
3
+ <purpose>
4
+ Scaffold a new project from the official Rihal template repo. Delegates to the rihal-scaffold-project skill.
5
+ </purpose>
6
+
7
+ ## Execution
8
+
9
+ Locate and follow the installed skill:
10
+
11
+ ```bash
12
+ find .rihal/skills/actions -path "*rihal-scaffold-project/workflow.md" 2>/dev/null | head -1
13
+ ```
14
+
15
+ Read and follow the workflow at that path. If the path is empty:
16
+
17
+ ```
18
+ Skill not installed — run: npx @hanzlaa/rcode install
19
+ ```
20
+
21
+ ## On Completion
22
+
23
+ /rihal-init — configure Rihal for the scaffolded project
24
+ /rihal-new-project {name} — design the project with full facilitation
25
+ /rihal-create-prd — write the product requirements document
26
+
27
+ ## ▶ Next Up
28
+
29
+ - **Project scaffolded:** `/rihal-create-prd` — define what you're building
30
+ - **Already have requirements:** `/rihal-create-milestone` — jump straight to roadmap
31
+ - **Quick start:** `/rihal-do` — interactive router shows your next best step
@@ -77,6 +77,8 @@ INIT=$(node "$PROJECT_ROOT/.rihal/bin/rihal-tools.cjs" init scan 2>/dev/null ||
77
77
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
78
78
  ```
79
79
 
80
+ Extract `response_language` from INIT JSON. If set, include `Respond in {response_language}.` in all spawned subagent prompts.
81
+
80
82
  Look up which documents would be produced for the selected focus (from the mapping table above).
81
83
 
82
84
  For each target document, check if it already exists in `.planning/codebase/`:
@@ -225,6 +227,7 @@ Task(
225
227
 
226
228
  This scope section is non-negotiable — the orchestrator will reject documents missing it.",
227
229
  subagent_type="rihal-codebase-mapper",
230
+ model="sonnet",
228
231
  model="{resolved_model}"
229
232
  )
230
233
  ```
@@ -370,3 +373,10 @@ If arguments are invalid, missing files, or subagent fails:
370
373
  - Check that required files exist
371
374
  - Retry with clearer arguments or report the specific error to the user
372
375
 
376
+
377
+ ## On Completion
378
+
379
+ /rihal-council {your question} — strategic question about what was found
380
+ /rihal-plan {N} — plan fixes for discovered issues
381
+ /rihal-explore — go deeper with socratic analysis
382
+ /rihal-next — get suggested next action
@@ -33,12 +33,19 @@ If `$ARGUMENTS` is empty or contains only `--help` or `-h`:
33
33
  ## 0. Initialize
34
34
 
35
35
  ```bash
36
- INIT=$(node ".rihal/bin/rihal-tools.cjs" init phase-op "${PHASE_ARG}")
36
+ INIT=$(node ".rihal/bin/rihal-tools.cjs" init phase-op "${PHASE_ARG}" 2>/dev/null)
37
37
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
38
38
  AGENT_SKILLS_AUDITOR=$(node ".rihal/bin/rihal-tools.cjs" agent-skills rihal-security-auditor 2>/dev/null)
39
39
  ```
40
40
 
41
- Parse: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`.
41
+ If `INIT` is empty or `INIT.ok` is false, print error and exit:
42
+ ```
43
+ Error: rihal-tools init failed. Verify .rihal/ is installed and state.json is valid.
44
+ ```
45
+
46
+ Parse: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `response_language`.
47
+
48
+ **If `response_language` is set:** include `Respond in {response_language}.` in all spawned subagent prompts.
42
49
 
43
50
  ```bash
44
51
  AUDITOR_MODEL=$(node ".rihal/bin/rihal-tools.cjs" resolve-model rihal-security-auditor --raw)
@@ -194,3 +201,9 @@ If arguments are invalid, missing files, or subagent fails:
194
201
  - Check that required files exist
195
202
  - Retry with clearer arguments or report the specific error to the user
196
203
 
204
+
205
+ ## ▶ Next Up
206
+
207
+ - **Issues found:** Address security findings, then re-run `/rihal-secure-phase {phase}`
208
+ - **Clean report:** `/rihal-verify-phase {phase}` — run full verification
209
+ - **Continue execution:** `/rihal-execute {next-phase}` — proceed to next phase
@@ -77,21 +77,40 @@ Extract counts:
77
77
 
78
78
  ## Step 5 — Estimate token usage
79
79
 
80
- Calculate estimated tokens (note: this is an estimate, not actual measurement):
80
+ Calculate estimated tokens (note: these are rough approximations, not actual measurements).
81
81
 
82
- - **Council sessions:** count × 50,000 tokens (5 agents × 2 rounds × ~5K avg per agent)
83
- - **Chains:** count × 30,000 tokens (3-5 stages × ~8K avg per stage)
84
- - **Discusses:** count × 10,000 tokens (single agent, focused conversation)
85
- - **Execute:** (executions count) × 20,000 tokens (estimation only)
82
+ Read context_window from config to calibrate multipliers:
86
83
 
87
- **Total estimate:** sum of above (with disclaimer)
84
+ ```bash
85
+ CW=$(node .rihal/bin/rihal-tools.cjs config-get context_window 2>/dev/null || echo "200000")
86
+ ```
87
+
88
+ Scale multipliers: if `CW >= 500000`, multiply by 2× (larger context windows → more content read per agent turn).
89
+
90
+ | Artifact type | Base tokens | Rationale |
91
+ |---------------|-------------|-----------|
92
+ | Council session | 50,000 | 5 agents × 2 rounds × ~5K avg |
93
+ | Chain | 30,000 | 3–5 stages × ~8K avg |
94
+ | Discuss | 10,000 | single agent, focused |
95
+ | Execute | 20,000 | executor + verifier per plan |
96
+
97
+ Apply context window scale: `estimate = base × max(1, CW / 200000)`
98
+
99
+ **Total estimate:** sum of above, rounded to nearest 1K (with clear disclaimer: "Rough estimate — actual usage depends on codebase size, plan length, and model")
100
+
101
+ **Note for accuracy:** actual token counts require the `/usage` endpoint or Claude Code session logs. These multipliers are 2024 baselines updated for 1M-context models.
88
102
 
89
103
  ## Step 6 — List commits
90
104
 
91
105
  Get commits touching rihal paths since state creation:
92
106
 
93
107
  ```bash
94
- git log --since="$(date -d '$(cat .rihal/state.json | jq -r .created)' '+%Y-%m-%dT%H:%M:%S')" --oneline -- .rihal rihal/ .planning 2>/dev/null || git log --all --oneline -- .rihal rihal/ .planning 2>/dev/null | head -20
108
+ SINCE_DATE=$(node -e "try{const s=require('fs').readFileSync('.rihal/state.json','utf8');console.log(JSON.parse(s).created||'')}catch(e){}" 2>/dev/null)
109
+ if [[ -n "$SINCE_DATE" ]]; then
110
+ git log --since="$SINCE_DATE" --oneline -- .rihal rihal/ .planning 2>/dev/null | head -20
111
+ else
112
+ git log --all --oneline -- .rihal rihal/ .planning 2>/dev/null | head -20
113
+ fi
95
114
  ```
96
115
 
97
116
  Extract commit hashes and subjects. If git errors, report gracefully (project may not be git-based).
@@ -185,3 +204,9 @@ Then print summary:
185
204
  - **Git not available:** report gracefully ("Git not available, skipping commit history.").
186
205
  - **Write permission denied to .planning/:** print error and stop.
187
206
  - **Insufficient readable history:** report gracefully and skip that section.
207
+
208
+ ## On Completion
209
+
210
+ /rihal-progress — see full roadmap status
211
+ /rihal-next — get suggested next action
212
+ /rihal-resume-work — pick up where you left off
@@ -44,10 +44,15 @@ Read all files referenced by the invoking prompt's execution_context before star
44
44
  Parse arguments and load project state:
45
45
 
46
46
  ```bash
47
- INIT=$(node ".rihal/bin/rihal-tools.cjs" init phase-op "${PHASE_ARG}")
47
+ INIT=$(node ".rihal/bin/rihal-tools.cjs" init phase-op "${PHASE_ARG}" 2>/dev/null)
48
48
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
49
49
  ```
50
50
 
51
+ If `INIT` is empty or `INIT.ok` is false, print error and exit:
52
+ ```
53
+ Error: rihal-tools init failed. Verify .rihal/ is installed and state.json is valid.
54
+ ```
55
+
51
56
  Parse from init JSON: `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `padded_phase`, `commit_docs`.
52
57
 
53
58
  Also load config for branching strategy:
@@ -257,7 +262,7 @@ After shipping:
257
262
 
258
263
  - /rihal-complete-milestone — if all phases in milestone are done
259
264
  - /rihal-progress — see overall project state
260
- - /rihal-execute-phase {next} — continue to next phase
265
+ - /rihal-execute {next} — continue to next phase
261
266
  </offer_next>
262
267
 
263
268
  <success_criteria>
@@ -61,3 +61,9 @@ Separate multiple plans with `---\n`
61
61
  - ID unresolvable → Show resolve-id error message
62
62
  - SPRINT.md missing → "File not found: {path}"
63
63
  - state.json corrupt → Omit execution status, continue
64
+
65
+ ## On Completion
66
+
67
+ /rihal-execute {phase} — execute this phase
68
+ /rihal-plan {phase} — revise the plan
69
+ /rihal-progress — see full roadmap
@@ -41,12 +41,12 @@ STOP — do not proceed.
41
41
  ## Step 1 — Load sprint data
42
42
 
43
43
  ```bash
44
- SPRINT_STATUS=$(node .rihal/bin/rihal-tools.cjs state sprint status)
45
- VELOCITY=$(node .rihal/bin/rihal-tools.cjs state sprint velocity)
46
- STORIES=$(node .rihal/bin/rihal-tools.cjs state story list)
44
+ SPRINT_STATUS=$(node .rihal/bin/rihal-tools.cjs state sprint status 2>/dev/null || echo "")
45
+ VELOCITY=$(node .rihal/bin/rihal-tools.cjs state sprint velocity 2>/dev/null || echo "0")
46
+ STORIES=$(node .rihal/bin/rihal-tools.cjs state story list 2>/dev/null || echo "")
47
47
  ```
48
48
 
49
- If no current sprint:
49
+ If `SPRINT_STATUS` is empty:
50
50
  ```
51
51
  No active sprint. Run /rihal-sprint-planning to create one.
52
52
  ```
@@ -57,7 +57,7 @@ the weighted bar as the primary progress indicator to avoid a misleading `0/N (0
57
57
  For each entry in `SNAPSHOT.phases[]`:
58
58
 
59
59
  - `▶` if `phase.number === SNAPSHOT.current_phase`
60
- - `✓` if `phase.disk.summary_count > 0` AND matches `phase.disk.plan_count` (complete)
60
+ - `✓` if `phase.disk.summary_count > 0` AND matches `phase.disk.plan_count` AND `phase.disk.has_verification` (complete + verified; if VERIFICATION.md absent, use `◎` and label "complete-unverified")
61
61
  - `◆` if `phase.disk.plan_count > phase.disk.summary_count` (executing — has plans, not all summarized)
62
62
  - `◇` if `phase.disk.has_context && !phase.disk.plan_count` (discussing — CONTEXT.md exists but no plan yet)
63
63
  - `◈` if `phase.disk.has_research && !phase.disk.plan_count` (researched — RESEARCH.md but no plan)
@@ -89,7 +89,7 @@ Do NOT hide insights. They exist because the CLI noticed something the workflow
89
89
  ## Step 5 — Recent decisions + blockers
90
90
 
91
91
  - If `SNAPSHOT.decisions.length > 0`, print the last 3 (most recent first).
92
- - If `SNAPSHOT.blockers.length > 0`, render each with and the blocker description.
92
+ - If `SNAPSHOT.blockers.length > 0`, render each with ⚠, the blocker description, and its age. Compute age from `blocker.date` to now: if > 7 days, append `(⚡ {N} days old)` in amber; if > 30 days, append `(🔥 {N} days — stale)`. If no `date` field, render `(age unknown)`.
93
93
 
94
94
  Omit a section entirely when its array is empty.
95
95
 
@@ -81,7 +81,7 @@ node .rihal/bin/rihal-tools.cjs state set --ui-spec-path ".rihal/UI-SPEC.md"
81
81
 
82
82
  Print:
83
83
  ```
84
- UI-SPEC.md generated: {ui_spec_path}
84
+ UI-SPEC.md generated: {ui_spec_path}
85
85
 
86
86
  Contains:
87
87
  • Color Tokens
@@ -20,8 +20,6 @@ If `$ARGUMENTS` is empty or contains only `--help` or `-h`:
20
20
  STOP — do not proceed.
21
21
 
22
22
  <required_reading>
23
- @.rihal/references/ui-brand.md
24
- @.rihal/references/gate-prompts.md
25
23
  </required_reading>
26
24
 
27
25
  <process>
@@ -149,7 +147,8 @@ EOF
149
147
  exit 0
150
148
  fi
151
149
 
152
- mapfile -t COMMITS < <(git log --pretty=format:%H --no-merges "${SNAPSHOT_TAG}..HEAD")
150
+ COMMITS=()
151
+ while IFS= read -r line; do [[ -n "$line" ]] && COMMITS+=("$line"); done < <(git log --pretty=format:%H --no-merges "${SNAPSHOT_TAG}..HEAD")
153
152
  ```
154
153
 
155
154
  If the range is empty (HEAD is already at the snapshot):
@@ -94,7 +94,7 @@ Count each category. Store results in `$ADDED`, `$CHANGED`, `$REMOVED` (arrays o
94
94
 
95
95
  If all three lists are empty:
96
96
  ```
97
- rihal-code is up to date (no changes detected)
97
+ rihal-code is up to date (no changes detected)
98
98
  ```
99
99
  Exit.
100
100
 
@@ -213,7 +213,7 @@ If the user passed a version argument (`/rihal-update v1.3.0`), pass it through
213
213
  Print:
214
214
 
215
215
  ```
216
- rihal-code updated successfully
216
+ rihal-code updated successfully
217
217
 
218
218
  Updated files: N
219
219
  - file-path-1
@@ -42,7 +42,7 @@ SUMMARY_FILES=$(ls "${PHASE_DIR}"/*-SUMMARY.md 2>/dev/null)
42
42
 
43
43
  - **State A** (`VALIDATION_FILE` non-empty): Audit existing
44
44
  - **State B** (`VALIDATION_FILE` empty, `SUMMARY_FILES` non-empty): Reconstruct from artifacts
45
- - **State C** (`SUMMARY_FILES` empty): Exit — "Phase {N} not executed. Run /rihal-execute-phase {N} ${Rihal_WS} first."
45
+ - **State C** (`SUMMARY_FILES` empty): Exit — "Phase {N} not executed. Run /rihal-execute {N} ${Rihal_WS} first."
46
46
 
47
47
  ## 2. Discovery
48
48
 
@@ -0,0 +1,31 @@
1
+ # Workflow: rihal-validate-prd
2
+
3
+ <purpose>
4
+ Validate an existing PRD for completeness, consistency, and testability. Delegates to the rihal-validate-prd skill.
5
+ </purpose>
6
+
7
+ ## Execution
8
+
9
+ Locate and follow the installed skill:
10
+
11
+ ```bash
12
+ find .rihal/skills/actions -path "*rihal-validate-prd/workflow.md" 2>/dev/null | head -1
13
+ ```
14
+
15
+ Read and follow the workflow at that path. If the path is empty:
16
+
17
+ ```
18
+ Skill not installed — run: npx @hanzlaa/rcode install
19
+ ```
20
+
21
+ ## On Completion
22
+
23
+ /rihal-create-milestone — build the roadmap from the validated PRD
24
+ /rihal-edit-prd — fix validation findings
25
+ /rihal-council — escalate ambiguous requirements to the council
26
+
27
+ ## ▶ Next Up
28
+
29
+ - **PRD valid:** `/rihal-create-milestone` — design M1..Mn roadmap
30
+ - **Gaps found:** `/rihal-edit-prd` — fill in missing sections
31
+ - **Need council review:** `/rihal-council {prd-question}` — debate key decisions
@@ -30,10 +30,15 @@ Then verify each level against the actual codebase.
30
30
  Load phase operation context:
31
31
 
32
32
  ```bash
33
- INIT=$(node ".rihal/bin/rihal-tools.cjs" init phase-op "${PHASE_ARG}")
33
+ INIT=$(node ".rihal/bin/rihal-tools.cjs" init phase-op "${PHASE_ARG}" 2>/dev/null)
34
34
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
35
35
  ```
36
36
 
37
+ If `INIT` is empty or `INIT.ok` is false, print error and exit:
38
+ ```
39
+ Error: rihal-tools init failed. Verify .rihal/ is installed and state.json is valid.
40
+ ```
41
+
37
42
  Extract from init JSON: `phase_dir`, `phase_number`, `phase_name`, `has_plans`, `plan_count`.
38
43
 
39
44
  Then load phase details and list plans/summaries:
@@ -178,14 +183,14 @@ Record status and evidence for each key link.
178
183
  <step name="verify_requirements">
179
184
  If REQUIREMENTS.md exists:
180
185
  ```bash
181
- grep -E "Phase ${PHASE_NUM}" .planning/REQUIREMENTS.md 2>/dev/null || true
186
+ grep -E "Phase ${PHASE_NUMBER}" .planning/REQUIREMENTS.md 2>/dev/null || true
182
187
  ```
183
188
 
184
189
  For each requirement: parse description → identify supporting truths/artifacts → status: ✓ SATISFIED / ✗ BLOCKED / ? NEEDS HUMAN.
185
190
  </step>
186
191
 
187
192
  <step name="scan_antipatterns">
188
- Extract files modified in this phase from SUMMARY.md, scan each:
193
+ Extract files modified in this phase from SUMMARY.md YAML frontmatter fields `key-files.created` and `key-files.modified` (parse the block between the opening and closing `---` delimiters). Scan each listed file:
189
194
 
190
195
  | Pattern | Search | Severity |
191
196
  |---------|--------|----------|
@@ -284,6 +289,27 @@ If a requirement specifies a quantity of test cases (e.g., "30 calculations"), c
284
289
  **Impact on status:** Any BLOCKER from test quality audit ��� overall status = `gaps_found`, regardless of other checks passing.
285
290
  </step>
286
291
 
292
+ <step name="check_code_review_findings">
293
+ Check if a REVIEW.md exists for this phase. If it does, parse critical and high severity counts before writing the verdict:
294
+
295
+ ```bash
296
+ REVIEW_FILE=$(ls "$PHASE_DIR"/*-REVIEW.md 2>/dev/null | head -1)
297
+ if [[ -n "$REVIEW_FILE" ]]; then
298
+ CRITICAL_COUNT=$(grep -c "severity.*critical\|🔴.*critical\|critical.*🔴" "$REVIEW_FILE" 2>/dev/null || echo 0)
299
+ HIGH_COUNT=$(grep -c "severity.*high\|🟠.*high\|high.*🟠" "$REVIEW_FILE" 2>/dev/null || echo 0)
300
+ echo "Code review: ${CRITICAL_COUNT} critical, ${HIGH_COUNT} high findings"
301
+ fi
302
+ ```
303
+
304
+ **If CRITICAL_COUNT > 0:** Add a blocker gap — "Code review found ${CRITICAL_COUNT} critical finding(s) in REVIEW.md — must be resolved before phase passes."
305
+
306
+ **If HIGH_COUNT > 0:** Add a warning — "Code review found ${HIGH_COUNT} high-severity finding(s) in REVIEW.md — review before shipping."
307
+
308
+ **If REVIEW.md does not exist:** Skip silently — code review is optional (agent may not have been run).
309
+
310
+ Record findings in VERIFICATION.md under `## Code Review Integration` section.
311
+ </step>
312
+
287
313
  <step name="identify_human_verification">
288
314
  **Always needs human:** Visual appearance, user flow completion, real-time behavior (WebSocket/SSE), external service integration, performance feel, error message clarity.
289
315
 
@@ -295,7 +321,7 @@ Format each as: Test Name → What to do → Expected result → Why can't verif
295
321
  <step name="determine_status">
296
322
  Classify status using this decision tree IN ORDER (most restrictive first):
297
323
 
298
- 1. IF any truth FAILED, artifact MISSING/STUB, key link NOT_WIRED, blocker found, **or test quality audit found blockers (disabled requirement tests, circular tests)**:
324
+ 1. IF any truth FAILED, artifact MISSING/STUB, key link NOT_WIRED, blocker found, **test quality audit found blockers (disabled requirement tests, circular tests)**, **or code review found critical findings**:
299
325
  → **gaps_found**
300
326
 
301
327
  2. IF the previous step produced ANY human verification items:
@@ -340,7 +366,7 @@ If gaps_found:
340
366
 
341
367
  <step name="create_report">
342
368
  ```bash
343
- REPORT_PATH="$PHASE_DIR/${PHASE_NUM}-VERIFICATION.md"
369
+ REPORT_PATH="$PHASE_DIR/${PHASE_NUMBER}-VERIFICATION.md"
344
370
  ```
345
371
 
346
372
  Fill template sections: frontmatter (phase/timestamp/status/score), goal achievement, artifact table, wiring table, requirements coverage, anti-patterns, human verification, gaps summary, fix plans (if gaps_found), metadata.
@@ -367,6 +393,7 @@ Orchestrator routes: `passed` → update_roadmap | `gaps_found` → create/execu
367
393
  - [ ] Requirements coverage assessed (if applicable)
368
394
  - [ ] Anti-patterns scanned and categorized
369
395
  - [ ] Test quality audited (disabled tests, circular patterns, assertion strength, provenance)
396
+ - [ ] Code review findings checked (REVIEW.md critical/high counts surfaced if file exists)
370
397
  - [ ] Human verification items identified
371
398
  - [ ] Overall status determined
372
399
  - [ ] Deferred items filtered against later milestone phases (if gaps found)
@@ -374,3 +401,9 @@ Orchestrator routes: `passed` → update_roadmap | `gaps_found` → create/execu
374
401
  - [ ] VERIFICATION.md created with complete report
375
402
  - [ ] Results returned to orchestrator
376
403
  </success_criteria>
404
+
405
+ ## ▶ Next Up
406
+
407
+ - **Verification passed:** `/rihal-complete-milestone` (if all phases done) or `/rihal-execute` for next phase
408
+ - **Gaps found:** `/rihal-plan --gaps {phase}` — plan gap-closure tasks
409
+ - **Re-verify after fixes:** `/rihal-verify-phase {phase}`