@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
@@ -0,0 +1,60 @@
1
+ <purpose>
2
+ Unified capture command. Routes a single user gesture to the right Memory Bank surface based on flags: todo (default — actionable item), note (passive observation), seed (forward-looking idea with trigger conditions), or list (show pending todos). Replaces the muscle-memory pattern of remembering which of /rihal-add-todo, /rihal-note, /rihal-plant-seed, /rihal-check-todos to invoke.
3
+ </purpose>
4
+
5
+ ## Step 0 — Usage check
6
+
7
+ If `$ARGUMENTS` is empty AND no flag is set:
8
+
9
+ ```
10
+ /rihal-capture <text> # save as todo (default)
11
+ /rihal-capture --note <text> # passive observation
12
+ /rihal-capture --seed <text> # forward-looking with trigger
13
+ /rihal-capture --list [--area <area>] # show pending todos
14
+ ```
15
+
16
+ STOP — do not proceed.
17
+
18
+ ## Step 1 — Parse mode flags
19
+
20
+ Inspect `$ARGUMENTS` for mode flags. Exactly one mode applies:
21
+
22
+ - `--note` → note mode (delegates to add-note workflow)
23
+ - `--seed` → seed mode (delegates to plant-seed workflow)
24
+ - `--list` → list mode (delegates to check-todos workflow)
25
+ - (none) → todo mode (default, delegates to add-todo workflow)
26
+
27
+ After determining mode, strip the mode flag from `$ARGUMENTS` and pass the remaining text to the underlying workflow.
28
+
29
+ ## Step 2 — Dispatch to underlying workflow
30
+
31
+ Each mode is implemented by an existing workflow. Load and execute end-to-end:
32
+
33
+ - **todo (default):** read and execute `@.rihal/workflows/add-todo.md` with the cleaned `$ARGUMENTS`. Output identical to `/rihal-add-todo`.
34
+ - **note (`--note`):** read and execute `@.rihal/workflows/note.md`. Output identical to `/rihal-note`.
35
+ - **seed (`--seed`):** read and execute `@.rihal/workflows/plant-seed.md`. Output identical to `/rihal-plant-seed`.
36
+ - **list (`--list`):** read and execute `@.rihal/workflows/check-todos.md`. Output identical to `/rihal-check-todos`.
37
+
38
+ The underlying workflows are unchanged — `/rihal-capture` is a thin router. Behaviour, output format, and side effects are byte-identical to invoking the underlying command directly. This means `/rihal-add-todo "X"` and `/rihal-capture "X"` produce the same disk writes and the same console output.
39
+
40
+ ## Step 3 — Footer
41
+
42
+ After the underlying workflow's normal output, append a single line indicating the mode that was selected:
43
+
44
+ ```
45
+ (rihal-capture: routed to {todo|note|seed|list} mode)
46
+ ```
47
+
48
+ This is invisible polish — confirms to the user that the dispatch was correct.
49
+
50
+ ## Migration note
51
+
52
+ The four absorbed commands continue to work and are not deprecated yet — they remain canonical aliases. `/rihal-capture` exists as the unified entry for users who want one command to remember instead of four. Future minor versions may consolidate further; until then, both invocation paths are first-class.
53
+
54
+ ## Acceptance
55
+
56
+ - [ ] `/rihal-capture "fix nav"` produces the same artefacts as `/rihal-add-todo "fix nav"`
57
+ - [ ] `/rihal-capture --note "hex codes everywhere"` produces the same artefacts as `/rihal-note "hex codes everywhere"`
58
+ - [ ] `/rihal-capture --seed "scale to 1k users"` produces the same artefacts as `/rihal-plant-seed "scale to 1k users"`
59
+ - [ ] `/rihal-capture --list` produces the same output as `/rihal-check-todos`
60
+ - [ ] No flag combinations are silently ignored — unknown flags surface as a clear error
@@ -116,7 +116,7 @@ If missing, the stage failed — print which stage, stop the chain, allow user t
116
116
 
