@hanzlaa/rcode 3.4.31 → 3.4.33

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 (76) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +1 -1
  3. package/CONTRIBUTING.md +19 -0
  4. package/cli/agent.js +57 -0
  5. package/cli/index.js +4 -0
  6. package/dist/rcode.js +44 -0
  7. package/package.json +1 -1
  8. package/rihal/agents/rihal-advisor-researcher.md +2 -25
  9. package/rihal/agents/rihal-ahmed.md +0 -57
  10. package/rihal/agents/rihal-assumptions-analyzer.md +1 -69
  11. package/rihal/agents/rihal-code-fixer.md +3 -66
  12. package/rihal/agents/rihal-code-reviewer.md +3 -66
  13. package/rihal/agents/rihal-codebase-mapper.md +1 -167
  14. package/rihal/agents/rihal-cross-platform-auditor.md +15 -0
  15. package/rihal/agents/rihal-debugger.md +1 -104
  16. package/rihal/agents/rihal-dep-auditor.md +15 -0
  17. package/rihal/agents/rihal-docs-auditor.md +3 -12
  18. package/rihal/agents/rihal-edge-case-hunter.md +7 -33
  19. package/rihal/agents/rihal-executor.md +1 -98
  20. package/rihal/agents/rihal-fatima.md +0 -62
  21. package/rihal/agents/rihal-haitham.md +11 -55
  22. package/rihal/agents/rihal-hanzla.md +0 -60
  23. package/rihal/agents/rihal-hussain-pm.md +0 -65
  24. package/rihal/agents/rihal-i18n-auditor.md +16 -0
  25. package/rihal/agents/rihal-integration-checker.md +1 -396
  26. package/rihal/agents/rihal-layla.md +0 -48
  27. package/rihal/agents/rihal-mariam.md +0 -54
  28. package/rihal/agents/rihal-nasser.md +0 -48
  29. package/rihal/agents/rihal-noor.md +0 -51
  30. package/rihal/agents/rihal-nyquist-auditor.md +1 -7
  31. package/rihal/agents/rihal-observability-auditor.md +16 -0
  32. package/rihal/agents/rihal-omar.md +6 -48
  33. package/rihal/agents/rihal-phase-researcher.md +7 -40
  34. package/rihal/agents/rihal-planner.md +2 -209
  35. package/rihal/agents/rihal-profiler.md +5 -24
  36. package/rihal/agents/rihal-project-researcher.md +2 -36
  37. package/rihal/agents/rihal-remediation-planner.md +3 -70
  38. package/rihal/agents/rihal-research-synthesizer.md +1 -210
  39. package/rihal/agents/rihal-roadmapper.md +2 -74
  40. package/rihal/agents/rihal-sadiq.md +0 -55
  41. package/rihal/agents/rihal-security-adversary.md +10 -39
  42. package/rihal/agents/rihal-security-auditor.md +7 -29
  43. package/rihal/agents/rihal-sprint-checker.md +1 -118
  44. package/rihal/agents/rihal-ui-auditor.md +10 -34
  45. package/rihal/agents/rihal-ux-designer.md +3 -69
  46. package/rihal/agents/rihal-verifier.md +1 -85
  47. package/rihal/agents/rihal-waleed.md +0 -56
  48. package/rihal/agents/rihal-yousef.md +9 -49
  49. package/rihal/bin/rihal-tools.cjs +129 -2
  50. package/rihal/references/REFERENCES_INDEX.md +67 -0
  51. package/rihal/references/assumptions-analyzer-playbook.md +82 -0
  52. package/rihal/references/auditor-shared-checklists.md +91 -0
  53. package/rihal/references/code-fixer-playbook.md +71 -0
  54. package/rihal/references/code-reviewer-playbook.md +71 -0
  55. package/rihal/references/codebase-mapping-process.md +176 -0
  56. package/rihal/references/debugger-playbook.md +127 -0
  57. package/rihal/references/executor-playbook.md +119 -0
  58. package/rihal/references/integration-verification-playbook.md +392 -0
  59. package/rihal/references/persona-engineer-shared.md +61 -0
  60. package/rihal/references/phase-id-conventions.md +101 -0
  61. package/rihal/references/planner-playbook.md +217 -0
  62. package/rihal/references/remediation-planner-playbook.md +75 -0
  63. package/rihal/references/research-synthesis-playbook.md +205 -0
  64. package/rihal/references/researcher-shared.md +87 -0
  65. package/rihal/references/roadmapper-playbook.md +82 -0
  66. package/rihal/references/sprint-checker-playbook.md +128 -0
  67. package/rihal/references/ux-designer-playbook.md +74 -0
  68. package/rihal/references/verifier-playbook.md +104 -0
  69. package/rihal/skills/actions/4-implementation/rihal-code-review/steps/step-02-review.md +7 -3
  70. package/rihal/skills/agents/majlis-council/SKILL.md +1 -1
  71. package/rihal/team.yaml +32 -0
  72. package/rihal/workflows/add-phase.md +37 -0
  73. package/rihal/workflows/status.md +19 -0
  74. package/server/dashboard.js +1 -1
  75. package/server/lib/api.js +7 -0
  76. package/server/lib/html/client.js +2 -2
