@hanzlaa/rcode 3.6.8 → 3.6.15

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 (142) hide show
  1. package/AGENTS.md +1 -1
  2. package/CONTRIBUTING.md +1 -1
  3. package/README.md +3 -3
  4. package/cli/generate-command-skills.cjs +5 -12
  5. package/cli/index.js +5 -1
  6. package/cli/lib/manifest.cjs +51 -43
  7. package/dist/rcode.js +32 -35
  8. package/package.json +3 -2
  9. package/rihal/bin/rihal-tools.cjs +45 -24
  10. package/rihal/commands/add-todo.md +1 -1
  11. package/rihal/commands/check-implementation-readiness.md +18 -0
  12. package/rihal/commands/create-architecture.md +18 -0
  13. package/rihal/commands/debug.md +1 -1
  14. package/rihal/commands/edit-prd.md +18 -0
  15. package/rihal/commands/memory-audit.md +1 -1
  16. package/rihal/commands/memory-distill.md +1 -1
  17. package/rihal/commands/memory-init.md +1 -1
  18. package/rihal/commands/memory-update.md +1 -1
  19. package/rihal/commands/progress.md +1 -1
  20. package/rihal/commands/resume-work.md +1 -1
  21. package/rihal/commands/retrospective.md +18 -0
  22. package/rihal/commands/review-edge-case-hunter.md +18 -0
  23. package/rihal/commands/scaffold-project.md +18 -0
  24. package/rihal/commands/validate-prd.md +18 -0
  25. package/rihal/references/agent-contracts.md +46 -20
  26. package/rihal/references/continuation-format.md +5 -6
  27. package/rihal/references/model-profile-resolution.md +41 -5
  28. package/rihal/references/phase-argument-parsing.md +31 -7
  29. package/rihal/references/research-synthesis-playbook.md +1 -1
  30. package/rihal/references/revision-loop.md +36 -9
  31. package/rihal/references/universal-anti-patterns.md +56 -12
  32. package/rihal/skills/SKILLS_INDEX.md +34 -5
  33. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/SKILL.md +1 -0
  34. package/rihal/skills/actions/1-analysis/research/rihal-market-research/SKILL.md +1 -0
  35. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/SKILL.md +1 -0
  36. package/rihal/skills/actions/1-analysis/rihal-document-project/SKILL.md +1 -0
  37. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +1 -0
  38. package/rihal/skills/actions/1-analysis/rihal-product-brief/SKILL.md +1 -0
  39. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +1 -0
  40. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/workflow.md +12 -0
  41. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +1 -0
  42. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-06-phase-stubs.md +1 -1
  43. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-10-complete.md +1 -1
  44. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +1 -0
  45. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +1 -0
  46. package/rihal/skills/actions/2-plan/rihal-create-ux-design/SKILL.md +1 -0
  47. package/rihal/skills/actions/2-plan/rihal-edit-prd/SKILL.md +1 -0
  48. package/rihal/skills/actions/2-plan/rihal-frontend-design/SKILL.md +1 -0
  49. package/rihal/skills/actions/2-plan/rihal-validate-prd/SKILL.md +1 -0
  50. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/SKILL.md +1 -0
  51. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/SKILL.md +1 -0
  52. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/SKILL.md +1 -0
  53. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +1 -0
  54. package/rihal/skills/actions/4-implementation/rihal-code-review/SKILL.md +1 -0
  55. package/rihal/skills/actions/4-implementation/rihal-correct-course/SKILL.md +1 -0
  56. package/rihal/skills/actions/4-implementation/rihal-debug/SKILL.md +4 -16
  57. package/rihal/skills/actions/4-implementation/rihal-dev-story/SKILL.md +1 -0
  58. package/rihal/skills/actions/4-implementation/rihal-dev-story/workflow.md +13 -0
  59. package/rihal/skills/actions/4-implementation/rihal-qa-generate-e2e-tests/SKILL.md +1 -0
  60. package/rihal/skills/actions/4-implementation/rihal-retrospective/SKILL.md +1 -0
  61. package/rihal/skills/actions/4-implementation/rihal-retrospective/workflow.md +12 -0
  62. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/SKILL.md +1 -0
  63. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +1 -0
  64. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/workflow.md +12 -0
  65. package/rihal/skills/actions/4-implementation/rihal-sprint-status/SKILL.md +1 -0
  66. package/rihal/skills/agents/ahmed-hassani-director/SKILL.md +1 -0
  67. package/rihal/skills/agents/dalil-scout/SKILL.md +1 -0
  68. package/rihal/skills/agents/fatima-qa/SKILL.md +1 -0
  69. package/rihal/skills/agents/haitham-frontend/SKILL.md +1 -0
  70. package/rihal/skills/agents/hanzla-engineer/SKILL.md +1 -0
  71. package/rihal/skills/agents/hussain-pm/SKILL.md +1 -0
  72. package/rihal/skills/agents/hussain-sm/SKILL.md +1 -0
  73. package/rihal/skills/agents/layla-designer/SKILL.md +1 -0
  74. package/rihal/skills/agents/majlis-council/SKILL.md +1 -0
  75. package/rihal/skills/agents/mariam-marketing/SKILL.md +1 -0
  76. package/rihal/skills/agents/nasser-eng-manager/SKILL.md +1 -0
  77. package/rihal/skills/agents/noor-writer/SKILL.md +1 -0
  78. package/rihal/skills/agents/raees-orchestrator/SKILL.md +1 -0
  79. package/rihal/skills/agents/rihal-cross-platform-auditor/SKILL.md +1 -0
  80. package/rihal/skills/agents/rihal-dep-auditor/SKILL.md +1 -0
  81. package/rihal/skills/agents/rihal-deviation-analyzer/SKILL.md +1 -0
  82. package/rihal/skills/agents/rihal-i18n-auditor/SKILL.md +1 -0
  83. package/rihal/skills/agents/rihal-observability-auditor/SKILL.md +1 -0
  84. package/rihal/skills/agents/sadiq-analyst/SKILL.md +1 -0
  85. package/rihal/skills/agents/waleed-architect/SKILL.md +1 -0
  86. package/rihal/skills/agents/yousef-backend/SKILL.md +1 -0
  87. package/rihal/skills/agents/zahra-branding/SKILL.md +1 -0
  88. package/rihal/skills/agents/zayd-ml/SKILL.md +1 -0
  89. package/rihal/skills/core/rihal-init/SKILL.md +1 -1
  90. package/rihal/skills/core/rihal-memory-audit/SKILL.md +5 -5
  91. package/rihal/skills/core/rihal-memory-distill/SKILL.md +5 -5
  92. package/rihal/skills/core/rihal-memory-init/SKILL.md +7 -7
  93. package/rihal/skills/core/rihal-memory-update/SKILL.md +4 -4
  94. package/rihal/team.yaml +56 -0
  95. package/rihal/templates/UAT.md +69 -18
  96. package/rihal/templates/memory/INDEX.md +2 -2
  97. package/rihal/templates/memory/distillates/project.distillate.md +2 -2
  98. package/rihal/templates/memory/distillates/stack.distillate.md +2 -2
  99. package/rihal/templates/memory/project/stack.md +1 -1
  100. package/rihal/templates/summary.md +54 -37
  101. package/rihal/templates/verification-report.md +72 -17
  102. package/rihal/workflows/analyze-dependencies.md +4 -4
  103. package/rihal/workflows/audit-fix.md +3 -3
  104. package/rihal/workflows/audit-milestone.md +12 -11
  105. package/rihal/workflows/audit-worktrees.md +163 -0
  106. package/rihal/workflows/audit.md +18 -3
  107. package/rihal/workflows/autonomous.md +2 -2
  108. package/rihal/workflows/correct-course.md +3 -3
  109. package/rihal/workflows/create-architecture.md +3 -3
  110. package/rihal/workflows/create-epics-and-stories.md +3 -3
  111. package/rihal/workflows/create-prd.md +1 -1
  112. package/rihal/workflows/diagnose-issues.md +75 -22
  113. package/rihal/workflows/discuss-phase-power.md +1 -1
  114. package/rihal/workflows/discuss-phase.md +1 -1
  115. package/rihal/workflows/document-project.md +3 -3
  116. package/rihal/workflows/edit-prd.md +3 -3
  117. package/rihal/workflows/execute-milestone.md +3 -3
  118. package/rihal/workflows/execute-sprint.md +1 -1
  119. package/rihal/workflows/execute-waves.md +27 -2
  120. package/rihal/workflows/forensics.md +3 -3
  121. package/rihal/workflows/health.md +19 -4
  122. package/rihal/workflows/help.md +0 -2
  123. package/rihal/workflows/memory-audit.md +2 -2
  124. package/rihal/workflows/memory-distill.md +2 -2
  125. package/rihal/workflows/memory-init.md +2 -2
  126. package/rihal/workflows/memory-update.md +2 -2
  127. package/rihal/workflows/new-project-roadmap.md +2 -2
  128. package/rihal/workflows/plan-research-validation.md +2 -2
  129. package/rihal/workflows/plan.md +7 -7
  130. package/rihal/workflows/research-phase.md +1 -1
  131. package/rihal/workflows/retrospective.md +3 -3
  132. package/rihal/workflows/review-adversarial.md +8 -6
  133. package/rihal/workflows/review.md +2 -2
  134. package/rihal/workflows/scaffold-project.md +3 -3
  135. package/rihal/workflows/secure-phase.md +4 -4
  136. package/rihal/workflows/session-report.md +1 -1
  137. package/rihal/workflows/status.md +6 -10
  138. package/rihal/workflows/validate-prd.md +4 -4
  139. package/rihal/workflows/verify-phase.md +3 -3
  140. package/rihal/workflows/verify-work.md +1 -1
  141. package/rihal/workflows/workstream.md +3 -3
  142. package/server/lib/html/client/views/MemoryView.js +6 -6