117
117
  ### Print stage summary
118
118
  ```
119
- Stage {N}/{total} — {agent}: {artifact filename}
119
+ Stage {N}/{total} — {agent}: {artifact filename}
120
120
  ```
121
121
 
122
122
  ## Step 3 — Final output
@@ -207,7 +207,8 @@ echo "Fix scope: ${FIX_SCOPE}"
207
207
  Use Task() to spawn agent:
208
208
 
209
209
  ```
210
- Task(subagent_type="rihal-code-fixer", prompt="
210
+ Task(subagent_type="rihal-code-fixer",
211
+ model="sonnet", prompt="
211
212
  <files_to_read>
212
213
  ${REVIEW_PATH}
213
214
  </files_to_read>
@@ -288,7 +289,8 @@ if [ "$AUTO_MODE" = "true" ]; then
288
289
 
289
290
  # Spawn rihal-code-reviewer agent to re-review
290
291
  # (This overwrites REVIEW_PATH with latest review state)
291
- Task(subagent_type="rihal-code-reviewer", prompt="
292
+ Task(subagent_type="rihal-code-reviewer",
293
+ model="sonnet", prompt="
292
294
  <config>
293
295
  depth: ${REVIEW_DEPTH}
294
296
  phase_dir: ${PHASE_DIR}
@@ -321,7 +323,8 @@ Do NOT commit the output — the orchestrator handles that.
321
323
  # Still has issues — spawn fixer again
322
324
  echo "Issues remain. Applying fixes for iteration ${ITERATION}..."
323
325
 
324
- Task(subagent_type="rihal-code-fixer", prompt="
326
+ Task(subagent_type="rihal-code-fixer",
327
+ model="sonnet", prompt="
325
328
  <files_to_read>
326
329
  ${REVIEW_PATH}
327
330
  </files_to_read>
@@ -66,11 +66,18 @@ Parse arguments and load project state:
66
66
 
67
67
  ```bash
68
68
  PHASE_ARG="${1}"
69
- INIT=$(node "$PROJECT_ROOT/.rihal/bin/rihal-tools.cjs" init phase-op "${PHASE_ARG}")
69
+ INIT=$(node "$PROJECT_ROOT/.rihal/bin/rihal-tools.cjs" init phase-op "${PHASE_ARG}" 2>/dev/null)
70
70
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
71
71
  ```
72
72
 
73
- Parse from init JSON: `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `padded_phase`, `commit_docs`.
73
+ If `INIT` is empty or `INIT.ok` is false, print error and exit:
74
+ ```
75
+ Error: rihal-tools init failed. Verify .rihal/ is installed and state.json is valid.
76
+ ```
77
+
78
+ Parse from init JSON: `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `padded_phase`, `commit_docs`, `response_language`.
79
+
80
+ **If `response_language` is set:** include `Respond in {response_language}.` in all spawned subagent prompts.
74
81
 
75
82
  **Input sanitization (defense-in-depth):**
76
83
  ```bash
@@ -381,7 +388,8 @@ done
381
388
  Spawn the rihal-code-reviewer agent:
382
389
 
383
390
  ```
384
- Task(subagent_type="rihal-code-reviewer", prompt="
391
+ Task(subagent_type="rihal-code-reviewer",
392
+ model="sonnet", prompt="
385
393
  <files_to_read>
386
394
  ${FILES_TO_READ}
387
395
  </files_to_read>
@@ -397,6 +405,20 @@ ${CONFIG_FILES}
397
405
 
398
406
  Review the listed source files at ${REVIEW_DEPTH} depth. Write findings to ${REVIEW_PATH}.
399
407
  Do NOT commit the output — the orchestrator handles that.
408
+
409
+ The REVIEW.md file MUST begin with YAML frontmatter in exactly this format:
410
+ ---
411
+ status: clean | issues_found | skipped
412
+ phase: <phase_number or HEAD~N..HEAD>
413
+ files_reviewed: <count>
414
+ critical: <count>
415
+ high: <count>
416
+ medium: <count>
417
+ low: <count>
418
+ generated: <ISO timestamp>
419
+ ---
420
+
421
+ Use severity: critical (must fix, security/data-loss/broken), high (should fix, correctness/coverage), medium (consider, poor patterns), low (optional, style/naming).
400
422
  ")
401
423
  ```
