@hanzlaa/rcode 2.2.0 → 2.3.1

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 (72) hide show
  1. package/CONTRIBUTING.md +138 -0
  2. package/README.md +76 -17
  3. package/cli/install.js +312 -80
  4. package/cli/uninstall.js +8 -0
  5. package/dist/rcode.js +19777 -0
  6. package/package.json +17 -4
  7. package/rihal/DOCS-AUDIT.md +14 -0
  8. package/rihal/agents/rihal-code-reviewer.md +1 -1
  9. package/rihal/agents/rihal-codebase-mapper.md +1 -1
  10. package/rihal/agents/rihal-docs-auditor.md +1 -1
  11. package/rihal/agents/rihal-edge-case-hunter.md +1 -1
  12. package/rihal/agents/rihal-executor.md +1 -1
  13. package/rihal/agents/rihal-hussain-pm.md +1 -0
  14. package/rihal/agents/rihal-nyquist-auditor.md +1 -1
  15. package/rihal/agents/rihal-phase-researcher.md +1 -2
  16. package/rihal/agents/rihal-planner.md +1 -1
  17. package/rihal/agents/rihal-roadmapper.md +1 -0
  18. package/rihal/agents/rihal-security-adversary.md +1 -1
  19. package/rihal/agents/rihal-security-auditor.md +1 -1
  20. package/rihal/agents/rihal-sprint-checker.md +1 -1
  21. package/rihal/agents/rihal-verifier.md +1 -1
  22. package/rihal/bin/lib/roadmap.cjs +2 -3
  23. package/rihal/bin/rihal-tools.cjs +11 -31
  24. package/rihal/commands/audit.md +8 -0
  25. package/rihal/commands/checkpoint-preview.md +13 -0
  26. package/rihal/commands/config.md +4 -4
  27. package/rihal/commands/prfaq.md +15 -0
  28. package/rihal/commands/settings.md +2 -2
  29. package/rihal/references/agent-contracts.md +12 -0
  30. package/rihal/references/karpathy-guidelines-full.md +79 -0
  31. package/rihal/references/karpathy-guidelines.md +8 -76
  32. package/rihal/references/model-profile-resolution.md +8 -0
  33. package/rihal/references/phase-argument-parsing.md +11 -0
  34. package/rihal/references/revision-loop.md +11 -0
  35. package/rihal/references/universal-anti-patterns.md +15 -0
  36. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +10 -0
  37. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +3 -1
  38. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +3 -1
  39. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-10-complete.md +1 -1
  40. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +13 -0
  41. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +4 -2
  42. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +10 -0
  43. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +3 -1
  44. package/rihal/skills/agents/hussain-pm/SKILL.md +8 -0
  45. package/rihal/skills/agents/hussain-sm/SKILL.md +8 -0
  46. package/rihal/templates/UAT.md +29 -0
  47. package/rihal/templates/milestone.md +2 -0
  48. package/rihal/templates/sprint.md +11 -28
  49. package/rihal/templates/summary.md +30 -0
  50. package/rihal/templates/verification-report.md +28 -0
  51. package/rihal/workflows/audit-milestone.md +34 -2
  52. package/rihal/workflows/audit.md +172 -0
  53. package/rihal/workflows/autonomous.md +67 -0
  54. package/rihal/workflows/checkpoint-preview.md +7 -0
  55. package/rihal/workflows/council.md +3 -1
  56. package/rihal/workflows/debug.md +8 -1
  57. package/rihal/workflows/diagnose-issues.md +34 -0
  58. package/rihal/workflows/do.md +47 -3
  59. package/rihal/workflows/execute-sprint.md +11 -4
  60. package/rihal/workflows/execute.md +9 -3
  61. package/rihal/workflows/karpathy-audit.md +7 -14
  62. package/rihal/workflows/pause-work.md +7 -1
  63. package/rihal/workflows/prfaq.md +7 -0
  64. package/rihal/workflows/profile-user.md +2 -2
  65. package/rihal/workflows/settings.md +116 -118
  66. package/rihal/workflows/sprint-planning.md +39 -8
  67. package/rihal/workflows/status.md +5 -0
  68. package/rihal/workflows/ui-phase.md +3 -3
  69. package/rihal/workflows/update.md +80 -22
  70. package/rihal/workflows/validate-phase.md +7 -1
  71. package/rihal/agents/rihal-ui-designer.md +0 -6
  72. package/rihal/workflows/config.md +0 -105
@@ -10,7 +10,7 @@ Read all files referenced by the invoking prompt's execution_context before star
10
10
  <process>
11
11
 
12
12
  <step name="parse_args">
