@hanzlaa/rcode 3.6.14 → 3.6.16

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 (127) hide show
  1. package/AGENTS.md +1 -1
  2. package/CONTRIBUTING.md +1 -1
  3. package/README.md +3 -3
  4. package/cli/index.js +5 -1
  5. package/cli/lib/manifest.cjs +51 -43
  6. package/dist/rcode.js +32 -35
  7. package/package.json +3 -2
  8. package/rihal/bin/rihal-tools.cjs +20 -0
  9. package/rihal/commands/add-todo.md +1 -1
  10. package/rihal/commands/check-implementation-readiness.md +18 -0
  11. package/rihal/commands/create-architecture.md +18 -0
  12. package/rihal/commands/debug.md +1 -1
  13. package/rihal/commands/edit-prd.md +18 -0
  14. package/rihal/commands/execute-milestone.md +2 -2
  15. package/rihal/commands/memory-audit.md +1 -1
  16. package/rihal/commands/memory-distill.md +1 -1
  17. package/rihal/commands/memory-init.md +1 -1
  18. package/rihal/commands/memory-update.md +1 -1
  19. package/rihal/commands/plan-milestone.md +2 -2
  20. package/rihal/commands/progress.md +1 -1
  21. package/rihal/commands/resume-work.md +1 -1
  22. package/rihal/commands/retrospective.md +18 -0
  23. package/rihal/commands/review-edge-case-hunter.md +18 -0
  24. package/rihal/commands/scaffold-milestone.md +2 -2
  25. package/rihal/commands/scaffold-project.md +18 -0
  26. package/rihal/commands/validate-prd.md +18 -0
  27. package/rihal/references/agent-contracts.md +46 -20
  28. package/rihal/references/model-profile-resolution.md +41 -5
  29. package/rihal/references/phase-argument-parsing.md +31 -7
  30. package/rihal/references/revision-loop.md +36 -9
  31. package/rihal/references/universal-anti-patterns.md +56 -12
  32. package/rihal/skills/SKILLS_INDEX.md +34 -5
  33. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/SKILL.md +1 -0
  34. package/rihal/skills/actions/1-analysis/research/rihal-market-research/SKILL.md +1 -0
  35. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/SKILL.md +1 -0
  36. package/rihal/skills/actions/1-analysis/rihal-document-project/SKILL.md +1 -0
  37. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +1 -0
  38. package/rihal/skills/actions/1-analysis/rihal-product-brief/SKILL.md +1 -0
  39. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +1 -0
  40. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/workflow.md +12 -0
  41. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +1 -0
  42. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +1 -0
  43. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +1 -0
  44. package/rihal/skills/actions/2-plan/rihal-create-ux-design/SKILL.md +1 -0
  45. package/rihal/skills/actions/2-plan/rihal-edit-prd/SKILL.md +1 -0
  46. package/rihal/skills/actions/2-plan/rihal-frontend-design/SKILL.md +1 -0
  47. package/rihal/skills/actions/2-plan/rihal-validate-prd/SKILL.md +1 -0
  48. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/SKILL.md +1 -0
  49. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/SKILL.md +1 -0
  50. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/SKILL.md +1 -0
  51. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +1 -0
  52. package/rihal/skills/actions/4-implementation/rihal-code-review/SKILL.md +1 -0
  53. package/rihal/skills/actions/4-implementation/rihal-correct-course/SKILL.md +1 -0
  54. package/rihal/skills/actions/4-implementation/rihal-debug/SKILL.md +3 -17
  55. package/rihal/skills/actions/4-implementation/rihal-dev-story/SKILL.md +1 -0
  56. package/rihal/skills/actions/4-implementation/rihal-dev-story/workflow.md +13 -0
  57. package/rihal/skills/actions/4-implementation/rihal-qa-generate-e2e-tests/SKILL.md +1 -0
  58. package/rihal/skills/actions/4-implementation/rihal-retrospective/SKILL.md +1 -0
  59. package/rihal/skills/actions/4-implementation/rihal-retrospective/workflow.md +12 -0
  60. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/SKILL.md +1 -0
  61. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +1 -0
  62. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/workflow.md +12 -0
  63. package/rihal/skills/actions/4-implementation/rihal-sprint-status/SKILL.md +1 -0
  64. package/rihal/skills/agents/ahmed-hassani-director/SKILL.md +1 -0
  65. package/rihal/skills/agents/dalil-scout/SKILL.md +1 -0
  66. package/rihal/skills/agents/fatima-qa/SKILL.md +1 -0
  67. package/rihal/skills/agents/haitham-frontend/SKILL.md +1 -0
  68. package/rihal/skills/agents/hanzla-engineer/SKILL.md +1 -0
  69. package/rihal/skills/agents/hussain-pm/SKILL.md +1 -0
  70. package/rihal/skills/agents/hussain-sm/SKILL.md +1 -0
  71. package/rihal/skills/agents/layla-designer/SKILL.md +1 -0
  72. package/rihal/skills/agents/majlis-council/SKILL.md +1 -0
  73. package/rihal/skills/agents/mariam-marketing/SKILL.md +1 -0
  74. package/rihal/skills/agents/nasser-eng-manager/SKILL.md +1 -0
  75. package/rihal/skills/agents/noor-writer/SKILL.md +1 -0
  76. package/rihal/skills/agents/raees-orchestrator/SKILL.md +1 -0
  77. package/rihal/skills/agents/rihal-cross-platform-auditor/SKILL.md +1 -0
  78. package/rihal/skills/agents/rihal-dep-auditor/SKILL.md +1 -0
  79. package/rihal/skills/agents/rihal-deviation-analyzer/SKILL.md +1 -0
  80. package/rihal/skills/agents/rihal-i18n-auditor/SKILL.md +1 -0
  81. package/rihal/skills/agents/rihal-observability-auditor/SKILL.md +1 -0
  82. package/rihal/skills/agents/sadiq-analyst/SKILL.md +1 -0
  83. package/rihal/skills/agents/waleed-architect/SKILL.md +1 -0
  84. package/rihal/skills/agents/yousef-backend/SKILL.md +1 -0
  85. package/rihal/skills/agents/zahra-branding/SKILL.md +1 -0
  86. package/rihal/skills/agents/zayd-ml/SKILL.md +1 -0
  87. package/rihal/skills/core/rihal-init/SKILL.md +1 -1
  88. package/rihal/skills/core/rihal-memory-audit/SKILL.md +5 -5
  89. package/rihal/skills/core/rihal-memory-distill/SKILL.md +5 -5
  90. package/rihal/skills/core/rihal-memory-init/SKILL.md +7 -7
  91. package/rihal/skills/core/rihal-memory-update/SKILL.md +4 -4
  92. package/rihal/team.yaml +56 -0
  93. package/rihal/templates/UAT.md +69 -18
  94. package/rihal/templates/memory/INDEX.md +2 -2
  95. package/rihal/templates/memory/distillates/project.distillate.md +2 -2
  96. package/rihal/templates/memory/distillates/stack.distillate.md +2 -2
  97. package/rihal/templates/memory/project/stack.md +1 -1
  98. package/rihal/templates/summary.md +54 -37
  99. package/rihal/templates/verification-report.md +72 -17
  100. package/rihal/workflows/autonomous.md +2 -2
  101. package/rihal/workflows/create-prd.md +1 -1
  102. package/rihal/workflows/diagnose-issues.md +75 -22
  103. package/rihal/workflows/discuss-phase.md +1 -1
  104. package/rihal/workflows/edit-prd.md +1 -1
  105. package/rihal/workflows/health.md +6 -6
  106. package/rihal/workflows/help.md +0 -1
  107. package/rihal/workflows/memory-audit.md +2 -2
  108. package/rihal/workflows/memory-distill.md +2 -2
  109. package/rihal/workflows/memory-init.md +2 -2
  110. package/rihal/workflows/memory-update.md +2 -2
  111. package/rihal/workflows/research-phase.md +1 -1
  112. package/rihal/workflows/scaffold-project.md +1 -1
  113. package/rihal/workflows/validate-prd.md +2 -2
  114. package/rihal/workflows/verify-work.md +1 -1
  115. package/server/lib/html/client/components/App.js +56 -19
  116. package/server/lib/html/client/components/Sidebar.js +13 -0
  117. package/server/lib/html/client/components/Topbar.js +6 -3
  118. package/server/lib/html/client/store.js +30 -0
  119. package/server/lib/html/client/util.js +0 -10
  120. package/server/lib/html/client/views/FilesView.js +4 -1
  121. package/server/lib/html/client/views/KanbanView.js +15 -4
  122. package/server/lib/html/client/views/MemoryView.js +6 -6
  123. package/server/lib/html/client/views/OrchestrationView.js +12 -2
  124. package/server/lib/html/client/views/OverviewView.js +44 -4
  125. package/server/lib/html/client.js +7 -0
  126. package/server/lib/html/css.js +16 -0
  127. package/server/lib/scanner.js +7 -2
