@hanzlaa/rcode 3.4.33 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/AGENTS.md +6 -6
  2. package/CONTRIBUTING.md +2 -0
  3. package/LICENSE +21 -0
  4. package/README.md +66 -403
  5. package/cli/doctor.js +87 -1
  6. package/cli/install.js +122 -31
  7. package/cli/lib/schemas.cjs +318 -0
  8. package/cli/postinstall.js +19 -3
  9. package/dist/rcode.js +316 -23
  10. package/package.json +8 -4
  11. package/rihal/agents/rihal-cross-platform-auditor.md +1 -1
  12. package/rihal/agents/rihal-dep-auditor.md +1 -1
  13. package/rihal/agents/rihal-docs-auditor.md +3 -145
  14. package/rihal/agents/rihal-i18n-auditor.md +1 -1
  15. package/rihal/agents/rihal-nyquist-auditor.md +4 -156
  16. package/rihal/agents/rihal-observability-auditor.md +1 -1
  17. package/rihal/bin/rihal-hooks.cjs +394 -4
  18. package/rihal/bin/rihal-tools.cjs +891 -24
  19. package/rihal/commands/create-prd.md +18 -0
  20. package/rihal/commands/execute-milestone.md +18 -0
  21. package/rihal/commands/plan-milestone.md +18 -0
  22. package/rihal/commands/scaffold-milestone.md +18 -0
  23. package/rihal/commands/scaffold-skill.md +18 -0
  24. package/rihal/references/REFERENCES_INDEX.md +49 -7
  25. package/rihal/references/agent-contracts.md +10 -0
  26. package/rihal/references/design-tokens.md +98 -0
  27. package/rihal/references/docs-auditor-playbook.md +148 -0
  28. package/rihal/references/git-preflight.md +117 -0
  29. package/rihal/references/iterative-retrieval.md +85 -0
  30. package/rihal/references/nyquist-auditor-playbook.md +157 -0
  31. package/rihal/references/workstream-flag.md +2 -2
  32. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +9 -0
  33. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +9 -0
  34. package/rihal/skills/actions/4-implementation/rihal-ci/SKILL.md +4 -0
  35. package/rihal/skills/actions/4-implementation/rihal-code-review/steps/step-02-review.md +2 -2
  36. package/rihal/skills/actions/4-implementation/rihal-harden/SKILL.md +4 -0
  37. package/rihal/skills/actions/4-implementation/rihal-migrate/SKILL.md +4 -0
  38. package/rihal/skills/agents/haitham-frontend/SKILL.md +2 -0
  39. package/rihal/templates/settings-hooks.json +39 -0
  40. package/rihal/workflows/check-todos.md +4 -0
  41. package/rihal/workflows/code-review-fix.md +4 -3
  42. package/rihal/workflows/code-review.md +1 -1
  43. package/rihal/workflows/debug.md +1 -1
  44. package/rihal/workflows/dev-story.md +4 -0
  45. package/rihal/workflows/diff.md +2 -2
  46. package/rihal/workflows/do.md +16 -8
  47. package/rihal/workflows/docs-update.md +2 -2
  48. package/rihal/workflows/enable-hooks.md +6 -1
  49. package/rihal/workflows/execute-milestone.md +139 -0
  50. package/rihal/workflows/execute-regression-gates.md +1 -1
  51. package/rihal/workflows/execute-sprint.md +54 -2
  52. package/rihal/workflows/execute-verify-phase-goal.md +31 -4
  53. package/rihal/workflows/execute-waves.md +33 -5
  54. package/rihal/workflows/execute.md +40 -6
  55. package/rihal/workflows/help.md +1 -1
  56. package/rihal/workflows/import.md +1 -1
  57. package/rihal/workflows/lens-audit.md +39 -23
  58. package/rihal/workflows/list-workspaces.md +1 -1
  59. package/rihal/workflows/map-codebase.md +4 -4
  60. package/rihal/workflows/new-milestone.md +18 -1
  61. package/rihal/workflows/new-project-research.md +53 -1
  62. package/rihal/workflows/new-workspace.md +1 -1
  63. package/rihal/workflows/plan-milestone.md +105 -0
  64. package/rihal/workflows/plan-research-validation.md +1 -1
  65. package/rihal/workflows/plan-spawn-planner.md +1 -1
  66. package/rihal/workflows/plan.md +31 -3
  67. package/rihal/workflows/plant-seed.md +6 -0
  68. package/rihal/workflows/quick.md +11 -5
  69. package/rihal/workflows/research-phase.md +24 -0
  70. package/rihal/workflows/scaffold-milestone.md +60 -0
  71. package/rihal/workflows/scaffold-skill.md +137 -0
  72. package/rihal/workflows/scan.md +1 -1
  73. package/rihal/workflows/session-report.md +43 -3
  74. package/rihal/workflows/verify-work.md +3 -3
  75. package/server/dashboard.js +52 -5
  76. package/server/lib/html/client.js +723 -11
  77. package/server/lib/html/css.js +2046 -466
  78. package/server/lib/html/shell.js +227 -134
  79. package/server/lib/scanner.js +33 -0
  80. package/server/orchestrator.js +438 -0