13
- Extract `$ARGUMENTS` and detect `--auto` flag (suppresses confirmation, dispatches immediately):
13
+ Extract `$ARGUMENTS`, detect `--auto` flag, and check config mode:
14
14
 
15
15
  ```bash
16
16
  AUTO_MODE=false
@@ -19,6 +19,11 @@ if [[ "$ARGUMENTS" == *"--auto"* ]]; then
19
19
  AUTO_MODE=true
20
20
  QUESTION=$(echo "$ARGUMENTS" | sed 's/--auto[[:space:]]*//' | xargs)
21
21
  fi
22
+ # Also auto-dispatch in yolo mode
23
+ CONFIG_MODE=$(node .rihal/bin/rihal-tools.cjs config-get mode 2>/dev/null || echo "guided")
24
+ if [[ "$CONFIG_MODE" == "yolo" ]]; then
25
+ AUTO_MODE=true
26
+ fi
22
27
  ```
23
28
  </step>
24
29
 
@@ -52,18 +57,53 @@ If user picks 1-15, invoke that command. If 16, capture text and continue.
52
57
  </step>
53
58
 
54
59
  <step name="check_project">
55
- **Check if project exists.**
60
+ **Check if project exists + state survey.**
56
61
 
57
62
  ```bash
58
63
  INIT=$(node ".rihal/bin/rihal-tools.cjs" state load 2>/dev/null)
64
+ HAS_PRD=$([ -f .planning/prd.md ] && echo true || echo false)
65
+ HAS_EPICS=$([ -f .planning/epics.md ] && echo true || echo false)
66
+ 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)
67
+ HAS_PHASES=$([ "$PHASE_COUNT" -gt 0 ] && echo true || echo false)
59
68
  ```
60
69
 
61
- Track whether `.planning/` existssome routes require it, others don't.
70
+ These flags drive the greenfield guard in the next step. `.planning/` existing alone is not enough we need to know whether the methodology chain has actually run (PRD → milestone → epics → phases).
71
+ </step>
72
+
73
+ <step name="greenfield_guard" priority="first-match">
74
+ **Block methodology inversion.**
75
+
76
+ Some routes ASSUME upstream artifacts exist. If they don't, dispatching to them inverts the chain (the autonomous-bypass pattern that produced the interpos disaster — issue #220 + #219).
77
+
78
+ Apply this guard BEFORE the routing table below:
79
+
80
+ | Intent contains... | AND state shows... | Then re-route to... | Why |
81
+ |--------------------|---------------------|----------------------|-----|
82
+ | "draft phases", "all phases", "build all phases", "groom phases", "auto mode" + "phases" | `HAS_PRD=false` | `/rihal:create-prd` first | Phases need a PRD foundation. Without one, the autonomous flow hallucinates requirements. |
83
+ | "execute phase", "build phase N", "run phase N" | `HAS_PHASES=false` OR PLAN.md missing for phase N | `/rihal:plan N` first (or `/rihal:create-prd` if no PRD) | Can't execute what hasn't been planned. |
84
+ | "sprint planning", "plan the sprint" | `HAS_EPICS=false` | `/rihal:create-epics-and-stories` first | Sprints draw stories from epics. No epics = no stories to schedule. |
85
+ | "create stories", "epics" | `HAS_PRD=false` | `/rihal:create-prd` first | Epics decompose a milestone. Milestone needs PRD. |
86
+ | "create milestones", "roadmap" | `HAS_PRD=false` | `/rihal:create-prd` first | Roadmap is derived from PRD success metrics. |
87
+
88
+ When the guard fires, print a clear message:
89
+
90
+ ```
91
+ ⚠ Cannot {requested action}: missing prerequisite — {what's missing}.
92
+
93
+ Re-routing to: /rihal:{prerequisite-command}
94
+ Once that completes, re-run your original request.
95
+ ```
96
+
97
+ Then dispatch to the prerequisite command instead of the originally-matched route.
98
+
99
+ The guard never silently rejects intent — it always either dispatches to a sensible alternative OR explicitly tells the user what flag overrides it (e.g. `--skip-prerequisites` for the rare legitimate use case).
62
100
  </step>
63
101
 
64
102
  <step name="route">
65
103
  **Match intent to command.**
66
104
 
105
+ (Run only after greenfield_guard has cleared.)
106
+
67
107
  Evaluate `$QUESTION` against these routing rules. Apply the **first matching** rule:
68
108
 
69
109
  | If the text describes... | Route to | Why |
@@ -71,6 +111,10 @@ Evaluate `$QUESTION` against these routing rules. Apply the **first matching** r
71
111
  | Starting a new project, "set up", "initialize" | `/rihal:new-project` | Needs full project initialization |
