@hanzlaa/rcode 4.7.3 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +1 -1
  3. package/CONTRIBUTING.md +3 -0
  4. package/README.md +7 -5
  5. package/cli/github-sync.js +17 -201
  6. package/cli/install.js +16 -13
  7. package/cli/lib/config.cjs +1 -1
  8. package/cli/lib/github-sync-discover.cjs +304 -0
  9. package/cli/lib/namespace-migrate.cjs +16 -1
  10. package/cli/uninstall.js +7 -2
  11. package/dist/rcode.js +197 -197
  12. package/package.json +1 -1
  13. package/rcode/agents/rcode-code-reviewer.md +1 -1
  14. package/rcode/agents/rcode-docs-auditor.md +1 -1
  15. package/rcode/agents/rcode-edge-case-hunter.md +1 -1
  16. package/rcode/agents/rcode-haitham.md +1 -1
  17. package/rcode/agents/rcode-hanzla.md +1 -1
  18. package/rcode/agents/rcode-hussain-pm.md +1 -1
  19. package/rcode/agents/rcode-nyquist-auditor.md +1 -1
  20. package/rcode/agents/rcode-omar.md +1 -1
  21. package/rcode/agents/rcode-remediation-planner.md +1 -1
  22. package/rcode/agents/rcode-security-adversary.md +1 -1
  23. package/rcode/agents/rcode-security-auditor.md +1 -1
  24. package/rcode/agents/rcode-sprint-checker.md +1 -1
  25. package/rcode/agents/rcode-verifier.md +1 -1
  26. package/rcode/agents/rcode-waleed.md +1 -1
  27. package/rcode/agents/rcode-yousef.md +1 -1
  28. package/rcode/agents/rules/planner/task-templates.md +24 -22
  29. package/rcode/agents/rules/verifier/verification-report.md +2 -2
  30. package/rcode/bin/lib/roadmap.cjs +80 -4
  31. package/rcode/bin/rcode-tools.cjs +124 -1
  32. package/rcode/brain/best-practices/state-sync-rule.md +1 -1
  33. package/rcode/references/council-protocol.md +9 -4
  34. package/rcode/references/execute-auto-copy-learnings.md +15 -0
  35. package/rcode/references/execute-close-parent-artifacts.md +49 -0
  36. package/rcode/references/execute-interactive-mode.md +44 -0
  37. package/rcode/references/execute-notify-webhooks.md +22 -0
  38. package/rcode/references/execution-protocol.md +11 -11
  39. package/rcode/references/git-preflight.md +7 -4
  40. package/rcode/references/output-format.md +5 -5
  41. package/rcode/references/plan-gaps-mode.md +89 -0
  42. package/rcode/references/plan-thinking-partner.md +20 -0
  43. package/rcode/references/plan-windows-troubleshooting.md +25 -0
  44. package/rcode/references/planner-playbook.md +23 -29
  45. package/rcode/skills/_shared/state-sync-rule.md +1 -1
  46. package/rcode/skills/actions/1-analysis/rcode-document-project/SKILL.md +2 -0
  47. package/rcode/skills/actions/1-analysis/rcode-prfaq/SKILL.md +2 -0
  48. package/rcode/skills/actions/2-plan/rcode-create-epics-and-stories/SKILL.md +11 -0
  49. package/rcode/skills/actions/2-plan/rcode-create-prd/SKILL.md +2 -0
  50. package/rcode/skills/actions/2-plan/rcode-create-story/SKILL.md +11 -0
  51. package/rcode/skills/actions/2-plan/rcode-edit-prd/SKILL.md +2 -0
  52. package/rcode/skills/actions/2-plan/rcode-validate-prd/SKILL.md +2 -0
  53. package/rcode/skills/actions/3-solutioning/rcode-check-implementation-readiness/SKILL.md +2 -0
  54. package/rcode/skills/actions/3-solutioning/rcode-create-architecture/SKILL.md +2 -0
  55. package/rcode/skills/actions/4-implementation/rcode-checkpoint-preview/SKILL.md +2 -0
  56. package/rcode/skills/actions/4-implementation/rcode-code-review/SKILL.md +2 -0
  57. package/rcode/skills/actions/4-implementation/rcode-correct-course/SKILL.md +2 -0
  58. package/rcode/skills/actions/4-implementation/rcode-debug/SKILL.md +1 -1
  59. package/rcode/skills/actions/4-implementation/rcode-dev-story/SKILL.md +2 -0
  60. package/rcode/skills/actions/4-implementation/rcode-retrospective/SKILL.md +2 -0
  61. package/rcode/skills/actions/4-implementation/rcode-scaffold-project/SKILL.md +2 -0
  62. package/rcode/skills/actions/4-implementation/rcode-sprint-planning/SKILL.md +3 -2
  63. package/rcode/skills/actions/4-implementation/rcode-sprint-status/SKILL.md +2 -0
  64. package/rcode/skills/agents/haitham-frontend/SKILL.md +6 -0
  65. package/rcode/skills/agents/hanzla-engineer/SKILL.md +6 -0
  66. package/rcode/skills/agents/hussain-pm/SKILL.md +1 -1
  67. package/rcode/skills/agents/hussain-sm/SKILL.md +3 -3
  68. package/rcode/skills/agents/majlis-council/references.md +17 -7
  69. package/rcode/skills/agents/raees-orchestrator/SKILL.md +13 -11
  70. package/rcode/skills/agents/yousef-backend/SKILL.md +6 -0
  71. package/rcode/templates/github/epic-template.md +1 -1
  72. package/rcode/templates/github/feature-template.md +1 -1
  73. package/rcode/templates/github/task-template.md +1 -1
  74. package/rcode/templates/sprint.md +14 -3
  75. package/rcode/templates/verification-report.md +7 -4
  76. package/rcode/workflows/add-phase.md +33 -14
  77. package/rcode/workflows/code-review-fix.md +5 -5
  78. package/rcode/workflows/code-review.md +1 -1
  79. package/rcode/workflows/council.md +1 -0
  80. package/rcode/workflows/create-epics-and-stories.md +12 -6
  81. package/rcode/workflows/dev-story.md +12 -14
  82. package/rcode/workflows/do.md +12 -9
  83. package/rcode/workflows/execute-sprint.md +7 -4
  84. package/rcode/workflows/execute-waves.md +38 -2
  85. package/rcode/workflows/execute.md +42 -138
  86. package/rcode/workflows/init.md +10 -2
  87. package/rcode/workflows/lens-audit.md +7 -7
  88. package/rcode/workflows/plan-research-validation.md +10 -5
  89. package/rcode/workflows/plan-spawn-planner.md +9 -14
  90. package/rcode/workflows/plan.md +27 -138
  91. package/rcode/workflows/quick.md +1 -1
  92. package/rcode/workflows/scaffold-skill.md +19 -1
  93. package/rcode/workflows/secure-phase.md +7 -1
  94. package/rcode/workflows/sprint-planning.md +14 -37
  95. package/rcode/workflows/validate-phase.md +7 -1
