@hanzlaa/rcode 2.7.2 → 3.1.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 (135) hide show
  1. package/AGENTS.md +11 -1
  2. package/CONTRIBUTING.md +7 -0
  3. package/README.md +39 -20
  4. package/package.json +2 -2
  5. package/rihal/agents/rihal-advisor-researcher.md +1 -1
  6. package/rihal/agents/rihal-assumptions-analyzer.md +1 -1
  7. package/rihal/agents/rihal-codebase-mapper.md +1 -1
  8. package/rihal/agents/rihal-docs-auditor.md +3 -3
  9. package/rihal/agents/rihal-executor.md +10 -0
  10. package/rihal/agents/rihal-fatima.md +31 -101
  11. package/rihal/agents/rihal-haitham.md +125 -57
  12. package/rihal/agents/rihal-hanzla.md +23 -98
  13. package/rihal/agents/rihal-hussain-pm.md +33 -102
  14. package/rihal/agents/rihal-integration-checker.md +1 -1
  15. package/rihal/agents/rihal-mariam.md +26 -94
  16. package/rihal/agents/rihal-noor.md +2 -2
  17. package/rihal/agents/rihal-omar.md +112 -31
  18. package/rihal/agents/rihal-phase-researcher.md +1 -1
  19. package/rihal/agents/rihal-planner.md +25 -0
  20. package/rihal/agents/rihal-project-researcher.md +1 -1
  21. package/rihal/agents/rihal-research-synthesizer.md +1 -1
  22. package/rihal/agents/rihal-roadmapper.md +1 -1
  23. package/rihal/agents/rihal-sadiq.md +30 -95
  24. package/rihal/agents/rihal-sprint-checker.md +19 -1
  25. package/rihal/agents/rihal-verifier.md +1 -1
  26. package/rihal/agents/rihal-waleed.md +34 -98
  27. package/rihal/agents/rihal-yousef.md +111 -52
  28. package/rihal/commands/code-review.md +1 -1
  29. package/rihal/commands/memory-audit.md +10 -0
  30. package/rihal/commands/memory-distill.md +11 -0
  31. package/rihal/commands/memory-init.md +12 -0
  32. package/rihal/commands/memory-update.md +12 -0
  33. package/rihal/config/model-profiles.json +5 -5
  34. package/rihal/references/agent-shared-rules.md +81 -0
  35. package/rihal/references/karpathy-guidelines-full.md +1 -1
  36. package/rihal/references/no-unauthorized-git-ops.md +1 -1
  37. package/rihal/references/verb-dictionary.md +1 -1
  38. package/rihal/skills/actions/2-plan/rihal-frontend-design/SKILL.md +49 -139
  39. package/rihal/skills/actions/2-plan/rihal-frontend-design/references.md +79 -0
  40. package/rihal/skills/actions/4-implementation/rihal-browser-verify/SKILL.md +70 -0
  41. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +1 -1
  42. package/rihal/skills/actions/4-implementation/rihal-ci/SKILL.md +108 -0
  43. package/rihal/skills/actions/4-implementation/rihal-debug/SKILL.md +78 -0
  44. package/rihal/skills/actions/4-implementation/rihal-git-flow/SKILL.md +90 -0
  45. package/rihal/skills/actions/4-implementation/rihal-harden/SKILL.md +91 -0
  46. package/rihal/skills/actions/4-implementation/rihal-incremental/SKILL.md +50 -0
  47. package/rihal/skills/actions/4-implementation/rihal-migrate/SKILL.md +86 -0
  48. package/rihal/skills/actions/4-implementation/rihal-perf/SKILL.md +96 -0
  49. package/rihal/skills/actions/4-implementation/rihal-prove-it/SKILL.md +64 -0
  50. package/rihal/skills/actions/4-implementation/rihal-source-truth/SKILL.md +76 -0
  51. package/rihal/skills/actions/4-implementation/rihal-trim/SKILL.md +73 -0
  52. package/rihal/skills/agents/dalil-scout/SKILL.md +43 -125
  53. package/rihal/skills/agents/dalil-scout/references.md +67 -0
  54. package/rihal/skills/agents/fatima-qa/SKILL.md +21 -0
  55. package/rihal/skills/agents/hanzla-engineer/SKILL.md +22 -0
  56. package/rihal/skills/agents/hussain-pm/SKILL.md +21 -0
  57. package/rihal/skills/agents/majlis-council/SKILL.md +50 -144
  58. package/rihal/skills/agents/majlis-council/references.md +90 -0
  59. package/rihal/skills/agents/mariam-marketing/SKILL.md +19 -0
  60. package/rihal/skills/agents/raees-orchestrator/SKILL.md +56 -117
  61. package/rihal/skills/agents/raees-orchestrator/references.md +47 -0
  62. package/rihal/skills/agents/sadiq-analyst/SKILL.md +30 -0
  63. package/rihal/skills/agents/waleed-architect/SKILL.md +20 -0
  64. package/rihal/skills/core/rihal-advanced-elicitation/SKILL.md +36 -136
  65. package/rihal/skills/core/rihal-advanced-elicitation/references.md +101 -0
  66. package/rihal/skills/core/rihal-auth-audit/SKILL.md +93 -0
  67. package/rihal/skills/core/rihal-brainstorming/SKILL.md +5 -0
  68. package/rihal/skills/core/rihal-client-gate/SKILL.md +91 -0
  69. package/rihal/skills/core/rihal-clone-website/SKILL.md +30 -371
  70. package/rihal/skills/core/rihal-clone-website/references.md +213 -0
  71. package/rihal/skills/core/rihal-deploy-unify/SKILL.md +87 -0
  72. package/rihal/skills/core/rihal-distillator/SKILL.md +37 -187
  73. package/rihal/skills/core/rihal-distillator/references.md +118 -0
  74. package/rihal/skills/core/rihal-editorial-review-prose/SKILL.md +5 -0
  75. package/rihal/skills/core/rihal-editorial-review-structure/SKILL.md +45 -183
  76. package/rihal/skills/core/rihal-editorial-review-structure/references.md +110 -0
  77. package/rihal/skills/core/rihal-help/SKILL.md +6 -1
  78. package/rihal/skills/core/rihal-incident-record/SKILL.md +161 -0
  79. package/rihal/skills/core/rihal-index-docs/SKILL.md +5 -0
  80. package/rihal/skills/core/rihal-init/SKILL.md +5 -0
  81. package/rihal/skills/core/rihal-memory-audit/SKILL.md +88 -0
  82. package/rihal/skills/core/rihal-memory-distill/SKILL.md +87 -0
  83. package/rihal/skills/core/rihal-memory-init/SKILL.md +77 -0
  84. package/rihal/skills/core/rihal-memory-update/SKILL.md +73 -0
  85. package/rihal/skills/core/rihal-mvp-graduate/SKILL.md +116 -0
  86. package/rihal/skills/core/rihal-ocr-consistency/SKILL.md +106 -0
  87. package/rihal/skills/core/rihal-party-mode/SKILL.md +5 -0
  88. package/rihal/skills/core/rihal-rebrand/SKILL.md +133 -0
  89. package/rihal/skills/core/rihal-review-adversarial-general/SKILL.md +5 -0
  90. package/rihal/skills/core/rihal-review-edge-case-hunter/SKILL.md +5 -0
  91. package/rihal/skills/core/rihal-shard-doc/SKILL.md +5 -0
  92. package/rihal/skills/core/rihal-theme-system/SKILL.md +113 -0
  93. package/rihal/team.yaml +3 -22
  94. package/rihal/templates/memory/INDEX.md +46 -0
  95. package/rihal/templates/memory/change-records/.gitkeep +4 -0
  96. package/rihal/templates/memory/distillates/project.distillate.md +11 -0
  97. package/rihal/templates/memory/distillates/stack.distillate.md +11 -0
  98. package/rihal/templates/memory/incidents/known-issues.md +27 -0
  99. package/rihal/templates/memory/incidents/post-mortems/.gitkeep +3 -0
  100. package/rihal/templates/memory/milestones/archive/.gitkeep +2 -0
  101. package/rihal/templates/memory/milestones/current.md +39 -0
  102. package/rihal/templates/memory/people/stakeholders.md +25 -0
  103. package/rihal/templates/memory/people/team.md +35 -0
  104. package/rihal/templates/memory/project/decisions.md +32 -0
  105. package/rihal/templates/memory/project/glossary.md +16 -0
  106. package/rihal/templates/memory/project/stack.md +46 -0
  107. package/rihal/workflows/audit.md +3 -3
  108. package/rihal/workflows/code-review.md +32 -1
  109. package/rihal/workflows/council.md +1 -1
  110. package/rihal/workflows/discuss-phase-power.md +3 -3
  111. package/rihal/workflows/do.md +1 -1
  112. package/rihal/workflows/docs-update.md +4 -4
  113. package/rihal/workflows/execute.md +61 -5
  114. package/rihal/workflows/help.md +5 -5
  115. package/rihal/workflows/karpathy-audit.md +9 -9
  116. package/rihal/workflows/memory-audit.md +83 -0
  117. package/rihal/workflows/memory-distill.md +103 -0
  118. package/rihal/workflows/memory-init.md +102 -0
  119. package/rihal/workflows/memory-update.md +83 -0
  120. package/rihal/workflows/plan.md +66 -1
  121. package/server/dashboard.js +6 -1
  122. package/server/lib/api.js +8 -2
  123. package/server/lib/html/client.js +63 -0
  124. package/server/lib/html/shell.js +5 -0
  125. package/server/lib/scanner.js +76 -1
  126. package/rihal/agents/rihal-architect.md +0 -79
  127. package/rihal/agents/rihal-tech-writer.md +0 -80
  128. package/rihal/commands/check-implementation-readiness.md +0 -8
  129. package/rihal/commands/discuss-phase-power.md +0 -11
  130. package/rihal/commands/karpathy-audit.md +0 -12
  131. package/rihal/commands/new-project-research.md +0 -11
  132. package/rihal/commands/new-project-roadmap.md +0 -11
  133. package/rihal/commands/report.md +0 -10
  134. package/rihal/commands/review-adversarial.md +0 -8
  135. package/rihal/commands/review-edge-case-hunter.md +0 -8