72
112
  | Mapping or analyzing an existing codebase | `/rihal:map-codebase` | Codebase discovery |
73
113
  | A bug, error, crash, failure, or something broken | `/rihal:debug` | Needs systematic investigation |
114
+ | Validate an idea, "working backwards", "press release", "PRFAQ", "is this worth building" | `/rihal:prfaq` | Stress-test concept before committing sprint capacity |
115
+ | Brainstorm, generate ideas, "explore options", "what could we do" | `/rihal:brainstorm` | Structured ideation before planning |
116
+ | Audit code quality, "review changes", "karpathy", "check my diff", "too complex" | `/rihal:karpathy-audit` | 4-principle code audit against recent diff |
117
+ | Walk through a change, "checkpoint", "explain this diff", "human review" | `/rihal:checkpoint-preview` | Human-in-the-loop diff walkthrough |
74
118
  | Exploring, researching, comparing, or "how does X work" | `/rihal:research-phase` | Domain research before planning |
75
119
  | Scope unclear, conflicting UIs/options, "which one", "better UX", "still have confusion", "how should X look", brainstorming vision | `/rihal:discuss-phase` | Decisions not yet locked — gather before planning |
76
120
  | A complex task: refactoring, migration, multi-file architecture, system redesign | `/rihal:add-phase` | Needs a full phase with plan/build cycle |
@@ -341,16 +341,23 @@ If verification fails:
341
341
 
342
342
  **Check if node repair is enabled** (default: on):
343
343
  ```bash
344
- NODE_REPAIR=$(node "./.claude/get-shit-done/bin/rihal-tools.cjs" config-get workflow.node_repair 2>/dev/null || echo "true")
344
+ NODE_REPAIR=$(node ".rihal/bin/rihal-tools.cjs" config-get workflow.node_repair 2>/dev/null || echo "true")
345
345
  ```
346
346
 
347
- If `NODE_REPAIR` is `true`: invoke `@./.claude/get-shit-done/workflows/node-repair.md` with:
347
+ If `NODE_REPAIR` is `true`: attempt RETRY → DECOMPOSE → PRUNE in that order
348
+ within a budget of `workflow.node_repair_budget` (default: 2). Track:
349
+
348
350
  - FAILED_TASK: task number, name, done-criteria
349
351
  - ERROR: expected vs actual result
350
352
  - PLAN_CONTEXT: adjacent task names + phase goal
351
- - REPAIR_BUDGET: `workflow.node_repair_budget` from config (default: 2)
353
+ - REPAIR_BUDGET: remaining attempts
354
+
355
+ Repair strategies:
356
+ - **RETRY** — re-run the same task with the failure context as added input.
357
+ - **DECOMPOSE** — split into smaller subtasks (only if the original was L/XL).
358
+ - **PRUNE** — drop the task from the sprint scope and record under "Issues Encountered" in SUMMARY.
352
359
 
353
- Node repair will attempt RETRY, DECOMPOSE, or PRUNE autonomously. Only reaches this gate again if repair budget is exhausted (ESCALATE).
360
+ If the budget is exhausted without success: ESCALATE.
354
361
 
355
362
  If `NODE_REPAIR` is `false` OR repair returns ESCALATE: STOP. Present: "Verification failed for Task [X]: [name]. Expected: [criteria]. Actual: [result]. Repair attempted: [summary of what was tried]." Options: Retry | Skip (mark incomplete) | Stop (investigate). If skipped → SUMMARY "Issues Encountered".
356
363
  </step>
@@ -56,8 +56,14 @@ wall-clock expectation).
56
56
  </execution_plan>
57
57
 
58
58
  <three_options>
59
- After execution plan, offer three modes via AskUserQuestion. Each option
60
- names the tradeoff explicitly:
59
+ Check config mode first:
60
+ ```bash
61
+ CONFIG_MODE=$(node .rihal/bin/rihal-tools.cjs config-get mode 2>/dev/null || echo "guided")
62
+ ```
63
+
64
+ **If `CONFIG_MODE == "yolo"` or `$ARGUMENTS` contains `--auto`:** Skip the menu. Auto-select **A) Autonomous run** and print one line: `▶ Auto-selecting Autonomous run (yolo mode). /rihal:settings set mode guided to change.`
65
+
66
+ Otherwise, offer three modes via AskUserQuestion. Each option names the tradeoff explicitly:
61
67
 
62
68
  **A) Autonomous run** — Spawn subagent per plan in sequence/parallel per
63
69
  wave rules. Checkpoints still pause for user. Fastest wall-clock.
@@ -157,7 +163,7 @@ Always use the exact name from this list — do not fall back to 'general-purpos
157
163
  - rihal-codebase-mapper — Maps project structure and dependencies