@@ -1,22 +1,48 @@
1
1
  # Agent Contracts
2
2
 
3
- Conventions Rihal sub-agents follow when invoked from a workflow.
4
-
5
- - **Input**: a single prompt string. The orchestrator passes structured data
6
- inline (path lists, JSON blobs) — sub-agents do not stream args.
7
- - **Output**: one final message back to the orchestrator. No partial state
8
- is visible mid-run.
9
- - **Side effects**: each agent's tool list is its full surface any tool
10
- not granted in the agent definition is unavailable.
11
- - **Failure**: agents that hit an obstacle return a structured "blocked"
12
- message rather than fabricating output.
13
-
14
- ## Iterative retrieval (research subagents)
15
-
16
- When a workflow spawns a research subagent, it passes the broader objective
17
- not just the literal query and evaluates the returned result for sufficiency
18
- against that objective. If the result is insufficient (coverage gap, vague
19
- recommendations, or a blocked signal), the workflow re-dispatches the same
20
- subagent with the named gaps, hard-capped at 3 cycles. This loop is research-only
21
- — it does not apply to executor subagents. See `iterative-retrieval.md` for the
22
- full contract.
3
+ Every Rihal agent and skill operates under a contract that defines what it consumes, what it produces, and what guarantees it offers. Workflows depend on these contracts being honoured — if an agent silently broadens or narrows its contract, the orchestrator's assumptions break.
4
+
5
+ ## The contract has 5 parts
6
+
7
+ 1. **Inputs** what the orchestrator passes to the agent at spawn time. Examples: phase number, sprint id, story file path, council question, file glob.
8
+ 2. **Outputs** — concrete artifacts produced. Always file paths or structured JSON, never free-form prose. Examples: `SUMMARY.md`, `RESEARCH.md`, a `state.json` mutation, a JSON object on stdout.
9
+ 3. **Side effects** what the agent writes outside its primary output. Examples: state.json upserts, .planning/ artifacts, decisions log entries.
10
+ 4. **Halt conditions** — when the agent stops and returns control. Examples: menu reached, user input required, blocker detected, budget exhausted.
11
+ 5. **Failure modes** what the agent does on error. Always: partial output is preserved, error is reported with a fix command, exit code is non-zero.
12
+
13
+ ## Contract enforcement
14
+
15
+ - Every agent's `.md` file declares its inputs/outputs in the frontmatter or opening section.
16
+ - Workflows that spawn agents pass exactly the declared inputs no more, no less.
17
+ - Orchestrators verify the declared outputs after the agent returns. Missing output = run failed, regardless of what the agent says.
18
+ - Side-effect changes (state.json, .planning/) are validated against `_shared/state-sync-rule.md`.
19
+
20
+ ## Why this matters
21
+
22
+ Without contracts, agents drift. An agent originally designed to "read code and produce SUMMARY.md" starts also writing decisions and modifying state.json. The next workflow that spawns it makes assumptions that no longer hold. Cascading silent breakage.
23
+
24
+ The contract is the API. Treat agents like network services that happen to run in-process.
25
+
26
+ ## When you write a new agent
27
+
28
+ Open with a contract block:
29
+
30
+ ```yaml
31
+ ---
32
+ name: rihal-foo
33
+ inputs:
34
+ - phase: NN
35
+ - story_path: .planning/phases/NN/story-X.md
36
+ outputs:
37
+ - .planning/phases/NN/story-X-SUMMARY.md
38
+ side_effects:
39
+ - state.phases[N].stories[X].status: completed
40
+ halt_conditions:
41
+ - acceptance criteria not measurable
42
+ - user-input required for design decision
43
+ on_failure:
44
+ - emit FAILURE.md with diagnostic + suggested fix command
45
+ ---
46
+ ```
47
+
48
+ If your agent doesn't fit a contract, the agent is too broad — split it.
@@ -1,8 +1,44 @@
1
1
  # Model Profile Resolution
