@hanzlaa/rcode 3.4.33 → 3.6.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 (106) hide show
  1. package/AGENTS.md +6 -6
  2. package/CONTRIBUTING.md +2 -0
  3. package/LICENSE +21 -0
  4. package/README.md +66 -403
  5. package/cli/doctor.js +87 -1
  6. package/cli/install.js +122 -31
  7. package/cli/lib/schemas.cjs +318 -0
  8. package/cli/postinstall.js +19 -3
  9. package/dist/rcode.js +316 -23
  10. package/package.json +14 -4
  11. package/rihal/agents/rihal-cross-platform-auditor.md +1 -1
  12. package/rihal/agents/rihal-dep-auditor.md +1 -1
  13. package/rihal/agents/rihal-docs-auditor.md +3 -145
  14. package/rihal/agents/rihal-i18n-auditor.md +1 -1
  15. package/rihal/agents/rihal-nyquist-auditor.md +4 -156
  16. package/rihal/agents/rihal-observability-auditor.md +1 -1
  17. package/rihal/bin/rihal-hooks.cjs +394 -4
  18. package/rihal/bin/rihal-tools.cjs +891 -24
  19. package/rihal/commands/create-prd.md +18 -0
  20. package/rihal/commands/execute-milestone.md +18 -0
  21. package/rihal/commands/plan-milestone.md +18 -0
  22. package/rihal/commands/scaffold-milestone.md +18 -0
  23. package/rihal/commands/scaffold-skill.md +18 -0
  24. package/rihal/references/REFERENCES_INDEX.md +49 -7
  25. package/rihal/references/agent-contracts.md +10 -0
  26. package/rihal/references/design-tokens.md +98 -0
  27. package/rihal/references/docs-auditor-playbook.md +148 -0
  28. package/rihal/references/git-preflight.md +117 -0
  29. package/rihal/references/iterative-retrieval.md +85 -0
  30. package/rihal/references/nyquist-auditor-playbook.md +157 -0
  31. package/rihal/references/workstream-flag.md +2 -2
  32. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +9 -0
  33. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +9 -0
  34. package/rihal/skills/actions/4-implementation/rihal-ci/SKILL.md +4 -0
  35. package/rihal/skills/actions/4-implementation/rihal-code-review/steps/step-02-review.md +2 -2
  36. package/rihal/skills/actions/4-implementation/rihal-harden/SKILL.md +4 -0
  37. package/rihal/skills/actions/4-implementation/rihal-migrate/SKILL.md +4 -0
  38. package/rihal/skills/agents/haitham-frontend/SKILL.md +2 -0
  39. package/rihal/templates/settings-hooks.json +39 -0
  40. package/rihal/workflows/check-todos.md +4 -0
  41. package/rihal/workflows/code-review-fix.md +4 -3
  42. package/rihal/workflows/code-review.md +1 -1
  43. package/rihal/workflows/debug.md +1 -1
  44. package/rihal/workflows/dev-story.md +4 -0
  45. package/rihal/workflows/diff.md +2 -2
  46. package/rihal/workflows/do.md +16 -8
  47. package/rihal/workflows/docs-update.md +2 -2
  48. package/rihal/workflows/enable-hooks.md +6 -1
  49. package/rihal/workflows/execute-milestone.md +139 -0
  50. package/rihal/workflows/execute-regression-gates.md +1 -1
  51. package/rihal/workflows/execute-sprint.md +54 -2
  52. package/rihal/workflows/execute-verify-phase-goal.md +31 -4
  53. package/rihal/workflows/execute-waves.md +33 -5
  54. package/rihal/workflows/execute.md +40 -6
  55. package/rihal/workflows/help.md +1 -1
  56. package/rihal/workflows/import.md +1 -1
  57. package/rihal/workflows/lens-audit.md +39 -23
  58. package/rihal/workflows/list-workspaces.md +1 -1
  59. package/rihal/workflows/map-codebase.md +4 -4
  60. package/rihal/workflows/new-milestone.md +18 -1
  61. package/rihal/workflows/new-project-research.md +53 -1
  62. package/rihal/workflows/new-workspace.md +1 -1
  63. package/rihal/workflows/plan-milestone.md +105 -0
  64. package/rihal/workflows/plan-research-validation.md +1 -1
  65. package/rihal/workflows/plan-spawn-planner.md +1 -1
  66. package/rihal/workflows/plan.md +31 -3
  67. package/rihal/workflows/plant-seed.md +6 -0
  68. package/rihal/workflows/quick.md +11 -5
  69. package/rihal/workflows/research-phase.md +24 -0
  70. package/rihal/workflows/scaffold-milestone.md +60 -0
  71. package/rihal/workflows/scaffold-skill.md +137 -0
  72. package/rihal/workflows/scan.md +1 -1
  73. package/rihal/workflows/session-report.md +43 -3
  74. package/rihal/workflows/verify-work.md +3 -3
  75. package/server/dashboard.js +154 -5
  76. package/server/lib/html/client/agents-data.js +27 -0
  77. package/server/lib/html/client/app.js +15 -0
  78. package/server/lib/html/client/components/App.js +211 -0
  79. package/server/lib/html/client/components/OrchPanel.js +293 -0
  80. package/server/lib/html/client/components/Sidebar.js +73 -0
  81. package/server/lib/html/client/components/Topbar.js +53 -0
  82. package/server/lib/html/client/components/XtermPanel.js +220 -0
  83. package/server/lib/html/client/components/shared.js +330 -0
  84. package/server/lib/html/client/icons-client.js +85 -0
  85. package/server/lib/html/client/orchestrator.js +279 -0
  86. package/server/lib/html/client/preact.js +34 -0
  87. package/server/lib/html/client/store.js +91 -0
  88. package/server/lib/html/client/util.js +186 -0
  89. package/server/lib/html/client/views/AgentsView.js +83 -0
  90. package/server/lib/html/client/views/DecisionsView.js +102 -0
  91. package/server/lib/html/client/views/FilesView.js +223 -0
  92. package/server/lib/html/client/views/KanbanView.js +236 -0
  93. package/server/lib/html/client/views/MemoryView.js +157 -0
  94. package/server/lib/html/client/views/MilestonesView.js +136 -0
  95. package/server/lib/html/client/views/OrchestrationView.js +167 -0
  96. package/server/lib/html/client/views/OverviewView.js +221 -0
  97. package/server/lib/html/client/views/PhasesView.js +184 -0
  98. package/server/lib/html/client/views/RoadmapView.js +238 -0
  99. package/server/lib/html/client/views/SprintsView.js +178 -0
  100. package/server/lib/html/client/views/TasksView.js +148 -0
  101. package/server/lib/html/client.js +42 -1064
  102. package/server/lib/html/css.js +2266 -466
  103. package/server/lib/html/icons.js +68 -0
  104. package/server/lib/html/shell.js +16 -210
  105. package/server/lib/scanner.js +109 -0
  106. package/server/orchestrator.js +362 -0
package/AGENTS.md CHANGED
@@ -24,7 +24,7 @@ If a user says "just keep going" or "don't stop until done", that authorization
24
24
 
25
25
  - Follow [Conventional Commits](https://www.conventionalcommits.org/) format: `type(scope): subject`
26
26
  - Types allowed: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`, `perf`, `revert`
27
- - Scopes allowed: `agents`, `skills`, `workflows`, `templates`, `dashboard`, `docs`, `config`, `github`, `commands`, `memory`, `brand`, `cli`, `ci`, `release`, `meta`, `tasks`, `migrations`, `refs`, `state`, `hooks`, `install`, `parity`, `triggers`, `dogfood`, `namespace`, `planning`, `insights`, `help`, `roadmap`, `session`, `audits`, `execute`, `executor`, `plan`, `planner`, `readme`, `sync`, `sprint`, `agent-exp`, `extensibility`, `lens-audit`, `tiers`, `build`, `council`, `doctor`, `postinstall`, `progress`, `security`, `tools`, `uninstall`, `update`, `test`, `changelog`, `scopes`, `phases`, `references`, plus numeric phase/sprint scopes (e.g. `docs(15)`, `feat(8.3)`)
27
+ - Scopes allowed: `agents`, `skills`, `workflows`, `templates`, `dashboard`, `docs`, `config`, `github`, `commands`, `memory`, `brand`, `cli`, `ci`, `release`, `meta`, `tasks`, `migrations`, `refs`, `state`, `hooks`, `install`, `parity`, `triggers`, `dogfood`, `namespace`, `planning`, `insights`, `help`, `roadmap`, `session`, `audits`, `execute`, `executor`, `plan`, `planner`, `readme`, `sync`, `sprint`, `agent-exp`, `extensibility`, `lens-audit`, `tiers`, `build`, `council`, `doctor`, `postinstall`, `progress`, `security`, `tools`, `uninstall`, `update`, `test`, `changelog`, `scopes`, `phases`, `references`, `kanban`, `orchestrator`, plus numeric phase/sprint scopes (e.g. `docs(15)`, `feat(8.3)`)
28
28
  - Subject: lowercase first letter, imperative mood, no trailing period, under 72 chars
29
29
  - **NEVER add Claude/AI attribution to commit messages.** No "Generated with Claude Code", no "Co-Authored-By: Claude", no "🤖 Generated". The user does not want this.
30
30
  - **NEVER use `--no-verify`** to bypass hooks. If hooks fail, fix the underlying issue.
@@ -77,12 +77,12 @@ If a user says "just keep going" or "don't stop until done", that authorization
77
77
 
78
78
  ## Testing Rules
79
79
 
80
- - Run the compliance check after modifying any skill:
80
+ - Run schema validation after modifying any skill or agent — it enforces the
81
+ 5-component skill standard (frontmatter, trigger phrases, negative boundary)
82
+ in place of the old grep-based check:
81
83
  ```bash
82
- for f in rihal/skills/agents/*/SKILL.md rihal/skills/actions/*/SKILL.md; do
83
- grep -q "^## Output Format" "$f" || echo "MISSING: $f"
84
- grep -q "^## Examples" "$f" || echo "MISSING: $f"
85
- done
84
+ node cli/doctor.js # full preflight + compliance
85
+ node --test test/artifact-schema.test.cjs # schema validators only
86
86
  ```
87
87
  - Run grep checks before committing renames or refactors:
88
88
  ```bash
package/CONTRIBUTING.md CHANGED
@@ -329,6 +329,8 @@ We use [Conventional Commits](https://www.conventionalcommits.org/) format. The
329
329
  - `scopes` — AGENTS.md / CONTRIBUTING.md scope-list maintenance
330
330
  - `phases` — `.planning/phases/` artifacts (SPRINT.md, SUMMARY.md, VERIFICATION.md)
331
331
  - `references` — files inside `rihal/references/` (extracting agent playbooks to references)
332
+ - `kanban` — `/rihal-kanban` orchestration board workflow and surfaces
333
+ - `orchestrator` — orchestrator panel, SSE streaming, session persistence
332
334
  - `<phase-id>` — numeric phase scope when committing inside a phase (e.g. `docs(15)`, `feat(8.3)`)
333
335
  - `<sprint-id>` — numeric sprint scope inside a phase (e.g. `feat(15.1)`)
334
336
 
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hanzla Habib
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div dir="rtl">طريقة رحال</div>
4
4
 
5
- > **The AI team that never forgets.** Persistent memory, 45 specialist agents, 95 commands — install once, and your AI IDE gets a project brain that survives every session reset.
5
+ > **The AI team that never forgets.** Persistent memory, 45 specialist agents, 109 commands — install once, and your AI IDE gets a project brain that survives every session reset.
6
6
 
7
7
  ```bash
8
8
  npx @hanzlaa/rcode install # one command, zero dependencies
@@ -11,99 +11,63 @@ npx @hanzlaa/rcode install # one command, zero dependencies
11
11
  [![npm version](https://img.shields.io/npm/v/@hanzlaa/rcode)](https://www.npmjs.com/package/@hanzlaa/rcode)
12
12
  [![downloads](https://img.shields.io/npm/dw/@hanzlaa/rcode)](https://www.npmjs.com/package/@hanzlaa/rcode)
13
13
 
14
- **Quick look:** `npx @hanzlaa/rcode install` `/rihal-council` `/rihal-plan 1` `/rihal-execute 1` that's the full loop in three commands.
14
+ Status: actively developed published on npm as `@hanzlaa/rcode` v3.5.x, with an automated test suite covered by `node --test`.
15
15
 
16
16
  ---
17
17
 
18
- ## Who is rcode for
18
+ ## See it work
19
19
 
20
- You'll feel rcode pay off if you've lived any of these:
21
-
22
- - **AI agents lose context mid-project.** Three sessions in, the assistant has forgotten the architectural decision you made on day one.
23
- - **Onboarding a teammate** means a 30-minute archaeology dig through Slack, Notion, and review comments to explain "why we did it this way".
24
- - **Late client requirements** keep shifting the goal posts, and there's no record of what was decided when.
25
- - **MVPs that work but can't be revamped** without rewriting from scratch — the original context is lost.
26
-
27
- rcode addresses these with a checked-in **Memory Bank** (`.rihal/memory/`), distinctive engineering personas, and a phased workflow that survives session resets. **For everything in one place, read [`DOCS.md`](DOCS.md).** See [`MEMORY_BANK.md`](MEMORY_BANK.md) for the spec, and [`BRAND.md`](BRAND.md) for naming and voice conventions.
20
+ The full loop runs in three commands `/rihal-council` `/rihal-plan` → `/rihal-execute`. The Diwan dashboard (`npm run dashboard`) renders project state, decisions, and the Memory Bank in one view.
28
21
 
29
22
  ---
30
23
 
31
24
  ## Why this exists
32
25
 
33
- Every project carries unwritten context — how the team reviews PRs, what "done" means, how milestones sequence, how PRDs travel from Product into Engineering. That context sits in people's heads, Slack, Notion, and senior engineers' review comments. AI assistants pick it up never, because every new chat session starts knowing nothing about how this project actually works.
26
+ Every project carries unwritten context — how the team reviews PRs, what "done" means, how milestones sequence. That context sits in people's heads, Slack, and senior engineers' review comments. AI assistants pick it up never, because every new chat session starts knowing nothing about how this project actually works.
34
27
 
35
- **rcode fixes that.** One install, and the AI knows. Every session. Every repo. Every contributor.
36
-
37
- ---
38
-
39
- ## 🚦 Start Here
40
-
41
- Rihal Code packages a lot. To keep things approachable, everything is organized into **four tiers**:
28
+ You'll feel rcode pay off if you've lived any of these:
42
29
 
43
- | Tier | Who it's for | Start with |
44
- |------|--------------|-----------|
45
- | 🌱 **[Starter](docs/TIERS.md#-starter--the-golden-path)** | First-time Rihalian | 7 skills the Golden Path |
46
- | 🌿 **[Advanced](docs/TIERS.md#-advanced--real-sprint-team)** | Teams running sprints | PRD variants, architecture, UX, QA |
47
- | 🌳 **[Ultra Advanced](docs/TIERS.md#-ultra-advanced--power-user-workflows)** | Power users | Multi-agent council, dashboard, clone-website |
48
- | 📐 **[Standards](docs/STANDARDS.md)** | Contributors | Skill spec, commit rules, PR checklist |
30
+ - **AI agents lose context mid-project.** Three sessions in, the assistant has forgotten the architectural decision you made on day one.
31
+ - **Onboarding a teammate** means a 30-minute archaeology dig through Slack, Notion, and review comments.
32
+ - **Late client requirements** keep shifting the goal posts, with no record of what was decided when.
33
+ - **MVPs that work but can't be revamped** without rewriting from scratch the original context is lost.
49
34
 
50
- **Brand new?** Do the [Golden Path](docs/TIERS.md#-starter--the-golden-path): scaffold PRD stories sprint dev review status. Seven skills, one project, end-to-end.
35
+ rcode fixes that with a checked-in **Memory Bank** (`.rihal/memory/`), distinctive engineering personas, and a phased workflow that survives session resets. One install, and the AI knows. Every session. Every repo. Every contributor.
51
36
 
52
- > **v3 — Rihal Brain.** v1 was a generic AI-engineering methodology. v2 added the Rihal context layer. v3 ships it as a single npm package with a Memory Bank, live dashboard, and 134 automated tests. See [`CHANGELOG.md`](CHANGELOG.md).
37
+ It's not a chatbot. It's a methodology.
53
38
 
54
39
  ---
55
40
 
56
- ## What is this
57
-
58
- Most AI tools give you one assistant pretending to be everything. **Rihal Code gives you Rihal's team — and Rihal's brain — inside every project.**
59
-
60
- - **44 agents** with clear roles, cultural identity (Arabic names), and hard scope boundaries
61
- - **96 slash commands** covering research, planning, execution, verification, and recovery
62
- - **105 skills** including Memory Bank primitives, 11 engineering-rigor skills (TDD, harden, perf, debug, trim, etc.), and 8 real-pain skills (auth-audit, mvp-graduate, deploy-unify, etc.)
63
- - **102 workflows** — the execution backbone behind every slash command
64
- - **Persistent project memory** at `.rihal/memory/` — checked into git, visible in the Diwan dashboard, lossless distillates for fast LLM hydration
65
- - **3 execution modes**: parallel debate (`/rihal-council`), sequential pipelines (`/rihal-chain`), and quick-sync (`/rihal-discuss`)
66
- - **File-based state** in `.rihal/` that every workflow reads and updates
67
- - **Intent guards** on every workflow — catch wrong commands early with copy-paste redirects
68
- - **Karpathy-inspired coding guidelines** wired into every code-writing agent
69
- - **Numeric ID system** (M1 milestones, NN phases, NN.M plans, NN.M.T tasks, with decimal insertion for urgent work)
70
- - **Plan verification loop** that validates file/symbol references before execution
71
- - **Post-execute gates** (integration-checker, nyquist-auditor) verify completeness
72
- - **Global agents** at `~/.rihal/agents/` — customize without forking
73
-
74
- See [`MIGRATIONS.md`](MIGRATIONS.md) if you're upgrading from a pre-Memory-Bank install.
41
+ ## Quickstart
75
42
 
76
- It's not a chatbot. It's a methodology.
77
-
78
- ---
43
+ ### Install two steps, one minute
79
44
 
80
- ## Install one command
45
+ rcode ships in two parts. Run them both up front so nothing surfaces as an afterthought later:
81
46
 
82
- In any project directory (existing codebase OR empty folder):
47
+ **Step 1 — project files (required).** In any project directory (existing codebase OR empty folder):
83
48
 
84
49
  ```bash
85
50
  npx @hanzlaa/rcode install
86
51
  ```
87
52
 
88
- [Live on npm](https://www.npmjs.com/package/@hanzlaa/rcode) as `@hanzlaa/rcode`. See [`docs/install.md`](docs/install.md) for flavors (module subsets, IDE options, version pinning, yolo mode).
53
+ **Step 2 — `rcode` on your PATH (optional).** For the `rcode` CLI command (e.g. `rcode version`, `rcode update`), install globally once:
89
54
 
90
- One unified installer. Pure file shipping, no runtime dependencies. Installs into:
55
+ ```bash
56
+ npm install -g @hanzlaa/rcode
57
+ ```
58
+
59
+ [Live on npm](https://www.npmjs.com/package/@hanzlaa/rcode) as `@hanzlaa/rcode`. Pure file shipping, no runtime dependencies. Step 1 installs into:
91
60
 
92
61
  - `.rihal/` — config, workflows, references, bin (Rihal infrastructure)
93
62
  - `.claude/agents/` — 45 first-class subagents
94
- - `.claude/commands/rihal/` — 95 slash commands
95
- - `.claude/skills/` — 105 phrase-activated skills (scaffold-project, create-prd, prfaq, memory-init, retrospective, etc.)
96
- - `rihal/brain/` — Rihal standards pulled from upstream (PR / commit / architecture docs)
97
- - `.planning/` — where your artifacts land (council sessions, plans, chains, summaries)
63
+ - `.claude/commands/rihal/` — 109 slash commands
64
+ - `.claude/skills/` — 85 phrase-activated skills
65
+ - `rihal/brain/` — Rihal standards pulled from upstream
66
+ - `.planning/` — where your artifacts land
98
67
 
99
- Restart Claude Code (or your IDE), type `/`, and every `rihal-*` command appears.
68
+ Restart Claude Code (or your IDE), type `/`, and every `rihal-*` command appears. Update anytime with `npx @hanzlaa/rcode update`.
100
69
 
101
- Update anytime with `npx @hanzlaa/rcode update` (or `/rihal-update` inside a Claude session).
102
-
103
- > **Want `rcode` on your PATH?** `npx @hanzlaa/rcode install` sets up the project files but doesn't put `rcode` in your shell. For the `rcode` CLI command (e.g. `rcode version`, `rcode update`), install globally once:
104
- > ```bash
105
- > npm install -g @hanzlaa/rcode
106
- > ```
70
+ See [`docs/install.md`](docs/install.md) for flavors (module subsets, IDE options, version pinning, yolo mode).
107
71
 
108
72
  ### Then begin the rihla
109
73
 
@@ -111,138 +75,41 @@ Update anytime with `npx @hanzlaa/rcode update` (or `/rihal-update` inside a Cla
111
75
  /rihal-init
112
76
  ```
113
77
 
114
- Detects your project state (fresh / existing-with-no-rihal / returning), asks a few configuration questions, and routes you to the right first action.
115
-
116
- ### Install a specific module
117
-
118
- ```bash
119
- npx @hanzlaa/rcode install --module core # council + quick-sync only
120
- npx @hanzlaa/rcode install --module execution --force
121
- npx @hanzlaa/rcode install --module discovery --force
122
- ```
123
-
124
- ### Multi-IDE support
125
-
126
- ```bash
127
- npx @hanzlaa/rcode install --ide claude # default
128
- npx @hanzlaa/rcode install --ide cursor
129
- npx @hanzlaa/rcode install --ide gemini
130
- ```
131
-
132
- ---
78
+ `/rihal-init` is the single first command — there is no other entry point to choose. It detects your project state (fresh / existing-with-no-rihal / returning), asks a few configuration questions, and routes you to the right first action. For a greenfield project it routes into `/rihal-new-project` automatically — you never call that directly, it's a sub-path of `/rihal-init`.
133
79
 
134
- ## 90-second tour
80
+ ### The full loop
135
81
 
136
82
  ```
137
- /rihal-do → interactive router
138
83
  /rihal-council should I rewrite auth? → 5 agents debate in parallel, 2 rounds
139
- /rihal-discuss waleed what stack for saas? → single expert, fast
140
- /rihal-chain research-plan dubai affiliate → Mariam → Hussain-PM → Planner pipeline
141
84
  /rihal-plan --research build a rental app → researcher grounds, plan-checker verifies
142
85
  /rihal-execute .planning/plans/01/PLAN.md → atomic commits + post-gates
143
86
  /rihal-status → phases, decisions, blockers, sessions
144
- /rihal-code-review HEAD~5..HEAD --karpathy → audit changes vs 4 coding principles
145
- ```
146
-
147
- ---
148
-
149
- ## Filesystem layout
150
-
151
- **System-owned directories (do not edit):**
152
-
153
87
  ```
154
- .rihal/ — Rihal infrastructure + state
155
- config.yaml — preferences (model, language, mode, branching)
156
- state.json — project phases, decisions, sessions, workstreams
157
- RIHLA.md — project journey baseline
158
- HANDOFF.json — pause-work context for resuming
159
- bin/
160
- rihal-tools.cjs — CLI helper (state read/write, panel scoring, etc.)
161
- lib/council-panel.cjs — deterministic panel scorer
162
- workflows/ — 102 slash command workflows
163
- references/ — shared contracts (council-protocol, gates, karpathy-guidelines, etc.)
164
- agents-rules/ — lazy-loaded agent rule files (planner, executor, debugger)
165
- ```
166
-
167
- **Your artifacts (created automatically):**
168
-
169
- ```
170
- .planning/ — your work outputs
171
- phases/01-name/PLAN.md — plans organized by phase number (01, 02, 02.1, etc.)
172
- council-sessions/ — debate artifacts
173
- chains/ — pipeline outputs (RESEARCH.md → SCOPE.md → PLAN.md)
174
- notes/ — quick notes from /rihal-note
175
- HANDOFF.json — pause-work checkpoint
176
- .continue-here.md — human-readable handoff summary
177
- ```
178
-
179
- ---
180
-
181
- ## The team
182
-
183
- **5 council agents** with cultural identity, each with hard scope boundaries and response-style contracts:
184
-
185
- | Agent | Role | Spawns for |
186
- |-------|------|-----------|
187
- | 🧭 **Sadiq (صادق)** | Director of Strategy | Priorities, kill criteria, market timing, "should we build this" |
188
- | 🏗️ **Waleed (وليد)** | CTO | Architecture, stack, feasibility, security, scale, tech debt |
189
- | 🛡️ **Fatima (فاطمة)** | QA Lead | Test strategy, release readiness, regression risk, coverage |
190
- | 📣 **Mariam (مريم)** | Marketing & Growth | Market research, GTM, positioning, GCC/MENA markets |
191
- | 📋 **Hussain-PM (حسين)** | Product Manager | Scope, roadmap, features, user stories, PRDs, sprint planning |
192
88
 
193
- **30+ specialist agents** for execution, discovery, and verification:
194
-
195
- - **Execution**: rihal-executor, rihal-planner, rihal-verifier, rihal-plan-checker, rihal-debugger
196
- - **Discovery**: rihal-codebase-mapper, rihal-project-researcher, rihal-roadmapper, rihal-phase-researcher, rihal-advisor-researcher, rihal-assumptions-analyzer, rihal-research-synthesizer
197
- - **Verification**: rihal-integration-checker, rihal-nyquist-auditor
198
- - **Quality**: rihal-noor, rihal-ux-designer, rihal-code-reviewer, rihal-code-fixer, rihal-edge-case-hunter, rihal-deviation-analyzer
199
- - **And more**: rihal-docs-auditor, rihal-doc-verifier, rihal-doc-writer, rihal-repo-metrics, rihal-security-auditor, etc.
200
-
201
- **Customize globally:** Define reusable agents in `~/.rihal/agents/rihal-<name>.md`. They appear in every project alongside project-local agents, without forking the repo.
89
+ **Brand new?** Do the [Golden Path](docs/TIERS.md#-starter--the-golden-path): scaffold → PRD → stories → sprint → dev → review → status. Seven skills, one project, end-to-end.
202
90
 
203
91
  ---
204
92
 
205
- ## Three modes, three mental models
206
-
207
- ### 🏛️ `/rihal-council` — Parallel debate
208
-
209
- 3-5 agents answer simultaneously in Round 1, then Round 2 lets each agent challenge the others' Round 1 responses. Result: one session artifact with all voices + orchestrator note flagging the sharpest disagreement.
210
-
211
- **Best for:** strategic decisions where you want disagreement, not consensus.
212
-
213
- ```
214
- /rihal-council should we migrate from monolith to microservices?
215
- ```
216
-
217
- ### 🔗 `/rihal-chain` — Sequential pipeline
218
-
219
- Each agent runs after the previous one finishes, reading that agent's artifact as input. Result: a typed artifact per stage (RESEARCH.md → SCOPE.md → PLAN.md) in `.planning/chains/`.
220
-
221
- **Best for:** when you know roughly what you want and each specialist needs to do their part in order.
222
-
223
- ```
224
- /rihal-chain research-plan dubai affiliate site for mobile accessories
225
- /rihal-chain feasibility migrate postgres to neon serverless
226
- /rihal-chain gtm-to-build saas bookkeeping in oman
227
- ```
228
-
229
- Presets: `research-plan` · `feasibility` · `gtm-to-build` · `full-discovery`. Or custom: `/rihal-chain mariam,waleed,fatima "your topic"`.
93
+ ## What makes Rihal different
230
94
 
231
- ### 💬 `/rihal-discuss`Single agent, quick-sync
95
+ Most AI tools give you one assistant pretending to be everything. **Rihal Code gives you Rihal's team and Rihal's brain — inside every project.**
232
96
 
233
- One agent, one round, conversational tone, no mandatory artifact. Feels like texting one colleague.
97
+ How it stacks up against the tools you already know:
234
98
 
235
- ```
236
- /rihal-discuss waleed can we use postgres jsonb for this?
237
- /rihal-discuss fatima is this release ready?
238
- /rihal-discuss what's the kill criterion for this project?
239
- ```
99
+ | Dimension | Cursor / Windsurf | CrewAI / AutoGen | **Rihal Code** |
100
+ |-----------|-------------------|------------------|----------------|
101
+ | Per-project memory | Per-user, not git-tracked | Requires a vector DB | Git-tracked markdown in `.rihal/memory/` |
102
+ | Specialist agents | 1 generalist with IDE context | Define your own in code | 45 shipped at install time |
103
+ | Workflow gates | None | Build your own | Structural — refuses to run without upstream |
104
+ | Infrastructure | Cloud API + local IDE | Python server + dependencies | Zero — pure files |
105
+ | IDE lock-in | Cursor only | Framework-specific | Claude, Cursor, Gemini, Codex |
106
+ | Install | IDE extension | `pip install` + config + code | `npx install` — one command |
240
107
 
241
- If no agent named, the panel scorer picks the top match.
108
+ Full breakdown: [`docs/USP.md`](docs/USP.md).
242
109
 
243
- ---
110
+ ### Persistent project memory
244
111
 
245
- ## What makes Rihal different
112
+ A checked-in **Memory Bank** at `.rihal/memory/` — visible in the Diwan dashboard, with lossless distillates for fast LLM hydration. A typical session loads ~5K tokens of Memory Bank and is fully oriented to the project's history, decisions, and known issues. See [`MEMORY_BANK.md`](MEMORY_BANK.md) for the spec.
246
113
 
247
114
  ### Intent guards catch wrong commands
248
115
 
@@ -251,236 +118,44 @@ Run the wrong command and you get a single-line copy-paste redirect — not a us
251
118
  ```
252
119
  /rihal-plan should we use postgres or mongo?
253
120
  ⚠ That's a decision question, not a planning input.
254
- Copy-paste this to ask the council instead:
255
121
  /rihal-council should we use postgres or mongo?
256
122
  ```
257
123
 
258
124
  Every workflow has a Step 0.5 intent detector.
259
125
 
260
- ### Multilingual Roman Urdu + Arabic + English
261
-
262
- The classifier recognizes `dubai`, `affiliate`, `bnanai`, `karobar`, `site banana`, `دبئی`, `مارکیٹ`, `کاروبار` and many more. Mariam leads for GCC/MENA market questions.
263
-
264
- ```
265
- /rihal-council yar affiliate site bnanai hai dubai ma for quick bucks
266
- → panel: [mariam, hussain-pm, sadiq]
267
- ```
126
+ ### Markdown-first agent design
268
127
 
269
- ### PRFAQvalidate before you build
128
+ Most agent frameworks wrap their logic in Python classes, JSON schemas, and orchestration layers. rcode doesn't. Every agent is a markdown file the model follows structured prose, no wrapper needed.
270
129
 
271
- Amazon's "Working Backwards" method: write the finished-product press release *before* writing a line of code. If you can't write a compelling press release, the product isn't ready. `/rihal-prfaq` runs a 5-stage coaching gauntlet — Ignition → Press Release → Customer FAQ → Internal FAQ → Verdict — and outputs a battle-hardened concept document plus a PRD distillate ready for `/rihal-create-prd`.
130
+ The design rule: **markdown owns the logic, scripts own the boundaries.** Heavy playbook content lives in `rihal/references/` and gets `@-include`d at spawn time, so agent files stay thin (≤100 lines) without losing context.
272
131
 
273
- **When to use it:** Any time a PM or engineer wants to validate whether an idea is worth building before committing sprint capacity. The skill challenges vague thinking, enforces customer-first framing, and gives a build/refine/kill verdict.
132
+ ### Three execution modes
274
133
 
275
- ```
276
- /rihal-prfaq interactive gauntlet
277
- /rihal-prfaq --headless --customer "..." --problem "..." --solution "..." → autonomous first draft
278
- ```
134
+ - **`/rihal-council`** — parallel debate: 3-5 agents answer simultaneously, then challenge each other in Round 2. For strategic decisions where you want disagreement, not consensus.
135
+ - **`/rihal-chain`** — sequential pipeline: each agent reads the previous one's artifact (RESEARCH.md SCOPE.md → PLAN.md).
136
+ - **`/rihal-discuss`** single agent, quick-sync: one expert, conversational, no mandatory artifact.
279
137
 
280
138
  ### Karpathy coding guidelines
281
139
 
282
- 4 behavioral principles from [Andrej Karpathy's observations on LLM coding pitfalls](https://github.com/forrestchang/andrej-karpathy-skills), wired into every code-writing agent as hard constraints:
140
+ 4 behavioral principles from [Andrej Karpathy's observations on LLM coding pitfalls](https://github.com/forrestchang/andrej-karpathy-skills), wired into every code-writing agent as hard constraints: think before coding, simplicity first, surgical changes, goal-driven execution. `/rihal-code-review --karpathy` runs them as a post-hoc audit against any diff.
283
141
 
284
- 1. **Think before coding** — surface assumptions, don't hide confusion
285
- 2. **Simplicity first** — minimum code, no speculative abstractions
286
- 3. **Surgical changes** — touch only what's needed, match existing style
287
- 4. **Goal-driven execution** — define verifiable success criteria
142
+ ### Verification built in
288
143
 
289
- `/rihal-code-review --karpathy` runs these 4 principles as a post-hoc audit against any diff or phase. Use it after implementation to catch bloated, over-engineered, or scope-creeping changes before they land in a PR.
290
-
291
- ```
292
- /rihal-code-review HEAD~5..HEAD --karpathy
293
- /rihal-code-review 03 --files=src/auth/ --karpathy
294
- ```
295
-
296
- ### Plan verification + post-execute gates
297
-
298
- `/rihal-plan` runs `rihal-plan-checker` after the planner writes PLAN.md. On failure, loops back to planner with feedback (max 2 retries).
299
-
300
- `/rihal-execute` runs `rihal-integration-checker` (cross-phase E2E) and `rihal-nyquist-auditor` (test coverage) after completion. Both append to SUMMARY.md.
301
-
302
- ### Model profiles
303
-
304
- ```bash
305
- /rihal-settings # interactive config
306
- ```
307
-
308
- - **quality** — opus/sonnet-4.6 for reasoning agents
309
- - **balanced** — sonnet-4.6 across the board (default)
310
- - **budget** — haiku-4.5 everywhere
311
- - **inherit** — use parent session's model
312
-
313
- ### Session handoff
314
-
315
- ```
316
- /rihal-pause-work → writes .rihal/HANDOFF.json + .continue-here.md
317
- /rihal-resume-work → reads HANDOFF, surfaces blocking constraints
318
- ```
319
-
320
- ---
321
-
322
- ## Full command surface (95 commands)
323
-
324
- ### Router + lifecycle
325
- `init` · `do` · `help` · `status` · `stats` · `health` · `forensics` · `update`
326
-
327
- ### Discovery + research
328
- `new-project` · `map-codebase` · `scan` · `explore` · `document-project` · `analyze-dependencies`
329
-
330
- ### Discovery + validation
331
- `prfaq` · `brainstorm` · `market-research` · `domain-research` · `technical-research` · `product-brief`
332
-
333
- ### Planning
334
- `plan` · `chain` · `create-epics-and-stories` · `create-story` · `dev-story` · `sprint-planning`
335
-
336
- ### Execution
337
- `execute` · `quick` · `autonomous` · `audit-fix` · `undo`
338
-
339
- ### Observability + review
340
- `code-review` · `code-review-fix` · `checkpoint-preview` · `secure-phase` · `show` · `why` · `rerun` · `diff`
341
-
342
- ### Recovery + correction
343
- `pause-work` · `resume-work` · `correct-course` · `next` · `config`
344
-
345
- ### Multi-agent modes
346
- `council` · `chain` · `discuss`
347
-
348
- ### Configuration + setup
349
- `settings` · `install` · `enable-hooks` · `profile-user`
350
-
351
- ### Lifecycle + phases
352
- `insert-phase` · `new-milestone` · `audit-milestone` · `complete-milestone` · `milestone-summary` · `new-workspace` · `list-workspaces` · `remove-workspace` · `workstream`
353
-
354
- ### Docs + notes + reporting
355
- `docs-update` · `note` · `report` · `session-report` · `add-todo` · `import` · `inbox`
356
-
357
- ### UI design
358
- `ui-phase` · `ui-review`
359
-
360
- ---
361
-
362
- ## Configuration
363
-
364
- `.rihal/config.yaml` — edit directly or run `/rihal-settings`:
365
-
366
- ```yaml
367
- user_name: "Hanzla"
368
- project_name: "your-project"
369
- communication_language: "English" # or Urdu, Arabic, etc.
370
- mode: "guided" # or yolo
371
- model_profile: "balanced" # quality | balanced | budget | inherit
372
- workflow:
373
- research_by_default: false
374
- plan_checker: true
375
- post_execute_gates: true
376
- ui_safety_gate: true
377
- git:
378
- branching_strategy: "none" # none | feature-branch | worktree-isolation
379
- ```
144
+ `/rihal-plan` runs `rihal-plan-checker` to validate file/symbol references before execution. `/rihal-execute` runs `rihal-integration-checker` (cross-phase E2E) and `rihal-nyquist-auditor` (test coverage) after completion.
380
145
 
381
146
  ---
382
147
 
383
- ## State tracking
384
-
385
- `.rihal/state.json` tracks everything:
148
+ ## Learn more
386
149
 
387
- - `current_phase`, `current_plan`
388
- - `phases[]`, `executions[]`, `decisions[]`, `blockers[]`
389
- - `council_sessions[]`, `chains[]`
390
- - `workstreams[]`, `active_workstream`, `last_session`
391
-
392
- View formatted:
393
- ```bash
394
- node .rihal/bin/rihal-tools.cjs state read
395
- # or
396
- /rihal-status
397
- ```
398
-
399
- ---
400
-
401
- ## Hooks (opt-in)
402
-
403
- ```bash
404
- /rihal-enable-hooks
405
- ```
406
-
407
- Installs 3 opt-in hooks into `.claude/settings.json`:
408
- 1. **pre-edit** — enforces read-before-edit
409
- 2. **pre-workflow** — soft intent warnings on mismatched commands
410
- 3. **post-commit** — validates commit format, blocks AI attribution
411
-
412
- ---
413
-
414
- ## Modules
415
-
416
- | Module | Contents |
417
- |--------|----------|
418
- | **core** | 5 council agents, `/rihal-council`, `/rihal-discuss`, `/rihal-status`, `/rihal-do`, `/rihal-help`, state management |
419
- | **execution** | Executor, planner, verifier + checker agents, `/rihal-execute`, `/rihal-plan`, `/rihal-quick`, `/rihal-debug`, `/rihal-audit-fix`, `/rihal-undo` |
420
- | **discovery** | Codebase-mapper, project-researcher, roadmapper, `/rihal-new-project`, `/rihal-map-codebase`, `/rihal-scan`, `/rihal-explore`, `/rihal-code-review`, `/rihal-docs-update` |
421
-
422
- Full install = all 3 modules = 700+ files.
423
-
424
- ---
425
-
426
- ## Testing
427
-
428
- ```bash
429
- node --test # full suite (134 tests, ~2s)
430
- node --test --test-reporter=spec # verbose output with test names
431
- ```
432
-
433
- **134 tests · pure Node stdlib (no test runner install needed)**
434
-
435
- ### Test scenarios
436
-
437
- | Suite | Tests | What it verifies |
438
- |-------|-------|-----------------|
439
- | `compliance.test.cjs` | 8 | Architecture invariants — every command routes through a workflow, every agent has valid frontmatter, all module manifests resolve, `rihal-tools.cjs` subcommands match help text |
440
- | `classifier.test.cjs` | 10 | Question classifier handles Roman Urdu, Arabic (unicode), English, ambiguous, and multilingual inputs; routes to correct intent (greenfield / market / codebase) |
441
- | `panel-scorer.test.cjs` | 12 | Council panel scorer selects correct agents for market, greenfield, and codebase questions; `--agents` override bypasses scoring; `--full` returns all agents |
442
- | `lib/config.test.cjs` | 15 | Config loader merges hardcoded → user → project layers; validates enum values; `suggestClosest` catches typos |
443
- | `lib/fsutil.test.cjs` | 8 | `writeFileAtomic` creates parents, overwrites cleanly, leaves no temp files, handles custom chmod modes |
444
- | `lib/manifest.test.cjs` | 12 | `readPackageManifest` discovers agents/actions; `verifyClaudeInstall` detects drift; `verifyInstall` aggregates multi-editor state |
445
- | `lib/memory-bank.test.cjs` | 10 | Fingerprint stability, staleness detection on hash change and structure change, `never/stale/fresh` thresholds |
446
- | `lib/prompts.test.cjs` | 15 | `askText`, `askConfirm`, `askChoice` in piped (CI) mode; re-prompt on bad input; `PromptAbortError` on max attempts; `closeSession` idempotency |
447
- | `lib/no-absolute-home-paths.test.cjs` | 3 | No slash command template embeds absolute `$HOME` paths (install portability) |
448
- | `lib/wizard-piped.test.cjs` | 2 | Full install in piped mode against temp dir; every known slash command installs non-empty |
449
-
450
- ### Post-install health check
451
-
452
- Every install runs 5 automated smoke tests before exiting:
453
-
454
- ```
455
- Health check:
456
- ✓ rihal-tools.cjs runs — syntax ok
457
- ✓ .rihal/config.yaml present — 412 bytes
458
- ✓ .rihal/state.json parses — valid JSON
459
- ✓ agents installed — 45
460
- ✓ skills + commands installed — 105 skills + 95 commands
461
- ```
462
-
463
- A failed check prints the debug command and returns exit code 1 so CI catches broken installs.
464
-
465
- ### CI pipeline
466
-
467
- Three jobs run on every push and pull request to `main`:
468
-
469
- | Job | What it checks |
470
- |-----|----------------|
471
- | `test` | Runs `node --test` on Node 18, 20, 22, and 24 — no `npm install` needed |
472
- | `no-new-deps` | Blocks any addition to `dependencies{}` (runtime zero-dep invariant); audits `devDependencies` against approved build-tool list |
473
- | `syntax-check` | `node -c` on every file in `cli/` to catch parse errors before runtime |
474
-
475
- The release pipeline additionally runs `npm ci && npm run build:cli` to produce `dist/rcode.js` (the self-contained esbuild bundle published to npm), then runs a compliance check and attaches the artefact to the GitHub Release.
476
-
477
- ### Run a single suite
478
-
479
- ```bash
480
- node --test test/compliance.test.cjs # architecture invariants only
481
- node --test test/lib/config.test.cjs # config layer only
482
- node --test test/lib/manifest.test.cjs # install verification only
483
- ```
150
+ | Document | What's in it |
151
+ |----------|--------------|
152
+ | [`DOCS.md`](DOCS.md) | Complete documentation — install, concepts, all commands, Memory Bank, dashboard, testing & CI, architecture |
153
+ | [`docs/getting-started.md`](docs/getting-started.md) | Step-by-step first project |
154
+ | [`docs/TIERS.md`](docs/TIERS.md) | Starter / Advanced / Power-user paths |
155
+ | [`MEMORY_BANK.md`](MEMORY_BANK.md) | Memory Bank specification |
156
+ | [`BRAND.md`](BRAND.md) | Naming, voice, and persona glossary |
157
+ | [`MIGRATIONS.md`](MIGRATIONS.md) | Upgrade path from a pre-Memory-Bank install |
158
+ | [`CHANGELOG.md`](CHANGELOG.md) | Release history |
484
159
 
485
160
  ---
486
161
 
@@ -499,16 +174,4 @@ node --test test/lib/manifest.test.cjs # install verification only
499
174
 
500
175
  ## License
501
176
 
502
- UNLICENSED proprietary. All rights reserved.
503
-
504
- ---
505
-
506
- ## Auto-heal cadence
507
-
508
- rihal-code ships continuous auto-heal tools — `/rihal-feature-drift`, `/rihal-memory-audit`, `/rihal-health` — plus a CI dogfood gate that runs them against this repo on every push. See [docs/AUTO-HEAL-CADENCE.md](docs/AUTO-HEAL-CADENCE.md) for recommended schedules, `/loop` examples, crontab entries, and the safety rules around `--fix` modes.
509
-
510
- ---
511
-
512
- ## Roadmap
513
-
514
- See [GitHub Issues](https://github.com/hanzlahabib/rihal-code/issues) for tracked work. Current focus: marketing launch, MCP server, dashboard enhancements.
177
+ Released under the [MIT License](LICENSE).