158
164
  - rihal-integration-checker — Checks cross-phase integration
159
165
  - rihal-nyquist-auditor — Validates verification coverage
160
- - rihal-ui-designer — Researches UI/UX approaches
166
+ - rihal-ux-designer — Researches UI/UX approaches
161
167
  - rihal-ui-auditor — Reviews UI implementation quality
162
168
  - rihal-ui-auditor — Audits UI against design requirements
163
169
  </available_agent_types>
@@ -382,28 +382,21 @@ Auto-fix some issues: /rihal:code-review-fix {phase}
382
382
 
383
383
  </process>
384
384
 
385
- <success_criteria>
385
+ ## Success Criteria
386
+
386
387
  - [ ] Input parsed correctly (phase, git ref, or file override)
387
388
  - [ ] Source files filtered from non-code files
388
389
  - [ ] All 4 principles audited with specific rules
389
390
  - [ ] Findings include file:line references
390
- - [ ] Severity levels assigned (critical/warning/info)
391
+ - [ ] Severity levels assigned (critical / warning / info)
391
392
  - [ ] Report written with summary table and details
392
393
  - [ ] User receives actionable recommendations
393
394
  - [ ] Report saved to phase dir if phase mode
394
- </success_criteria>
395
-
396
- ## Success Criteria
397
-
398
- - [ ] Task completed as requested
399
- - [ ] Output saved or reported
400
- - [ ] State updated if necessary
401
- - [ ] No errors encountered
402
395
 
403
396
  ## On Error
404
397
 
405
- If arguments are invalid, missing files, or subagent fails:
406
- - Validate inputs match expected format
407
- - Check that required files exist
408
- - Retry with clearer arguments or report the specific error to the user
398
+ - **Phase not found:** suggest `/rihal:karpathy-audit HEAD~5..HEAD` as the git-ref fallback.
399
+ - **No source files in diff:** report "no auditable changes in range" and STOP — do not invent findings.
400
+ - **karpathy-guidelines.md missing:** print "Reference doc missing. Run: npx @hanzlaa/rcode install ." and STOP.
401
+ - **Empty diff:** STOP gracefully, do not run principle checks against an empty input.
409
402
 
@@ -73,7 +73,13 @@ Extract from active SPRINT.md:
73
73
 
74
74
  ## Step 3 — Collect Blocking Constraints
75
75
 
76
- Ask user via AskUserQuestion for any constraints or notes:
76
+ ```bash
77
+ CONFIG_MODE=$(node .rihal/bin/rihal-tools.cjs config-get mode 2>/dev/null || echo "guided")
78
+ ```
79
+
80
+ **If `CONFIG_MODE == "yolo"`:** Set `blocking_constraints = ""` and skip to Step 4.
81
+
82
+ Otherwise ask user via AskUserQuestion:
77
83
 
78
84
  ```
79
85
  Question:
@@ -0,0 +1,7 @@
1
+ # Workflow: rihal:prfaq
2
+
3
+ <purpose>
4
+ Working Backwards PRFAQ challenge. Stress-test a product concept by writing the press release before building it. Produces a battle-hardened PRFAQ document + PRD distillate. Delegates to the rihal-prfaq skill for the full interview and generation protocol.
5
+ </purpose>
6
+
7
+ @.rihal/skills/rihal-prfaq/SKILL.md
@@ -15,8 +15,8 @@ If `$ARGUMENTS` is empty or contains only `--help` or `-h`:
15
15
 
16
16
  **Examples:**
17
17
  ```
18
- /rihal:profile-user example 1
19
- /rihal:profile-user example 2
18
+ /rihal:profile-user
19
+ /rihal:profile-user --json '{"communication":"Direct & dense","autonomy":"Autonomous","domain_depth":"Advanced","iteration_speed":"Fast"}'
20
20
  ```
21
21
 
22
22
  STOP — do not proceed.
@@ -1,185 +1,183 @@
1
1
  # Workflow: rihal:settings
2
2
 
3
3
  <purpose>
4
- Interactive configuration wizard for Rihal project settings. Collects user preferences for model profile, research strategy, execution gates, and branching strategy, then writes them back to .rihal/config.yaml.
4
+ View and edit Rihal project settings stored in `.rihal/config.yaml`. Closes
5
+ #233 — replaces the previous broken implementation that wrote flat keys
6
+ nothing read and corrupted the nested `workflow:` / `git:` sections on every
7
+ save.
8
+
9
+ The single source of truth for config keys is the table in Step 1.5. All keys
10
+ documented there are consumed somewhere in the codebase — settings that the
11
+ wizard writes are settings that workflows actually honour.
5
12
  </purpose>
6
13
 
7
-
8
14
  ## Step 0 — Usage check
9
15
 
10
- If `$ARGUMENTS` is empty or contains only `--help` or `-h`:
16
+ If `$ARGUMENTS` contains `--help` or `-h`:
11
17
 
12
18
  ```