@@ -0,0 +1,157 @@
1
+ # Nyquist Auditor Playbook
2
+
3
+ Shared reference `@`-included by `rihal-nyquist-auditor`. Holds the execution flow, structured-return formats, and success criteria for filling validation gaps.
4
+
5
+ <execution_flow>
6
+
7
+ <step name="load_context">
8
+ Read ALL files from `<files_to_read>`. Extract:
9
+ - Implementation: exports, public API, input/output contracts
10
+ - PLANs: requirement IDs, task structure, verify blocks
11
+ - SUMMARYs: what was implemented, files changed, deviations
12
+ - Test infrastructure: framework, config, runner commands, conventions
13
+ - Existing VALIDATION.md: current map, compliance status
14
+ </step>
15
+
16
+ <step name="analyze_gaps">
17
+ For each gap in `<gaps>`:
18
+
19
+ 1. Read related implementation files
20
+ 2. Identify observable behavior the requirement demands
21
+ 3. Classify test type:
22
+
23
+ | Behavior | Test Type |
24
+ |----------|-----------|
25
+ | Pure function I/O | Unit |
26
+ | API endpoint | Integration |
27
+ | CLI command | Smoke |
28
+ | DB/filesystem operation | Integration |
29
+
30
+ 4. Map to test file path per project conventions
31
+
32
+ Action by gap type:
33
+ - `no_test_file` → Create test file
34
+ - `test_fails` → Diagnose and fix the test (not impl)
35
+ - `no_automated_command` → Determine command, update map
36
+ </step>
37
+
38
+ <step name="generate_tests">
39
+ Convention discovery: existing tests → framework defaults → fallback.
40
+
41
+ | Framework | File Pattern | Runner | Assert Style |
42
+ |-----------|-------------|--------|--------------|
43
+ | pytest | `test_{name}.py` | `pytest {file} -v` | `assert result == expected` |
44
+ | jest | `{name}.test.ts` | `npx jest {file}` | `expect(result).toBe(expected)` |
45
+ | vitest | `{name}.test.ts` | `npx vitest run {file}` | `expect(result).toBe(expected)` |
46
+ | go test | `{name}_test.go` | `go test -v -run {Name}` | `if got != want { t.Errorf(...) }` |
47
+
48
+ Per gap: Write test file. One focused test per requirement behavior. Arrange/Act/Assert. Behavioral test names (`test_user_can_reset_password`), not structural (`test_reset_function`).
49
+ </step>
50
+
51
+ <step name="run_and_verify">
52
+ Execute each test. If passes: record success, next gap. If fails: enter debug loop.
53
+
54
+ Run every test. Never mark untested tests as passing.
55
+ </step>
56
+
57
+ <step name="debug_loop">
58
+ Max 3 iterations per failing test.
59
+
60
+ | Failure Type | Action |
61
+ |--------------|--------|
62
+ | Import/syntax/fixture error | Fix test, re-run |
63
+ | Assertion: actual matches impl but violates requirement | IMPLEMENTATION BUG → ESCALATE |
64
+ | Assertion: test expectation wrong | Fix assertion, re-run |
65
+ | Environment/runtime error | ESCALATE |
66
+
67
+ Track: `{ gap_id, iteration, error_type, action, result }`
68
+
69
+ After 3 failed iterations: ESCALATE with requirement, expected vs actual behavior, impl file reference.
70
+ </step>
71
+
72
+ <step name="report">
73
+ Resolved gaps: `{ task_id, requirement, test_type, automated_command, file_path, status: "green" }`
74
+ Escalated gaps: `{ task_id, requirement, reason, debug_iterations, last_error }`
75
+
76
+ Return one of three structured formats below.
77
+ </step>
78
+
79
+ </execution_flow>
80
+
81
+ <structured_returns>
82
+
83
+ ## GAPS FILLED
84
+
85
+ ```markdown
86
+ ## GAPS FILLED
87
+
88
+ **Phase:** {N} — {name}
89
+ **Resolved:** {count}/{count}
90
+
91
+ ### Tests Created
92
+ | # | File | Type | Command |
93
+ |---|------|------|---------|
94
+ | 1 | {path} | {unit/integration/smoke} | `{cmd}` |
95
+
96
+ ### Verification Map Updates
97
+ | Task ID | Requirement | Command | Status |
98
+ |---------|-------------|---------|--------|
99
+ | {id} | {req} | `{cmd}` | green |
100
+
101
+ ### Files for Commit
102
+ {test file paths}
103
+ ```
104
+
105
+ ## PARTIAL
106
+
107
+ ```markdown
108
+ ## PARTIAL
109
+
110
+ **Phase:** {N} — {name}
111
+ **Resolved:** {M}/{total} | **Escalated:** {K}/{total}
112
+
113
+ ### Resolved
114
+ | Task ID | Requirement | File | Command | Status |
115
+ |---------|-------------|------|---------|--------|
116
+ | {id} | {req} | {file} | `{cmd}` | green |
117
+
118
+ ### Escalated
119
+ | Task ID | Requirement | Reason | Iterations |
120
+ |---------|-------------|--------|------------|
121
+ | {id} | {req} | {reason} | {N}/3 |
122
+
123
+ ### Files for Commit
124
+ {test file paths for resolved gaps}
125
+ ```
126
+
127
+ ## ESCALATE
128
+
129
+ ```markdown
130
+ ## ESCALATE
131
+
132
+ **Phase:** {N} — {name}
133
+ **Resolved:** 0/{total}
134
+
135
+ ### Details
136
+ | Task ID | Requirement | Reason | Iterations |
137
+ |---------|-------------|--------|------------|
138
+ | {id} | {req} | {reason} | {N}/3 |
139
+
140
+ ### Recommendations
141
+ - **{req}:** {manual test instructions or implementation fix needed}
142
+ ```
143
+
144
+ </structured_returns>
145
+
146
+ <success_criteria>
147
+ - [ ] All `<files_to_read>` loaded before any action
148
+ - [ ] Each gap analyzed with correct test type
149
+ - [ ] Tests follow project conventions
150
+ - [ ] Tests verify behavior, not structure
151
+ - [ ] Every test executed — none marked passing without running
152
+ - [ ] Implementation files never modified
153
+ - [ ] Max 3 debug iterations per gap
154
+ - [ ] Implementation bugs escalated, not fixed
155
+ - [ ] Structured return provided (GAPS FILLED / PARTIAL / ESCALATE)
156
+ - [ ] Test files listed for commit
157
+ </success_criteria>
@@ -97,10 +97,10 @@ Use workspaces (`--workspace` flag) for:
97
97
  /rihal-plan <task> --workspace=Hotfix
