@hanzlaa/rcode 3.4.32 → 3.5.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.
- package/AGENTS.md +6 -6
- package/CONTRIBUTING.md +2 -0
- package/LICENSE +21 -0
- package/README.md +66 -403
- package/cli/agent.js +3 -2
- package/cli/doctor.js +87 -1
- package/cli/install.js +122 -31
- package/cli/lib/schemas.cjs +318 -0
- package/cli/postinstall.js +19 -3
- package/dist/rcode.js +318 -24
- package/package.json +8 -4
- package/rihal/agents/rihal-cross-platform-auditor.md +15 -0
- package/rihal/agents/rihal-dep-auditor.md +15 -0
- package/rihal/agents/rihal-docs-auditor.md +3 -145
- package/rihal/agents/rihal-i18n-auditor.md +16 -0
- package/rihal/agents/rihal-nyquist-auditor.md +4 -156
- package/rihal/agents/rihal-observability-auditor.md +16 -0
- package/rihal/agents/rihal-phase-researcher.md +1 -1
- package/rihal/agents/rihal-planner.md +1 -1
- package/rihal/bin/rihal-hooks.cjs +394 -4
- package/rihal/bin/rihal-tools.cjs +891 -24
- package/rihal/commands/create-prd.md +18 -0
- package/rihal/commands/execute-milestone.md +18 -0
- package/rihal/commands/plan-milestone.md +18 -0
- package/rihal/commands/scaffold-milestone.md +18 -0
- package/rihal/commands/scaffold-skill.md +18 -0
- package/rihal/references/REFERENCES_INDEX.md +49 -7
- package/rihal/references/agent-contracts.md +10 -0
- package/rihal/references/design-tokens.md +98 -0
- package/rihal/references/docs-auditor-playbook.md +148 -0
- package/rihal/references/git-preflight.md +117 -0
- package/rihal/references/iterative-retrieval.md +85 -0
- package/rihal/references/nyquist-auditor-playbook.md +157 -0
- package/rihal/references/workstream-flag.md +2 -2
- package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +9 -0
- package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +9 -0
- package/rihal/skills/actions/4-implementation/rihal-ci/SKILL.md +4 -0
- package/rihal/skills/actions/4-implementation/rihal-code-review/steps/step-02-review.md +7 -3
- package/rihal/skills/actions/4-implementation/rihal-harden/SKILL.md +4 -0
- package/rihal/skills/actions/4-implementation/rihal-migrate/SKILL.md +4 -0
- package/rihal/skills/agents/haitham-frontend/SKILL.md +2 -0
- package/rihal/skills/agents/majlis-council/SKILL.md +1 -1
- package/rihal/team.yaml +32 -0
- package/rihal/templates/settings-hooks.json +39 -0
- package/rihal/workflows/check-todos.md +4 -0
- package/rihal/workflows/code-review-fix.md +4 -3
- package/rihal/workflows/code-review.md +1 -1
- package/rihal/workflows/debug.md +1 -1
- package/rihal/workflows/dev-story.md +4 -0
- package/rihal/workflows/diff.md +2 -2
- package/rihal/workflows/do.md +16 -8
- package/rihal/workflows/docs-update.md +2 -2
- package/rihal/workflows/enable-hooks.md +6 -1
- package/rihal/workflows/execute-milestone.md +139 -0
- package/rihal/workflows/execute-regression-gates.md +1 -1
- package/rihal/workflows/execute-sprint.md +54 -2
- package/rihal/workflows/execute-verify-phase-goal.md +31 -4
- package/rihal/workflows/execute-waves.md +33 -5
- package/rihal/workflows/execute.md +40 -6
- package/rihal/workflows/help.md +1 -1
- package/rihal/workflows/import.md +1 -1
- package/rihal/workflows/lens-audit.md +39 -23
- package/rihal/workflows/list-workspaces.md +1 -1
- package/rihal/workflows/map-codebase.md +4 -4
- package/rihal/workflows/new-milestone.md +18 -1
- package/rihal/workflows/new-project-research.md +53 -1
- package/rihal/workflows/new-workspace.md +1 -1
- package/rihal/workflows/plan-milestone.md +105 -0
- package/rihal/workflows/plan-research-validation.md +1 -1
- package/rihal/workflows/plan-spawn-planner.md +1 -1
- package/rihal/workflows/plan.md +31 -3
- package/rihal/workflows/plant-seed.md +6 -0
- package/rihal/workflows/quick.md +11 -5
- package/rihal/workflows/research-phase.md +24 -0
- package/rihal/workflows/scaffold-milestone.md +60 -0
- package/rihal/workflows/scaffold-skill.md +137 -0
- package/rihal/workflows/scan.md +1 -1
- package/rihal/workflows/session-report.md +43 -3
- package/rihal/workflows/verify-work.md +3 -3
- package/server/dashboard.js +53 -6
- package/server/lib/api.js +7 -0
- package/server/lib/html/client.js +725 -13
- package/server/lib/html/css.js +2046 -466
- package/server/lib/html/shell.js +227 -134
- package/server/lib/scanner.js +33 -0
- package/server/orchestrator.js +438 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rihal-create-prd
|
|
3
|
+
description: "Create a Product Requirements Document from scratch through guided facilitation. Use when starting a new project or feature that needs a PRD before architecture or phases."
|
|
4
|
+
argument-hint: "[topic]"
|
|
5
|
+
allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<objective>
|
|
9
|
+
Execute create-prd workflow
|
|
10
|
+
</objective>
|
|
11
|
+
|
|
12
|
+
<execution_context>
|
|
13
|
+
@.rihal/workflows/create-prd.md
|
|
14
|
+
</execution_context>
|
|
15
|
+
|
|
16
|
+
<process>
|
|
17
|
+
Execute the create-prd workflow from @.rihal/workflows/create-prd.md end-to-end.
|
|
18
|
+
</process>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rihal-execute-milestone
|
|
3
|
+
description: Execute all phases in the current milestone in dependency order, with verify gates between phases. Closes #738.
|
|
4
|
+
argument-hint: "[--milestone <name>] [--dry-run] [--skip-verify] [--wave N] [--phase N]"
|
|
5
|
+
allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion, Agent, TaskCreate, TaskUpdate
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<objective>
|
|
9
|
+
Execute all phases in the current milestone in dependency order, with verify gates between waves.
|
|
10
|
+
</objective>
|
|
11
|
+
|
|
12
|
+
<execution_context>
|
|
13
|
+
@.rihal/workflows/execute-milestone.md
|
|
14
|
+
</execution_context>
|
|
15
|
+
|
|
16
|
+
<process>
|
|
17
|
+
Execute the execute-milestone workflow from @.rihal/workflows/execute-milestone.md end-to-end.
|
|
18
|
+
</process>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rihal-plan-milestone
|
|
3
|
+
description: Plan all phases in a milestone in parallel dependency waves. Reads ROADMAP.md, groups phases into dependency waves, spawns rihal-planner agents in parallel per wave. Closes #732.
|
|
4
|
+
argument-hint: "[--milestone <name>] [--dry-run] [--skip-research] [--wave N]"
|
|
5
|
+
allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion, Agent, TaskCreate, TaskUpdate
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<objective>
|
|
9
|
+
Plan all phases for a milestone using parallel dependency-wave execution. Group independent phases into concurrent waves, run rihal-planner for each in parallel.
|
|
10
|
+
</objective>
|
|
11
|
+
|
|
12
|
+
<execution_context>
|
|
13
|
+
@.rihal/workflows/plan-milestone.md
|
|
14
|
+
</execution_context>
|
|
15
|
+
|
|
16
|
+
<process>
|
|
17
|
+
Execute the plan-milestone workflow from @.rihal/workflows/plan-milestone.md end-to-end.
|
|
18
|
+
</process>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rihal-scaffold-milestone
|
|
3
|
+
description: Bulk-create all phase directories for a milestone from a pipe-separated name list or ROADMAP.md planned phases. Closes #731.
|
|
4
|
+
argument-hint: "--names \"Phase Name 1|Phase Name 2|...\" [--start N]"
|
|
5
|
+
allowed-tools: Read, Write, Bash, Glob, Grep
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<objective>
|
|
9
|
+
Execute scaffold-milestone workflow
|
|
10
|
+
</objective>
|
|
11
|
+
|
|
12
|
+
<execution_context>
|
|
13
|
+
@.rihal/workflows/scaffold-milestone.md
|
|
14
|
+
</execution_context>
|
|
15
|
+
|
|
16
|
+
<process>
|
|
17
|
+
Execute the scaffold-milestone workflow from @.rihal/workflows/scaffold-milestone.md end-to-end.
|
|
18
|
+
</process>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rihal-scaffold-skill
|
|
3
|
+
description: "Scaffold a new compliant SKILL.md file for a Rihal role. Eliminates the friction of finding the right folder, copying an existing skill, and chasing 5-component compliance. Use when adding a new role-specific skill."
|
|
4
|
+
argument-hint: "--role <role> --name <skill-name>"
|
|
5
|
+
allowed-tools: Read, Write, Bash, Glob, Grep
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<objective>
|
|
9
|
+
Execute scaffold-skill workflow
|
|
10
|
+
</objective>
|
|
11
|
+
|
|
12
|
+
<execution_context>
|
|
13
|
+
@.rihal/workflows/scaffold-skill.md
|
|
14
|
+
</execution_context>
|
|
15
|
+
|
|
16
|
+
<process>
|
|
17
|
+
Execute the scaffold-skill workflow from @.rihal/workflows/scaffold-skill.md end-to-end.
|
|
18
|
+
</process>
|
|
@@ -21,8 +21,10 @@ These files were extracted from heavy agents (>100L) to reduce context budget pe
|
|
|
21
21
|
| `code-reviewer-playbook.md` | rihal-code-reviewer |
|
|
22
22
|
| `codebase-mapping-process.md` | rihal-codebase-mapper |
|
|
23
23
|
| `debugger-playbook.md` | rihal-debugger |
|
|
24
|
+
| `docs-auditor-playbook.md` | rihal-docs-auditor |
|
|
24
25
|
| `executor-playbook.md` | rihal-executor |
|
|
25
26
|
| `integration-verification-playbook.md` | rihal-integration-checker |
|
|
27
|
+
| `nyquist-auditor-playbook.md` | rihal-nyquist-auditor |
|
|
26
28
|
| `persona-engineer-shared.md` | rihal-haitham, rihal-omar, rihal-yousef |
|
|
27
29
|
| `planner-playbook.md` | rihal-planner |
|
|
28
30
|
| `remediation-planner-playbook.md` | rihal-remediation-planner |
|
|
@@ -52,16 +54,56 @@ These files were extracted from heavy agents (>100L) to reduce context budget pe
|
|
|
52
54
|
| File | Loaded by |
|
|
53
55
|
|------|-----------|
|
|
54
56
|
| `auto-init-guard.md` | workflows/council.md, workflows/do.md, workflows/execute.md, workflows/new-project.md, workflows/plan.md, workflows/status.md |
|
|
57
|
+
| `git-preflight.md` | workflows/code-review-fix.md, workflows/dev-story.md, workflows/execute.md, workflows/quick.md |
|
|
55
58
|
| `output-format.md` | workflows/autonomous.md, workflows/council.md, workflows/decisions.md, workflows/discuss.md, workflows/do.md, workflows/execute.md, workflows/export-to-github.md, workflows/feature-drift.md, workflows/from-template.md, workflows/list-plans.md, workflows/map-codebase.md, workflows/new-milestone.md, workflows/new-project.md, workflows/next.md, workflows/notify-test.md, workflows/plan.md, workflows/replay.md, workflows/sprint-planning.md, workflows/sprint-status.md, workflows/status.md, workflows/verify-work.md |
|
|
56
59
|
|
|
57
60
|
---
|
|
58
61
|
|
|
59
|
-
##
|
|
62
|
+
## Specialist References
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
| File | Loaded by |
|
|
65
|
+
|------|-----------|
|
|
66
|
+
| `design-tokens.md` | rihal-haitham, workflows/lens-audit.md (Lens 11) |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Persona ↔ SKILL.md Mapping (#714)
|
|
71
|
+
|
|
72
|
+
Persona agents are thin pointers — the bulk of each persona's playbook lives
|
|
73
|
+
in a `SKILL.md` at `rihal/skills/agents/<name>-<role>/SKILL.md` and gets pulled
|
|
74
|
+
in via `@-include`. This keeps agent files dependency-free + IDE-discoverable
|
|
75
|
+
while the playbook can grow without ballooning every spawn.
|
|
76
|
+
|
|
77
|
+
| Persona | Agent file | Playbook |
|
|
78
|
+
|---------|------------|----------|
|
|
79
|
+
| Hanzla | rihal-hanzla.md | rihal/skills/agents/hanzla-engineer/SKILL.md |
|
|
80
|
+
| Waleed | rihal-waleed.md | rihal/skills/agents/waleed-architect/SKILL.md |
|
|
81
|
+
| Sadiq | rihal-sadiq.md | rihal/skills/agents/sadiq-analyst/SKILL.md |
|
|
82
|
+
| Fatima | rihal-fatima.md | rihal/skills/agents/fatima-qa/SKILL.md |
|
|
83
|
+
| Mariam | rihal-mariam.md | rihal/skills/agents/mariam-marketing/SKILL.md |
|
|
84
|
+
| Layla | rihal-layla.md | rihal/skills/agents/layla-designer/SKILL.md |
|
|
85
|
+
| Hussain-PM | rihal-hussain-pm.md | rihal/skills/agents/hussain-pm/SKILL.md |
|
|
86
|
+
| Noor | rihal-noor.md | rihal/skills/agents/noor-writer/SKILL.md |
|
|
87
|
+
| Nasser | rihal-nasser.md | rihal/skills/agents/nasser-eng-manager/SKILL.md |
|
|
88
|
+
| Zahra | rihal-zahra.md | rihal/skills/agents/zahra-branding/SKILL.md |
|
|
89
|
+
| Ahmed | rihal-ahmed.md | rihal/skills/agents/ahmed-hassani-director/SKILL.md |
|
|
90
|
+
| Zayd | rihal-zayd.md | rihal/skills/agents/zayd-ml/SKILL.md |
|
|
91
|
+
| Yousef | rihal-yousef.md | rihal/skills/agents/yousef-backend/SKILL.md |
|
|
92
|
+
| Haitham | rihal-haitham.md | rihal/skills/agents/haitham-frontend/SKILL.md |
|
|
93
|
+
| Khalid | rihal-khalid.md | *(inline — 99L, no separate playbook)* |
|
|
94
|
+
| Omar | rihal-omar.md | *(inline — 96L, no separate playbook)* |
|
|
95
|
+
|
|
96
|
+
Khalid and Omar keep their content inline because no separate playbook
|
|
97
|
+
exists. Both are under the 100-line budget; extracting them to SKILL.md is
|
|
98
|
+
optional scope and not required for compliance.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Size Compliance
|
|
103
|
+
|
|
104
|
+
The Agent File Size Rule (CONTRIBUTING.md:212) requires agents >100L to extract to references.
|
|
63
105
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
106
|
+
**All 45 agents currently comply** (max: 99L). The previously-listed exceptions
|
|
107
|
+
(`rihal-nyquist-auditor.md` at 176L, `rihal-docs-auditor.md` at 173L) were slimmed
|
|
108
|
+
in #713: their playbooks live in `nyquist-auditor-playbook.md` and
|
|
109
|
+
`docs-auditor-playbook.md` respectively.
|
|
@@ -10,3 +10,13 @@ Conventions Rihal sub-agents follow when invoked from a workflow.
|
|
|
10
10
|
not granted in the agent definition is unavailable.
|
|
11
11
|
- **Failure**: agents that hit an obstacle return a structured "blocked"
|
|
12
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.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Design Tokens Discipline
|
|
2
|
+
|
|
3
|
+
Shared reference `@`-included by `rihal-code-reviewer` and `rihal-haitham`. Designed by Haitham to close #660.
|
|
4
|
+
|
|
5
|
+
## The rule
|
|
6
|
+
|
|
7
|
+
**If a token is missing for a stated semantic role, ADD the token to the design system. Do NOT inline hex.**
|
|
8
|
+
|
|
9
|
+
A semantic role is anything named like `.order-status-paid`, `.btn-danger`, `.alert-warning`, `.badge-pending` — the class name encodes a meaning the design system should own.
|
|
10
|
+
|
|
11
|
+
## What this catches
|
|
12
|
+
|
|
13
|
+
**Anti-pattern (real incident, Phase 07):**
|
|
14
|
+
```css
|
|
15
|
+
.order-status-paid {
|
|
16
|
+
background: #D1FAE5; /* ✗ raw hex outside :root */
|
|
17
|
+
color: #065F46; /* ✗ raw hex outside :root */
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The class is asking for `--paid-bg` and `--paid-fg` tokens. Inlining hex silently defeats tokenization and creates a hole the next dev will repeat.
|
|
22
|
+
|
|
23
|
+
**Correct fix:**
|
|
24
|
+
```css
|
|
25
|
+
:root {
|
|
26
|
+
--paid-bg: #D1FAE5;
|
|
27
|
+
--paid-fg: #065F46;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.order-status-paid {
|
|
31
|
+
background: var(--paid-bg);
|
|
32
|
+
color: var(--paid-fg);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Regex (two-stage; single regex can't express block context)
|
|
37
|
+
|
|
38
|
+
**Stage A — candidate scan** in `*.css`, `*.scss`, `*.sass`, `*.less`, styled-components in `*.{ts,tsx,js,jsx}`, Tailwind config files:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
(#[0-9a-fA-F]{3,8}\b)|(\b(?:rgb|rgba|hsl|hsla)\s*\()
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Stage B — context filter** (drop matches where ANY of these hold):
|
|
45
|
+
|
|
46
|
+
1. Match is inside a `:root { … }`, `@theme { … }`, `:where(:root) { … }`, or `[data-theme] { … }` block (track brace depth from file start).
|
|
47
|
+
2. The line is a CSS-custom-property declaration: `^\s*--[a-z0-9-]+\s*:`.
|
|
48
|
+
3. Match is inside `url(...)`, `content:`, `font-family:`, `background-image: url(...)`.
|
|
49
|
+
4. Match is preceded by `//` or inside `/* … */`.
|
|
50
|
+
5. Match is an HTML/URL fragment: `href="#...`, `id="#...`, or `#` followed by non-hex chars.
|
|
51
|
+
6. File path appears in `.rihal/design-tokens-allowlist.txt`.
|
|
52
|
+
7. The exact `file:line:value` triple appears in `.rihal/design-tokens-allowlist.txt`.
|
|
53
|
+
|
|
54
|
+
**Named-color trap** (`color: red`, `background: white`): flag too, but only for the CSS-named-color set in property positions:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
(?:color|background(?:-color)?|border(?:-[a-z]+)?-color|fill|stroke)\s*:\s*(red|blue|green|orange|purple|pink|yellow|black|white|gray|grey|cyan|magenta|brown|teal|navy|olive|maroon|silver|aqua|fuchsia|lime)\b
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## When violations are found — failure banner
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
✗ Design-token bypass (Lens 11 · Karpathy)
|
|
64
|
+
|
|
65
|
+
apps/web/styles/orders.css:42 — hex literal used outside token block: #D1FAE5
|
|
66
|
+
apps/web/styles/orders.css:43 — hex literal used outside token block: #065F46
|
|
67
|
+
|
|
68
|
+
Why this fails:
|
|
69
|
+
A semantic role (.order-status-paid) is missing tokens.
|
|
70
|
+
Inlining hex silently defeats the design system and creates a hole that repeats.
|
|
71
|
+
|
|
72
|
+
Fix path:
|
|
73
|
+
1. Add to :root → --paid-bg: #D1FAE5; --paid-fg: #065F46;
|
|
74
|
+
2. Replace in class → background: var(--paid-bg); color: var(--paid-fg);
|
|
75
|
+
3. Or waive → echo "apps/web/styles/orders.css:42:#D1FAE5" >> .rihal/design-tokens-allowlist.txt
|
|
76
|
+
|
|
77
|
+
Files: 1 · Violations: 2 · Waived: 0
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Allowlist file format
|
|
81
|
+
|
|
82
|
+
`.rihal/design-tokens-allowlist.txt` — one waiver per line, blank lines and `#` comments allowed:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
# Print stylesheet — Pantone-mandated for the PDF export
|
|
86
|
+
apps/web/styles/print.css
|
|
87
|
+
# Specific match (file:line:value) — narrowest waiver, prefer this form
|
|
88
|
+
apps/web/styles/legacy/calendar.css:88:#0A0A0A
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Why a check vs a pre-commit hook
|
|
92
|
+
|
|
93
|
+
This rule lives in `/rihal-lens-audit` (Lens 11 — Karpathy) because the violation is a Karpathy-shaped defect: code that looks fine but silently degrades a system contract. Users opt in by running the lens or `all`.
|
|
94
|
+
|
|
95
|
+
A pre-commit hook would catch it sooner but adds friction every commit. The recommended workflow:
|
|
96
|
+
|
|
97
|
+
- Run `/rihal-lens-audit 11` before opening a PR.
|
|
98
|
+
- Add the regex above to `pre-commit` if your team wants enforcement at commit time.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Docs Auditor Playbook
|
|
2
|
+
|
|
3
|
+
Shared reference `@`-included by `rihal-docs-auditor`. Holds the bulk audit-mode rules and the two structured-output modes (`--mode=feature-drift`, `--mode=phase-status`).
|
|
4
|
+
|
|
5
|
+
## Specializations
|
|
6
|
+
|
|
7
|
+
### Coverage Audit
|
|
8
|
+
- Identify missing documentation: README, API docs, guides, examples
|
|
9
|
+
- Check for critical gaps: setup, deployment, testing, troubleshooting
|
|
10
|
+
- Assess discoverability: are docs easy to find from relevant code?
|
|
11
|
+
|
|
12
|
+
### Accuracy Audit
|
|
13
|
+
- Verify code examples actually work
|
|
14
|
+
- Check version accuracy: do docs match current version?
|
|
15
|
+
- Validate configuration examples against actual schema
|
|
16
|
+
- Confirm links and references are not broken
|
|
17
|
+
|
|
18
|
+
### Quality Audit
|
|
19
|
+
- Assess clarity: could a new engineer follow this?
|
|
20
|
+
- Check completeness: are all required steps documented?
|
|
21
|
+
- Evaluate maintainability: are docs structured for easy updates?
|
|
22
|
+
- Identify tone consistency across documentation
|
|
23
|
+
|
|
24
|
+
### Compliance Audit
|
|
25
|
+
- Verify required documentation exists (privacy, security, legal)
|
|
26
|
+
- Check standards compliance: do docs meet team standards?
|
|
27
|
+
- Assess accessibility: are docs screen-reader friendly?
|
|
28
|
+
|
|
29
|
+
## Redirects
|
|
30
|
+
|
|
31
|
+
Use command-redirect-format.md. One reason, then command.
|
|
32
|
+
|
|
33
|
+
- Documentation writing → rihal-noor
|
|
34
|
+
- Technical accuracy verification → Waleed (CTO)
|
|
35
|
+
- Content updates → rihal-noor
|
|
36
|
+
|
|
37
|
+
## Constraints
|
|
38
|
+
|
|
39
|
+
- Audit against documented standards, not personal preference
|
|
40
|
+
- Distinguish missing docs from incomplete docs
|
|
41
|
+
- Verify code examples before approving documentation
|
|
42
|
+
- Prioritize critical paths (setup, deployment, common tasks)
|
|
43
|
+
- No emojis beyond 📚
|
|
44
|
+
|
|
45
|
+
<mode_feature_drift>
|
|
46
|
+
**Activated when:** invoked with `--mode=feature-drift` argument or when
|
|
47
|
+
`mode: feature-drift` is present in the orchestrator prompt (called from
|
|
48
|
+
`/rihal-feature-drift` workflow per Phase 6 D-4 — extension flag, not new agent).
|
|
49
|
+
|
|
50
|
+
**Inputs:**
|
|
51
|
+
- PRD content (may be null — handle gracefully without crashing or speculating)
|
|
52
|
+
- Epics content (may be null)
|
|
53
|
+
- Stories content (may be null)
|
|
54
|
+
- Code surface paths (always present)
|
|
55
|
+
- present_layers[] — which layers were found; never compare against absent layers
|
|
56
|
+
|
|
57
|
+
**Output: structured JSON** (not prose). Schema:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"drift": [
|
|
62
|
+
{
|
|
63
|
+
"id": "drift-001",
|
|
64
|
+
"severity": "trivial|minor|major|critical",
|
|
65
|
+
"layer_a": "prd|epics|stories|code",
|
|
66
|
+
"layer_b": "prd|epics|stories|code",
|
|
67
|
+
"claim_a": "<text from layer_a>",
|
|
68
|
+
"claim_b": "<text from layer_b>",
|
|
69
|
+
"file": "<path>",
|
|
70
|
+
"line": <number-or-null>,
|
|
71
|
+
"fix_hint": "<if trivial: exact replacement string; else null>"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"layers_skipped": ["..."]
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Severity rules (HARD — enforced downstream by workflow code, but you must classify correctly):**
|
|
79
|
+
|
|
80
|
+
- `trivial` — typo, stale ISO date, broken relative path, mechanically-correctable
|
|
81
|
+
factual error (e.g., "API returns JSON" when code returns YAML and the exact
|
|
82
|
+
replacement is unambiguous). Must include `fix_hint` with the literal replacement.
|
|
83
|
+
- `minor` — wording divergence that doesn't change meaning (paraphrase mismatch).
|
|
84
|
+
- `major` — scope or behavior claim mismatch (PRD says feature does X, code does Y).
|
|
85
|
+
- `critical` — security or data-loss-relevant claim mismatch (PRD says encrypted,
|
|
86
|
+
code stores plaintext, etc.).
|
|
87
|
+
|
|
88
|
+
**Never:**
|
|
89
|
+
- Compare layers that aren't both in `present_layers[]` — silently skipping
|
|
90
|
+
the comparison is correct here, not a bug.
|
|
91
|
+
- Speculate about author intent — flag only observable, citable drift.
|
|
92
|
+
- Recommend patches above trivial severity. The `fix_hint` field is null for
|
|
93
|
+
any non-trivial finding.
|
|
94
|
+
- Return prose narrative — the workflow parses your JSON. Narrative output
|
|
95
|
+
is treated as a malfunction.
|
|
96
|
+
</mode_feature_drift>
|
|
97
|
+
|
|
98
|
+
<mode_phase_status>
|
|
99
|
+
**Activated when:** invoked with `--mode=phase-status` argument or when `mode: phase-status` is present in the orchestrator prompt (called from `/rihal-feature-drift --mode=phase-status` per Phase 8 D-6 — extension flag, not new agent).
|
|
100
|
+
|
|
101
|
+
**Inputs:**
|
|
102
|
+
- `roadmap_phases[]` — array of phase entries from `roadmap list-phases`. Each: `{number, name, status, goal}`.
|
|
103
|
+
- `phase_dirs[]` — array of disk-state per phase. Each: `{number, dir, has_summary, has_sprint, has_plan, has_context, has_research, has_verification}`.
|
|
104
|
+
- `recent_commits[]` (optional) — most recent commit hash + ISO date for each phase's `${phase_dir}/` scope.
|
|
105
|
+
- Project root path so the auditor can read individual ROADMAP entries for acceptance-item details.
|
|
106
|
+
|
|
107
|
+
**Output: structured JSON** (not prose). Schema:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"drift": [
|
|
112
|
+
{
|
|
113
|
+
"id": "phase-status-drift-001",
|
|
114
|
+
"severity": "trivial|partial|major",
|
|
115
|
+
"phase_number": "6",
|
|
116
|
+
"claimed_status": "Complete|Active|Planned",
|
|
117
|
+
"shipping_signals": {
|
|
118
|
+
"has_summary": true,
|
|
119
|
+
"has_sprint": true,
|
|
120
|
+
"last_commit_iso": "2026-04-29",
|
|
121
|
+
"phase_dir_present": true
|
|
122
|
+
},
|
|
123
|
+
"evidence": "Phase 4 ROADMAP says 'Active (Sprint 04.2 in progress)' but git log shows sprint 04.2 commits + 4 post-sprint enhancements. SUMMARY.md absent (older convention), but shipping reality contradicts claim.",
|
|
124
|
+
"fix_hint": "Add ' ✅' to '## Phase 04 — Dashboard Refresh' heading. Update Status line to 'Complete (YYYY-MM-DD)'."
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Severity rules (HARD — enforced downstream by workflow code, but you must classify correctly):**
|
|
131
|
+
|
|
132
|
+
- `trivial` — claim is right in spirit, but cosmetic markers are missing. Examples:
|
|
133
|
+
- Status: Complete but no `✅` on the heading
|
|
134
|
+
- Status: Complete with no date in parentheses
|
|
135
|
+
- `fix_hint` MUST carry the exact ROADMAP edit (insertion point + literal string).
|
|
136
|
+
- `partial` — N of M acceptance items shipped per the ROADMAP entry's "Acceptance:" line. Status under-represents partial completion (Phase 5 case from the 2026-04-29 session). `fix_hint` is `null` — only a human can decide whether to flip status or update the acceptance bullets.
|
|
137
|
+
- `major` — claim is entirely wrong. Examples:
|
|
138
|
+
- Status: Complete but NO `*-SUMMARY.md` AND NO commits on phase scope (the claim is a lie)
|
|
139
|
+
- Status: Planned but all acceptance items are shipped per git log (Phase 4 case from the 2026-04-29 session)
|
|
140
|
+
- Status references a sprint number that doesn't exist
|
|
141
|
+
- `fix_hint` is `null`.
|
|
142
|
+
|
|
143
|
+
**Never:**
|
|
144
|
+
- Auto-flip Active→Complete or Planned→Complete in `fix_hint` — those are decisions, not corrections. Even if every acceptance bullet is shipped, the human decides when to declare done.
|
|
145
|
+
- Treat absence of SUMMARY.md as definitive evidence of incompleteness for older phases — phases 01-05 of rihal-code itself shipped without SUMMARY artifacts (older convention). Use commit-log + sprint-presence as primary signals.
|
|
146
|
+
- Compare against `state.json` directly — `state.json` is itself often drifted. ROADMAP.md is the source of truth for claimed status.
|
|
147
|
+
- Return prose narrative — the workflow parses your JSON. Narrative output is treated as a malfunction.
|
|
148
|
+
</mode_phase_status>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Git Preflight Contract
|
|
2
|
+
|
|
3
|
+
Shared reference `@`-included by every code-touching workflow. Designed by Khalid (DevOps) to close #659.
|
|
4
|
+
|
|
5
|
+
## When this runs
|
|
6
|
+
|
|
7
|
+
Before ANY workflow step that will modify files in the working tree — i.e. before `/rihal-execute`, `/rihal-quick`, `/rihal-dev-story`, `/rihal-code-review-fix`, and any other workflow that writes outside `.planning/`.
|
|
8
|
+
|
|
9
|
+
## The 4 checks
|
|
10
|
+
|
|
11
|
+
Run these read-only commands in order. Any failure halts the workflow with the failure banner below.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Check 1: working tree clean
|
|
15
|
+
DIRTY=$(git status --porcelain 2>/dev/null)
|
|
16
|
+
|
|
17
|
+
# Check 2: not on a protected branch
|
|
18
|
+
BRANCH=$(git branch --show-current 2>/dev/null)
|
|
19
|
+
PROTECTED="main master develop v2-prototype"
|
|
20
|
+
|
|
21
|
+
# Check 3: branch follows naming convention
|
|
22
|
+
# Allowed: feat/foo-bar, fix/123-baz, issue-123-name, task-123-slug
|
|
23
|
+
BRANCH_OK=$(echo "$BRANCH" | grep -qE '^((feat|fix|docs|chore|refactor|test|perf|style|build|ci)/[a-z0-9][a-z0-9-]*|(issue|task)-[0-9]+-[a-z0-9-]+)$' && echo yes || echo no)
|
|
24
|
+
|
|
25
|
+
# Check 4: scope drift — files touched that don't belong to the active task
|
|
26
|
+
# The workflow MUST pass $TASK_SCOPE_GLOB (e.g. ".planning/phases/8-*/" or "src/auth/")
|
|
27
|
+
# If the workflow can't compute scope, skip this check rather than fail closed.
|
|
28
|
+
if [ -n "$TASK_SCOPE_GLOB" ]; then
|
|
29
|
+
OUT_OF_SCOPE=$(git diff --name-only HEAD 2>/dev/null | grep -vE "$TASK_SCOPE_GLOB" | head -10)
|
|
30
|
+
fi
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Failure conditions
|
|
34
|
+
|
|
35
|
+
The workflow MUST stop and print the banner below if ANY of:
|
|
36
|
+
|
|
37
|
+
- `DIRTY` is non-empty AND user did not pass `--allow-dirty`
|
|
38
|
+
- `BRANCH` is in `$PROTECTED` AND user did not pass `--on-main`
|
|
39
|
+
- `BRANCH_OK` is `no` AND user did not pass `--allow-dirty` (branch-name lint is advisory if working tree is dirty AND user accepted the dirty override)
|
|
40
|
+
- `OUT_OF_SCOPE` is non-empty AND user did not pass `--allow-scope-drift`
|
|
41
|
+
|
|
42
|
+
## Failure UX (banner)
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Khalid (خالد) — DevOps preflight
|
|
46
|
+
|
|
47
|
+
Cannot start {workflow_name}. Git state is unsafe.
|
|
48
|
+
|
|
49
|
+
Branch: {BRANCH} {protected? "(protected)" : ""}
|
|
50
|
+
Working tree: {dirty/clean} {N modified, M untracked if dirty}
|
|
51
|
+
Branch name: {BRANCH_OK ? "ok" : "doesn't match convention"}
|
|
52
|
+
Scope drift: {N files outside task scope}
|
|
53
|
+
|
|
54
|
+
{if dirty: list up to 5 modified files}
|
|
55
|
+
{if scope drift: list up to 5 out-of-scope files}
|
|
56
|
+
|
|
57
|
+
Fix path:
|
|
58
|
+
1. git checkout -b fix/<issue-num>-<short-slug>
|
|
59
|
+
2. git add <files> ; git commit -m "fix(scope): subject (#<issue>)"
|
|
60
|
+
3. Re-run /{workflow_name}
|
|
61
|
+
|
|
62
|
+
Override (last resort, only if you understand the trade-off):
|
|
63
|
+
/{workflow_name} {args} --allow-dirty # skip working-tree check
|
|
64
|
+
/{workflow_name} {args} --on-main # skip protected-branch check
|
|
65
|
+
/{workflow_name} {args} --allow-scope-drift # skip scope-drift check
|
|
66
|
+
|
|
67
|
+
▶ Next Up
|
|
68
|
+
Clean the tree or branch, then resume. Khalid does not gate hotfixes —
|
|
69
|
+
if this is a true emergency, --on-main is the right answer.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Post-task commit prompt
|
|
73
|
+
|
|
74
|
+
After the workflow's code-modifying work completes, BEFORE returning control to the user, prompt for a commit:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
Khalid — commit checkpoint
|
|
78
|
+
|
|
79
|
+
Modified files (staged or unstaged):
|
|
80
|
+
[list git status --short output, grouped by logical unit if possible]
|
|
81
|
+
|
|
82
|
+
A commit is required before this workflow can be considered done.
|
|
83
|
+
|
|
84
|
+
GH issue link required per AGENTS.md. What issue does this work close?
|
|
85
|
+
Issue # (digits only, or "none" if this is exploratory): ___
|
|
86
|
+
|
|
87
|
+
Suggested commit (Conventional Commits):
|
|
88
|
+
{type}({scope}): {subject} (#{issue})
|
|
89
|
+
|
|
90
|
+
{body — optional, explain WHY}
|
|
91
|
+
|
|
92
|
+
Run `git add <files> && git commit` with the message above, or edit before
|
|
93
|
+
running. AGENTS.md forbids --no-verify; if a hook fails, fix the underlying
|
|
94
|
+
cause.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The hook only stages and commits. **It does NOT push.** Push always requires fresh user consent per `.rihal/references/no-unauthorized-git-ops.md`.
|
|
98
|
+
|
|
99
|
+
## Override flag semantics
|
|
100
|
+
|
|
101
|
+
| Flag | Skips | When valid |
|
|
102
|
+
|------|-------|------------|
|
|
103
|
+
| `--allow-dirty` | working-tree clean check | resuming a partial in-progress task, or amending a WIP commit |
|
|
104
|
+
| `--on-main` | protected-branch check | true hotfix where the user accepts the risk; CI / release flows |
|
|
105
|
+
| `--allow-scope-drift` | scope drift check | refactor that legitimately spans phases; cross-cutting cleanup |
|
|
106
|
+
|
|
107
|
+
Each flag is independent. The user must pass exactly the override they need; the workflow MUST NOT auto-promote one override into another.
|
|
108
|
+
|
|
109
|
+
## What this does NOT do
|
|
110
|
+
|
|
111
|
+
- Does not run `git fetch` / `git pull` — those are remote operations and need explicit consent (see `no-unauthorized-git-ops.md`).
|
|
112
|
+
- Does not create branches automatically. The failure banner *suggests* the branch name; the user runs the command.
|
|
113
|
+
- Does not block read-only workflows (`/rihal-status`, `/rihal-discuss`, `/rihal-council`, etc.).
|
|
114
|
+
|
|
115
|
+
## Why a shared reference
|
|
116
|
+
|
|
117
|
+
Same shape as `no-unauthorized-git-ops.md`: a pre-condition contract that every workflow includes by `@`-reference. Single source of truth — when the policy changes, exactly one file changes and every code-touching workflow inherits the update.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Iterative Retrieval — Bounded Research Loop
|
|
2
|
+
|
|
3
|
+
The contract a research-spawning workflow follows when dispatching a research
|
|
4
|
+
subagent and handling its return. Designed to be `@`-included by any workflow
|
|
5
|
+
that spawns a research subagent (`rihal-phase-researcher`,
|
|
6
|
+
`rihal-project-researcher`, `rihal-research-synthesizer`,
|
|
7
|
+
`rihal-codebase-mapper`).
|
|
8
|
+
|
|
9
|
+
Goal: research subagents get a follow-up gate, the same way executors get a
|
|
10
|
+
verifier gate. A single research dispatch may return a shallow or partial
|
|
11
|
+
result; this loop re-queries it — bounded — until the result is sufficient
|
|
12
|
+
against the original objective.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 1. Initial dispatch — pass the broader objective
|
|
17
|
+
|
|
18
|
+
The orchestrator MUST pass the broader **objective** into the subagent prompt,
|
|
19
|
+
not just the literal query. The subagent needs to know *why* the research
|
|
20
|
+
matters and *what its output must enable downstream* — otherwise it optimizes
|
|
21
|
+
for the narrow question and misses what the consumer actually needs.
|
|
22
|
+
|
|
23
|
+
Include an `<objective>` block of this shape in the dispatch prompt:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
<objective>
|
|
27
|
+
{literal research query — the specific thing to find out}
|
|
28
|
+
|
|
29
|
+
Why this matters: {the broader phase/project goal this research serves}
|
|
30
|
+
Downstream consumer: {what planning/requirements/roadmap step uses this
|
|
31
|
+
result, and what a sufficient result must let that step do}
|
|
32
|
+
</objective>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The literal query stays; the objective frames it.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 2. Sufficiency evaluation — on return
|
|
40
|
+
|
|
41
|
+
After the subagent returns its `## RESEARCH COMPLETE` summary, the orchestrator
|
|
42
|
+
evaluates the result against the Step-1 objective **before** routing onward.
|
|
43
|
+
The result is **insufficient** if any of these hold:
|
|
44
|
+
|
|
45
|
+
- **Coverage gap** — the result does not address every dimension the objective
|
|
46
|
+
asked for (a missing dimension, an unanswered sub-question).
|
|
47
|
+
- **Vague recommendations** — recommendations lack specifics: no versions, no
|
|
48
|
+
rationale, "consider X or Y" menus instead of "use X because Y".
|
|
49
|
+
- **Blocked signal** — the subagent returned `## RESEARCH INCONCLUSIVE`, a
|
|
50
|
+
structured blocked message, or flagged a dimension it could not resolve.
|
|
51
|
+
|
|
52
|
+
If none hold, the result is sufficient — proceed with normal routing.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 3. Re-dispatch — same subagent, named gaps
|
|
57
|
+
|
|
58
|
+
If insufficient, re-spawn the **SAME** `subagent_type` with a follow-up prompt
|
|
59
|
+
that:
|
|
60
|
+
|
|
61
|
+
- names the **specific gaps** found in Section 2 (which dimension, which
|
|
62
|
+
vague recommendation, which blocked signal),
|
|
63
|
+
- includes the **prior result** so the subagent does not redo finished work,
|
|
64
|
+
- asks **only for the missing pieces** — not a full re-research.
|
|
65
|
+
|
|
66
|
+
The follow-up dispatch carries the same `<objective>` block from Step 1.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 4. Hard cap — maximum 3 cycles
|
|
71
|
+
|
|
72
|
+
The loop is hard-capped at **3 cycles**: the initial dispatch plus at most 2
|
|
73
|
+
follow-up re-dispatches. After cycle 3, the orchestrator accepts the best
|
|
74
|
+
result obtained, records the residual gaps in the research artifact (a
|
|
75
|
+
`## Residual Gaps` note or equivalent), and proceeds. **Never loop unbounded** —
|
|
76
|
+
3 cycles is the ceiling regardless of remaining gaps.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 5. Out of scope — executors
|
|
81
|
+
|
|
82
|
+
This loop applies to **research subagents only**. It does **not** apply to
|
|
83
|
+
executor subagents — the executor checkpoint/verifier flow is unchanged. Do
|
|
84
|
+
not re-dispatch an executor based on a sufficiency evaluation; executors have
|
|
85
|
+
their own checkpoint and verifier gates.
|