13
- /rihal:settings <argument-here>
19
+ /rihal:settings # show current + interactive edit
20
+ /rihal:settings show # show current only
21
+ /rihal:settings get <key> # read a single dotted key (e.g. workflow.discuss_mode)
22
+ /rihal:settings set <key> <value> # write a single dotted key
14
23
  ```
15
24
 
16
25
  **Examples:**
17
26
  ```
18
- /rihal:settings example 1
19
- /rihal:settings example 2
27
+ /rihal:settings show
28
+ /rihal:settings get workflow.research_by_default
29
+ /rihal:settings set workflow.research_by_default true
30
+ /rihal:settings set git.branching_strategy feature-branch
20
31
  ```
21
32
 
22
- STOPdo not proceed.
33
+ ## Step 1 Resolve mode
23
34
 
24
- <available_tools>
25
- - AskUserQuestion collect user input
26
- - Read read current config.yaml
27
- - Write write updated config.yaml
28
- - Bash validate git state if needed
29
- </available_tools>
35
+ Parse `$ARGUMENTS`:
36
+ - `show` (or empty) run Step 1.5 then Step 2 (interactive)
37
+ - `get <key>` Step 1.7 then STOP
38
+ - `set <key> <value>` Step 1.8 then STOP
39
+ - anything else print usage from Step 0 and STOP
30
40
 
31
- ## Step 1 — Initialize
41
+ ## Step 1.5Show current settings
32
42
 
33
- Load current settings from `.rihal/config.yaml`:
43
+ Read each known key via `rihal-tools.cjs config-get <dotted.key>` (the
44
+ nested-safe reader in `rihal/bin/lib/config.cjs`). **Do not** call the legacy
45
+ `config set` — it uses a flat YAML parser and corrupts nested sections.
34
46
 
35
47
  ```bash
36
- [ -f .rihal/config.yaml ] && cat .rihal/config.yaml || echo "# No config yet"
48
+ TOOL="node .rihal/bin/rihal-tools.cjs"
49
+ $TOOL config-get user_name || echo "(unset)"
50
+ $TOOL config-get communication_language || echo "(unset)"
51
+ $TOOL config-get mode || echo "(unset)"
52
+ $TOOL config-get model_profile || echo "(unset)"
53
+ $TOOL config-get workflow.research_by_default || echo "(unset)"
54
+ $TOOL config-get workflow.plan_checker || echo "(unset)"
55
+ $TOOL config-get workflow.post_execute_gates || echo "(unset)"
56
+ $TOOL config-get workflow.ui_safety_gate || echo "(unset)"
57
+ $TOOL config-get workflow.discuss_mode || echo "(unset)"
58
+ $TOOL config-get git.branching_strategy || echo "(unset)"
59
+ $TOOL config-get git.commit_docs || echo "(unset)"
60
+ $TOOL config-get output.verbose || echo "(unset)"
37
61
  ```
38
62
 
39
- Parse the config to extract current values:
40
- - `model_profile` (default: "balanced")
41
- - `enable_research_pre_step` (default: "false")
42
- - `enable_plan_checker_loop` (default: "true")
43
- - `enable_post_execute_verifier` (default: "false")
44
- - `branching_strategy` (default: "none")
45
-
46
- Store these as `current_*` variables for pre-fill use.
47
-
48
- ## Step 2 — Collect Settings
49
-
50
- Use AskUserQuestion to prompt the user for each setting. Pre-fill current values where applicable.
51
-
52
- ### Setting 1: Model Profile
63
+ Render as a table:
53
64
 
54
65
  ```
55
- Question:
56
- Which model profile would you like to use?
66
+ Current Rihal Settings (.rihal/config.yaml)
57
67
 
58
- Options:
59
- 1. quality (Opus for reasoning agents, Sonnet for executor, Haiku for utilities)
60
- 2. balanced (Sonnet across the board) [CURRENT]
61
- 3. budget (Haiku across the board)
62
- 4. inherit (Use parent session model, no override)
68
+ Identity
69
+ user_name : {value}
70
+ communication_language : {value}
63
71
 
