@hanzlaa/rcode 4.7.2 → 4.8.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 (82) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +1 -1
  3. package/CONTRIBUTING.md +4 -0
  4. package/cli/github-sync.js +17 -201
  5. package/cli/lib/config.cjs +1 -1
  6. package/cli/lib/github-sync-discover.cjs +304 -0
  7. package/cli/lib/namespace-migrate.cjs +16 -1
  8. package/cli/uninstall.js +7 -2
  9. package/dist/rcode.js +194 -194
  10. package/package.json +1 -1
  11. package/rcode/agents/rcode-haitham.md +1 -1
  12. package/rcode/agents/rcode-hanzla.md +1 -1
  13. package/rcode/agents/rcode-hussain-pm.md +1 -1
  14. package/rcode/agents/rcode-nyquist-auditor.md +1 -1
  15. package/rcode/agents/rcode-omar.md +1 -1
  16. package/rcode/agents/rcode-remediation-planner.md +1 -1
  17. package/rcode/agents/rcode-waleed.md +1 -1
  18. package/rcode/agents/rcode-yousef.md +1 -1
  19. package/rcode/agents/rules/planner/task-templates.md +24 -22
  20. package/rcode/agents/rules/verifier/verification-report.md +2 -2
  21. package/rcode/bin/lib/roadmap.cjs +80 -4
  22. package/rcode/bin/rcode-tools.cjs +18 -1
  23. package/rcode/brain/best-practices/state-sync-rule.md +1 -1
  24. package/rcode/references/council-protocol.md +9 -4
  25. package/rcode/references/execute-auto-copy-learnings.md +15 -0
  26. package/rcode/references/execute-close-parent-artifacts.md +49 -0
  27. package/rcode/references/execute-interactive-mode.md +44 -0
  28. package/rcode/references/execute-notify-webhooks.md +22 -0
  29. package/rcode/references/execution-protocol.md +11 -11
  30. package/rcode/references/git-preflight.md +2 -2
  31. package/rcode/references/plan-gaps-mode.md +89 -0
  32. package/rcode/references/plan-thinking-partner.md +20 -0
  33. package/rcode/references/plan-windows-troubleshooting.md +25 -0
  34. package/rcode/references/planner-playbook.md +23 -29
  35. package/rcode/skills/_shared/state-sync-rule.md +1 -1
  36. package/rcode/skills/actions/1-analysis/rcode-document-project/SKILL.md +2 -0
  37. package/rcode/skills/actions/1-analysis/rcode-prfaq/SKILL.md +2 -0
  38. package/rcode/skills/actions/2-plan/rcode-create-epics-and-stories/SKILL.md +11 -0
  39. package/rcode/skills/actions/2-plan/rcode-create-prd/SKILL.md +2 -0
  40. package/rcode/skills/actions/2-plan/rcode-create-story/SKILL.md +11 -0
  41. package/rcode/skills/actions/2-plan/rcode-edit-prd/SKILL.md +2 -0
  42. package/rcode/skills/actions/2-plan/rcode-validate-prd/SKILL.md +2 -0
  43. package/rcode/skills/actions/3-solutioning/rcode-check-implementation-readiness/SKILL.md +2 -0
  44. package/rcode/skills/actions/3-solutioning/rcode-create-architecture/SKILL.md +2 -0
  45. package/rcode/skills/actions/4-implementation/rcode-checkpoint-preview/SKILL.md +2 -0
  46. package/rcode/skills/actions/4-implementation/rcode-code-review/SKILL.md +2 -0
  47. package/rcode/skills/actions/4-implementation/rcode-correct-course/SKILL.md +2 -0
  48. package/rcode/skills/actions/4-implementation/rcode-debug/SKILL.md +1 -1
  49. package/rcode/skills/actions/4-implementation/rcode-dev-story/SKILL.md +2 -0
  50. package/rcode/skills/actions/4-implementation/rcode-retrospective/SKILL.md +2 -0
  51. package/rcode/skills/actions/4-implementation/rcode-scaffold-project/SKILL.md +2 -0
  52. package/rcode/skills/actions/4-implementation/rcode-sprint-planning/SKILL.md +3 -2
  53. package/rcode/skills/actions/4-implementation/rcode-sprint-status/SKILL.md +2 -0
  54. package/rcode/skills/agents/haitham-frontend/SKILL.md +6 -0
  55. package/rcode/skills/agents/hanzla-engineer/SKILL.md +6 -0
  56. package/rcode/skills/agents/hussain-pm/SKILL.md +1 -1
  57. package/rcode/skills/agents/hussain-sm/SKILL.md +3 -3
  58. package/rcode/skills/agents/majlis-council/references.md +17 -7
  59. package/rcode/skills/agents/raees-orchestrator/SKILL.md +13 -11
  60. package/rcode/skills/agents/yousef-backend/SKILL.md +6 -0
  61. package/rcode/templates/github/epic-template.md +1 -1
  62. package/rcode/templates/github/feature-template.md +1 -1
  63. package/rcode/templates/github/task-template.md +1 -1
  64. package/rcode/templates/sprint.md +14 -3
  65. package/rcode/templates/verification-report.md +7 -4
  66. package/rcode/workflows/code-review-fix.md +5 -5
  67. package/rcode/workflows/code-review.md +1 -1
  68. package/rcode/workflows/council.md +1 -0
  69. package/rcode/workflows/create-epics-and-stories.md +12 -6
  70. package/rcode/workflows/dev-story.md +12 -14
  71. package/rcode/workflows/do.md +12 -9
  72. package/rcode/workflows/execute-sprint.md +4 -0
  73. package/rcode/workflows/execute-waves.md +44 -1
  74. package/rcode/workflows/execute.md +20 -119
  75. package/rcode/workflows/lens-audit.md +7 -7
  76. package/rcode/workflows/plan-spawn-planner.md +0 -1
  77. package/rcode/workflows/plan.md +25 -136
  78. package/rcode/workflows/quick.md +1 -1
  79. package/rcode/workflows/sprint-planning.md +14 -37
  80. package/server/lib/html/client/components/shared.js +21 -1
  81. package/server/lib/html/client/views/SprintsView.js +3 -3
  82. package/server/lib/scanner.js +7 -4