2
2
 
3
- Workflows pick a model via `node .rihal/bin/rihal-tools.cjs resolve-model
4
- <role>`, which reads `.rihal/config.yaml` `model_profile` and returns the
5
- concrete model id for that role per `rihal/config/model-profiles.json`.
3
+ Rihal Code lets each project pick a `model_profile` in `.rihal/config.yaml`. The profile decides which Claude model each spawned agent uses.
6
4
 
7
- If `model_profile` is unset, default is `balanced`. Unknown profile falls
8
- back to `balanced` with a stderr warning.
5
+ ## Profiles
6
+
7
+ | Profile | When to pick | Model assignment |
8
+ |---------|--------------|------------------|
9
+ | `quality` | Critical milestone, hard problem, high blast radius | Most agents → Opus; tactical sub-agents → Sonnet |
10
+ | `balanced` *(default)* | Day-to-day work | Most agents → Sonnet; orchestrators → Opus; trivial helpers → Haiku |
11
+ | `budget` | Exploration, low-stakes prototyping, cost-sensitive | Most agents → Haiku; only orchestrators → Sonnet |
12
+ | `inherit` | Use whatever model the calling Claude Code session is on | All agents → session model |
13
+
14
+ ## Resolution order
15
+
16
+ When a workflow spawns an agent:
17
+
18
+ 1. **Per-agent override** — if the agent's `.md` frontmatter has `model: <name>`, use that.
19
+ 2. **Profile mapping** — look up the agent role (strategic / technical / tactical / quality) in the active profile's table.
20
+ 3. **Project profile** — read `model_profile` from `.rihal/config.yaml`.
21
+ 4. **Global profile** — fall back to `~/.rihal-code/defaults.json` if the project doesn't specify.
22
+ 5. **Hard default** — `balanced`.
23
+
24
+ ## Model names referenced
25
+
26
+ - **Claude Opus 4.7** (`claude-opus-4-7`) — strongest reasoning. Use for orchestration, council moderation, hard architecture calls.
27
+ - **Claude Sonnet 4.6** (`claude-sonnet-4-6`) — balanced. Default for most agents.
28
+ - **Claude Haiku 4.5** (`claude-haiku-4-5-20251001`) — fast + cheap. Use for tactical helpers (file walkers, simple transforms).
29
+
30
+ When using the Anthropic API directly, defaults to the latest available model in each tier.
31
+
32
+ ## Override at invocation
33
+
34
+ Per-invocation override:
35
+
36
+ ```bash
37
+ RIHAL_MODEL_PROFILE=quality /rihal:execute-phase 04
38
+ ```
39
+
40
+ Survives the session, doesn't persist to config.
41
+
42
+ ## Why profiles exist
43
+
44
+ Cost vs quality is a real tradeoff. A retrospective doesn't need Opus. A council on a strategic decision shouldn't run on Haiku. Letting users pick a profile per-project means they don't have to reason about model selection per-agent.
@@ -1,11 +1,35 @@
1
1
  # Phase Argument Parsing
