@hanzlaa/rcode 2.8.0 → 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 (120) 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-integration-checker.md +1 -1
  11. package/rihal/agents/rihal-noor.md +2 -2
  12. package/rihal/agents/rihal-phase-researcher.md +1 -1
  13. package/rihal/agents/rihal-planner.md +25 -0
  14. package/rihal/agents/rihal-project-researcher.md +1 -1
  15. package/rihal/agents/rihal-research-synthesizer.md +1 -1
  16. package/rihal/agents/rihal-roadmapper.md +1 -1
  17. package/rihal/agents/rihal-sprint-checker.md +19 -1
  18. package/rihal/agents/rihal-verifier.md +1 -1
  19. package/rihal/agents/rihal-waleed.md +1 -2
  20. package/rihal/commands/code-review.md +1 -1
  21. package/rihal/commands/memory-audit.md +10 -0
  22. package/rihal/commands/memory-distill.md +11 -0
  23. package/rihal/commands/memory-init.md +12 -0
  24. package/rihal/commands/memory-update.md +12 -0
  25. package/rihal/config/model-profiles.json +5 -5
  26. package/rihal/references/karpathy-guidelines-full.md +1 -1
  27. package/rihal/references/no-unauthorized-git-ops.md +1 -1
  28. package/rihal/references/verb-dictionary.md +1 -1
  29. package/rihal/skills/actions/2-plan/rihal-frontend-design/SKILL.md +49 -139
  30. package/rihal/skills/actions/2-plan/rihal-frontend-design/references.md +79 -0
  31. package/rihal/skills/actions/4-implementation/rihal-browser-verify/SKILL.md +70 -0
  32. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +1 -1
  33. package/rihal/skills/actions/4-implementation/rihal-ci/SKILL.md +108 -0
  34. package/rihal/skills/actions/4-implementation/rihal-debug/SKILL.md +78 -0
  35. package/rihal/skills/actions/4-implementation/rihal-git-flow/SKILL.md +90 -0
  36. package/rihal/skills/actions/4-implementation/rihal-harden/SKILL.md +91 -0
  37. package/rihal/skills/actions/4-implementation/rihal-incremental/SKILL.md +50 -0
  38. package/rihal/skills/actions/4-implementation/rihal-migrate/SKILL.md +86 -0
  39. package/rihal/skills/actions/4-implementation/rihal-perf/SKILL.md +96 -0
  40. package/rihal/skills/actions/4-implementation/rihal-prove-it/SKILL.md +64 -0
  41. package/rihal/skills/actions/4-implementation/rihal-source-truth/SKILL.md +76 -0
  42. package/rihal/skills/actions/4-implementation/rihal-trim/SKILL.md +73 -0
  43. package/rihal/skills/agents/dalil-scout/SKILL.md +43 -125
  44. package/rihal/skills/agents/dalil-scout/references.md +67 -0
  45. package/rihal/skills/agents/majlis-council/SKILL.md +50 -144
  46. package/rihal/skills/agents/majlis-council/references.md +90 -0
  47. package/rihal/skills/agents/raees-orchestrator/SKILL.md +56 -117
  48. package/rihal/skills/agents/raees-orchestrator/references.md +47 -0
  49. package/rihal/skills/core/rihal-advanced-elicitation/SKILL.md +36 -136
  50. package/rihal/skills/core/rihal-advanced-elicitation/references.md +101 -0
  51. package/rihal/skills/core/rihal-auth-audit/SKILL.md +93 -0
  52. package/rihal/skills/core/rihal-brainstorming/SKILL.md +5 -0
  53. package/rihal/skills/core/rihal-client-gate/SKILL.md +91 -0
  54. package/rihal/skills/core/rihal-clone-website/SKILL.md +30 -371
  55. package/rihal/skills/core/rihal-clone-website/references.md +213 -0
  56. package/rihal/skills/core/rihal-deploy-unify/SKILL.md +87 -0
  57. package/rihal/skills/core/rihal-distillator/SKILL.md +37 -187
  58. package/rihal/skills/core/rihal-distillator/references.md +118 -0
  59. package/rihal/skills/core/rihal-editorial-review-prose/SKILL.md +5 -0
  60. package/rihal/skills/core/rihal-editorial-review-structure/SKILL.md +45 -183
  61. package/rihal/skills/core/rihal-editorial-review-structure/references.md +110 -0
  62. package/rihal/skills/core/rihal-help/SKILL.md +6 -1
  63. package/rihal/skills/core/rihal-incident-record/SKILL.md +161 -0
  64. package/rihal/skills/core/rihal-index-docs/SKILL.md +5 -0
  65. package/rihal/skills/core/rihal-init/SKILL.md +5 -0
  66. package/rihal/skills/core/rihal-memory-audit/SKILL.md +88 -0
  67. package/rihal/skills/core/rihal-memory-distill/SKILL.md +87 -0
  68. package/rihal/skills/core/rihal-memory-init/SKILL.md +77 -0
  69. package/rihal/skills/core/rihal-memory-update/SKILL.md +73 -0
  70. package/rihal/skills/core/rihal-mvp-graduate/SKILL.md +116 -0
  71. package/rihal/skills/core/rihal-ocr-consistency/SKILL.md +106 -0
  72. package/rihal/skills/core/rihal-party-mode/SKILL.md +5 -0
  73. package/rihal/skills/core/rihal-rebrand/SKILL.md +133 -0
  74. package/rihal/skills/core/rihal-review-adversarial-general/SKILL.md +5 -0
  75. package/rihal/skills/core/rihal-review-edge-case-hunter/SKILL.md +5 -0
  76. package/rihal/skills/core/rihal-shard-doc/SKILL.md +5 -0
  77. package/rihal/skills/core/rihal-theme-system/SKILL.md +113 -0
  78. package/rihal/team.yaml +3 -22
  79. package/rihal/templates/memory/INDEX.md +46 -0
  80. package/rihal/templates/memory/change-records/.gitkeep +4 -0
  81. package/rihal/templates/memory/distillates/project.distillate.md +11 -0
  82. package/rihal/templates/memory/distillates/stack.distillate.md +11 -0
  83. package/rihal/templates/memory/incidents/known-issues.md +27 -0
  84. package/rihal/templates/memory/incidents/post-mortems/.gitkeep +3 -0
  85. package/rihal/templates/memory/milestones/archive/.gitkeep +2 -0
  86. package/rihal/templates/memory/milestones/current.md +39 -0
  87. package/rihal/templates/memory/people/stakeholders.md +25 -0
  88. package/rihal/templates/memory/people/team.md +35 -0
  89. package/rihal/templates/memory/project/decisions.md +32 -0
  90. package/rihal/templates/memory/project/glossary.md +16 -0
  91. package/rihal/templates/memory/project/stack.md +46 -0
  92. package/rihal/workflows/audit.md +3 -3
  93. package/rihal/workflows/code-review.md +32 -1
  94. package/rihal/workflows/council.md +1 -1
  95. package/rihal/workflows/discuss-phase-power.md +3 -3
  96. package/rihal/workflows/do.md +1 -1
  97. package/rihal/workflows/docs-update.md +4 -4
  98. package/rihal/workflows/execute.md +61 -5
  99. package/rihal/workflows/help.md +5 -5
  100. package/rihal/workflows/karpathy-audit.md +9 -9
  101. package/rihal/workflows/memory-audit.md +83 -0
  102. package/rihal/workflows/memory-distill.md +103 -0
  103. package/rihal/workflows/memory-init.md +102 -0
  104. package/rihal/workflows/memory-update.md +83 -0
  105. package/rihal/workflows/plan.md +66 -1
  106. package/server/dashboard.js +6 -1
  107. package/server/lib/api.js +8 -2
  108. package/server/lib/html/client.js +63 -0
  109. package/server/lib/html/shell.js +5 -0
  110. package/server/lib/scanner.js +76 -1
  111. package/rihal/agents/rihal-architect.md +0 -79
  112. package/rihal/agents/rihal-tech-writer.md +0 -80
  113. package/rihal/commands/check-implementation-readiness.md +0 -8
  114. package/rihal/commands/discuss-phase-power.md +0 -11
  115. package/rihal/commands/karpathy-audit.md +0 -12
  116. package/rihal/commands/new-project-research.md +0 -11
  117. package/rihal/commands/new-project-roadmap.md +0 -11
  118. package/rihal/commands/report.md +0 -10
  119. package/rihal/commands/review-adversarial.md +0 -8
  120. package/rihal/commands/review-edge-case-hunter.md +0 -8
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: rihal-memory-audit
3
+ description: >
4
+ Audit the Memory Bank for stale entries, contradictions, missing sections,
5
+ and content that should be archived. Produces a report with severity-tagged
6
+ findings and one-line fix suggestions. Activates when the user says
7
+ "audit memory bank", "check memory bank", "/rcode:memory-audit",
8
+ "memory bank ka audit", "find stale entries", "is my memory bank healthy".
9
+ Do NOT use for: bootstrap (use rcode-memory-init), surgical updates
10
+ (use rcode-memory-update), or distillate regeneration (use rcode-memory-distill).
11
+ triggers:
12
+ - "audit memory bank"
13
+ - "check memory bank"
14
+ - "find stale entries"
15
+ - "is my memory bank healthy"
16
+ - "memory bank ka audit"
17
+ - "/rcode:memory-audit"
18
+ user-invocable: true
19
+ ---
20
+
21
+ ## Overview
22
+
23
+ Walks the Memory Bank and reports problems. Stale entries (referencing milestones that ended), contradictions (decisions log says X, stack file says Y), missing sections (template placeholders never filled), and content that should be archived (resolved issues lingering in `known-issues.md`). Read-only — never modifies files. Produces a fix list the user can act on with `rcode-memory-update`.
24
+
25
+ ## Workflow
26
+
27
+ 1. **Walk the Memory Bank.** List every file and section.
28
+ 2. **Run six checks** (see Output Format) and collect findings.
29
+ 3. **Tag severity** per finding: `critical` (broken reference), `warn` (stale or contradictory), `info` (template placeholder still present).
30
+ 4. **Group findings by file**, sorted by severity descending.
31
+ 5. **Print report.** No file changes.
32
+
33
+ ## The six checks
34
+
35
+ 1. **Stale milestone** — `milestones/current.md` references a milestone whose target close date has passed by ≥30 days
36
+ 2. **Resolved issues lingering** — `incidents/known-issues.md` entry has a "Real fix planned for" milestone that has completed
37
+ 3. **Template placeholders unfilled** — files still contain `{{PLACEHOLDER}}` patterns or `_(e.g. ...)_` italicised hints from templates
38
+ 4. **Stack vs decisions contradiction** — a decision in `decisions.md` references a stack item that doesn't appear in `stack.md`
39
+ 5. **Empty subdirectories** — `change-records/`, `incidents/post-mortems/`, `milestones/archive/` contain only `.gitkeep`
40
+ 6. **Distillate freshness** — `distillates/*.distillate.md` `source-digest` does not match current source files
41
+
42
+ ## Output Format
43
+
44
+ ```
45
+ Memory Bank Audit — 2026-04-26
46
+ ================================
47
+
48
+ CRITICAL (1)
49
+ project/decisions.md
50
+ └─ Decision "Switch to Postgres 16" references stack.md row that doesn't exist
51
+ Fix: update project/stack.md Runtime → Database to "Postgres 16.x"
52
+
53
+ WARN (3)
54
+ milestones/current.md
55
+ └─ Milestone target close was 2026-02-01 (84 days ago) but file still says "active"
56
+ Fix: archive via /rcode:memory-update or move to milestones/archive/
57
+
58
+ incidents/known-issues.md
59
+ └─ Issue "SSO Safari 16 fails" — real fix was planned for M2 (closed)
60
+ Fix: verify and remove, or move to post-mortems/
61
+
62
+ distillates/project.distillate.md
63
+ └─ Source digest stale — 4 source files modified since last regenerate
64
+ Fix: /rcode:memory-distill
65
+
66
+ INFO (2)
67
+ project/glossary.md
68
+ └─ Empty — no terms recorded yet
69
+ people/team.md
70
+ └─ Coverage table contains 3 unfilled cells
71
+ Fix: /rcode:memory-update with team coverage info
72
+ ```
73
+
74
+ ## Examples
75
+
76
+ **Healthy bank**
77
+ Output: `✓ Memory Bank is healthy. 0 findings.`
78
+
79
+ **Stale milestone + unfilled glossary**
80
+ Output: lists 2 findings, severity warn + info, suggests fixes per finding.
81
+
82
+ **Negative — used to fix problems**
83
+ This skill only reports. Fixes happen via `rcode-memory-update`, manual edits, or `rcode-memory-distill`. Do not invoke this skill expecting auto-fix.
84
+
85
+ ## Memory Bank Hooks
86
+
87
+ - **Reads:** every file under `.rihal/memory/`
88
+ - **Writes:** nothing — strictly read-only
@@ -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)