@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,128 @@
1
+ # Sprint Checker Playbook
2
+
3
+ Loaded by `rihal-sprint-checker` via `@-include`. Contains the full
4
+ verification methodology: project context loading, upstream input
5
+ handling, core verification principle, 12 verification dimensions,
6
+ execution steps, mandatory output markers, and constraints.
7
+
8
+ CRITICAL: The "Mandatory output markers" section is load-bearing.
9
+ The orchestrator malfunction guard checks for `issues:` and
10
+ `verified_files:` YAML blocks in every agent return. Copy this
11
+ section verbatim — no reformatting.
12
+
13
+ <project_context>
14
+ Before verifying, discover project context:
15
+
16
+ **Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions.
17
+
18
+ **Project skills:** Check `.agent/skills/` or `.agents/skills/` directory if either exists:
19
+ 1. List available skills (subdirectories)
20
+ 2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
21
+ 3. Load specific `rules/*.md` files as needed during verification
22
+ 4.
23
+ 5. Verify sprints account for project skill patterns
24
+
25
+ This ensures verification checks that sprints follow project-specific conventions.
26
+ </project_context>
27
+
28
+ <upstream_input>
29
+ **CONTEXT.md** (if exists) — User decisions from `/rihal-discuss-phase`
30
+
31
+ | Section | How You Use It |
32
+ |---------|----------------|
33
+ | `## Decisions` | LOCKED — sprints MUST implement these exactly. Flag if contradicted. |
34
+ | `## the agent's Discretion` | Freedom areas — planner can choose approach, don't flag. |
35
+ | `## Deferred Ideas` | Out of scope — sprints must NOT include these. Flag if present. |
36
+
37
+ If CONTEXT.md exists, add verification dimension: **Context Compliance**
38
+ - Do sprints honor locked decisions?
39
+ - Are deferred ideas excluded?
40
+ - Are discretion areas handled appropriately?
41
+ </upstream_input>
42
+
43
+ <core_principle>
44
+ **Sprint completeness =/= Goal achievement**
45
+
46
+ A task "create auth endpoint" can be in the sprint while password hashing is missing. The task exists but the goal "secure authentication" won't be achieved.
47
+
48
+ Goal-backward verification works backwards from outcome:
49
+
50
+ 1. What must be TRUE for the phase goal to be achieved?
51
+ 2. Which tasks address each truth?
52
+ 3. Are those tasks complete (files, action, verify, done)?
53
+ 4. Are artifacts wired together, not just created in isolation?
54
+ 5. Will execution complete within context budget?
55
+
56
+ Then verify each level against the actual sprint files.
57
+
58
+ **The difference:**
59
+ - `rihal-verifier`: Verifies code DID achieve goal (after execution)
60
+ - `rihal-sprint-checker`: Verifies sprints WILL achieve goal (before execution)
61
+
62
+ Same methodology (goal-backward), different timing, different subject matter.
63
+ </core_principle>
64
+
65
+ <verification_dimensions>
66
+
67
+
68
+ 1. Requirement Coverage
69
+ 2. Task Completeness
70
+ 3. Dependency Correctness
71
+ 4. Key Links Planned
72
+ 5. Scope Sanity
73
+ 6. Verification Derivation
74
+ 7. Context Compliance (only if CONTEXT.md present)
75
+ 8. Nyquist Compliance
76
+ 9. Cross-Sprint Data Contracts
77
+ 10. CLAUDE.md Compliance
78
+ 11. File References Verification
79
+ 12. Evidence Grounding (issue #649) — every task body MUST include an `<evidence>` block citing real grep hit counts, real `path:line` ranges, or an explicit `creates:` justification. A task that names a file count, component, or pattern with no traceable codebase query is **theoretical** and rejected. Run a sample of the cited greps yourself; if the planner's claimed "13 hits" actually returns 4, downgrade to BLOCKER.
80
+
81
+ Each dimension has pass/partial/fail criteria, remediation guidance, and output format requirements.
82
+
83
+ </verification_dimensions>
84
+
85
+ ## Execution (Slim)
86
+
87
+ 1. **Load context** — Read phase SCOPE.md, CONTEXT.md (if present), RESEARCH.md, and all SPRINT.md files.
88
+ 2. **Run dimensions** — For each verification dimension, collect evidence and classify (pass / partial / fail).
89
+ 3. **Programmatic evidence check (issue #649)** — call:
90
+ ```
91
+ node .rihal/bin/rihal-tools.cjs plan validate-evidence <phase> --spot-check
92
+ ```
93
+ Exit code 0 = pass, 1 = at least one task violation. Inline the JSON `violations[]` into dimension 12 of CHECK.md verbatim — these are authoritative and must not be paraphrased away.
94
+ 4. **Synthesize** — Produce CHECK.md with overall verdict, per-dimension scores, remediation asks.
95
+ 5. **Return** — Block execution if critical dimensions fail (Evidence Grounding is critical); proceed with cautions if only partials.
96
+
97
+ ## Mandatory output markers (per #440 / #445 fix)
98
+
99
+ Every return from this agent MUST include at least one of these YAML markers — they prove tool invocation actually happened. The orchestrator's malfunction guard in `plan.md` blocks execution if none are present.
100
+
101
+ ```yaml
102
+ issues: # always emit, even if empty (issues: [])
103
+ - dimension: <name>
104
+ severity: BLOCKER | WARNING | INFO
105
+ path: <file:line>
106
+ finding: <short text>
107
+
108
+ verified_files: # list every file actually read during verification
109
+ - path: <relative path>
110
+ bytes: <int>
111
+ ```
112
+
113
+ If you have not invoked `Read`, `Bash`, `Grep`, or `Glob` during execution, do NOT return — instead, report the failure and stop. Empty narrative output is treated as malfunction, not pass.
114
+
115
+ ## On-Demand Rule Files
116
+
117
+ | When you need... | Read |
118
+ |---|---|
119
+ | Full dimension definitions with examples, checks, output formats | `.rihal/agents-rules/sprint-checker/dimensions.md` |
120
+ | Step-by-step verification process (Steps 1-9.5) | `.rihal/agents-rules/sprint-checker/process.md` |
121
+
122
+ Read these only when actually performing the check. Don't preemptively load.
123
+
124
+ ## Constraints
125
+
126
+ - Never modify sprints — read-only analysis
127
+ - Produce CHECK.md at `.planning/phases/{phase}/{phase}-{sprint}-CHECK.md`
128
+ - Block execution on critical fails (missing coverage, broken deps, unverifiable outcomes)
@@ -0,0 +1,74 @@
1
+ # UX Designer Playbook
2
+
3
+ Loaded by `rihal-ux-designer` via `@-include`. Contains the full thinking
4
+ framework, 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 UX question has four pressure points:
14
+ 1. **What is the user's goal in this moment?** — Not the feature, the goal. User completes checkout, not "user sees payment form"
15
+ 2. **What feedback does the user need to feel in control?** — Loading states, progress, errors, success. Silence kills trust.
16
+ 3. **What will confuse this user?** — Name one specific misconception and design around it
17
+ 4. **How does this serve the 10th-time user, not the first?** — Delight happens through invisible efficiency
18
+
19
+ ---
20
+
21
+ ## Specializations
22
+
23
+ ### Usability Audits
24
+
25
+ - Audit existing interfaces for clarity, consistency, friction
26
+ - Map user journeys and identify drop-off points
27
+ - Test against accessibility standards (WCAG 2.1 AA minimum)
28
+ - Recommend low-cost, high-impact improvements
29
+
30
+ ### Design System Work
31
+
32
+ - Define component library philosophy: when to have variants vs. separate components
33
+ - Establish typography, color, spacing scales
34
+ - Document patterns for forms, tables, modals, navigation
35
+ - Ensure consistency across surfaces without becoming rigid
36
+
37
+ ### Accessibility Strategy
38
+
39
+ - Audit for WCAG violations (color contrast, keyboard navigation, screen reader support)
40
+ - Design for real disability, not sympathy: cognitive load, motor control, sensory limitations
41
+ - Plan gradual remediation: quick wins vs. architectural changes
42
+ - Educate team on accessible design as capability, not compliance checkbox
43
+
44
+ ### Design-Driven Decisions
45
+
46
+ - Evaluate features through UX lens: launch simpler version first, layer complexity
47
+ - Design for different user segments (power users vs. newcomers)
48
+ - Plan onboarding and progressive disclosure (novice → expert)
49
+ - Define "done" through user success metrics, not design completion
50
+
51
+ ---
52
+
53
+ ## Workflow
54
+
55
+ 1. **Identify the user's goal** — not the feature request. What is the user trying to accomplish?
56
+ 2. **Map current friction** — where do users get stuck, abandon, or misunderstand?
57
+ 3. **Propose flows** — user journey maps, not wireframes. What sequence of interactions gets the user to their goal?
58
+ 4. **Apply four pressure points** — goal clarity, feedback needs, confusing elements, 10th-time efficiency.
59
+ 5. **Handle edge cases** — empty states, error states, loading states, rare-but-valid paths.
60
+ 6. **Define success metrics** — how will we know the design worked? Conversion, task completion time, error rate.
61
+ 7. **Route** — implementation to Haitham, prioritization to Hussain-PM, technical feasibility to Waleed.
62
+
63
+ ---
64
+
65
+ ## Examples
66
+
67
+ **Happy path** — design lead management flow
68
+ > 🎨 **UX Designer:** Goal: sales rep records a lead during a call, in under 30 seconds. Current friction: 7-field form with required fields. Per 10th-time-user, after 100 leads they know the required fields — but they still tab through all 7. Proposed: 3-field quick-add (name, phone, source) → drawer to fill rest later. Empty state for missing data shows inline edit prompt. Error state gives field-specific guidance, not generic "please fix errors."
69
+
70
+ **Edge case** — designing for RTL and LTR simultaneously
71
+ > 🎨 **UX Designer:** Navigation flows left-to-right cognitively in LTR but right-to-left in Arabic RTL. "Next step" arrow direction inverts. Breadcrumbs reverse. Checklist item position mirrors. Route to Haitham for logical-properties implementation — these are implementation decisions once the direction hierarchy is defined.
72
+
73
+ **Negative** — asked to evaluate a feature request for business fit
74
+ > 🎨 **UX Designer:** "Should we build X?" is a strategy question, not a UX question. I evaluate HOW to design X once it's in scope. Route to Sadiq for "should we build it" and Hussain-PM for scope and prioritization: `/rihal-council sadiq hussain-pm — feature fit for [X]`.
@@ -0,0 +1,104 @@
1
+ # Verifier Playbook
2
+
3
+ Loaded by `rihal-verifier` via `@-include`. Contains the full verification
4
+ flow, final status tables, on-demand rule files, and success criteria checklist.
5
+
6
+ The agent stub holds the role definition, critical rules, constraints, and
7
+ @-include list.
8
+
9
+ ---
10
+
11
+ ## Project Context Loading
12
+
13
+ Before verifying, discover project context:
14
+
15
+ - **Project instructions:** Read `./CLAUDE.md` if it exists. Follow project-specific guidelines.
16
+ - **Project skills:** Check `.agent/skills/` or `.agents/skills/` directories. Load relevant `SKILL.md` indexes and `rules/*.md` files as needed during verification.
17
+
18
+ ---
19
+
20
+ ## Core Principle
21
+
22
+ **Task completion ≠ Goal achievement.** A task "create chat component" can be marked complete when the component is a placeholder. Goal-backward verification asks:
23
+
24
+ 1. What must be TRUE for the goal to be achieved?
25
+ 2. What must EXIST for those truths to hold?
26
+ 3. What must be WIRED for those artifacts to function?
27
+ 4. What data must FLOW for those artifacts to be real?
28
+
29
+ ---
30
+
31
+ ## Verification Flow (Slim)
32
+
33
+ 1. **Check for previous VERIFICATION.md** — if exists with gaps, enter RE-VERIFICATION MODE (skip to Step 3).
34
+ 2. **Load context** — SPRINT.md, SUMMARY.md, ROADMAP.md goal, REQUIREMENTS.md.
35
+ 3. **Establish must-haves** — from PLAN frontmatter (Option A), ROADMAP success criteria (Option B), or derive from goal (Option C).
36
+ 4. **Verify observable truths** — for each truth, status ✓ VERIFIED / ✗ FAILED / ? UNCERTAIN.
37
+ 5. **Verify artifacts (3 levels)** — exists, substantive, wired. Use `rihal-tools.cjs verify artifacts`.
38
+ 6. **Data-flow trace (Level 4)** — for wired artifacts rendering dynamic data, trace upstream to confirm real data source.
39
+ 7. **Verify key links** — component→API, API→DB, form→handler, state→render. Use `rihal-tools.cjs verify key-links`.
40
+ 8. **Requirements coverage** — cross-reference PLAN `requirements:` against REQUIREMENTS.md. Flag ORPHANED.
41
+ 9. **Anti-pattern scan** — TODO/FIXME/placeholder/empty-return/hardcoded-empty. Classify Blocker/Warning/Info.
42
+ 10. **Behavioral spot-checks** — run 2-4 quick commands (<10s each) against runnable code. Skip if no runnable entry points.
43
+ 11. **Human verification needs** — visual, real-time, external service, uncertain wiring.
44
+ 12. **Determine status** — passed | gaps_found | human_needed. Score = verified_truths / total_truths.
45
+ 13. **Structure gap output** — YAML frontmatter for `/rihal-plan --gaps`.
46
+ 14. **Create VERIFICATION.md** — use Write tool (never heredoc). Return to orchestrator. DO NOT COMMIT.
47
+
48
+ ---
49
+
50
+ ## Final Status Tables
51
+
52
+ **Artifact status (all 4 levels):**
53
+
54
+ | Exists | Substantive | Wired | Data Flows | Status |
55
+ | ------ | ----------- | ----- | ---------- | ------ |
56
+ | ✓ | ✓ | ✓ | ✓ | ✓ VERIFIED |
57
+ | ✓ | ✓ | ✓ | ✗ | ⚠️ HOLLOW — wired but data disconnected |
58
+ | ✓ | ✓ | ✗ | - | ⚠️ ORPHANED |
59
+ | ✓ | ✗ | - | - | ✗ STUB |
60
+ | ✗ | - | - | - | ✗ MISSING |
61
+
62
+ **Overall status decision:**
63
+
64
+ - **passed** — All truths VERIFIED, all artifacts pass 1-3, all key links WIRED, no blocker anti-patterns.
65
+ - **gaps_found** — Any truth FAILED, artifact MISSING/STUB, key link NOT_WIRED, or blocker anti-patterns found.
66
+ - **human_needed** — All automated checks pass but items flagged for human verification.
67
+
68
+ ---
69
+
70
+ ## On-Demand Rule Files
71
+
72
+ | When you need... | Read |
73
+ |---|---|
74
+ | Previous-verification check + load context + establish must-haves (Steps 0-2) | `.rihal/agents-rules/verifier/context-loading.md` |
75
+ | Observable truths + 3-level artifact verification (Steps 3-4) | `.rihal/agents-rules/verifier/artifact-verification.md` |
76
+ | Level-4 data-flow trace patterns (Step 4b) | `.rihal/agents-rules/verifier/data-flow-trace.md` |
77
+ | Key link wiring fallback patterns (Step 5) | `.rihal/agents-rules/verifier/key-links.md` |
78
+ | Requirements coverage + orphaned detection (Step 6) | `.rihal/agents-rules/verifier/requirements-coverage.md` |
79
+ | Anti-pattern grep commands + stub reference patterns (Step 7) | `.rihal/agents-rules/verifier/anti-patterns.md` |
80
+ | Behavioral spot-check command examples (Step 7b) | `.rihal/agents-rules/verifier/behavioral-spot-checks.md` |
81
+ | Status determination + gap YAML structure (Steps 8-10) | `.rihal/agents-rules/verifier/gap-output.md` |
82
+ | VERIFICATION.md template + return-to-orchestrator format | `.rihal/agents-rules/verifier/verification-report.md` |
83
+
84
+ Read these ONLY when the current step needs them. Don't preemptively load.
85
+
86
+ ---
87
+
88
+ ## Success Criteria
89
+
90
+ - [ ] Previous VERIFICATION.md checked (Step 0)
91
+ - [ ] Must-haves loaded (re-verification) or established (initial mode)
92
+ - [ ] All truths verified with status and evidence
93
+ - [ ] All artifacts checked at levels 1-3 (exists, substantive, wired)
94
+ - [ ] Data-flow trace (Level 4) run on wired artifacts that render dynamic data
95
+ - [ ] All key links verified
96
+ - [ ] Requirements coverage assessed (if applicable)
97
+ - [ ] Anti-patterns scanned and categorized
98
+ - [ ] Behavioral spot-checks run on runnable code (or skipped with reason)
99
+ - [ ] Human verification items identified
100
+ - [ ] Overall status determined
101
+ - [ ] Gaps structured in YAML frontmatter (if gaps_found)
102
+ - [ ] Re-verification metadata included (if previous existed)
103
+ - [ ] VERIFICATION.md created via Write tool
104
+ - [ ] Results returned to orchestrator (NOT committed)
@@ -17,11 +17,15 @@ failed_layers: '' # set at runtime: comma-separated list of layers that failed o
17
17
 
18
18
  2. Launch parallel subagents without conversation context. If subagents are not available, generate prompt files in `{implementation_artifacts}` — one per reviewer role below — and HALT. Ask the user to run each in a separate session (ideally a different LLM) and paste back the findings. When findings are pasted, resume from this point and proceed to step 3.
19
19
 
20
- - **Blind Hunter** receives `{diff_output}` only. No spec, no context docs, no project access. Invoke via the `rihal-review-adversarial-general` skill.
20
+ **Subagent mapping** (issue #720): the three reviewer roles below map to actual agents shipped in `.claude/agents/`. The skill names that used to be referenced here (`rihal-review-adversarial-general`, `rihal-review-edge-case-hunter`) are skills, not subagents, and `Task(subagent_type=...)` cannot reach them. Use the agents listed.
21
21
 
22
- - **Edge Case Hunter** — receives `{diff_output}` and read access to the project. Invoke via the `rihal-review-edge-case-hunter` skill.
22
+ - **Blind Hunter** — receives `{diff_output}` only. No spec, no context docs, no project access. Dispatch:
23
+ `Task(subagent_type="rihal-security-adversary", model="sonnet", prompt="<adversarial review of diff>")`. The security-adversary persona's cynical mindset is the right fit for an isolated diff-only review.
23
24
 
24
- - **Acceptance Auditor** (only if `{review_mode}` = `"full"`) — receives `{diff_output}`, the content of the file at `{spec_file}`, and any loaded context docs. Its prompt:
25
+ - **Edge Case Hunter** — receives `{diff_output}` and read access to the project. Dispatch:
26
+ `Task(subagent_type="rihal-edge-case-hunter", model="sonnet", prompt="<enumerate edge cases for diff>")`.
27
+
28
+ - **Acceptance Auditor** (only if `{review_mode}` = `"full"`) — receives `{diff_output}`, the content of the file at `{spec_file}`, and any loaded context docs. Dispatch via `rihal-code-reviewer`. Its prompt:
25
29
  > You are an Acceptance Auditor. Review this diff against the spec and context docs. Check for: violations of acceptance criteria, deviations from spec intent, missing implementation of specified behavior, contradictions between spec constraints and actual code. Output findings as a Markdown list. Each finding: one-line title, which AC/constraint it violates, and evidence from the diff.
26
30
 
27
31
  3. **Subagent failure handling**: If any subagent fails, times out, or returns empty results, append the layer name to `{failed_layers}` (comma-separated) and proceed with findings from the remaining layers.
@@ -59,7 +59,7 @@ Majlis (مجلس) is the consulting council. Convenes specialists when a questio
59
59
  | DM | Decision matrix — walk through a specific choice with pros/cons per agent | `rihal-majlis-decision` |
60
60
  | CM | Crisis mode — rapid consultation during an incident | `rihal-majlis-crisis` |
61
61
 
62
- ## Consultation Protocol
62
+ ## Workflow
63
63
 
64
64
  1. **Frame the question** — restate clearly so every agent answers the same question.
65
65
  2. **Determine the council** — identify which agents' domains are relevant (3 minimum, 12 maximum, 3-8 ideal).
package/rihal/team.yaml CHANGED
@@ -520,3 +520,35 @@ tactical_agents:
520
520
  role: Verifier
521
521
  authority_level: quality
522
522
  description: Verifies phase goal achievement goal-backward
523
+
524
+ - id: rihal-i18n-auditor
525
+ name: i18n Auditor
526
+ file_path: rihal/agents/rihal-i18n-auditor.md
527
+ skill_path: rihal/skills/agents/rihal-i18n-auditor
528
+ role: i18n Auditor
529
+ authority_level: quality
530
+ description: Detects hardcoded English strings, missing response_language threading, and RTL layout gaps
531
+
532
+ - id: rihal-cross-platform-auditor
533
+ name: Cross-Platform Auditor
534
+ file_path: rihal/agents/rihal-cross-platform-auditor.md
535
+ skill_path: rihal/skills/agents/rihal-cross-platform-auditor
536
+ role: Cross-Platform Auditor
537
+ authority_level: quality
538
+ description: Detects bash-isms, macOS-only flags, hardcoded Unix paths, and CRLF line endings
539
+
540
+ - id: rihal-dep-auditor
541
+ name: Dep Auditor
542
+ file_path: rihal/agents/rihal-dep-auditor.md
543
+ skill_path: rihal/skills/agents/rihal-dep-auditor
544
+ role: Dependency Health Auditor
545
+ authority_level: quality
546
+ description: Scans for outdated packages, CVEs, unused dependencies, and loose version pins
547
+
548
+ - id: rihal-observability-auditor
549
+ name: Observability Auditor
550
+ file_path: rihal/agents/rihal-observability-auditor.md
551
+ skill_path: rihal/skills/agents/rihal-observability-auditor
552
+ role: Observability Auditor
553
+ authority_level: quality
554
+ description: Detects unguarded shell calls, unchecked Task() results, and missing INIT .ok checks
@@ -104,6 +104,43 @@ Update STATE.md to reflect the new phase:
104
104
  If "Roadmap Evolution" section doesn't exist, create it.
105
105
  </step>
106
106
 
107
+ <step name="milestone_health_check">
108
+ After the phase is added, run the milestone-health gauge (issue #718):
109
+
110
+ ```bash
111
+ HEALTH=$(node ".rihal/bin/rihal-tools.cjs" milestone-health 2>/dev/null)
112
+ RECOMMENDATION=$(echo "$HEALTH" | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{try{console.log(JSON.parse(s).recommendation||'unknown')}catch{console.log('unknown')}})")
113
+ OPEN_COUNT=$(echo "$HEALTH" | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{try{console.log(JSON.parse(s).open_phases||0)}catch{console.log(0)}})")
114
+ MILESTONE_NAME=$(echo "$HEALTH" | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{try{console.log(JSON.parse(s).milestone||'')}catch{console.log('')}})")
115
+ ```
116
+
117
+ If `RECOMMENDATION` is `should-close` (≥12 open phases), surface a hard nudge:
118
+
119
+ ```
120
+ ⚠ Milestone health: {MILESTONE_NAME} has {OPEN_COUNT} open phases.
121
+
122
+ Phase {N} is now in this milestone, but the milestone is well past the
123
+ 12-phase threshold for considering closure. Phases are accumulating without
124
+ a milestone boundary — historically this is where roadmaps lose structure.
125
+
126
+ Recommended next step:
127
+ /rihal-complete-milestone close {MILESTONE_NAME} cleanly + archive done phases
128
+ /rihal-new-milestone start a fresh milestone for ongoing work
129
+
130
+ If you genuinely want a giant single-milestone roadmap, ignore this and
131
+ continue. The threshold is conservative on purpose.
132
+ ```
133
+
134
+ If `RECOMMENDATION` is `consider-closing` (8-11 open phases), softer nudge:
135
+
136
+ ```
137
+ ℹ Milestone health: {MILESTONE_NAME} has {OPEN_COUNT} open phases — getting full.
138
+ Consider /rihal-complete-milestone before adding more.
139
+ ```
140
+
141
+ If `RECOMMENDATION` is `healthy`, say nothing.
142
+ </step>
143
+
107
144
  <step name="completion">
108
145
  Present completion summary:
109
146
 
@@ -53,6 +53,25 @@ Then stop.
53
53
  If `SNAPSHOT.weighted_progress > 0` but `SNAPSHOT.completed_count === 0`, display
54
54
  the weighted bar as the primary progress indicator to avoid a misleading `0/N (0%)`.
55
55
 
56
+ ### Milestone health (issue #718)
57
+
58
+ After the main dashboard, call `rihal-tools milestone-health` and surface
59
+ a gauge when the milestone is full:
60
+
61
+ ```bash
62
+ HEALTH=$(node ".rihal/bin/rihal-tools.cjs" milestone-health 2>/dev/null)
63
+ ```
64
+
65
+ Parse `recommendation`, `open_phases`, `phase_count`. Display ONLY when
66
+ `recommendation` is not `healthy`:
67
+
68
+ ```
69
+ ⚠ Milestone health: {open_phases} open / {phase_count} total — {recommendation}
70
+ → /rihal-complete-milestone to close, or /rihal-new-milestone to fork
71
+ ```
72
+
73
+ When healthy, print nothing — keeps status terse for normal projects.
74
+
56
75
  ## Step 3 — Phases section
57
76
 
58
77
  For each entry in `SNAPSHOT.phases[]`:
@@ -79,7 +79,7 @@ const server = http.createServer((req, res) => {
79
79
  res.end('Not found');
80
80
  });
81
81
 
82
- server.listen(PORT, () => {
82
+ server.listen(PORT, '127.0.0.1', () => {
83
83
  console.log(`\n🕌 Majlis (مجلس) — Rihal Code Dashboard`);
84
84
  console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
85
85
  console.log(` Mode: view-only`);
package/server/lib/api.js CHANGED
@@ -132,6 +132,13 @@ function handleApiFile(req, res, projectRoot) {
132
132
  if (!resolved.startsWith(projectRoot + path.sep) && resolved !== projectRoot) {
133
133
  res.writeHead(403); res.end('Forbidden'); return;
134
134
  }
135
+ // Dereference symlinks so a symlink outside projectRoot cannot bypass the guard
136
+ let realResolved;
137
+ try { realResolved = fs.realpathSync(resolved); }
138
+ catch { res.writeHead(404); res.end('File not found'); return; }
139
+ if (!realResolved.startsWith(projectRoot + path.sep) && realResolved !== projectRoot) {
140
+ res.writeHead(403); res.end('Forbidden'); return;
141
+ }
135
142
  if (!resolved.endsWith('.md')) {
136
143
  res.writeHead(403); res.end('Forbidden: only .md files'); return;
137
144
  }
@@ -29,9 +29,9 @@ function chip(s) {
29
29
  : s === 'blocked' ? 'blocked'
30
30
  : s === 'planned' ? 'planned'
31
31
  : s === 'todo' ? 'todo' : 'other';
32
- return '<span class="status-chip ' + c + '">● ' + s + '</span>';
32
+ return '<span class="status-chip ' + c + '">● ' + esc(s) + '</span>';
33
33
  }
34
- function tag(t) { return '<span class="tag">' + t + '</span>'; }
34
+ function tag(t) { return '<span class="tag">' + esc(t) + '</span>'; }
35
35
  function esc(s) { return String(s || '').replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;'); }
36
36
  function pct(d, t) { return t > 0 ? Math.round(d/t*100) + '%' : '—'; }
37
37
  function pctNum(d, t) { return t > 0 ? Math.round(d/t*100) : 0; }