64
- Your choice: [pre-filled with current_model_profile]
65
- ```
72
+ Execution
73
+ mode : {value} # guided | yolo
74
+ model_profile : {value} # quality | balanced | budget | inherit
66
75
 
67
- Valid responses: 1, 2, 3, 4, or exact names (quality, balanced, budget, inherit).
68
- Map numeric choices to profile names. Store as `new_model_profile`.
76
+ Workflow gates
77
+ workflow.research_by_default : {value} # true | false
78
+ workflow.plan_checker : {value} # true | false
79
+ workflow.post_execute_gates : {value} # true | false
80
+ workflow.ui_safety_gate : {value} # true | false
81
+ workflow.discuss_mode : {value} # adaptive | discuss | skip
69
82
 
70
- ### Setting 2: Enable Research Pre-step
83
+ Output
84
+ output.verbose : {value} # false (slim, default) | true (full detail)
71
85
 
86
+ Git
87
+ git.branching_strategy : {value} # none | feature-branch | worktree-isolation
88
+ git.commit_docs : {value} # true | false
72
89
  ```
73
- Question:
74
- Enable research pre-step in /rihal:plan by default?
75
90
 
76
- This runs a research phase before planning if enabled, providing additional context.
91
+ If invoked as `/rihal:settings show`, STOP here.
77
92
 
78
- Options:
79
- 1. Yes
80
- 2. No [CURRENT]
93
+ ## Step 1.7 — `get <key>`
81
94
 
82
- Your choice:
95
+ ```bash
96
+ node .rihal/bin/rihal-tools.cjs config-get "$KEY"
83
97
  ```
84
98
 
85
- Valid responses: 1/yes/y or 2/no/n. Store as `new_enable_research_pre_step` (true/false string).
99
+ Print the result (empty output means unset). STOP.
86
100
 
87
- ### Setting 3: Enable Plan-Checker Loop
88
-
89
- ```
90
- Question:
91
- Enable sprint-checker loop during /rihal:plan?
101
+ ## Step 1.8 `set <key> <value>`
92
102
 
93
- This verifies and repairs plans before execution if enabled.
103
+ Validate the key against the table in Step 1.5 — reject unknown keys with
104
+ the table printed.
94
105
 
95
- Options:
96
- 1. Yes [CURRENT]
97
- 2. No
106
+ Validate the value:
107
+ - `mode` ∈ {guided, yolo}
108
+ - `model_profile` ∈ {quality, balanced, budget, inherit}
109
+ - `workflow.discuss_mode` ∈ {adaptive, discuss, skip}
110
+ - `git.branching_strategy` ∈ {none, feature-branch, worktree-isolation}
111
+ - `workflow.*` booleans ∈ {true, false}
112
+ - `output.verbose` ∈ {true, false}
98
113
 
99
- Your choice:
114
+ ```bash
115
+ node .rihal/bin/rihal-tools.cjs config-set "$KEY" "$VALUE"
100
116
  ```
101
117
 
102
- Valid responses: 1/yes/y or 2/no/n. Store as `new_enable_plan_checker_loop` (true/false string).
103
-
104
- ### Setting 4: Enable Post-Execute Verifier Gates
105
-
118
+ Print:
106
119
  ```
107
- Question:
108
- Enable post-execute verifier gates?
109
-
110
- This runs verification after each task execution to catch regressions and issues.
111
-
112
- Options:
113
- 1. Yes
114
- 2. No [CURRENT]
115
-
116
- Your choice:
120
+ ✓ {key} = {value}
117
121
  ```
118
122
 
119
- Valid responses: 1/yes/y or 2/no/n. Store as `new_enable_post_execute_verifier` (true/false string).
123
+ STOP.
120
124
 
121
- ### Setting 5: Branching Strategy
125
+ ## Step 2 Interactive edit
126
+
127
+ After Step 1.5 prints the table, ask:
122
128
 
123
129
  ```
124
130
  Question:
125
- What branching strategy should workflows use?
131
+ Which setting would you like to change?
126
132
 
127
133
  Options:
128
- 1. none (No branching, work on current branch)
129
- 2. feature-branch (Create feature branches, leave checkout to user)
130
- 3. worktree-isolation (Use git worktrees for isolated work)
131
-
132
- Your choice: [pre-filled with current_branching_strategy]
133
- ```
134
-
135
- Valid responses: 1, 2, 3, or exact names (none, feature-branch, worktree-isolation).
136
- Map numeric choices to strategy names. Store as `new_branching_strategy`.
137
-
138
- ## Step 3 Write Config
139
-
140
- After collecting all settings, write them back to `.rihal/config.yaml` using `rihal-tools.cjs config set`:
134
+ 1. mode (guided / yolo)
135
+ 2. model_profile
136
+ 3. workflow.research_by_default
137
+ 4. workflow.plan_checker
138
+ 5. workflow.post_execute_gates
139
+ 6. workflow.ui_safety_gate
140
+ 7. workflow.discuss_mode
141
+ 8. git.branching_strategy
142
+ 9. git.commit_docs
143
+ 10. communication_language
144
+ 11. output.verbose (slim output / full detail)
145
+ 0. Done — exit
146
+ ```
147
+
148
+ For each pick, present the constrained option set from Step 1.8, accept the
149
+ choice, then call:
141
150
 