@@ -1,167 +1,67 @@
1
1
  ---
2
2
  name: rihal-advanced-elicitation
3
- description: 'Push the LLM to reconsider, refine, and improve its recent output. Use when user asks for deeper critique or mentions a known deeper critique method, e.g. socratic, first principles, pre-mortem, red team.'
3
+ description: Push the LLM to reconsider, refine, and improve its recent output through structured methods like socratic questioning, first principles, pre-mortem, and red-teaming. Use when the user asks for deeper critique, says "push harder on this", "go deeper", "challenge this", "stress-test this section", or names a specific elicitation method. For prose editing use rihal-editorial-review-prose; for structural review use rihal-editorial-review-structure.
4
4
  agent_party: '{project-root}/.rihal/team.yaml'
5
5
  triggers:
6
6
  - "advanced elicitation"
7
- ---
8
-
9
- # Advanced Elicitation
10
-
11
- **Goal:** Push the LLM to reconsider, refine, and improve its recent output.
12
-
7
+ - "push deeper"
8
+ - "go deeper"
9
+ - "challenge this"
10
+ - "stress-test this"
11
+ - "pre-mortem"
12
+ - "red team this"
13
+ - "first principles"
14
+ user-invocable: true
13
15
  ---
14
16
 
15
17
  ## Overview