@@ -71,6 +71,40 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
71
71
  For 200k models, this keeps orchestrator context lean (~10-15%).
72
72
  For 1M+ models (Opus 4.6, Sonnet 4.6), richer context can be passed directly.
73
73
 
74
+ **Classify plan and select subagent_type (BEFORE spawning, once per plan):**
75
+
76
+ This used to be prose pseudocode the orchestrating LLM was expected to hand-apply
77
+ (FRONTEND_GLOBS/BACKEND_GLOBS matching + keyword fallback). A live execution run showed
78
+ that computation was never actually carried out — a plan whose `files_modified` clearly
79
+ matched the backend glob rule (a path containing `db`) still fell back to `rcode-executor`.
80
+ Classification is now a deterministic CLI call — do not hand-compute it.
81
+
82
+ Call `classify-plan` with the phase and this plan's id (it reads `files_modified` and the
83
+ `<objective>` directly from the plan's SPRINT.md, so no need to re-parse step 1's overlap
84
+ data yourself):
85
+
86
+ ```bash
87
+ CLASSIFY_JSON=$(node ".rcode/bin/rcode-tools.cjs" classify-plan "$PHASE" "$PLAN_ID" 2>/dev/null)
88
+ SUBAGENT_TYPE=$(echo "$CLASSIFY_JSON" | node -e "let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{try{console.log(JSON.parse(d).subagent_type)}catch{console.log('rcode-executor')}})")
89
+ SUBAGENT_TYPE=${SUBAGENT_TYPE:-rcode-executor}
90
+ ```
91
+
92
+ Use the literal `subagent_type` value returned — do not second-guess or override it.
93
+
94
+ This decision is computed once per plan, before that plan's Task() spawn(s) below, and the
95
+ resulting `subagent_type` value is used in the Task() call template (worktree and sequential
96
+ modes both reuse this same value — see "Sequential mode" further below).
97
+
98
+ **Resolve executor model (once per wave, before spawning):**
99
+
100
+ `executor_model` from `init` is the raw `model_profile` string (e.g. `balanced`), not a
101
+ resolved model id — it must be passed through `resolve-model` first, the same way
102
+ `code_review_gate` in execute.md resolves `REVIEWER_MODEL` before its Task() spawn.
103
+ ```bash
104
+ EXECUTOR_MODEL=$(node ".rcode/bin/rcode-tools.cjs" resolve-model executor 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")
105
+ EXECUTOR_MODEL=${EXECUTOR_MODEL:-sonnet}
106
+ ```
107
+
74
108
  **Worktree mode** (`USE_WORKTREES` is not `false`):
75
109
 
76
110
  Before spawning, capture the current HEAD:
@@ -96,15 +130,17 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
96
130
 
