@hanzlaa/rcode 3.6.7 → 3.6.14
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/cli/generate-command-skills.cjs +5 -12
- package/package.json +1 -1
- package/rihal/bin/rihal-hooks.cjs +154 -39
- package/rihal/bin/rihal-tools.cjs +25 -24
- package/rihal/commands/execute-milestone.md +2 -2
- package/rihal/commands/plan-milestone.md +2 -2
- package/rihal/commands/scaffold-milestone.md +2 -2
- package/rihal/references/continuation-format.md +5 -6
- package/rihal/references/research-synthesis-playbook.md +1 -1
- package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-06-phase-stubs.md +1 -1
- package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-10-complete.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-debug/SKILL.md +2 -0
- package/rihal/workflows/analyze-dependencies.md +4 -4
- package/rihal/workflows/audit-fix.md +3 -3
- package/rihal/workflows/audit-milestone.md +12 -11
- package/rihal/workflows/audit-worktrees.md +163 -0
- package/rihal/workflows/audit.md +18 -3
- package/rihal/workflows/correct-course.md +3 -3
- package/rihal/workflows/create-architecture.md +3 -3
- package/rihal/workflows/create-epics-and-stories.md +3 -3
- package/rihal/workflows/discuss-phase-power.md +1 -1
- package/rihal/workflows/document-project.md +3 -3
- package/rihal/workflows/edit-prd.md +3 -3
- package/rihal/workflows/execute-milestone.md +3 -3
- package/rihal/workflows/execute-sprint.md +1 -1
- package/rihal/workflows/execute-waves.md +27 -2
- package/rihal/workflows/forensics.md +3 -3
- package/rihal/workflows/health.md +23 -8
- package/rihal/workflows/help.md +0 -1
- package/rihal/workflows/new-project-roadmap.md +2 -2
- package/rihal/workflows/plan-research-validation.md +2 -2
- package/rihal/workflows/plan.md +7 -7
- package/rihal/workflows/retrospective.md +3 -3
- package/rihal/workflows/review-adversarial.md +8 -6
- package/rihal/workflows/review.md +2 -2
- package/rihal/workflows/scaffold-project.md +3 -3
- package/rihal/workflows/secure-phase.md +4 -4
- package/rihal/workflows/session-report.md +1 -1
- package/rihal/workflows/status.md +6 -10
- package/rihal/workflows/validate-prd.md +3 -3
- package/rihal/workflows/verify-phase.md +3 -3
- package/rihal/workflows/workstream.md +3 -3
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Workflow: audit-worktrees
|
|
2
|
+
|
|
3
|
+
<purpose>
|
|
4
|
+
Scan for orphaned executor worktrees and branches left behind by rihal-execute.
|
|
5
|
+
Reports each orphan with its age, merge status, and safe-to-delete verdict.
|
|
6
|
+
With --prune, deletes confirmed-safe orphans automatically.
|
|
7
|
+
</purpose>
|
|
8
|
+
|
|
9
|
+
## Step 0 — Parse arguments
|
|
10
|
+
|
|
11
|
+
- `--prune` → `PRUNE=true` — delete safe orphans after reporting
|
|
12
|
+
- `--help` or `-h` → print usage and stop:
|
|
13
|
+
```
|
|
14
|
+
/rihal-audit worktrees [--prune]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Step 1 — Scan for orphaned worktrees
|
|
18
|
+
|
|
19
|
+
Executor agents use branches prefixed `worktree-agent-`. Find all such branches
|
|
20
|
+
and worktrees still present in the repo:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Active worktrees with executor branches
|
|
24
|
+
git worktree list --porcelain \
|
|
25
|
+
| awk 'BEGIN{p=""} /^worktree /{p=$2} /^branch /{if($2~/refs\/heads\/worktree-agent-/) print p"\t"$2}' \
|
|
26
|
+
> /tmp/rihal-active-wts.txt
|
|
27
|
+
|
|
28
|
+
# Local branches with executor prefix (includes detached/removed worktrees)
|
|
29
|
+
git branch --list 'worktree-agent-*' --format='%(refname:short)' \
|
|
30
|
+
> /tmp/rihal-orphan-br.txt
|
|
31
|
+
|
|
32
|
+
ACTIVE_WT_COUNT=$(wc -l < /tmp/rihal-active-wts.txt)
|
|
33
|
+
ORPHAN_BR_COUNT=$(wc -l < /tmp/rihal-orphan-br.txt)
|
|
34
|
+
TOTAL=$((ACTIVE_WT_COUNT + ORPHAN_BR_COUNT))
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If `TOTAL` is 0:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
✓ No orphaned executor worktrees or branches found.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Stop.
|
|
44
|
+
|
|
45
|
+
## Step 2 — For each orphan, gather intelligence
|
|
46
|
+
|
|
47
|
+
For each entry (worktree or branch), run:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Is it merged into the current branch?
|
|
51
|
+
MERGED=$(git branch --merged HEAD --list '<branch>' 2>/dev/null | grep -c '<branch>')
|
|
52
|
+
|
|
53
|
+
# When was the last commit on this branch?
|
|
54
|
+
LAST_COMMIT=$(git log -1 --format="%ar %s" '<branch>' 2>/dev/null || echo "unknown")
|
|
55
|
+
|
|
56
|
+
# How many commits does it have that are NOT on HEAD?
|
|
57
|
+
AHEAD=$(git rev-list HEAD..'<branch>' --count 2>/dev/null || echo "?")
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Build a report table:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
RIHAL ► WORKTREE AUDIT
|
|
64
|
+
══════════════════════════════════════════════════════════
|
|
65
|
+
|
|
66
|
+
Orphaned executor artifacts: {TOTAL}
|
|
67
|
+
|
|
68
|
+
Branch Merged Ahead Last commit
|
|
69
|
+
────────────────────────────── ────── ───── ──────────────────────
|
|
70
|
+
worktree-agent-abc123 YES 0 3 days ago feat: add auth
|
|
71
|
+
worktree-agent-def456 NO 2 1 hour ago wip: migrations
|
|
72
|
+
...
|
|
73
|
+
|
|
74
|
+
Active worktrees still pointing to executor branches:
|
|
75
|
+
.claude/worktrees/agent-abc123 → worktree-agent-abc123
|
|
76
|
+
...
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Step 3 — Classify each orphan
|
|
80
|
+
|
|
81
|
+
For each branch/worktree:
|
|
82
|
+
|
|
83
|
+
- **SAFE** → `MERGED=YES` AND `AHEAD=0` — all commits are on HEAD, nothing to lose
|
|
84
|
+
- **STALE** → `MERGED=YES` AND `AHEAD>0` — commits are ahead but branch is in merged list (rebased/squash-merged); verify before deleting
|
|
85
|
+
- **UNMERGED** → `MERGED=NO` — DO NOT auto-delete; show explicitly and warn
|
|
86
|
+
|
|
87
|
+
Print classification next to each entry.
|
|
88
|
+
|
|
89
|
+
## Step 4 — Report summary
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Summary:
|
|
93
|
+
SAFE to delete: {N} (merged, 0 ahead)
|
|
94
|
+
STALE (check first): {N} (merged but ahead — may be rebase/squash)
|
|
95
|
+
UNMERGED (keep): {N} (not merged — manual review required)
|
|
96
|
+
|
|
97
|
+
To prune SAFE orphans: /rihal-audit worktrees --prune
|
|
98
|
+
To inspect UNMERGED: git log HEAD..<branch> --oneline
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
If `PRUNE=false`, stop here.
|
|
102
|
+
|
|
103
|
+
## Step 5 — Prune (only when --prune passed)
|
|
104
|
+
|
|
105
|
+
Delete SAFE entries only. Never touch STALE or UNMERGED.
|
|
106
|
+
|
|
107
|
+
For each SAFE branch:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Remove the worktree if it still exists
|
|
111
|
+
WT_PATH=$(awk -F'\t' '$2=="refs/heads/<branch>"{print $1}' /tmp/rihal-active-wts.txt)
|
|
112
|
+
if [ -n "$WT_PATH" ] && [ -d "$WT_PATH" ]; then
|
|
113
|
+
git worktree remove "$WT_PATH" --force 2>/dev/null \
|
|
114
|
+
&& echo " ✓ removed worktree: $WT_PATH" \
|
|
115
|
+
|| echo " ⚠ could not remove worktree: $WT_PATH"
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
# Delete the branch
|
|
119
|
+
git branch -D '<branch>' 2>/dev/null \
|
|
120
|
+
&& echo " ✓ deleted branch: <branch>" \
|
|
121
|
+
|| echo " ⚠ could not delete branch: <branch>"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
After all deletes, re-run Step 1 scan and confirm `TOTAL=0` for SAFE entries.
|
|
125
|
+
|
|
126
|
+
Print final report:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
Pruned: {N} safe orphans removed
|
|
130
|
+
Kept: {N} unmerged branches (manual review required)
|
|
131
|
+
|
|
132
|
+
✓ Worktree cleanup complete
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Step 6 — Post-audit health note
|
|
136
|
+
|
|
137
|
+
If any UNMERGED branches remain, print:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
⚠ {N} unmerged executor branch(es) still present.
|
|
141
|
+
These have commits NOT on your current branch.
|
|
142
|
+
Inspect before deleting:
|
|
143
|
+
|
|
144
|
+
git log HEAD..worktree-agent-<id> --oneline
|
|
145
|
+
git show worktree-agent-<id>:<file> # inspect specific file
|
|
146
|
+
|
|
147
|
+
To delete after manual review:
|
|
148
|
+
git worktree remove .claude/worktrees/<id> --force
|
|
149
|
+
git branch -D worktree-agent-<id>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Success Criteria
|
|
153
|
+
|
|
154
|
+
- [ ] All `worktree-agent-*` branches and worktrees found and reported
|
|
155
|
+
- [ ] Each classified as SAFE / STALE / UNMERGED based on actual merge status
|
|
156
|
+
- [ ] `--prune` deletes only SAFE entries, never UNMERGED
|
|
157
|
+
- [ ] Post-prune confirmation scan verifies cleanup succeeded
|
|
158
|
+
- [ ] Non-executor worktrees (feature branches, manual worktrees) are never touched
|
|
159
|
+
|
|
160
|
+
## On Error
|
|
161
|
+
|
|
162
|
+
- `git worktree list` fails → print `git not available or not a repo` and stop
|
|
163
|
+
- `git branch -D` fails on a branch → skip it, note it in the report, continue
|
package/rihal/workflows/audit.md
CHANGED
|
@@ -26,6 +26,7 @@ If `$ARGUMENTS` contains `--help` or `-h`:
|
|
|
26
26
|
/rihal-audit fix # → /rihal-audit-fix
|
|
27
27
|
/rihal-audit work # → /rihal-verify-work
|
|
28
28
|
/rihal-audit lens [<1-15> | all] # → /rihal-lens-audit (15-lens methodology)
|
|
29
|
+
/rihal-audit worktrees [--prune] # → scan + report orphaned executor worktrees/branches
|
|
29
30
|
```
|
|
30
31
|
|
|
31
32
|
**Examples:**
|
|
@@ -48,7 +49,7 @@ DISCUSS=$($TOOL config-get workflow.discuss_mode 2>/dev/null || echo "adaptive")
|
|
|
48
49
|
```
|
|
49
50
|
|
|
50
51
|
Parse `$ARGUMENTS`:
|
|
51
|
-
- First word ∈ {plans, phase, milestone, uat, code, fix, work, lens} → set `$TARGET`, drop it from args, jump to Step 4.
|
|
52
|
+
- First word ∈ {plans, phase, milestone, uat, code, fix, work, lens, worktrees} → set `$TARGET`, drop it from args, jump to Step 4.
|
|
52
53
|
- Empty or unrecognised → continue to Step 2.
|
|
53
54
|
|
|
54
55
|
## Step 2 — Detect project state
|
|
@@ -70,9 +71,20 @@ as `(no data — skip)`.
|
|
|
70
71
|
|
|
71
72
|
## Step 3 — Ask user (guided mode only)
|
|
72
73
|
|
|
74
|
+
Also probe for orphaned executor worktrees (add to context for Step 3 menu):
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
ORPHAN_WTS=$(git worktree list --porcelain \
|
|
78
|
+
| awk '/^branch /{if($2 ~ /refs\/heads\/worktree-agent-/) print $2}' \
|
|
79
|
+
| wc -l)
|
|
80
|
+
ORPHAN_BR=$(git branch --list 'worktree-agent-*' 2>/dev/null | wc -l)
|
|
81
|
+
ORPHANS=$((ORPHAN_WTS + ORPHAN_BR))
|
|
82
|
+
```
|
|
83
|
+
|
|
73
84
|
If `$MODE` is `yolo`, skip this step and pick the most relevant target
|
|
74
|
-
automatically (priority: `
|
|
75
|
-
|
|
85
|
+
automatically (priority: `worktrees` if ORPHANS>0, else `work` if dirty
|
|
86
|
+
branch, else `plans` if PLANS>0 and SUMMARIES<PLANS, else `milestone` if
|
|
87
|
+
SUMMARIES>0, else `code`).
|
|
76
88
|
|
|
77
89
|
Otherwise call AskUserQuestion:
|
|
78
90
|
|
|
@@ -89,6 +101,7 @@ Options:
|
|
|
89
101
|
6. auto-fix — audit then auto-fix findings (uses #1–5 output)
|
|
90
102
|
7. work — verify current branch / WIP ({ON_BRANCH}, dirty={DIRTY})
|
|
91
103
|
8. lens — 15-lens methodology audit (security, perf, tests…)
|
|
104
|
+
9. worktrees — orphaned executor worktrees/branches ({ORPHANS} found)
|
|
92
105
|
0. cancel
|
|
93
106
|
```
|
|
94
107
|
|
|
@@ -110,6 +123,7 @@ sub-workflow.
|
|
|
110
123
|
| fix | a prior audit report exists OR a prior `--report` artefact | `No audit findings yet. Run /rihal-audit first.` |
|
|
111
124
|
| work | inside a git worktree | `Not in a git repo.` |
|
|
112
125
|
| lens | `rihal/` or `.rihal/` directory exists | `No rihal source found. Run: npx @hanzlaa/rcode install .` |
|
|
126
|
+
| worktrees | git repo exists | `Not in a git repo.` |
|
|
113
127
|
|
|
114
128
|
For `milestone` specifically, check the **graceful-degrade** condition
|
|
115
129
|
(closes #234 audit-milestone halt):
|
|
@@ -153,6 +167,7 @@ Run the target's slash command, forwarding remaining args:
|
|
|
153
167
|
| lens | `/rihal-lens-audit $REST_ARGS` |
|
|
154
168
|
| fix | `/rihal-audit-fix $REST_ARGS` |
|
|
155
169
|
| work | `/rihal-verify-work $REST_ARGS` |
|
|
170
|
+
| worktrees | execute `@.rihal/workflows/audit-worktrees.md` inline |
|
|
156
171
|
|
|
157
172
|
## Step 6 — Closing summary
|
|
158
173
|
|
|
@@ -191,6 +191,6 @@ Run remediation with:
|
|
|
191
191
|
|
|
192
192
|
## ▶ Next Up
|
|
193
193
|
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
-
|
|
194
|
+
- /rihal-execute {phase}
|
|
195
|
+
- /rihal-plan {phase}
|
|
196
|
+
- /rihal-progress
|
|
@@ -26,6 +26,6 @@ Skill not installed — run: npx @hanzlaa/rcode install
|
|
|
26
26
|
|
|
27
27
|
## ▶ Next Up
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
29
|
+
- /rihal-plan {phase}
|
|
30
|
+
- /rihal-council {architecture-question}
|
|
31
|
+
- /rihal-create-prd
|
|
@@ -374,6 +374,6 @@ If arguments are invalid, missing files, or subagent fails:
|
|
|
374
374
|
|
|
375
375
|
## ▶ Next Up
|
|
376
376
|
|
|
377
|
-
-
|
|
378
|
-
-
|
|
379
|
-
-
|
|
377
|
+
- /rihal-sprint-planning
|
|
378
|
+
- /rihal-dev-story {story-id}
|
|
379
|
+
- /rihal-edit-prd
|
|
@@ -181,6 +181,6 @@ If .rihal/DOCS-AUDIT.md exists, check for missing/stale docs:
|
|
|
181
181
|
|
|
182
182
|
## ▶ Next Up
|
|
183
183
|
|
|
184
|
-
-
|
|
185
|
-
-
|
|
186
|
-
-
|
|
184
|
+
- /rihal-progress
|
|
185
|
+
- /rihal-plan {phase}
|
|
186
|
+
- /rihal-council {question}
|
|
@@ -26,6 +26,6 @@ Skill not installed — run: npx @hanzlaa/rcode install
|
|
|
26
26
|
|
|
27
27
|
## ▶ Next Up
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
29
|
+
- /rihal-validate-prd
|
|
30
|
+
- /rihal-create-milestone
|
|
31
|
+
- /rihal-create-epics-and-stories
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<purpose>
|
|
2
2
|
Execute all phases in the current milestone in dependency order, with verify gates between waves. Closes #738.
|
|
3
|
-
Reads the ROADMAP.md to determine phase ordering, executes each phase via /rihal-execute, runs /rihal-verify after each, and surfaces blockers before advancing.
|
|
3
|
+
Reads the ROADMAP.md to determine phase ordering, executes each phase via /rihal-execute, runs /rihal-verify-phase after each, and surfaces blockers before advancing.
|
|
4
4
|
</purpose>
|
|
5
5
|
|
|
6
6
|
<required_reading>
|
|
@@ -89,10 +89,10 @@ Spawn `rihal-verifier` for the phase. On `FAIL` or `PARTIAL`:
|
|
|
89
89
|
⚠ Verify gate: Phase {N} — {FAIL|PARTIAL}
|
|
90
90
|
|
|
91
91
|
Gap count: {N}
|
|
92
|
-
Recommendation: Run /rihal-
|
|
92
|
+
Recommendation: Run /rihal-plan {N} --gaps to close before advancing.
|
|
93
93
|
|
|
94
94
|
Options:
|
|
95
|
-
1. Close gaps now (spawn /rihal-
|
|
95
|
+
1. Close gaps now (spawn /rihal-plan --gaps) [Recommended]
|
|
96
96
|
2. Advance anyway (log gap, continue to next phase)
|
|
97
97
|
3. Abort milestone execution
|
|
98
98
|
```
|
|
@@ -582,7 +582,7 @@ If `USER_SETUP_CREATED=true`: display `⚠️ USER SETUP REQUIRED` with path + e
|
|
|
582
582
|
| Condition | Route | Action |
|
|
583
583
|
|-----------|-------|--------|
|
|
584
584
|
| summaries < plans | **A: More plans** | Find next PLAN without SUMMARY. Yolo: auto-continue. Interactive: show next plan, suggest `/rihal-execute {phase}` + `/rihal-verify-work`. STOP here. |
|
|
585
|
-
| summaries = plans, current < highest phase | **B: Phase done** | Show completion, suggest `/rihal-plan
|
|
585
|
+
| summaries = plans, current < highest phase | **B: Phase done** | Show completion, suggest `/rihal-plan {Z+1}` + `/rihal-verify-work {Z}` + `/rihal-discuss-phase {Z+1}` |
|
|
586
586
|
| summaries = plans, current = highest phase | **C: Milestone done** | Show banner, suggest `/rihal-complete-milestone` + `/rihal-verify-work` + `/rihal-add-phase` |
|
|
587
587
|
|
|
588
588
|
All routes: `/clear` first for fresh context.
|
|
@@ -280,8 +280,13 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
|
|
|
280
280
|
When executor agents ran in worktree isolation, their commits land on temporary branches in separate working trees. After the wave completes, merge these changes back and clean up:
|
|
281
281
|
|
|
282
282
|
```bash
|
|
283
|
-
#
|
|
284
|
-
|
|
283
|
+
# IMPORTANT: only touch worktrees whose branch starts with "worktree-agent-".
|
|
284
|
+
# Claude Code's EnterWorktree names all auto-created branches with this prefix.
|
|
285
|
+
# A broad "all non-primary worktrees" grep is dangerous — it would also pick up
|
|
286
|
+
# manually-created worktrees (feature branches, other milestone workspaces, etc.)
|
|
287
|
+
# and either corrupt or delete work that wasn't part of this execution.
|
|
288
|
+
WORKTREES=$(git worktree list --porcelain \
|
|
289
|
+
| awk '/^worktree /{path=$2} /^branch /{if($2 ~ /refs\/heads\/worktree-agent-/) print path}')
|
|
285
290
|
|
|
286
291
|
for WT in $WORKTREES; do
|
|
287
292
|
# Get the branch name for this worktree
|
|
@@ -358,6 +363,26 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
|
|
|
358
363
|
|
|
359
364
|
**If no worktrees found:** Skip silently — agents may have been spawned without worktree isolation.
|
|
360
365
|
|
|
366
|
+
**Post-cleanup verification (mandatory):** After the loop, confirm no `worktree-agent-*` worktrees or branches remain:
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
LEFTOVER_WT=$(git worktree list --porcelain \
|
|
370
|
+
| awk '/^branch /{if($2 ~ /refs\/heads\/worktree-agent-/) print $2}')
|
|
371
|
+
LEFTOVER_BR=$(git branch --list 'worktree-agent-*' 2>/dev/null)
|
|
372
|
+
|
|
373
|
+
if [ -n "$LEFTOVER_WT" ] || [ -n "$LEFTOVER_BR" ]; then
|
|
374
|
+
echo "⚠ WORKTREE LEAK: leftover executor artifacts detected after cleanup:"
|
|
375
|
+
[ -n "$LEFTOVER_WT" ] && echo " Worktrees: $LEFTOVER_WT"
|
|
376
|
+
[ -n "$LEFTOVER_BR" ] && echo " Branches: $LEFTOVER_BR"
|
|
377
|
+
echo " Run: /rihal-audit worktrees to inspect and prune"
|
|
378
|
+
else
|
|
379
|
+
echo "✓ Worktree cleanup verified — no executor artifacts remain"
|
|
380
|
+
fi
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
Do NOT silently skip this check. If leaks are found, surface them — the user's next
|
|
384
|
+
`/rihal-status` should not show surprise worktrees from a previous execution.
|
|
385
|
+
|
|
361
386
|
5.6. **Post-wave shared artifact update (worktree mode only):**
|
|
362
387
|
|
|
363
388
|
When executor agents ran with `isolation="worktree"`, they skipped STATE.md and ROADMAP.md updates to avoid last-merge-wins overwrites. The orchestrator is the single writer for these files. After worktrees are merged back, update shared artifacts once:
|
|
@@ -204,6 +204,6 @@ If arguments are invalid, missing files, or subagent fails:
|
|
|
204
204
|
|
|
205
205
|
After reviewing the diagnostic report, pick your recovery path:
|
|
206
206
|
|
|
207
|
-
-
|
|
208
|
-
-
|
|
209
|
-
-
|
|
207
|
+
- /rihal-resume-work
|
|
208
|
+
- /rihal-execute {phase-number}
|
|
209
|
+
- /rihal-progress
|
|
@@ -203,29 +203,44 @@ print(len(phantom))
|
|
|
203
203
|
If 0 phantoms: `✓ PASS — no phantom-complete phases detected`
|
|
204
204
|
If any: `⚠ WARN — {N} phantom-complete phase(s) detected. Run: /rihal-audit to inspect`
|
|
205
205
|
|
|
206
|
+
**Check 10 — no orphaned executor worktrees or branches**
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
ORPHAN_WTS=$(git worktree list --porcelain \
|
|
210
|
+
| awk '/^branch /{if($2 ~ /refs\/heads\/worktree-agent-/) print $2}' \
|
|
211
|
+
| wc -l 2>/dev/null || echo 0)
|
|
212
|
+
ORPHAN_BR=$(git branch --list 'worktree-agent-*' 2>/dev/null | wc -l || echo 0)
|
|
213
|
+
ORPHANS=$((ORPHAN_WTS + ORPHAN_BR))
|
|
214
|
+
echo "$ORPHANS"
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
If `ORPHANS` is 0: `✓ PASS — no orphaned executor worktrees or branches`
|
|
218
|
+
If `ORPHANS > 0`: `⚠ WARN — ${ORPHANS} orphaned worktree-agent-* artifact(s) from a previous /rihal-execute. Run: /rihal-audit worktrees --prune`
|
|
219
|
+
|
|
206
220
|
---
|
|
207
221
|
|
|
208
222
|
## Step 7 — Count results and print final summary
|
|
209
223
|
|
|
210
224
|
**Action:** Count all pass/fail/warn results and display overall status.
|
|
211
225
|
|
|
212
|
-
Total: `{N}/
|
|
226
|
+
Total: `{N}/10 checks passed`
|
|
213
227
|
|
|
214
|
-
If all
|
|
228
|
+
If all 10 pass:
|
|
215
229
|
```
|
|
216
230
|
✓ All systems nominal — rihal is healthy
|
|
217
231
|
```
|
|
218
232
|
|
|
219
|
-
If fewer than
|
|
233
|
+
If fewer than 10 pass:
|
|
220
234
|
```
|
|
221
|
-
⚠ {N}/
|
|
235
|
+
⚠ {N}/10 checks passed — {M} issue(s) found
|
|
222
236
|
Run: /rihal-update to repair installation issues
|
|
223
237
|
Run: /rihal-status for project-state issues
|
|
238
|
+
Run: /rihal-audit worktrees --prune to clean orphaned executor artifacts
|
|
224
239
|
```
|
|
225
240
|
|
|
226
241
|
## Success Criteria
|
|
227
242
|
|
|
228
|
-
- [ ] All
|
|
243
|
+
- [ ] All 10 checks executed (skip state checks if no state.json)
|
|
229
244
|
- [ ] Each check result printed clearly
|
|
230
245
|
- [ ] Final summary shows pass/fail count
|
|
231
246
|
- [ ] Repair instructions shown if any checks fail
|
|
@@ -238,6 +253,6 @@ Run: /rihal-status for project-state issues
|
|
|
238
253
|
|
|
239
254
|
## ▶ Next Up
|
|
240
255
|
|
|
241
|
-
-
|
|
242
|
-
-
|
|
243
|
-
-
|
|
256
|
+
- /rihal-forensics
|
|
257
|
+
- /rihal-do
|
|
258
|
+
- /rihal-correct-course {phase}
|
package/rihal/workflows/help.md
CHANGED
|
@@ -269,7 +269,6 @@ init → new-project → plan → execute → next → status → ship
|
|
|
269
269
|
| `/rihal-autonomous` | Run remaining phases autonomously — plan → execute → verify cycles. |
|
|
270
270
|
| `/rihal-research-phase <n>` | Standalone research (usually use `/rihal-plan` instead). |
|
|
271
271
|
| `/rihal-analyze-dependencies` | Suggest "Depends on" entries for ROADMAP.md. |
|
|
272
|
-
| `/rihal-list-phase-assumptions <n>` | Surface agent's intended approach before planning. |
|
|
273
272
|
| `/rihal-profile-user` | Classify developer on 4 dimensions, produce profile artifact. |
|
|
274
273
|
| `/rihal-dashboard` | Start the Diwan view-only dashboard (port 7717). |
|
|
275
274
|
| `/rihal-health` | 6-point health check of the Rihal installation. |
|
|
@@ -367,7 +367,7 @@ PHASE1_HAS_UI=$(echo "$PHASE1_SECTION" | grep -qi "UI hint.*yes" && echo "true"
|
|
|
367
367
|
|
|
368
368
|
**Also available:**
|
|
369
369
|
- /rihal-ui-phase 1 — generate UI design contract (recommended for frontend phases)
|
|
370
|
-
- /rihal-plan
|
|
370
|
+
- /rihal-plan 1 — skip discussion, plan directly
|
|
371
371
|
|
|
372
372
|
───────────────────────────────────────────────────────────────
|
|
373
373
|
```
|
|
@@ -388,7 +388,7 @@ PHASE1_HAS_UI=$(echo "$PHASE1_SECTION" | grep -qi "UI hint.*yes" && echo "true"
|
|
|
388
388
|
---
|
|
389
389
|
|
|
390
390
|
**Also available:**
|
|
391
|
-
- /rihal-plan
|
|
391
|
+
- /rihal-plan 1 — skip discussion, plan directly
|
|
392
392
|
|
|
393
393
|
───────────────────────────────────────────────────────────────
|
|
394
394
|
```
|
|
@@ -232,7 +232,7 @@ If `TEXT_MODE` is true, present as a plain-text numbered list:
|
|
|
232
232
|
```
|
|
233
233
|
Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?
|
|
234
234
|
|
|
235
|
-
1. Generate UI-SPEC first — Run /rihal-ui-phase {N} then re-run /rihal-
|
|
235
|
+
1. Generate UI-SPEC first — Run /rihal-ui-phase {N} then re-run /rihal-plan {N}
|
|
236
236
|
2. Continue without UI-SPEC
|
|
237
237
|
3. Not a frontend phase
|
|
238
238
|
|
|
@@ -243,7 +243,7 @@ Otherwise use AskUserQuestion:
|
|
|
243
243
|
- header: "UI Design Contract"
|
|
244
244
|
- question: "Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?"
|
|
245
245
|
- options:
|
|
246
|
-
- "Generate UI-SPEC first" → Display: "Run `/rihal-ui-phase {N} ${Rihal_WS}` then re-run `/rihal-
|
|
246
|
+
- "Generate UI-SPEC first" → Display: "Run `/rihal-ui-phase {N} ${Rihal_WS}` then re-run `/rihal-plan {N} ${Rihal_WS}`". Exit workflow.
|
|
247
247
|
- "Continue without UI-SPEC" → Continue to step 6.
|
|
248
248
|
- "Not a frontend phase" → Continue to step 6.
|
|
249
249
|
|
package/rihal/workflows/plan.md
CHANGED
|
@@ -174,7 +174,7 @@ No REVIEWS.md found for Phase {N}. Run reviews first:
|
|
|
174
174
|
|
|
175
175
|
/rihal-review --phase {N}
|
|
176
176
|
|
|
177
|
-
Then re-run /rihal-
|
|
177
|
+
Then re-run /rihal-plan {N} --reviews
|
|
178
178
|
```
|
|
179
179
|
Exit workflow.
|
|
180
180
|
|
|
@@ -322,7 +322,7 @@ If "Run discuss-phase first":
|
|
|
322
322
|
does not work correctly in nested subcontexts (#1009). Instead, display the command
|
|
323
323
|
and exit so the user runs it as a top-level command:
|
|
324
324
|
```
|
|
325
|
-
Run this command first, then re-run /rihal-
|
|
325
|
+
Run this command first, then re-run /rihal-plan {X} ${Rihal_WS}:
|
|
326
326
|
|
|
327
327
|
/rihal-discuss-phase {X} ${Rihal_WS}
|
|
328
328
|
```
|
|
@@ -443,7 +443,7 @@ VALIDATION_EXISTS=$(ls "${PHASE_DIR}"/*-VALIDATION.md 2>/dev/null | head -1)
|
|
|
443
443
|
```
|
|
444
444
|
|
|
445
445
|
If missing and Nyquist is still enabled/applicable — ask user:
|
|
446
|
-
1. Re-run: `/rihal-
|
|
446
|
+
1. Re-run: `/rihal-plan {PHASE} --research ${Rihal_WS}`
|
|
447
447
|
2. Disable Nyquist with the exact command:
|
|
448
448
|
`node ".rihal/bin/rihal-tools.cjs" config-set workflow.nyquist_validation false`
|
|
449
449
|
3. Continue anyway (plans fail Dimension 8)
|
|
@@ -935,9 +935,9 @@ Verification: {Passed | Passed with override | Skipped}
|
|
|
935
935
|
|
|
936
936
|
**Also available:**
|
|
937
937
|
- cat .planning/phases/{phase-dir}/*-SPRINT.md — review plans
|
|
938
|
-
- /rihal-
|
|
938
|
+
- /rihal-plan {X} --research — re-research first
|
|
939
939
|
- /rihal-review --phase {X} --all — peer review plans with external AIs
|
|
940
|
-
- /rihal-
|
|
940
|
+
- /rihal-plan {X} --reviews — replan incorporating review feedback
|
|
941
941
|
|
|
942
942
|
───────────────────────────────────────────────────────────────
|
|
943
943
|
</offer_next>
|
|
@@ -958,11 +958,11 @@ stdio deadlocks with MCP servers — see Claude Code issue anthropics/claude-cod
|
|
|
958
958
|
Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\tasks\*" -ErrorAction SilentlyContinue
|
|
959
959
|
```
|
|
960
960
|
4. **Reduce MCP server count:** Temporarily disable non-essential MCP servers in settings.json
|
|
961
|
-
5. **Retry:** Restart Claude Code and run `/rihal-
|
|
961
|
+
5. **Retry:** Restart Claude Code and run `/rihal-plan` again
|
|
962
962
|
|
|
963
963
|
If freezes persist, try `--skip-research` to reduce the agent chain from 3 to 2 agents:
|
|
964
964
|
```
|
|
965
|
-
/rihal-
|
|
965
|
+
/rihal-plan N --skip-research
|
|
966
966
|
```
|
|
967
967
|
</windows_troubleshooting>
|
|
968
968
|
|
|
@@ -26,6 +26,6 @@ Skill not installed — run: npx @hanzlaa/rcode install
|
|
|
26
26
|
|
|
27
27
|
## ▶ Next Up
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
29
|
+
- /rihal-new-milestone
|
|
30
|
+
- /rihal-progress
|
|
31
|
+
- /rihal-complete-milestone
|
|
@@ -10,15 +10,17 @@ Assume an adversarial/hostile perspective and audit code for weaknesses: SQL inj
|
|
|
10
10
|
If `$ARGUMENTS` is empty or contains only `--help` or `-h`:
|
|
11
11
|
|
|
12
12
|
```
|
|
13
|
-
/rihal-review
|
|
13
|
+
/rihal-code-review --attack
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
**Examples:**
|
|
17
17
|
```
|
|
18
|
-
/rihal-review
|
|
19
|
-
/rihal-review
|
|
18
|
+
/rihal-code-review --attack
|
|
19
|
+
/rihal-code-review --attack --scope auth/
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
Note: This workflow is invoked internally by `/rihal-code-review --attack`. There is no standalone `/rihal-review-adversarial` command.
|
|
23
|
+
|
|
22
24
|
STOP — do not proceed.
|
|
23
25
|
|
|
24
26
|
<available_agent_types>
|
|
@@ -187,6 +189,6 @@ Critical findings filed as blocking AC. High findings as optional tasks.
|
|
|
187
189
|
|
|
188
190
|
## ▶ Next Up
|
|
189
191
|
|
|
190
|
-
- **Vulnerabilities found:** Address security findings, re-run `/rihal-review
|
|
191
|
-
-
|
|
192
|
-
-
|
|
192
|
+
- **Vulnerabilities found:** Address security findings, re-run `/rihal-code-review --attack`
|
|
193
|
+
- /rihal-verify-phase {phase}
|
|
194
|
+
- /rihal-ship {phase}
|
|
@@ -283,5 +283,5 @@ Clean up temp files.
|
|
|
283
283
|
## ▶ Next Up
|
|
284
284
|
|
|
285
285
|
- **Issues found:** Fix identified problems, then re-run `/rihal-review`
|
|
286
|
-
-
|
|
287
|
-
-
|
|
286
|
+
- /rihal-ship {phase}
|
|
287
|
+
- /rihal-secure-phase {phase}
|
|
@@ -26,6 +26,6 @@ Skill not installed — run: npx @hanzlaa/rcode install
|
|
|
26
26
|
|
|
27
27
|
## ▶ Next Up
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
29
|
+
- /rihal-create-prd
|
|
30
|
+
- /rihal-create-milestone
|
|
31
|
+
- /rihal-do
|
|
@@ -106,7 +106,7 @@ Call AskUserQuestion with threat table and options:
|
|
|
106
106
|
|
|
107
107
|
```
|
|
108
108
|
Task(
|
|
109
|
-
prompt="Read
|
|
109
|
+
prompt="Read $HOME/.claude/agents/rihal-security-auditor.md for instructions.\n\n" +
|
|
110
110
|
"<files_to_read>{PLAN, SUMMARY, impl files, SECURITY.md}</files_to_read>" +
|
|
111
111
|
"<threat_register>{threat register}</threat_register>" +
|
|
112
112
|
"<config>asvs_level: {SECURITY_ASVS}, block_on: {SECURITY_BLOCK_ON}</config>" +
|
|
@@ -165,7 +165,7 @@ node ".rihal/bin/rihal-tools.cjs" commit "docs(phase-${PHASE}): add/update secur
|
|
|
165
165
|
```
|
|
166
166
|
Rihal > PHASE {N} THREAT-SECURE
|
|
167
167
|
threats_open: 0 — all threats have dispositions.
|
|
168
|
-
▶ /rihal-validate {N} validate test coverage
|
|
168
|
+
▶ /rihal-validate-phase {N} validate test coverage
|
|
169
169
|
▶ /rihal-verify-work {N} run UAT
|
|
170
170
|
```
|
|
171
171
|
|
|
@@ -205,5 +205,5 @@ If arguments are invalid, missing files, or subagent fails:
|
|
|
205
205
|
## ▶ Next Up
|
|
206
206
|
|
|
207
207
|
- **Issues found:** Address security findings, then re-run `/rihal-secure-phase {phase}`
|
|
208
|
-
-
|
|
209
|
-
-
|
|
208
|
+
- /rihal-verify-phase {phase}
|
|
209
|
+
- /rihal-execute {next-phase}
|
|
@@ -212,7 +212,7 @@ Write `.planning/SESSION-REPORT-{YYYY-MM-DD-HHmmss}.md` with this structure:
|
|
|
212
212
|
## Next Steps
|
|
213
213
|
|
|
214
214
|
- Address {count} open blocker(s) before proceeding
|
|
215
|
-
- Plan next phase with `/rihal-plan
|
|
215
|
+
- Plan next phase with `/rihal-plan {next_phase}`
|
|
216
216
|
```
|
|
217
217
|
|
|
218
218
|
## Step 8 — Print confirmation
|