2
2
 
3
- Workflows accept a phase argument in two forms:
3
+ Workflows that take a phase argument (`/rihal:plan 04`, `/rihal:execute-phase 999.5`, `/rihal:research-phase 12`) all use the same parsing rules.
4
4
 
5
- - **Numeric**: `01`, `2`, `02.1` — resolved via
6
- `node .rihal/bin/rihal-tools.cjs init phase-op "$ARG"` to the matching
7
- phase directory under `.planning/phases/`.
8
- - **Path**: a direct `.planning/phases/<slug>/PLAN.md` path — used as-is.
5
+ ## Accepted forms
9
6
 
10
- If the resolver returns `phase_found: false`, workflows must STOP with a
11
- "phase not found" message rather than fabricating a target.
7
+ | Input | Resolves to | Notes |
8
+ |-------|-------------|-------|
9
+ | `04` | Phase 04 | Zero-padded NN |
10
+ | `4` | Phase 04 | Auto-pads |
11
+ | `999.5` | Decimal parking-lot phase 999.5 | See `docs/parking-lot-convention.md` |
12
+ | `04.1` | Sub-phase 04.1 | Inserted-phase / urgent work |
13
+ | `current` | The phase currently in `state.current_phase` | Useful when looping |
14
+ | `next` | The next planned phase after current | Looks at ROADMAP.md ordering |
15
+ | (empty) | Same as `current` if state has one; else error | Most workflows refuse empty |
16
+
17
+ ## Resolution
18
+
19
+ 1. Strip whitespace.
20
+ 2. Match against the patterns above (regex per row).
21
+ 3. Look up the resolved number in `state.phases[]`.
22
+ 4. If not found, fall back to looking on disk under `.planning/phases/<NN>-*/`.
23
+ 5. If neither, exit non-zero with: `Phase X not found. Run /rihal:status to list known phases.`
24
+
25
+ ## Strict vs lenient
26
+
27
+ Workflows pass `--strict` if a missing phase should hard-fail rather than offering to create. By default, planning workflows ask "Phase X doesn't exist — create it now?" before erroring. Execution workflows hard-fail because executing a phase that doesn't exist is always a bug.
28
+
29
+ ## Error messages
30
+
31
+ Always include the resolved (or attempted-resolve) value in the error. Never just say "phase not found" — say "Phase 12 not found in state.json (3 phases registered: 04, 05, 999.5)".
32
+
33
+ ## Multi-phase invocations
34
+
35
+ Some workflows accept `04..06` to operate on a range, or `04 05 06` as space-separated. Each gets parsed by the rules above; the workflow operates on the resolved set in roadmap order.
@@ -1,11 +1,38 @@
1
- # Plan Revision Loop
1
+ # Revision Loop
2
2
 
3
- When `workflow.plan_checker` is enabled (`/rihal-settings`), `/rihal-plan`
4
- runs the rihal-sprint-checker after the planner. Findings drive a bounded
5
- revision loop:
3
+ When a plan is reviewed (by `rihal-plan-checker`, by a council, or by the user) and the verdict is "needs changes", the planner must run the revision loop — not silently accept the feedback and move on.
6
4
 
7
- 1. Planner produces PLAN.md.
8
- 2. Plan-checker scores against goal-backward criteria.
9
- 3. If BLOCK / FLAG: planner revises with the findings as added input.
10
- 4. Up to 2 revision rounds. After that, surface to user for manual
11
- confirmation rather than loop indefinitely.
5
+ ## The loop
6
+
7
+ 1. **Receive feedback.** Capture every reviewer concern as a structured list:
8
+ - Source (which reviewer / agent / user)
9
+ - Concern (one-sentence summary)
10
+ - Suggested change (if any)
11
+ - Severity (blocker / warning / suggestion)
12
+
13
+ 2. **Triage.** For each concern, classify:
14
+ - **Accept** — change the plan as suggested.
15
+ - **Counter** — disagree, document why, keep original plan.
16
+ - **Defer** — out of scope for this phase; file as follow-up.
17
+
18
+ 3. **Apply.** Make the accepted changes to PLAN.md. Mark the diff in a "Revision N" section so reviewers can see what changed.
19
+
20
+ 4. **Re-circulate.** Send the revised plan back to the reviewer that surfaced the blocker. If a council reviewed, send to the same panel.
21
+
22
+ 5. **Iterate or proceed.**
23
+ - All blockers resolved → proceed to execute.
24
+ - Any blocker still standing → either escalate (to user) or stop the phase.
25
+
26
+ ## Loop bound
27
+
28
+ Three revisions is the soft cap. If a plan needs four revisions, the underlying disagreement isn't about the plan — it's about scope, requirements, or strategy. Halt the loop, run `/rihal:discuss-phase` or `/rihal:council` to resolve the upstream disagreement, then start a fresh plan.
29
+
30
+ ## What never happens
31
+
32
+ - Silent acceptance. If a concern is rejected ("counter"), it's documented with a reason in the PLAN.md revision history.
33
+ - Blanket revisions. Each round addresses specific concerns from specific reviewers. Don't bundle "various improvements" into a single revision.
34
+ - Skipping the loop because the planner thinks they know better. The loop exists because reviewers catch what planners miss.
35
+
36
+ ## Output of the loop
37
+
38
+ A PLAN.md with a "Revision history" section showing each round, what changed, and who signed off. This becomes the audit trail when the phase ships and someone asks "why did we build it this way?"
@@ -1,15 +1,59 @@
1
- # Universal Anti-Patterns (Discuss-Phase)
1
+ # Universal Anti-Patterns
2
2
 