@@ -0,0 +1,217 @@
1
+ # Planner Playbook
2
+
3
+ Loaded by `rihal-planner` via `@-include`. Contains the full sprint
4
+ planning methodology: quick reference, task anatomy, SPRINT.md
5
+ templates, dependency graph rules, codebase discovery protocol,
6
+ file-existence verification, plan structure template, and constraints.
7
+
8
+ The agent stub holds the role definition, scope-driven sizing rules,
9
+ hierarchical ID format, and output routing.
10
+
11
+ ## Quick Reference
12
+
13
+ ### Context Fidelity
14
+ - **Locked Decisions** (CONTEXT.md): MUST implement exactly. Reference decision ID (D-01, D-02) in task actions.
15
+ - **Deferred Ideas**: MUST NOT appear in plans.
16
+ - **Agent's Discretion**: Use judgment, document choices.
17
+
18
+ ### Discovery Levels
19
+ - **Level 0:** Pure internal, existing patterns only. Skip research.
20
+ - **Level 1:** Single known lib. Use Context7 resolve + query-docs (2-5 min).
21
+ - **Level 2:** Choose between 2-3 options. Route to discovery workflow (15-30 min).
22
+ - **Level 3:** Architecture decision, novel problem. Full research (1+ hour).
23
+
24
+ ### Task Anatomy
25
+ - `<files>`: Exact paths (not "relevant components")
26
+ - `<action>`: Specific instructions, what to avoid & WHY
27
+ - `<verify>`: <automated> command < 60 sec (REQUIRED by Nyquist Rule)
28
+ - `<done>`: Measurable acceptance criteria
29
+ - `<evidence>`: **REQUIRED** (issue #649). Must show codebase grounding — at minimum one of:
30
+ - `grep:` a literal grep/Glob pattern + count of matches that justified this task ("`rg '\\.alert' apps/web/src` → 13 hits across 9 files")
31
+ - `lines:` exact `path:line-line` ranges of code being modified
32
+ - `creates:` the file paths being created from scratch (with one-line justification why no existing file fits)
33
+ A task without `<evidence>` is theoretical and MUST NOT be written.
34
+
35
+ ### Task Types
36
+ | Type | When | Autonomy |
37
+ |------|------|----------|
38
+ | `auto` | Everything agent does independently | Fully autonomous |
39
+ | `checkpoint:human-verify` | Visual/functional verification | Pauses for user |
40
+ | `checkpoint:decision` | Implementation choices | Pauses for user |
41
+ | `checkpoint:human-action` | Unavoidable manual (2FA, auth link) | Pauses for user |
42
+
43
+ ### Task Sizing
44
+ - **15-60 min:** Right size
45
+ - **< 15 min:** Combine with related task
46
+ - **> 60 min:** Split into smaller tasks
47
+
48
+ ### TDD vs Standard
49
+ - **TDD (dedicated plan):** Can write `expect(fn(input)).toBe(output)` before `fn`. Complex business logic.
50
+ - **Standard:** UI layout, config, glue code, simple CRUD.
51
+
52
+ ## On-Demand Rule Files
53
+
54
+ | When you need... | Read |
55
+ |---|---|
56
+ | Goal-backward methodology | `.rihal/agents-rules/planner/goal-backward-thinking.md` |
57
+ | Task templates by type | `.rihal/agents-rules/planner/task-templates.md` |
58
+ | Dependency analysis | `.rihal/agents-rules/planner/dependency-analysis.md` |
59
+ | Plan verification checklist | `.rihal/agents-rules/planner/plan-verification.md` |
60
+ | Common planning patterns | `.rihal/agents-rules/planner/common-patterns.md` |
61
+
62
+ Read ONLY when current task needs them. Don't preemptively load.
63
+
64
+ ## SPRINT.md Frontmatter Template
65
+
66
+ ```yaml
67
+ ---
68
+ phase: XX-name
69
+ sprint: NN.S
70
+ type: execute | tdd
71
+ wave: N # Auto-derived from depends_on
72
+ depends_on: [sprint-id, ...]
73
+ files_modified: [paths...]
74
+ autonomous: true | false # false if has checkpoints
75
+ requirements: [REQ-01, REQ-02] # MUST NOT be empty
76
+
77
+ must_haves:
78
+ truths: [...] # Observable outcomes from user perspective
79
+ artifacts: [...] # Files/models that must exist
80
+ key_links: [...] # Critical connections, breakage points
81
+ ---
82
+ ```
83
+
84
+ ## Dependency Graph Rules
85
+
86
+ **For each story:**
87
+ - What does it NEED before running?
88
+ - What does it CREATE for others?
89
+ - Can it run independently?
90
+
91
+ **Wave assignment:**
92
+ ```
93
+ if depends_on is empty: wave = 1
94
+ else: wave = max(waves of dependencies) + 1
95
+ ```
96
+
97
+ **Vertical slices (PREFER):** User feature (model+API+UI) as one plan. Parallel.
98
+ **Horizontal layers (AVOID):** All models, then all APIs, then all UIs. Sequential.
99
+
100
+ **File ownership:** No overlap in files_modified → can run parallel. Overlap → later depends on earlier.
101
+
102
+ ## Codebase Discovery (BLOCKER — added after issue #649)
103
+
104
+ **Before writing any task body, you MUST query the actual codebase.** Plans built on
105
+ guessed file counts, imagined components, or "probably the dashboard does X" content
106
+ are theoretical and rejected by sprint-checker.
107
+
108
+ For every claim a task makes about the codebase, run a real query and capture the
109
+ result in the task's `<evidence>` field:
110
+
111
+ | Claim shape | Required query |
112
+ |---|---|
113
+ | "migrate N files away from X" | `rg -l '<X>' <scope>` — record exact file count + paths |
114
+ | "modify component Y" | `Read` the file; record `path:line-line` ranges |
115
+ | "replace pattern P" | `rg '<P>'` — record hit count + a representative match |
116
+ | "add Z where there's no Z today" | `rg '<Z>'` returning 0 hits is the evidence |
117
+ | "create new file F" | confirm F does NOT exist + state why no existing file fits |
118
+
119
+ **Hard stops:**
120
+
121
+ - Did NOT grep for a symbol the task says it modifies? → drop the task or mark as `<evidence>investigation needed</evidence>` BLOCKER.
122
+ - File count cited but never measured? → run the grep, write the real number, never use round numbers like "13 files" without a grep behind them.
123
+ - Claim references "the dashboard / the orders page / the POS" without reading the file? → Read the file first, cite line ranges.
124
+
125
+ **Smell test before writing each task:**
126
+ > "Could every line of this task body be traced back to a specific file and line in the repo?"
127
+ >
128
+ > If not, the task is theoretical. Drop it.
129
+
130
+ The orchestrator (`/rihal-plan`) MUST pass this checklist forward to sprint-checker
131
+ which fails the plan if any task lacks `<evidence>`.
132
+
133
+ ## File-existence verification (BLOCKER — added in v3.1.0 after #441)
134
+
135
+ Before writing each entry into `files_modified`, you MUST verify the file actually exists in the project. Plans with fictional file names cause executors to scramble at runtime.
136
+
137
+ For every candidate path:
138
+
139
+ ```bash
140
+ # Try the exact name first
141
+ test -f "<candidate>" && echo "OK" && exit 0
142
+
143
+ # Then try a fuzzy match for renamed/moved files
144
+ find . -type f \( -name "<basename>" -o -iname "*$<short-slug>*" \) \
145
+ -not -path './node_modules/*' -not -path './.git/*' 2>/dev/null
146
+ ```
147
+
148
+ Apply these rules to every path you put in `files_modified`:
149
+
150
+ - **Exact match exists** → use the verified path verbatim
151
+ - **No exact match, fuzzy match found** → use the fuzzy match's path AND log a note in the SPRINT.md frontmatter (`renamed_from: <original candidate>`)
152
+ - **Neither exact nor fuzzy match** → DO NOT add the path to `files_modified`. Either:
153
+ - Mark it as a CREATE story (the executor will create the file fresh) — set `creates: [<path>]` in the story body
154
+ - OR raise a BLOCKER finding for sprint-checker to surface: file referenced by name but not present and not flagged for creation
155
+
156
+ Sprint-checker enforces this — see `rihal-sprint-checker.md` Mandatory Output Markers section. Plans that claim to modify non-existent files without a CREATE marker are rejected.
157
+
158
+ ## Plan Structure
159
+
160
+ ```markdown
161
+ ---
162
+ [frontmatter with phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, must_haves]
163
+ ---
164
+
165
+ <objective>
166
+ [What this plan accomplishes]
167
+ Purpose: [Why this matters]
168
+ Output: [Artifacts created]
169
+ </objective>
170
+
171
+ <execution_context>
172
+ @.rihal/workflows/execute.md
173
+ @.rihal/templates/summary.md
174
+ </execution_context>
175
+
176
+ <context>
177
+ @.planning/PROJECT.md
178
+ @.planning/ROADMAP.md
179
+ @.planning/STATE.md
180
+ [Only prior SUMMARY refs if genuinely needed]
181
+ </context>
182
+
183
+ <tasks>
184
+ [2-3 tasks max, each 15-60 min]
185
+ </tasks>
186
+
187
+ <verification>
188
+ [Overall phase checks]
189
+ </verification>
190
+
191
+ <success_criteria>
192
+ [Measurable completion]
193
+ </success_criteria>
194
+
195
+ <output>
196
+ Create `.planning/phases/XX-name/{phase}-{plan}-SUMMARY.md`
197
+ </output>
198
+ ```
199
+
200
+ ## Common Planning Mistakes to Avoid
201
+
202
+ 1. **Empty requirements:** Every plan MUST list requirement IDs from ROADMAP. No empty requirements field.
203
+ 2. **Vague tasks:** "Add authentication" → "Create POST /api/login with JWT, 15-min access, 7-day refresh"
204
+ 3. **Missing verify:** Every task needs <automated> command < 60 sec (Nyquist Rule)
205
+ 4. **Over-splitting:** Ticket-sized work → ONE plan, not three
206
+ 5. **No dependency graph:** Tasks look independent but aren't
207
+ 6. **Context anxiety:** Plans bloat when context > 50%. Keep to 2-3 tasks.
208
+ 7. **Theoretical content (BLOCKER, issue #649):** Writing a task that names files, counts, components, or patterns you have not actually grepped or read. If you can't quote a real `path:line` or a real grep hit count, you are guessing. Drop the task or downgrade it to an investigation BLOCKER.
209
+
210
+ ## Constraints
211
+
212
+ - Apply Karpathy guidelines (truthfulness, specificity, no fluff)
213
+ - Never produce vague, abstract task descriptions
214
+ - Document all design decisions (why library X not Y)
215
+ - Every locked decision (D-01, D-02) must appear in at least one task
216
+ - Every plan must address >= 1 requirement ID from ROADMAP
217
+ - No empty <requirements> field
@@ -0,0 +1,75 @@
1
+ # Remediation Planner Playbook
2
+
3
+ Loaded by `rihal-remediation-planner` via `@-include`. Contains the full
4
+ specialization descriptions, workflow steps, and worked examples.
5
+
6
+ The agent stub holds the role identity, response format, principles,
7
+ anti-patterns, redirects, and constraints.
8
+
9
+ ---
10
+
11
+ ## How you think
12
+
13
+ Every remediation task has three pressure points:
14
+ 1. **What are the recovery options?** — Accelerate, cut scope, extend timeline, add resources
15
+ 2. **What are the trade-offs?** — Cost in dollars, schedule, quality, technical debt
16
+ 3. **What's the fastest path forward?** — What gets us back on track soonest?
17
+
18
+ ---
19
+
20
+ ## Specializations
21
+
22
+ ### Plan Recovery
23
+ - Design options for phase recovery: accelerate, cut scope, extend timeline, add resources
24
+ - Estimate effort and cost for each option
25
+ - Identify dependencies and critical path
26
+ - Recommend fastest path that doesn't break downstream work
27
+
28
+ ### Blocker Resolution
29
+ - Identify root cause of blocking issue
30
+ - Enumerate solutions with estimated effort and risk
31
+ - Recommend approach with lowest risk and fastest resolution
32
+ - Plan contingencies if recommended approach fails
33
+
34
+ ### Technical Debt Management
35
+ - Quantify technical debt and its impact
36
+ - Plan strategic debt paydown in parallel with feature work
37
+ - Balance speed (incur debt) vs. quality (pay debt)
38
+ - Identify debt that's blocking future work
39
+
40
+ ### Resource Allocation
41
+ - Assess available team capacity and skills
42
+ - Plan optimal allocation to recovery tasks
43
+ - Identify bottlenecks and single points of failure
44
+ - Recommend skill training or external resources if needed
45
+
46
+ ---
47
+
48
+ ## Workflow
49
+
50
+ 1. **Read deviation analysis** — from rihal-deviation-analyzer or caller context.
51
+ 2. **Assess constraints** — available time, team capacity, budget, quality floor.
52
+ 3. **Enumerate recovery options** — accelerate, cut scope, extend timeline, add resources.
53
+ 4. **Cost each option** — schedule days, quality impact, technical debt incurred.
54
+ 5. **Recommend fastest path** — the option that meets constraints with lowest risk.
55
+ 6. **Write contingency** — if the recommended plan fails, what's next?
56
+ 7. **Identify approval gates** — which decisions need Sadiq (priority) or Hussain-PM (scope)?
57
+ 8. **Create action plan** — specific tasks, owners, deadlines.
58
+
59
+ ---
60
+
61
+ ## Examples
62
+
63
+ **Happy path** — 3-day schedule slip in Phase 5
64
+ > 🔄 **Remediation Planner:**
65
+ > Options:
66
+ > 1. Cut scope: defer analytics dashboard to Phase 6 → Phase 5 ships on time, 1 feature deferred
67
+ > 2. Accelerate: add 10h weekend work → ships on time, team burnout risk (low — one weekend)
68
+ > 3. Extend: slip Phase 5 by 3 days → downstream Phase 6 start shifts 3 days
69
+ > Recommended: Option 1 (cut scope) — lowest risk, cleanest timeline. Decision needed from Hussain-PM on which analytics features are deferrable. Route: `/rihal-council hussain-pm`.
70
+
71
+ **Edge case** — blocker on third-party API unavailable
72
+ > 🔄 **Remediation Planner:** External API unavailable is a dependency blocker, not a scope deviation. Options: mock the API and ship with degraded mode vs. wait for API to recover vs. switch to alternative provider. Each option needs Waleed's sign-off on technical approach and Sadiq's sign-off if provider switch has contract implications.
73
+
74
+ **Negative** — asked to make the priority decision
75
+ > 🔄 **Remediation Planner:** Priority decisions (which option, what to cut) belong to Sadiq (Strategy) and Hussain-PM (Product). I've laid out the options and trade-offs. Route: `/rihal-council sadiq hussain-pm — remediation decision for [phase/blocker]`.
@@ -0,0 +1,205 @@
1
+ # Research Synthesis Playbook
2
+
3
+ Loaded by `rihal-research-synthesizer` via `@-include`. Contains the full
4
+ eight-step synthesis process, output format specification, structured return
5
+ formats, and success criteria.
6
+
7
+ ---
8
+
9
+ ## Step 1: Read Research Files
10
+
11
+ Read all 4 research files:
12
+
13
+ ```bash
14
+ cat .planning/research/STACK.md
15
+ cat .planning/research/FEATURES.md
16
+ cat .planning/research/ARCHITECTURE.md
17
+ cat .planning/research/PITFALLS.md
18
+
19
+ # Planning config loaded via rihal-tools.cjs in commit step
20
+ ```
21
+
22
+ Parse each file to extract:
23
+ - **STACK.md:** Recommended technologies, versions, rationale
24
+ - **FEATURES.md:** Table stakes, differentiators, anti-features
25
+ - **ARCHITECTURE.md:** Patterns, component boundaries, data flow
26
+ - **PITFALLS.md:** Critical/moderate/minor pitfalls, phase warnings
27
+
28
+ ## Step 2: Synthesize Executive Summary
29
+
30
+ Write 2-3 paragraphs that answer:
31
+ - What type of product is this and how do experts build it?
32
+ - What's the recommended approach based on research?
33
+ - What are the key risks and how to mitigate them?
34
+
35
+ Someone reading only this section should understand the research conclusions.
36
+
37
+ ## Step 3: Extract Key Findings
38
+
39
+ For each research file, pull out the most important points:
40
+
41
+ **From STACK.md:**
42
+ - Core technologies with one-line rationale each
43
+ - Any critical version requirements
44
+
45
+ **From FEATURES.md:**
46
+ - Must-have features (table stakes)
47
+ - Should-have features (differentiators)
48
+ - What to defer to v2+
49
+
50
+ **From ARCHITECTURE.md:**
51
+ - Major components and their responsibilities
52
+ - Key patterns to follow
53
+
54
+ **From PITFALLS.md:**
55
+ - Top 3-5 pitfalls with prevention strategies
56
+
57
+ ## Step 4: Derive Roadmap Implications
58
+
59
+ This is the most important section. Based on combined research:
60
+
61
+ **Suggest phase structure:**
62
+ - What should come first based on dependencies?
63
+ - What groupings make sense based on architecture?
64
+ - Which features belong together?
65
+
66
+ **For each suggested phase, include:**
67
+ - Rationale (why this order)
68
+ - What it delivers
69
+ - Which features from FEATURES.md
70
+ - Which pitfalls it must avoid
71
+
72
+ **Add research flags:**
73
+ - Which phases likely need `/rihal-research` during planning?
74
+ - Which phases have well-documented patterns (skip research)?
75
+
76
+ ## Step 5: Assess Confidence
77
+
78
+ | Area | Confidence | Notes |
79
+ |------|------------|-------|
80
+ | Stack | [level] | [based on source quality from STACK.md] |
81
+ | Features | [level] | [based on source quality from FEATURES.md] |
82
+ | Architecture | [level] | [based on source quality from ARCHITECTURE.md] |
83
+ | Pitfalls | [level] | [based on source quality from PITFALLS.md] |
84
+
85
+ Identify gaps that couldn't be resolved and need attention during planning.
86
+
87
+ ## Step 6: Write SUMMARY.md
88
+
89
+ **ALWAYS use the Write tool to create files** — never use `Bash(cat << 'EOF')` or heredoc commands for file creation.
90
+
91
+ Use template: .rihal/templates/research-project/SUMMARY.md
92
+
93
+ Write to `.planning/research/SUMMARY.md`
94
+
95
+ ## Step 7: Commit All Research
96
+
97
+ The 4 parallel researcher agents write files but do NOT commit. You commit everything together.
98
+
99
+ ```bash
100
+ node ".rihal/bin/rihal-tools.cjs" commit "docs: complete project research" --files .planning/research/
101
+ ```
102
+
103
+ ## Step 8: Return Summary
104
+
105
+ Return brief confirmation with key points for the orchestrator.
106
+
107
+ ---
108
+
109
+ Use template: .rihal/templates/research-project/SUMMARY.md
110
+
111
+ Key sections:
112
+ - Executive Summary (2-3 paragraphs)
113
+ - Key Findings (summaries from each research file)
114
+ - Implications for Roadmap (phase suggestions with rationale)
115
+ - Confidence Assessment (honest evaluation)
116
+ - Sources (aggregated from research files)
117
+
118
+ ---
119
+
120
+ ## Synthesis Complete
121
+
122
+ When SUMMARY.md is written and committed:
123
+
124
+ ```markdown
125
+ ## SYNTHESIS COMPLETE
126
+
127
+ **Files synthesized:**
128
+ - .planning/research/STACK.md
129
+ - .planning/research/FEATURES.md
130
+ - .planning/research/ARCHITECTURE.md
131
+ - .planning/research/PITFALLS.md
132
+
133
+ **Output:** .planning/research/SUMMARY.md
134
+
135
+ ### Executive Summary
136
+
137
+ [2-3 sentence distillation]
138
+
139
+ ### Roadmap Implications
140
+
141
+ Suggested phases: [N]
142
+
143
+ 1. **[Phase name]** — [one-liner rationale]
144
+ 2. **[Phase name]** — [one-liner rationale]
145
+ 3. **[Phase name]** — [one-liner rationale]
146
+
147
+ ### Research Flags
148
+
149
+ Needs research: Phase [X], Phase [Y]
150
+ Standard patterns: Phase [Z]
151
+
152
+ ### Confidence
153
+
154
+ Overall: [HIGH/MEDIUM/LOW]
155
+ Gaps: [list any gaps]
156
+
157
+ ### Ready for Requirements
158
+
159
+ SUMMARY.md committed. Orchestrator can proceed to requirements definition.
160
+ ```
161
+
162
+ ## Synthesis Blocked
163
+
164
+ When unable to proceed:
165
+
166
+ ```markdown
167
+ ## SYNTHESIS BLOCKED
168
+
169
+ **Blocked by:** [issue]
170
+
171
+ **Missing files:**
172
+ - [list any missing research files]
173
+
174
+ **Awaiting:** [what's needed]
175
+ ```
176
+
177
+ ---
178
+
179
+ Synthesis is complete when:
180
+
181
+ - [ ] All 4 research files read
182
+ - [ ] Executive summary captures key conclusions
183
+ - [ ] Key findings extracted from each file
184
+ - [ ] Roadmap implications include phase suggestions
185
+ - [ ] Research flags identify which phases need deeper research
186
+ - [ ] Confidence assessed honestly
187
+ - [ ] Gaps identified for later attention
188
+ - [ ] SUMMARY.md follows template format
189
+ - [ ] File committed to git
190
+ - [ ] Structured return provided to orchestrator
191
+
192
+ Quality indicators:
193
+
194
+ - **Synthesized, not concatenated:** Findings are integrated, not just copied
195
+ - **Opinionated:** Clear recommendations emerge from combined research
196
+ - **Actionable:** Roadmapper can structure phases based on implications
197
+ - **Honest:** Confidence levels reflect actual source quality
198
+
199
+ ---
200
+
201
+ - synthesize findings from multiple researchers coherently
202
+ - preserve source attribution and evidence chains
203
+ - identify contradictions and validate against facts
204
+ - output structured SYNTHESIS.md for planning input
205
+ - validate conclusions against research standards
@@ -0,0 +1,87 @@
1
+ # Researcher Shared Rules
2
+
3
+ Loaded by rihal-phase-researcher, rihal-project-researcher,
4
+ rihal-advisor-researcher, and rihal-profiler via `@-include`.
5
+ Contains the shared research methodology, confidence labeling,
6
+ evidence discipline, and scope constraints all researchers inherit.
7
+
8
+ Agent-specific output formats, workflows, and domain rules live
9
+ in each agent's own file.
10
+
11
+ ---
12
+
13
+ ## Research Methodology: Evidence First
14
+
15
+ All four researchers share the discipline of evidence-before-conclusions:
16
+
17
+ - **Gather evidence first. Form conclusions from the evidence.** Do not start with a hypothesis and find supporting evidence.
18
+ - phase-researcher calls this "Prescriptive-not-exploratory." project-researcher calls it "Evidence-drives-conclusions." advisor-researcher calls it "gather evidence, form conclusions." profiler calls it "Data-grounded."
19
+ - The naming differs; the discipline is identical: never let the conclusion precede the evidence.
20
+ - "I think X is true" is not evidence. Analytics, code, documentation, interviews, current sources, usage logs — those are evidence.
21
+
22
+ ---
23
+
24
+ ## Confidence Labeling Protocol
25
+
26
+ Shared by phase-researcher, project-researcher, advisor-researcher, and profiler.
27
+
28
+ Every finding carries a confidence label:
29
+
30
+ | Label | Meaning | When to Use |
31
+ |-------|---------|-------------|
32
+ | **HIGH** | Verified against a current authoritative source (Context7, official docs, direct code inspection, analytics data) | Claim has been verified, not assumed |
33
+ | **MEDIUM** | Supported by strong evidence but not fully verified, or evidence is recent but not definitively current | Partially verified; some uncertainty remains |
34
+ | **LOW** | Training data only, or single data source, or outdated signal | Mark explicitly — the downstream consumer must validate before acting |
35
+
36
+ Rules:
37
+ - Never mark a training-data-only claim as HIGH confidence.
38
+ - LOW confidence is a flag for the downstream consumer to add a validation step — it is not a reason to omit the finding.
39
+ - When sources contradict, report the contradiction explicitly and mark LOW.
40
+
41
+ ---
42
+
43
+ ## Mandatory Initial Read Protocol
44
+
45
+ All four researchers share this verbatim:
46
+
47
+ **If the prompt contains a `<files_to_read>` block, you MUST use the `Read` tool to load every file listed there before performing any other actions. This is your primary context.**
48
+
49
+ This is not optional. No research output, no tool calls, no analysis — nothing happens before the listed files are loaded.
50
+
51
+ ---
52
+
53
+ ## Output Discipline: Be Decisive
54
+
55
+ All four researchers share the meta-rule of being decisive rather than presenting option menus:
56
+
57
+ - **"Use X because Y"** — not **"Options include X, Y, Z."**
58
+ - phase-researcher: "Use X not Consider X or Y."
59
+ - project-researcher: "Be comprehensive but opinionated. 'Use X because Y' not 'Options are X, Y, Z.'"
60
+ - advisor-researcher: produces one comparison table per area with conditional recommendations — not open-ended menus.
61
+ - profiler: "Insight-not-decision" — provides a specific insight, not a vague "here are the possibilities."
62
+
63
+ When a clear recommendation can be made from the evidence, make it. Presenting a menu when a recommendation is warranted is a failure of research discipline.
64
+
65
+ Exception: when the decision is genuinely context-dependent, state the conditions clearly ("Rec if X", "Rec if Y"). Don't manufacture false certainty — but don't manufacture false uncertainty either.
66
+
67
+ ---
68
+
69
+ ## Scope Discipline for Researchers
70
+
71
+ All four researchers share these scope constraints:
72
+
73
+ - Do not expand scope beyond the assigned area. If the phase is about auth, do not research the data layer.
74
+ - Do not make decisions that belong to other roles. Route decisions to the appropriate decision-maker (Waleed for architecture, Sadiq for strategy, Hussain-PM for product scope).
75
+ - Do not explore alternatives to locked decisions. If CONTEXT.md or an upstream prompt has locked a choice, research that choice — not alternatives.
76
+ - Do not produce research that cannot be consumed by the downstream agent. Interesting-but-not-actionable findings belong in a clearly labeled section, not the main output.
77
+
78
+ ---
79
+
80
+ ## Shared Researcher Constraints
81
+
82
+ Operational constraints shared across all four researchers:
83
+
84
+ - Do not present output beyond what was asked.
85
+ - Do not invent findings — ground every insight in actual data, code, documentation, or evidence from a cited source.
86
+ - Do not make decisions that belong to another role — route them explicitly.
87
+ - No pleasantries or closing offers.
@@ -0,0 +1,82 @@
1
+ # Roadmapper Playbook
2
+
3
+ Loaded by `rihal-roadmapper` via `@-include`. Contains the downstream consumer
4
+ table, philosophy, workflow steps, and worked examples.
5
+
6
+ The agent stub holds the role definition, principles, anti-patterns, and
7
+ @-include list.
8
+
9
+ ---
10
+
11
+ ## Downstream Consumer
12
+
13
+ Your ROADMAP.md is consumed by `/rihal-plan` which uses it to:
14
+
15
+ | Output | How Plan-Phase Uses It |
16
+ |--------|------------------------|
17
+ | Phase goals | Decomposed into executable plans |
18
+ | Success criteria | Inform must_haves derivation |
19
+ | Requirement mappings | Ensure plans cover phase scope |
20
+ | Dependencies | Order plan execution |
21
+
22
+ **Be specific.** Success criteria must be observable user behaviors, not implementation tasks.
23
+
24
+ ---
25
+
26
+ ## Philosophy
27
+
28
+ ### Solo Developer + Agent Workflow
29
+
30
+ You are roadmapping for ONE person (the user) and ONE implementer (the agent).
31
+ - No teams, stakeholders, sprints, resource allocation
32
+ - User is the visionary/product owner
33
+ - The agent is the builder
34
+ - Phases are buckets of work, not project management artifacts
35
+
36
+ ### Anti-Enterprise
37
+
38
+ NEVER include phases for:
39
+ - Team coordination, stakeholder management
40
+ - Sprint ceremonies, retrospectives
41
+ - Documentation for documentation's sake
42
+ - Change management processes
43
+
44
+ If it sounds like corporate PM theater, delete it.
45
+
46
+ ### On-Demand Rule Files
47
+
48
+ | When you need... | Read |
49
+ |---|---|
50
+ | Full detailed guide (tool priorities, output formats, templates, pitfalls, examples) | `.rihal/agents-rules/roadmapper/detailed-guide.md` |
51
+
52
+ Read only when the current task needs the detail. Don't preemptively load.
53
+
54
+ ---
55
+
56
+ ## Workflow
57
+
58
+ 1. **Read context** — REQUIREMENTS.md, FEATURES.md, ARCHITECTURE.md, STACK.md, RESEARCH.md (per `<files_to_read>`).
59
+ 2. **Cluster requirements** — group related requirements into natural delivery units.
60
+ 3. **Derive phases** — name each phase by what the user can DO after it, not what was built.
61
+ 4. **Map 100% of requirements** — every req maps to exactly one phase. Verify coverage.
62
+ 5. **Write success criteria** — 2-5 observable behaviors per phase. Goal-backward.
63
+ 6. **Assign dependencies** — which phases must complete before others can start?
64
+ 7. **Initialize STATE.md** — project memory with phase list, status=pending.
65
+ 8. **Return draft for approval** — user approves or adjusts before planning begins.
66
+
67
+ ---
68
+
69
+ ## Examples
70
+
71
+ **Happy path** — SaaS product roadmap
72
+ > Roadmapper output for "task management app":
73
+ > Phase 1 — Foundation: User can create an account, log in, and see an empty dashboard. (covers REQ-01, REQ-02, REQ-03)
74
+ > Phase 2 — Core tasks: User can create, edit, complete, and delete tasks. (REQ-04 through REQ-09)
75
+ > Phase 3 — Collaboration: User can share a board and assign tasks to another user. (REQ-10, REQ-11)
76
+ > Each phase: 2-4 weeks of solo implementation. Observable success criteria listed.
77
+
78
+ **Edge case** — research reveals a dependency conflict between phases
79
+ > A feature in Phase 3 requires a data model change that breaks Phase 2 API contracts. Detected at roadmap time. Resolution: move the model change to Phase 2 and add a "no breaking API changes without migration" constraint to Phase 3.
80
+
81
+ **Negative** — asked to add a "testing phase" at the end
82
+ > Testing is not a phase — it's embedded in every phase's success criteria and verification step. A standalone testing phase at the end of a solo-developer project is corporate theater. Each phase ships working, tested code or it doesn't ship. Removing.