142
151
  ```bash
143
- node .rihal/bin/rihal-tools.cjs config set --key model_profile --value "$new_model_profile"
144
- node .rihal/bin/rihal-tools.cjs config set --key enable_research_pre_step --value "$new_enable_research_pre_step"
145
- node .rihal/bin/rihal-tools.cjs config set --key enable_plan_checker_loop --value "$new_enable_plan_checker_loop"
146
- node .rihal/bin/rihal-tools.cjs config set --key enable_post_execute_verifier --value "$new_enable_post_execute_verifier"
147
- node .rihal/bin/rihal-tools.cjs config set --key branching_strategy --value "$new_branching_strategy"
152
+ node .rihal/bin/rihal-tools.cjs config-set "{dotted.key}" "{value}"
148
153
  ```
149
154
 
150
- ## Step 4 Confirm and Print
155
+ After each successful write, re-display the affected row from Step 1.5 so the
156
+ user sees the change took effect.
151
157
 
152
- Print a summary of the new settings:
158
+ Loop until the user picks `0. Done`.
153
159
 
154
- ```
155
- ✓ Settings updated successfully!
160
+ ## Step 3 — Closing summary
156
161
 
157
- Model Profile: $new_model_profile
158
- Research pre-step: $new_enable_research_pre_step
159
- Plan-checker loop: $new_enable_plan_checker_loop
160
- Post-execute verifier: $new_enable_post_execute_verifier
161
- Branching strategy: $new_branching_strategy
162
+ Print:
162
163
 
163
- Settings saved to: .rihal/config.yaml
164
164
  ```
165
+ ✓ Settings saved to .rihal/config.yaml
165
166
 
166
- Print a tip:
167
-
168
- ```
169
- Tip: Use /rihal:resume-work to reload config and continue work.
167
+ Tip: settings take effect on the next workflow run. Use /rihal:settings show
168
+ to verify, or /rihal:resume-work to reload context.
170
169
  ```
171
170
 
172
171
  ## Success Criteria
173
172
 
174
- - [ ] Task completed as requested
175
- - [ ] Output saved or reported
176
- - [ ] State updated if necessary
177
- - [ ] No errors encountered
173
+ - [ ] `/rihal:settings show` prints all 11 keys (no `(unset)` for keys with defaults)
174
+ - [ ] `/rihal:settings set workflow.discuss_mode discuss` round-trips: `config-get` returns `discuss`
175
+ - [ ] After any save, sibling keys in `workflow:` and `git:` blocks are preserved (no nesting corruption)
176
+ - [ ] Unknown keys are rejected with the allowed-keys table
178
177
 
179
178
  ## On Error
180
179
 
181
- If arguments are invalid, missing files, or subagent fails:
182
- - Validate inputs match expected format
183
- - Check that required files exist
184
- - Retry with clearer arguments or report the specific error to the user
185
-
180
+ - **`.rihal/config.yaml` missing:** print "No config found. Run /rihal:init first." and STOP.
181
+ - **Invalid key:** print the allowed keys from Step 1.5 and STOP.
182
+ - **Invalid value:** print the allowed values for that key and STOP.
183
+ - **`rihal-tools.cjs` missing:** print "Run: npx @hanzlaa/rcode install ." and STOP.
@@ -1,11 +1,46 @@
1
1
  # Workflow: rihal:sprint-planning
2
2
 
3
3
  <purpose>