3
- Common failure modes the discuss workflow checks for:
3
+ Patterns that show up across every Rihal project. When a planning workflow surfaces these, halt and discuss before proceeding — they're cheap to fix during planning, expensive to fix after execution.
4
4
 
5
- - **Solution-first framing**: jumping to implementation before constraints
6
- are explicit.
7
- - **Hidden binary choice**: presenting a "decision" that has only one
8
- viable option.
9
- - **Unowned action**: a "we should X" with no owner or deadline.
10
- - **Sunk-cost continuation**: defending an existing plan instead of
11
- evaluating fresh evidence.
12
- - **Scope inflation**: bundling new work into the current decision.
5
+ ## Scope anti-patterns
13
6
 
14
- Discuss-phase flags any of these and asks for explicit framing before
15
- proceeding.
7
+ ### "While we're at it…"
8
+ Phase plan picks up scope adjacent to the actual goal. Symptom: phase description starts with the real goal but acceptance criteria reference 3 unrelated files. Fix: spin the side-scope into its own phase, even if it's a 1-day phase. Linear roadmaps are easier to verify than tangled ones.
9
+
10
+ ### Implicit prerequisites
11
+ Phase assumes another phase has shipped without declaring the dependency. Symptom: plan refers to a file or table that doesn't exist yet. Fix: surface the dependency in the phase's `Depends on` line in ROADMAP.md.
12
+
13
+ ### Vague acceptance
14
+ Acceptance criterion is "users can do X" with no measurable threshold. Fix: make every acceptance criterion observable from outside the system — a CLI command, an API response, a log line, a UI assertion.
15
+
16
+ ## Estimation anti-patterns
17
+
18
+ ### Round-number capacity
19
+ Sprint commits to "30 points this week" because that's what last week was. No data-backed velocity. Fix: use 80% of the trailing 3-sprint average, never a round number.
20
+
21
+ ### Hidden multitasking
22
+ Phase plan assumes the dev works on it full-time when in reality they're also on-call, in interviews, and at standups. Fix: explicit `effective_dev_hours` field in sprint capacity.
23
+
24
+ ## Decision anti-patterns
25
+
26
+ ### Reversible vs irreversible confusion
27
+ Treating reversible decisions (CSS framework choice) like irreversible ones (database engine), and vice versa. Fix: tag every recorded decision with `reversibility: reversible | one-way | nuanced`.
28
+
29
+ ### Council asked, council ignored
30
+ Council session produces a clear recommendation, the team builds the rejected option anyway. Fix: if you reject a council recommendation, explicitly log the override in `state.decisions[]` with `override_council: <session-id>` so the disagreement is searchable later.
31
+
32
+ ## Implementation anti-patterns
33
+
34
+ ### Defensive code for impossible states
35
+ Adding null checks, fallbacks, and validation for inputs that can never occur in this code path. Fix: trust internal contracts. Validate at system boundaries (user input, network, FS), not internally.
36
+
37
+ ### "Just in case" abstractions
38
+ Building a generic helper because someday three callers might need it, when right now there's one. Fix: three concrete callers first, then extract.
39
+
40
+ ### Comments that explain what
41
+ "// increment counter by 1" — the code says that. Fix: comments only for *why* (hidden constraint, surprising behaviour, workaround for specific bug, invariant that's not obvious from reading).
42
+
43
+ ### Silent failures
44
+ `try { ... } catch { /* ignore */ }`. Fix: every catch block has either a logged warning, a metric increment, or a re-throw. Never bare empty catches.
45
+
46
+ ## Process anti-patterns
47
+
48
+ ### Half-merged migrations
49
+ Old code path and new code path both running in production "for safety". Fix: complete migrations within one phase. Both paths existing forever doubles the maintenance burden.
50
+
51
+ ### Documentation that ages out silently
52
+ README written once, never updated. Code drifts. README lies. Fix: documentation that references specific files / functions includes a sentinel marker; CI fails if the docs reference paths that no longer exist.
53
+
54
+ ### "We'll fix it in v2"
55
+ Known broken behaviour that ships anyway because the deadline. Fix: the phase doesn't ship if known-broken behaviour reaches users. Cut the broken feature, don't ship it broken.
56
+
57
+ ---
58
+
59
+ When a phase plan or sprint hits any of these patterns during discussion, halt. Surface it explicitly. Adjust before execution starts. The cost compounds.
@@ -1,8 +1,8 @@
1
1
  # Rihal Code — Skills Index
2
2
 
3
- All 58 skills in Rihal Code, organized by category: 17 agent skills, 26 action skills, 13 core skills, plus 2 shared modules.
3
+ All 85 skills in Rihal Code, organized by category: 23 agent skills, 37 action skills, 25 core skills, plus 2 shared modules.
4
4
 
5
- ## Agent Skills (17)
5
+ ## Agent Skills (23)
6
6
 
7
7
  Each agent has a persona, principles, and a capabilities table that lists which action skills it can invoke.
8
8
 
@@ -25,12 +25,18 @@ Each agent has a persona, principles, and a capabilities table that lists which
25
25
  | **Zayd** | زيد | Senior ML Engineer | `agents/zayd-ml/` |
26
26
  | **Raees** | رئيس | Orchestrator | `agents/raees-orchestrator/` |
27
27
  | **Majlis** | مجلس | Multi-Agent Council | `agents/majlis-council/` |
28
+ | **Dalil** | دليل | Codebase Scout | `agents/dalil-scout/` |
29
+ | **Cross-Platform Auditor** | — | Cross-Platform Auditor | `agents/rihal-cross-platform-auditor/` |
30
+ | **Dep Auditor** | — | Dependency Health Auditor | `agents/rihal-dep-auditor/` |
31
+ | **Deviation Analyzer** | — | Deviation Analyzer | `agents/rihal-deviation-analyzer/` |
32
+ | **i18n Auditor** | — | i18n / L10n Auditor | `agents/rihal-i18n-auditor/` |
33
+ | **Observability Auditor** | — | Observability Auditor | `agents/rihal-observability-auditor/` |
28
34
 
29
35
  Note: Hussain has two hats — **PM** (strategic product management) and **SM** (scrum master / sprint ops). Real teams often combine these.
30
36
 
31
37
  ---
32
38
 
33
- ## Action Skills (26)
39
+ ## Action Skills (37)
34
40
 
35
41
  Invoked by agents via the capabilities table in their SKILL.md. Organized by SDLC phase.
36
42
 
@@ -57,7 +63,7 @@ Invoked by agents via the capabilities table in their SKILL.md. Organized by SDL
57
63
  - `actions/3-solutioning/rihal-check-implementation-readiness` — verify PRD/UX/arch alignment
58
64
  - `actions/3-solutioning/rihal-generate-project-context` — generate project-context.md
59
65
 
60
- ### 4 — Implementation (9)
66
+ ### 4 — Implementation (20)
61
67
  - `actions/4-implementation/rihal-dev-story` — execute a story (write tests + code)
62
68
  - `actions/4-implementation/rihal-code-review` — comprehensive code review
63
69
  - `actions/4-implementation/rihal-qa-generate-e2e-tests` — generate e2e test suite
@@ -67,10 +73,21 @@ Invoked by agents via the capabilities table in their SKILL.md. Organized by SDL
67
73
  - `actions/4-implementation/rihal-correct-course` — course-correction for off-track stories
68
74
  - `actions/4-implementation/rihal-scaffold-project` — scaffold new project from Rihal template
69
75
  - `actions/4-implementation/rihal-checkpoint-preview` — LLM-assisted human-in-the-loop review
76
+ - `actions/4-implementation/rihal-browser-verify` — verify browser behaviour via Chrome DevTools MCP
77
+ - `actions/4-implementation/rihal-ci` — CI/CD setup and quality gates
78
+ - `actions/4-implementation/rihal-debug` — root-cause debugging via the scientific method
79
+ - `actions/4-implementation/rihal-git-flow` — branching, commits, conflicts, parallel work
80
+ - `actions/4-implementation/rihal-harden` — security hardening checklist for SaaS apps
81
+ - `actions/4-implementation/rihal-incremental` — ship code in small, atomic, verifiable steps
82
+ - `actions/4-implementation/rihal-migrate` — move from MVP to production-grade infrastructure
83
+ - `actions/4-implementation/rihal-perf` — performance optimisation (LCP / TBT / CLS / hydration)
84
+ - `actions/4-implementation/rihal-prove-it` — test-first development
85
+ - `actions/4-implementation/rihal-source-truth` — cite official docs before writing framework code
86
+ - `actions/4-implementation/rihal-trim` — code simplification
70
87
 
71
88
  ---
72
89
 
73
- ## Core Skills (13)
90
+ ## Core Skills (25)
74
91
 
75
92
  Shared utilities used across agents and workflows.
76
93
 
@@ -87,6 +104,18 @@ Shared utilities used across agents and workflows.
87
104
  - `core/rihal-review-adversarial-general` — adversarial review for robustness
88
105
  - `core/rihal-review-edge-case-hunter` — edge case hunting and boundary testing
89
106
  - `core/rihal-party-mode` — multi-agent collaboration mode
107
+ - `core/rihal-auth-audit` — audit Keycloak ↔ AD sync, JWT validation, tenant isolation
108
+ - `core/rihal-client-gate` — client requirement freeze gates and async-comm patterns
109
+ - `core/rihal-deploy-unify` — detect and unify multiple deployment paths
110
+ - `core/rihal-incident-record` — generate a change record + post-mortem
111
+ - `core/rihal-memory-init` — bootstrap the Memory Bank for a project
112
+ - `core/rihal-memory-update` — surgical update of specific Memory Bank files
113
+ - `core/rihal-memory-audit` — audit the Memory Bank for stale entries and contradictions
114
+ - `core/rihal-memory-distill` — regenerate token-optimised Memory Bank distillates
115
+ - `core/rihal-mvp-graduate` — move an MVP to production-grade infrastructure incrementally
116
+ - `core/rihal-ocr-consistency` — OCR pipeline determinism + ground-truth validation
117
+ - `core/rihal-rebrand` — stack-wide rebranding migration
118
+ - `core/rihal-theme-system` — audit a frontend's design tokens before launch
90
119
 
91
120
  ---
92
121
 
@@ -15,6 +15,7 @@ triggers:
15
15
  - "help
16
16
  me understand X industry"
17
17
  - "domain research for"
18
+ user-invocable: true
18
19
  ---
19
20
  @.rihal/references/karpathy-guidelines.md
20
21
 
@@ -14,6 +14,7 @@ triggers:
14
14
  - "size the market"
15
15
  - "competitor scan"
16
16
  - "analyze the market for X"
17
+ user-invocable: true
17
18
  ---
18
19
  @.rihal/references/karpathy-guidelines.md
19
20
 
@@ -17,6 +17,7 @@ triggers:
17
17
  - "what stack for"
18
18
  - "technical
19
19
  feasibility for"
20
+ user-invocable: true
20
21
  ---
21
22
  @.rihal/references/karpathy-guidelines.md
22
23
 
@@ -14,6 +14,7 @@ triggers:
14
14
  existing code"
15
15
  - "brownfield analysis"
16
16
  - "create LLM-friendly docs"
17
+ user-invocable: true
17
18
  ---
18
19
  @.rihal/references/karpathy-guidelines.md
19
20
 
@@ -9,6 +9,7 @@ triggers:
9
9
  - "create a prfaq"
10
10
  - "product concept challenge"
11
11
  - "forge a product idea"
12
+ user-invocable: true
12
13
  ---
13
14
  @.rihal/references/karpathy-guidelines.md
14
15
 
@@ -14,6 +14,7 @@ triggers:
14
14
  - "draft a brief for"
15
15
  - "product briefing"
16
16
  - "create the brief"
17
+ user-invocable: true
17
18
  ---
18
19
  @.rihal/references/karpathy-guidelines.md
19
20
 
@@ -25,6 +25,7 @@ triggers:
25
25
  - "قسّم المتطلبات"
26
26
  - "ابني القائمة"
27
27
  - "تحليل وثيقة المتطلبات"
28
+ user-invocable: true
28
29
  ---
29
30
  @.rihal/references/karpathy-guidelines.md
30
31
 
@@ -4,6 +4,18 @@
4
4
 
5
5
  **Your Role:** In addition to your name, communication_style, and persona, you are also a product strategist and technical specifications writer collaborating with a product owner. This is a partnership, not a client-vendor relationship. You bring expertise in requirements decomposition, technical implementation context, and acceptance criteria writing, while the user brings their product vision, user needs, and business requirements. Work together as equals.
6
6
 
7
+ ## State-sync rule (NO EXCEPTIONS)
8
+
9
+ After this workflow writes any `.planning/` artifact (ROADMAP.md, epics.md, sprint-*.md, SUMMARY.md, etc.) or updates phase/story status:
10
+
11
+ ```bash
12
+ node .rihal/bin/rihal-tools.cjs state sync --from-disk
13
+ ```
14
+
15
+ This keeps `.rihal/state.json` in sync with disk — `/rihal:progress`, `/rihal:status`, and `/rihal:execute` all read state.json. Skipping the sync silently drifts them. See `../../_shared/state-sync-rule.md`.
16
+
17
+ ---
18
+
7
19
  ---
8
20
 
9
21
  ## WORKFLOW ARCHITECTURE
@@ -17,6 +17,7 @@ triggers:
17
17
  - "break this project into
18
18
  milestones"
19
19
  - "roadmap for this product"
20
+ user-invocable: true
20
21
  ---
21
22
  @.rihal/references/karpathy-guidelines.md
22
23
 
@@ -27,6 +27,7 @@ triggers:
27
27
  - "وثيقة المتطلبات"
28
28
  - "ابدأ PRD"
29
29
  - "صمم المتطلبات"
30
+ user-invocable: true
30
31
  ---
31
32
  @.rihal/references/karpathy-guidelines.md
32
33
 
@@ -25,6 +25,7 @@ triggers:
25
25
  - "حضّر القصة"
26
26
  - "القصة التالية"
27
27
  - "جهّز القصة للتنفيذ"
28
+ user-invocable: true
28
29
  ---
29
30
  @.rihal/references/karpathy-guidelines.md
30
31
 
@@ -15,6 +15,7 @@ triggers:
15
15
  - "UX plan"
16
16
  - "design this screen"
17
17
  - "create the design for"
18
+ user-invocable: true
18
19
  ---
19
20
  @.rihal/references/karpathy-guidelines.md
20
21
 
@@ -14,6 +14,7 @@ triggers:
14
14
  - "add a section to the PRD"
15
15
  - "revise requirements"
16
16
  - "change the scope in the PRD"
17
+ user-invocable: true
17
18
  ---
18
19
  @.rihal/references/karpathy-guidelines.md
19
20
 
@@ -26,6 +26,7 @@ triggers:
26
26
  - "editorial"
27
27
  - "maximalist"
28
28
  license: Adapted from Anthropic's frontend-design skill
29
+ user-invocable: true
29
30
  ---
30
31
  @.rihal/references/karpathy-guidelines.md
31
32
 
@@ -14,6 +14,7 @@ triggers:
14
14
  - "PRD quality
15
15
  check"
16
16
  - "audit the PRD"
17
+ user-invocable: true
17
18
  ---
18
19
  @.rihal/references/karpathy-guidelines.md
19
20
 
@@ -15,6 +15,7 @@ triggers:
15
15
  - "readiness check"
16
16
  - "IR check"
17
17
  - "can we start building"
18
+ user-invocable: true
18
19
  ---
19
20
  @.rihal/references/karpathy-guidelines.md
20
21
 
@@ -18,6 +18,7 @@ triggers:
18
18
  - "lock this technical decision"
19
19
  - "record the
20
20
  decision to use X"
21
+ user-invocable: true
21
22
  ---
22
23
  @.rihal/references/karpathy-guidelines.md
23
24
 
@@ -16,6 +16,7 @@ triggers:
16
16
  - "setup AI context"
17
17
  - "create
18
18
  project-context.md"
19
+ user-invocable: true
19
20
  ---
20
21
  @.rihal/references/karpathy-guidelines.md
21
22
 
@@ -9,6 +9,7 @@ triggers:
9
9
  - "review before checkpoint"
10
10
  - "checkpoint review session"
11
11
  - "preview changes before approval"
12
+ user-invocable: true
12
13
  ---
13
14
 
14
15
  ## Overview
@@ -27,6 +27,7 @@ triggers:
27
27
  - "افحص الكود"
28
28
  - "تدقيق الكود"
29
29
  - "جودة الكود"
30
+ user-invocable: true
30
31
  ---
31
32
  @.rihal/references/karpathy-guidelines.md
32
33
 
@@ -16,6 +16,7 @@ triggers:
16
16
  - "handle scope
17
17
  change"
18
18
  - "change story mid-way"
19
+ user-invocable: true
19
20
  ---
20
21
  @.rihal/references/karpathy-guidelines.md
21
22
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: rihal-debug
3
- description: Root-cause debugging via the scientific method. Enforces investigate-before-fix, structured hypothesis iteration, multi-component evidence gathering, and architectural escalation after 3 failed fixes.
3
+ description: Scientific-method debugging: investigate first, test hypotheses, escalate at 3 failures.
4
4
  triggers:
5
5
  # English
6
6
  - "debug this"
@@ -31,7 +31,6 @@ user-invocable: false
31
31
  ---
32
32
  @.rihal/references/karpathy-guidelines.md
33
33
 
34
-
35
34
  ## The Iron Law
36
35
 
37
36
  ```
@@ -45,7 +44,6 @@ If you have not completed Phase 1, you cannot propose a fix. "It seems to work"
45
44
  Debugging is investigation, not pattern-matching. Each iteration narrows the problem space — never widens it. The skill enforces a written hypothesis, an experiment that distinguishes "yes" from "no", and a captured observation. Random fixes are not allowed — the bug must be understood before the fix is written.
46
45
 
47
46
  ## Workflow
48
-
49
47
  ## Phase 1 — Root Cause Investigation
50
48
 
51
49
  **BEFORE attempting ANY fix:**
@@ -137,7 +135,6 @@ If the project has Sentry (`@sentry/*` in `package.json` or `sentry-sdk` in Pyth
137
135
  - Read breadcrumbs for the chain of events leading to the error
138
136
  - Check "first seen / last seen" — recurring or one-off matters
139
137
  - Cross-reference with deployment timestamps to identify regressions
140
-
141
138
  ## Red Flags — STOP and return to Phase 1
142
139
 
143
140
  If you catch yourself thinking any of these:
@@ -153,17 +150,6 @@ If you catch yourself thinking any of these:
153
150
 
154
151
  **ALL of these mean: STOP. Return to Phase 1.**
155
152
 
156
- ## Common Rationalizations
157
-
158
- | Excuse | Reality |
159
- |--------|---------|
160
- | "Issue is simple, don't need process" | Simple bugs have root causes too. Process is fast for simple bugs. |
161
- | "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
162
- | "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
163
- | "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
164
- | "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
165
- | "One more fix attempt" (after 2+) | 3+ failures = architectural problem. Escalate, don't fix again. |
166
-
167
153
  ## Output Format
168
154
 
169
155
  ```
@@ -209,5 +195,5 @@ Do NOT include: "tried X and it seems to work" · speculative "maybe it's cachin
209
195
 
210
196
  ## Memory Bank Hooks
211
197
 
212
- - **Reads:** `.rihal/memory/incidents/known-issues.md` (prior debugging context), `.rihal/memory/project/stack.md` (Sentry presence, observability tools)
213
- - **Writes:** append root cause to `.rihal/memory/incidents/post-mortems/YYYYMMDD-<slug>.md` when resolved; remove from `known-issues.md` once fix is verified in production
198
+ - **Reads:** `known-issues.md`, `stack.md`
199
+ - **Writes:** append to `post-mortems/YYYYMMDD-<slug>.md`; remove from `known-issues.md` once fixed in production
@@ -15,6 +15,7 @@ triggers:
15
15
  - "run
16
16
  dev-story on"
17
17
  - "implement .rihal/phases/{phase}/stories/{file}"
18
+ user-invocable: true
18
19
  ---
19
20
  @.rihal/references/karpathy-guidelines.md
20
21