@@ -13,9 +13,20 @@
13
13
 
14
14
  ## Stories
15
15
 
16
- | ID | Title | Points | Status | Done when |
17
- |----|-------|--------|--------|-----------|
18
- | {story_id} | {title} | {points} | {status} | {verifiable_ac} |
16
+ <!-- One <task> block per story. id= and <title> are REQUIRED (scanner.js's primary parse path) -->
17
+ <tasks>
18
+ <task id="{sprint_id}.{NN}" type="auto">
19
+ <title>{story title}</title>
20
+ <read_first>{files + line ranges the executor must read before writing}</read_first>
21
+ <files>{exact paths this task creates/modifies}</files>
22
+ <action>{specific implementation instructions}</action>
23
+ <verify>
24
+ <automated>{command < 60 sec}</automated>
25
+ </verify>
26
+ <done>{measurable acceptance criteria}</done>
27
+ <evidence>{grep/lines/creates evidence per issue #649}</evidence>
28
+ </task>
29
+ </tasks>
19
30
 
20
31
  ## Capacity
21
32
 
@@ -10,11 +10,14 @@ phase: NN
10
10
  phase_name: <slug>
11
11
  verifier: <agent / human>
12
12
  verified_at: <ISO date>
13
- verdict: pass | fail | partial
13
+ status: passed | gaps_found | human_needed
14
14
  goal_source: ROADMAP.md (commit-sha-at-phase-start)
15
15
  ---
16
16
  ```
17
17
 
18
+ `status` is the ONLY key `execute.md`'s `uat_gate` step reads (`grep -qE "^status:[[:space:]]*passed"`). Do not
19
+ substitute `result`, `verdict`, or `outcome` — a wrong key silently strands the phase at `status: executed` forever.
20
+
18
21
  ## Sections
19
22
 
20
23
  ### Phase goal (verbatim)
@@ -63,9 +66,9 @@ What the phase changed BEYOND the goal. Often these are silent:
63
66
 
64
67
  Each side effect should be intentional and documented.
65
68
 
66
- ### Verdict reasoning
69
+ ### Status reasoning
67
70
 
68
- One paragraph explaining why the verdict (pass / fail / partial) was chosen. Include any judgment calls.
71
+ One paragraph explaining why the status (passed / gaps_found / human_needed) was chosen. Include any judgment calls.
69
72
 
70
73
  ### Follow-ups
71
74
 
@@ -79,5 +82,5 @@ Issues filed (or to file) for gaps surfaced during verification:
79
82
  ```
80
83
  Verifier: <name or agent id>
81
84
  Date: <ISO>
82
- Verdict: <verdict from frontmatter>
85
+ Status: <status from frontmatter>
83
86
  ```
@@ -1,5 +1,5 @@
1
1
  <purpose>
2
- Auto-fix issues from REVIEW.md. Validates phase, checks config gate, verifies REVIEW.md exists and has fixable issues, spawns rcode-fixer agent, handles --auto iteration loop (capped at 3), commits REVIEW-FIX.md once at the end, and presents results.
2
+ Auto-fix issues from REVIEW.md. Validates phase, checks config gate, verifies REVIEW.md exists and has fixable issues, spawns rcode-code-fixer agent, handles --auto iteration loop (capped at 3), commits REVIEW-FIX.md once at the end, and presents results.
3
3
  </purpose>
4
4
 
5
5
  <required_reading>
@@ -9,7 +9,7 @@ Read all files referenced by the invoking prompt's execution_context before star
9
9
  </required_reading>
10
10
 
11
11
  <available_agent_types>
12
- - rcode-fixer: Applies fixes to code review findings
12
+ - rcode-code-fixer: Applies fixes to code review findings
13
13
  - rcode-reviewer: Reviews source files for bugs and issues
14
14
  </available_agent_types>
15
15
 
@@ -202,7 +202,7 @@ If REVIEW.md contains a `files_reviewed_list` frontmatter field, use that as the
202
202
  </step>
203
203
 
204
204
  <step name="spawn_fixer">
205
- Spawn the rcode-fixer agent with config:
205
+ Spawn the rcode-code-fixer agent with config:
206
206
 
207
207
  ```bash
208
208
  # Build config for agent
@@ -295,7 +295,7 @@ if [ "$AUTO_MODE" = "true" ]; then
295
295
 
296
296
  # Spawn rcode-reviewer agent to re-review
297
297
  # (This overwrites REVIEW_PATH with latest review state)
298
- Task(subagent_type="rcode-code-reviewer",
298
+ Task(subagent_type="rcode-reviewer",
299
299
  model="{model}", prompt="
300
300
  <config>
301
301
  depth: ${REVIEW_DEPTH}
@@ -527,7 +527,7 @@ echo "════════════════════════
527
527
 
528
528
  - [ ] Config gate (`workflow.code_review`) verified before any agent is spawned
529
529
  - [ ] `REVIEW.md` confirmed present at `.planning/phases/<N>/REVIEW.md`; workflow exits with explicit error if missing
530
- - [ ] `rcode-fixer` agent spawned with correct `review_path`, `fix_scope`, and `fix_report_path`
530
+ - [ ] `rcode-code-fixer` agent spawned with correct `review_path`, `fix_scope`, and `fix_report_path`
531
531
  - [ ] `--auto` iteration loop capped at 3 rounds; each round re-reviews only the original file scope
532
532
  - [ ] `REVIEW-FIX.md` committed exactly once at the end of all iterations (not per iteration)
533
533
  - [ ] Results presented inline with a concrete next-step suggestion (e.g., `git log --oneline`)
@@ -388,7 +388,7 @@ done
388
388
  Spawn the rcode-reviewer agent:
389
389
 
390
390
  ```
391
- Task(subagent_type="rcode-code-reviewer",
391
+ Task(subagent_type="rcode-reviewer",
392
392
  model="{model}", prompt="
393
393
  <files_to_read>
394
394
  ${FILES_TO_READ}
@@ -157,6 +157,7 @@ Parse the JSON for:
157
157
  - `flags.explain` — boolean, show panel scoring
158
158
  - `panel` — string[], the pre-computed panel (respects `--full` and `--agents`)
159
159
  - `scores` — object, per-agent scoring for explain mode
160
+ - `domain` — string, the detected question domain (`fe`/`be`/`ml`/`deploy`/`strategic`/`market`/`general`) — always populated, used for the `Domain:` banner field
160
161
  - `question_type` — `"codebase" | "discovery" | "market" | "greenfield"` — drives Step 1 branching
161
162
  - `question_signals` — string[], matched phrases that drove the classification
162
163
  - `config` — `{ user_name, project_name, language, mode }` from `.rcode/config.yaml`
@@ -4,6 +4,16 @@
4
4
  Parse a PRD, PROJECT.md, or project document to generate numbered epic files in `.planning/epics/`. Each epic file contains user stories with acceptance criteria, development notes, and effort estimates. Output is ready for `/rcode-sprint-planning`.
5
5
  </purpose>
6
6
 
7
+ > **Note (experimental, no execution consumer):** the epics/stories/dev-story pipeline this
8
+ > workflow is part of is not wired to `/rcode-execute` today — `rcode-executor` only reads
9
+ > `*-SPRINT.md` files (see `rcode/agents/rcode-executor.md`). The only way to "run" a story
10
+ > produced here is the manual `/rcode {dev-prompt-file}` invocation documented in
11
+ > `rcode/workflows/dev-story.md`, which has none of `/rcode-execute`'s atomic-commit,
12
+ > checkpoint, wave, or verification machinery. Treat this pipeline as experimental /
13
+ > unsupported for production execution until a decision is made to either wire it to
14
+ > `/rcode-execute` or deprecate it in favor of the SPRINT.md pipeline (see
15
+ > `AUDIT-redundant-work.md` finding 2).
16
+
7
17
 
8
18
  <available_agent_types>
9
19
  - `rcode-roadmapper` — reads PRD/context and generates epic structure
@@ -378,11 +388,7 @@ If arguments are invalid, missing files, or subagent fails:
378
388
 
379
389
  ## ▶ Next Up
380
390
 
381
- - /rcode-sprint-planning
382
- - /rcode-dev-story {story-id}
383
- - /rcode-edit-prd
384
-
385
- ## Next Up
386
-
387
391
  - `/rcode-sprint-planning` — plan the sprint from the generated epic files
392
+ - `/rcode-dev-story {story-id}`
393
+ - `/rcode-edit-prd`
388
394
  - `/rcode-create-story` — develop individual stories into self-contained STORY.md files
@@ -336,11 +336,9 @@ This story is "Done" when all items in checklist-story-dod.md are checked:
336
336
 
337
337
  ## Running This Story
338
338
 
339
- To execute with an AI coder:
340
-
341
- ```bash
342
- /rcode .planning/dev-sessions/{story-id}-dev-prompt.md
343
- ```
339
+ This file is the execution context for an AI coder — there is no standalone command that consumes it directly. Either:
340
+ - Continue in the session that has this context loaded and say "let's build this," or
341
+ - Fold the story into a phase (`/rcode-add-phase`) and run `/rcode-execute {phase-number}` for a full plan/build cycle with checkpoints.
344
342
 
345
343
  ---
346
344
 
@@ -388,7 +386,9 @@ Acceptance Criteria: {count}
388
386
 
389
387
  Context file: {path to dev-prompt.md}
390
388
 
391
- Next: /rcode {path to dev-prompt.md}
389
+ Ready to code this story? Two real options:
390
+ 1. Continue this session — I already have full story context loaded, just say "let's build this"
391
+ 2. Fold it into a phase (/rcode-add-phase) and run /rcode-execute {phase-number} for a full plan/build cycle with checkpoints
392
392
 
393
393
  Or, continue the current session to:
394
394
  - Ask clarifying questions
@@ -396,24 +396,22 @@ Or, continue the current session to:
396
396
  - Review dependencies
397
397
  ```
398
398
 
399
- ## Step 6 — Optional: Spawn AI Coder
399
+ ## Step 6 — Next Step: Continue or Fold Into a Phase
400
400
 
401
- If user says "start coding" or "let's build", spawn the code execution workflow:
401
+ There is no standalone command that consumes a dev-prompt.md file directly (`/rcode`, no hyphen, does not exist — every rcode command is hyphenated). This step never spawns anything; it only tells the user how to proceed.
402
402
 
403
- ```bash
404
- # User says "let's go" or "start", then:
405
- /rcode "$DEV_PROMPT_FILE"
406
- ```
403
+ If the user says "start coding" or "let's build", continue implementing directly in the current session — it already has the full story context loaded from Step 3-4.
407
404
 
408
405
  Otherwise, offer:
409
406
 
410
407
  ```
411
408
  Ready to code this story?
412
409
 
413
- /rcode {dev-prompt-file}
410
+ 1. Continue in this session — say "let's build this" and I'll implement it directly.
411
+ 2. Fold it into a phase (/rcode-add-phase) and run /rcode-execute {phase-number} for a full plan/build cycle with checkpoints.
414
412
  ```
415
413
 
416
- Stop and wait for user to proceed. Do NOT auto-spawn.
414
+ Stop and wait for user to proceed. Do NOT auto-spawn — this workflow only wraps the story, it never executes it.
417
415
 
418
416
  ## Errors
419
417
 
@@ -6,10 +6,11 @@ Analyze freeform text from the user and route to the most appropriate rcode comm
6
6
  @.rcode/references/auto-init-guard.md
7
7
  @.rcode/references/output-format.md
8
8
  @.rcode/references/verb-dictionary.md
9
- @.rcode/references/dispatch-banner.md
10
9
  Read all files referenced by the invoking prompt's execution_context before starting.
11
10
  </required_reading>
12
11
 
12
+ `.rcode/references/dispatch-banner.md` is NOT required reading here — its banner format is scoped to real `Task(subagent_type=...)` spawns. `/rcode-do` never spawns a Task/subagent (see guardrails); it only dispatches via the `Skill` tool, so it uses the plain `ROUTING` banner defined in the `display` step below.
13
+
13
14
  <process>
14
15
 
15
16
  <step name="auto_init_check">
@@ -71,7 +72,7 @@ Match if `$QUESTION` starts with `@<persona> <CODE>` or `@<persona>:<CODE>` —
71
72
  {list from the persona's Capabilities table}
72
73
  ```
73
74
  And stop. Do not fall back to fuzzy intent matching — the user used the deterministic API, honour it.
74
- 5. Dispatch directly via the routing banner. Skip greenfield_guard / external_data_guard / explicit_intent_check / route — the user already chose the persona AND the action. The persona itself can still refuse internally if its preconditions aren't met.
75
+ 5. Dispatch directly: show the plain `ROUTING` banner (the `display` step's format — "Routing to: {chosen command}") and call the `Skill` tool. Skip greenfield_guard / external_data_guard / explicit_intent_check / route — the user already chose the persona AND the action. This is a `Skill()` dispatch, not a `Task(subagent_type=...)` spawn, so it does NOT use the persona-voiced `dispatch-banner.md` format. The persona itself can still refuse internally if its preconditions aren't met.
75
76
 
76
77
  **This is the deterministic API surface.** Power users (and other agents in council follow-ups) can invoke specific capabilities without re-reading triggers or risking fuzzy match. It's the cheapest way to get repeatable behaviour out of the persona system.
77
78
 
@@ -423,15 +424,17 @@ If the chosen command expects a phase number and one wasn't provided in the text
423
424
  </process>
424
425
 
425
426
  <guardrails>
426
- **Hard prohibitions during /rcode-do execution (issue #458):**
427
+ **Hard prohibitions during /rcode-do execution (issue #458, refined by #1007):**
428
+
429
+ The steps above (`parse_args`, `check_project`, `auto_init_check`, `greenfield_guard`, `explicit_intent_check`, `persona_shortcut`) legitimately call Bash for structured state/config lookups (`rcode-tools.cjs state load`, `progress init`, `config-get mode`, `classify-question`, milestone/PRD/epic detection via `ls`/`grep`) and Read for the specific persona/capability-table lookup in `persona_shortcut` step 2. That is routing plumbing, not investigation, and is allowed. What's prohibited is using those same tools to figure out the route by inspecting application code, or to do the routed work itself:
427
430
 
428
- - MUST NOT call Bash, Read, Grep, Glob, Write, or Edit tools. The dispatcher does not investigate, read code, or write files. Period.
429
- - MUST NOT spawn Task / Agent / subagents. Dispatch is a Skill tool call to a routed command — nothing else.
430
- - MUST NOT "do a quick check" before routing. If you feel the urge to grep or read a file to "figure out the right route," the dispatcher contract has already failed STOP and use the no-route exit.
431
- - The ONLY tools allowed inside /rcode-do are: AskUserQuestion (for disambiguation), Skill (for dispatch), and the one Bash call to the classifier (`classify-question`). Nothing else.
431
+ - MUST NOT use Bash/Read/Grep/Glob to explore or read application source code to guess what a vague request means. The state/config lookups named above are the only sanctioned uses — anything beyond them (grepping `src/`, reading a feature file to understand behavior, etc.) means the dispatcher contract has failed — STOP and use the no-route exit instead.
432
+ - MUST NOT call Write or Edit. The dispatcher never modifies files.
433
+ - MUST NOT spawn Task / Agent / subagents. Dispatch is a `Skill` tool call to a routed commandnothing else.
434
+ - MUST NOT "do a quick check" of source code before routing. If you feel the urge to grep or read application code to "figure out the right route," the dispatcher contract has already failed — STOP and use the no-route exit.
432
435
  - If the user's input doesn't match any route and the classifier is ambiguous: invoke the no-route exit menu. Do not "be helpful" by executing the work yourself.
433
436
 
434
- Why this is hard: do.md is a router. The moment it does work, two failure modes appear: (a) the work is duplicated when the user re-invokes the proper command, or (b) the work happens in the wrong context with the wrong subagent and produces inferior output. Both are worse than a 1-second routing prompt.
437
+ Why this is hard: do.md is a router. The moment it does the work itself (as opposed to looking up state to decide *where to route*), two failure modes appear: (a) the work is duplicated when the user re-invokes the proper command, or (b) the work happens in the wrong context with the wrong subagent and produces inferior output. Both are worse than a 1-second routing prompt.
435
438
  </guardrails>
436
439
 
437
440
  <success_criteria>
@@ -444,7 +447,7 @@ Why this is hard: do.md is a router. The moment it does work, two failure modes
444
447
  - [ ] Command invoked via the Skill tool — NOT printed as text
445
448
  - [ ] Dispatch banner not repeated (single emission only)
446
449
  - [ ] No work done directly — dispatcher only
447
- - [ ] No Bash/Read/Grep/Write/Edit/Task tool calls during execution (only AskUserQuestion + Skill + classifier Bash)
450
+ - [ ] No Write/Edit/Task tool calls, and no Bash/Read/Grep/Glob use beyond the sanctioned state/config lookups and persona/capability-table reads
448
451
  - [ ] On no-route, exit cleanly with the disambiguation menu — never silently fall through to inline work
449
452
  </success_criteria>
450
453
  </content>
@@ -378,6 +378,8 @@ If new untracked files appeared after running scripts or tools, decide for each:
378
378
  <hook_revert_detection_gate>
379
379
  ## Post-Step Hook Revert Detection Gate
380
380
 
381
+ <!-- See also <post_step_revert_gate> below — catches a different revert shape (shrunk, not identical) -->
382
+
381
383
  After each task that writes or edits files, run:
382
384
  ```bash
383
385
  git diff --name-only HEAD
@@ -394,6 +396,8 @@ Do not proceed to the next task until all expected file changes survive the git
394
396
  <post_step_revert_gate>
395
397
  ## Post-Step Revert Detection Gate
396
398
 
399
+ <!-- See also <hook_revert_detection_gate> above — catches a different revert shape (identical, not shrunk) -->
400
+
397
401
  After committing each task, run a diff check to detect accidental reverts. This catches the class of bug where a task's implementation unknowingly undoes work from a previous task or wave.
398
402
 
399
403
  **When to run:** After every `git commit` that records a task completion (not after TDD RED commits or style-only commits).
@@ -71,6 +71,47 @@ 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
+ Reuse the `files_modified` list already parsed in step 1's intra-wave overlap check for this
77
+ plan — do not re-read the plan file to get it again.
78
+
79
+ ```
80
+ FRONTEND_GLOBS = ["*.tsx", "*.jsx", "*.css"] + paths containing "client" or "ui"
81
+ BACKEND_GLOBS = paths containing "api", "server", "db", or "service"
82
+
83
+ touches_frontend = any(file matches FRONTEND_GLOBS for file in files_modified)
84
+ touches_backend = any(file matches BACKEND_GLOBS for file in files_modified)
85
+
86
+ if touches_frontend and touches_backend:
87
+ classification = "full-stack"
88
+ elif touches_frontend:
89
+ classification = "frontend"
90
+ elif touches_backend:
91
+ classification = "backend"
92
+ else:
93
+ classification = "other" # files_modified empty/absent, or no glob matched
94
+ ```
95
+
96
+ **If `classification` is `"other"`** (ambiguous, or `files_modified` empty/absent), fall back
97
+ to keyword-matching the plan's `<objective>` text before giving up:
98
+ - Frontend keywords (React, component, UI, CSS, Tailwind, frontend, client-side, accessibility, a11y) → `classification = "frontend"`
99
+ - Backend keywords (API, endpoint, database, schema, service, queue, backend, server-side) → `classification = "backend"`
100
+ - Neither matches (pure docs/config/infra plan) → `classification` stays `"other"`
101
+
102
+ **Route to `subagent_type`:**
103
+
104
+ | classification | subagent_type |
105
+ |---|---|
106
+ | frontend | rcode-haitham |
107
+ | backend | rcode-yousef |
108
+ | full-stack | rcode-hanzla |
109
+ | other | rcode-executor |
110
+
111
+ This decision is computed once per plan, before that plan's Task() spawn(s) below, and the
112
+ resulting `subagent_type` value is used in the Task() call template (worktree and sequential
113
+ modes both reuse this same value — see "Sequential mode" further below).
114
+
74
115
  **Worktree mode** (`USE_WORKTREES` is not `false`):
75
116
 
76
117
  Before spawning, capture the current HEAD:
@@ -96,7 +137,7 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
96
137
 
97
138
  ```
98
139
  Task(
99
- subagent_type="rcode-executor",
140
+ subagent_type="{subagent_type}",
100
141
  description="Execute plan {plan_number} of phase {phase_number}",
101
142
  model="{executor_model}",
102
143
  isolation="worktree",
@@ -105,6 +146,8 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT
105
146
  Execute plan {plan_number} of phase {phase_number}-{phase_name}.
106
147
  Commit each task atomically. Create SUMMARY.md.
107
148
  Do NOT update STATE.md or ROADMAP.md — the orchestrator owns those writes after all worktree agents in the wave complete.
149
+
150
+ Routing note: this plan touches {classification} paths → dispatched to {subagent_type} (see step 3's classification logic in execute-waves.md).
108
151
  </objective>
109
152
 
110
153
  <!--
@@ -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>
@@ -335,46 +339,10 @@ Write these answers inline before continuing. If a blocking anti-pattern cannot
335
339
 
336
340
  **If `--interactive` flag present:** Switch to interactive execution mode.
337
341
 
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
342
+ ```bash
343
+ INTERACTIVE_MODE=$([[ "$ARGUMENTS" =~ (^|[[:space:]])--interactive($|[[:space:]]) ]] && echo true || echo false)
344
+ ```
345
+ ${INTERACTIVE_MODE === 'true' ? '@.rcode/references/execute-interactive-mode.md' : ''}
378
346
 
379
347
  **Skip to handle_branching step** (interactive plans execute inline after grouping).
380
348
  </step>
@@ -434,10 +402,8 @@ Report:
434
402
  ```
435
403
  </step>
436
404
 
437
-
438
405
  @rcode/workflows/execute-waves.md
439
406
 
440
-
441
407
  <step name="checkpoint_handling">
442
408
  Plans with `autonomous: false` require user interaction.
443
409
 
@@ -646,7 +612,7 @@ generated: <ISO timestamp>
646
612
  Group findings by severity. For each finding include: file path, line reference, description, recommended fix.
647
613
 
648
614
  ${REVIEWER_SKILLS}",
649
- subagent_type="rcode-code-reviewer",
615
+ subagent_type="rcode-reviewer",
650
616
  model="${REVIEWER_MODEL}"
651
617
  )
652
618
  ```
@@ -740,59 +706,16 @@ Only when the gate is clean or the user overrides do we proceed to close_parent_
740
706
 
741
707
  **Skip if** phase number has no decimal (e.g., `3`, `04`) — only applies to gap-closure phases like `4.1`, `03.1`.
742
708
 
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
709
  ```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
710
+ IS_GAP_CLOSURE_PHASE=$([[ "$PHASE_NUMBER" == *.* ]] && echo true || echo false)
785
711
  ```
712
+ ${IS_GAP_CLOSURE_PHASE === 'true' ? '@.rcode/references/execute-close-parent-artifacts.md' : ''}
786
713
  </step>
787
714
 
788
-
789
715
  @rcode/workflows/execute-regression-gates.md
790
716
 
791
-
792
-
793
717
  @rcode/workflows/execute-verify-phase-goal.md
794
718
 
795
-
796
719
  <step name="uat_gate" priority="blocker">
797
720
  **UAT gate:**
798
721
 
@@ -899,24 +822,13 @@ node ".rcode/bin/rcode-tools.cjs" commit "docs(phase-{X}): complete phase execut
899
822
  <step name="auto_copy_learnings">
900
823
  **Auto-copy phase learnings to global store (when enabled).**
901
824
 
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
825
  **Check config gate:**
906
826
  ```bash
907
827
  GL_ENABLED=$(node ".rcode/bin/rcode-tools.cjs" config-get features.global_learnings --raw 2>/dev/null || echo "false")
908
828
  ```
909
829
 
910
830
  **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.
831
+ ${GL_ENABLED === 'true' ? '@.rcode/references/execute-auto-copy-learnings.md' : ''}
920
832
  </step>
921
833
 
922
834
  <step name="update_project_md">
@@ -947,21 +859,10 @@ node ".rcode/bin/rcode-tools.cjs" commit "docs(phase-{X}): evolve PROJECT.md aft
947
859
  Silent no-op if no webhook URLs are in `.rcode/config.yaml`. Failures are reported but never block the workflow.
948
860
 
949
861
  ```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
862
+ 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)
863
+ WEBHOOK_CONFIGURED=$([ -n "$WEBHOOK_CONFIGURED" ] && echo true || echo false)
954
864
  ```
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`.
865
+ ${WEBHOOK_CONFIGURED === 'true' ? '@.rcode/references/execute-notify-webhooks.md' : ''}
965
866
  </step>
966
867
 
967
868
  <step name="generate_tests">
@@ -1075,7 +976,7 @@ For 1M+ context models, consider:
1075
976
  </context_efficiency>
1076
977
 
1077
978
  <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
979
+ - See the classifyHandoffIfNeeded workaround in execute-waves.md (already @-included above).
1079
980
  - **Agent fails mid-plan:** Missing SUMMARY.md → report, ask user how to proceed
1080
981
  - **Dependency chain breaks:** Wave 1 fails → Wave 2 dependents likely fail → user chooses attempt or skip
1081
982
  - **All agents in wave fail:** Systemic issue → stop, report for investigation
@@ -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
 
@@ -351,7 +351,6 @@ Fix issues inline. No sub-agent needed — this is a quick self-check before the
351
351
  Task(
352
352
  prompt=filled_prompt,
353
353
  subagent_type="rcode-planner",
354
- model="{model}",
355
354
  model="{planner_model}",
356
355
  description="Plan Phase {phase}"
357
356
  )