97
131
  ```
98
132
  Task(
99
- subagent_type="rcode-executor",
133
+ subagent_type="{subagent_type}",
100
134
  description="Execute plan {plan_number} of phase {phase_number}",
101
- model="{executor_model}",
135
+ model="${EXECUTOR_MODEL}",
102
136
  isolation="worktree",
103
137
  prompt="
104
138
  <objective>
105
139
  Execute plan {plan_number} of phase {phase_number}-{phase_name}.
106
140
  Commit each task atomically. Create SUMMARY.md.
107
141
  Do NOT update STATE.md or ROADMAP.md — the orchestrator owns those writes after all worktree agents in the wave complete.
142
+
143
+ Routing note: this plan touches {classification} paths → dispatched to {subagent_type} (see step 3's classification logic in execute-waves.md).
108
144
  </objective>
109
145
 
110
146
  <!--
@@ -35,11 +35,12 @@ route back to the user.
35
35
  4. **Branch check**: confirm current git branch is appropriate
36
36
  for the work. Two checks, both blocking:
37
37
 
38
- a. **Not on main/master without consent**: if `git branch --show-current`
39
- returns `main` or `master`, refuse to execute. Suggest:
40
- `git switch -c <phase>-<plan>-<slug>` (e.g. `git switch -c 8-1-aria`).
41
- User can override only by passing `--allow-main` to /rcode-execute and
42
- explicitly typing the override on this turn.
38
+ a. **Not on main/master without consent** (skip entirely when `git.branching_strategy`
39
+ config is `none` check via `node .rcode/bin/rcode-tools.cjs config-get
40
+ git.branching_strategy`): if `git branch --show-current` returns `main` or
41
+ `master`, refuse to execute. Suggest: `git switch -c <phase>-<plan>-<slug>`
42
+ (e.g. `git switch -c 8-1-aria`). User can override only by passing `--on-main`
43
+ to /rcode-execute and explicitly typing the override on this turn.
43
44
 
44
45
  b. **Working tree clean enough**: if `git status --porcelain` shows
45
46
  modified files unrelated to this phase's `files_modified` frontmatter,
@@ -49,8 +50,7 @@ route back to the user.
49
50
 
50
51
  The branch name should align with the phase/plan IDs from state — check
51
52
  `workflow.branch_pattern` config (default `<phase>-<plan>-<slug>`).
52
- 5. **Worktree config**: read `workflow.use_worktrees` — if true + parallelization
53
- is true + no file overlaps, plans in a wave run parallel via worktrees
53
+ 5. **Worktree config**: read `workflow.use_worktrees` — if true + no file overlaps, plans in a wave run parallel via worktrees. (`parallelization` is not a real field in `init execute`'s output — see the "initialize" step below; don't gate on it.)
54
54
  </pre_flight>
55
55
 
56
56
  <insight_block>
@@ -178,12 +178,13 @@ via filesystem and git state.
178
178
  </runtime_compatibility>
179
179
 
180
180
  <required_reading>
181
- @.rcode/references/auto-init-guard.md
182
- @.rcode/references/output-format.md
181
+ <!-- If chained from plan.md's --auto (Skill(), same context), these 3 are already loaded — see AUDIT-workflow-complexity.md finding 3. -->
182
+ ${AUTO_CHAINED_FROM_PLAN ? '' : '@.rcode/references/auto-init-guard.md'}
183
+ ${AUTO_CHAINED_FROM_PLAN ? '' : '@.rcode/references/output-format.md'}
183
184
  @.rcode/references/git-preflight.md
184
185
  Read STATE.md before any operation to load project context.
185
186
 
186
- @.rcode/references/karpathy-guidelines.md
187
+ ${AUTO_CHAINED_FROM_PLAN ? '' : '@.rcode/references/karpathy-guidelines.md'}
187
188
  @.rcode/references/execution-protocol.md
188
189
  <!-- Read .rcode/references/agent-contracts.md only if debugging agent contract violations -->
189
190
  <!-- Read .rcode/references/context-budget.md only if context degradation guidance is needed -->
@@ -204,8 +205,11 @@ Always use the exact name from this list — do not fall back to 'general-purpos
204
205
  - rcode-integration-checker — Checks cross-phase integration
205
206
  - rcode-nyquist-auditor — Validates verification coverage
206
207
  - rcode-ux-designer — Researches UI/UX approaches
207
- - rcode-ui-auditor — Reviews UI implementation quality
208
208
  - rcode-ui-auditor — Audits UI against design requirements
209
+ - rcode-hanzla — Senior Full-Stack Engineer — full-stack plans spanning both frontend and backend
210
+ - rcode-yousef — Senior Backend Engineer — backend-only plans (API, DB, services, queues)
211
+ - rcode-haitham — Senior Frontend Engineer — frontend-only plans (React/Next.js/Tailwind/CSS/RTL/a11y)
212
+ - rcode-omar — Software Engineer (generalist) — fallback for cross-stack or small ambiguous plans when Hanzla isn't the clear fit
209
213
  </available_agent_types>
210
214
 
211
215
  <process>
@@ -234,14 +238,16 @@ If `INIT` is empty or `INIT.ok` is false, print error and exit:
234
238
  Error: rcode-tools init failed. Verify .rcode/ is installed and state.json is valid.
235
239
  ```
236
240
 
237
- Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`, `response_language`.
241
+ Parse JSON for these real, top-level fields: `executor_model`, `verifier_model`, `phase_dir`, `plans`, `state_exists`, `response_language`. Fields commonly assumed to exist but that are NOT top-level (verified live this session against `init execute`'s real output, `cmdInitExecute` in rcode-tools.cjs): `branching_strategy` is nested under `config.branching_strategy`; `commit_docs` doesn't exist (closest real value is `config.commit_planning`, a `"true"`/`"false"` string); `parallelization` has no source anywhere (not top-level, not under `config`, not in `phase-plan-index`'s output either); `branch_name` isn't returned (the `handle_branching` step below now computes it from config instead); `phase_name` isn't derivable either (`phase_dir`'s basename is a slug, not the human-readable name — read ROADMAP.md if a step needs it); `incomplete_plans`/`incomplete_count` don't exist (`plans[]` items only carry `{path, depends_on, wave, plan}`, no completion field); `roadmap_exists`/`phase_req_ids` are returned only by the separate `init sprint-plan` command, not `init execute`.
242
+ Derivable, not literal: `phase_found` as `phase_dir !== null`; `phase_number` as the `target` field (the raw phase argument as passed, e.g. `"45"`); `phase_slug` from `phase_dir`'s basename (the part after the first `-`); `plan_count` as `plans.length`. Downstream `${PHASE_NUMBER}`/`${PLAN_COUNT}` references later in this workflow (snapshot tag, review prompts, `phase complete`, etc.) resolve from `target`/`plans.length` per these derivations; `${PHASE_NAME}` and `${INCOMPLETE_COUNT}` have no source here — read `PHASE_NAME` from ROADMAP.md if a later step needs it, and treat `INCOMPLETE_COUNT` as unknown until `phase-plan-index` runs in `discover_and_group_plans` (which does return a real per-plan `has_summary` completion signal).
238
243
 
239
244
  **If `response_language` is set:** Include `response_language: {value}` in all spawned subagent prompts so any user-facing output stays in the configured language.
240
245
 
241
246
  Read worktree config:
242
247
 
243
248
  ```bash
