@hanzlaa/rcode 3.6.5 → 3.6.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzlaa/rcode",
3
- "version": "3.6.5",
3
+ "version": "3.6.6",
4
4
  "description": "rcode — the AI team that never forgets. Persistent memory, specialist agents, and slash commands for AI IDEs. Works in Claude Code, Cursor, Gemini, VS Code, and Antigravity.",
5
5
  "main": "cli/index.js",
6
6
  "bin": {
@@ -32,15 +32,39 @@ Follow the instructions in ./workflow.md.
32
32
  - Reads story file first; executes tasks in order
33
33
  - Marks tasks [x] only when implementation AND tests pass
34
34
  - Updates story's File List and Dev Agent Record sections
35
- - Reports: "Story complete. N tasks done. Tests: PASS (X). Files: [list]."
35
+ - Runs two-stage automated review before marking complete: spec compliance code quality
36
+ - Reports: "Story complete. N tasks done. Tests: PASS (X). Files: [list]. Reviews: SPEC ✅ QUALITY ✅"
36
37
  - Do NOT invent scope beyond the story
37
38
  - Do NOT commit with red tests
38
39
 
40
+ ## Review Protocol
41
+
42
+ After all tasks complete, dispatches two fresh reviewer subagents before handing off to human review:
43
+
44
+ **Stage 1 — Spec Compliance:** Confirms every AC is implemented, nothing extra was built. Repeats until COMPLIANT.
45
+
46
+ **Stage 2 — Code Quality:** Reviews naming, error handling, test depth, security, maintainability. Fixes High-severity issues; logs Medium issues for human reviewer. Repeats until APPROVED/APPROVED_WITH_NOTES.
47
+
48
+ ## Model Selection
49
+
50
+ When dispatching reviewer subagents or sub-tasks:
51
+ - Mechanical tasks (isolated, clear spec, 1-2 files) → cheapest/fastest model
52
+ - Integration tasks (multi-file, pattern matching) → standard model
53
+ - Architecture, design, or review tasks → most capable model
54
+
55
+ ## Implementer Status Protocol
56
+
57
+ When running as a subagent implementer, report one of:
58
+ - **DONE** — all requirements met, tests pass
59
+ - **DONE_WITH_CONCERNS** — complete but flagging doubts about correctness or scope
60
+ - **NEEDS_CONTEXT** — cannot proceed without specific missing information
61
+ - **BLOCKED** — cannot complete; caller must restructure or escalate
62
+
39
63
  ## Examples
40
64
 
41
65
  ### Happy Path
42
66
  **Input:** "dev this story: .rihal/phases/phase-02/stories/story-005.md"
43
- **Expected behavior:** Read story, execute tasks in order, write tests, run suite after each task, mark checkboxes, update File List.
67
+ **Expected behavior:** Read story, execute tasks in order, write tests, run suite after each task, mark checkboxes, update File List. After all tasks: dispatch spec compliance reviewer, dispatch code quality reviewer, mark as "review".
44
68
 
45
69
  ### Edge Case: Missing Story
46
70
  **Input:** "dev the login story" (story file doesn't exist)
@@ -49,3 +73,7 @@ Follow the instructions in ./workflow.md.
49
73
  ### Edge Case: Red Tests Mid-Execution
50
74
  **Input:** (task 2 breaks a test from task 1)
51
75
  **Expected behavior:** STOP. Report regression. Fix before continuing.
76
+
77
+ ### Edge Case: Spec Compliance Fails Review
78
+ **Input:** Implementation complete but reviewer finds missing AC
79
+ **Expected behavior:** Fix the gap, re-run tests, re-dispatch spec compliance reviewer. Do not proceed to code quality review until spec compliance passes.
@@ -263,6 +263,21 @@ Load config from `{project-root}/.rihal/config.json` and resolve:
263
263
  <step n="5" goal="Implement task following red-green-refactor cycle">
264
264
  <critical>FOLLOW THE STORY FILE TASKS/SUBTASKS SEQUENCE EXACTLY AS WRITTEN - NO DEVIATION</critical>
265
265
 
266
+ <!-- Model selection guidance — applies when dispatching sub-tasks to subagents -->
267
+ <model_selection>
268
+ Mechanical tasks (isolated function, clear spec, 1-2 files) → use cheapest/fastest model
269
+ Integration tasks (multi-file coordination, pattern matching) → use standard model
270
+ Architecture, design, or review tasks → use most capable model
271
+ </model_selection>
272
+
273
+ <!-- Implementer status protocol — use when completing tasks as a subagent -->
274
+ <status_protocol>
275
+ DONE: All requirements met, tests pass, committed.
276
+ DONE_WITH_CONCERNS: Complete but flagging doubts — describe the concern. Caller decides before review.
277
+ NEEDS_CONTEXT: Cannot proceed without missing information — specify exactly what is needed.
278
+ BLOCKED: Cannot complete despite context — describe the blocker. Caller must restructure or escalate.
279
+ </status_protocol>
280
+
266
281
  <action>Review the current task/subtask from the story file - this is your authoritative implementation guide</action>
267
282
  <action>Plan implementation following red-green-refactor cycle</action>
268
283
 
@@ -410,6 +425,65 @@ Load config from `{project-root}/.rihal/config.json` and resolve:
410
425
  <action if="definition-of-done validation fails">HALT - Address DoD failures before completing</action>
411
426
  </step>
412
427
 
428
+ <step n="9.5" goal="Two-stage automated review: spec compliance then code quality">
429
+ <critical>Both stages must pass before the story is marked complete. Never skip either stage. Spec compliance must pass before starting code quality review.</critical>
430
+
431
+ <output>🔍 **Two-Stage Review** — verifying before handing off to human review</output>
432
+
433
+ <!-- STAGE 1: Spec Compliance -->
434
+ <output>
435
+ ━━━ Stage 1: Spec Compliance Review ━━━
436
+ </output>
437
+ <action>Spawn a fresh spec-compliance reviewer subagent. Provide it:
438
+ - Full story file contents (especially Acceptance Criteria and Tasks sections)
439
+ - List of all modified files from the File List section
440
+ - Brief: "Review that every AC is satisfied in the code. Flag anything built outside spec. Flag any AC with no corresponding implementation."
441
+ </action>
442
+
443
+ <action>Reviewer reports one of: COMPLIANT | NON_COMPLIANT (with specific gaps listed)</action>
444
+
445
+ <check if="spec compliance reviewer reports NON_COMPLIANT">
446
+ <action>Fix each gap: implement missing ACs, remove any out-of-spec additions</action>
447
+ <action>Re-run tests to confirm fixes pass</action>
448
+ <action>Re-dispatch spec compliance reviewer with the same prompt</action>
449
+ <action>Repeat until COMPLIANT</action>
450
+ </check>
451
+
452
+ <output>✅ Stage 1 passed — implementation is spec-compliant</output>
453
+
454
+ <!-- STAGE 2: Code Quality Review -->
455
+ <output>
456
+ ━━━ Stage 2: Code Quality Review ━━━
457
+ </output>
458
+ <action>Spawn a fresh code quality reviewer subagent. Provide it:
459
+ - All modified files (from File List)
460
+ - Story title and ACs (context for what was being built)
461
+ - Project coding standards (contents of CLAUDE.md or project-context.md if available)
462
+ - Brief: "Review code quality: naming conventions, error handling, test coverage depth, security, performance, maintainability. Severity: High (must fix) | Medium (should fix) | Low (note only)."
463
+ </action>
464
+
465
+ <action>Reviewer reports one of: APPROVED | APPROVED_WITH_NOTES | CHANGES_REQUIRED (severity breakdown)</action>
466
+
467
+ <check if="code quality reviewer reports CHANGES_REQUIRED (High severity issues)">
468
+ <action>Fix all High-severity issues</action>
469
+ <action>Re-run tests to confirm fixes pass</action>
470
+ <action>Re-dispatch code quality reviewer with the same prompt</action>
471
+ <action>Repeat until APPROVED or APPROVED_WITH_NOTES</action>
472
+ </check>
473
+
474
+ <check if="Medium-severity issues exist">
475
+ <action>Fix Medium-severity issues when the fix is straightforward and low-risk</action>
476
+ <action>Log unfixed Medium issues in Dev Agent Record → Completion Notes for human reviewer awareness</action>
477
+ </check>
478
+
479
+ <output>✅ Stage 2 passed — code quality verified</output>
480
+
481
+ <output>
482
+ ✅ **Two-stage review complete** — story is spec-compliant and quality-approved.
483
+ Ready for human review.
484
+ </output>
485
+ </step>
486
+
413
487
  <step n="10" goal="Completion communication and user support">
414
488
  <action>Execute the enhanced definition-of-done checklist using the validation framework</action>
415
489
  <action>Prepare a concise summary in Dev Agent Record → Completion Notes</action>
@@ -114,6 +114,37 @@ Output consumed by /rihal-execute. Plans need:
114
114
  </downstream_consumer>
115
115
 
116
116
  <deep_work_rules>
117
+ ## File Structure Map (REQUIRED — before task decomposition)
118
+
119
+ Before writing any task, produce a file structure map listing every file this plan will create or modify:
120
+
121
+ ```
122
+ FILES_TO_CREATE:
123
+ - exact/path/to/new/file.ts — responsibility: [one sentence]
124
+ FILES_TO_MODIFY:
125
+ - exact/path/to/existing.ts — what changes: [one sentence]
126
+ FILES_FOR_TESTS:
127
+ - tests/exact/path/test.ts — tests for: [one sentence]
128
+ ```
129
+
130
+ Rules:
131
+ - Each file has one clear responsibility — if you can't describe it in one sentence, split the file
132
+ - Files that change together should live together (split by responsibility, not layer)
133
+ - This map is what informs task decomposition — each task should produce self-contained changes
134
+ - In existing codebases: follow established patterns; only restructure files if a file is genuinely unwieldy and the split is included as its own task
135
+
136
+ ## No-Placeholders Rule (HARD BLOCKER)
137
+
138
+ Every step must contain the actual content the executor needs. These are **plan failures** — never write them:
139
+ - "TBD", "TODO", "implement later", "fill in details"
140
+ - "Add appropriate error handling" / "add validation" / "handle edge cases" (without code)
141
+ - "Write tests for the above" (without actual test code)
142
+ - "Similar to Task N" — copy the code; executor may read tasks out of order
143
+ - Steps that describe what to do without showing how (code blocks required for code steps)
144
+ - References to types, functions, or methods not yet defined in any task in this plan
145
+
146
+ If a step would require TBD content, either: (a) do the research now and fill it in, or (b) split into a research task that outputs a decision, followed by an implementation task that consumes it.
147
+
117
148
  ## Anti-Shallow Execution Rules (MANDATORY)
118
149
 
119
150
  Every task MUST include these fields — they are NOT optional:
@@ -185,6 +216,8 @@ Every task MUST include these fields — they are NOT optional:
185
216
  </deep_work_rules>
186
217
 
187
218
  <quality_gate>
219
+ - [ ] File structure map written before first task (files_to_create / files_to_modify / files_for_tests)
220
+ - [ ] No placeholder patterns: no TBD/TODO/implement-later, no "similar to Task N", no code steps without code
188
221
  - [ ] SPRINT.md files created in phase directory
189
222
  - [ ] Each plan has valid frontmatter including `files_modified:` array aggregating all `<files>` paths across tasks (consumed by execute.md intra-wave overlap checker)
190
223
  - [ ] Tasks are specific and actionable
@@ -195,10 +228,21 @@ Every task MUST include these fields — they are NOT optional:
195
228
  - [ ] Every task has `<done>` with a single observable acceptance sentence (Dimension 2 requirement)
196
229
  - [ ] Every `<action>` contains concrete values (no "align X with Y" without specifying what)
197
230
  - [ ] Tasks extending existing code have `<interfaces>` with relevant signatures
231
+ - [ ] Type/name consistency: function names, types, and method signatures match across all tasks (no rename drift)
198
232
  - [ ] Dependencies correctly identified
199
233
  - [ ] Waves assigned for parallel execution
200
234
  - [ ] must_haves derived from phase goal
201
235
  </quality_gate>
236
+
237
+ <self_review>
238
+ After writing the complete plan, review the spec with fresh eyes before handing off:
239
+
240
+ 1. **Spec coverage** — skim each requirement in the phase goal / CONTEXT.md decisions. Can you point to a task that implements it? List any gaps; add tasks if needed.
241
+ 2. **Placeholder scan** — search the plan for the no-placeholder patterns listed above. Fix any found inline.
242
+ 3. **Type consistency** — check that function names, types, and method signatures used in later tasks match what earlier tasks define. A method called `clearLayers()` in Task 3 but `clearFullLayers()` in Task 7 is a bug.
243
+
244
+ Fix issues inline. No sub-agent needed — this is a quick self-check before the sprint-checker runs.
245
+ </self_review>
202
246
  ```
203
247
 
204
248
  ```