98
98
 
99
99
  # Switch to another workspace's context
100
- /rihal-workspace <name>
100
+ /rihal-workstream switch --name <name>
101
101
 
102
102
  # Return to main planning
103
- /rihal-workspace main
103
+ /rihal-workstream switch --name main
104
104
  ```
105
105
 
106
106
  ## Merging Workspaces Back
@@ -4,6 +4,11 @@ internal: true
4
4
  description: Working Backwards PRFAQ challenge to forge product concepts.
5
5
  triggers:
6
6
  - "prfaq"
7
+ - "working backwards"
8
+ - "press release first"
9
+ - "create a prfaq"
10
+ - "product concept challenge"
11
+ - "forge a product idea"
7
12
  ---
8
13
  @.rihal/references/karpathy-guidelines.md
9
14
 
@@ -133,3 +138,7 @@ When the user gets stuck, offer concrete suggestions based on what they've share
133
138
  ### Negative Test
134
139
  **Input:** "Create a PRFAQ for a product that doesn't have a clear customer"
135
140
  **Expected:** Skill challenges immediately: "Who specifically buys this? Job title + decision criteria?" Refuses vague answers.
141
+
142
+ ## When NOT to use this skill
143
+
144
+ Do NOT use this skill for writing a full PRD (use rihal-create-prd), validating an existing PRD (use rihal-validate-prd), market research (use rihal-sadiq-analyst), or sprint planning. PRFAQ is a concept-forging challenge, not a requirements document.
@@ -4,6 +4,11 @@ internal: true
4
4
  description: "LLM-assisted human-in-the-loop review."
5
5
  triggers:
6
6
  - "checkpoint preview"
7
+ - "preview the checkpoint"
8
+ - "human-in-the-loop review"
9
+ - "review before checkpoint"
10
+ - "checkpoint review session"
11
+ - "preview changes before approval"
7
12
  ---
8
13
 
9
14
  ## Overview
@@ -63,3 +68,7 @@ Read fully and follow `./step-01-orientation.md` to begin.
63
68
 
64
69
  ### Edge Case: No changes to review
65
70
  **Expected:** Exit early, suggest the user make changes first.
71
+
72
+ ## When NOT to use this skill
73
+
74
+ Do NOT use this skill for autonomous execution without a human (it is human-in-the-loop by design), for full code review (use rihal-code-review), or for phase verification (use rihal-verify-phase).
@@ -105,6 +105,10 @@ Next steps:
105
105
 
106
106
  **Negative — "just disable the failing check"** — Refuse. The check exists for a reason. Either fix what's broken or remove the check with a documented rationale.
107
107
 
108
+ ## When NOT to use this skill
109
+
110
+ Do NOT use this skill for application code changes, deployment infrastructure beyond CI (use rihal-deploy-unify), security hardening (use rihal-harden), or MVP-to-production migration (use rihal-migrate).
111
+
108
112
  ## Memory Bank Hooks
109
113
 
110
114
  - **Reads:** `.rihal/memory/project/stack.md` (deploy target)
@@ -20,10 +20,10 @@ failed_layers: '' # set at runtime: comma-separated list of layers that failed o
20
20
  **Subagent mapping** (issue #720): the three reviewer roles below map to actual agents shipped in `.claude/agents/`. The skill names that used to be referenced here (`rihal-review-adversarial-general`, `rihal-review-edge-case-hunter`) are skills, not subagents, and `Task(subagent_type=...)` cannot reach them. Use the agents listed.
21
21
 
22
22
  - **Blind Hunter** — receives `{diff_output}` only. No spec, no context docs, no project access. Dispatch:
23
- `Task(subagent_type="rihal-security-adversary", model="sonnet", prompt="<adversarial review of diff>")`. The security-adversary persona's cynical mindset is the right fit for an isolated diff-only review.
23
+ `Task(subagent_type="rihal-security-adversary", model="{review_model}", prompt="<adversarial review of diff>")`. The security-adversary persona's cynical mindset is the right fit for an isolated diff-only review.
24
24
 
25
25
  - **Edge Case Hunter** — receives `{diff_output}` and read access to the project. Dispatch:
26
- `Task(subagent_type="rihal-edge-case-hunter", model="sonnet", prompt="<enumerate edge cases for diff>")`.
26
+ `Task(subagent_type="rihal-edge-case-hunter", model="{review_model}", prompt="<enumerate edge cases for diff>")`.
27
27
 
28
28
  - **Acceptance Auditor** (only if `{review_mode}` = `"full"`) — receives `{diff_output}`, the content of the file at `{spec_file}`, and any loaded context docs. Dispatch via `rihal-code-reviewer`. Its prompt:
29
29
  > You are an Acceptance Auditor. Review this diff against the spec and context docs. Check for: violations of acceptance criteria, deviations from spec intent, missing implementation of specified behavior, contradictions between spec constraints and actual code. Output findings as a Markdown list. Each finding: one-line title, which AC/constraint it violates, and evidence from the diff.
@@ -88,6 +88,10 @@ Memory Bank update:
88
88
 
89
89
  **Negative — "we'll add security later"** — Refuse. Security retrofits are 10× the cost of building it in. Block until at least the Critical findings have a plan.
90
90
 
91
+ ## When NOT to use this skill
92
+
93
+ Do NOT use this skill for CI/CD setup (use rihal-ci), performance optimization (use rihal-perf), general code review (use rihal-code-review), or MVP-to-production migration (use rihal-migrate).
94
+
91
95
  ## Memory Bank Hooks
92
96
 
93
97
  - **Reads:** `.rihal/memory/project/stack.md` (auth layer detection), `.rihal/memory/incidents/post-mortems/` (prior auth/security incidents)
@@ -83,6 +83,10 @@ Each week is reversible: if anything goes sideways, the previous week's state sh
83
83
 
84
84
  **Negative — "let's rewrite in $NEW_FRAMEWORK"** — Refuse. A rewrite is not graduation. Graduation means filling specific gaps in the current system. Rewrites take 6 months and break what worked.
85
85
 
86
+ ## When NOT to use this skill
87
+
88
+ Do NOT use this skill for greenfield projects, framework rewrites (graduation fills gaps, it does not rewrite), feature development, or CI setup alone (use rihal-ci).
89
+
86
90
  ## Memory Bank Hooks
87
91
 
88
92
  - **Reads:** `.rihal/memory/project/stack.md` (current state), `.rihal/memory/incidents/known-issues.md` (operational pain), `.rihal/memory/milestones/current.md`
@@ -41,6 +41,7 @@ triggers:
41
41
  - "مكون React"
42
42
  ---
43
43
  @.rihal/references/karpathy-guidelines.md
44
+ @.rihal/references/design-tokens.md
44
45
 
45
46
 
46
47
  # Haitham — Senior Frontend Engineer
@@ -69,6 +70,7 @@ Concrete. Code samples over prose. Cites file paths and line numbers. Shows befo
69
70
  - Server Components by default in Next.js App Router; Client Components only when needed
70
71
  - Tailwind classes organized with `cn()` helper and variants via `cva`
71
72
  - Never commit code that doesn't pass `tsc --noEmit`
73
+ - **Missing token? Add the token. Never inline hex.** (see `@.rihal/references/design-tokens.md`)
72
74
 
73
75
  ## Rihal Frontend Context
74
76
 
@@ -8,6 +8,10 @@
8
8
  {
9
9
  "type": "command",
10
10
  "command": "node .rihal/bin/rihal-hooks.cjs pre-edit"
11
+ },
12
+ {
13
+ "type": "command",
14
+ "command": "node .rihal/bin/rihal-hooks.cjs compact-nudge"
11
15
  }
12
16
  ]
13
17
  },
@@ -19,6 +23,15 @@
19
23
  "command": "node .rihal/bin/rihal-hooks.cjs pre-workflow"
20
24
  }
21
25
  ]
26
+ },
27
+ {
28
+ "matcher": "Bash",
29
+ "hooks": [
30
+ {
31
+ "type": "command",
32
+ "command": "node .rihal/bin/rihal-hooks.cjs bash-guard"
33
+ }
34
+ ]
22
35
  }
23
36
  ],
24
37
  "PostToolUse": [
@@ -31,6 +44,32 @@
31
44
  }
32
45
  ]
33
46
  }
47
+ ],
48
+ "PreCompact": [
49
+ {
50
+ "matcher": "",
51
+ "hooks": [
52
+ {
53
+ "type": "command",
54
+ "command": "node .rihal/bin/rihal-hooks.cjs pre-compact"
55
+ }
56
+ ]
57
+ }
58
+ ],
59
+ "Stop": [
60
+ {
61
+ "matcher": "",
62
+ "hooks": [
63
+ {
64
+ "type": "command",
65
+ "command": "node .rihal/bin/rihal-hooks.cjs stop-verify"
66
+ },
67
+ {
68
+ "type": "command",
69
+ "command": "node .rihal/bin/rihal-hooks.cjs cost-track"
70
+ }
71
+ ]
72
+ }
34
73
  ]
35
74
  }
36
75
  }
@@ -110,6 +110,7 @@ Use AskUserQuestion:
110
110
  - "Add to phase plan" — include when planning Phase [N]
111
111
  - "Brainstorm approach" — think through before deciding
112
112
  - "Put it back" — return to list
113
+ - "Cancel" — exit /rihal-check-todos without changing anything
113
114
 
114
115
  **If no roadmap match:**
115
116
 
@@ -121,6 +122,9 @@ Use AskUserQuestion:
121
122
  - "Create a phase" — /rihal-add-phase with this scope
122
123
  - "Brainstorm approach" — think through before deciding
123
124
  - "Put it back" — return to list
125
+ - "Cancel" — exit /rihal-check-todos without changing anything
126
+
127
+ **If user picks "Cancel" (or hits Esc):** print `Cancelled — todo untouched.` and STOP. Do not proceed to execute_action.
124
128
  </step>
125
129
 
126
130
  <step name="execute_action">
@@ -5,6 +5,7 @@ Auto-fix issues from REVIEW.md. Validates phase, checks config gate, verifies RE
5
5
  <required_reading>
6
6
  Read all files referenced by the invoking prompt's execution_context before starting.
7
7
  @.rihal/references/karpathy-guidelines.md
8
+ @.rihal/references/git-preflight.md
8
9
  </required_reading>
9
10
 
10
11
  <available_agent_types>
@@ -208,7 +209,7 @@ Use Task() to spawn agent:
208
209
 
209
210
  ```