244
- USE_WORKTREES=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.use_worktrees 2>/dev/null || echo "true")
249
+ USE_WORKTREES=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.use_worktrees 2>/dev/null)
250
+ USE_WORKTREES=${USE_WORKTREES:-true} # config-get exits 0 with empty output when key absent; || fallback won't fire
245
251
  ```
246
252
 
247
253
  When `USE_WORKTREES` is `false`, all executor agents run without `isolation="worktree"` — they execute sequentially on the main working tree instead of in parallel worktrees.
@@ -261,16 +267,17 @@ When `CONTEXT_WINDOW >= 500000` (1M-class models), subagent prompts include rich
261
267
  - Verifier agents receive all SPRINT.md, SUMMARY.md, CONTEXT.md files plus REQUIREMENTS.md
262
268
  - This enables cross-phase awareness and history-aware verification
263
269
 
264
- **If `phase_found` is false:** Error — phase directory not found. Run `/rcode-status` to inspect state or `/rcode-plan {N}` to create the phase.
265
- **If `plan_count` is 0:** Error — no plans found in phase. Run `/rcode-plan {N}` to generate plans or `/rcode-help` for the command surface.
270
+ **If `phase_dir` is `null` (derived `phase_found` false):** Error — phase directory not found. Run `/rcode-status` to inspect state or `/rcode-plan {N}` to create the phase.
271
+ **If `plans.length` is 0 (derived `plan_count` 0):** Error — no plans found in phase. Run `/rcode-plan {N}` to generate plans or `/rcode-help` for the command surface.
266
272
  **If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
267
273
 
268
- When `parallelization` is false, plans within a wave execute sequentially.
274
+ `parallelization` is not a real field in `init execute`'s output (see the "initialize" step's field notes above) — this line currently documents behavior with no data source; don't treat it as a working toggle until a real source is wired in.
269
275
 
270
276
  **Runtime detection for Copilot:**
271
277
  Check if the current runtime is Copilot by testing for the `@rcode-executor` agent pattern
272
278
  or absence of the `Task()` subagent API. If running under Copilot, force sequential inline
273
- execution regardless of the `parallelization` settingCopilot's subagent completion
279
+ execution unconditionally (there is no real `parallelization` toggle to override see the
280
+ "initialize" step's field notes above) — Copilot's subagent completion
274
281
  signals are unreliable (see `<runtime_compatibility>`). Set `COPILOT_SEQUENTIAL=true`
275
282
  internally and skip the `execute_waves` step in favor of `check_interactive_mode`'s
276
283
  inline path for each plan.
@@ -335,46 +342,10 @@ Write these answers inline before continuing. If a blocking anti-pattern cannot
335
342
 
336
343
  **If `--interactive` flag present:** Switch to interactive execution mode.
337
344
 
338
- Interactive mode executes plans sequentially **inline** (no subagent spawning) with user
339
- checkpoints between tasks. The user can review, modify, or redirect work at any point.
340
-
341
- **Interactive execution flow:**
342
-
343
- 1. Load plan inventory as normal (discover_and_group_plans)
344
- 2. For each plan (sequentially, ignoring wave grouping):
345
-
346
- a. **Present the plan to the user:**
347
- ```
348
- ## Plan {plan_id}: {plan_name}
349
-
350
- Objective: {from plan file}
351
- Tasks: {task_count}
352
-
353
- Options:
354
- - Execute (proceed with all tasks)
355
- - Review first (show task breakdown before starting)
356
- - Skip (move to next plan)
357
- - Stop (end execution, save progress)
358
- ```
359
-
360
- b. **If "Review first":** Read and display the full plan file. Ask again: Execute, Modify, Skip.
361
-
362
- c. **If "Execute":** Read and follow `.rcode/workflows/execute-sprint.md` **inline**
363
- (do NOT spawn a subagent). Execute tasks one at a time.
364
-
365
- d. **After each task:** Pause briefly. If the user intervenes (types anything), stop and address
366
- their feedback before continuing. Otherwise proceed to next task.
367
-
368
- e. **After plan complete:** Show results, commit, create SUMMARY.md, then present next plan.
369
- **Overwrite guard:** If the SUMMARY.md file already exists from a previous run, delete it first with `rm -f <path>` before writing the new version. Never append to or skip an existing SUMMARY.md — always overwrite with the current sprint's completion data.
370
-
371
- 3. After all plans: proceed to verification (same as normal mode).
372
-
373
- **Benefits of interactive mode:**
374
- - No subagent overhead — dramatically lower token usage
375
- - User catches mistakes early — saves costly verification cycles
376
- - Maintains rcode's planning/tracking structure
377
- - Best for: small phases, bug fixes, verification gaps, learning rcode
345
+ ```bash
346
+ INTERACTIVE_MODE=$([[ "$ARGUMENTS" =~ (^|[[:space:]])--interactive($|[[:space:]]) ]] && echo true || echo false)
347
+ ```
348
+ ${INTERACTIVE_MODE === 'true' ? '@.rcode/references/execute-interactive-mode.md' : ''}
378
349
 
379
350
  **Skip to handle_branching step** (interactive plans execute inline after grouping).
380
351
  </step>
@@ -384,7 +355,7 @@ Check `branching_strategy` from init:
384
355
 
385
356
  **"none":** Skip, continue on current branch.
386
357
 
387
- **"phase" or "milestone":** Use pre-computed `branch_name` from init:
358
+ **"phase" or "milestone":** `init execute` does not return `branch_name` (see the "initialize" step's field notes above) — compute `BRANCH_NAME` from `workflow.branch_pattern` config (default `<phase>-<plan>-<slug>`) before running:
388
359
  ```bash