@@ -26,6 +26,7 @@ If `$ARGUMENTS` contains `--help` or `-h`:
26
26
  /rihal-audit fix # → /rihal-audit-fix
27
27
  /rihal-audit work # → /rihal-verify-work
28
28
  /rihal-audit lens [<1-15> | all] # → /rihal-lens-audit (15-lens methodology)
29
+ /rihal-audit worktrees [--prune] # → scan + report orphaned executor worktrees/branches
29
30
  ```
30
31
 
31
32
  **Examples:**
@@ -48,7 +49,7 @@ DISCUSS=$($TOOL config-get workflow.discuss_mode 2>/dev/null || echo "adaptive")
48
49
  ```
49
50
 
50
51
  Parse `$ARGUMENTS`:
51
- - First word ∈ {plans, phase, milestone, uat, code, fix, work, lens} → set `$TARGET`, drop it from args, jump to Step 4.
52
+ - First word ∈ {plans, phase, milestone, uat, code, fix, work, lens, worktrees} → set `$TARGET`, drop it from args, jump to Step 4.
52
53
  - Empty or unrecognised → continue to Step 2.
53
54
 
54
55
  ## Step 2 — Detect project state
@@ -70,9 +71,20 @@ as `(no data — skip)`.
70
71
 
71
72
  ## Step 3 — Ask user (guided mode only)
