@hanzlaa/rcode 2.8.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +11 -1
- package/CONTRIBUTING.md +7 -0
- package/README.md +39 -20
- package/package.json +2 -2
- package/rihal/agents/rihal-advisor-researcher.md +1 -1
- package/rihal/agents/rihal-assumptions-analyzer.md +1 -1
- package/rihal/agents/rihal-codebase-mapper.md +1 -1
- package/rihal/agents/rihal-docs-auditor.md +3 -3
- package/rihal/agents/rihal-executor.md +10 -0
- package/rihal/agents/rihal-integration-checker.md +1 -1
- package/rihal/agents/rihal-noor.md +2 -2
- package/rihal/agents/rihal-phase-researcher.md +1 -1
- package/rihal/agents/rihal-planner.md +25 -0
- package/rihal/agents/rihal-project-researcher.md +1 -1
- package/rihal/agents/rihal-research-synthesizer.md +1 -1
- package/rihal/agents/rihal-roadmapper.md +1 -1
- package/rihal/agents/rihal-sprint-checker.md +19 -1
- package/rihal/agents/rihal-verifier.md +1 -1
- package/rihal/agents/rihal-waleed.md +1 -2
- package/rihal/commands/code-review.md +1 -1
- package/rihal/commands/memory-audit.md +10 -0
- package/rihal/commands/memory-distill.md +11 -0
- package/rihal/commands/memory-init.md +12 -0
- package/rihal/commands/memory-update.md +12 -0
- package/rihal/config/model-profiles.json +5 -5
- package/rihal/references/karpathy-guidelines-full.md +1 -1
- package/rihal/references/no-unauthorized-git-ops.md +1 -1
- package/rihal/references/verb-dictionary.md +1 -1
- package/rihal/skills/actions/2-plan/rihal-frontend-design/SKILL.md +49 -139
- package/rihal/skills/actions/2-plan/rihal-frontend-design/references.md +79 -0
- package/rihal/skills/actions/4-implementation/rihal-browser-verify/SKILL.md +70 -0
- package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +1 -1
- package/rihal/skills/actions/4-implementation/rihal-ci/SKILL.md +108 -0
- package/rihal/skills/actions/4-implementation/rihal-debug/SKILL.md +78 -0
- package/rihal/skills/actions/4-implementation/rihal-git-flow/SKILL.md +90 -0
- package/rihal/skills/actions/4-implementation/rihal-harden/SKILL.md +91 -0
- package/rihal/skills/actions/4-implementation/rihal-incremental/SKILL.md +50 -0
- package/rihal/skills/actions/4-implementation/rihal-migrate/SKILL.md +86 -0
- package/rihal/skills/actions/4-implementation/rihal-perf/SKILL.md +96 -0
- package/rihal/skills/actions/4-implementation/rihal-prove-it/SKILL.md +64 -0
- package/rihal/skills/actions/4-implementation/rihal-source-truth/SKILL.md +76 -0
- package/rihal/skills/actions/4-implementation/rihal-trim/SKILL.md +73 -0
- package/rihal/skills/agents/dalil-scout/SKILL.md +43 -125
- package/rihal/skills/agents/dalil-scout/references.md +67 -0
- package/rihal/skills/agents/majlis-council/SKILL.md +50 -144
- package/rihal/skills/agents/majlis-council/references.md +90 -0
- package/rihal/skills/agents/raees-orchestrator/SKILL.md +56 -117
- package/rihal/skills/agents/raees-orchestrator/references.md +47 -0
- package/rihal/skills/core/rihal-advanced-elicitation/SKILL.md +36 -136
- package/rihal/skills/core/rihal-advanced-elicitation/references.md +101 -0
- package/rihal/skills/core/rihal-auth-audit/SKILL.md +93 -0
- package/rihal/skills/core/rihal-brainstorming/SKILL.md +5 -0
- package/rihal/skills/core/rihal-client-gate/SKILL.md +91 -0
- package/rihal/skills/core/rihal-clone-website/SKILL.md +30 -371
- package/rihal/skills/core/rihal-clone-website/references.md +213 -0
- package/rihal/skills/core/rihal-deploy-unify/SKILL.md +87 -0
- package/rihal/skills/core/rihal-distillator/SKILL.md +37 -187
- package/rihal/skills/core/rihal-distillator/references.md +118 -0
- package/rihal/skills/core/rihal-editorial-review-prose/SKILL.md +5 -0
- package/rihal/skills/core/rihal-editorial-review-structure/SKILL.md +45 -183
- package/rihal/skills/core/rihal-editorial-review-structure/references.md +110 -0
- package/rihal/skills/core/rihal-help/SKILL.md +6 -1
- package/rihal/skills/core/rihal-incident-record/SKILL.md +161 -0
- package/rihal/skills/core/rihal-index-docs/SKILL.md +5 -0
- package/rihal/skills/core/rihal-init/SKILL.md +5 -0
- package/rihal/skills/core/rihal-memory-audit/SKILL.md +88 -0
- package/rihal/skills/core/rihal-memory-distill/SKILL.md +87 -0
- package/rihal/skills/core/rihal-memory-init/SKILL.md +77 -0
- package/rihal/skills/core/rihal-memory-update/SKILL.md +73 -0
- package/rihal/skills/core/rihal-mvp-graduate/SKILL.md +116 -0
- package/rihal/skills/core/rihal-ocr-consistency/SKILL.md +106 -0
- package/rihal/skills/core/rihal-party-mode/SKILL.md +5 -0
- package/rihal/skills/core/rihal-rebrand/SKILL.md +133 -0
- package/rihal/skills/core/rihal-review-adversarial-general/SKILL.md +5 -0
- package/rihal/skills/core/rihal-review-edge-case-hunter/SKILL.md +5 -0
- package/rihal/skills/core/rihal-shard-doc/SKILL.md +5 -0
- package/rihal/skills/core/rihal-theme-system/SKILL.md +113 -0
- package/rihal/team.yaml +3 -22
- package/rihal/templates/memory/INDEX.md +46 -0
- package/rihal/templates/memory/change-records/.gitkeep +4 -0
- package/rihal/templates/memory/distillates/project.distillate.md +11 -0
- package/rihal/templates/memory/distillates/stack.distillate.md +11 -0
- package/rihal/templates/memory/incidents/known-issues.md +27 -0
- package/rihal/templates/memory/incidents/post-mortems/.gitkeep +3 -0
- package/rihal/templates/memory/milestones/archive/.gitkeep +2 -0
- package/rihal/templates/memory/milestones/current.md +39 -0
- package/rihal/templates/memory/people/stakeholders.md +25 -0
- package/rihal/templates/memory/people/team.md +35 -0
- package/rihal/templates/memory/project/decisions.md +32 -0
- package/rihal/templates/memory/project/glossary.md +16 -0
- package/rihal/templates/memory/project/stack.md +46 -0
- package/rihal/workflows/audit.md +3 -3
- package/rihal/workflows/code-review.md +32 -1
- package/rihal/workflows/council.md +1 -1
- package/rihal/workflows/discuss-phase-power.md +3 -3
- package/rihal/workflows/do.md +1 -1
- package/rihal/workflows/docs-update.md +4 -4
- package/rihal/workflows/execute.md +61 -5
- package/rihal/workflows/help.md +5 -5
- package/rihal/workflows/karpathy-audit.md +9 -9
- package/rihal/workflows/memory-audit.md +83 -0
- package/rihal/workflows/memory-distill.md +103 -0
- package/rihal/workflows/memory-init.md +102 -0
- package/rihal/workflows/memory-update.md +83 -0
- package/rihal/workflows/plan.md +66 -1
- package/server/dashboard.js +6 -1
- package/server/lib/api.js +8 -2
- package/server/lib/html/client.js +63 -0
- package/server/lib/html/shell.js +5 -0
- package/server/lib/scanner.js +76 -1
- package/rihal/agents/rihal-architect.md +0 -79
- package/rihal/agents/rihal-tech-writer.md +0 -80
- package/rihal/commands/check-implementation-readiness.md +0 -8
- package/rihal/commands/discuss-phase-power.md +0 -11
- package/rihal/commands/karpathy-audit.md +0 -12
- package/rihal/commands/new-project-research.md +0 -11
- package/rihal/commands/new-project-roadmap.md +0 -11
- package/rihal/commands/report.md +0 -10
- package/rihal/commands/review-adversarial.md +0 -8
- package/rihal/commands/review-edge-case-hunter.md +0 -8
package/rihal/workflows/plan.md
CHANGED
|
@@ -999,7 +999,27 @@ Track `stall_reentry_count` (starts at 0; incremented each time "Adjust approach
|
|
|
999
999
|
|
|
1000
1000
|
**If iteration_count < 3:**
|
|
1001
1001
|
|
|
1002
|
-
|
|
1002
|
+
**Sprint-checker malfunction guard (BLOCKER-class — added in v3.1.0 after #440):**
|
|
1003
|
+
|
|
1004
|
+
Before parsing issues, verify the checker actually invoked tools. The checker MUST exhibit at least one of these evidence markers in its return:
|
|
1005
|
+
|
|
1006
|
+
- A YAML `issues:` block (even an empty one — `issues: []`)
|
|
1007
|
+
- A YAML `verified_files:` block listing files it read
|
|
1008
|
+
- At least one `path:` field in any block (e.g. `path: src/components/Foo.tsx:42`)
|
|
1009
|
+
- A summary line of the form `Verified N of M files` or `Checked N symbols`
|
|
1010
|
+
|
|
1011
|
+
If NONE of these evidence markers are present, the checker malfunctioned (returned narrative without invoking tools — see #440). BLOCK execution:
|
|
1012
|
+
|
|
1013
|
+
```
|
|
1014
|
+
Display: "Sprint-checker returned without evidence of tool use — likely
|
|
1015
|
+
malfunctioned (cf. issue #440). Refusing to advance the plan
|
|
1016
|
+
on unverified output. Re-run /rihal:plan or inspect the agent."
|
|
1017
|
+
Halt the workflow with a non-zero exit signal.
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
Do NOT treat empty / narrative-only checker output as "plan approved". An empty checker output is a malfunction, not a pass.
|
|
1021
|
+
|
|
1022
|
+
Parse issue count from checker return: count BLOCKER + WARNING entries in the YAML issues block (structured output from rihal-sprint-checker). If the checker's return contains a populated YAML issues block with `issues: []` (i.e., the plan was approved with no issues AFTER actual checking), treat `issue_count` as 0 and skip the stall check — the plan passed. Proceed to step 13.
|
|
1003
1023
|
|
|
1004
1024
|
Display: `Revision iteration {N}/3 -- {blocker_count} blockers, {warning_count} warnings`
|
|
1005
1025
|
|
|
@@ -1064,6 +1084,51 @@ Display: `Max iterations reached. {N} issues remain:` + issue list
|
|
|
1064
1084
|
|
|
1065
1085
|
Offer: 1) Force proceed, 2) Provide guidance and retry, 3) Abandon
|
|
1066
1086
|
|
|
1087
|
+
## 12.5. Wave Parallelism File-Overlap Check (added in v3.1.0 after #442)
|
|
1088
|
+
|
|
1089
|
+
Before declaring plans ready, validate the wave-parallelism rule the planner declares: **same wave + overlapping `files_modified` = sequential, not parallel**. If two plans share `depends_on` (same wave) and both list the same file in `files_modified`, the planner should have marked the later one `sequential: true`. Catch the cases where it didn't.
|
|
1090
|
+
|
|
1091
|
+
```bash
|
|
1092
|
+
# For every pair of plans (A, B) with the same depends_on:
|
|
1093
|
+
# if files_modified(A) ∩ files_modified(B) is non-empty:
|
|
1094
|
+
# - the later plan (by sprint id) MUST declare sequential: true
|
|
1095
|
+
# - and must list the conflicting files in its frontmatter
|
|
1096
|
+
|
|
1097
|
+
node ".rihal/bin/rihal-tools.cjs" plan check-wave-overlaps "${PHASE_NUMBER}"
|
|
1098
|
+
```
|
|
1099
|
+
|
|
1100
|
+
The CLI helper returns a JSON report:
|
|
1101
|
+
|
|
1102
|
+
```json
|
|
1103
|
+
{
|
|
1104
|
+
"conflicts": [
|
|
1105
|
+
{
|
|
1106
|
+
"wave": 2,
|
|
1107
|
+
"plan_a": "96.2",
|
|
1108
|
+
"plan_b": "96.3",
|
|
1109
|
+
"shared_files": ["src/components/LeadDetailPanel.tsx", "src/styles/inbox.css"],
|
|
1110
|
+
"plan_b_sequential": false
|
|
1111
|
+
}
|
|
1112
|
+
]
|
|
1113
|
+
}
|
|
1114
|
+
```
|
|
1115
|
+
|
|
1116
|
+
**If `conflicts` is non-empty:**
|
|
1117
|
+
|
|
1118
|
+
1. For each conflict, edit the later plan's SPRINT.md frontmatter to add:
|
|
1119
|
+
```yaml
|
|
1120
|
+
sequential: true
|
|
1121
|
+
sequential_after: <plan_a id>
|
|
1122
|
+
conflicting_files: [<shared_files...>]
|
|
1123
|
+
```
|
|
1124
|
+
2. Recompute waves: the formerly-parallel plan now depends on the earlier one, so its wave is `max(waves of dependencies) + 1`.
|
|
1125
|
+
3. Re-run the checker to confirm the updated frontmatter.
|
|
1126
|
+
4. Display: `Wave parallelism: {N} conflict(s) auto-corrected to sequential.`
|
|
1127
|
+
|
|
1128
|
+
**If `conflicts` is empty:** Display `Wave parallelism: ✓ no file-overlap conflicts.` and proceed.
|
|
1129
|
+
|
|
1130
|
+
This closes the gap from #442 — the rule was stated in `rihal-planner.md` but not enforced. Now it's enforced automatically.
|
|
1131
|
+
|
|
1067
1132
|
## 13. Requirements Coverage Gate
|
|
1068
1133
|
|
|
1069
1134
|
After plans pass the checker (or checker is skipped), verify that all phase requirements are covered by at least one plan.
|
package/server/dashboard.js
CHANGED
|
@@ -24,7 +24,7 @@ const http = require('http');
|
|
|
24
24
|
const path = require('path');
|
|
25
25
|
|
|
26
26
|
const { scanState } = require('./lib/scanner');
|
|
27
|
-
const { handleApiState, handleApiFiles, handleApiFile, handleApiHierarchy } = require('./lib/api');
|
|
27
|
+
const { handleApiState, handleApiFiles, handleApiFile, handleApiHierarchy, handleApiMemory } = require('./lib/api');
|
|
28
28
|
const { renderHtml } = require('./lib/html/shell');
|
|
29
29
|
|
|
30
30
|
// ---------- Configuration ----------
|
|
@@ -62,6 +62,11 @@ const server = http.createServer((req, res) => {
|
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
if (url === '/api/memory') {
|
|
66
|
+
handleApiMemory(req, res, RIHAL_DIR);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
65
70
|
if (url === '/' || url === '/index.html') {
|
|
66
71
|
const state = scanState(RIHAL_DIR);
|
|
67
72
|
const html = renderHtml(state);
|
package/server/lib/api.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
|
-
const { scanState } = require('./scanner');
|
|
6
|
+
const { scanState, scanMemoryBank } = require('./scanner');
|
|
7
7
|
|
|
8
8
|
function handleApiState(req, res, rihalDir) {
|
|
9
9
|
const state = scanState(rihalDir);
|
|
@@ -120,4 +120,10 @@ function handleApiHierarchy(req, res, rihalDir) {
|
|
|
120
120
|
res.end(JSON.stringify(hierarchy, null, 2));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
function handleApiMemory(req, res, rihalDir) {
|
|
124
|
+
const memory = scanMemoryBank(rihalDir);
|
|
125
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
126
|
+
res.end(JSON.stringify(memory, null, 2));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
module.exports = { handleApiState, handleApiFiles, handleApiFile, handleApiHierarchy, handleApiMemory };
|
|
@@ -649,6 +649,69 @@ function route() {
|
|
|
649
649
|
else if (view === 'sprints') renderSprints(subId);
|
|
650
650
|
else if (view === 'tasks') renderTasks();
|
|
651
651
|
else if (view === 'decisions') renderDecisions();
|
|
652
|
+
else if (view === 'memory') renderMemory();
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
function renderMemory() {
|
|
656
|
+
const el = document.getElementById('view-memory-content');
|
|
657
|
+
if (!el) return;
|
|
658
|
+
el.innerHTML = '<div class="view-title">🧠 Memory Bank</div><div class="empty">Loading…</div>';
|
|
659
|
+
fetch('/api/memory').then(r => r.json()).then(m => {
|
|
660
|
+
if (!m.exists) {
|
|
661
|
+
el.innerHTML = '<div class="view-title">🧠 Memory Bank</div>' +
|
|
662
|
+
'<div class="empty"><h3 style="color:var(--rihal-gold);">Not initialised</h3>' +
|
|
663
|
+
'<p>The Memory Bank is rcode\\'s structured project context.</p>' +
|
|
664
|
+
'<div class="empty-action">Run <code>/rcode:memory-init</code> to bootstrap</div></div>';
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
let h = '<div class="view-title">🧠 Memory Bank</div>';
|
|
668
|
+
if (!m.initialised) {
|
|
669
|
+
h += '<div class="empty"><p>Directory exists but INDEX.md is missing — re-run <code>/rcode:memory-init</code></p></div>';
|
|
670
|
+
el.innerHTML = h;
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
const sections = m.sections || {};
|
|
674
|
+
h += '<div class="filter-bar"><span style="color:var(--text-muted);font-size:var(--text-sm);">Last scanned: ' + esc(m.lastScanned) + '</span></div>';
|
|
675
|
+
h += '<div id="memory-sections">';
|
|
676
|
+
for (const [section, files] of Object.entries(sections)) {
|
|
677
|
+
h += '<div style="font-size:var(--text-sm);font-weight:600;color:var(--text-muted);margin:var(--space-4) 0 var(--space-2);">' + esc(section) + '</div>';
|
|
678
|
+
h += '<div class="decision-list">';
|
|
679
|
+
for (const f of files) {
|
|
680
|
+
const status = f.exists ? (f.populated ? '✓' : '○') : '✗';
|
|
681
|
+
const meta = f.exists ? (f.populated ? 'populated' : 'template only') : 'missing';
|
|
682
|
+
h += '<div class="item">' +
|
|
683
|
+
'<div class="item-title">' + status + ' ' + esc(f.name) + '</div>' +
|
|
684
|
+
'<div class="item-meta">' + esc(meta) + ' · ' + (f.bytes || 0) + ' bytes</div>' +
|
|
685
|
+
'</div>';
|
|
686
|
+
}
|
|
687
|
+
h += '</div>';
|
|
688
|
+
}
|
|
689
|
+
function listGroup(label, items) {
|
|
690
|
+
if (!items || !items.length) return '';
|
|
691
|
+
let g = '<div style="font-size:var(--text-sm);font-weight:600;color:var(--text-muted);margin:var(--space-4) 0 var(--space-2);">' + esc(label) + ' (' + items.length + ')</div>';
|
|
692
|
+
g += '<div class="decision-list">';
|
|
693
|
+
for (const f of items) {
|
|
694
|
+
g += '<div class="item">' +
|
|
695
|
+
'<div class="item-title">' + esc(f.name) + '</div></div>';
|
|
696
|
+
}
|
|
697
|
+
g += '</div>';
|
|
698
|
+
return g;
|
|
699
|
+
}
|
|
700
|
+
h += listGroup('Distillates', m.distillates);
|
|
701
|
+
h += listGroup('Change Records', m.changeRecords);
|
|
702
|
+
h += listGroup('Milestone Archive', m.archive);
|
|
703
|
+
h += listGroup('Post-mortems', m.postMortems);
|
|
704
|
+
h += '</div>';
|
|
705
|
+
h += cmdAccordion([
|
|
706
|
+
cmdHint('/rcode:memory-init', 'Bootstrap the Memory Bank'),
|
|
707
|
+
cmdHint('/rcode:memory-update', 'Append a decision, issue, or stakeholder entry'),
|
|
708
|
+
cmdHint('/rcode:memory-distill', 'Regenerate fast-load distillates'),
|
|
709
|
+
cmdHint('/rcode:memory-audit', 'Find stale entries and gaps')
|
|
710
|
+
]);
|
|
711
|
+
el.innerHTML = h;
|
|
712
|
+
}).catch(err => {
|
|
713
|
+
el.innerHTML = '<div class="view-title">🧠 Memory Bank</div><div class="empty">Failed to load /api/memory: ' + esc(String(err)) + '</div>';
|
|
714
|
+
});
|
|
652
715
|
}
|
|
653
716
|
|
|
654
717
|
function renderDecisions() {
|
package/server/lib/html/shell.js
CHANGED
|
@@ -81,6 +81,7 @@ ${renderCss()}
|
|
|
81
81
|
<button class="nav-link" data-view="files">📄 Files</button>
|
|
82
82
|
<button class="nav-link" data-view="agents">🤝 Agents</button>
|
|
83
83
|
<button class="nav-link" data-view="decisions">⚖ Decisions</button>
|
|
84
|
+
<button class="nav-link" data-view="memory">🧠 Memory Bank</button>
|
|
84
85
|
</nav>
|
|
85
86
|
<div id="sidebar-file-tree" style="margin-top:var(--space-4);padding:0 var(--space-2);"></div>
|
|
86
87
|
</aside>
|
|
@@ -200,6 +201,10 @@ ${renderCss()}
|
|
|
200
201
|
|
|
201
202
|
<div id="view-decisions" class="view"></div>
|
|
202
203
|
|
|
204
|
+
<div id="view-memory" class="view">
|
|
205
|
+
<div id="view-memory-content"><div class="empty" style="padding:80px;background:var(--bg-card);border-radius:var(--radius-lg);"><h2 style="color:var(--rihal-gold);margin-bottom:16px;">Memory Bank</h2><p>Loading…</p></div></div>
|
|
206
|
+
</div>
|
|
207
|
+
|
|
203
208
|
<footer>
|
|
204
209
|
<div class="arabic">رحلة البناء · The Journey of Building</div>
|
|
205
210
|
<div>Rihal Code · View-Only Dashboard · <kbd>R</kbd> refresh · <kbd>1-9</kbd> switch views · <kbd>F</kbd> filter</div>
|
package/server/lib/scanner.js
CHANGED
|
@@ -139,4 +139,79 @@ function scanState(rihalDir) {
|
|
|
139
139
|
return state;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Scan the Memory Bank at .rihal/memory/. Returns structure suitable
|
|
144
|
+
* for the /api/memory endpoint and the dashboard /memory view.
|
|
145
|
+
* Returns { exists: false } when the Memory Bank has not been initialised.
|
|
146
|
+
*/
|
|
147
|
+
function scanMemoryBank(rihalDir) {
|
|
148
|
+
const memoryDir = path.join(rihalDir, 'memory');
|
|
149
|
+
const result = {
|
|
150
|
+
exists: false,
|
|
151
|
+
initialised: false,
|
|
152
|
+
indexPath: null,
|
|
153
|
+
sections: {},
|
|
154
|
+
distillates: [],
|
|
155
|
+
changeRecords: [],
|
|
156
|
+
archive: [],
|
|
157
|
+
postMortems: [],
|
|
158
|
+
lastScanned: new Date().toISOString(),
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
if (!fs.existsSync(memoryDir)) return result;
|
|
162
|
+
result.exists = true;
|
|
163
|
+
|
|
164
|
+
const indexPath = path.join(memoryDir, 'INDEX.md');
|
|
165
|
+
if (fs.existsSync(indexPath)) {
|
|
166
|
+
result.initialised = true;
|
|
167
|
+
result.indexPath = '.rihal/memory/INDEX.md';
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const sectionMap = {
|
|
171
|
+
project: ['stack.md', 'decisions.md', 'glossary.md'],
|
|
172
|
+
people: ['stakeholders.md', 'team.md'],
|
|
173
|
+
milestones: ['current.md'],
|
|
174
|
+
incidents: ['known-issues.md'],
|
|
175
|
+
};
|
|
176
|
+
for (const [section, files] of Object.entries(sectionMap)) {
|
|
177
|
+
const sectionDir = path.join(memoryDir, section);
|
|
178
|
+
if (!fs.existsSync(sectionDir)) continue;
|
|
179
|
+
result.sections[section] = files.map(name => {
|
|
180
|
+
const full = path.join(sectionDir, name);
|
|
181
|
+
const exists = fs.existsSync(full);
|
|
182
|
+
let bytes = 0, populated = false;
|
|
183
|
+
if (exists) {
|
|
184
|
+
try {
|
|
185
|
+
const stat = fs.statSync(full);
|
|
186
|
+
bytes = stat.size;
|
|
187
|
+
const text = fs.readFileSync(full, 'utf8');
|
|
188
|
+
populated = !/\{\{[A-Z_]+\}\}/.test(text) && !/_\(e\.g\.\s/.test(text);
|
|
189
|
+
} catch { /* ignore */ }
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
name,
|
|
193
|
+
path: `.rihal/memory/${section}/${name}`,
|
|
194
|
+
exists,
|
|
195
|
+
bytes,
|
|
196
|
+
populated,
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function listMd(subdir) {
|
|
202
|
+
const full = path.join(memoryDir, subdir);
|
|
203
|
+
if (!fs.existsSync(full)) return [];
|
|
204
|
+
return listDir(full)
|
|
205
|
+
.filter(e => e.isFile() && e.name.endsWith('.md'))
|
|
206
|
+
.map(e => ({ name: e.name, path: `.rihal/memory/${subdir}/${e.name}` }));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
result.distillates = listMd('distillates');
|
|
210
|
+
result.changeRecords = listMd('change-records');
|
|
211
|
+
result.archive = listMd('milestones/archive');
|
|
212
|
+
result.postMortems = listMd('incidents/post-mortems');
|
|
213
|
+
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
module.exports = { scanState, scanMemoryBank, safeReadText, safeReadJson, listDir, parseSimpleYaml };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: rihal-architect
|
|
3
|
-
description: Enterprise Architecture & System Design — spawned for architecture reviews, system design decisions, scalability planning, and technical strategy. Evaluates technology choices, integration patterns, and long-term maintainability.
|
|
4
|
-
tools: Read, Grep, Glob, WebFetch
|
|
5
|
-
color: orange
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
@.rihal/references/response-style.md
|
|
9
|
-
@.rihal/references/karpathy-guidelines.md
|
|
10
|
-
@.rihal/references/no-unauthorized-git-ops.md
|
|
11
|
-
|
|
12
|
-
# Rihal Architect
|
|
13
|
-
|
|
14
|
-
You are the **Architect** at Rihal. You are spawned for system design, architecture reviews, technology evaluation, scalability planning, and technical strategy decisions. You think in layers, boundaries, and trade-offs.
|
|
15
|
-
|
|
16
|
-
## Who you are
|
|
17
|
-
|
|
18
|
-
Enterprise architect. You evaluate "should we use X or Y?" for systems that span teams, services, and years. You understand the difference between early-stage pragmatism (build for today, refactor later) and long-term sustainability (design for tomorrow). You defer to Waleed (CTO) for current codebase decisions and Sadiq (Strategy) for product priorities.
|
|
19
|
-
|
|
20
|
-
You do not write code. You design systems and evaluate choices.
|
|
21
|
-
|
|
22
|
-
## How you think
|
|
23
|
-
|
|
24
|
-
Every architecture question has four pressure points:
|
|
25
|
-
1. **What constraints are real vs. assumed?** — Team size, budget, time, scale, regulation
|
|
26
|
-
2. **What breaks at 10x scale?** — If this works for 1k users, what fails at 10k?
|
|
27
|
-
3. **What's the migration cost if we change our mind?** — Can we pivot, or are we locked in?
|
|
28
|
-
4. **What's the simplest design that still wins?** — Overengineering is the most common architecture sin
|
|
29
|
-
|
|
30
|
-
## Response format
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
🏛️ **Architect:**
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Structured: Current state → Constraints → Options → Trade-offs → Recommendation → Migration if needed. Use diagrams (ASCII or textual) liberally.
|
|
37
|
-
|
|
38
|
-
## Specializations
|
|
39
|
-
|
|
40
|
-
### Architecture Reviews
|
|
41
|
-
|
|
42
|
-
- Analyze existing system for scalability bottlenecks, tech debt, integration risks
|
|
43
|
-
- Identify patterns that work and patterns that are brittle
|
|
44
|
-
- Recommend refactoring priorities, not a complete rewrite
|
|
45
|
-
|
|
46
|
-
### System Design
|
|
47
|
-
|
|
48
|
-
- Design new systems with explicit constraints: team size, time-to-market, scale expectations
|
|
49
|
-
- Show reference architectures and when they apply
|
|
50
|
-
- Explain why Pattern A instead of Pattern B given the constraints
|
|
51
|
-
|
|
52
|
-
### Technology Evaluation
|
|
53
|
-
|
|
54
|
-
- Compare technologies (databases, frameworks, services) using a consistent rubric
|
|
55
|
-
- Always include: maturity, community, long-term viability, cost, learning curve
|
|
56
|
-
- Avoid vendor lock-in; design for switching costs
|
|
57
|
-
|
|
58
|
-
### Scalability Planning
|
|
59
|
-
|
|
60
|
-
- Design systems that grow without total rewrites
|
|
61
|
-
- Identify bottlenecks early (database, caching, messaging, state)
|
|
62
|
-
- Plan upgrade paths (single instance → replicated → sharded → distributed)
|
|
63
|
-
|
|
64
|
-
## Redirects
|
|
65
|
-
|
|
66
|
-
Use command-redirect-format.md. One reason, then command.
|
|
67
|
-
|
|
68
|
-
- Current codebase decisions → Waleed (CTO)
|
|
69
|
-
- Product prioritization → Sadiq (Strategy)
|
|
70
|
-
- Team structure impact → Hussain-PM (Product Manager)
|
|
71
|
-
|
|
72
|
-
## Constraints
|
|
73
|
-
|
|
74
|
-
- Recommend designs for real constraints, not hypothetical scale
|
|
75
|
-
- Document why you reject an option, not just what you recommend
|
|
76
|
-
- Explain migration paths for design changes
|
|
77
|
-
- Avoid speculative technologies; favor proven patterns
|
|
78
|
-
- No emojis beyond 🏛️
|
|
79
|
-
- No pleasantries or closing offers
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: rihal-tech-writer
|
|
3
|
-
description: Documentation specialist — spawned by /rihal:docs-update and doc-writing workflows. Generates and updates README, API docs, changelogs, migration guides, and inline code comments. Specializes in clarity, accuracy, and structure.
|
|
4
|
-
tools: Read, Write, Edit, Grep, Glob
|
|
5
|
-
color: cyan
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
@.rihal/references/response-style.md
|
|
9
|
-
@.rihal/references/karpathy-guidelines.md
|
|
10
|
-
|
|
11
|
-
# Rihal Tech Writer
|
|
12
|
-
|
|
13
|
-
You are the **Technical Writer** at Rihal. You are spawned for documentation generation, API reference creation, changelog updates, migration guides, and inline code comment authoring. You prioritize clarity over completeness — every sentence serves the reader's goal.
|
|
14
|
-
|
|
15
|
-
## Who you are
|
|
16
|
-
|
|
17
|
-
You write for practitioners, not philosophers. Your README makes someone productive in 5 minutes. Your API docs make every endpoint discoverable by shape (request/response). Your changelogs state what changed and why. You ask Waleed (CTO) about architecture and technical decisions, Sadiq about product strategy and context.
|
|
18
|
-
|
|
19
|
-
You do not write code. You document it. You do not invent features — you document decisions that were already made.
|
|
20
|
-
|
|
21
|
-
## How you think
|
|
22
|
-
|
|
23
|
-
Every documentation request has three pressure points:
|
|
24
|
-
1. **What is the reader's immediate goal?** — "Set up locally", "Call this endpoint", "Migrate from v1", "Understand this algorithm". Everything serves this goal.
|
|
25
|
-
2. **What is the minimal example?** — Not the comprehensive one. The one that works in 20 seconds.
|
|
26
|
-
3. **What will they get wrong?** — Name one specific misconception and address it inline.
|
|
27
|
-
|
|
28
|
-
## Response format
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
📋 **Tech Writer:**
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Speak procedurally. Structure as: Goal → Prerequisites → Steps → Verification. Use code examples liberally. Link to deeper docs for the curious, but don't force them.
|
|
35
|
-
|
|
36
|
-
## Specializations
|
|
37
|
-
|
|
38
|
-
### README
|
|
39
|
-
|
|
40
|
-
- **Structure:** Headline → What it does (one sentence) → Quick start (code block first) → Features → Installation → Basic usage → Advanced → Contributing → License
|
|
41
|
-
- **Quick start:** Copy-paste runnable example. Must work. No "first install X" preamble.
|
|
42
|
-
- **Installation:** Exact commands for the primary OS/manager (pnpm/npm/pip). Link to alternatives.
|
|
43
|
-
|
|
44
|
-
### API docs
|
|
45
|
-
|
|
46
|
-
- **Per-endpoint:** Heading, one-line purpose, request shape (params/body/headers), response shape (success/error), curl + language example
|
|
47
|
-
- **Shape-first:** Show the request/response JSON before prose explanation
|
|
48
|
-
- **Error states:** Every endpoint documents its error codes and payloads
|
|
49
|
-
- **Authentication:** Stated once per endpoint, not once per section
|
|
50
|
-
|
|
51
|
-
### Changelogs
|
|
52
|
-
|
|
53
|
-
- **Per version:** Date, semver, breaking changes flagged with 🔴, new features with 🟢, bug fixes with 🔵, internal (no flag)
|
|
54
|
-
- **Minimal:** "Fixed X" not "We improved the robustness of X's handling". User-facing phrasing.
|
|
55
|
-
- **Migration guide link:** If breaking, link to the migration guide for that version
|
|
56
|
-
|
|
57
|
-
### Migration guides
|
|
58
|
-
|
|
59
|
-
- **Timeline:** Old API → New API side-by-side
|
|
60
|
-
- **Automated:** Shell script or code snippet to bulk-transform where possible
|
|
61
|
-
- **Gotchas:** One section: "Things that compile but behave differently"
|
|
62
|
-
|
|
63
|
-
## Redirects
|
|
64
|
-
|
|
65
|
-
Use command-redirect-format.md. One reason, then command.
|
|
66
|
-
|
|
67
|
-
- Architecture or technical decisions → Waleed (CTO)
|
|
68
|
-
- Product context or strategy → Sadiq (Strategy)
|
|
69
|
-
- Code changes themselves → Waleed or execution agents
|
|
70
|
-
|
|
71
|
-
## Constraints
|
|
72
|
-
|
|
73
|
-
- Apply Karpathy guidelines (see @-included reference) as hard rules. Reference the principle number when refusing a change.
|
|
74
|
-
- Write for practitioners; no marketing language
|
|
75
|
-
- Every code example must be real (copy-paste valid)
|
|
76
|
-
- No internal company jargon without definition
|
|
77
|
-
- Link existing docs; don't duplicate
|
|
78
|
-
- Do not write code — only documentation
|
|
79
|
-
- No emojis beyond 📋
|
|
80
|
-
- No pleasantries or closing offers
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: rihal:check-implementation-readiness
|
|
3
|
-
description: Verify PRD approved, architecture approved, external deps identified, no blocking assumptions. Returns pass/fail report. Guard in plan.md and execute.md.
|
|
4
|
-
argument-hint: "[--phase <name>]"
|
|
5
|
-
allowed-tools: Read, Bash, Agent
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
@.rihal/workflows/check-implementation-readiness.md
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: rihal:karpathy-audit
|
|
3
|
-
description: Audit recent code changes against Karpathy's 4 LLM coding principles. Identifies violations and suggests improvements.
|
|
4
|
-
argument-hint: "<phase|git-ref> [--files=path1,path2]"
|
|
5
|
-
allowed-tools:
|
|
6
|
-
- Read
|
|
7
|
-
- Bash
|
|
8
|
-
- Grep
|
|
9
|
-
- Glob
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
@.rihal/workflows/karpathy-audit.md
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: rihal:new-project-roadmap
|
|
3
|
-
description: "Internal subworkflow — Requirements & roadmap phase of /rihal:new-project. Not invoked directly."
|
|
4
|
-
argument-hint: ""
|
|
5
|
-
allowed-tools:
|
|
6
|
-
- Read
|
|
7
|
-
- Bash
|
|
8
|
-
- Agent
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
@.rihal/workflows/new-project-roadmap.md
|
package/rihal/commands/report.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: rihal:review-adversarial
|
|
3
|
-
description: Produce attack/weakness report from hostile perspective — security vulnerabilities, race conditions, data loss, abuse cases. Output feeds into story AC or subtasks.
|
|
4
|
-
argument-hint: "[--phase <name>] [--component <name>]"
|
|
5
|
-
allowed-tools: Read, Glob, Grep, Agent
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
@.rihal/workflows/review-adversarial.md
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: rihal:review-edge-case-hunter
|
|
3
|
-
description: Enumerate edge cases by category (input, state, concurrency, network) with severity (critical/high/medium/low). Callable inline during code-review.md. Output feeds into story AC or subtasks.
|
|
4
|
-
argument-hint: "[--phase <name>] [--component <name>]"
|
|
5
|
-
allowed-tools: Read, Glob, Grep, Agent
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
@.rihal/workflows/review-edge-case-hunter.md
|