389
360
  git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
390
361
  ```
@@ -393,7 +364,7 @@ All subsequent commits go to this branch. User handles merging.
393
364
  </step>
394
365
 
395
366
  <step name="validate_phase">
396
- From init JSON: `phase_dir`, `plan_count`, `incomplete_count`.
367
+ From init JSON: `phase_dir` (real); `plan_count` derives as `plans.length`; `incomplete_count` has no source at this point (see the "initialize" step's field notes) — treat as unknown until `phase-plan-index` runs.
397
368
 
398
369
  Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)"
399
370
 
@@ -434,10 +405,8 @@ Report:
434
405
  ```
435
406
  </step>
436
407
 
437
-
438
408
  @rcode/workflows/execute-waves.md
439
409
 
440
-
441
410
  <step name="checkpoint_handling">
442
411
  Plans with `autonomous: false` require user interaction.
443
412
 
@@ -561,7 +530,7 @@ Selected wave finished successfully. This phase still has incomplete plans, so p
561
530
  <step name="run_verify_commands">
562
531
  **Run per-task `<verify>` shell commands from all completed SPRINT.md plans.**
563
532
 
564
- 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.
533
+ After all executor agents finish, extract and run any `<verify>` blocks defined in plan tasks. These are the machine-executable proof that a task's `<done>` criteria are met — the plan schema has no such tag; `<verify><automated>` plus `<evidence>` grounding are what the planner and executor actually emit and enforce.
565
534
 
566
535
  ```bash
567
536
  # Extract all <verify> blocks from all SPRINT.md files for this phase
@@ -646,7 +615,7 @@ generated: <ISO timestamp>
646
615
  Group findings by severity. For each finding include: file path, line reference, description, recommended fix.
647
616
 
648
617
  ${REVIEWER_SKILLS}",
649
- subagent_type="rcode-code-reviewer",
618
+ subagent_type="rcode-reviewer",
650
619
  model="${REVIEWER_MODEL}"
651
620
  )
652
621
  ```
@@ -740,59 +709,16 @@ Only when the gate is clean or the user overrides do we proceed to close_parent_
740
709
 
741
710
  **Skip if** phase number has no decimal (e.g., `3`, `04`) — only applies to gap-closure phases like `4.1`, `03.1`.
742
711
 
743
- **1. Detect decimal phase and derive parent:**
744
- ```bash
745
- # Check if phase_number contains a decimal
746
- if [[ "$PHASE_NUMBER" == *.* ]]; then
747
- PARENT_PHASE="${PHASE_NUMBER%%.*}"
748
- fi
749
- ```
750
-
751
- **2. Find parent UAT file:**
752
- ```bash
753
- PARENT_INFO=$(node ".rcode/bin/rcode-tools.cjs" find-phase "${PARENT_PHASE}" --raw)
754
- # Extract directory from PARENT_INFO JSON, then find UAT file in that directory
755
- ```
756
-
757
- **If no parent UAT found:** Skip this step (gap-closure may have been triggered by VERIFICATION.md instead).
758
-
759
- **3. Update UAT gap statuses:**
760
-
761
- Read the parent UAT file's `## Gaps` section. For each gap entry with `status: failed`:
762
- - Update to `status: resolved`
763
-
764
- **4. Update UAT frontmatter:**
765
-
766
- If all gaps now have `status: resolved`:
767
- - Update frontmatter `status: diagnosed` → `status: resolved`
768
- - Update frontmatter `updated:` timestamp
769
-
770
- **5. Resolve referenced debug sessions:**
771
-
772
- For each gap that has a `debug_session:` field:
773
- - Read the debug session file
774
- - Update frontmatter `status:` → `resolved`
775
- - Update frontmatter `updated:` timestamp
776
- - Move to resolved directory:
777
712
  ```bash
778
- mkdir -p .planning/debug/resolved
779
- mv .planning/debug/{slug}.md .planning/debug/resolved/
780
- ```
781
-
782
- **6. Commit updated artifacts:**
783
- ```bash
784
- node ".rcode/bin/rcode-tools.cjs" commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-UAT.md .planning/debug/resolved/*.md
713
+ IS_GAP_CLOSURE_PHASE=$([[ "$PHASE_NUMBER" == *.* ]] && echo true || echo false)
785
714
  ```
715
+ ${IS_GAP_CLOSURE_PHASE === 'true' ? '@.rcode/references/execute-close-parent-artifacts.md' : ''}
786
716
  </step>
787
717
 
788
-
789
718
  @rcode/workflows/execute-regression-gates.md
790
719
 
791
-
792
-
793
720
  @rcode/workflows/execute-verify-phase-goal.md
794
721
 
795
-
796
722
  <step name="uat_gate" priority="blocker">
797
723
  **UAT gate:**
798
724
 