402
424
 
@@ -496,10 +518,11 @@ FRONTMATTER=$(sed -n '2,/^---$/p' "${REVIEW_PATH}" 2>/dev/null | head -n -1)
496
518
  # Parse fields from frontmatter only (not full file)
497
519
  STATUS=$(echo "$FRONTMATTER" | grep "^status:" | cut -d: -f2 | xargs)
498
520
  FILES_REVIEWED=$(echo "$FRONTMATTER" | grep "^files_reviewed:" | cut -d: -f2 | xargs)
499
- CRITICAL=$(echo "$FRONTMATTER" | grep "critical:" | head -1 | cut -d: -f2 | xargs)
500
- WARNING=$(echo "$FRONTMATTER" | grep "warning:" | head -1 | cut -d: -f2 | xargs)
501
- INFO=$(echo "$FRONTMATTER" | grep "info:" | head -1 | cut -d: -f2 | xargs)
502
- TOTAL=$(echo "$FRONTMATTER" | grep "total:" | head -1 | cut -d: -f2 | xargs)
521
+ CRITICAL=$(echo "$FRONTMATTER" | grep "^critical:" | head -1 | cut -d: -f2 | xargs)
522
+ HIGH=$(echo "$FRONTMATTER" | grep "^high:" | head -1 | cut -d: -f2 | xargs)
523
+ MEDIUM=$(echo "$FRONTMATTER" | grep "^medium:" | head -1 | cut -d: -f2 | xargs)
524
+ LOW=$(echo "$FRONTMATTER" | grep "^low:" | head -1 | cut -d: -f2 | xargs)
525
+ TOTAL=$(( ${CRITICAL:-0} + ${HIGH:-0} + ${MEDIUM:-0} + ${LOW:-0} ))
503
526
  ```
504
527
 
505
528
  Display inline summary to user:
@@ -516,8 +539,9 @@ Display inline summary to user:
516
539
 
517
540
  Findings:
518
541
  Critical: ${CRITICAL}
519
- Warning: ${WARNING}
520
- Info: ${INFO}
542
+ High: ${HIGH}
543
+ Medium: ${MEDIUM}
544
+ Low: ${LOW}
521
545
  ──────────
522
546
  Total: ${TOTAL}
523
547
 
@@ -542,7 +566,7 @@ Next steps:
542
566
  cat ${REVIEW_PATH} — View full report
543
567
  ```
544
568
 
545
- If critical > 0 or warning > 0, list top 3 issues inline:
569
+ If critical > 0 or high > 0, list top 3 issues inline:
546
570
  ```bash
547
571
  echo "Top issues:"
548
572
  grep -A 3 "^### CR-\|^### WR-" "${REVIEW_PATH}" | head -n 12
@@ -64,7 +64,7 @@ Read `.planning/ROADMAP.md` directly and parse phase statuses. Use this to verif
64
64
 
65
65
  ```bash
66
66
  ls -1 .planning/phases/*/SUMMARY.md 2>/dev/null | wc -l
67
- ls -1 .planning/phases/*/PLAN.md .planning/phases/*/*-PLAN.md 2>/dev/null | wc -l
67
+ ls -1 .planning/phases/*/*-SPRINT.md 2>/dev/null | wc -l
68
68
  ```
69
69
 
70
70
  **Requirements completion check (REQUIRED before presenting):**
@@ -150,7 +150,14 @@ Calculate milestone statistics:
150
150
  ```bash