16
18
 
17
- Advanced elicitation skill for Rihal Code.
18
-
19
- ## CRITICAL LLM INSTRUCTIONS
19
+ Iterative menu-driven enhancement of recently-generated content. Presents 5 contextually-chosen elicitation methods (from `methods.csv`), runs the user's pick against the current content, shows the improvement, and re-offers the menu until the user picks `x` to proceed. Designed to be invoked indirectly from a parent prompt that just produced a section, then return the enhanced version. Detailed method registry, response cases, and execution rules live in [`references.md`](references.md).
20
20
 
21
- - **MANDATORY:** Execute ALL steps in the flow section IN EXACT ORDER
22
- - DO NOT skip steps or change the sequence
23
- - HALT immediately when halt-conditions are met
24
- - Each action within a step is a REQUIRED action to complete that step
25
- - Sections outside flow (validation, output, critical-context) provide essential context - review and apply throughout execution
26
- - **YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the `communication_language`**
21
+ ## Process
27
22
 
28
- ---
29
-
30
- ## INTEGRATION (When Invoked Indirectly)
31
-
32
- When invoked from another prompt or process:
33
-
34
- 1. Receive or review the current section content that was just generated
35
- 2. Apply elicitation methods iteratively to enhance that specific content
36
- 3. Return the enhanced version back when user selects 'x' to proceed and return back
37
- 4. The enhanced content replaces the original section content in the output document
38
-
39
- ---
23
+ 1. **Method registry loading.** Read `./methods.csv` and `{agent_party}` from `.rihal/team.yaml`.
24
+ 2. **Context analysis.** Use conversation history to detect content type, complexity, stakeholder needs, risk level, creative potential.
25
+ 3. **Smart selection.** Pick 5 methods from the CSV that best match the context. Balance foundational and specialised techniques.
26
+ 4. **Present menu.** Show the 5 options + `r` (reshuffle), `a` (list all), `x` (proceed). HALT for input.
27
+ 5. **Execute on selection.** Apply the chosen method to the current content. Show the enhanced version. Ask the user `apply changes? y/n`. HALT.
28
+ 6. **On `y`** apply changes; on `n` discard. Re-present the menu — every method runs against the latest enhanced version.
29
+ 7. **On `x`** return the fully enhanced content to the invoking skill.
40
30
 
41
- ## FLOW
42
-
43
- ### Step 1: Method Registry Loading
44
-
45
- **Action:** Load and read `./methods.csv` and `{agent_party}`
46
-
47
- #### CSV Structure
48
-
49
- - **category:** Method grouping (core, structural, risk, etc.)
50
- - **method_name:** Display name for the method
51
- - **description:** Rich explanation of what the method does, when to use it, and why it's valuable
52
- - **output_pattern:** Flexible flow guide using arrows (e.g., "analysis -> insights -> action")
53
-
54
- #### Context Analysis
55
-
56
- - Use conversation history
57
- - Analyze: content type, complexity, stakeholder needs, risk level, and creative potential
58
-
59
- #### Smart Selection
60
-
61
- 1. Analyze context: Content type, complexity, stakeholder needs, risk level, creative potential
62
- 2. Parse descriptions: Understand each method's purpose from the rich descriptions in CSV
63
- 3. Select 5 methods: Choose methods that best match the context based on their descriptions
64
- 4. Balance approach: Include mix of foundational and specialized techniques as appropriate
65
-
66
- ---
31
+ **Iterative enhancement:** every method (1-5) applies to the current enhanced version, not the original. The loop continues until `x`.
67
32
 
68
- ### Step 2: Present Options and Handle Responses
69
-
70
- #### Display Format
33
+ ## Output Format
71
34
 
72
35
  ```
73
36
  **Advanced Elicitation Options**
74
37
  _If party mode is active, agents will join in._
75
38
  Choose a number (1-5), [r] to Reshuffle, [a] List All, or [x] to Proceed:
76
39
 
77
- 1. [Method Name]
78
- 2. [Method Name]
79
- 3. [Method Name]
80
- 4. [Method Name]
81
- 5. [Method Name]
40
+ 1. <Method name>
41
+ 2. <Method name>
42
+ 3. <Method name>
43
+ 4. <Method name>
44
+ 5. <Method name>
82
45
  r. Reshuffle the list with 5 new options
83
46
  a. List all methods with descriptions
84
- x. Proceed / No Further Actions
47
+ x. Proceed / No further actions
85
48
  ```
86
49
 
87
- #### Response Handling
88
-
89
- **Case 1-5 (User selects a numbered method):**
90
-
91
- - Execute the selected method using its description from the CSV
92
- - Adapt the method's complexity and output format based on the current context
93
- - Apply the method creatively to the current section content being enhanced
94
- - Display the enhanced version showing what the method revealed or improved
95
- - **CRITICAL:** Ask the user if they would like to apply the changes to the doc (y/n/other) and HALT to await response.
96
- - **CRITICAL:** ONLY if Yes, apply the changes. IF No, discard your memory of the proposed changes. If any other reply, try best to follow the instructions given by the user.
97
- - **CRITICAL:** Re-present the same 1-5,r,x prompt to allow additional elicitations
98
-
99
- **Case r (Reshuffle):**
100
-
101
- - Select 5 random methods from methods.csv, present new list with same prompt format
102
- - When selecting, try to think and pick a diverse set of methods covering different categories and approaches, with 1 and 2 being potentially the most useful for the document or section being discovered
103
-
104
- **Case x (Proceed):**
105
-
106
- - Complete elicitation and proceed
107
- - Return the fully enhanced content back to the invoking skill
108
- - The enhanced content becomes the final version for that section
109
- - Signal completion back to the invoking skill to continue with next section
110
-
111
- **Case a (List All):**
112
-
113
- - List all methods with their descriptions from the CSV in a compact table
114
- - Allow user to select any method by name or number from the full list
115
- - After selection, execute the method as described in the Case 1-5 above
50
+ After execution: show the enhanced version, then ask `apply changes? (y/n/other)`, HALT, and re-present the menu.
116
51
 
117
- **Case: Direct Feedback:**
118
-
119
- - Apply changes to current section content and re-present choices
120
-
121
- **Case: Multiple Numbers:**
122
-
123
- - Execute methods in sequence on the content, then re-offer choices
124
-
125
- ---
126
-
127
- ### Step 3: Execution Guidelines
128
-
129
- - **Method execution:** Use the description from CSV to understand and apply each method
130
- - **Output pattern:** Use the pattern as a flexible guide (e.g., "paths -> evaluation -> selection")
131
- - **Dynamic adaptation:** Adjust complexity based on content needs (simple to sophisticated)
132
- - **Creative application:** Interpret methods flexibly based on context while maintaining pattern consistency
133
- - Focus on actionable insights
134
- - **Stay relevant:** Tie elicitation to specific content being analyzed (the current section from the document being created unless user indicates otherwise)
135
- - **Identify personas:** For single or multi-persona methods, clearly identify viewpoints, and use party members if available in memory already
136
- - **Critical loop behavior:** Always re-offer the 1-5,r,a,x choices after each method execution
137
- - Continue until user selects 'x' to proceed with enhanced content, confirm or ask the user what should be accepted from the session
138
- - Each method application builds upon previous enhancements
139
- - **Content preservation:** Track all enhancements made during elicitation
140
- - **Iterative enhancement:** Each selected method (1-5) should:
141
- 1. Apply to the current enhanced version of the content
142
- 2. Show the improvements made
143
- 3. Return to the prompt for additional elicitations or completion
144
-
145
- ## Output Format
52
+ ## Examples
146
53
 
147
- Interactive menu loop presenting 5 elicitation methods, then the enhanced content after each method application. Final output is the user-approved enhanced version of the original content.
54
+ **Happy path** — `push deeper on this PRD section` → menu of 5 user picks "Pre-Mortem" analysis surfaces 3 blind spots user approves menu re-offered user types `x` return enhanced content to caller.
148
55
 
149
- ## Workflow
56
+ **Edge case — no content in context** — skill asks the user to provide or point to the content to enhance.
150
57
 
151
- 1. Read the user request and extract key parameters.
152
- 2. Execute the skill logic as described in the Overview.
153
- 3. Return output in the format specified below.
58
+ **Negative wrong skill** `review this code for bugs` is code review, not elicitation. Route to `rihal-code-review`.
154
59
 
155
- ## Examples
60
+ ## Memory Bank Hooks
156
61
 
157
- ### Happy path
158
- **User:** "push deeper on this PRD section"
159
- **Result:** Menu of 5 methods → user picks "Pre-Mortem" → analysis reveals 3 blind spots → user approves changes → re-offered menu → user selects 'x' to proceed
62
+ - **Reads:** `methods.csv`, `.rihal/team.yaml` (agent_party), the section content being enhanced
63
+ - **Writes:** the enhanced content is returned to the invoking skill — this skill does not write Memory Bank files itself
160
64
 
161
- ### Edge case
162
- **User:** "elicit" (no content in context)
163
- **Result:** Skill asks user to provide or point to the content to enhance
65
+ ## Detailed reference
164
66
 
165
- ### Negative boundary
166
- **User:** "review this code for bugs"
167
- **Result:** Not elicitation → route to `rihal-code-review` or `rihal-review-adversarial-general`
67
+ See [`references.md`](references.md) for: the CSV schema, the full case-by-case response handler (1-5 / r / a / x / direct feedback / multiple numbers), execution guidelines, and HALT conditions.
@@ -0,0 +1,101 @@
1
+ # Advanced Elicitation — Detailed Reference
2
+
3
+ Detailed method registry semantics, response handling, and execution rules for [`SKILL.md`](SKILL.md).
4
+
5
+ ---
6
+
7
+ ## CSV schema (`methods.csv`)
8
+
9
+ | Column | Meaning |
10
+ |---|---|
11
+ | `category` | Method grouping — core, structural, risk, etc. |
12
+ | `method_name` | Display name shown in the menu |
13
+ | `description` | Rich explanation of what the method does, when to use it, why it's valuable |
14
+ | `output_pattern` | Flexible flow guide using arrows (e.g. `analysis → insights → action`) |
15
+
16
+ The CSV is the single source of truth for available methods. Adding a method = adding a row.
17
+
18
+ ---
19
+
20
+ ## Smart selection (Step 3 of the process)
21
+
22
+ Apply this when picking the 5 methods to surface:
23
+
24
+ 1. **Analyse context** — content type, complexity, stakeholder needs, risk level, creative potential.
25
+ 2. **Parse descriptions** — understand each method's purpose from the rich descriptions.
26
+ 3. **Select 5** — choose methods that best match the context based on their descriptions.
27
+ 4. **Balance approach** — include a mix of foundational and specialised techniques.
28
+
29
+ Slot 1 and Slot 2 should be the most relevant for the section being enhanced — users skim before reading.
30
+
31
+ ---
32
+
33
+ ## Response handling (full case list)
34
+
35
+ **Cases 1-5 — user selects a numbered method:**
36
+ - Execute the method using its CSV description.
37
+ - Adapt complexity and output format to the current context.
38
+ - Apply creatively to the section content being enhanced.
39
+ - Display the enhanced version showing what the method revealed or improved.
40
+ - Ask `apply changes? (y/n/other)` and HALT.
41
+ - On `y` → apply. On `n` → discard. Other → follow user's instructions as best as possible.
42
+ - Re-present the menu.
43
+
44
+ **Case `r` — reshuffle:**
45
+ - Pick 5 random methods from the CSV.
46
+ - Aim for diversity across categories.
47
+ - Slot 1 and Slot 2 should still be the most useful for the current content.
48
+
49
+ **Case `x` — proceed:**
50
+ - Return the fully enhanced content to the invoking skill.
51
+ - The enhanced content becomes the final version for that section.
52
+ - Signal completion so the parent skill continues with the next section.
53
+
54
+ **Case `a` — list all:**
55
+ - Show every method with its description in a compact table.
56
+ - Allow selection by name or number from the full list.
57
+ - Then execute as if selected from cases 1-5.
58
+
59
+ **Case — direct feedback:**
60
+ - Apply the user's feedback to the current section content.
61
+ - Re-present the menu.
62
+
63
+ **Case — multiple numbers (e.g. `1,3`):**
64
+ - Execute methods in sequence on the content.
65
+ - Show the cumulative enhancement after each.
66
+ - Re-present the menu.
67
+
68
+ ---
69
+
70
+ ## Execution guidelines
71
+
72
+ - **Method execution.** Use the CSV description to understand and apply each method.
73
+ - **Output pattern.** Treat the pattern as a flexible guide, not a contract.
74
+ - **Dynamic adaptation.** Adjust complexity to content needs (simple to sophisticated).
75
+ - **Creative application.** Interpret methods flexibly while maintaining pattern consistency.
76
+ - **Stay relevant.** Tie elicitation to the specific content being analysed.
77
+ - **Identify personas.** For single- or multi-persona methods, name viewpoints clearly. Use party members from memory if available.
78
+ - **Loop behaviour.** Always re-offer the menu after each execution.
79
+ - **Build cumulatively.** Each method runs against the current enhanced version, not the original.
80
+ - **Track enhancements.** Maintain history so the user can see the trajectory.
81
+ - **End on `x` or explicit user confirmation.**
82
+
83
+ ---
84
+
85
+ ## HALT conditions
86
+
87
+ - HALT after presenting the menu — wait for user choice.
88
+ - HALT after applying a method — wait for `y/n/other` on whether to keep the change.
89
+ - HALT if `methods.csv` is missing or empty — report and exit.
90
+ - HALT if the section content to enhance is missing — ask the user to provide it.
91
+
92
+ ---
93
+
94
+ ## Integration when invoked indirectly
95
+
96
+ When the parent skill or workflow calls this skill mid-flow:
97
+
98
+ 1. Receive the section content that was just generated.
99
+ 2. Apply elicitation methods iteratively to enhance only that section.
100
+ 3. Return the enhanced version when the user picks `x`.
101
+ 4. The enhanced content replaces the original section in the parent's output document.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: rihal-auth-audit
3
+ description: Audit Keycloak ↔ Active Directory sync, JWT validation, and tenant isolation in multi-org Postgres. Use when seeing authentication weirdness — users disappearing, tokens accepted post-deactivation, "phantom" sessions, or tenant data leaking across orgs. Specifically encodes the lessons from the Rihal Keycloak data-loss incident — sync drift between Keycloak and AD silently broke logins.
4
+ triggers:
5
+ - "auth audit"
6
+ - "keycloak ad sync"
7
+ - "users disappearing"
8
+ - "ghost session"
9
+ - "tenant leak"
10
+ - "jwt validation check"
11
+ - "stale token"
12
+ - "session not invalidating"
13
+ user-invocable: true
14
+ ---
15
+
16
+ ## Overview
17
+
18
+ Authentication bugs are usually silent — the user just gets logged out, or worse, sees someone else's data. This skill encodes the specific failure modes that have actually bitten Rihal projects, with a runnable 10-minute checklist. Default scope is Keycloak + Active Directory + Postgres; adapt the specifics to whatever provider is in use.
19
+
20
+ ## The 10-minute checklist
21
+
22
+ ### Keycloak ↔ AD sync (the load-bearing one)
23
+
24
+ - [ ] Keycloak's AD federation is configured with **periodic sync ENABLED**, not just on-login. Without periodic sync, a user deactivated in AD keeps working in Keycloak until their token expires.
25
+ - [ ] Sync interval ≤ 1 hour for production. Longer windows are how the Rihal incident happened.
26
+ - [ ] Sync errors land in Sentry, not just Keycloak's internal log. If sync silently fails, no one notices for weeks.
27
+ - [ ] On AD deactivation, the corresponding Keycloak session is **explicitly invalidated** — don't rely on the JWT expiring.
28
+
29
+ ### JWT validation
30
+
31
+ - [ ] `iss`, `aud`, `exp`, signature — all four checked on every protected request.
32
+ - [ ] JWKS keys are **fetched dynamically with caching**, not pinned. Keycloak rotates them.
33
+ - [ ] Clock-skew tolerance is ≤ 60s. Larger windows give attackers reuse room.
34
+ - [ ] Token revocation list (or short TTL + refresh) is in place. Stateless JWTs are a CVE waiting for "logout doesn't actually log out".
35
+
36
+ ### Tenant isolation in Postgres
37
+
38
+ - [ ] Every query that reads tenant data has `WHERE tenant_id = $1` where `$1` is **derived from the JWT**, never from a request parameter or cookie.
39
+ - [ ] Postgres Row-Level Security (RLS) policies are enabled OR a query middleware enforces tenant_id (belt + suspenders preferred).
40
+ - [ ] No raw SQL strings interpolate tenant_id — always parameterised.
41
+ - [ ] Audit log captures the tenant_id from the JWT for every write.
42
+
43
+ ### Session lifecycle
44
+
45
+ - [ ] Password change → ALL sessions for that user invalidated (not just the current device).
46
+ - [ ] Permission change (role removed) → token re-validation forced on next request.
47
+ - [ ] Logout actually deletes the server-side session record, not just the cookie.
48
+
49
+ ## Workflow
50
+
51
+ 1. **Inventory the auth surfaces.** Login, refresh, password reset, role change, permission change, logout, OAuth callbacks if present.
52
+ 2. **Run the checklist** above for each surface. Cite the actual file and line for each pass / fail.
53
+ 3. **For each fail:** write a malicious test case before fixing — the test is the proof of regression-locked.
54
+ 4. **Persist findings** to `.rihal/memory/incidents/known-issues.md` if not fixable in this session, or `.rihal/memory/change-records/` if fixed.
55
+
56
+ ## Output Format
57
+
58
+ ```
59
+ Auth audit — <date>
60
+ Surfaces: <count>
61
+
62
+ Keycloak ↔ AD sync:
63
+ ✓ periodic sync enabled (interval: <X>)
64
+ ✗ sync errors not in Sentry
65
+ ⚠ <other findings>
66
+
67
+ JWT validation:
68
+ ✓ all 4 fields checked
69
+ ⚠ <other>
70
+
71
+ Tenant isolation:
72
+ ✗ <table>.<query> missing tenant_id filter — file:line
73
+
74
+ Session lifecycle:
75
+ ✓ <findings>
76
+
77
+ Critical (block launch / production): <count>
78
+ High (fix this sprint): <count>
79
+ Medium (track in known-issues.md): <count>
80
+ ```
81
+
82
+ ## Examples
83
+
84
+ **Happy path — sync drift caught** — Audit shows Keycloak sync is configured but interval is 24h, and errors aren't in Sentry. Findings: 2 critical. Fix: drop interval to 1h + wire sync errors to Sentry. Verify by deactivating a test user in AD and confirming Keycloak removes them within 1h.
85
+
86
+ **Edge case — RLS enabled but middleware bypasses it** — Postgres RLS is on, but the Strapi controllers use a service-role connection that bypasses RLS. Findings: critical. Fix: switch to per-request connections with the user's JWT-derived role.
87
+
88
+ **Negative — "we use OAuth so we're fine"** — Refuse. OAuth ≠ correctly-configured. Run the checklist anyway.
89
+
90
+ ## Memory Bank Hooks
91
+
92
+ - **Reads:** `.rihal/memory/incidents/post-mortems/` (prior auth incidents), `.rihal/memory/project/stack.md` (auth provider)
93
+ - **Writes:** `.rihal/memory/incidents/known-issues.md` (deferred); `.rihal/memory/change-records/YYYYMMDD-NNN.md` (the audit itself)
@@ -96,3 +96,8 @@ Follow the instructions in ./workflow.md.
96
96
  ### Negative boundary
97
97
  **User:** "brainstorm which tech stack to use"
98
98
  **Result:** Redirects to `/rihal:council` or Waleed (CTO) — architecture decisions need structured ADR evaluation, not open ideation.
99
+
100
+ ## Memory Bank Hooks
101
+
102
+ - **Reads:** `.rihal/memory/project/glossary.md` (so generated ideas use project domain terms)
103
+ - **Writes:** the brainstorm output document at the user-specified path; if any idea becomes a committed direction, the user should run `rcode-memory-update` to log it as a decision
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: rihal-client-gate
3
+ description: Client requirement freeze gates and async-comm patterns to stop late requirements from derailing delivery. Use when a project keeps slipping because the client adds requirements mid-sprint, or when the client takes a week to respond to a blocking question. Specifically encodes Rihal's "client late requirements caused project delays" pain — the fix isn't to "communicate better", it's structural gates that the project actually enforces.
4
+ triggers:
5
+ - "client gate"
6
+ - "freeze requirements"
7
+ - "scope creep"
8
+ - "client slow response"
9
+ - "requirements freeze"
10
+ - "client comm pattern"
11
+ - "stop late requirements"
12
+ - "delivery slipping"
13
+ user-invocable: true
14
+ ---
15
+
16
+ ## Overview
17
+
18
+ Late client requirements aren't the client's fault — they're the project's structural failure to define when input is welcome and when it's not. This skill installs three gates: a **scope freeze** at sprint start, a **decision deadline** for blocking questions, and a **change-control** path for everything that arrives after the freeze. Without these, every client comment becomes a potential mid-sprint pivot.
19
+
20
+ ## The 3 gates
21
+
22
+ ### Gate 1 — Scope freeze at sprint start
23
+
24
+ - Sprint scope is locked at sprint kickoff, in writing, with the client signing off.
25
+ - "Locked" means: no new stories enter the sprint without going through Gate 3 (change control).
26
+ - The scope doc lives in `.rihal/memory/milestones/current.md` (not just a Slack message).
27
+ - Sign-off is explicit — a thumbs-up emoji doesn't count. Email or document sign-off.
28
+
29
+ ### Gate 2 — Decision deadline for blocking questions
30
+
31
+ - Every blocking question to the client carries a deadline: e.g. "we need an answer by Wed EOD or we ship the default option".
32
+ - Deadlines are enforced — when missed, the team picks the documented default and moves on.
33
+ - Defaults are documented BEFORE asking — "if you don't reply, we'll do X".
34
+ - Stakeholder response cadences from `.rihal/memory/people/stakeholders.md` inform the deadline (don't give a 24h deadline to a stakeholder with a documented 1-week cadence).
35
+
36
+ ### Gate 3 — Change control after the freeze
37
+
38
+ - Anything new that arrives after the sprint kickoff goes into a queue, not the current sprint.
39
+ - Each change-request gets evaluated weekly:
40
+ - **Critical** (broken core flow, security): emergency mid-sprint slot — but explicit, with a story shipped late.
41
+ - **High** (next sprint priority): goes to top of next sprint's backlog.
42
+ - **Medium / nice-to-have**: parked, reviewed at next milestone.
43
+ - Client sees the queue; transparency prevents "where did my request go?" friction.
44
+
45
+ ## Workflow
46
+
47
+ 1. **At project kickoff:** install the 3 gates. Walk the client through them — explain that this is how delivery dates stay credible.
48
+ 2. **At each sprint kickoff:** run Gate 1. Write down the scope. Get sign-off.
49
+ 3. **Throughout the sprint:** any blocking question gets Gate 2 (deadline + default). Any new requirement gets Gate 3 (queue).
50
+ 4. **At sprint close:** review the change queue with the client. Triage.
51
+ 5. **Persist all gate events** to `.rihal/memory/people/stakeholders.md` and the change-records folder. The pattern of "client always responds Friday afternoon" becomes a planning input.
52
+
53
+ ## Output Format
54
+
55
+ For each sprint:
56
+
57
+ ```
58
+ Sprint kickoff — <date>
59
+ Scope (signed off by <client>):
60
+ - Story 1
61
+ - Story 2
62
+ ...
63
+
64
+ Active blocking questions:
65
+ Q1 (asked <date>, deadline <date>): <question>
66
+ Default if no answer: <documented default>
67
+
68
+ Change queue (post-freeze):
69
+ Critical: <count>
70
+ High: <count>
71
+ Medium: <count>
72
+
73
+ Memory Bank update:
74
+ → .rihal/memory/milestones/current.md (scope sign-off)
75
+ → .rihal/memory/people/stakeholders.md (cadence observations)
76
+ ```
77
+
78
+ ## Examples
79
+
80
+ **Happy path — government client** — Client has documented 1-week response cadence. Gate 2 deadline becomes 5 days, with a default ("we'll go with option B unless you reply"). Project ships on time despite slow comms.
81
+
82
+ **Happy path — scope freeze enforced** — Day 4 of sprint, client adds 3 requirements. Gate 3 queues all 3. Client sees them in the next-sprint backlog. No mid-sprint pivot.
83
+
84
+ **Edge case — "but this requirement is critical"** — Run the Gate 3 critical-or-not test: does this break a core flow? Is it a security issue? If yes, emergency mid-sprint slot with explicit story shipped late. If no, it's a next-sprint priority. Don't let "critical" be a synonym for "I'd really like this".
85
+
86
+ **Negative — "we'll just be more flexible"** — Refuse. Flexibility without gates is how every Rihal-style late-requirements incident happens. Gates make the flexibility explicit and survivable.
87
+
88
+ ## Memory Bank Hooks
89
+
90
+ - **Reads:** `.rihal/memory/people/stakeholders.md` (response cadences), `.rihal/memory/milestones/current.md`
91
+ - **Writes:** scope sign-offs to `.rihal/memory/milestones/current.md`; client change requests to `.rihal/memory/change-records/YYYYMMDD-NNN.md`