@hanzlaa/rcode 3.4.3 → 3.4.5
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/AGENTS.md +1 -1
- package/CONTRIBUTING.md +63 -1
- package/README.md +9 -4
- package/cli/generate-command-skills.cjs +5 -5
- package/cli/index.js +0 -0
- package/cli/install.js +128 -3
- package/cli/lib/manifest.cjs +1 -1
- package/cli/uninstall.js +8 -0
- package/dist/rcode.js +19 -1
- package/package.json +16 -17
- package/rihal/agents/rihal-ahmed.md +2 -1
- package/rihal/agents/rihal-code-fixer.md +46 -0
- package/rihal/agents/rihal-code-reviewer.md +46 -1
- package/rihal/agents/rihal-deviation-analyzer.md +1 -0
- package/rihal/agents/rihal-docs-auditor.md +106 -1
- package/rihal/agents/rihal-edge-case-hunter.md +47 -1
- package/rihal/agents/rihal-executor.md +1 -1
- package/rihal/agents/rihal-khalid.md +40 -1
- package/rihal/agents/rihal-layla.md +2 -1
- package/rihal/agents/rihal-nasser.md +2 -1
- package/rihal/agents/rihal-noor.md +3 -2
- package/rihal/agents/rihal-nyquist-auditor.md +1 -1
- package/rihal/agents/rihal-phase-researcher.md +46 -1
- package/rihal/agents/rihal-planner.md +1 -1
- package/rihal/agents/rihal-profiler.md +45 -2
- package/rihal/agents/rihal-project-researcher.md +47 -0
- package/rihal/agents/rihal-remediation-planner.md +45 -0
- package/rihal/agents/rihal-roadmapper.md +46 -0
- package/rihal/agents/rihal-security-adversary.md +46 -1
- package/rihal/agents/rihal-security-auditor.md +45 -1
- package/rihal/agents/rihal-ui-auditor.md +44 -1
- package/rihal/agents/rihal-ux-designer.md +41 -1
- package/rihal/agents/rihal-zahra.md +2 -1
- package/rihal/agents/rihal-zayd.md +2 -1
- package/rihal/bin/lib/config.cjs +13 -1
- package/rihal/bin/lib/council-panel.cjs +185 -23
- package/rihal/bin/lib/roadmap.cjs +27 -2
- package/rihal/bin/rihal-tools.cjs +1837 -99
- package/rihal/commands/audit.md +2 -2
- package/rihal/commands/capture.md +12 -0
- package/rihal/commands/diagnose-issues.md +18 -0
- package/rihal/commands/discuss-phase-power.md +18 -0
- package/rihal/commands/feature-drift.md +18 -0
- package/rihal/commands/karpathy-audit.md +18 -0
- package/rihal/commands/lens-audit.md +70 -0
- package/rihal/commands/new-project-research.md +18 -0
- package/rihal/commands/new-project-roadmap.md +18 -0
- package/rihal/commands/phase.md +11 -0
- package/rihal/references/continuation-format.md +3 -3
- package/rihal/references/output-format.md +79 -0
- package/rihal/references/revision-loop.md +1 -1
- package/rihal/references/verb-dictionary.md +85 -28
- package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +1 -1
- package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +12 -2
- package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/steps/step-04-final-validation.md +12 -0
- package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +12 -2
- package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +12 -2
- package/rihal/skills/actions/4-implementation/rihal-browser-verify/SKILL.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-ci/SKILL.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-code-review/SKILL.md +16 -4
- package/rihal/skills/actions/4-implementation/rihal-debug/SKILL.md +14 -1
- package/rihal/skills/actions/4-implementation/rihal-git-flow/SKILL.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-harden/SKILL.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-incremental/SKILL.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-migrate/SKILL.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-perf/SKILL.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-prove-it/SKILL.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-scaffold-project/steps/step-01-target.md +6 -0
- package/rihal/skills/actions/4-implementation/rihal-source-truth/SKILL.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +14 -3
- package/rihal/skills/actions/4-implementation/rihal-trim/SKILL.md +1 -1
- package/rihal/skills/agents/ahmed-hassani-director/SKILL.md +15 -1
- package/rihal/skills/agents/dalil-scout/SKILL.md +14 -2
- package/rihal/skills/agents/fatima-qa/SKILL.md +16 -1
- package/rihal/skills/agents/haitham-frontend/SKILL.md +13 -1
- package/rihal/skills/agents/hanzla-engineer/SKILL.md +13 -1
- package/rihal/skills/agents/hussain-pm/SKILL.md +16 -1
- package/rihal/skills/agents/hussain-sm/SKILL.md +14 -1
- package/rihal/skills/agents/layla-designer/SKILL.md +13 -1
- package/rihal/skills/agents/majlis-council/SKILL.md +16 -1
- package/rihal/skills/agents/mariam-marketing/SKILL.md +14 -1
- package/rihal/skills/agents/nasser-eng-manager/SKILL.md +16 -1
- package/rihal/skills/agents/noor-writer/SKILL.md +15 -1
- package/rihal/skills/agents/raees-orchestrator/SKILL.md +15 -1
- package/rihal/skills/agents/rihal-cross-platform-auditor/SKILL.md +162 -0
- package/rihal/skills/agents/rihal-dep-auditor/SKILL.md +151 -0
- package/rihal/skills/agents/rihal-deviation-analyzer/SKILL.md +78 -0
- package/rihal/skills/agents/rihal-i18n-auditor/SKILL.md +152 -0
- package/rihal/skills/agents/rihal-observability-auditor/SKILL.md +156 -0
- package/rihal/skills/agents/sadiq-analyst/SKILL.md +12 -2
- package/rihal/skills/agents/waleed-architect/SKILL.md +12 -2
- package/rihal/skills/agents/yousef-backend/SKILL.md +12 -2
- package/rihal/skills/agents/zahra-branding/SKILL.md +15 -1
- package/rihal/skills/agents/zayd-ml/SKILL.md +13 -1
- package/rihal/skills/core/rihal-advanced-elicitation/SKILL.md +2 -2
- package/rihal/skills/core/rihal-auth-audit/SKILL.md +1 -1
- package/rihal/skills/core/rihal-brainstorming/SKILL.md +13 -2
- package/rihal/skills/core/rihal-client-gate/SKILL.md +1 -1
- package/rihal/skills/core/rihal-clone-website/SKILL.md +11 -1
- package/rihal/skills/core/rihal-deploy-unify/SKILL.md +1 -1
- package/rihal/skills/core/rihal-distillator/SKILL.md +2 -2
- package/rihal/skills/core/rihal-editorial-review-prose/SKILL.md +1 -1
- package/rihal/skills/core/rihal-editorial-review-structure/SKILL.md +2 -2
- package/rihal/skills/core/rihal-help/SKILL.md +18 -1
- package/rihal/skills/core/rihal-incident-record/SKILL.md +1 -1
- package/rihal/skills/core/rihal-index-docs/SKILL.md +1 -1
- package/rihal/skills/core/rihal-memory-audit/SKILL.md +18 -1
- package/rihal/skills/core/rihal-memory-init/SKILL.md +13 -1
- package/rihal/skills/core/rihal-memory-update/SKILL.md +13 -1
- package/rihal/skills/core/rihal-mvp-graduate/SKILL.md +1 -1
- package/rihal/skills/core/rihal-ocr-consistency/SKILL.md +1 -1
- package/rihal/skills/core/rihal-rebrand/SKILL.md +1 -1
- package/rihal/skills/core/rihal-review-adversarial-general/SKILL.md +1 -1
- package/rihal/skills/core/rihal-review-edge-case-hunter/SKILL.md +17 -1
- package/rihal/skills/core/rihal-shard-doc/SKILL.md +1 -1
- package/rihal/skills/core/rihal-theme-system/SKILL.md +1 -1
- package/rihal/team.yaml +0 -7
- package/rihal/templates/RESEARCH.md +84 -0
- package/rihal/templates/VALIDATION.md +45 -0
- package/rihal/templates/memory/INDEX.md +1 -0
- package/rihal/templates/memory/project/design-system.md +128 -0
- package/rihal/templates/summary.md +33 -3
- package/rihal/workflows/add-tests.md +1 -1
- package/rihal/workflows/add-todo.md +6 -0
- package/rihal/workflows/analyze-dependencies.md +6 -0
- package/rihal/workflows/audit-fix.md +12 -0
- package/rihal/workflows/audit-milestone.md +2 -2
- package/rihal/workflows/audit.md +23 -14
- package/rihal/workflows/autonomous-smart-discuss.md +247 -0
- package/rihal/workflows/autonomous.md +54 -267
- package/rihal/workflows/capture.md +60 -0
- package/rihal/workflows/chain.md +1 -1
- package/rihal/workflows/code-review-fix.md +6 -3
- package/rihal/workflows/code-review.md +34 -10
- package/rihal/workflows/complete-milestone.md +17 -8
- package/rihal/workflows/correct-course.md +6 -0
- package/rihal/workflows/council.md +37 -23
- package/rihal/workflows/create-architecture.md +31 -0
- package/rihal/workflows/create-epics-and-stories.md +7 -1
- package/rihal/workflows/create-prd.md +25 -0
- package/rihal/workflows/dashboard.md +1 -1
- package/rihal/workflows/debug.md +8 -0
- package/rihal/workflows/decisions.md +1 -1
- package/rihal/workflows/diff.md +6 -0
- package/rihal/workflows/discuss-phase-discuss-areas.md +271 -0
- package/rihal/workflows/discuss-phase.md +27 -266
- package/rihal/workflows/do.md +51 -12
- package/rihal/workflows/docs-update.md +3 -0
- package/rihal/workflows/document-project.md +7 -1
- package/rihal/workflows/edit-prd.md +31 -0
- package/rihal/workflows/enable-hooks.md +1 -1
- package/rihal/workflows/execute-regression-gates.md +131 -0
- package/rihal/workflows/execute-sprint.md +31 -2
- package/rihal/workflows/execute-verify-phase-goal.md +136 -0
- package/rihal/workflows/execute-waves.md +404 -0
- package/rihal/workflows/execute.md +101 -642
- package/rihal/workflows/feature-drift.md +243 -0
- package/rihal/workflows/forensics.md +10 -2
- package/rihal/workflows/health.md +65 -16
- package/rihal/workflows/help.md +36 -9
- package/rihal/workflows/import.md +17 -3
- package/rihal/workflows/init.md +20 -10
- package/rihal/workflows/install.md +2 -10
- package/rihal/workflows/lens-audit.md +689 -0
- package/rihal/workflows/map-codebase.md +7 -1
- package/rihal/workflows/memory-audit.md +67 -5
- package/rihal/workflows/memory-distill.md +10 -0
- package/rihal/workflows/memory-init.md +4 -0
- package/rihal/workflows/memory-update.md +4 -0
- package/rihal/workflows/new-milestone.md +7 -1
- package/rihal/workflows/new-project-create-roadmap.md +176 -0
- package/rihal/workflows/new-project-define-requirements.md +160 -0
- package/rihal/workflows/new-project-research-decision.md +247 -0
- package/rihal/workflows/new-project.md +3 -557
- package/rihal/workflows/note.md +1 -1
- package/rihal/workflows/phase.md +54 -0
- package/rihal/workflows/plan-milestone-gaps.md +1 -1
- package/rihal/workflows/plan-prd-express.md +108 -0
- package/rihal/workflows/plan-research-validation.md +313 -0
- package/rihal/workflows/plan-spawn-planner.md +204 -0
- package/rihal/workflows/plan.md +91 -532
- package/rihal/workflows/plant-seed.md +1 -1
- package/rihal/workflows/pr-branch.md +1 -1
- package/rihal/workflows/profile-user.md +1 -1
- package/rihal/workflows/quick.md +3 -3
- package/rihal/workflows/remove-phase.md +6 -1
- package/rihal/workflows/remove-workspace.md +6 -0
- package/rihal/workflows/rerun.md +1 -1
- package/rihal/workflows/research-phase.md +4 -2
- package/rihal/workflows/resume-work.md +8 -3
- package/rihal/workflows/retrospective.md +31 -0
- package/rihal/workflows/review-adversarial.md +12 -0
- package/rihal/workflows/review.md +6 -0
- package/rihal/workflows/scaffold-project.md +31 -0
- package/rihal/workflows/scan.md +10 -0
- package/rihal/workflows/secure-phase.md +15 -2
- package/rihal/workflows/session-report.md +32 -7
- package/rihal/workflows/ship.md +7 -2
- package/rihal/workflows/show.md +6 -0
- package/rihal/workflows/sprint-status.md +4 -4
- package/rihal/workflows/status.md +2 -2
- package/rihal/workflows/ui-phase.md +1 -1
- package/rihal/workflows/undo.md +2 -3
- package/rihal/workflows/update.md +2 -2
- package/rihal/workflows/validate-phase.md +1 -1
- package/rihal/workflows/validate-prd.md +31 -0
- package/rihal/workflows/verify-phase.md +38 -5
- package/rihal/workflows/verify-work.md +25 -11
- package/rihal/workflows/workstream.md +20 -8
- package/server/lib/html/client.js +13 -63
- package/server/lib/html/shell.js +0 -1
- package/server/lib/scanner.js +33 -2
|
@@ -7,8 +7,8 @@ Execute all plans in a phase using wave-based parallel execution. Orchestrator s
|
|
|
7
7
|
findings BEFORE any subagents are spawned. If any check fails, stop and
|
|
8
8
|
route back to the user.
|
|
9
9
|
|
|
10
|
-
1. **Init state**: `node .rihal/bin/rihal-tools.cjs init execute
|
|
11
|
-
2. **Phase index**: list all plans via `
|
|
10
|
+
1. **Init state**: `node .rihal/bin/rihal-tools.cjs init execute {N}`
|
|
11
|
+
2. **Phase index**: list all plans via `phase-plan-index {N}` — extract
|
|
12
12
|
plan count, wave count, autonomy flag per plan, files_modified overlaps
|
|
13
13
|
3. **Anti-patterns**: check for `.continue-here.md` (paused state), STATE.md
|
|
14
14
|
error flag, existing VERIFICATION.md with FAIL items without overrides
|
|
@@ -126,7 +126,8 @@ Orchestrator coordinates, not executes. Each subagent loads the full execute-spr
|
|
|
126
126
|
|
|
127
127
|
<runtime_compatibility>
|
|
128
128
|
**Subagent spawning is runtime-specific:**
|
|
129
|
-
- **Claude Code:** Uses `Task(subagent_type="rihal-executor",
|
|
129
|
+
- **Claude Code:** Uses `Task(subagent_type="rihal-executor",
|
|
130
|
+
model="sonnet", ...)` — blocks until complete, returns result
|
|
130
131
|
- **Copilot:** Subagent spawning does not reliably return completion signals. **Default to
|
|
131
132
|
sequential inline execution**: read and follow execute-sprint.md directly for each plan
|
|
132
133
|
instead of spawning parallel agents. Only attempt parallel spawning if the user
|
|
@@ -149,6 +150,7 @@ Read STATE.md before any operation to load project context.
|
|
|
149
150
|
@.rihal/references/context-budget.md
|
|
150
151
|
@.rihal/references/gates.md
|
|
151
152
|
@.rihal/references/karpathy-guidelines.md
|
|
153
|
+
@.rihal/references/execution-protocol.md
|
|
152
154
|
</required_reading>
|
|
153
155
|
|
|
154
156
|
<available_agent_types>
|
|
@@ -206,6 +208,10 @@ Read context window size for adaptive prompt enrichment:
|
|
|
206
208
|
|
|
207
209
|
```bash
|
|
208
210
|
CONTEXT_WINDOW=$(node ".rihal/bin/rihal-tools.cjs" config-get context_window 2>/dev/null || echo "200000")
|
|
211
|
+
|
|
212
|
+
# Detect if any SPRINT.md in this phase references a checkpoint — used to lazy-load checkpoints.md
|
|
213
|
+
SPRINT_HAS_CHECKPOINT=$(grep -rl "checkpoint" "${phase_dir}"/*-SPRINT.md 2>/dev/null | head -1)
|
|
214
|
+
PRIOR_WAVE_FAILED=false # set to true by wave failure handler if a prior wave errored
|
|
209
215
|
```
|
|
210
216
|
|
|
211
217
|
When `CONTEXT_WINDOW >= 500000` (1M-class models), subagent prompts include richer context:
|
|
@@ -385,389 +391,9 @@ Report:
|
|
|
385
391
|
```
|
|
386
392
|
</step>
|
|
387
393
|
|
|
388
|
-
<step name="execute_waves">
|
|
389
|
-
Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`, sequential if `false`.
|
|
390
|
-
|
|
391
|
-
**For each wave:**
|
|
392
|
-
|
|
393
|
-
1. **Intra-wave files_modified overlap check (BEFORE spawning):**
|
|
394
|
-
|
|
395
|
-
Before spawning any agents for this wave, inspect the `files_modified` list of all plans
|
|
396
|
-
in the wave. Check every pair of plans in the wave — if any two plans share even one file
|
|
397
|
-
in their `files_modified` lists, those plans have an implicit dependency and MUST NOT run
|
|
398
|
-
in parallel.
|
|
399
|
-
|
|
400
|
-
**Detection algorithm (pseudocode):**
|
|
401
|
-
```
|
|
402
|
-
seen_files = {}
|
|
403
|
-
overlapping_plans = []
|
|
404
|
-
for each plan in wave_plans:
|
|
405
|
-
for each file in plan.files_modified:
|
|
406
|
-
if file in seen_files:
|
|
407
|
-
overlapping_plans.add(plan, seen_files[file]) # both plans overlap on this file
|
|
408
|
-
else:
|
|
409
|
-
seen_files[file] = plan
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
**If overlap is detected:**
|
|
413
|
-
- Warn the user:
|
|
414
|
-
```
|
|
415
|
-
⚠ Intra-wave files_modified overlap detected in Wave {N}:
|
|
416
|
-
Plan {A} and Plan {B} both modify {file}
|
|
417
|
-
Running these plans sequentially to avoid parallel worktree conflicts.
|
|
418
|
-
```
|
|
419
|
-
- Override `PARALLELIZATION` to `false` for this wave only — run all plans in the wave
|
|
420
|
-
sequentially regardless of the global parallelization setting.
|
|
421
|
-
- This is a safety net for plans that were incorrectly assigned to the same wave.
|
|
422
|
-
The planner should have caught this; flag it as a planning defect so the user can
|
|
423
|
-
replan the phase if desired.
|
|
424
|
-
|
|
425
|
-
**If no overlap:** proceed normally (parallel if `PARALLELIZATION=true`).
|
|
426
|
-
|
|
427
|
-
2. **Describe what's being built (BEFORE spawning):**
|
|
428
|
-
|
|
429
|
-
Read each plan's `<objective>`. Extract what's being built and why.
|
|
430
|
-
|
|
431
|
-
```
|
|
432
|
-
---
|
|
433
|
-
## Wave {N}
|
|
434
|
-
|
|
435
|
-
**{Plan ID}: {Plan Name}**
|
|
436
|
-
{2-3 sentences: what this builds, technical approach, why it matters}
|
|
437
|
-
|
|
438
|
-
Spawning {count} agent(s)...
|
|
439
|
-
---
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
- Bad: "Executing terrain generation plan"
|
|
443
|
-
- Good: "Procedural terrain generator using Perlin noise — creates height maps, biome zones, and collision meshes. Required before vehicle physics can interact with ground."
|
|
444
|
-
|
|
445
|
-
3. **Spawn executor agents:**
|
|
446
|
-
|
|
447
|
-
Pass paths only — executors read files themselves with their fresh context window.
|
|
448
|
-
For 200k models, this keeps orchestrator context lean (~10-15%).
|
|
449
|
-
For 1M+ models (Opus 4.6, Sonnet 4.6), richer context can be passed directly.
|
|
450
|
-
|
|
451
|
-
**Worktree mode** (`USE_WORKTREES` is not `false`):
|
|
452
|
-
|
|
453
|
-
Before spawning, capture the current HEAD:
|
|
454
|
-
```bash
|
|
455
|
-
EXPECTED_BASE=$(git rev-parse HEAD)
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
**Sequential dispatch for parallel execution (waves with 2+ agents):**
|
|
459
|
-
When spawning multiple agents in a wave, dispatch each `Task()` call **one at a time
|
|
460
|
-
with `run_in_background: true`** — do NOT send all Task calls in a single message.
|
|
461
|
-
`git worktree add` acquires an exclusive lock on `.git/config.lock`, so simultaneous
|
|
462
|
-
calls race for this lock and fail. Sequential dispatch ensures each worktree finishes
|
|
463
|
-
creation before the next begins (the round-trip latency of each tool call provides
|
|
464
|
-
natural spacing), while all agents still **run in parallel** once created.
|
|
465
|
-
|
|
466
|
-
```
|
|
467
|
-
# CORRECT: dispatch one Task() per message, each with run_in_background: true
|
|
468
|
-
# → worktrees created sequentially, agents execute in parallel
|
|
469
|
-
#
|
|
470
|
-
# WRONG: multiple Task() calls in a single message
|
|
471
|
-
# → simultaneous git worktree add → .git/config.lock contention → failures
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
```
|
|
475
|
-
Task(
|
|
476
|
-
subagent_type="rihal-executor",
|
|
477
|
-
description="Execute plan {plan_number} of phase {phase_number}",
|
|
478
|
-
model="{executor_model}",
|
|
479
|
-
isolation="worktree",
|
|
480
|
-
prompt="
|
|
481
|
-
<objective>
|
|
482
|
-
Execute plan {plan_number} of phase {phase_number}-{phase_name}.
|
|
483
|
-
Commit each task atomically. Create SUMMARY.md.
|
|
484
|
-
Do NOT update STATE.md or ROADMAP.md — the orchestrator owns those writes after all worktree agents in the wave complete.
|
|
485
|
-
</objective>
|
|
486
|
-
|
|
487
|
-
<worktree_branch_check>
|
|
488
|
-
FIRST ACTION before any other work: verify this worktree's branch is based on the correct commit.
|
|
489
|
-
|
|
490
|
-
Run:
|
|
491
|
-
```bash
|
|
492
|
-
ACTUAL_BASE=$(git merge-base HEAD {EXPECTED_BASE})
|
|
493
|
-
CURRENT_HEAD=$(git rev-parse HEAD)
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
If `ACTUAL_BASE` != `{EXPECTED_BASE}` (i.e. the worktree branch was created from an older
|
|
497
|
-
base such as `main` instead of the feature branch HEAD), rebase onto the correct base:
|
|
498
|
-
```bash
|
|
499
|
-
git rebase --onto {EXPECTED_BASE} $(git rev-parse --abbrev-ref HEAD~1 2>/dev/null || git rev-parse HEAD^) HEAD 2>/dev/null || true
|
|
500
|
-
# If rebase fails or is a no-op, reset the branch to start from the correct base:
|
|
501
|
-
git reset --soft {EXPECTED_BASE}
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
If `ACTUAL_BASE` == `{EXPECTED_BASE}`: the branch base is correct, proceed immediately.
|
|
505
|
-
|
|
506
|
-
This check fixes a known issue on Windows where `EnterWorktree` creates branches from
|
|
507
|
-
`main` instead of the current feature branch HEAD.
|
|
508
|
-
</worktree_branch_check>
|
|
509
|
-
|
|
510
|
-
<parallel_execution>
|
|
511
|
-
You are running as a PARALLEL executor agent. To avoid pre-commit hook
|
|
512
|
-
contention with other agents, acquire a file-based lock before each
|
|
513
|
-
commit and release it immediately after:
|
|
514
|
-
|
|
515
|
-
while ! mkdir .rihal/.commit-lock 2>/dev/null; do sleep 0.5; done
|
|
516
|
-
git commit -m "..." # hooks run normally
|
|
517
|
-
rmdir .rihal/.commit-lock
|
|
518
|
-
|
|
519
|
-
Hooks run as designed for every commit. AGENTS.md forbids --no-verify;
|
|
520
|
-
hook failures must be fixed at the source, not bypassed. The orchestrator
|
|
521
|
-
still validates state once after all agents complete.
|
|
522
|
-
</parallel_execution>
|
|
523
|
-
|
|
524
|
-
<execution_context>
|
|
525
|
-
@.rihal/workflows/execute-sprint.md
|
|
526
|
-
@.rihal/templates/summary.md
|
|
527
|
-
@.rihal/references/checkpoints.md
|
|
528
|
-
@.rihal/references/tdd.md
|
|
529
|
-
</execution_context>
|
|
530
|
-
|
|
531
|
-
<files_to_read>
|
|
532
|
-
Read these files at execution start using the Read tool:
|
|
533
|
-
- {phase_dir}/{plan_file} (Plan)
|
|
534
|
-
- .planning/PROJECT.md (Project context — core value, requirements, evolution rules)
|
|
535
|
-
- .planning/STATE.md (State)
|
|
536
|
-
- .planning/config.json (Config, if exists)
|
|
537
|
-
${CONTEXT_WINDOW >= 500000 ? `
|
|
538
|
-
- ${phase_dir}/*-CONTEXT.md (User decisions from discuss-phase — honors locked choices)
|
|
539
|
-
- ${phase_dir}/*-RESEARCH.md (Technical research — pitfalls and patterns to follow)
|
|
540
|
-
- ${prior_wave_summaries} (SUMMARY.md files from earlier waves in this phase — what was already built)
|
|
541
|
-
` : ''}
|
|
542
|
-
- ./CLAUDE.md (Project instructions, if exists — follow project-specific guidelines and coding conventions)
|
|
543
|
-
- .claude/skills/ or .agents/skills/ (Project skills, if either exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
|
|
544
|
-
</files_to_read>
|
|
545
|
-
|
|
546
|
-
${AGENT_SKILLS}
|
|
547
|
-
|
|
548
|
-
<mcp_tools>
|
|
549
|
-
If CLAUDE.md or project instructions reference MCP tools (e.g. jCodeMunch, context7,
|
|
550
|
-
or other MCP servers), prefer those tools over Grep/Glob for code navigation when available.
|
|
551
|
-
MCP tools often save significant tokens by providing structured code indexes.
|
|
552
|
-
Check tool availability first — if MCP tools are not accessible, fall back to Grep/Glob.
|
|
553
|
-
</mcp_tools>
|
|
554
|
-
|
|
555
|
-
<success_criteria>
|
|
556
|
-
- [ ] All tasks executed
|
|
557
|
-
- [ ] Each task committed individually
|
|
558
|
-
- [ ] SUMMARY.md created in plan directory
|
|
559
|
-
</success_criteria>
|
|
560
|
-
"
|
|
561
|
-
)
|
|
562
|
-
```
|
|
563
|
-
|
|
564
|
-
**Sequential mode** (`USE_WORKTREES` is `false`):
|
|
565
|
-
|
|
566
|
-
Omit `isolation="worktree"` from the Task call. Replace the `<parallel_execution>` block with:
|
|
567
|
-
|
|
568
|
-
```
|
|
569
|
-
<sequential_execution>
|
|
570
|
-
You are running as a SEQUENTIAL executor agent on the main working tree.
|
|
571
|
-
Use normal git commits (with hooks). Do NOT use --no-verify.
|
|
572
|
-
</sequential_execution>
|
|
573
|
-
```
|
|
574
|
-
|
|
575
|
-
The sequential mode Task prompt uses the same structure as worktree mode but with these differences in success_criteria — since there is only one agent writing at a time, there are no shared-file conflicts:
|
|
576
|
-
|
|
577
|
-
```
|
|
578
|
-
<success_criteria>
|
|
579
|
-
- [ ] All tasks executed
|
|
580
|
-
- [ ] Each task committed individually
|
|
581
|
-
- [ ] SUMMARY.md created in plan directory
|
|
582
|
-
- [ ] STATE.md updated with position and decisions
|
|
583
|
-
- [ ] ROADMAP.md updated with plan progress (via `roadmap update-plan-progress`)
|
|
584
|
-
</success_criteria>
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
When worktrees are disabled, execute plans **one at a time within each wave** (sequential) regardless of the `PARALLELIZATION` setting — multiple agents writing to the same working tree concurrently would cause conflicts.
|
|
588
|
-
|
|
589
|
-
4. **Wait for all agents in wave to complete.**
|
|
590
|
-
|
|
591
|
-
**Completion signal fallback (Copilot and runtimes where Task() may not return):**
|
|
592
|
-
|
|
593
|
-
If a spawned agent does not return a completion signal but appears to have finished
|
|
594
|
-
its work, do NOT block indefinitely. Instead, verify completion via spot-checks:
|
|
595
|
-
|
|
596
|
-
```bash
|
|
597
|
-
# For each plan in this wave, check if the executor finished:
|
|
598
|
-
SUMMARY_EXISTS=$(test -f "{phase_dir}/{plan_number}-{plan_padded}-SUMMARY.md" && echo "true" || echo "false")
|
|
599
|
-
COMMITS_FOUND=$(git log --oneline --all --grep="{phase_number}-{plan_padded}" --since="1 hour ago" | head -1)
|
|
600
|
-
```
|
|
601
|
-
|
|
602
|
-
**If SUMMARY.md exists AND commits are found:** The agent completed successfully —
|
|
603
|
-
treat as done and proceed to step 5. Log: `"✓ {Plan ID} completed (verified via spot-check — completion signal not received)"`
|
|
604
|
-
|
|
605
|
-
**If SUMMARY.md does NOT exist after a reasonable wait:** The agent may still be
|
|
606
|
-
running or may have failed silently. Check `git log --oneline -5` for recent
|
|
607
|
-
activity. If commits are still appearing, wait longer. If no activity, report
|
|
608
|
-
the plan as failed and route to the failure handler in step 6.
|
|
609
|
-
|
|
610
|
-
**This fallback applies automatically to all runtimes.** Claude Code's Task() normally
|
|
611
|
-
returns synchronously, but the fallback ensures resilience if it doesn't.
|
|
612
|
-
|
|
613
|
-
5. **Post-wave hook validation (parallel mode only):**
|
|
614
|
-
|
|
615
|
-
When agents committed with `--no-verify`, run pre-commit hooks once after the wave:
|
|
616
|
-
```bash
|
|
617
|
-
# Run project's pre-commit hooks on the current state
|
|
618
|
-
git diff --cached --quiet || git stash # stash any unstaged changes
|
|
619
|
-
git hook run pre-commit 2>&1 || echo "⚠ Pre-commit hooks failed — review before continuing"
|
|
620
|
-
```
|
|
621
|
-
If hooks fail: report the failure and ask "Fix hook issues now?" or "Continue to next wave?"
|
|
622
|
-
|
|
623
|
-
5.5. **Worktree cleanup (when `isolation="worktree"` was used):**
|
|
624
|
-
|
|
625
|
-
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:
|
|
626
|
-
|
|
627
|
-
```bash
|
|
628
|
-
# List worktrees created by this wave's agents
|
|
629
|
-
WORKTREES=$(git worktree list --porcelain | grep "^worktree " | grep -v "$(pwd)$" | sed 's/^worktree //')
|
|
630
|
-
|
|
631
|
-
for WT in $WORKTREES; do
|
|
632
|
-
# Get the branch name for this worktree
|
|
633
|
-
WT_BRANCH=$(git -C "$WT" rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
634
|
-
if [ -n "$WT_BRANCH" ] && [ "$WT_BRANCH" != "HEAD" ]; then
|
|
635
|
-
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
636
|
-
|
|
637
|
-
# --- Orchestrator file protection (#1756) ---
|
|
638
|
-
# Snapshot orchestrator-owned files BEFORE merge. If the worktree
|
|
639
|
-
# branch outlived a milestone transition, its versions of STATE.md
|
|
640
|
-
# and ROADMAP.md are stale. Main always wins for these files.
|
|
641
|
-
STATE_BACKUP=$(mktemp)
|
|
642
|
-
ROADMAP_BACKUP=$(mktemp)
|
|
643
|
-
git show HEAD:.planning/STATE.md > "$STATE_BACKUP" 2>/dev/null || true
|
|
644
|
-
git show HEAD:.planning/ROADMAP.md > "$ROADMAP_BACKUP" 2>/dev/null || true
|
|
645
|
-
|
|
646
|
-
# Snapshot list of files on main BEFORE merge to detect resurrections
|
|
647
|
-
PRE_MERGE_FILES=$(git ls-files .planning/)
|
|
648
|
-
|
|
649
|
-
# Merge the worktree branch into the current branch
|
|
650
|
-
git merge "$WT_BRANCH" --no-edit -m "chore: merge executor worktree ($WT_BRANCH)" 2>&1 || {
|
|
651
|
-
echo "⚠ Merge conflict from worktree $WT_BRANCH — resolve manually"
|
|
652
|
-
rm -f "$STATE_BACKUP" "$ROADMAP_BACKUP"
|
|
653
|
-
continue
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
# Restore orchestrator-owned files (main always wins)
|
|
657
|
-
if [ -s "$STATE_BACKUP" ]; then
|
|
658
|
-
cp "$STATE_BACKUP" .planning/STATE.md
|
|
659
|
-
fi
|
|
660
|
-
if [ -s "$ROADMAP_BACKUP" ]; then
|
|
661
|
-
cp "$ROADMAP_BACKUP" .planning/ROADMAP.md
|
|
662
|
-
fi
|
|
663
|
-
rm -f "$STATE_BACKUP" "$ROADMAP_BACKUP"
|
|
664
|
-
|
|
665
|
-
# Detect files deleted on main but re-added by worktree merge
|
|
666
|
-
# (e.g., archived phase directories that were intentionally removed)
|
|
667
|
-
DELETED_FILES=$(git diff --diff-filter=A --name-only HEAD~1 -- .planning/ 2>/dev/null || true)
|
|
668
|
-
for RESURRECTED in $DELETED_FILES; do
|
|
669
|
-
# Check if this file was NOT in main's pre-merge tree
|
|
670
|
-
if ! echo "$PRE_MERGE_FILES" | grep -qxF "$RESURRECTED"; then
|
|
671
|
-
git rm -f "$RESURRECTED" 2>/dev/null || true
|
|
672
|
-
fi
|
|
673
|
-
done
|
|
674
|
-
|
|
675
|
-
# Amend merge commit with restored files if any changed
|
|
676
|
-
if ! git diff --quiet .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || \
|
|
677
|
-
[ -n "$DELETED_FILES" ]; then
|
|
678
|
-
# Only amend the commit with .planning/ files if commit_docs is enabled (#1783)
|
|
679
|
-
COMMIT_DOCS=$(node ".rihal/bin/rihal-tools.cjs" config-get commit_docs 2>/dev/null || echo "true")
|
|
680
|
-
if [ "$COMMIT_DOCS" != "false" ]; then
|
|
681
|
-
git add .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || true
|
|
682
|
-
git commit --amend --no-edit 2>/dev/null || true
|
|
683
|
-
fi
|
|
684
|
-
fi
|
|
685
|
-
|
|
686
|
-
# Remove the worktree
|
|
687
|
-
git worktree remove "$WT" --force 2>/dev/null || true
|
|
688
|
-
|
|
689
|
-
# Delete the temporary branch
|
|
690
|
-
git branch -D "$WT_BRANCH" 2>/dev/null || true
|
|
691
|
-
fi
|
|
692
|
-
done
|
|
693
|
-
```
|
|
694
|
-
|
|
695
|
-
**If `workflow.use_worktrees` is `false`:** Agents ran on the main working tree — skip this step entirely.
|
|
696
|
-
|
|
697
|
-
**If no worktrees found:** Skip silently — agents may have been spawned without worktree isolation.
|
|
698
|
-
|
|
699
|
-
5.6. **Post-wave shared artifact update (worktree mode only):**
|
|
700
|
-
|
|
701
|
-
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:
|
|
702
|
-
|
|
703
|
-
```bash
|
|
704
|
-
# Update ROADMAP.md for each completed plan in this wave
|
|
705
|
-
for PLAN_ID in ${WAVE_PLAN_IDS}; do
|
|
706
|
-
node ".rihal/bin/rihal-tools.cjs" roadmap update-plan-progress "${PHASE_NUMBER}" "${PLAN_ID}" completed
|
|
707
|
-
done
|
|
708
|
-
|
|
709
|
-
```
|
|
710
|
-
|
|
711
|
-
Where `WAVE_PLAN_IDS` is the space-separated list of plan IDs that completed in this wave.
|
|
712
|
-
|
|
713
|
-
**If `workflow.use_worktrees` is `false`:** Sequential agents already updated STATE.md and ROADMAP.md themselves — skip this step.
|
|
714
|
-
|
|
715
|
-
6. **Report completion — spot-check claims first:**
|
|
716
|
-
|
|
717
|
-
For each SUMMARY.md:
|
|
718
|
-
- Verify first 2 files from `key-files.created` exist on disk
|
|
719
|
-
- Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
|
|
720
|
-
- Check for `## Self-Check: FAILED` marker
|
|
721
|
-
|
|
722
|
-
If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
|
|
723
|
-
|
|
724
|
-
If pass:
|
|
725
|
-
```
|
|
726
|
-
---
|
|
727
|
-
## Wave {N} Complete
|
|
728
|
-
|
|
729
|
-
**{Plan ID}: {Plan Name}**
|
|
730
|
-
{What was built — from SUMMARY.md}
|
|
731
|
-
{Notable deviations, if any}
|
|
732
|
-
|
|
733
|
-
{If more waves: what this enables for next wave}
|
|
734
|
-
---
|
|
735
|
-
```
|
|
736
|
-
|
|
737
|
-
- Bad: "Wave 2 complete. Proceeding to Wave 3."
|
|
738
|
-
- Good: "Terrain system complete — 3 biome types, height-based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
|
|
739
|
-
|
|
740
|
-
7. **Handle failures:**
|
|
741
|
-
|
|
742
|
-
**Known Claude Code bug (classifyHandoffIfNeeded):** If an agent reports "failed" with error containing `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not a Rihal or agent issue. The error fires in the completion handler AFTER all tool calls finish. In this case: run the same spot-checks as step 5 (SUMMARY.md exists, git commits present, no Self-Check: FAILED). If spot-checks PASS → treat as **successful**. If spot-checks FAIL → treat as real failure below.
|
|
743
|
-
|
|
744
|
-
For real failures: report which plan failed → ask "Continue?" or "Stop?" → if continue, dependent plans may also fail. If stop, partial completion report.
|
|
745
|
-
|
|
746
|
-
7b. **Pre-wave dependency check (waves 2+ only):**
|
|
747
|
-
|
|
748
|
-
Before spawning wave N+1, for each plan in the upcoming wave:
|
|
749
|
-
```bash
|
|
750
|
-
node ".rihal/bin/rihal-tools.cjs" verify key-links {phase_dir}/{plan}-SPRINT.md
|
|
751
|
-
```
|
|
752
|
-
|
|
753
|
-
If any key-link from a PRIOR wave's artifact fails verification:
|
|
754
|
-
|
|
755
|
-
## Cross-Plan Wiring Gap
|
|
756
|
-
|
|
757
|
-
| Plan | Link | From | Expected Pattern | Status |
|
|
758
|
-
|------|------|------|-----------------|--------|
|
|
759
|
-
| {plan} | {via} | {from} | {pattern} | NOT FOUND |
|
|
760
|
-
|
|
761
|
-
Wave {N} artifacts may not be properly wired. Options:
|
|
762
|
-
1. Investigate and fix before continuing
|
|
763
|
-
2. Continue (may cause cascading failures in wave {N+1})
|
|
764
394
|
|
|
765
|
-
|
|
395
|
+
@rihal/workflows/execute-waves.md
|
|
766
396
|
|
|
767
|
-
8. **Execute checkpoint plans between waves** — see `<checkpoint_handling>`.
|
|
768
|
-
|
|
769
|
-
9. **Proceed to next wave.**
|
|
770
|
-
</step>
|
|
771
397
|
|
|
772
398
|
<step name="checkpoint_handling">
|
|
773
399
|
Plans with `autonomous: false` require user interaction.
|
|
@@ -889,6 +515,48 @@ Selected wave finished successfully. This phase still has incomplete plans, so p
|
|
|
889
515
|
- this means the selected wave happened to be the last remaining work in the phase
|
|
890
516
|
</step>
|
|
891
517
|
|
|
518
|
+
<step name="run_verify_commands">
|
|
519
|
+
**Run per-task `<verify>` shell commands from all completed SPRINT.md plans.**
|
|
520
|
+
|
|
521
|
+
After all executor agents finish, extract and run any `<verify>` blocks defined in plan tasks. These are the machine-executable counterpart to `<acceptance_criteria>` prose.
|
|
522
|
+
|
|
523
|
+
```bash
|
|
524
|
+
# Extract all <verify> blocks from all SPRINT.md files for this phase
|
|
525
|
+
for plan in "${PHASE_DIR}"/*-SPRINT.md; do
|
|
526
|
+
python3 -c "
|
|
527
|
+
import re, sys
|
|
528
|
+
content = open('$plan').read()
|
|
529
|
+
verifies = re.findall(r'<verify>(.*?)</verify>', content, re.DOTALL)
|
|
530
|
+
for v in verifies:
|
|
531
|
+
for line in v.strip().splitlines():
|
|
532
|
+
line = line.strip()
|
|
533
|
+
if line:
|
|
534
|
+
print(line)
|
|
535
|
+
" 2>/dev/null
|
|
536
|
+
done
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
Run each extracted command. Collect results:
|
|
540
|
+
- Exit 0 → `✓ PASS`
|
|
541
|
+
- Non-zero → `❌ FAIL: {command}`
|
|
542
|
+
|
|
543
|
+
**If any verify command fails:**
|
|
544
|
+
```
|
|
545
|
+
⚠ Task verify commands failed:
|
|
546
|
+
|
|
547
|
+
❌ {command}
|
|
548
|
+
Output: {stderr/stdout}
|
|
549
|
+
|
|
550
|
+
These are task-level acceptance checks. Fix before proceeding to code review.
|
|
551
|
+
/rihal-debug "verify command failed: {command}" — diagnose the failure
|
|
552
|
+
```
|
|
553
|
+
STOP — do not proceed to `code_review_gate` until all verify commands pass or the user explicitly overrides.
|
|
554
|
+
|
|
555
|
+
**If all pass (or no `<verify>` blocks exist):** proceed to `code_review_gate` silently.
|
|
556
|
+
|
|
557
|
+
**Skip if:** `--skip-verify` flag is set.
|
|
558
|
+
</step>
|
|
559
|
+
|
|
892
560
|
<step name="code_review_gate" required="true">
|
|
893
561
|
**This step is REQUIRED and must not be skipped.** Spawn `rihal-code-reviewer` to review the phase's source changes. Acts as a BLOCKING gate before the verifier when critical or high findings are present.
|
|
894
562
|
|
|
@@ -901,7 +569,8 @@ If `CODE_REVIEW_ENABLED` is `"false"`: display "Code review skipped (workflow.co
|
|
|
901
569
|
|
|
902
570
|
**Resolve reviewer model:**
|
|
903
571
|
```bash
|
|
904
|
-
REVIEWER_MODEL=$(node ".rihal/bin/rihal-tools.cjs" resolve-model code-reviewer 2>/dev/null | node -e "let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{try{console.log(JSON.parse(d).model)}catch{console.log('')}})" || echo "")
|
|
572
|
+
REVIEWER_MODEL=$(node ".rihal/bin/rihal-tools.cjs" resolve-model code-reviewer 2>/dev/null | node -e "let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{try{console.log(JSON.parse(d).model)}catch{console.log('')}})" || echo "sonnet")
|
|
573
|
+
REVIEWER_MODEL=${REVIEWER_MODEL:-sonnet}
|
|
905
574
|
REVIEWER_SKILLS=$(node ".rihal/bin/rihal-tools.cjs" agent-skills rihal-code-reviewer 2>/dev/null || echo "")
|
|
906
575
|
PADDED=$(printf "%02d" "${PHASE_NUMBER}")
|
|
907
576
|
REVIEW_FILE="${PHASE_DIR}/${PADDED}-REVIEW.md"
|
|
@@ -1039,264 +708,13 @@ node ".rihal/bin/rihal-tools.cjs" commit "docs(phase-${PARENT_PHASE}): resolve U
|
|
|
1039
708
|
```
|
|
1040
709
|
</step>
|
|
1041
710
|
|
|
1042
|
-
<step name="regression_gate">
|
|
1043
|
-
Run prior phases' test suites to catch cross-phase regressions BEFORE verification.
|
|
1044
|
-
|
|
1045
|
-
**Skip if:** This is the first phase (no prior phases), or no prior VERIFICATION.md files exist.
|
|
1046
|
-
|
|
1047
|
-
**Step 1: Discover prior phases' test files**
|
|
1048
|
-
```bash
|
|
1049
|
-
# Find all VERIFICATION.md files from prior phases in current milestone
|
|
1050
|
-
PRIOR_VERIFICATIONS=$(find .planning/phases/ -name "*-VERIFICATION.md" ! -path "*${PHASE_NUMBER}*" 2>/dev/null)
|
|
1051
|
-
```
|
|
1052
|
-
|
|
1053
|
-
**Step 2: Extract test file lists from prior verifications**
|
|
1054
711
|
|
|
1055
|
-
|
|
1056
|
-
- Lines containing `test`, `spec`, or `__tests__` paths
|
|
1057
|
-
- The "Test Suite" or "Automated Checks" section
|
|
1058
|
-
- File patterns from `key-files.created` in corresponding SUMMARY.md files that match `*.test.*` or `*.spec.*`
|
|
712
|
+
@rihal/workflows/execute-regression-gates.md
|
|
1059
713
|
|
|
1060
|
-
Collect all unique test file paths into `REGRESSION_FILES`.
|
|
1061
714
|
|
|
1062
|
-
**Step 3: Run regression tests (if any found)**
|
|
1063
715
|
|
|
1064
|
-
|
|
1065
|
-
# Detect test runner and run prior phase tests
|
|
1066
|
-
if [ -f "package.json" ]; then
|
|
1067
|
-
# Node.js — use project's test runner
|
|
1068
|
-
npx jest ${REGRESSION_FILES} --passWithNoTests --no-coverage -q 2>&1 || npx vitest run ${REGRESSION_FILES} 2>&1
|
|
1069
|
-
elif [ -f "Cargo.toml" ]; then
|
|
1070
|
-
cargo test 2>&1
|
|
1071
|
-
elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
|
|
1072
|
-
python -m pytest ${REGRESSION_FILES} -q --tb=short 2>&1
|
|
1073
|
-
fi
|
|
1074
|
-
```
|
|
716
|
+
@rihal/workflows/execute-verify-phase-goal.md
|
|
1075
717
|
|
|
1076
|
-
**Step 4: Report results**
|
|
1077
|
-
|
|
1078
|
-
If all tests pass:
|
|
1079
|
-
```
|
|
1080
|
-
✓ Regression gate: {N} prior-phase test files passed — no regressions detected
|
|
1081
|
-
```
|
|
1082
|
-
→ Proceed to verify_phase_goal
|
|
1083
|
-
|
|
1084
|
-
If any tests fail:
|
|
1085
|
-
```
|
|
1086
|
-
## ⚠ Cross-Phase Regression Detected
|
|
1087
|
-
|
|
1088
|
-
Phase {X} execution may have broken functionality from prior phases.
|
|
1089
|
-
|
|
1090
|
-
| Test File | Phase | Status | Detail |
|
|
1091
|
-
|-----------|-------|--------|--------|
|
|
1092
|
-
| {file} | {origin_phase} | FAILED | {first_failure_line} |
|
|
1093
|
-
|
|
1094
|
-
Options:
|
|
1095
|
-
1. Fix regressions before verification (recommended)
|
|
1096
|
-
2. Continue to verification anyway (regressions will compound)
|
|
1097
|
-
3. Abort phase — roll back and re-plan
|
|
1098
|
-
```
|
|
1099
|
-
|
|
1100
|
-
Use AskUserQuestion to present the options.
|
|
1101
|
-
</step>
|
|
1102
|
-
|
|
1103
|
-
<step name="schema_drift_gate">
|
|
1104
|
-
Post-execution schema drift detection. Catches false-positive verification where
|
|
1105
|
-
build/types pass because TypeScript types come from config, not the live database.
|
|
1106
|
-
|
|
1107
|
-
**Run after execution completes but BEFORE verification marks success.**
|
|
1108
|
-
|
|
1109
|
-
```bash
|
|
1110
|
-
SCHEMA_DRIFT=$(node ".rihal/bin/rihal-tools.cjs" verify schema-drift "${PHASE_NUMBER}" 2>/dev/null)
|
|
1111
|
-
```
|
|
1112
|
-
|
|
1113
|
-
Parse JSON result for: `drift_detected`, `blocking`, `schema_files`, `orms`, `unpushed_orms`, `message`.
|
|
1114
|
-
|
|
1115
|
-
**If `drift_detected` is false:** Skip to verify_phase_goal.
|
|
1116
|
-
|
|
1117
|
-
**If `drift_detected` is true AND `blocking` is true:**
|
|
1118
|
-
|
|
1119
|
-
Check for override:
|
|
1120
|
-
```bash
|
|
1121
|
-
SKIP_SCHEMA=$(echo "${Rihal_SKIP_SCHEMA_CHECK:-false}")
|
|
1122
|
-
```
|
|
1123
|
-
|
|
1124
|
-
**If `SKIP_SCHEMA` is `true`:**
|
|
1125
|
-
|
|
1126
|
-
Display:
|
|
1127
|
-
```
|
|
1128
|
-
⚠ Schema drift detected but Rihal_SKIP_SCHEMA_CHECK=true — bypassing gate.
|
|
1129
|
-
|
|
1130
|
-
Schema files changed: {schema_files}
|
|
1131
|
-
ORMs requiring push: {unpushed_orms}
|
|
1132
|
-
|
|
1133
|
-
Proceeding to verification (database may be out of sync).
|
|
1134
|
-
```
|
|
1135
|
-
→ Continue to verify_phase_goal.
|
|
1136
|
-
|
|
1137
|
-
**If `SKIP_SCHEMA` is not `true`:**
|
|
1138
|
-
|
|
1139
|
-
BLOCK verification. Display:
|
|
1140
|
-
|
|
1141
|
-
```
|
|
1142
|
-
## BLOCKED: Schema Drift Detected
|
|
1143
|
-
|
|
1144
|
-
Schema-relevant files changed during this phase but no database push command
|
|
1145
|
-
was executed. Build and type checks pass because TypeScript types come from
|
|
1146
|
-
config, not the live database — verification would produce a false positive.
|
|
1147
|
-
|
|
1148
|
-
Schema files changed: {schema_files}
|
|
1149
|
-
ORMs requiring push: {unpushed_orms}
|
|
1150
|
-
|
|
1151
|
-
Required push commands:
|
|
1152
|
-
{For each unpushed ORM, show the push command from the message}
|
|
1153
|
-
|
|
1154
|
-
Options:
|
|
1155
|
-
1. Run push command now (recommended) — execute the push, then re-verify
|
|
1156
|
-
2. Skip schema check (Rihal_SKIP_SCHEMA_CHECK=true) — bypass this gate
|
|
1157
|
-
3. Abort — stop execution and investigate
|
|
1158
|
-
```
|
|
1159
|
-
|
|
1160
|
-
If `TEXT_MODE` is true, present as a plain-text numbered list. Otherwise use AskUserQuestion.
|
|
1161
|
-
|
|
1162
|
-
**If user selects option 1:** Present the specific push command(s) to run. After user confirms execution, re-run the schema drift check. If it passes, continue to verify_phase_goal.
|
|
1163
|
-
|
|
1164
|
-
**If user selects option 2:** Set override and continue to verify_phase_goal.
|
|
1165
|
-
|
|
1166
|
-
**If user selects option 3:** Stop execution. Report partial completion.
|
|
1167
|
-
</step>
|
|
1168
|
-
|
|
1169
|
-
<step name="verify_phase_goal">
|
|
1170
|
-
Verify phase achieved its GOAL, not just completed tasks.
|
|
1171
|
-
|
|
1172
|
-
```bash
|
|
1173
|
-
VERIFIER_SKILLS=$(node ".rihal/bin/rihal-tools.cjs" agent-skills rihal-verifier 2>/dev/null)
|
|
1174
|
-
```
|
|
1175
|
-
|
|
1176
|
-
```
|
|
1177
|
-
Task(
|
|
1178
|
-
description="Verify phase {phase_number} goal achievement",
|
|
1179
|
-
prompt="Verify phase {phase_number} goal achievement.
|
|
1180
|
-
Phase directory: {phase_dir}
|
|
1181
|
-
Phase goal: {goal from ROADMAP.md}
|
|
1182
|
-
Phase requirement IDs: {phase_req_ids}
|
|
1183
|
-
Check must_haves against actual codebase.
|
|
1184
|
-
Cross-reference requirement IDs from PLAN frontmatter against REQUIREMENTS.md — every ID MUST be accounted for.
|
|
1185
|
-
Create VERIFICATION.md.
|
|
1186
|
-
|
|
1187
|
-
<files_to_read>
|
|
1188
|
-
Read these files before verification:
|
|
1189
|
-
- {phase_dir}/*-SPRINT.md (All plans — understand intent, check must_haves)
|
|
1190
|
-
- {phase_dir}/*-SUMMARY.md (All summaries — cross-reference claimed vs actual)
|
|
1191
|
-
- .planning/REQUIREMENTS.md (Requirement traceability)
|
|
1192
|
-
${CONTEXT_WINDOW >= 500000 ? `- {phase_dir}/*-CONTEXT.md (User decisions — verify they were honored)
|
|
1193
|
-
- {phase_dir}/*-RESEARCH.md (Known pitfalls — check for traps)
|
|
1194
|
-
- Prior VERIFICATION.md files from earlier phases (regression check)
|
|
1195
|
-
` : ''}
|
|
1196
|
-
</files_to_read>
|
|
1197
|
-
|
|
1198
|
-
${VERIFIER_SKILLS}",
|
|
1199
|
-
subagent_type="rihal-verifier",
|
|
1200
|
-
model="{verifier_model}"
|
|
1201
|
-
)
|
|
1202
|
-
```
|
|
1203
|
-
|
|
1204
|
-
Read status:
|
|
1205
|
-
```bash
|
|
1206
|
-
grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
|
|
1207
|
-
```
|
|
1208
|
-
|
|
1209
|
-
| Status | Action |
|
|
1210
|
-
|--------|--------|
|
|
1211
|
-
| `passed` | → update_roadmap |
|
|
1212
|
-
| `human_needed` | Present items for human testing, get approval or feedback |
|
|
1213
|
-
| `gaps_found` | Present gap summary, offer `/rihal-plan {phase} --gaps ${Rihal_WS}` |
|
|
1214
|
-
|
|
1215
|
-
**If human_needed:**
|
|
1216
|
-
|
|
1217
|
-
**Step A: Persist human verification items as UAT file.**
|
|
1218
|
-
|
|
1219
|
-
Create `{phase_dir}/{phase_num}-HUMAN-UAT.md` using UAT template format:
|
|
1220
|
-
|
|
1221
|
-
```markdown
|
|
1222
|
-
---
|
|
1223
|
-
status: partial
|
|
1224
|
-
phase: {phase_num}-{phase_name}
|
|
1225
|
-
source: [{phase_num}-VERIFICATION.md]
|
|
1226
|
-
started: [now ISO]
|
|
1227
|
-
updated: [now ISO]
|
|
1228
|
-
---
|
|
1229
|
-
|
|
1230
|
-
## Current Test
|
|
1231
|
-
|
|
1232
|
-
[awaiting human testing]
|
|
1233
|
-
|
|
1234
|
-
## Tests
|
|
1235
|
-
|
|
1236
|
-
{For each human_verification item from VERIFICATION.md:}
|
|
1237
|
-
|
|
1238
|
-
### {N}. {item description}
|
|
1239
|
-
expected: {expected behavior from VERIFICATION.md}
|
|
1240
|
-
result: [pending]
|
|
1241
|
-
|
|
1242
|
-
## Summary
|
|
1243
|
-
|
|
1244
|
-
total: {count}
|
|
1245
|
-
passed: 0
|
|
1246
|
-
issues: 0
|
|
1247
|
-
pending: {count}
|
|
1248
|
-
skipped: 0
|
|
1249
|
-
blocked: 0
|
|
1250
|
-
|
|
1251
|
-
## Gaps
|
|
1252
|
-
```
|
|
1253
|
-
|
|
1254
|
-
Commit the file:
|
|
1255
|
-
```bash
|
|
1256
|
-
node ".rihal/bin/rihal-tools.cjs" commit "test({phase_num}): persist human verification items as UAT" --files "{phase_dir}/{phase_num}-HUMAN-UAT.md"
|
|
1257
|
-
```
|
|
1258
|
-
|
|
1259
|
-
**Step B: Present to user:**
|
|
1260
|
-
|
|
1261
|
-
```
|
|
1262
|
-
## ✓ Phase {X}: {Name} — Human Verification Required
|
|
1263
|
-
|
|
1264
|
-
All automated checks passed. {N} items need human testing:
|
|
1265
|
-
|
|
1266
|
-
{From VERIFICATION.md human_verification section}
|
|
1267
|
-
|
|
1268
|
-
Items saved to `{phase_num}-HUMAN-UAT.md` — they will appear in `/rihal-progress` and `/rihal-audit-uat`.
|
|
1269
|
-
|
|
1270
|
-
"approved" → continue | Report issues → gap closure
|
|
1271
|
-
```
|
|
1272
|
-
|
|
1273
|
-
**If user says "approved":** Proceed to `update_roadmap`. The HUMAN-UAT.md file persists with `status: partial` and will surface in future progress checks until the user runs `/rihal-verify-work` on it.
|
|
1274
|
-
|
|
1275
|
-
**If user reports issues:** Proceed to gap closure as currently implemented.
|
|
1276
|
-
|
|
1277
|
-
**If gaps_found:**
|
|
1278
|
-
```
|
|
1279
|
-
## ⚠ Phase {X}: {Name} — Gaps Found
|
|
1280
|
-
|
|
1281
|
-
**Score:** {N}/{M} must-haves verified
|
|
1282
|
-
**Report:** {phase_dir}/{phase_num}-VERIFICATION.md
|
|
1283
|
-
|
|
1284
|
-
### What's Missing
|
|
1285
|
-
{Gap summaries from VERIFICATION.md}
|
|
1286
|
-
|
|
1287
|
-
---
|
|
1288
|
-
## ▶ Next Up
|
|
1289
|
-
|
|
1290
|
-
`/clear` then:
|
|
1291
|
-
|
|
1292
|
-
`/rihal-plan {X} --gaps ${Rihal_WS}`
|
|
1293
|
-
|
|
1294
|
-
Also: `cat {phase_dir}/{phase_num}-VERIFICATION.md` — full report
|
|
1295
|
-
Also: `/rihal-verify-work {X} ${Rihal_WS}` — manual testing first
|
|
1296
|
-
```
|
|
1297
|
-
|
|
1298
|
-
Gap closure cycle: `/rihal-plan {X} --gaps ${Rihal_WS}` reads VERIFICATION.md → creates gap plans with `gap_closure: true` → user runs `/rihal-execute {X} --gaps-only ${Rihal_WS}` → verifier re-runs.
|
|
1299
|
-
</step>
|
|
1300
718
|
|
|
1301
719
|
<step name="uat_gate" priority="blocker">
|
|
1302
720
|
**UAT gate (added in v3.1.0 after #443 / #448):**
|
|
@@ -1308,9 +726,9 @@ VERIFICATION_FILE=$(ls "${PHASE_DIR}"/*-VERIFICATION.md 2>/dev/null | head -1)
|
|
|
1308
726
|
|
|
1309
727
|
if [ -z "$VERIFICATION_FILE" ]; then
|
|
1310
728
|
VERIFICATION_STATUS="missing"
|
|
1311
|
-
elif grep -
|
|
729
|
+
elif grep -qE "^status:[[:space:]]*passed" "$VERIFICATION_FILE" 2>/dev/null; then
|
|
1312
730
|
VERIFICATION_STATUS="pass"
|
|
1313
|
-
elif grep -
|
|
731
|
+
elif grep -qE "^status:[[:space:]]*(gaps_found|fail)" "$VERIFICATION_FILE" 2>/dev/null; then
|
|
1314
732
|
VERIFICATION_STATUS="fail"
|
|
1315
733
|
else
|
|
1316
734
|
VERIFICATION_STATUS="indeterminate"
|
|
@@ -1332,8 +750,11 @@ fi
|
|
|
1332
750
|
|
|
1333
751
|
{list AC items from SPRINT.md}
|
|
1334
752
|
|
|
1335
|
-
|
|
1336
|
-
/rihal-
|
|
753
|
+
Recommended next steps:
|
|
754
|
+
/rihal-add-tests {X} — generate unit + E2E tests before UAT
|
|
755
|
+
/rihal-verify-work {X} — perform UAT and produce VERIFICATION.md
|
|
756
|
+
|
|
757
|
+
/rihal-next will refuse to advance until the UAT gate passes.
|
|
1337
758
|
```
|
|
1338
759
|
3. STOP the workflow. Do NOT proceed to `update_roadmap`. Do NOT call `phase complete`.
|
|
1339
760
|
|
|
@@ -1355,6 +776,16 @@ The previous behaviour (printing "Next Up: /rihal-verify-work" without state-gat
|
|
|
1355
776
|
COMPLETION=$(node ".rihal/bin/rihal-tools.cjs" phase complete "${PHASE_NUMBER}")
|
|
1356
777
|
```
|
|
1357
778
|
|
|
779
|
+
Record execution telemetry (plan count + latest commit hash):
|
|
780
|
+
```bash
|
|
781
|
+
EXEC_HASH=$(git rev-parse --short HEAD 2>/dev/null || echo "")
|
|
782
|
+
node ".rihal/bin/rihal-tools.cjs" state record-execution \
|
|
783
|
+
--plan "${PHASE_NUMBER}" \
|
|
784
|
+
--tasks "${PLAN_COUNT}" \
|
|
785
|
+
--hash "${EXEC_HASH}" \
|
|
786
|
+
2>/dev/null || true
|
|
787
|
+
```
|
|
788
|
+
|
|
1358
789
|
The CLI handles:
|
|
1359
790
|
- Marking phase checkbox `[x]` with completion date
|
|
1360
791
|
- Updating Progress table (Status → Complete, date)
|
|
@@ -1447,6 +878,33 @@ teams_webhook_url: "https://outlook.office.com/webhook/..."
|
|
|
1447
878
|
Then verify with `/rihal-notify-test`.
|
|
1448
879
|
</step>
|
|
1449
880
|
|
|
881
|
+
<step name="generate_tests">
|
|
882
|
+
**Offer test generation for the completed phase.**
|
|
883
|
+
|
|
884
|
+
After verification passes and the roadmap is updated, check whether tests were already written as part of the phase plans:
|
|
885
|
+
|
|
886
|
+
```bash
|
|
887
|
+
TEST_FILES=$(find "${PHASE_DIR}" -name "*test*" -o -name "*spec*" 2>/dev/null | wc -l)
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
If `TEST_FILES` is 0 — no test artifacts were produced during execution. Present the test generation offer:
|
|
891
|
+
|
|
892
|
+
```
|
|
893
|
+
## ✓ Phase {X}: {Name} — Add Tests?
|
|
894
|
+
|
|
895
|
+
No test files were generated during this phase.
|
|
896
|
+
Run /rihal-add-tests to generate unit + E2E tests from the SUMMARY:
|
|
897
|
+
|
|
898
|
+
/rihal-add-tests {X} ${Rihal_WS}
|
|
899
|
+
|
|
900
|
+
Skip if tests are out of scope for this phase (infra, config, docs-only).
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
If `TEST_FILES` is > 0 — tests were written inline. Skip this step silently.
|
|
904
|
+
|
|
905
|
+
**This step is advisory only — it never blocks phase completion.**
|
|
906
|
+
</step>
|
|
907
|
+
|
|
1450
908
|
<step name="offer_next">
|
|
1451
909
|
|
|
1452
910
|
**Exception:** If `gaps_found`, the `verify_phase_goal` step already presents the gap-closure path (`/rihal-plan {X} --gaps`). No additional routing needed — skip auto-advance.
|
|
@@ -1505,6 +963,7 @@ Read and follow `.rihal/workflows/transition.md`, passing through the `--auto` f
|
|
|
1505
963
|
```
|
|
1506
964
|
## ✓ Phase {X}: {Name} Complete
|
|
1507
965
|
|
|
966
|
+
/rihal-add-tests {X} ${Rihal_WS} — generate unit + E2E tests for this phase
|
|
1508
967
|
/rihal-progress ${Rihal_WS} — see updated roadmap
|
|
1509
968
|
/rihal-discuss-phase {next} ${Rihal_WS} — discuss next phase before planning
|
|
1510
969
|
/rihal-plan {next} ${Rihal_WS} — plan next phase
|