151
151
  git log --oneline --grep="feat(" | head -20
152
152
  git diff --stat FIRST_COMMIT..LAST_COMMIT | tail -1
153
- find . -name "*.swift" -o -name "*.ts" -o -name "*.py" -o -name "*.tsx" -o -name "*.js" | xargs wc -l 2>/dev/null || true
153
+ find . \
154
+ -not -path '*/node_modules/*' \
155
+ -not -path '*/dist/*' \
156
+ -not -path '*/.next/*' \
157
+ -not -path '*/.venv/*' \
158
+ -not -path '*/__pycache__/*' \
159
+ \( -name "*.swift" -o -name "*.ts" -o -name "*.py" -o -name "*.tsx" -o -name "*.js" \) \
160
+ | head -500 | xargs wc -l 2>/dev/null | tail -1 || true
154
161
  git log --format="%ai" FIRST_COMMIT | tail -1
155
162
  git log --format="%ai" LAST_COMMIT | head -1
156
163
  ```
@@ -242,10 +249,12 @@ Write with the Write tool (append-preserving — Read MILESTONES.md first if it
242
249
 
243
250
  Full PROJECT.md evolution review at milestone completion.
244
251
 
245
- Read all phase summaries:
252
+ Read all phase summaries (capped to first 30 lines each, max 20 files):
246
253
 
247
254
  ```bash
248
- cat .planning/phases/*/*-SUMMARY.md .planning/phases/*/SUMMARY.md 2>/dev/null
255
+ find .planning/phases/ -maxdepth 3 \( -name '*-SUMMARY.md' -o -name 'SUMMARY.md' \) | head -20 | while IFS= read -r f; do
256
+ echo "=== $f ===" && head -30 "$f"
257
+ done
249
258
  ```
250
259
 
251
260
  **Full review checklist:**
@@ -407,7 +416,7 @@ status: completed
407
416
 
408
417
  ```
409
418
 
410
- Verify: `✅ Milestone archived to .planning/milestones/`
419
+ Verify: `✓ Milestone archived to .planning/milestones/`
411
420
 
412
421
  **Phase archival (optional):** Ask the user via AskUserQuestion:
413
422
 
@@ -425,7 +434,7 @@ mkdir -p "$ARCHIVE_DIR"
425
434
  find .planning/phases -mindepth 1 -maxdepth 1 -type d -exec mv {} "$ARCHIVE_DIR/" \;
426
435
  ```
427
436
 
428
- Verify: `✅ Phase directories archived to .planning/milestones/v[X.Y]-phases/`
437
+ Verify: `✓ Phase directories archived to .planning/milestones/v[X.Y]-phases/`
429
438
 
430
439
  If "Skip": Phase directories remain in `.planning/phases/` as raw execution history. Use `/rihal-cleanup` later to archive retroactively.
431
440
 
@@ -444,14 +453,14 @@ After archival, reorganize ROADMAP.md with milestone groupings, then delete orig
444
453
 
445
454
  ## Milestones
446
455
 
447
- - **v1.0 MVP** — Phases 1-4 (shipped YYYY-MM-DD)
456
+ - **v1.0 MVP** — Phases 1-4 (shipped YYYY-MM-DD)
448
457
  - 🚧 **v1.1 Security** — Phases 5-6 (in progress)
449
458
  - 📋 **v2.0 Redesign** — Phases 7-10 (planned)
450
459
 
451
460
  ## Phases
452
461
 
453
462
  <details>
454
- <summary>✅ v1.0 MVP (Phases 1-4) — SHIPPED YYYY-MM-DD</summary>
463
+ <summary>✓ v1.0 MVP (Phases 1-4) — SHIPPED YYYY-MM-DD</summary>
455
464
 
456
465
  - [x] Phase 1: Foundation (2/2 plans) — completed YYYY-MM-DD
457
466
  - [x] Phase 2: Authentication (2/2 plans) — completed YYYY-MM-DD
@@ -188,3 +188,9 @@ Run remediation with:
188
188
  - If PRD missing: skip scope/AC analysis, focus on architecture
189
189
  - If architecture missing: skip architecture analysis, focus on features
190
190
  - If agents fail: provide template deviation/remediation structure
191
+
192
+ ## ▶ Next Up
193
+
194
+ - **Course corrected:** `/rihal-execute {phase}` — resume execution with updated direction
195
+ - **Plan needs updating:** `/rihal-plan {phase}` — re-plan affected phase
196
+ - **Check project state:** `/rihal-progress` — verify deviation was contained
@@ -12,7 +12,8 @@ Open with banner:
12
12
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
13
13
 
14
14
  Question: {$ARGUMENTS}
15
- Panel: {N} agents selected by keyword scoring
15
+ Domain: {domain from scores fe / be / ml / deploy / strategic / market / general}
16
+ Panel: {N} agents selected by intent scoring
16
17
  ```