72
73
 
74
+ Also probe for orphaned executor worktrees (add to context for Step 3 menu):
75
+
76
+ ```bash
77
+ ORPHAN_WTS=$(git worktree list --porcelain \
78
+ | awk '/^branch /{if($2 ~ /refs\/heads\/worktree-agent-/) print $2}' \
79
+ | wc -l)
80
+ ORPHAN_BR=$(git branch --list 'worktree-agent-*' 2>/dev/null | wc -l)
81
+ ORPHANS=$((ORPHAN_WTS + ORPHAN_BR))
82
+ ```
83
+
73
84
  If `$MODE` is `yolo`, skip this step and pick the most relevant target
74
- automatically (priority: `work` if dirty branch, else `plans` if PLANS>0
75
- and SUMMARIES<PLANS, else `milestone` if SUMMARIES>0, else `code`).
85
+ automatically (priority: `worktrees` if ORPHANS>0, else `work` if dirty
86
+ branch, else `plans` if PLANS>0 and SUMMARIES<PLANS, else `milestone` if
87
+ SUMMARIES>0, else `code`).
76
88
 
77
89
  Otherwise call AskUserQuestion:
78
90
 
@@ -89,6 +101,7 @@ Options:
89
101
  6. auto-fix — audit then auto-fix findings (uses #1–5 output)
90
102
  7. work — verify current branch / WIP ({ON_BRANCH}, dirty={DIRTY})
91
103
  8. lens — 15-lens methodology audit (security, perf, tests…)
104
+ 9. worktrees — orphaned executor worktrees/branches ({ORPHANS} found)
92
105
  0. cancel
93
106
  ```
94
107
 
@@ -110,6 +123,7 @@ sub-workflow.
110
123
  | fix | a prior audit report exists OR a prior `--report` artefact | `No audit findings yet. Run /rihal-audit first.` |
111
124
  | work | inside a git worktree | `Not in a git repo.` |
112
125
  | lens | `rihal/` or `.rihal/` directory exists | `No rihal source found. Run: npx @hanzlaa/rcode install .` |
126
+ | worktrees | git repo exists | `Not in a git repo.` |
113
127
 
114
128
  For `milestone` specifically, check the **graceful-degrade** condition
115
129
  (closes #234 audit-milestone halt):
@@ -153,6 +167,7 @@ Run the target's slash command, forwarding remaining args:
153
167
  | lens | `/rihal-lens-audit $REST_ARGS` |
154
168
  | fix | `/rihal-audit-fix $REST_ARGS` |
155
169
  | work | `/rihal-verify-work $REST_ARGS` |
170
+ | worktrees | execute `@.rihal/workflows/audit-worktrees.md` inline |
156
171
 
157
172
  ## Step 6 — Closing summary
158
173
 
@@ -18,7 +18,7 @@ interpos audit (issue #221) — DO NOT regress.
18
18
  2. **NEVER skip the methodology chain on greenfield projects.** Before
19
19
  the phase loop runs, the prerequisite check (next step) MUST verify:
20
20
  - `.planning/prd.md` exists (else halt → /rihal-create-prd)
21
- - ROADMAP.md has milestone structure (else halt → /rihal-create-milestone)
21
+ - ROADMAP.md has milestone structure (else halt → /rihal-new-milestone)
22
22
  - `.planning/epics.md` exists (else halt → /rihal-create-epics-and-stories)
23
23
  See issue #219 + #229.
24
24
 
@@ -68,7 +68,7 @@ If `SKIP_FLAG=false` AND any prerequisite is missing, HALT with a clear message:
68
68
 
69
69
  The autonomous flow assumes a project that has already gone through:
70
70
  1. /rihal-create-prd → produces .planning/prd.md
71
- 2. /rihal-create-milestone → produces ROADMAP.md with M1..Mn
71
+ 2. /rihal-new-milestone → produces ROADMAP.md with M1..Mn
72
72
  3. /rihal-create-epics-and-stories → produces .planning/epics.md
73
73
  4. THEN /rihal-autonomous ← you are here
74
74
 
@@ -191,6 +191,6 @@ Run remediation with:
191
191
 
192
192
  ## ▶ Next Up
193
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
194
+ - /rihal-execute {phase}
195
+ - /rihal-plan {phase}
196
+ - /rihal-progress
@@ -26,6 +26,6 @@ Skill not installed — run: npx @hanzlaa/rcode install
26
26
 
27
27
  ## ▶ Next Up
28
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
29
+ - /rihal-plan {phase}
30
+ - /rihal-council {architecture-question}
31
+ - /rihal-create-prd
@@ -374,6 +374,6 @@ If arguments are invalid, missing files, or subagent fails:
374
374
 
375
375
  ## ▶ Next Up
376
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
377
+ - /rihal-sprint-planning
378
+ - /rihal-dev-story {story-id}
379
+ - /rihal-edit-prd
@@ -21,5 +21,5 @@ Skill not installed — run: npx @hanzlaa/rcode install
21
21
  ## On Completion
22
22
 
23
23
  /rihal-validate-prd — validate the PRD for completeness
24
- /rihal-create-milestone — build the milestone roadmap from the PRD
24
+ /rihal-new-milestone — build the milestone roadmap from the PRD
25
25
  /rihal-edit-prd — revise the PRD
@@ -1,34 +1,87 @@
1
- # Workflow: rihal-diagnose-issues
2
-
3
1
  <purpose>
4
- Reusable diagnosis subroutine called from /rihal-verify-work when
5
- verification fails. Walks symptom → hypothesis → evidence → minimal
6
- repro and returns a structured finding. Not a top-level command.
2
+ Diagnose issues surfaced during /rihal:verify-work. For each failed acceptance criterion, identify root cause, classify severity, and decide whether to fix in-flight or file as follow-up.
3
+
4
+ Spawned by /rihal:verify-work when verification fails. Not typically called directly by users.
7
5
  </purpose>
8
6
 
9
- ## Step 1 — Symptom capture
7
+ <required_reading>
8
+ @.rihal/references/output-format.md
9
+ @.rihal/references/common-bug-patterns.md
10
+ @.rihal/references/verification-patterns.md
11
+ </required_reading>
12
+
13
+ <process>
14
+
15
+ ## 1. Receive failure list
16
+
17
+ `/rihal:verify-work` passes a structured list of failures:
18
+
19
+ ```json
20
+ [
21
+ {
22
+ "criterion": "Auth login completes in <2s",
23
+ "expected": "redirect to /dashboard within 2s of submit",
24
+ "actual": "redirected after 8s",
25
+ "evidence": "browser network log shows 6s spent on /api/me"
26
+ }
27
+ ]
28
+ ```
29
+
30
+ ## 2. For each failure — diagnose
31
+
32
+ Parallel-spawn one investigator per failure. Each investigator:
33
+
34
+ a. **Reproduce** locally using the verification steps from UAT.md.
35
+ b. **Bisect** — narrow down which file/function/commit introduced the regression. Use `git log --since` + `git bisect` if needed.
36
+ c. **Classify** — bug / config / docs / environment / spec.
37
+ d. **Severity** — critical (blocks ship) / high (degrades core feature) / medium (workaround exists) / low (cosmetic).
38
+ e. **Root cause** — one-sentence explanation.
39
+ f. **Fix proposal** — one of:
40
+ - **In-flight** — small enough to fix in this phase before merging
41
+ - **Follow-up** — substantial; file an issue and proceed
42
+ - **Stop** — phase shouldn't ship; halt and re-plan
43
+
44
+ ## 3. Aggregate diagnosis
45
+
46
+ Each investigator returns a structured diagnosis. The orchestrator collates:
47
+
48
+ ```
49
+ Failed criteria: 3
50
+ Diagnosis:
51
+ Critical: 1 (must fix before ship)
52
+ High: 1 (recommended fix in-flight)
53
+ Medium: 1 (file as follow-up, ship anyway)
54
+ ```
55
+
56
+ ## 4. Decide
57
+
58
+ - All criticals fixable in-flight → loop into rihal-code-fixer with the diagnosis bundle.
59
+ - Any critical not fixable in-flight → return STOP to verify-work; phase doesn't ship.
60
+ - Otherwise → file follow-ups, return PROCEED to verify-work.
10
61
 
11
- Record:
12
- - failing assertion / log line / wrong output
13
- - file:line where divergence first appears
14
- - last commit before symptom appeared (`git log -S<token>`)
62
+ ## 5. Output
15
63
 
16
- ## Step 2 Hypotheses
64
+ `DIAGNOSIS.md` per failure, written to `.planning/phases/<NN>/diagnosis/<criterion-slug>.md`. Each contains:
17
65
 
18
- List 2–3 plausible causes. For each:
19
- - a one-line predicted mechanism
20
- - the cheapest test that would falsify it
66
+ - Reproduction steps
67
+ - Bisect result
68
+ - Root cause
69
+ - Severity + classification
70
+ - Fix proposal + estimated effort
21
71
 
22
- ## Step 3 Evidence
72
+ Plus an aggregate `DIAGNOSIS-INDEX.md` summarizing all failures and the orchestrator's decision.
23
73
 
24
- Run the falsifying tests in cheapest-first order. Stop at the first
25
- hypothesis that matches all evidence.
74
+ </process>
26
75
 
27
- ## Step 4 — Minimal repro
76
+ ## Success Criteria
28
77
 
29
- Reduce to the smallest input that still triggers the bug. Save under
30
- `.planning/diagnostics/<slug>.md`.
78
+ - [ ] Every failed criterion has a DIAGNOSIS.md file
79
+ - [ ] Each DIAGNOSIS.md has reproduction + root cause + fix proposal
80
+ - [ ] Critical failures either get in-flight fix or halt the phase
81
+ - [ ] Follow-up issues filed for medium/low items proceed without blocking ship
31
82
 
32
- ## Step 5 — Hand-off
83
+ ## On Error
33
84
 
34
- Return JSON: `{ root_cause, repro_path, suggested_fix }` to the caller.
85
+ - **Cannot reproduce** mark diagnosis status `cannot-reproduce`. Often signals environment drift between verifier and dev. File as follow-up; do not block ship if all other criticals pass.
86
+ - **Bisect inconclusive** — fall back to a hypothesis-driven investigation (read recent commits in the affected file, look for likely causes).
87
+ - **Repair budget exhausted** — STOP. Return control to user with the full diagnosis bundle.
@@ -294,7 +294,7 @@ CONTEXT.md written: {phase_dir}/{padded_phase}-CONTEXT.md
294
294
  Decisions captured: {answered}
295
295
  Deferred: {remaining}
296
296
 
297
- Next step: /rihal-plan-phase {N}
297
+ Next step: /rihal-plan {N}
298
298
  ```
299
299
  </step>
300
300
 
@@ -152,7 +152,7 @@ Phase number from argument (required).
152
152
  ```bash
153
153
  INIT=$(node ".rihal/bin/rihal-tools.cjs" init phase-op "${PHASE}")
154
154
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
155
- AGENT_SKILLS_ADVISOR=$(node ".rihal/bin/rihal-tools.cjs" agent-skills rihal-advisor 2>/dev/null)
155
+ AGENT_SKILLS_ADVISOR=$(node ".rihal/bin/rihal-tools.cjs" agent-skills rihal-advisor-researcher 2>/dev/null)
156
156
  ```
157
157
 
158
158
  Parse JSON for: `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `has_verification`, `plan_count`, `roadmap_exists`, `planning_exists`, `response_language`.
@@ -181,6 +181,6 @@ If .rihal/DOCS-AUDIT.md exists, check for missing/stale docs:
181
181
 
182
182
  ## ▶ Next Up
183
183
 
184
- - **Documentation updated:** `/rihal-progress` — see current project state
185
- - **Proceed to planning:** `/rihal-plan {phase}` — create executable plans
186
- - **Review with council:** `/rihal-council {question}` — debate approach
184
+ - /rihal-progress
185
+ - /rihal-plan {phase}
186
+ - /rihal-council {question}
@@ -26,6 +26,6 @@ Skill not installed — run: npx @hanzlaa/rcode install
26
26
 
27
27
  ## ▶ Next Up
28
28
 
29
- - **PRD updated:** `/rihal-validate-prd` — check completeness after changes
30
- - **Ready to plan:** `/rihal-create-milestone` — build milestone roadmap from PRD
31
- - **Review epics:** `/rihal-create-epics-and-stories` — update stories if scope changed
29
+ - /rihal-validate-prd
30
+ - /rihal-new-milestone
31
+ - /rihal-create-epics-and-stories
@@ -1,6 +1,6 @@
1
1
  <purpose>
2
2
  Execute all phases in the current milestone in dependency order, with verify gates between waves. Closes #738.
3
- Reads the ROADMAP.md to determine phase ordering, executes each phase via /rihal-execute, runs /rihal-verify after each, and surfaces blockers before advancing.
3
+ Reads the ROADMAP.md to determine phase ordering, executes each phase via /rihal-execute, runs /rihal-verify-phase after each, and surfaces blockers before advancing.
4
4
  </purpose>
5
5
 
6
6
  <required_reading>
@@ -89,10 +89,10 @@ Spawn `rihal-verifier` for the phase. On `FAIL` or `PARTIAL`:
89
89
  ⚠ Verify gate: Phase {N} — {FAIL|PARTIAL}
90
90
 
91
91
  Gap count: {N}
92
- Recommendation: Run /rihal-sprint-plan {N} --gaps to close before advancing.
92
+ Recommendation: Run /rihal-plan {N} --gaps to close before advancing.
93
93
 
94
94
  Options:
95
- 1. Close gaps now (spawn /rihal-sprint-plan --gaps) [Recommended]
95
+ 1. Close gaps now (spawn /rihal-plan --gaps) [Recommended]
96
96
  2. Advance anyway (log gap, continue to next phase)
97
97
  3. Abort milestone execution
98
98
  ```
@@ -582,7 +582,7 @@ If `USER_SETUP_CREATED=true`: display `⚠️ USER SETUP REQUIRED` with path + e
582
582
  | Condition | Route | Action |
583
583
  |-----------|-------|--------|
584
584
  | summaries < plans | **A: More plans** | Find next PLAN without SUMMARY. Yolo: auto-continue. Interactive: show next plan, suggest `/rihal-execute {phase}` + `/rihal-verify-work`. STOP here. |
585
- | summaries = plans, current < highest phase | **B: Phase done** | Show completion, suggest `/rihal-plan-phase {Z+1}` + `/rihal-verify-work {Z}` + `/rihal-discuss-phase {Z+1}` |
585
+ | summaries = plans, current < highest phase | **B: Phase done** | Show completion, suggest `/rihal-plan {Z+1}` + `/rihal-verify-work {Z}` + `/rihal-discuss-phase {Z+1}` |
586
586
  | summaries = plans, current = highest phase | **C: Milestone done** | Show banner, suggest `/rihal-complete-milestone` + `/rihal-verify-work` + `/rihal-add-phase` |
587
587
 
588
588
  All routes: `/clear` first for fresh context.
@@ -280,8 +280,13 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
280
280
  When executor agents ran in worktree isolation, their commits land on temporary branches in separate working trees. After the wave completes, merge these changes back and clean up:
281
281
 
282
282
  ```bash
283
- # List worktrees created by this wave's agents
284
- WORKTREES=$(git worktree list --porcelain | grep "^worktree " | grep -v "$(pwd)$" | sed 's/^worktree //')
283
+ # IMPORTANT: only touch worktrees whose branch starts with "worktree-agent-".
284
+ # Claude Code's EnterWorktree names all auto-created branches with this prefix.
285
+ # A broad "all non-primary worktrees" grep is dangerous — it would also pick up
286
+ # manually-created worktrees (feature branches, other milestone workspaces, etc.)
287
+ # and either corrupt or delete work that wasn't part of this execution.
288
+ WORKTREES=$(git worktree list --porcelain \
289
+ | awk '/^worktree /{path=$2} /^branch /{if($2 ~ /refs\/heads\/worktree-agent-/) print path}')
285
290
 
286
291
  for WT in $WORKTREES; do
287
292
  # Get the branch name for this worktree
@@ -358,6 +363,26 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
358
363
 
359
364
  **If no worktrees found:** Skip silently — agents may have been spawned without worktree isolation.
360
365
 
366
+ **Post-cleanup verification (mandatory):** After the loop, confirm no `worktree-agent-*` worktrees or branches remain:
367
+
368
+ ```bash
369
+ LEFTOVER_WT=$(git worktree list --porcelain \
370
+ | awk '/^branch /{if($2 ~ /refs\/heads\/worktree-agent-/) print $2}')
371
+ LEFTOVER_BR=$(git branch --list 'worktree-agent-*' 2>/dev/null)
372
+
373
+ if [ -n "$LEFTOVER_WT" ] || [ -n "$LEFTOVER_BR" ]; then
374
+ echo "⚠ WORKTREE LEAK: leftover executor artifacts detected after cleanup:"
375
+ [ -n "$LEFTOVER_WT" ] && echo " Worktrees: $LEFTOVER_WT"
376
+ [ -n "$LEFTOVER_BR" ] && echo " Branches: $LEFTOVER_BR"
377
+ echo " Run: /rihal-audit worktrees to inspect and prune"
378
+ else
379
+ echo "✓ Worktree cleanup verified — no executor artifacts remain"
380
+ fi
381
+ ```
382
+
383
+ Do NOT silently skip this check. If leaks are found, surface them — the user's next
384
+ `/rihal-status` should not show surprise worktrees from a previous execution.
385
+
361
386
  5.6. **Post-wave shared artifact update (worktree mode only):**
362
387
 
363
388
  When executor agents ran with `isolation="worktree"`, they skipped STATE.md and ROADMAP.md updates to avoid last-merge-wins overwrites. The orchestrator is the single writer for these files. After worktrees are merged back, update shared artifacts once:
@@ -204,6 +204,6 @@ If arguments are invalid, missing files, or subagent fails:
204
204
 
205
205
  After reviewing the diagnostic report, pick your recovery path:
206
206
 
207
- - **Phase stuck mid-execution:** `/rihal-resume-work`
208
- - **Phase planned but not executed:** `/rihal-execute {phase-number}`
209
- - **No incomplete work found:** `/rihal-progress` — view current state
207
+ - /rihal-resume-work
208
+ - /rihal-execute {phase-number}
209
+ - /rihal-progress
@@ -203,6 +203,20 @@ print(len(phantom))
203
203
  If 0 phantoms: `✓ PASS — no phantom-complete phases detected`
204
204
  If any: `⚠ WARN — {N} phantom-complete phase(s) detected. Run: /rihal-audit to inspect`
205
205
 
206
+ **Check 10 — no orphaned executor worktrees or branches**
207
+
208
+ ```bash
209
+ ORPHAN_WTS=$(git worktree list --porcelain \
210
+ | awk '/^branch /{if($2 ~ /refs\/heads\/worktree-agent-/) print $2}' \
211
+ | wc -l 2>/dev/null || echo 0)
212
+ ORPHAN_BR=$(git branch --list 'worktree-agent-*' 2>/dev/null | wc -l || echo 0)
213
+ ORPHANS=$((ORPHAN_WTS + ORPHAN_BR))
214
+ echo "$ORPHANS"
215
+ ```
216
+
217
+ If `ORPHANS` is 0: `✓ PASS — no orphaned executor worktrees or branches`
218
+ If `ORPHANS > 0`: `⚠ WARN — ${ORPHANS} orphaned worktree-agent-* artifact(s) from a previous /rihal-execute. Run: /rihal-audit worktrees --prune`
219
+
206
220
  ---
207
221
 
208
222
  ## Step 7 — Count results and print final summary
@@ -213,7 +227,7 @@ Total: `{N}/9 checks passed`
213
227
 
214
228
  If all 9 pass:
215
229
  ```
216
- ✓ All systems nominal — rihal is healthy
230
+ ✓ All systems nominal — rihal is healthy (9/9)
217
231
  ```
218
232
 
219
233
  If fewer than 9 pass:
@@ -221,6 +235,7 @@ If fewer than 9 pass:
221
235
  ⚠ {N}/9 checks passed — {M} issue(s) found
222
236
  Run: /rihal-update to repair installation issues
223
237
  Run: /rihal-status for project-state issues
238
+ Run: /rihal-audit worktrees --prune to clean orphaned executor artifacts
224
239
  ```
225
240
 
226
241
  ## Success Criteria
@@ -238,6 +253,6 @@ Run: /rihal-status for project-state issues
238
253
 
239
254
  ## ▶ Next Up
240
255
 
241
- - **Issues found:** `/rihal-forensics` — deep diagnostic on specific failures
242
- - **Ready to continue:** `/rihal-do` — interactive router guides next step
243
- - **Fix specific phase:** `/rihal-correct-course {phase}` — targeted correction
256
+ - /rihal-forensics
257
+ - /rihal-do
258
+ - /rihal-correct-course {phase}
@@ -231,7 +231,6 @@ init → new-project → plan → execute → next → status → ship
231
231
  | `/rihal-dev-story <file>` | Execute an approved STORY by writing tests + code per AC. |
232
232
  | (internal) `check-implementation-readiness` | Guard called by `/rihal-plan` and `/rihal-execute` to verify PRD + architecture aligned before build. |
233
233
  | `/rihal-create-architecture` | Write an Architecture Decision Record (ADR). |
234
- | `/rihal-create-ux-design` | Realize a UX design that informs architecture and implementation. |
235
234
  | `/rihal-correct-course` | Course-correct mid-sprint when major change is discovered. |
236
235
  | `/rihal-sprint-planning` | Compute capacity, prioritize stories, create SPRINT.md. |
237
236
  | `/rihal-sprint-status` | Sprint progress — stories, points, velocity, burndown. |
@@ -269,7 +268,6 @@ init → new-project → plan → execute → next → status → ship
269
268
  | `/rihal-autonomous` | Run remaining phases autonomously — plan → execute → verify cycles. |
270
269
  | `/rihal-research-phase <n>` | Standalone research (usually use `/rihal-plan` instead). |
271
270
  | `/rihal-analyze-dependencies` | Suggest "Depends on" entries for ROADMAP.md. |
272
- | `/rihal-list-phase-assumptions <n>` | Surface agent's intended approach before planning. |
273
271
  | `/rihal-profile-user` | Classify developer on 4 dimensions, produce profile artifact. |
274
272
  | `/rihal-dashboard` | Start the Diwan view-only dashboard (port 7717). |
275
273
  | `/rihal-health` | 6-point health check of the Rihal installation. |
@@ -33,7 +33,7 @@ fi
33
33
 
34
34
  ## Halt conditions
35
35
 
36
- - Memory Bank not initialised → instruct to run `/rcode:memory-init` first
36
+ - Memory Bank not initialised → instruct to run `/rihal-memory-init` first
37
37
 
38
38
  ---
39
39
 
@@ -77,7 +77,7 @@ For `change-records/`, `incidents/post-mortems/`, `milestones/archive/`:
77
77
  For each `distillates/*.distillate.md`:
78
78
  - Read frontmatter `source-digest`
79
79
  - Recompute digest of current source files (per `rcode-memory-distill` rules)
80
- - If mismatch, emit a `warn` finding suggesting `/rcode:memory-distill`
80
+ - If mismatch, emit a `warn` finding suggesting `/rihal-memory-distill`
81
81
 
82
82
  ### Step 8 — Render report
83
83
 
@@ -20,7 +20,7 @@ Regenerate Memory Bank distillates with lossless compression. Idempotent.
20
20
 
21
21
  ## Halt conditions
22
22
 
23
- - `.rihal/memory/` missing → instruct to run `/rcode:memory-init` first
23
+ - `.rihal/memory/` missing → instruct to run `/rihal-memory-init` first
24
24
  - All sources empty (only template placeholders) → warn and exit; no point distilling empty content
25
25
 
26
26
  ---
@@ -70,7 +70,7 @@ For each target distillate, write:
70
70
  ---
71
71
  generated: true
72
72
  do-not-edit: true
73
- regenerate-with: /rcode:memory-distill
73
+ regenerate-with: /rihal-memory-distill
74
74
  source-digest: <hash>
75
75
  generated-at: <ISO datetime>
76
76
  source-files:
@@ -41,7 +41,7 @@ If `INDEX.md` exists:
41
41
  - List every file under `.rihal/memory/`
42
42
  - For each, count non-template lines (lines that don't start with `<!--` or contain `_(...)_` placeholders)
43
43
  - Print which files are empty / template-only and which are populated
44
- - Suggest `/rcode:memory-update` for surgical edits and exit
44
+ - Suggest `/rihal-memory-update` for surgical edits and exit
45
45
 
46
46
  ### Step 2 — Copy templates
47
47
 
@@ -90,7 +90,7 @@ Add or update the `memory_bank` block in `.rihal/state.json`:
90
90
  Show:
91
91
  - File tree of `.rihal/memory/`
92
92
  - Files seeded vs files still empty
93
- - Suggested next command: `/rcode:memory-distill`
93
+ - Suggested next command: `/rihal-memory-distill`
94
94
 
95
95
  ---
96
96
 
@@ -15,7 +15,7 @@ Append-only surgical update to a single Memory Bank file. Never rewrites, never
15
15
 
16
16
  ## Preconditions
17
17
 
18
- - `.rihal/memory/` exists (run `/rcode:memory-init` first)
18
+ - `.rihal/memory/` exists (run `/rihal-memory-init` first)
19
19
 
20
20
  ## Halt conditions
21
21
 
@@ -72,7 +72,7 @@ For `change-records/`:
72
72
 
73
73
  ### Step 5 — Suggest distillate refresh
74
74
 
75
- If the change was to `project/`, `milestones/current.md`, or `incidents/`, suggest `/rcode:memory-distill` to refresh distillates. Optional, not enforced.
75
+ If the change was to `project/`, `milestones/current.md`, or `incidents/`, suggest `/rihal-memory-distill` to refresh distillates. Optional, not enforced.
76
76
 
77
77
  ---
78
78
 
@@ -367,7 +367,7 @@ PHASE1_HAS_UI=$(echo "$PHASE1_SECTION" | grep -qi "UI hint.*yes" && echo "true"
367
367
 
368
368
  **Also available:**
369
369
  - /rihal-ui-phase 1 — generate UI design contract (recommended for frontend phases)
370
- - /rihal-plan-phase 1 — skip discussion, plan directly
370
+ - /rihal-plan 1 — skip discussion, plan directly
371
371
 
372
372
  ───────────────────────────────────────────────────────────────
373
373
  ```
@@ -388,7 +388,7 @@ PHASE1_HAS_UI=$(echo "$PHASE1_SECTION" | grep -qi "UI hint.*yes" && echo "true"
388
388
  ---
389
389
 
390
390
  **Also available:**
391
- - /rihal-plan-phase 1 — skip discussion, plan directly
391
+ - /rihal-plan 1 — skip discussion, plan directly
392
392
 
393
393
  ───────────────────────────────────────────────────────────────
394
394
  ```
@@ -232,7 +232,7 @@ If `TEXT_MODE` is true, present as a plain-text numbered list:
232
232
  ```
233
233
  Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?
234
234
 
235
- 1. Generate UI-SPEC first — Run /rihal-ui-phase {N} then re-run /rihal-sprint-plan {N}
235
+ 1. Generate UI-SPEC first — Run /rihal-ui-phase {N} then re-run /rihal-plan {N}
236
236
  2. Continue without UI-SPEC
237
237
  3. Not a frontend phase
238
238
 
@@ -243,7 +243,7 @@ Otherwise use AskUserQuestion:
243
243
  - header: "UI Design Contract"
244
244
  - question: "Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?"
245
245
  - options:
246
- - "Generate UI-SPEC first" → Display: "Run `/rihal-ui-phase {N} ${Rihal_WS}` then re-run `/rihal-sprint-plan {N} ${Rihal_WS}`". Exit workflow.
246
+ - "Generate UI-SPEC first" → Display: "Run `/rihal-ui-phase {N} ${Rihal_WS}` then re-run `/rihal-plan {N} ${Rihal_WS}`". Exit workflow.
247
247
  - "Continue without UI-SPEC" → Continue to step 6.
248
248
  - "Not a frontend phase" → Continue to step 6.
249
249
 
@@ -174,7 +174,7 @@ No REVIEWS.md found for Phase {N}. Run reviews first:
174
174
 
175
175
  /rihal-review --phase {N}
176
176
 
177
- Then re-run /rihal-sprint-plan {N} --reviews
177
+ Then re-run /rihal-plan {N} --reviews
178
178
  ```
179
179
  Exit workflow.
180
180
 
@@ -322,7 +322,7 @@ If "Run discuss-phase first":
322
322
  does not work correctly in nested subcontexts (#1009). Instead, display the command
323
323
  and exit so the user runs it as a top-level command:
324
324
  ```
325
- Run this command first, then re-run /rihal-sprint-plan {X} ${Rihal_WS}:
325
+ Run this command first, then re-run /rihal-plan {X} ${Rihal_WS}:
326
326
 
327
327
  /rihal-discuss-phase {X} ${Rihal_WS}
328
328
  ```
@@ -443,7 +443,7 @@ VALIDATION_EXISTS=$(ls "${PHASE_DIR}"/*-VALIDATION.md 2>/dev/null | head -1)
443
443
  ```
444
444
 
445
445
  If missing and Nyquist is still enabled/applicable — ask user:
446
- 1. Re-run: `/rihal-sprint-plan {PHASE} --research ${Rihal_WS}`
446
+ 1. Re-run: `/rihal-plan {PHASE} --research ${Rihal_WS}`
447
447
  2. Disable Nyquist with the exact command:
448
448
  `node ".rihal/bin/rihal-tools.cjs" config-set workflow.nyquist_validation false`
449
449
  3. Continue anyway (plans fail Dimension 8)
@@ -935,9 +935,9 @@ Verification: {Passed | Passed with override | Skipped}
935
935
 
936
936
  **Also available:**
937
937
  - cat .planning/phases/{phase-dir}/*-SPRINT.md — review plans
938
- - /rihal-sprint-plan {X} --research — re-research first
938
+ - /rihal-plan {X} --research — re-research first
939
939
  - /rihal-review --phase {X} --all — peer review plans with external AIs
940
- - /rihal-sprint-plan {X} --reviews — replan incorporating review feedback
940
+ - /rihal-plan {X} --reviews — replan incorporating review feedback
941
941
 
942
942
  ───────────────────────────────────────────────────────────────
943
943
  </offer_next>
@@ -958,11 +958,11 @@ stdio deadlocks with MCP servers — see Claude Code issue anthropics/claude-cod
958
958
  Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\tasks\*" -ErrorAction SilentlyContinue
959
959
  ```
960
960
  4. **Reduce MCP server count:** Temporarily disable non-essential MCP servers in settings.json
961
- 5. **Retry:** Restart Claude Code and run `/rihal-sprint-plan` again
961
+ 5. **Retry:** Restart Claude Code and run `/rihal-plan` again
962
962
 
963
963
  If freezes persist, try `--skip-research` to reduce the agent chain from 3 to 2 agents:
964
964
  ```
965
- /rihal-sprint-plan N --skip-research
965
+ /rihal-plan N --skip-research
966
966
  ```
967
967
  </windows_troubleshooting>
968
968
 
@@ -44,7 +44,7 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
44
44
  # If INIT is empty or INIT.ok is false: print "Error: rihal-tools init failed." and exit.
45
45
  # Extract: phase_dir, padded_phase, phase_number, state_path, requirements_path, context_path, response_language
46
46
  # If response_language is set, include "Respond in {value}." in all spawned subagent prompts.
47
- AGENT_SKILLS_RESEARCHER=$(node ".rihal/bin/rihal-tools.cjs" agent-skills rihal-researcher 2>/dev/null)
47
+ AGENT_SKILLS_RESEARCHER=$(node ".rihal/bin/rihal-tools.cjs" agent-skills rihal-phase-researcher 2>/dev/null)
48
48
  ```
49
49
 
50
50
  ## Step 4: Spawn Researcher
@@ -26,6 +26,6 @@ Skill not installed — run: npx @hanzlaa/rcode install
26
26
 
27
27
  ## ▶ Next Up
28
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
29
+ - /rihal-new-milestone
30
+ - /rihal-progress
31
+ - /rihal-complete-milestone