@@ -822,10 +748,10 @@ fi
822
748
  ```
823
749
  ⚠ Phase {X} EXECUTED but not yet verified.
824
750
 
825
- The following acceptance criteria require human verification before
751
+ The following task completion criteria require human verification before
826
752
  the phase can advance to `status: complete`:
827
753
 
828
- {list AC items from SPRINT.md}
754
+ {list each task's <done> sentence from SPRINT.md}
829
755
 
830
756
  Recommended next steps:
831
757
  /rcode-add-tests {X} — generate unit + E2E tests before UAT
@@ -838,7 +764,7 @@ fi
838
764
  **If `VERIFICATION_STATUS` is `fail`:**
839
765
 
840
766
  1. Mark the phase as `status: executed` (so /rcode-plan --gaps can run a closure cycle).
841
- 2. Surface the failed AC items.
767
+ 2. Surface the tasks whose `<done>` criteria failed human verification.
842
768
  3. STOP. Don't mark complete on a failing verification.
843
769
 
844
770
  **Only when `VERIFICATION_STATUS` is `pass`** — proceed to `update_roadmap` below.
@@ -899,24 +825,13 @@ node ".rcode/bin/rcode-tools.cjs" commit "docs(phase-{X}): complete phase execut
899
825
  <step name="auto_copy_learnings">
900
826
  **Auto-copy phase learnings to global store (when enabled).**
901
827
 
902
- This step runs AFTER phase completion and SUMMARY.md is written. It copies any LEARNINGS.md
903
- entries from the completed phase to the global learnings store at `.rcode/knowledge/`.
904
-
905
828
  **Check config gate:**
906
829
  ```bash
907
830
  GL_ENABLED=$(node ".rcode/bin/rcode-tools.cjs" config-get features.global_learnings --raw 2>/dev/null || echo "false")
908
831
  ```
909
832
 
910
833
  **If `GL_ENABLED` is not `true`:** Skip this step entirely (feature disabled by default).
911
-
912
- **If enabled:**
913
-
914
- 1. Check if LEARNINGS.md exists in the phase directory (use the `phase_dir` value from init context)
915
- 2. If found, copy to global store:
916
- ```bash
917
- node ".rcode/bin/rcode-tools.cjs" learnings copy 2>/dev/null || echo "⚠ Learnings copy failed — continuing"
918
- ```
919
- Copy failure must NOT block phase completion.
834
+ ${GL_ENABLED === 'true' ? '@.rcode/references/execute-auto-copy-learnings.md' : ''}
920
835
  </step>
921
836
 
922
837
  <step name="update_project_md">
@@ -947,21 +862,10 @@ node ".rcode/bin/rcode-tools.cjs" commit "docs(phase-{X}): evolve PROJECT.md aft
947
862
  Silent no-op if no webhook URLs are in `.rcode/config.yaml`. Failures are reported but never block the workflow.
948
863
 
949
864
  ```bash
950
- node ".rcode/bin/rcode-tools.cjs" notify send \
951
- --title "Phase ${phase_number} complete ${phase_name}" \
952
- --body "$(basename "$PWD") · $(git rev-parse --short HEAD) · ${incomplete_count:-0} plan(s) remaining" \
953
- --event "execute-done" 2>/dev/null || true
865
+ WEBHOOK_CONFIGURED=$(node ".rcode/bin/rcode-tools.cjs" config-get slack_webhook_url 2>/dev/null; node ".rcode/bin/rcode-tools.cjs" config-get discord_webhook_url 2>/dev/null; node ".rcode/bin/rcode-tools.cjs" config-get teams_webhook_url 2>/dev/null)
866
+ WEBHOOK_CONFIGURED=$([ -n "$WEBHOOK_CONFIGURED" ] && echo true || echo false)
954
867
  ```
955
-
956
- Users configure webhooks by editing `.rcode/config.yaml`:
957
-
958
- ```yaml
959
- slack_webhook_url: "https://hooks.slack.com/services/..."
960
- discord_webhook_url: "https://discord.com/api/webhooks/..."
961
- teams_webhook_url: "https://outlook.office.com/webhook/..."
962
- ```
963
-
964
- Then verify with `/rcode-notify-test`.
868
+ ${WEBHOOK_CONFIGURED === 'true' ? '@.rcode/references/execute-notify-webhooks.md' : ''}
965
869
  </step>
966
870
 
967
871
  <step name="generate_tests">
@@ -1075,7 +979,7 @@ For 1M+ context models, consider:
1075
979
  </context_efficiency>
1076
980
 
1077
981
  <failure_handling>
1078
- - **classifyHandoffIfNeeded false failure:** Agent reports "failed" but error is `classifyHandoffIfNeeded is not defined` → Claude Code bug, not rcode. Spot-check (SUMMARY exists, commits present) → if pass, treat as success
982
+ - See the classifyHandoffIfNeeded workaround in execute-waves.md (already @-included above).
1079
983
  - **Agent fails mid-plan:** Missing SUMMARY.md → report, ask user how to proceed
1080
984
  - **Dependency chain breaks:** Wave 1 fails → Wave 2 dependents likely fail → user chooses attempt or skip
1081
985
  - **All agents in wave fail:** Systemic issue → stop, report for investigation
@@ -279,10 +279,10 @@ if [ -s .rcode/context/active.md ] && ! grep -q "Run \`/rcode" .rcode/context/ac
279
279
  fi
280
280
  ```
281
281
 