17
18
  TaskCreate: "Classify question type", "Select panel ({N} agents)", "Spawn agents in parallel", "Collect + synthesize responses", "Write artifact to council-sessions/".
18
19
  Per-agent spawn indicator:
@@ -28,6 +29,7 @@ Closure: `RIHAL ► COUNCIL COMPLETE ✓` + Next Up with decision options.
28
29
 
29
30
  <required_reading>
30
31
  @.rihal/references/output-format.md
32
+ @.rihal/references/council-protocol.md
31
33
  </required_reading>
32
34
 
33
35
  <process>
@@ -92,15 +94,8 @@ After Step 0.6 confirmation, proceed to load references by Reading:
92
94
  <available_agent_types>
93
95
  Read the `installed_agents` array from INIT_JSON. Every entry can be invoked as
94
96
  `subagent_type: "rihal-{id}"`. The classifier and panel scorer will surface only
95
- agents present in this list.
96
-
97
- Currently registered council agents (always available if installed):
98
- - rihal-sadiq, rihal-waleed, rihal-fatima, rihal-mariam, rihal-hussain-pm
99
-
100
- Specialist agents that may be installed (add to panel if scorer surfaces them):
101
- - rihal-ux-designer, rihal-noor
102
- - rihal-codebase-mapper, rihal-project-researcher, rihal-roadmapper
103
- - (and any other rihal-* agent in installed_agents)
97
+ agents present in this list — **do not hardcode agent names here**, use the live
98
+ list from INIT_JSON so new agents added to team.yaml are automatically available.
104
99
 
105
100
  Do not invoke `general-purpose` or any agent type not present in
106
101
  `installed_agents`. If the scorer surfaces an unknown agent, drop it
@@ -160,19 +155,23 @@ Parse the JSON for:
160
155
  - `paths` — `{ state, planning_root, sessions_dir, references_dir }`
161
156
  - `state_exists` — boolean, `.rihal/state.json` present
162
157
  - `installed_agents` — the authoritative list of installed agent ids (for validation)
158
+ - `response_language` — output language from config (null = English)
163
159
 
164
160
  **If the panel contains any id not in `installed_agents`:** stop, print `Unknown agent: {id}. Installed: {installed_agents.join(', ')}`, exit.
165
161
 
162
+ **If `response_language` is set:** include `Respond in {response_language}.` in every subagent prompt so all panelist output stays in the configured language.
163
+
166
164
  ## Step 2 — Pre-consultation context gathering
167
165
 
168
166
  📁 Session artifact will be saved to: `.planning/council-sessions/council-{date}-{slug}.md`
169
167
 
170
168
  **Branch on `question_type`** (returned by `rihal-tools.cjs init` as `question_type`):
171
169
 