210
211
  Task(subagent_type="rihal-code-fixer",
211
- model="sonnet", prompt="
212
+ model="{model}", prompt="
212
213
  <files_to_read>
213
214
  ${REVIEW_PATH}
214
215
  </files_to_read>
@@ -290,7 +291,7 @@ if [ "$AUTO_MODE" = "true" ]; then
290
291
  # Spawn rihal-code-reviewer agent to re-review
291
292
  # (This overwrites REVIEW_PATH with latest review state)
292
293
  Task(subagent_type="rihal-code-reviewer",
293
- model="sonnet", prompt="
294
+ model="{model}", prompt="
294
295
  <config>
295
296
  depth: ${REVIEW_DEPTH}
296
297
  phase_dir: ${PHASE_DIR}
@@ -324,7 +325,7 @@ Do NOT commit the output — the orchestrator handles that.
324
325
  echo "Issues remain. Applying fixes for iteration ${ITERATION}..."
325
326
 
326
327
  Task(subagent_type="rihal-code-fixer",
327
- model="sonnet", prompt="
328
+ model="{model}", prompt="
328
329
  <files_to_read>
329
330
  ${REVIEW_PATH}
330
331
  </files_to_read>
@@ -389,7 +389,7 @@ Spawn the rihal-code-reviewer agent:
389
389
 
390
390
  ```
391
391
  Task(subagent_type="rihal-code-reviewer",
392
- model="sonnet", prompt="
392
+ model="{model}", prompt="
393
393
  <files_to_read>
394
394
  ${FILES_TO_READ}
395
395
  </files_to_read>
@@ -116,7 +116,7 @@ For each issue, fill the debug-subagent-prompt template and spawn:
116
116
  Task(
117
117
  prompt=filled_debug_subagent_prompt + "\n\n<files_to_read>\n- .rihal/STATE.md\n</files_to_read>\n${AGENT_SKILLS_DEBUGGER}",
118
118
  subagent_type="rihal-debugger",
119
- model="sonnet",
119
+ model="{model}",
120
120
  description="Debug: {truth_short}"
121
121
  )
122
122
  ```
@@ -11,6 +11,10 @@ Wrap a STORY.md file for AI-coder consumption. Produces:
11
11
  This workflow creates the execution prompt for a pair-programming session with an AI coder.
12
12
  </purpose>
13
13
 
14
+ <required_reading>
15
+ @.rihal/references/git-preflight.md
16
+ </required_reading>
17
+
14
18
 
15
19
  ## Step 0 — Parse Arguments
16
20
 
@@ -39,7 +39,7 @@ If no changes: Return `No changes between {sha1}..{sha2}`
39
39
 
40
40
  For each file in diff output:
41
41
 
42
- 1. Extract filename: `.planning/phases/01-foundation/01-01-SPRINT.md`
42
+ 1. Extract filename: `.planning/phases/01-foundation/01-1-SPRINT.md`
43
43
  2. Read that file's YAML frontmatter (if .md): extract phase/plan ID
44
44
  3. Prefix the hunk with: `Phase {id} — {filename}`
45
45
  4. Show the diff +/- lines
@@ -49,7 +49,7 @@ For `.rihal/state.json`: Show raw diff (no frontmatter parsing)
49
49
  Example output:
50
50
 
51
51
  ```
52
- Phase 01-01 — .planning/phases/01-foundation/01-01-SPRINT.md
52
+ Phase 01-01 — .planning/phases/01-foundation/01-1-SPRINT.md
53
53
  @@ -5,3 +5,4 @@
54
54
  - old line
55
55
  + new line
@@ -93,25 +93,33 @@ If `$QUESTION` is empty, present the main menu via AskUserQuestion:
93
93
  ```
94
94
  What would you like to do?
95
95
 
96
+ — Talk —
96
97
  1. Quick chat with one expert (/rihal-discuss)
97
98
  2. Convene the council (/rihal-council)
98
99
  3. Discuss an unlocked phase (/rihal-discuss-phase)
100
+
101
+ — Plan & build —
99
102
  4. Plan a phase (/rihal-plan)
100
103
  5. Execute a phase (/rihal-execute)
101
104
  6. Sprint planning (/rihal-sprint-planning)
102
105
  7. Execute a sprint (/rihal-execute-sprint)
103
- 8. Check sprint status (/rihal-sprint-status)
104
- 9. Break milestone into epics & stories (/rihal-create-epics-and-stories)
105
- 10. Implement a story (/rihal-dev-story)
106
- 11. Check progress (/rihal-progress)
106
+ 8. Break milestone into epics & stories (/rihal-create-epics-and-stories)
107
+ 9. Implement a story (/rihal-dev-story)
108
+
109
+ Status & recovery —
110
+ 10. Check progress (/rihal-progress)
111
+ 11. Check sprint status (/rihal-sprint-status)
107
112
  12. Auto-advance to next step (/rihal-next)
108
113
  13. Debug an issue (/rihal-debug)
109
114
  14. Resume paused work (/rihal-resume-work)
115
+
116
+ — Other —
110
117
  15. Add a note (/rihal-note)
111
118
  16. Something else — describe it
119
+ 0. Cancel — exit without running anything
112
120
  ```
113
121
 
114
- If user picks 1-15, invoke that command. If 16, capture text and continue.
122
+ If user picks 1-15, invoke that command. If 16, capture text and continue. If 0 (or empty / Esc), print `Cancelled.` and STOP — do not fall through to project-state survey.
115
123
  </step>
116
124
 
117
125
  <step name="check_project">
@@ -120,7 +128,7 @@ If user picks 1-15, invoke that command. If 16, capture text and continue.
120
128
  Detect PRD / epics with glob — projects use either singular files (`.planning/prd.md`) OR per-milestone directories (`.planning/prds/v1.8.md`). Closes #377 — false 'create-prd first' redirects on multi-milestone repos.
121
129
 
122
130
  ```bash
123
- INIT=$(node ".rihal/bin/rihal-tools.cjs" state load 2>/dev/null)
131
+ INIT=$(node ".rihal/bin/rihal-tools.cjs" state load 2>/dev/null || echo '{"ok":false,"error":"state_load_failed"}')
124
132
  HAS_PRD=$( ( ls .planning/prd.md .planning/PRD.md .planning/prds/*.md .planning/milestones/*/PRD.md 2>/dev/null | head -1 ) && echo true || echo false)
125
133
  HAS_EPICS=$( ( ls .planning/epics.md .planning/EPICS.md .planning/epics/*.md .planning/milestones/*/EPICS.md 2>/dev/null | head -1 ) && echo true || echo false)
126
134
  PHASE_COUNT=$(node ".rihal/bin/rihal-tools.cjs" progress init 2>/dev/null | python3 -c "import sys,json;print(json.load(sys.stdin).get('phase_count',0))" 2>/dev/null || echo 0)
@@ -221,7 +229,7 @@ The full mapping is in the dictionary's "Scope nouns" table. Pre-conditions enfo
221
229
  | epic | `/rihal-create-epics-and-stories` | HAS_PRD true |
222
230
  | sprint | `/rihal-sprint-planning` | HAS_EPICS true |
223
231
  | PRD | `/rihal-create-prd` | none |
224
- | roadmap | `/rihal-create-milestone` | HAS_PRD true |
232
+ | roadmap | `/rihal-new-milestone` | HAS_PRD true |
225
233
  | council | `/rihal-council` | none |
226
234
  | plan (verb) | `/rihal-plan` | HAS_PHASES true |
227
235
 
@@ -290,7 +298,7 @@ Evaluate `$QUESTION` against these routing rules. Apply the **first matching** r
290
298
  | "Sprint planning", "plan the sprint", "next sprint", "what's in this sprint" | `/rihal-sprint-planning` | Sprint-level scope/capacity planning |
291
299
  | Executing a sprint, "run the sprint", "start sprint", "work on sprint" | `/rihal-execute-sprint` | Sprint execution with wave batching |
292
300
  | Sprint status, "how is the sprint going", "sprint board", "sprint progress" | `/rihal-sprint-status` | Current sprint state |
293
- | "Create milestones", "plan milestones", "create roadmap", "what milestones do I need", "break project into milestones" | `/rihal-create-milestone` | Roadmap-level planning — designs M1..Mn from the PRD. Do NOT route to `create-epics-and-stories`; that skill decomposes a single milestone into epics |
301
+ | "Create milestones", "plan milestones", "create roadmap", "what milestones do I need", "break project into milestones" | `/rihal-new-milestone` | Roadmap-level planning — designs M1..Mn from the PRD. Do NOT route to `create-epics-and-stories`; that skill decomposes a single milestone into epics |
294
302
  | Break milestone into epics/stories, "create stories", "user stories", "epics" | `/rihal-create-epics-and-stories` | Milestone → epic → story decomposition (assumes roadmap already exists) |
295
303
  | Create a single story, "add story", "write a story for X" | `/rihal-create-story` | Single story addition |
296
304
  | Implement a story, "work on story", "dev story", "build story" | `/rihal-dev-story` | Story-level implementation |
@@ -157,7 +157,7 @@ For each doc in the queue, spawn a `rihal-noor` agent in parallel waves (up to 3
157
157
  ```
158
158
  Task(
159
159
  subagent_type="rihal-noor",
160
- model="sonnet",
160
+ model="{model}",
161
161
  prompt="
162
162
  Generate documentation for {doc_type}.
163
163
  Output path: {resolved_path}
@@ -180,7 +180,7 @@ For each generated doc:
180
180
  ```
181
181
  Task(
182
182
  subagent_type="rihal-docs-auditor",
183
- model="sonnet",
183
+ model="{model}",
184
184
  prompt="
185
185
  Verify this documentation file against the live codebase:
186
186
  Path: {resolved_path}
@@ -1,7 +1,7 @@
1
1
  # Workflow: rihal-enable-hooks
2
2
 
3
3
  <purpose>
4
- Merge Rihal opt-in hooks from settings-hooks.json into .claude/settings.json. Creates settings.json if missing. Enables pre-edit (read-before-edit check), pre-workflow (command hint), and post-commit (format validation) guardrails.
4
+ Merge Rihal opt-in hooks from settings-hooks.json into .claude/settings.json. Creates settings.json if missing. Enables all 8 guardrails: pre-edit (read-before-edit check), pre-workflow (command hint), post-commit (format validation), bash-guard (blocks dangerous commands), pre-compact (refreshes HANDOFF.json before context compaction), stop-verify (syntax-checks files changed during the response), cost-track (logs measured token usage to .rihal/telemetry/cost.jsonl), and compact-nudge (advises /rihal-trim or /clear after many edits).
5
5
  </purpose>
6
6
 
7
7
 
@@ -81,6 +81,11 @@ Enabled guardrails:
81
81
  • pre-edit: Verifies files are Read() before Edit/Write
82
82
  • pre-workflow: Warns if rihal-* commands look suspicious
83
83
  • post-commit: Validates commit format and bans "Generated with Claude" patterns
84
+ • bash-guard: Blocks unapproved git push, --force, --no-verify, and unscoped rm -rf
85
+ • pre-compact: Refreshes HANDOFF.json before context compaction
86
+ • stop-verify: Syntax-checks files changed during the response
87
+ • cost-track: Logs measured token usage to .rihal/telemetry/cost.jsonl
88
+ • compact-nudge: Advises /rihal-trim or /clear after many edits
84
89
 
85
90
  To disable, remove the hooks section from .claude/settings.json or edit .rihal/templates/settings-hooks.json and re-run.
86
91
  ```