@hanzlaa/rcode 2.1.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.
- package/CONTRIBUTING.md +138 -0
- package/README.md +83 -19
- package/cli/install.js +687 -80
- package/cli/uninstall.js +8 -0
- package/dist/rcode.js +19777 -0
- package/package.json +17 -4
- package/rihal/DOCS-AUDIT.md +14 -0
- package/rihal/agents/rihal-code-reviewer.md +1 -1
- package/rihal/agents/rihal-codebase-mapper.md +1 -1
- package/rihal/agents/rihal-docs-auditor.md +1 -1
- package/rihal/agents/rihal-edge-case-hunter.md +1 -1
- package/rihal/agents/rihal-executor.md +1 -1
- package/rihal/agents/rihal-hussain-pm.md +1 -0
- package/rihal/agents/rihal-nyquist-auditor.md +1 -1
- package/rihal/agents/rihal-phase-researcher.md +1 -2
- package/rihal/agents/rihal-planner.md +1 -1
- package/rihal/agents/rihal-roadmapper.md +1 -0
- package/rihal/agents/rihal-security-adversary.md +1 -1
- package/rihal/agents/rihal-security-auditor.md +1 -1
- package/rihal/agents/rihal-sprint-checker.md +1 -1
- package/rihal/agents/rihal-verifier.md +1 -1
- package/rihal/bin/lib/roadmap.cjs +2 -3
- package/rihal/bin/rihal-tools.cjs +153 -36
- package/rihal/brain/sources.yaml +7 -4
- package/rihal/commands/audit.md +8 -0
- package/rihal/commands/checkpoint-preview.md +13 -0
- package/rihal/commands/config.md +4 -4
- package/rihal/commands/prfaq.md +15 -0
- package/rihal/commands/settings.md +2 -2
- package/rihal/references/agent-contracts.md +12 -0
- package/rihal/references/karpathy-guidelines-full.md +79 -0
- package/rihal/references/karpathy-guidelines.md +8 -76
- package/rihal/references/model-profile-resolution.md +8 -0
- package/rihal/references/phase-argument-parsing.md +11 -0
- package/rihal/references/revision-loop.md +11 -0
- package/rihal/references/universal-anti-patterns.md +15 -0
- package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +10 -0
- package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +3 -1
- package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +3 -1
- package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-10-complete.md +1 -1
- package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +13 -0
- package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +4 -2
- package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +10 -0
- package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +3 -1
- package/rihal/skills/agents/hussain-pm/SKILL.md +8 -0
- package/rihal/skills/agents/hussain-sm/SKILL.md +8 -0
- package/rihal/templates/UAT.md +29 -0
- package/rihal/templates/milestone.md +2 -0
- package/rihal/templates/sprint.md +11 -28
- package/rihal/templates/summary.md +30 -0
- package/rihal/templates/verification-report.md +28 -0
- package/rihal/workflows/audit-milestone.md +34 -2
- package/rihal/workflows/audit.md +172 -0
- package/rihal/workflows/autonomous.md +67 -0
- package/rihal/workflows/checkpoint-preview.md +7 -0
- package/rihal/workflows/council.md +3 -1
- package/rihal/workflows/dashboard.md +2 -2
- package/rihal/workflows/debug.md +8 -1
- package/rihal/workflows/diagnose-issues.md +34 -0
- package/rihal/workflows/do.md +47 -3
- package/rihal/workflows/execute-sprint.md +11 -4
- package/rihal/workflows/execute.md +9 -3
- package/rihal/workflows/install.md +2 -2
- package/rihal/workflows/karpathy-audit.md +7 -14
- package/rihal/workflows/pause-work.md +7 -1
- package/rihal/workflows/prfaq.md +7 -0
- package/rihal/workflows/profile-user.md +2 -2
- package/rihal/workflows/progress.md +1 -1
- package/rihal/workflows/settings.md +116 -118
- package/rihal/workflows/sprint-planning.md +39 -8
- package/rihal/workflows/status.md +6 -1
- package/rihal/workflows/ui-phase.md +3 -3
- package/rihal/workflows/update.md +80 -22
- package/rihal/workflows/validate-phase.md +7 -1
- package/rihal/agents/rihal-ui-designer.md +0 -6
- package/rihal/workflows/config.md +0 -105
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Workflow: rihal:audit
|
|
2
|
+
|
|
3
|
+
<purpose>
|
|
4
|
+
Single entry point for every kind of audit. Asks the user *what* to audit
|
|
5
|
+
and dispatches to the right sub-workflow. Closes #234 — replaces the prior
|
|
6
|
+
state where users had to know about six separate audit/verify commands by
|
|
7
|
+
name (`audit-milestone`, `audit-uat`, `audit-fix`, `karpathy-audit`,
|
|
8
|
+
`verify-phase`, `verify-work`).
|
|
9
|
+
|
|
10
|
+
Honours `.rihal/config.yaml`: in `mode: yolo`, the router skips the menu
|
|
11
|
+
and auto-picks the most-relevant target based on project state. In
|
|
12
|
+
`mode: guided` (default), it asks.
|
|
13
|
+
</purpose>
|
|
14
|
+
|
|
15
|
+
## Step 0 — Usage check
|
|
16
|
+
|
|
17
|
+
If `$ARGUMENTS` contains `--help` or `-h`:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
/rihal:audit # interactive — asks what to audit
|
|
21
|
+
/rihal:audit phase [<NN>] # → /rihal:verify-phase
|
|
22
|
+
/rihal:audit milestone [--strict] # → /rihal:audit-milestone (with synth fallback)
|
|
23
|
+
/rihal:audit uat # → /rihal:audit-uat
|
|
24
|
+
/rihal:audit code [--scope=...] # → /rihal:karpathy-audit
|
|
25
|
+
/rihal:audit fix # → /rihal:audit-fix
|
|
26
|
+
/rihal:audit work # → /rihal:verify-work
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Examples:**
|
|
30
|
+
```
|
|
31
|
+
/rihal:audit
|
|
32
|
+
/rihal:audit milestone --strict
|
|
33
|
+
/rihal:audit phase 03
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Step 1 — Resolve mode + arguments
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
TOOL="node .rihal/bin/rihal-tools.cjs"
|
|
40
|
+
MODE=$($TOOL config-get mode 2>/dev/null || echo "guided")
|
|
41
|
+
DISCUSS=$($TOOL config-get workflow.discuss_mode 2>/dev/null || echo "adaptive")
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Parse `$ARGUMENTS`:
|
|
45
|
+
- First word ∈ {phase, milestone, uat, code, fix, work} → set `$TARGET`, drop it from args, jump to Step 4.
|
|
46
|
+
- Empty or unrecognised → continue to Step 2.
|
|
47
|
+
|
|
48
|
+
## Step 2 — Detect project state
|
|
49
|
+
|
|
50
|
+
Probe what's audit-able right now:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
ROADMAP=$([ -f .planning/ROADMAP.md ] && echo yes || echo no)
|
|
54
|
+
PHASES=$(ls -d .planning/phases/*/ 2>/dev/null | wc -l)
|
|
55
|
+
PLANS=$(find .planning/phases -name PLAN.md 2>/dev/null | wc -l)
|
|
56
|
+
SUMMARIES=$(find .planning/phases -name SUMMARY.md 2>/dev/null | wc -l)
|
|
57
|
+
UAT_FILES=$(find .planning -name 'UAT*.md' 2>/dev/null | wc -l)
|
|
58
|
+
ON_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
59
|
+
DIRTY=$([ -n "$(git status --porcelain 2>/dev/null)" ] && echo yes || echo no)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Use these to decide which menu options are *relevant* and which to mark
|
|
63
|
+
as `(no data — skip)`.
|
|
64
|
+
|
|
65
|
+
## Step 3 — Ask user (guided mode only)
|
|
66
|
+
|
|
67
|
+
If `$MODE` is `yolo`, skip this step and pick the most relevant target
|
|
68
|
+
automatically (priority: `work` if dirty branch, else `phase` if PLANS>0
|
|
69
|
+
and SUMMARIES<PLANS, else `milestone` if SUMMARIES>0, else `code`).
|
|
70
|
+
|
|
71
|
+
Otherwise call AskUserQuestion:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
Question:
|
|
75
|
+
What do you want to audit?
|
|
76
|
+
|
|
77
|
+
Options:
|
|
78
|
+
1. phase — verify a single phase against its PLAN ({PLANS} plans)
|
|
79
|
+
2. milestone — cross-phase milestone goal coverage ({SUMMARIES} summaries)
|
|
80
|
+
3. uat — outstanding UAT / verification items ({UAT_FILES} files)
|
|
81
|
+
4. code-quality — Karpathy 4-principle code review (current diff)
|
|
82
|
+
5. auto-fix — audit then auto-fix findings (uses #1–4 output)
|
|
83
|
+
6. work — verify current branch / WIP ({ON_BRANCH}, dirty={DIRTY})
|
|
84
|
+
0. cancel
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Set `$TARGET` from the user's choice.
|
|
88
|
+
|
|
89
|
+
## Step 4 — Pre-flight per target
|
|
90
|
+
|
|
91
|
+
Each target has a precondition. Fail loudly with the fix step *before*
|
|
92
|
+
dispatching, so the user doesn't get a surprise halt deep inside the
|
|
93
|
+
sub-workflow.
|
|
94
|
+
|
|
95
|
+
| target | precondition | failure message |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| phase | at least one `.planning/phases/*/PLAN.md` | `No PLAN.md found. Run /rihal:plan first.` |
|
|
98
|
+
| milestone | ROADMAP.md exists | `No ROADMAP.md. Run /rihal:new-milestone first.` |
|
|
99
|
+
| uat | at least one UAT*.md exists | `No UAT files yet. Run /rihal:execute on a phase first.` |
|
|
100
|
+
| code | git repo with at least one commit | `Empty repo — nothing to audit yet.` |
|
|
101
|
+
| fix | a prior audit report exists OR a prior `--report` artefact | `No audit findings yet. Run /rihal:audit first.` |
|
|
102
|
+
| work | inside a git worktree | `Not in a git repo.` |
|
|
103
|
+
|
|
104
|
+
For `milestone` specifically, check the **graceful-degrade** condition
|
|
105
|
+
(closes #234 audit-milestone halt):
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
if [ "$TARGET" = "milestone" ] && [ "$SUMMARIES" -eq 0 ] && [ "$PLANS" -gt 0 ]; then
|
|
109
|
+
# Phases planned but no formal closes — offer to synthesize.
|
|
110
|
+
GIT_FEAT_COMMITS=$(git log --oneline --grep='^feat' 2>/dev/null | wc -l)
|
|
111
|
+
echo "⚠ $PLANS phases planned, 0 SUMMARY.md, $GIT_FEAT_COMMITS feat commits."
|
|
112
|
+
echo " Phases were executed but never formally closed."
|
|
113
|
+
# Offer (yolo: auto-pick 1; guided: ask):
|
|
114
|
+
# 1. Synthesize SUMMARY.md per phase from PLAN.md + git log [recommended]
|
|
115
|
+
# 2. Run /rihal:verify-phase per phase (manual close)
|
|
116
|
+
# 3. Continue audit anyway (will only assess what's documented)
|
|
117
|
+
# 0. Cancel
|
|
118
|
+
fi
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
In `mode: yolo`, auto-pick option 1: group `git log --oneline` output by
|
|
122
|
+
phase tag (e.g. commits matching `^feat\(0?(\d+)`) and write a first-pass
|
|
123
|
+
`SUMMARY.md` per phase under `.planning/phases/<phase>/SUMMARY.md`
|
|
124
|
+
containing the goal (from PLAN.md), the commit list, and a `# TODO:
|
|
125
|
+
expand outcomes` marker. The user can then refine before re-running the
|
|
126
|
+
audit.
|
|
127
|
+
|
|
128
|
+
A native `phase synthesize-summaries` CLI subcommand is tracked separately
|
|
129
|
+
(see #234 follow-ups) — until it lands, the LLM performs the synthesis
|
|
130
|
+
inline using `git log` + `Read PLAN.md` + `Write SUMMARY.md`.
|
|
131
|
+
|
|
132
|
+
## Step 5 — Dispatch
|
|
133
|
+
|
|
134
|
+
Run the target's slash command, forwarding remaining args:
|
|
135
|
+
|
|
136
|
+
| target | dispatch |
|
|
137
|
+
|---|---|
|
|
138
|
+
| phase | `/rihal:verify-phase $REST_ARGS` |
|
|
139
|
+
| milestone | `/rihal:audit-milestone $REST_ARGS` |
|
|
140
|
+
| uat | `/rihal:audit-uat $REST_ARGS` |
|
|
141
|
+
| code | `/rihal:karpathy-audit $REST_ARGS` |
|
|
142
|
+
| fix | `/rihal:audit-fix $REST_ARGS` |
|
|
143
|
+
| work | `/rihal:verify-work $REST_ARGS` |
|
|
144
|
+
|
|
145
|
+
## Step 6 — Closing summary
|
|
146
|
+
|
|
147
|
+
After the sub-workflow returns:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
RIHAL ► AUDIT ({TARGET}) ✓
|
|
151
|
+
|
|
152
|
+
Report: {report_path or "(stdout only)"}
|
|
153
|
+
Findings: {count}
|
|
154
|
+
|
|
155
|
+
Next:
|
|
156
|
+
/rihal:audit fix — auto-fix findings classified as auto-fixable
|
|
157
|
+
/rihal:audit code — drill into code-quality issues
|
|
158
|
+
/rihal:settings show — review which audit gates are enabled
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Success Criteria
|
|
162
|
+
|
|
163
|
+
- [ ] `/rihal:audit` (no args) presents menu in guided mode, auto-picks in yolo
|
|
164
|
+
- [ ] `/rihal:audit milestone` short-circuits the menu
|
|
165
|
+
- [ ] When SUMMARY.md absent but PLAN.md present, milestone offers synthesize/verify/skip — does not dead-halt
|
|
166
|
+
- [ ] Sub-workflow's closing report is surfaced unchanged
|
|
167
|
+
|
|
168
|
+
## On Error
|
|
169
|
+
|
|
170
|
+
- **Sub-workflow not installed** (slash file missing): `Audit subroute '/rihal:{target}' not found. Run: npx @hanzlaa/rcode install .`
|
|
171
|
+
- **Precondition failed**: print the message from Step 4's table, suggest the unblocking command, STOP.
|
|
172
|
+
- **`.rihal/config.yaml` missing**: treat as `mode: guided`, continue.
|
|
@@ -4,16 +4,83 @@ Drive milestone phases autonomously — all remaining phases, a range via `--fro
|
|
|
4
4
|
|
|
5
5
|
</purpose>
|
|
6
6
|
|
|
7
|
+
<critical_rules priority="absolute">
|
|
8
|
+
|
|
9
|
+
These rules apply throughout autonomous execution. Violations broke the
|
|
10
|
+
interpos audit (issue #221) — DO NOT regress.
|
|
11
|
+
|
|
12
|
+
1. **NEVER modify `.rihal/config.yaml`.** Specifically: never write
|
|
13
|
+
`mode: yolo`, never call `rihal-tools config-set mode`, never `sed`
|
|
14
|
+
the file. The user's mode preference is sacred. Autonomous behavior
|
|
15
|
+
is governed by the workflow's own internal flags + the `--auto`
|
|
16
|
+
invocation flag, NOT by mutating persistent config.
|
|
17
|
+
|
|
18
|
+
2. **NEVER skip the methodology chain on greenfield projects.** Before
|
|
19
|
+
the phase loop runs, the prerequisite check (next step) MUST verify:
|
|
20
|
+
- `.planning/prd.md` exists (else halt → /rihal:create-prd)
|
|
21
|
+
- ROADMAP.md has milestone structure (else halt → /rihal:create-milestone)
|
|
22
|
+
- `.planning/epics.md` exists (else halt → /rihal:create-epics-and-stories)
|
|
23
|
+
See issue #219 + #229.
|
|
24
|
+
|
|
25
|
+
3. **NEVER write SPRINT.md directly.** Sprint creation MUST go through
|
|
26
|
+
the `rihal-sprint-planning` skill so the capacity gate (#127) fires.
|
|
27
|
+
If autonomous needs a sprint, invoke the skill — don't shortcut.
|
|
28
|
+
|
|
29
|
+
4. **ALWAYS call `state sync --from-disk` after writing any
|
|
30
|
+
.planning/ artifact.** Otherwise state.json drifts and downstream
|
|
31
|
+
workflows lie. See `_shared/state-sync-rule.md` (#198).
|
|
32
|
+
|
|
33
|
+
5. **ALWAYS record decisions via `rihal-tools state add-decision`.**
|
|
34
|
+
Never write decision prose to STATE.md. See #224.
|
|
35
|
+
|
|
36
|
+
</critical_rules>
|
|
37
|
+
|
|
7
38
|
<required_reading>
|
|
8
39
|
|
|
9
40
|
@.rihal/references/output-format.md
|
|
10
41
|
@.rihal/references/workstream-flag.md
|
|
11
42
|
@.rihal/references/output-realism.md
|
|
43
|
+
@.rihal/skills/_shared/no-autonomous-bypass.md
|
|
44
|
+
@.rihal/skills/_shared/state-sync-rule.md
|
|
12
45
|
|
|
13
46
|
Read all files referenced by the invoking prompt's execution_context before starting.
|
|
14
47
|
|
|
15
48
|
</required_reading>
|
|
16
49
|
|
|
50
|
+
<step name="prerequisite_check" priority="before-everything">
|
|
51
|
+
|
|
52
|
+
## 0. Prerequisite check (greenfield guard)
|
|
53
|
+
|
|
54
|
+
Before any phase work, verify the methodology chain has run:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
HAS_PRD=$([ -f .planning/prd.md ] && echo true || echo false)
|
|
58
|
+
HAS_ROADMAP_MILESTONES=$(grep -qE "^## Milestone\s+M[0-9]+" .planning/ROADMAP.md 2>/dev/null && echo true || echo false)
|
|
59
|
+
HAS_EPICS=$([ -f .planning/epics.md ] && echo true || echo false)
|
|
60
|
+
SKIP_FLAG=$(echo "$ARGUMENTS" | grep -qE "\-\-skip-prerequisites" && echo true || echo false)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
If `SKIP_FLAG=false` AND any prerequisite is missing, HALT with a clear message:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
⚠ Cannot run autonomous: missing prerequisite — {what}.
|
|
67
|
+
|
|
68
|
+
The autonomous flow assumes a project that has already gone through:
|
|
69
|
+
1. /rihal:create-prd → produces .planning/prd.md
|
|
70
|
+
2. /rihal:create-milestone → produces ROADMAP.md with M1..Mn
|
|
71
|
+
3. /rihal:create-epics-and-stories → produces .planning/epics.md
|
|
72
|
+
4. THEN /rihal:autonomous ← you are here
|
|
73
|
+
|
|
74
|
+
Suggested first step: /rihal:{first-missing-command}
|
|
75
|
+
|
|
76
|
+
If you genuinely want to skip these (rare — usually inverted methodology),
|
|
77
|
+
re-invoke with: /rihal:autonomous --skip-prerequisites
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If `SKIP_FLAG=true`: print a warning that downstream workflows may produce low-quality output without upstream artifacts, then proceed.
|
|
81
|
+
|
|
82
|
+
</step>
|
|
83
|
+
|
|
17
84
|
<output_format>
|
|
18
85
|
|
|
19
86
|
Open with banner:
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Workflow: rihal:checkpoint-preview
|
|
2
|
+
|
|
3
|
+
<purpose>
|
|
4
|
+
Human-in-the-loop change review. Make sense of a diff, focus attention where it matters, and walk through testing. Delegates to the rihal-checkpoint-preview skill for the full review protocol.
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
@.rihal/skills/rihal-checkpoint-preview/SKILL.md
|
|
@@ -404,7 +404,9 @@ Rules for compact mode:
|
|
|
404
404
|
- Round 2 deltas: ≤ 15 words each. "Held position" is a valid delta.
|
|
405
405
|
- No section headers beyond the four above. No numbered story breakdowns. No tables from panelists verbatim.
|
|
406
406
|
|
|
407
|
-
### Verbose mode (`--verbose` flag)
|
|
407
|
+
### Verbose mode (`--verbose` flag or `output.verbose: true` in config)
|
|
408
|
+
|
|
409
|
+
Activated by: `--verbose` in `$ARGUMENTS` OR `$(node .rihal/bin/rihal-tools.cjs config-get output.verbose)` equals `"true"`.
|
|
408
410
|
|
|
409
411
|
Print Round 1 (and Round 2 if ran) verbatim in panel order. Do NOT summarize.
|
|
410
412
|
|
|
@@ -27,14 +27,14 @@ Check for the dashboard server in priority order:
|
|
|
27
27
|
|
|
28
28
|
1. `./server/dashboard.js` (when inside the rihal-code source repo)
|
|
29
29
|
2. `./.rihal/lib/server/dashboard.js` (installed package copy)
|
|
30
|
-
3. `$(npm root -g)/@
|
|
30
|
+
3. `$(npm root -g)/@hanzlaa/rcode/server/dashboard.js` (global install)
|
|
31
31
|
|
|
32
32
|
Store the resolved path as `$DASHBOARD`.
|
|
33
33
|
|
|
34
34
|
If none found, print:
|
|
35
35
|
```
|
|
36
36
|
❌ Dashboard script not found.
|
|
37
|
-
Run `npx
|
|
37
|
+
Run `npx @hanzlaa/rcode install` to install the package, or check you're inside a project with .rihal/.
|
|
38
38
|
```
|
|
39
39
|
Exit.
|
|
40
40
|
|
package/rihal/workflows/debug.md
CHANGED
|
@@ -118,8 +118,15 @@ Task(
|
|
|
118
118
|
)
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
**Never pass `isolation="worktree"` without explicit user consent.** Worktree isolation creates a git worktree, which is a write operation the user may not want. If you believe isolation is genuinely needed (e.g., the debug agent may edit files)
|
|
121
|
+
**Never pass `isolation="worktree"` without explicit user consent.** Worktree isolation creates a git worktree, which is a write operation the user may not want. If you believe isolation is genuinely needed (e.g., the debug agent may edit files):
|
|
122
122
|
|
|
123
|
+
```bash
|
|
124
|
+
CONFIG_MODE=$(node .rihal/bin/rihal-tools.cjs config-get mode 2>/dev/null || echo "guided")
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**If `CONFIG_MODE == "yolo"`:** Skip isolation — default to no worktree, proceed immediately.
|
|
128
|
+
|
|
129
|
+
Otherwise ask via AskUserQuestion:
|
|
123
130
|
```
|
|
124
131
|
Spawn the debug agent with git worktree isolation?
|
|
125
132
|
- Safer: agent edits stay isolated until you merge
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Workflow: rihal:diagnose-issues
|
|
2
|
+
|
|
3
|
+
<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.
|
|
7
|
+
</purpose>
|
|
8
|
+
|
|
9
|
+
## Step 1 — Symptom capture
|
|
10
|
+
|
|
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>`)
|
|
15
|
+
|
|
16
|
+
## Step 2 — Hypotheses
|
|
17
|
+
|
|
18
|
+
List 2–3 plausible causes. For each:
|
|
19
|
+
- a one-line predicted mechanism
|
|
20
|
+
- the cheapest test that would falsify it
|
|
21
|
+
|
|
22
|
+
## Step 3 — Evidence
|
|
23
|
+
|
|
24
|
+
Run the falsifying tests in cheapest-first order. Stop at the first
|
|
25
|
+
hypothesis that matches all evidence.
|
|
26
|
+
|
|
27
|
+
## Step 4 — Minimal repro
|
|
28
|
+
|
|
29
|
+
Reduce to the smallest input that still triggers the bug. Save under
|
|
30
|
+
`.planning/diagnostics/<slug>.md`.
|
|
31
|
+
|
|
32
|
+
## Step 5 — Hand-off
|
|
33
|
+
|
|
34
|
+
Return JSON: `{ root_cause, repro_path, suggested_fix }` to the caller.
|
package/rihal/workflows/do.md
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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 "
|
|
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`:
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
60
|
-
|
|
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-
|
|
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>
|
|
@@ -50,8 +50,8 @@ The installer needs to be called with the `--module` flag. Detect the rihal-code
|
|
|
50
50
|
# Try local dev first, then global
|
|
51
51
|
if [ -f ./cli/install-v2.js ]; then
|
|
52
52
|
node ./cli/install-v2.js . --module {name} --force --yes
|
|
53
|
-
elif [ -f "$(npm root -g)/@
|
|
54
|
-
node "$(npm root -g)/@
|
|
53
|
+
elif [ -f "$(npm root -g)/@hanzlaa/rcode/cli/install-v2.js" ]; then
|
|
54
|
+
node "$(npm root -g)/@hanzlaa/rcode/cli/install-v2.js" . --module {name} --force --yes
|
|
55
55
|
else
|
|
56
56
|
echo "Cannot find rihal-code package. Install it globally or run from the repo."
|
|
57
57
|
exit 1
|
|
@@ -382,28 +382,21 @@ Auto-fix some issues: /rihal:code-review-fix {phase}
|
|
|
382
382
|
|
|
383
383
|
</process>
|
|
384
384
|
|
|
385
|
-
|
|
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
|
-
|
|
406
|
-
-
|
|
407
|
-
-
|
|
408
|
-
-
|
|
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
|
-
|
|
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
|
|
19
|
-
/rihal:profile-user
|
|
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.
|
|
@@ -179,6 +179,6 @@ If `SNAPSHOT.routes[]` is empty or only has fallback entries, print:
|
|
|
179
179
|
|
|
180
180
|
## On Error
|
|
181
181
|
|
|
182
|
-
- **CLI missing:** "Rihal Code install missing or stale. Run: npx @
|
|
182
|
+
- **CLI missing:** "Rihal Code install missing or stale. Run: npx @hanzlaa/rcode install"
|
|
183
183
|
- **CLI returns `ok: false`:** surface the CLI's error verbatim. Do not attempt to compensate — the CLI's failures are the source of truth on what's wrong.
|
|
184
184
|
- **Network-dependent insights:** there should be none. Insights are computed from local state + disk only.
|