172
- - `codebase` — existing code question → codebase scan
170
+ - `frontend` — React/UI/a11y/RTL → codebase scan + scan component dirs (`src/components/`, `src/app/`, `src/pages/`)
171
+ - `backend` — API/DB/queue → codebase scan + scan server dirs (`src/api/`, `server/`, `prisma/`)
172
+ - `codebase` — general existing code question → codebase scan
173
173
  - `performance` — latency/p95/throughput → codebase scan + read `baseline-metrics.md` if present
174
174
  - `ml` — OCR/retrieval/LLM → codebase scan + read ML service paths
175
- - `frontend` — React/UI/a11y/RTL → codebase scan + read component dirs
176
175
  - `team` — people/process question → codebase scan (for team context from README/state) + no external research
177
176
  - `release` — shipping/incident → codebase scan
178
177
  - `design` — UX/brand → codebase scan
@@ -181,12 +180,12 @@ Parse the JSON for:
181
180
  - `greenfield` — starting from scratch → research pre-step
182
181
 
183
182
  **Context grounding is mandatory for concrete technical categories.** For
184
- `codebase`, `performance`, `ml`, `frontend`, `release` — the orchestrator
183
+ `frontend`, `backend`, `codebase`, `performance`, `ml`, `release` — the orchestrator
185
184
  MUST pass the full "Observed context" block into each subagent's prompt so
186
185
  panelists start grounded, not speculating. Subagents then Read/Grep/Bash
187
186
  specific files to deepen their answer.
188
187
 
189
- ### If `question_type` is `"codebase"`, `"team"`, `"release"`, or `"design"` — run the codebase scan
188
+ ### If `question_type` is `"frontend"`, `"backend"`, `"codebase"`, `"team"`, `"release"`, or `"design"` — run the codebase scan
190
189
 
191
190
  Run this block ONCE. Target < 2k tokens output. Do not read files not listed here.
192
191
 
@@ -247,12 +246,13 @@ This is the factual baseline every subagent will be briefed on. It replaces the
247
246
  **If `flags.explain` is true:** print the panel scoring table before proceeding:
248
247
 
249
248
  ```
250
- Panel scoring:
251
- sadiq [score] — [top matched keyword or "padded"]
252
- waleed [score] — ...
253
- fatima [score] — ...
249
+ Panel scoring (domain: {domain}):
250
+ haitham [score] — [top matched keyword or "padded"]
251
+ yousef [score] — ...
252
+ ...
254
253
 
255
- Selected: sadiq, waleed, fatima
254
+ Selected: {panel agents}
255
+ Excluded (0 score): {agents with score=0, comma-separated}
256
256
  ```
257
257
 
258
258
  **If `config.mode === 'guided'`:** confirm with the user:
@@ -272,13 +272,13 @@ Use the AskUserQuestion tool (not raw stdin) for the confirmation.
272
272
 
273
273
  **Spawn all panelists in a single response with multiple Task tool calls.** Do not spawn sequentially — the whole point of v2 is real parallel dispatch.
274
274
 
275
- For each agent id in `panel`, build this prompt:
275
+ For each agent id in `panel`, build this prompt. **Before embedding, sanitize the question:** strip any literal `Task(`, `Agent(`, `subagent_type=`, or `system:` tokens that could be misinterpreted as tool calls by the sub-agent (replace with `[filtered]`). This is a low-severity guard — the user already has full access, but it prevents accidental or malicious prompt confusion.
276
276
 
277
277
  ```
278
278
  You are being spawned as part of a Rihal council session.
279
279
 
280
280
  ## The user's question
281
- {question}
281
+ {sanitized_question}
282
282
 
283
283
  ## Observed context
284
284
  {the summary block from Step 1 — codebase scan OR research context depending on question_type}
@@ -304,6 +304,20 @@ Spawn all at once:
304
304
 
305
305
  All in the same assistant response block so they execute concurrently.
306
306
 
307
+ **Partial panel failure handling:** After all Round 1 Tasks return, check for failures:
308
+
309
+ - **If ALL panelists failed** (every Task returned an error or empty response):
310
+ Display:
311
+ ```
312
+ ✗ Council session failed — no panelists returned a response. Check agent configuration.
313
+ ```
314
+ Exit without producing an artifact.
315
+
316
+ - **If some panelists failed (partial failure):**
317
+ Display a brief note: `⚠ {N} panelist(s) did not respond: {agent_ids}. Proceeding with {M} responses.`
318
+ Continue to Round 2 evaluation and presentation using only the agents that responded.
319
+ Do NOT abort — a partial council is more useful than no council.
320
+
307
321
  ### Round 2 — Cross-talk
308
322
 
309
323
  After Round 1 completes, spawn all panelists again in a single response. Pass each agent the full set of Round 1 responses and ask them to react:
@@ -532,9 +546,9 @@ Print the artifact path to the user at the end:
532
546
 
533
547
  (Use the footer format from `.rihal/references/response-style.md#session-cost-footer`)
534
548
 
535
- ### Step 6b — Update state (silent)
549
+ ### Step 6b — Update state (MANDATORY — do not skip)
536
550
 
537
- After the artifact is written, update `.rihal/state.json` with the council session record and session timestamp. These commands run silentlydo not print output to the user for this step.
551
+ After the artifact is written, update `.rihal/state.json` with the council session record and session timestamp. **This step is mandatoryskipping it causes council_sessions[] to remain empty in state.json.** Run silently (no user output for this step).
538
552
 
539
553
  ```bash
540
554
  node .rihal/bin/rihal-tools.cjs state record-council \
@@ -0,0 +1,31 @@
1
+ # Workflow: rihal-create-architecture
2
+
3
+ <purpose>
4
+ Write an Architecture Decision Record (ADR) or system design document. Delegates to the rihal-create-architecture skill.
5
+ </purpose>
6
+
7
+ ## Execution
8
+
9
+ Locate and follow the installed skill:
10
+
11
+ ```bash
12
+ find .rihal/skills/actions -path "*rihal-create-architecture/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-plan — plan implementation phases from the architecture
24
+ /rihal-council — review the architecture with the full council
25
+ /rihal-discuss — discuss architectural tradeoffs
26
+
27
+ ## ▶ Next Up
28
+
29
+ - **Architecture created:** `/rihal-plan {phase}` — break it into executable plans
30
+ - **Review with team:** `/rihal-council {architecture-question}` — debate the design
31
+ - **PRD needed first:** `/rihal-create-prd` — define requirements before architecture
@@ -129,7 +129,7 @@ Generate a structured set of epics. Each epic covers ONE coherent concern or pha
129
129
  ## Epic decomposition rules (MANDATORY)
130
130
 
131
131
  1. One epic = one coherent theme. Examples of correct splits:
132
- - "Web Search Investigation" + "Toggle Bug Fixes" + "Provider Improvements" = 3 epics
132
+ - "Web Search Investigation" + "Toggle Bug Fixes" + "Provider Improvements" = 3 epics
133
133
  - ❌ "Web Search (everything)" with 10 stories = 1 bloated epic (WRONG)
134
134
 
135
135
  2. Each epic has 3–5 stories MAX. If you have 8+ stories for one theme, split into 2 epics.
@@ -371,3 +371,9 @@ If arguments are invalid, missing files, or subagent fails:
371
371
  - Check that required files exist
372
372
  - Retry with clearer arguments or report the specific error to the user
373
373
 
374
+
375
+ ## ▶ Next Up
376
+
377
+ - **Stories created:** `/rihal-sprint-planning` — schedule capacity-gated sprint
378
+ - **Review stories:** `/rihal-dev-story {story-id}` — implement a specific story
379
+ - **Back to PRD:** `/rihal-edit-prd` — revise if epics revealed scope gaps
@@ -0,0 +1,25 @@
1
+ # Workflow: rihal-create-prd
2
+
3
+ <purpose>
4
+ Create a Product Requirements Document from scratch through guided facilitation. Delegates to the rihal-create-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-create-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-validate-prd — validate the PRD for completeness
24
+ /rihal-create-milestone — build the milestone roadmap from the PRD
25
+ /rihal-edit-prd — revise the PRD
@@ -46,7 +46,7 @@ else
46
46
  if [ -z "$DASHBOARD" ]; then
47
47
  for BIN in rcode rihal rihal-code; do
48
48
  BIN_PATH="$(command -v $BIN 2>/dev/null)" || continue
49
- REAL_BIN="$(readlink -f "$BIN_PATH" 2>/dev/null)"
49
+ REAL_BIN="$(readlink -f "$BIN_PATH" 2>/dev/null || python3 -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$BIN_PATH" 2>/dev/null)"
50
50
  [ -z "$REAL_BIN" ] && continue
51
51
  # Walk up from dist/rcode.js → package root → server/dashboard.js
52
52
  PKG_ROOT="$(dirname "$(dirname "$REAL_BIN")")"
@@ -7,6 +7,7 @@ Orchestrator stays lean: parse issues, spawn agents, collect results, synthesize
7
7
  </purpose>
8
8
 
9
9
  @.rihal/references/karpathy-guidelines.md
10
+ @.rihal/references/thinking-models-debug.md
10
11
 
11
12
  ## Step 0 — Usage check
12
13
 
@@ -115,6 +116,7 @@ For each issue, fill the debug-subagent-prompt template and spawn:
115
116
  Task(
116
117
  prompt=filled_debug_subagent_prompt + "\n\n<files_to_read>\n- .rihal/STATE.md\n</files_to_read>\n${AGENT_SKILLS_DEBUGGER}",
117
118
  subagent_type="rihal-debugger",
119
+ model="sonnet",
118
120
  description="Debug: {truth_short}"
119
121
  )
120
122
  ```
@@ -262,3 +264,9 @@ If arguments are invalid, missing files, or subagent fails:
262
264
  - Check that required files exist
263
265
  - Retry with clearer arguments or report the specific error to the user
264
266
 
267
+
268
+ ## On Completion
269
+
270
+ /rihal-code-review {phase} — review the fix before committing
271
+ /rihal-verify-work {phase} — re-run UAT after the fix
272
+ /rihal-execute {phase} --gaps-only — re-run just the failing plans
@@ -53,7 +53,7 @@ QUERY_ARGS=()
53
53
  [ -n "$LIMIT" ] && QUERY_ARGS+=(--limit "$LIMIT")
54
54
  [ -n "$PROJECT" ] && QUERY_ARGS+=(--project "$PROJECT")
55
55
  [ -n "$SINCE" ] && QUERY_ARGS+=(--since "$SINCE")
56
- RESULT=$(node .rihal/bin/rihal-tools.cjs state decisions-global "${QUERY_ARGS[@]}")
56
+ RESULT=$(node .rihal/bin/rihal-tools.cjs state decisions-global "${QUERY_ARGS[@]}" 2>/dev/null || echo '{"decisions":[],"total":0}')
57
57
  ```
58
58
 
59
59
  The result is JSON: `{decisions: [...], total: N}`. If `decisions` is empty:
@@ -72,3 +72,9 @@ State changes — .rihal/state.json
72
72
  - Git error (invalid SHAs, not a repo) → Show git error
73
73
  - state.json missing for `--last` → "Cannot find session info. Use explicit SHAs or no args."
74
74
  - No changes → Return message "No changes between {shas}"
75
+
76
+ ## On Completion
77
+
78
+ /rihal-plan {phase} — plan fixes for changes seen in the diff
79
+ /rihal-execute {phase} — execute the phase
80
+ /rihal-progress — see full roadmap status