4
- Plan the next sprint: compute capacity from velocity history, prioritize stories from phase scope, create SPRINT.md, register sprint + stories in state.json.
5
-
6
- Uses rihal-tools.cjs sprint/story state commands for tracking.
4
+ Plan the next sprint. Authoritative implementation lives in the
5
+ `rihal-sprint-planning` skill — this workflow delegates to it so every
6
+ safety rail (capacity gate per #127, halt-at-menu per #124, state-sync
7
+ per #198) fires identically whether the user invokes the slash command
8
+ or the phrase-activated skill.
9
+
10
+ The skill MUST be loaded before the in-line steps below run. If the skill
11
+ file is missing (broken install), report and stop — do not silently fall
12
+ back to the in-line implementation.
7
13
  </purpose>
8
14
 
15
+ <delegate_to_skill>
16
+ Required skill: `rihal-sprint-planning`
17
+ Path: `.claude/skills/rihal-sprint-planning/SKILL.md`
18
+ Workflow ref: `.claude/skills/rihal-sprint-planning/workflow.md`
19
+
20
+ Behaviour:
21
+ 1. Load the skill's `SKILL.md` and `workflow.md`. Apply every Critical
22
+ Rule from the workflow's `## CRITICAL RULES (NO EXCEPTIONS)` block,
23
+ including the capacity gate (step n="0") which MUST halt for
24
+ numeric capacity inputs before any story is committed.
25
+ 2. Run the skill's step files in order. The in-line steps below this
26
+ block are a fallback summary for legacy installs that lack the skill;
27
+ they are NOT the authoritative behaviour.
28
+ 3. After SPRINT.md is written, ALWAYS run:
29
+ `node .rihal/bin/rihal-tools.cjs state sync --from-disk`
30
+ so state.sprints[] reflects the new sprint.
31
+
32
+ If skill files are missing: print
33
+ "Sprint-planning skill not installed. Run: npx @hanzlaa/rcode install"
34
+ and exit non-zero. Do not proceed with the legacy in-line steps because
35
+ they bypass the capacity gate.
36
+ </delegate_to_skill>
37
+
38
+ <required_reading>
39
+ @.rihal/references/output-format.md
40
+ @.rihal/skills/_shared/no-autonomous-bypass.md
41
+ @.rihal/skills/_shared/state-sync-rule.md
42
+ </required_reading>
43
+
9
44
  <output_format>
10
45
  Open with banner:
11
46
  ```
@@ -13,15 +48,11 @@ Open with banner:
13
48
  RIHAL ► PLANNING SPRINT
14
49
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
15
50
  ```
16
- TaskCreate: "Load phase scope + velocity", "Curate stories with user", "Register sprint + stories in state", "Write SPRINT.md", "Start sprint".
51
+ TaskCreate: "Load phase scope + velocity", "Capacity gate (halt for numbers)", "Curate stories with user", "Register sprint + stories in state", "Write SPRINT.md", "Sync state", "Start sprint".
17
52
  Closure: `RIHAL ► SPRINT {NN.S} READY ✓ ({N} stories, {M} points)`
18
53
  Next Up: `/rihal:execute .planning/phases/{phase}/SPRINT.md`
19
54
  </output_format>
20
55
 
21
- <required_reading>
22
- @.rihal/references/output-format.md
23
- </required_reading>
24
-
25
56
  <process>
26
57
  ## Step 0 — Usage check
27
58
 
@@ -16,10 +16,15 @@ Render a human-readable project status dashboard. All data comes from a single `
16
16
 
17
17
  ```bash
18
18
  SNAPSHOT=$(node .rihal/bin/rihal-tools.cjs progress init)
19
+ VERBOSE=$(node .rihal/bin/rihal-tools.cjs config-get output.verbose 2>/dev/null || echo "false")
19
20
  ```
20
21
 
21
22
  Parse as JSON. If `SNAPSHOT.ok` is not true, print a one-line error and stop.
22
23
 
24
+ **Slim mode** (default when `VERBOSE != "true"`): Output Steps 2–3 only (banner + phases list). Skip decisions, blockers detail, and route menu — just print the top route as a single "Next: `/rihal:X`" line. Append `(run /rihal:status --verbose for full detail)`.
25
+
26
+ **Verbose mode** (`VERBOSE == "true"` or `$ARGUMENTS` contains `--verbose`): Full Steps 2–6 output.
27
+
23
28
  If `SNAPSHOT.project` is empty and `SNAPSHOT.phases` is empty, print:
24
29
 
25
30
  ```
@@ -22,7 +22,7 @@ If `$ARGUMENTS` is empty or contains only `--help` or `-h`:
22
22
  STOP — do not proceed.
23
23
 
24
24
  <available_agent_types>
25
- - `rihal-ui-designer` — UI specification generator
25
+ - `rihal-ux-designer` — UI specification generator
26
26
  </available_agent_types>
27
27
 
28
28
  ## Step 0 — Initialize
@@ -51,11 +51,11 @@ Load existing design system, extract:
51
51
 
52
52
  ## Step 2 — Spawn UI Designer
53
53
 
54
- Spawn `rihal-ui-designer` subagent:
54
+ Spawn `rihal-ux-designer` subagent:
55
55
 
56
56
  ```
57
57
  Task tool call:
58
- subagent_type: "rihal-ui-designer"
58
+ subagent_type: "rihal-ux-designer"
59
59
  description: "Generate UI-SPEC.md"
60
60
  prompt: |
61
61
  Generate a UI-SPEC.md file with the following structure: