@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
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: rihal-memory-distill
3
+ description: >
4
+ Generate or regenerate Memory Bank distillates — token-optimised, lossless
5
+ compressions of Memory Bank source files for fast LLM context loading.
6
+ Produces `distillates/project.distillate.md` and `distillates/stack.distillate.md`.
7
+ Activates when the user says "distill memory bank", "regenerate distillates",
8
+ "refresh distillates", "/rcode:memory-distill", "compress memory bank",
9
+ "memory bank ko compress karo". Do NOT use for: bootstrap (use rcode-memory-init),
10
+ surgical updates (use rcode-memory-update), or finding stale entries (use
11
+ rcode-memory-audit). For non-Memory-Bank document compression, use the
12
+ existing rihal-distillator skill.
13
+ triggers:
14
+ - "distill memory bank"
15
+ - "regenerate distillates"
16
+ - "refresh distillates"
17
+ - "compress memory bank"
18
+ - "memory bank ko compress karo"
19
+ - "/rcode:memory-distill"
20
+ user-invocable: true
21
+ ---
22
+
23
+ ## Overview
24
+
25
+ Read the Memory Bank source files and produce two LLM-optimised distillates: a full project distillate (`distillates/project.distillate.md`) and a stack-only distillate (`distillates/stack.distillate.md`). Distillates are lossless: every fact, decision, constraint, and relationship from the source files is preserved, but presentation overhead (headings, tables, prose connective tissue) is stripped to minimise token cost. Reuses the same compression principle as the existing `rihal-distillator` skill, scoped to Memory Bank files.
26
+
27
+ ## Workflow
28
+
29
+ 1. **Discover sources.** Walk `.rihal/memory/` and group files by target distillate:
30
+ - **project distillate:** `project/*.md`, `people/*.md`, `milestones/current.md`, `incidents/known-issues.md`
31
+ - **stack distillate:** `project/stack.md` only
32
+ 2. **Hash sources.** Compute a digest of source file mtimes. If digest matches the existing distillate's `source-digest:` frontmatter, skip regeneration unless `--force` was passed.
33
+ 3. **Compress.** For each target, read all source files, extract every fact/decision/constraint/relationship, and produce a dense markdown document. No summary mode — preserve everything.
34
+ 4. **Verify losslessness.** For each fact in the source files, confirm it appears (verbatim or in directly-equivalent form) in the distillate. Report any drops as a warning.
35
+ 5. **Write output** with frontmatter:
36
+ ```yaml
37
+ ---
38
+ generated: true
39
+ do-not-edit: true
40
+ regenerate-with: /rcode:memory-distill
41
+ source-digest: <hash>
42
+ generated-at: <ISO datetime>
43
+ source-files: [list of files included]
44
+ token-estimate: <approximate>
45
+ ---
46
+ ```
47
+ 6. **Print summary.** Show source file count, output token estimate, time taken.
48
+
49
+ ## Output Format
50
+
51
+ ```
52
+ ✓ Memory Bank distillates regenerated
53
+
54
+ distillates/project.distillate.md
55
+ sources: 9 files
56
+ tokens: ~4,800
57
+ digest: a1b2c3d4
58
+
59
+ distillates/stack.distillate.md
60
+ sources: 1 file
61
+ tokens: ~600
62
+ digest: e5f6a7b8
63
+
64
+ Skip notice: source files unchanged since last run — no rewrite was needed.
65
+ ```
66
+
67
+ ## Examples
68
+
69
+ **Happy path**
70
+ User: `/rcode:memory-distill`
71
+ Skill: reads sources, regenerates both distillates, prints summary. ~10 seconds for a typical project.
72
+
73
+ **No-op skip**
74
+ User runs distill twice in a row without changing source files. Second run reports "source files unchanged" and exits without rewriting.
75
+
76
+ **Force refresh**
77
+ User: `/rcode:memory-distill --force`
78
+ Skill: regenerates regardless of digest match. Useful when distillate format itself changes.
79
+
80
+ **Negative — used on non-memory docs**
81
+ User wants to compress `docs/REFERENCE.md`. Wrong skill — direct them to `rihal-distillator` (which handles arbitrary documents).
82
+
83
+ ## Memory Bank Hooks
84
+
85
+ - **Reads:** every file under `.rihal/memory/{project,people,milestones,incidents}/`
86
+ - **Writes:** `.rihal/memory/distillates/project.distillate.md`, `.rihal/memory/distillates/stack.distillate.md`
87
+ - **Idempotent:** safe to re-run; skips work when sources are unchanged
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: rihal-memory-init
3
+ description: >
4
+ Bootstrap the rcode Memory Bank for a project. Copies templates from
5
+ `rihal/templates/memory/` into `.rihal/memory/`, then asks 5 questions to
6
+ populate the most-used files (stack, current milestone, primary stakeholder).
7
+ Activates when the user says "init memory bank", "bootstrap memory",
8
+ "set up memory bank", "/rcode:memory-init", "create memory bank",
9
+ "memory bank initialise", "memory bank kaise banayen". Do NOT use for:
10
+ updating an existing Memory Bank (use rcode-memory-update), regenerating
11
+ distillates (use rcode-memory-distill), or finding stale entries (use
12
+ rcode-memory-audit).
13
+ triggers:
14
+ - "init memory bank"
15
+ - "bootstrap memory"
16
+ - "set up memory bank"
17
+ - "create memory bank"
18
+ - "memory bank initialise"
19
+ - "memory bank kaise banayen"
20
+ - "/rcode:memory-init"
21
+ user-invocable: true
22
+ ---
23
+
24
+ ## Overview
25
+
26
+ Initialise the `.rihal/memory/` directory in the current project. Copies the template scaffold, fills `INDEX.md` with the project name and date, and asks five short questions to seed the most useful files. Skill is idempotent: re-running on an initialised project will not overwrite existing entries — it reports gaps instead.
27
+
28
+ ## Workflow
29
+
30
+ 1. **Check for existing Memory Bank.** If `.rihal/memory/INDEX.md` exists, switch to "report mode": list files, show which sections are still empty, and exit. Do not overwrite.
31
+ 2. **Copy templates.** Recursively copy `rihal/templates/memory/` → `.rihal/memory/`, preserving the directory structure.
32
+ 3. **Substitute placeholders.** Replace `{{PROJECT_NAME}}` with the directory name (or `package.json` `name` if present), and `{{INIT_DATE}}` with today's ISO date.
33
+ 4. **Ask the 5 init questions** (one at a time, accept short answers):
34
+ 1. One-sentence project goal → seeds `milestones/current.md` Goal field
35
+ 2. Primary stack (frontend / backend / database) → seeds `project/stack.md` Runtime table
36
+ 3. Current milestone name → seeds `milestones/current.md` Milestone Name
37
+ 4. Primary external stakeholder (name + role) → seeds `people/stakeholders.md`
38
+ 5. Any known production issue today → seeds `incidents/known-issues.md`
39
+ 5. **Print the summary.** Show the file tree, where to add more, and recommend running `/rcode:memory-distill` once `project/stack.md` is fleshed out.
40
+ 6. **Update `.rihal/state.json`** to record `memory_bank.initialised_at` so the dashboard shows it as live.
41
+
42
+ ## Output Format
43
+
44
+ ```
45
+ ✓ Memory Bank initialised at .rihal/memory/
46
+
47
+ Files seeded from your answers:
48
+ • milestones/current.md — goal + milestone name
49
+ • project/stack.md — runtime stack
50
+ • people/stakeholders.md — 1 contact
51
+ • incidents/known-issues.md — 1 entry
52
+
53
+ Files still empty (fill as you go):
54
+ • project/glossary.md
55
+ • people/team.md
56
+ • change-records/
57
+
58
+ Next step: run /rcode:memory-distill to generate fast-load distillates.
59
+ ```
60
+
61
+ ## Examples
62
+
63
+ **Happy path**
64
+ User: `/rcode:memory-init`
65
+ Skill: asks 5 questions, populates files, prints summary, updates state.json. Total time: under two minutes.
66
+
67
+ **Already initialised**
68
+ User: `/rcode:memory-init` on a project that already has `.rihal/memory/INDEX.md`.
69
+ Skill: refuses to overwrite. Lists files, shows which are still empty, suggests `/rcode:memory-update` for surgical edits.
70
+
71
+ **Negative — wrong skill**
72
+ User wants to "update the stakeholder list". Do not use this skill. Use `rcode-memory-update`.
73
+
74
+ ## Memory Bank Hooks
75
+
76
+ - **Reads:** `package.json` (for project name), existing `.rihal/state.json`
77
+ - **Writes:** every file under `.rihal/memory/` (from templates), `.rihal/state.json` (`memory_bank.initialised_at`)
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: rihal-memory-update
3
+ description: >
4
+ Surgical update of specific Memory Bank files from conversation context.
5
+ Adds an entry to decisions.md, appends a known issue, updates the current
6
+ milestone, or extends the stakeholder list — without rewriting whole files.
7
+ Activates when the user says "remember this decision", "log this decision",
8
+ "add this to memory bank", "update memory bank", "/rcode:memory-update",
9
+ "save this to memory", "yeh memory mein add karo", or after a council
10
+ session that produced a clear decision. Do NOT use for: initial bootstrap
11
+ (use rcode-memory-init), regenerating distillates (use rcode-memory-distill),
12
+ or general note-taking (use the existing rihal-note workflow).
13
+ triggers:
14
+ - "remember this decision"
15
+ - "log this decision"
16
+ - "add this to memory bank"
17
+ - "update memory bank"
18
+ - "save this to memory"
19
+ - "yeh memory mein add karo"
20
+ - "/rcode:memory-update"
21
+ user-invocable: true
22
+ ---
23
+
24
+ ## Overview
25
+
26
+ Append or update a single Memory Bank file based on the current conversation context. Surgical: never rewrites a whole file, never deletes existing content. Auto-routes the update to the right file based on what's being saved (decision → `decisions.md`, issue → `known-issues.md`, etc.).
27
+
28
+ ## Workflow
29
+
30
+ 1. **Detect target file.** Read the user's intent and pick the destination:
31
+ - "decision" / "we chose" / "ADR" → `project/decisions.md`
32
+ - "issue" / "bug" / "workaround" → `incidents/known-issues.md`
33
+ - "stakeholder" / "client" / "contact" → `people/stakeholders.md`
34
+ - "milestone" / "sprint" / "phase" → `milestones/current.md`
35
+ - "stack" / "we're using" / "switched to" → `project/stack.md`
36
+ - "term" / "what does X mean" / "glossary" → `project/glossary.md`
37
+ - "team" / "who owns" → `people/team.md`
38
+ 2. **Confirm target with user.** Show the file path and the entry to be added. Wait for ack.
39
+ 3. **Append using the file's documented format.** Each Memory Bank file documents its own entry format at the top — follow it exactly.
40
+ 4. **Never overwrite.** If the user wants to *change* an existing entry, refuse and direct them to edit the file directly. This skill is append-only for safety.
41
+ 5. **Stamp with date** in `YYYY-MM-DD` format.
42
+ 6. **Suggest distillate refresh** if the update was substantive (`/rcode:memory-distill`).
43
+
44
+ ## Output Format
45
+
46
+ ```
47
+ ✓ Appended to .rihal/memory/project/decisions.md
48
+
49
+ ### 2026-04-26 — Switch to Postgres 16 from Postgres 14
50
+ **Decision:** Upgrade primary database to Postgres 16.4.
51
+ **Rationale:** ...
52
+
53
+ Tip: run /rcode:memory-distill to refresh the project distillate.
54
+ ```
55
+
56
+ ## Examples
57
+
58
+ **Happy path — decision**
59
+ User: `remember this decision: we picked Temporal over BullMQ because we need durable workflows`
60
+ Skill: detects decision intent, formats entry, confirms, appends to `decisions.md`.
61
+
62
+ **Happy path — known issue**
63
+ User: `add to memory bank: SSO login fails on Safari 16, workaround is Chrome`
64
+ Skill: detects issue intent, formats entry, appends to `incidents/known-issues.md`.
65
+
66
+ **Negative — destructive request**
67
+ User: `update memory bank: change the milestone goal to X`
68
+ Skill: refuses ("this skill is append-only"). Suggests editing `milestones/current.md` directly.
69
+
70
+ ## Memory Bank Hooks
71
+
72
+ - **Reads:** the target file's existing format header (to preserve structure)
73
+ - **Writes:** exactly one append to one file per invocation
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: rihal-mvp-graduate
3
+ description: Move an MVP to production-grade infrastructure incrementally. Use when an MVP has shipped, has real users, and "the next round of features" is hitting walls — flaky deploys, no observability, manual ops, hand-rolled auth. Specifically addresses Rihal's "MVPs delivered, hard to revamp" pain. Companion to rihal-migrate (the engineering skill); this one is the strategic / sequenced version specifically scoped to MVP→prod.
4
+ triggers:
5
+ - "graduate this mvp"
6
+ - "mvp to prod plan"
7
+ - "real users now"
8
+ - "scale beyond demo"
9
+ - "post-mvp infrastructure"
10
+ - "revamp mvp"
11
+ - "hardening pass"
12
+ - "ready for production"
13
+ user-invocable: true
14
+ ---
15
+
16
+ ## Overview
17
+
18
+ This skill is the strategic version of `rihal-migrate`: same gap analysis, but framed as a multi-week plan with stakeholder sequencing rather than a one-week-per-gap engineering checklist. Use this when the conversation starts with the founder/CEO; use `rihal-migrate` when the conversation starts with the engineer.
19
+
20
+ ## The graduation framework
21
+
22
+ ### Phase A — Stop the bleeding (week 1)
23
+
24
+ If any of these are missing, ship them first. Skip the "feature factory" until they're in place.
25
+
26
+ 1. **Sentry (or equivalent).** Until you can see what's breaking in production, every bug is a guess.
27
+ 2. **Automated backups.** Daily. Tested restore. No "we have backups but never tried to use them".
28
+ 3. **CI on every PR.** Even just "the tests pass". Manual deploys with no test gate is shipping blind.
29
+ 4. **Single source of truth for env vars.** No "Hanzla has the prod env in his Notion".
30
+
31
+ ### Phase B — Lock down auth + tenant isolation (weeks 2-3)
32
+
33
+ The Rihal incident makes this non-negotiable for anything multi-org.
34
+
35
+ 1. Real auth provider (Keycloak / Clerk / Auth0). Drop hand-rolled JWT.
36
+ 2. Tenant isolation enforced at the query layer (RLS or middleware), not the URL.
37
+ 3. Run `rihal-auth-audit` end-to-end before declaring this phase done.
38
+
39
+ ### Phase C — Operational maturity (weeks 4-5)
40
+
41
+ 1. Healthchecks → liveness + readiness, distinct.
42
+ 2. Resource limits → memory request = limit, no overcommit.
43
+ 3. PodDisruptionBudget for replica > 1 deployments.
44
+ 4. Logs are structured (JSON) and searchable.
45
+
46
+ ### Phase D — Documentation + onboarding (week 6)
47
+
48
+ 1. README that gets a new dev to a working local environment in < 1 day.
49
+ 2. Architecture diagram (Mermaid in `docs/`, regenerated, not hand-drawn).
50
+ 3. Runbooks for the 5 most common ops events (deploy, rollback, restart, restore, scale).
51
+ 4. `.rihal/memory/` populated — this skill writes the project-summary as the deliverable.
52
+
53
+ ### Phase E — Performance + cost (weeks 7-8)
54
+
55
+ Run `rihal-perf` against the top 5 slowest pages / queries. Do the cost math: which K8s pods are over-provisioned? Which queries are scanning when they could index?
56
+
57
+ ## Stakeholder sequencing
58
+
59
+ Each phase has a different audience:
60
+
61
+ - Phase A: founder/CEO buy-in (it's not features, but it stops the bleeding)
62
+ - Phase B: legal / compliance / security (especially for government clients)
63
+ - Phase C: ops on-call (whoever wakes up at 3am)
64
+ - Phase D: future hires / external contributors
65
+ - Phase E: finance + perf-sensitive users
66
+
67
+ Sequence the conversations accordingly.
68
+
69
+ ## Workflow
70
+
71
+ 1. **Run `rihal-migrate`'s 8-check audit.** Output is the gap report.
72
+ 2. **Map gaps to A-E phases.** Phase A first, no exceptions.
73
+ 3. **Calendar the phases.** 1-2 weeks each, no parallel phases unless they're truly independent.
74
+ 4. **Each week ends with a demo to the relevant stakeholder** — not just a Slack post.
75
+ 5. **Persist the plan** to `.rihal/memory/milestones/current.md` so future sessions track progress.
76
+
77
+ ## Output Format
78
+
79
+ ```
80
+ MVP graduation plan — <project name>
81
+
82
+ Current state (MVP→prod gap report from rihal-migrate):
83
+ Pass: <count> / 8
84
+ Critical gaps: <list>
85
+
86
+ Plan:
87
+ Phase A (week 1) — Stop the bleeding
88
+ Owner: <stakeholder>
89
+ Tasks: <list>
90
+
91
+ Phase B (weeks 2-3) — Auth + tenant isolation
92
+ ...
93
+
94
+ Phase C-E ...
95
+
96
+ Risk register:
97
+ - <risk> — <mitigation>
98
+
99
+ Demo schedule:
100
+ Week 1: Sentry + backups working — demo to founder
101
+ Week 3: tenant-isolation audit clean — demo to legal/security
102
+ Week 6: new-dev onboarding < 1 day — demo with a real new dev
103
+ ```
104
+
105
+ ## Examples
106
+
107
+ **Happy path — government client product** — MVP shipped 6 months ago, 3 government clients now. Gap report: missing Sentry, hand-rolled JWT, no automated backups, no Helm chart. Phases A→D mapped over 6 weeks. Each phase signs off with a stakeholder.
108
+
109
+ **Edge case — pivoting MVP** — Founder wants to pivot. Run gap report anyway — even a pivoted MVP needs the same foundation. The pivot doesn't reset the technical floor.
110
+
111
+ **Negative — "let's just rewrite in $NEW_FRAMEWORK"** — Refuse. A rewrite isn't graduation, it's restart. Ship the foundation against the existing codebase first; rewrites can come later if the pivot demands it.
112
+
113
+ ## Memory Bank Hooks
114
+
115
+ - **Reads:** `.rihal/memory/project/stack.md`, `.rihal/memory/incidents/known-issues.md`, `.rihal/memory/people/stakeholders.md` (for sequencing)
116
+ - **Writes:** `.rihal/memory/milestones/current.md` (the graduation plan); `.rihal/memory/change-records/YYYYMMDD-NNN.md` (the kickoff change record)
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: rihal-ocr-consistency
3
+ description: OCR pipeline determinism + ground-truth validation. Use when running an OCR pipeline (text extraction from PDFs, scanned documents, government forms) and seeing inconsistent output across runs, language-routing mistakes, or accuracy regressions. Specifically encodes Rihal's OCR pain — Arabic/English routing failures, Triton inconsistencies, missing ground-truth checks.
4
+ triggers:
5
+ - "ocr inconsistency"
6
+ - "ocr pipeline"
7
+ - "text extraction"
8
+ - "pdf ocr"
9
+ - "siglip routing"
10
+ - "triton ocr"
11
+ - "ground truth"
12
+ - "ocr accuracy regression"
13
+ user-invocable: true
14
+ ---
15
+
16
+ ## Overview
17
+
18
+ OCR is non-deterministic by default — same input, different output across runs, model versions, and infrastructure. This skill encodes the discipline needed to ship OCR that doesn't silently regress. Default stack: SigLIP2 language router + LightOnOCR / PaddleOCR / Triton; adapt to whatever's in use. The skill assumes Python + Temporal workflows (rcode's verified Rihal stack).
19
+
20
+ ## The 6 consistency checks
21
+
22
+ ### 1. Language routing
23
+
24
+ - [ ] Router (e.g. SigLIP2) classifies document language **before** OCR.
25
+ - [ ] Confidence threshold for routing decisions — below threshold, surface for human review, don't pick a default.
26
+ - [ ] Routing decisions logged with the document hash for replay.
27
+ - [ ] Arabic/English boundary cases tested explicitly — bilingual documents trip naive routers.
28
+
29
+ ### 2. Model determinism
30
+
31
+ - [ ] OCR model version pinned in code, not "whatever's loaded in Triton".
32
+ - [ ] Triton config pinned (no auto-update). Model swaps surface as deploys, not silent drift.
33
+ - [ ] Temperature / sampling parameters set to deterministic values (temperature=0 for greedy decoding).
34
+
35
+ ### 3. Ground truth
36
+
37
+ - [ ] A ground-truth dataset exists — at least 20 documents per language with verified text.
38
+ - [ ] Accuracy is measured on every model upgrade and every infra change (Triton config, GPU change).
39
+ - [ ] Regression threshold defined: e.g. ≥95% character accuracy on the ground-truth set; below blocks deploy.
40
+
41
+ ### 4. Routing tests
42
+
43
+ - [ ] PyMuPDF text-layer routing is correctly bypassing OCR for text-native PDFs.
44
+ - [ ] English page misclassification tests (the documented Rihal incident — text-layer English pages routed to Arabic OCR).
45
+ - [ ] Mixed-language documents have an explicit handler.
46
+
47
+ ### 5. Pipeline observability
48
+
49
+ - [ ] Every document passes through with a trace ID.
50
+ - [ ] Routing decision, model used, confidence score, and final output all logged.
51
+ - [ ] Failures (OCR returns empty, confidence below threshold) trigger Sentry alerts, not silent retries.
52
+
53
+ ### 6. Replay capability
54
+
55
+ - [ ] Any production document can be re-OCR'd from the archived input, deterministically.
56
+ - [ ] Temporal workflows have idempotency — replays don't double-process or skip.
57
+ - [ ] Source documents archived with hash → output mapping.
58
+
59
+ ## Workflow
60
+
61
+ 1. **Run the 6 checks.** Cite file/path for each pass / fail.
62
+ 2. **For accuracy regression:** capture the ground-truth diff. Which documents changed output? Which characters?
63
+ 3. **Bisect the regression** — was it the model? the Triton config? the routing? Don't ship "we'll figure it out next sprint".
64
+ 4. **Persist findings** to `.rihal/memory/incidents/known-issues.md` for unresolved drift, or `.rihal/memory/incidents/post-mortems/` for resolved incidents.
65
+
66
+ ## Output Format
67
+
68
+ ```
69
+ OCR pipeline audit — <date>
70
+
71
+ Language routing:
72
+ ✓/✗ findings
73
+
74
+ Model determinism:
75
+ ✓/✗ findings
76
+
77
+ Ground truth:
78
+ Accuracy on ground-truth set: <X%>
79
+ Regressions vs last run: <count>
80
+
81
+ Routing tests:
82
+ ✓/✗ findings
83
+
84
+ Observability:
85
+ ✓/✗ findings
86
+
87
+ Replay capability:
88
+ ✓/✗ findings
89
+
90
+ Critical: <count>
91
+ High: <count>
92
+ Memory Bank update: → .rihal/memory/incidents/...
93
+ ```
94
+
95
+ ## Examples
96
+
97
+ **Happy path — text-layer routing fix** — Audit shows English text-layer PDFs misclassified as Arabic by SigLIP2 (the documented Rihal bug). Fix: route text-layer PDFs to PyMuPDF extraction, bypass OCR entirely. Re-run ground truth: accuracy stable, throughput up.
98
+
99
+ **Edge case — Triton silent upgrade** — Triton image was bumped from 25.02 to 25.06 in the Helm chart; ground-truth accuracy dropped 4%. Roll back Triton, pin the version, re-run audit. Add a CI check that fails the build on accuracy regression.
100
+
101
+ **Negative — "OCR is fuzzy by nature, accept the variance"** — Refuse. Variance without measurement is just regression in disguise. Pin the model, pin the infra, measure on ground truth, surface confidence.
102
+
103
+ ## Memory Bank Hooks
104
+
105
+ - **Reads:** `.rihal/memory/project/stack.md` (OCR layer detection), `.rihal/memory/incidents/post-mortems/` (prior OCR incidents)
106
+ - **Writes:** `.rihal/memory/incidents/known-issues.md` (deferred drift); ground-truth accuracy results into `.rihal/memory/change-records/YYYYMMDD-NNN.md`
@@ -89,3 +89,8 @@ Each party mode turn follows this pattern:
89
89
  ### Negative boundary
90
90
  **User:** "party mode — approve this PR"
91
91
  **Result:** Redirects to `/rihal:code-review` — code review needs structured evaluation, not open discussion.
92
+
93
+ ## Memory Bank Hooks
94
+
95
+ - **Reads:** `rihal/team.yaml`, every consulted persona's SKILL.md, `.rihal/memory/people/team.md` (so the casual chat respects active team availability)
96
+ - **Writes:** transcript saved to `.rihal/progress/party-{date}.md` for audit; does NOT update Memory Bank decision log (use `rcode-memory-update` if the chat surfaced a real decision)
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: rihal-rebrand
3
+ description: Stack-wide rebranding migration — refs, assets, copy, env vars, docs, redirects, package names. Use when a project's brand changes mid-flight and the rename has to ripple through dozens of files without breaking anything. Specifically encodes the Rihal "had to do complete rebranding" pain — the rename touched 100+ files and broke 3 deploys before we got it right.
4
+ triggers:
5
+ - "rebrand"
6
+ - "stack-wide rename"
7
+ - "product rename"
8
+ - "rename project"
9
+ - "brand migration"
10
+ - "logo refresh"
11
+ - "domain change"
12
+ - "company name change"
13
+ user-invocable: true
14
+ ---
15
+
16
+ ## Overview
17
+
18
+ A rebrand is N renames at once: package name, npm scope, repo URL, environment variables, asset paths, copy strings, redirects, social handles, contracts. Each one looks small. Together they break things. This skill enforces a checklist + a decomposition (one category per commit) so the rename ships incrementally without a "Friday at 5pm" big-bang deploy.
19
+
20
+ ## The 9 surfaces of a rebrand
21
+
22
+ For each: scope it before touching code, identify cross-references, decompose into commits.
23
+
24
+ ### 1. Package + repo identity
25
+
26
+ - [ ] `package.json` `name`, `description`, `repository.url`, `homepage`, `bugs.url`
27
+ - [ ] `README.md` heading, badges, CDN URLs, npm install commands
28
+ - [ ] Repository name on GitHub (and any forks / deploy keys / webhooks)
29
+ - [ ] npm scope rename (this is one-way; coordinate carefully)
30
+
31
+ ### 2. Environment variables + secrets
32
+
33
+ - [ ] Old prefix `OLDBRAND_*` → `NEWBRAND_*`
34
+ - [ ] Update `.env.example`, all CI environment definitions, K8s ConfigMaps and Secrets
35
+ - [ ] Compatibility window: read both names for 1 release, then drop the old
36
+
37
+ ### 3. Assets
38
+
39
+ - [ ] Logos, favicons, OG images, brand-coloured graphics
40
+ - [ ] Email templates (transactional + marketing)
41
+ - [ ] PDF templates, certificate templates, invoice templates
42
+
43
+ ### 4. Copy strings
44
+
45
+ - [ ] User-facing UI copy
46
+ - [ ] Email subject lines + bodies
47
+ - [ ] Push notification text
48
+ - [ ] Error messages
49
+ - [ ] Marketing site / landing page
50
+
51
+ ### 5. URLs + redirects
52
+
53
+ - [ ] Old domain → new domain HTTP 301s
54
+ - [ ] Email-link tracking domains
55
+ - [ ] Deep-link schemes (`oldbrand://` → `newbrand://`) with backwards-compat for installed apps
56
+ - [ ] CDN paths + old-image redirects
57
+
58
+ ### 6. Social + external
59
+
60
+ - [ ] Twitter / LinkedIn / Instagram handles (one-way; rename last after rest is verified)
61
+ - [ ] App Store / Play Store listings + reviews moved
62
+ - [ ] Crashlytics / Sentry project name
63
+ - [ ] Stripe / payment processor business name
64
+
65
+ ### 7. Documentation + onboarding
66
+
67
+ - [ ] README, CONTRIBUTING, all `docs/`
68
+ - [ ] Internal wiki / Notion
69
+ - [ ] Customer-facing help docs
70
+
71
+ ### 8. Code-internal references
72
+
73
+ - [ ] CSS variable names (`--oldbrand-blue` → `--newbrand-blue`)
74
+ - [ ] TS / JS namespace exports
75
+ - [ ] Test fixture data containing the old name
76
+
77
+ ### 9. Legal + contracts
78
+
79
+ - [ ] Customer contracts referencing the old name
80
+ - [ ] Privacy policy, terms of service, DPA
81
+ - [ ] Trademark registrations + domain whois
82
+
83
+ ## Workflow
84
+
85
+ 1. **Inventory.** Grep for the old brand name across the entire monorepo (case-insensitive, all variants — `OldBrand`, `oldbrand`, `old-brand`, `OLD_BRAND`).
86
+ 2. **Categorise** each hit into one of the 9 surfaces.
87
+ 3. **Decompose into commits** — one surface per commit minimum. Surfaces 1, 2, 4, 5, 7, 8 can be one commit each; surface 6 (social) is the LAST commit because it's hardest to revert.
88
+ 4. **Compatibility window.** For env vars, deep links, public APIs: read both names for 1 release, drop the old in the next.
89
+ 5. **Verify after each commit:** the build passes, the tests pass, no broken links to the old name.
90
+ 6. **Communicate.** Customer-facing rename is an event — schedule it, announce it, follow with a status post 24h later confirming nothing's broken.
91
+
92
+ ## Output Format
93
+
94
+ ```
95
+ Rebrand inventory — <old> → <new>
96
+ Total occurrences: <count> across <files>
97
+
98
+ By surface:
99
+ 1. Package + repo: <count>
100
+ 2. Env vars: <count>
101
+ 3. Assets: <count>
102
+ ...
103
+
104
+ Commit plan:
105
+ 1. refactor(meta): rename package + repo references
106
+ 2. refactor(env): migrate OLDBRAND_* env vars with compat fallback
107
+ 3. refactor(assets): swap logos, favicons, OG images
108
+ ...
109
+
110
+ Compatibility windows:
111
+ - env vars: 1 release
112
+ - public API: 1 minor version with deprecation warning
113
+ - deep links: 6 months for installed apps
114
+
115
+ Communication plan:
116
+ - Internal heads-up: <date>
117
+ - Customer email: <date>
118
+ - Social handle change: <last commit ships>
119
+ - 24h post-launch status: <date>
120
+ ```
121
+
122
+ ## Examples
123
+
124
+ **Happy path** — `OldBrand → NewBrand` rename. Inventory: 312 occurrences across 87 files in 9 surfaces. 9 commits over 4 days, compat window of 1 release for env vars + public API. Social handles renamed last. Zero customer reports of broken links.
125
+
126
+ **Edge case — domain change with email** — Old domain hosts customer email aliases. Old domain MUST keep MX records during compatibility window OR customers lose email. Add domain-MX to the checklist before touching DNS.
127
+
128
+ **Negative — rename in one commit** — Refuse. A 312-line diff across 87 files cannot be reviewed meaningfully and cannot be reverted partially. Decompose into 9 commits minimum.
129
+
130
+ ## Memory Bank Hooks
131
+
132
+ - **Reads:** `.rihal/memory/people/stakeholders.md` (who needs to approve external changes)
133
+ - **Writes:** `.rihal/memory/change-records/YYYYMMDD-NNN.md` per commit; `.rihal/memory/project/decisions.md` for the rebrand kickoff
@@ -65,3 +65,8 @@ Markdown bullet list of findings, each describing a specific problem, gap, or ri
65
65
 
66
66
  - HALT if zero findings — this is suspicious, re-analyze or ask for guidance
67
67
  - HALT if content is empty or unreadable
68
+
69
+ ## Memory Bank Hooks
70
+
71
+ - **Reads:** the content under review (diff, spec, story, doc)
72
+ - **Writes:** nothing — produces findings only. Findings can be persisted by the caller via `rcode-memory-update` if they shape downstream work.
@@ -97,3 +97,8 @@ No extra text, no explanations, no markdown wrapping. An empty array `[]` is val
97
97
  ### Negative boundary
98
98
  **User:** "critically review this spec"
99
99
  **Result:** Not edge-case hunting → route to `rihal-review-adversarial-general`
100
+
101
+ ## Memory Bank Hooks
102
+
103
+ - **Reads:** the content under review (diff, full file, or function)
104
+ - **Writes:** nothing — produces an unhandled-edges report only
@@ -135,3 +135,8 @@ Present user with options for the original document:
135
135
  ## HALT CONDITIONS
136
136
 
137
137
  - HALT if npx command fails or produces no output files
138
+
139
+ ## Memory Bank Hooks
140
+
141
+ - **Reads:** the source document being sharded
142
+ - **Writes:** the sharded output files only; does NOT modify `.rihal/memory/`. If the sharded doc is a Memory Bank file, use `rcode-memory-distill` instead.