282
- After writing both files, refresh the memory bank fingerprint so staleness checks see the project as fresh:
282
+ After writing both files, refresh the memory bank fingerprint so staleness checks see the project as fresh. `context refresh` reads `.rcode/sources.yaml`, but nothing in rcode ever creates that file (the installer only scaffolds the unrelated `.rcode/brain/sources.yaml`, used by `brain pull`) — so on every fresh project this call is a guaranteed no-op. Skip it when the file is known not to exist rather than spending a call to learn that (#1018):
283
283
 
284
284
  ```bash
285
- node .rcode/bin/rcode-tools.cjs context refresh >/dev/null 2>&1 || true
285
+ test -f .rcode/sources.yaml && node .rcode/bin/rcode-tools.cjs context refresh >/dev/null 2>&1 || true
286
286
  ```
287
287
 
288
288
  ## Step 4c — Scaffold CLAUDE.md / AGENTS.md if missing
@@ -327,6 +327,14 @@ Or strategic question about the codebase:
327
327
  /rcode-council {your question}
328
328
  ```
329
329
 
330
+ **In all three cases, append this tip:**
331
+ ```
332
+ Tip: run /rcode-enable-hooks to turn on a one-line project status primer at
333
+ the start of every session, plus 9 other opt-in guardrails (read-before-edit
334
+ checks, dangerous-command blocking, auto-formatting). Off by default so a
335
+ fresh install never surprises you.
336
+ ```
337
+
330
338
  **If `returning` with `--reset`:**
331
339
  ```
332
340
  ✓ rcode reconfigured. Prior state preserved in state.json.
@@ -196,7 +196,7 @@ FINDINGS[security] = merge(PRIMARY, SECONDARY)
196
196
 
197
197
  ```
198
198
  RESULT = Task(
199
- subagent_type="rcode-code-reviewer",
199
+ subagent_type="rcode-reviewer",
200
200
  model="{lens_model}",
201
201
  prompt="Audit-only — do NOT optimize anything. {CONTEXT}
202
202
 
@@ -288,7 +288,7 @@ FINDINGS[extensibility] = RESULT
288
288
 
289
289
  ```
290
290
  RESULT = Task(
291
- subagent_type="rcode-code-reviewer",
291
+ subagent_type="rcode-dep-auditor",
292
292
  model="{lens_model}",
293
293
  prompt="Audit-only — do NOT install or update packages. {CONTEXT}
294
294
 
@@ -419,7 +419,7 @@ FINDINGS[documentation] = RESULT
419
419
 
420
420
  ```
421
421
  RESULT = Task(
422
- subagent_type="rcode-code-reviewer",
422
+ subagent_type="rcode-cross-platform-auditor",
423
423
  model="{lens_model}",
424
424
  prompt="Cross-platform audit — do NOT fix scripts. {CONTEXT}
425
425
 
@@ -446,7 +446,7 @@ FINDINGS[cross-platform] = RESULT
446
446
 
447
447
  ```
448
448
  PRIMARY = Task(
449
- subagent_type="rcode-code-reviewer",
449
+ subagent_type="rcode-reviewer",
450
450
  model="{lens_model}",
451
451
  prompt="Karpathy 4-principle audit — do NOT fix code. {CONTEXT}
452
452
 
@@ -516,7 +516,7 @@ FINDINGS[sxo] = RESULT
516
516
 
517
517
  ```
518
518
  RESULT = Task(
519
- subagent_type="rcode-code-reviewer",
519
+ subagent_type="rcode-observability-auditor",
520
520
  model="{lens_model}",
521
521
  prompt="Observability audit — do NOT add instrumentation. {CONTEXT}
522
522
 
@@ -559,7 +559,7 @@ PRIMARY = Task(
559
559
  )
560
560
 
561
561
  SECONDARY = Task(
562
- subagent_type="rcode-code-reviewer",
562
+ subagent_type="rcode-reviewer",
563
563
  model="{lens_model}",
564
564
  prompt="Variable naming audit in recent code changes. {CONTEXT}
565
565
 
@@ -619,7 +619,7 @@ FINDINGS[coverage] = merge(PRIMARY, SECONDARY)
619
619
 
620
620
  ```
621
621
  PRIMARY = Task(
622
- subagent_type="rcode-code-reviewer",
622
+ subagent_type="rcode-reviewer",
623
623
  model="{lens_model}",
624
624
  prompt="YAGNI / over-engineering audit — do NOT fix code. {CONTEXT}
625
625
 
@@ -157,9 +157,12 @@ test -f "${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md" && echo "VALIDATION_CREATED
157
157
  > Skip if `workflow.security_enforcement` is explicitly `false`. Absent = enabled.
158
158
 
159
159
  ```bash
160
- SECURITY_CFG=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
161
- SECURITY_ASVS=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.security_asvs_level --raw 2>/dev/null || echo "1")
162
- SECURITY_BLOCK=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.security_block_on --raw 2>/dev/null || echo "high")
160
+ SECURITY_CFG=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null)
161
+ SECURITY_CFG=${SECURITY_CFG:-true} # config-get exits 0 with empty output when key absent; || fallback won't fire
162
+ SECURITY_ASVS=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.security_asvs_level --raw 2>/dev/null)
163
+ SECURITY_ASVS=${SECURITY_ASVS:-1} # config-get exits 0 with empty output when key absent; || fallback won't fire
164
+ SECURITY_BLOCK=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.security_block_on --raw 2>/dev/null)
165
+ SECURITY_BLOCK=${SECURITY_BLOCK:-high} # config-get exits 0 with empty output when key absent; || fallback won't fire
163
166
  ```
164
167
 
165
168
  **If `SECURITY_CFG` is `false`:** Skip to step 5.6.
@@ -183,8 +186,10 @@ Continue to step 5.6. Security config is passed to the planner in step 8.
183
186
  > Skip if `workflow.ui_phase` is explicitly `false` AND `workflow.ui_safety_gate` is explicitly `false` in `.rcode/config.yaml`. If keys are absent, treat as enabled.
184
187
 
185
188
  ```bash
186
- UI_PHASE_CFG=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.ui_phase 2>/dev/null || echo "true")
187
- UI_GATE_CFG=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.ui_safety_gate 2>/dev/null || echo "true")
189
+ UI_PHASE_CFG=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.ui_phase 2>/dev/null)
190
+ UI_PHASE_CFG=${UI_PHASE_CFG:-true} # config-get exits 0 with empty output when key absent; || fallback won't fire
191
+ UI_GATE_CFG=$(node ".rcode/bin/rcode-tools.cjs" config-get workflow.ui_safety_gate 2>/dev/null)
192
+ UI_GATE_CFG=${UI_GATE_CFG:-true} # config-get exits 0 with empty output when key absent; || fallback won't fire
188
193
  ```
189
194
 
190
195
  **If both are `false`:** Skip to step 6.
@@ -114,7 +114,7 @@ ${AGENT_SKILLS_PLANNER}
114
114
  <downstream_consumer>
115
115
  Output consumed by /rcode-execute. Plans need:
116
116
  - Frontmatter (wave, depends_on, autonomous, **files_modified** — aggregated list of all file paths from `<files>` blocks across every task; used by executor for intra-wave parallel-safety overlap detection)
117
- - Tasks in XML format with read_first, files, acceptance_criteria, verify (with `<automated>` child), and done fields (MANDATORY on every task)
117
+ - Tasks in XML format with read_first, files, evidence, verify (with `<automated>` child), and done fields (MANDATORY on every task)
118
118
  - Verification criteria
119
119
  - must_haves for goal-backward verification
120
120
  - **`## Files Touched`** section (see below) — required on every SPRINT.md
@@ -257,17 +257,13 @@ Every task MUST include these fields — they are NOT optional:
257
257
  - Executor checkpoint (knows what to stage after each task)
258
258
  - Example: `src/auth/auth.service.ts`, `tests/auth/auth.service.test.ts`
259
259
 
260
- 3. **`<acceptance_criteria>`** — Verifiable conditions that prove the task was done correctly. Rules:
261
- - Every criterion must be checkable with grep, file read, test command, or CLI output
262
- - NEVER use subjective language ("looks correct", "properly configured", "consistent with")
263
- - ALWAYS include exact strings, patterns, values, or command outputs that must be present
264
- - Examples:
265
- - Code: `auth.py contains def verify_token(` / `test_auth.py exits 0`
266
- - Config: `.env.example contains DATABASE_URL=` / `Dockerfile contains HEALTHCHECK`
267
- - Docs: `README.md contains '## Installation'` / `API.md lists all endpoints`
268
- - Infra: `deploy.yml has rollback step` / `docker-compose.yml has healthcheck for db`
269
-
270
- 4. **`<verify>`** — Shell commands that PROVE the acceptance criteria are met. Run by executor after task completes and by verifier during post-execution check. The block MUST contain an `<automated>` child with the exact commands to run (Dimension 8 hard-blocks without it). Rules:
260
+ 3. **`<evidence>`** — REQUIRED (issue #649). Must show codebase grounding proving the task is real, not theoretical. At minimum one of:
261
+ - `grep:` a literal grep/Glob pattern + count of matches that justified this task (e.g. `` `rg '\.alert' apps/web/src` → 13 hits across 9 files ``)
262
+ - `lines:` exact `path:line-line` ranges of code being modified
263
+ - `creates:` the file paths being created from scratch (with one-line justification why no existing file fits)
264
+ A task without `<evidence>` is theoretical and MUST NOT be written. (Matches `rcode/references/planner-playbook.md`'s "Task Anatomy" section — single source of truth for this rule.)
265
+
266
+ 4. **`<verify>`** — Shell commands that PROVE the `<done>` criteria are met. Run by executor after task completes and by verifier during post-execution check. The block MUST contain an `<automated>` child with the exact commands to run (Dimension 8 hard-blocks without it). Rules:
271
267
  - `<automated>` commands must exit 0 on success, non-zero on failure
272
268
  - Prefer `grep -q` for presence checks, `test -f` for file existence, project test runner for behavior
273
269
  - Keep commands short and composable — one check per line
@@ -325,7 +321,7 @@ Every task MUST include these fields — they are NOT optional:
325
321
  - [ ] Tasks are specific and actionable
326
322
  - [ ] Every task has `<read_first>` with at least the file being modified
327
323
  - [ ] Every task has `<files>` listing exact files this task will modify or create
328
- - [ ] Every task has `<acceptance_criteria>` with grep-verifiable conditions
324
+ - [ ] Every task has `<evidence>` with grep/lines/creates codebase grounding per issue #649 — not a prose checklist tag (none exists in the real plan schema)
329
325
  - [ ] Every task has `<verify>` with an `<automated>` child containing at least one shell command (Dimension 8 blocker)
330
326
  - [ ] Every task has `<done>` with a single observable acceptance sentence (Dimension 2 requirement)
331
327
  - [ ] Every `<action>` contains concrete values (no "align X with Y" without specifying what)
@@ -351,7 +347,6 @@ Fix issues inline. No sub-agent needed — this is a quick self-check before the
351
347
  Task(
352
348
  prompt=filled_prompt,
353
349
  subagent_type="rcode-planner",
354
- model="{model}",
355
350
  model="{planner_model}",
356
351
  description="Plan Phase {phase}"
357
352
  )