@hanzlaa/rcode 2.2.0 → 2.3.2

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 (143) hide show
  1. package/CLAUDE.md +15 -0
  2. package/CONTRIBUTING.md +138 -0
  3. package/README.md +74 -15
  4. package/cli/install.js +312 -80
  5. package/cli/postinstall.js +4 -4
  6. package/cli/uninstall.js +8 -0
  7. package/dist/rcode.js +19777 -0
  8. package/package.json +18 -5
  9. package/rihal/DOCS-AUDIT.md +14 -0
  10. package/rihal/agents/rihal-code-reviewer.md +1 -1
  11. package/rihal/agents/rihal-codebase-mapper.md +1 -1
  12. package/rihal/agents/rihal-docs-auditor.md +1 -1
  13. package/rihal/agents/rihal-edge-case-hunter.md +1 -1
  14. package/rihal/agents/rihal-executor.md +2 -1
  15. package/rihal/agents/rihal-hussain-pm.md +1 -0
  16. package/rihal/agents/rihal-nyquist-auditor.md +1 -1
  17. package/rihal/agents/rihal-phase-researcher.md +2 -2
  18. package/rihal/agents/rihal-planner.md +3 -2
  19. package/rihal/agents/rihal-roadmapper.md +1 -0
  20. package/rihal/agents/rihal-security-adversary.md +1 -1
  21. package/rihal/agents/rihal-security-auditor.md +1 -1
  22. package/rihal/agents/rihal-sprint-checker.md +1 -1
  23. package/rihal/agents/rihal-verifier.md +1 -1
  24. package/rihal/bin/lib/roadmap.cjs +2 -3
  25. package/rihal/bin/rihal-tools.cjs +11 -31
  26. package/rihal/brain/best-practices/no-theoretical-suggestions.md +56 -0
  27. package/rihal/commands/add-phase.md +2 -2
  28. package/rihal/commands/audit.md +8 -0
  29. package/rihal/commands/checkpoint-preview.md +13 -0
  30. package/rihal/commands/cleanup.md +2 -2
  31. package/rihal/commands/config.md +4 -4
  32. package/rihal/commands/pr-branch.md +2 -2
  33. package/rihal/commands/prfaq.md +15 -0
  34. package/rihal/commands/remove-phase.md +2 -2
  35. package/rihal/commands/research-phase.md +2 -2
  36. package/rihal/commands/settings.md +2 -2
  37. package/rihal/commands/ship.md +15 -3
  38. package/rihal/commands/validate-phase.md +1 -1
  39. package/rihal/commands/verify-phase.md +2 -2
  40. package/rihal/references/agent-contracts.md +12 -0
  41. package/rihal/references/karpathy-guidelines-full.md +79 -0
  42. package/rihal/references/karpathy-guidelines.md +8 -76
  43. package/rihal/references/model-profile-resolution.md +8 -0
  44. package/rihal/references/phase-argument-parsing.md +11 -0
  45. package/rihal/references/revision-loop.md +11 -0
  46. package/rihal/references/universal-anti-patterns.md +15 -0
  47. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/SKILL.md +11 -0
  48. package/rihal/skills/actions/1-analysis/research/rihal-market-research/SKILL.md +11 -0
  49. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/SKILL.md +13 -0
  50. package/rihal/skills/actions/1-analysis/rihal-document-project/SKILL.md +11 -0
  51. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +12 -0
  52. package/rihal/skills/actions/1-analysis/rihal-product-brief/SKILL.md +7 -0
  53. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +15 -1
  54. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +21 -1
  55. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-10-complete.md +1 -1
  56. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +26 -0
  57. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +16 -2
  58. package/rihal/skills/actions/2-plan/rihal-create-ux-design/SKILL.md +12 -0
  59. package/rihal/skills/actions/2-plan/rihal-edit-prd/SKILL.md +11 -0
  60. package/rihal/skills/actions/2-plan/rihal-frontend-design/SKILL.md +13 -0
  61. package/rihal/skills/actions/2-plan/rihal-validate-prd/SKILL.md +12 -0
  62. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/SKILL.md +12 -0
  63. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/SKILL.md +14 -0
  64. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/SKILL.md +12 -0
  65. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +16 -0
  66. package/rihal/skills/actions/4-implementation/rihal-code-review/SKILL.md +12 -0
  67. package/rihal/skills/actions/4-implementation/rihal-correct-course/SKILL.md +13 -0
  68. package/rihal/skills/actions/4-implementation/rihal-dev-story/SKILL.md +12 -0
  69. package/rihal/skills/actions/4-implementation/rihal-qa-generate-e2e-tests/SKILL.md +12 -0
  70. package/rihal/skills/actions/4-implementation/rihal-retrospective/SKILL.md +11 -0
  71. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/SKILL.md +10 -0
  72. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +14 -1
  73. package/rihal/skills/actions/4-implementation/rihal-sprint-status/SKILL.md +10 -0
  74. package/rihal/skills/agents/ahmed-hassani-director/SKILL.md +13 -1
  75. package/rihal/skills/agents/fatima-qa/SKILL.md +14 -1
  76. package/rihal/skills/agents/haitham-frontend/SKILL.md +15 -1
  77. package/rihal/skills/agents/hanzla-engineer/SKILL.md +14 -1
  78. package/rihal/skills/agents/hussain-pm/SKILL.md +22 -1
  79. package/rihal/skills/agents/hussain-sm/SKILL.md +22 -1
  80. package/rihal/skills/agents/layla-designer/SKILL.md +15 -1
  81. package/rihal/skills/agents/majlis-council/SKILL.md +14 -1
  82. package/rihal/skills/agents/mariam-marketing/SKILL.md +15 -1
  83. package/rihal/skills/agents/nasser-eng-manager/SKILL.md +14 -1
  84. package/rihal/skills/agents/noor-writer/SKILL.md +14 -1
  85. package/rihal/skills/agents/raees-orchestrator/SKILL.md +13 -1
  86. package/rihal/skills/agents/sadiq-analyst/SKILL.md +15 -1
  87. package/rihal/skills/agents/waleed-architect/SKILL.md +16 -1
  88. package/rihal/skills/agents/yousef-backend/SKILL.md +16 -1
  89. package/rihal/skills/agents/zahra-branding/SKILL.md +15 -1
  90. package/rihal/skills/agents/zayd-ml/SKILL.md +17 -1
  91. package/rihal/skills/core/rihal-advanced-elicitation/SKILL.md +12 -0
  92. package/rihal/skills/core/rihal-brainstorming/SKILL.md +16 -0
  93. package/rihal/skills/core/rihal-clone-website/SKILL.md +21 -0
  94. package/rihal/skills/core/rihal-distillator/SKILL.md +8 -0
  95. package/rihal/skills/core/rihal-editorial-review-prose/SKILL.md +12 -0
  96. package/rihal/skills/core/rihal-editorial-review-structure/SKILL.md +18 -0
  97. package/rihal/skills/core/rihal-help/SKILL.md +12 -0
  98. package/rihal/skills/core/rihal-index-docs/SKILL.md +18 -0
  99. package/rihal/skills/core/rihal-init/SKILL.md +8 -0
  100. package/rihal/skills/core/rihal-party-mode/SKILL.md +14 -0
  101. package/rihal/skills/core/rihal-review-adversarial-general/SKILL.md +12 -0
  102. package/rihal/skills/core/rihal-review-edge-case-hunter/SKILL.md +18 -0
  103. package/rihal/skills/core/rihal-shard-doc/SKILL.md +18 -0
  104. package/rihal/team.yaml +205 -0
  105. package/rihal/templates/UAT.md +29 -0
  106. package/rihal/templates/milestone.md +2 -0
  107. package/rihal/templates/sprint.md +11 -28
  108. package/rihal/templates/summary.md +30 -0
  109. package/rihal/templates/verification-report.md +28 -0
  110. package/rihal/workflows/audit-milestone.md +34 -2
  111. package/rihal/workflows/audit.md +172 -0
  112. package/rihal/workflows/autonomous.md +67 -0
  113. package/rihal/workflows/checkpoint-preview.md +7 -0
  114. package/rihal/workflows/council.md +3 -1
  115. package/rihal/workflows/debug.md +8 -1
  116. package/rihal/workflows/diagnose-issues.md +34 -0
  117. package/rihal/workflows/do.md +47 -3
  118. package/rihal/workflows/document-project.md +1 -1
  119. package/rihal/workflows/execute-sprint.md +11 -4
  120. package/rihal/workflows/execute.md +9 -3
  121. package/rihal/workflows/help.md +1 -1
  122. package/rihal/workflows/karpathy-audit.md +7 -14
  123. package/rihal/workflows/pause-work.md +7 -1
  124. package/rihal/workflows/prfaq.md +7 -0
  125. package/rihal/workflows/profile-user.md +2 -2
  126. package/rihal/workflows/settings.md +116 -117
  127. package/rihal/workflows/ship.md +31 -1
  128. package/rihal/workflows/sprint-planning.md +39 -8
  129. package/rihal/workflows/status.md +5 -0
  130. package/rihal/workflows/ui-phase.md +3 -3
  131. package/rihal/workflows/update.md +80 -22
  132. package/rihal/workflows/validate-phase.md +7 -1
  133. package/server/dashboard.js +34 -575
  134. package/server/lib/api.js +123 -0
  135. package/server/lib/html/client.js +969 -0
  136. package/server/lib/html/css.js +416 -0
  137. package/server/lib/html/shell.js +230 -0
  138. package/server/lib/scanner.js +142 -0
  139. package/rihal/agents/rihal-ui-designer.md +0 -6
  140. package/rihal/skills/core/rihal-advanced-elicitation/rihal-advanced-elicitation/SKILL.md +0 -148
  141. package/rihal/skills/core/rihal-advanced-elicitation/rihal-advanced-elicitation/methods.csv +0 -51
  142. package/rihal/skills/core/rihal-shard-doc/rihal-shard-doc/SKILL.md +0 -122
  143. package/rihal/workflows/config.md +0 -105
package/package.json CHANGED
@@ -1,22 +1,25 @@
1
1
  {
2
2
  "name": "@hanzlaa/rcode",
3
- "version": "2.2.0",
4
- "description": "Rihal Code (rcode) — installable context-brain for Rihalians. 44 agents, 93 slash commands, 58 skills, pullable Rihal standards. Unified install for Claude Code, Cursor, and Gemini.",
3
+ "version": "2.3.2",
4
+ "description": "Rihal Code (rcode) — installable context-brain for Rihalians. 44 agents, 98 slash commands, 56 skills, pullable Rihal standards. Unified install for Claude Code, Cursor, and Gemini.",
5
5
  "main": "cli/index.js",
6
6
  "bin": {
7
- "rcode": "cli/index.js",
8
- "rihal-code": "cli/index.js"
7
+ "rcode": "dist/rcode.js",
8
+ "rihal-code": "dist/rcode.js"
9
9
  },
10
10
  "scripts": {
11
11
  "dashboard": "node server/dashboard.js",
12
12
  "test": "node --test",
13
13
  "test:ci": "node --test --test-reporter=spec",
14
- "postinstall": "node cli/postinstall.js"
14
+ "postinstall": "node cli/postinstall.js",
15
+ "build:cli": "node scripts/build.cjs",
16
+ "build": "node scripts/build.cjs"
15
17
  },
16
18
  "files": [
17
19
  "cli/",
18
20
  "rihal/",
19
21
  "server/",
22
+ "dist/",
20
23
  ".rihal-template/",
21
24
  "README.md",
22
25
  "AGENTS.md",
@@ -54,6 +57,16 @@
54
57
  "node": ">=18.0.0"
55
58
  },
56
59
  "dependencies": {},
60
+ "devDependencies": {
61
+ "esbuild": "^0.25.0",
62
+ "picocolors": "^1.1.1",
63
+ "nanospinner": "^1.2.2",
64
+ "fast-glob": "^3.3.3",
65
+ "zod": "^3.24.0",
66
+ "semver": "^7.7.1",
67
+ "diff": "^7.0.0",
68
+ "@clack/prompts": "^0.9.1"
69
+ },
57
70
  "publishConfig": {
58
71
  "access": "public"
59
72
  }
@@ -0,0 +1,14 @@
1
+ # DOCS-AUDIT.md (per-project artefact)
2
+
3
+ This file is generated by `/rihal:document-project` into the project root
4
+ as `DOCS-AUDIT.md`. The shipped reference here just defines the schema:
5
+
6
+ - **Inventory:** every doc file (path, last-touched, owner, freshness).
7
+ - **Gaps:** docs that should exist per the project's domain (e.g. README,
8
+ CONTRIBUTING, ADRs for major decisions) but don't.
9
+ - **Stale:** docs that diverge from current code/state (links to dead
10
+ files, version mismatches, removed features still documented).
11
+ - **Recommendations:** ordered remediation list.
12
+
13
+ Workflows that @-include this file expect the live audit output, which
14
+ the workflow itself writes to disk before reading.
@@ -6,7 +6,7 @@ color: purple
6
6
  ---
7
7
 
8
8
  @.rihal/references/response-style.md
9
- @.rihal/references/karpathy-guidelines.md
9
+ @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/no-unauthorized-git-ops.md
11
11
 
12
12
  # Rihal Code Reviewer
@@ -7,7 +7,7 @@ color: cyan
7
7
 
8
8
 
9
9
  @.rihal/references/response-style.md
10
- @.rihal/references/karpathy-guidelines.md
10
+ @.rihal/references/karpathy-guidelines-full.md
11
11
 
12
12
  <role>
13
13
  You are a rihal codebase mapper. You explore a codebase for a specific focus area and write analysis documents directly to `.rihal/codebase/`.
@@ -6,7 +6,7 @@ color: gold
6
6
  ---
7
7
 
8
8
  @.rihal/references/response-style.md
9
- @.rihal/references/karpathy-guidelines.md
9
+ @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/no-unauthorized-git-ops.md
11
11
 
12
12
  # Rihal Documentation Auditor
@@ -6,7 +6,7 @@ color: maroon
6
6
  ---
7
7
 
8
8
  @.rihal/references/response-style.md
9
- @.rihal/references/karpathy-guidelines.md
9
+ @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/no-unauthorized-git-ops.md
11
11
 
12
12
  # Rihal Edge Case Hunter
@@ -6,9 +6,10 @@ color: yellow
6
6
  ---
7
7
 
8
8
  @.rihal/references/response-style.md
9
- @.rihal/references/karpathy-guidelines.md
9
+ @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/output-realism.md
11
11
  @.rihal/references/no-unauthorized-git-ops.md
12
+ @.rihal/brain/best-practices/no-theoretical-suggestions.md
12
13
 
13
14
  <role>
14
15
  Rihal sprint executor. Execute SPRINT.md files atomically, commit each story, handle deviations, pause at checkpoints, produce SUMMARY.md.
@@ -7,6 +7,7 @@ color: orange
7
7
 
8
8
  @.rihal/references/response-style.md
9
9
  @.rihal/references/codebase-grounding.md
10
+ @.rihal/references/karpathy-guidelines.md
10
11
 
11
12
  # Hussain-PM — Product Manager
12
13
 
@@ -6,7 +6,7 @@ color: #8B5CF6
6
6
  ---
7
7
 
8
8
  @.rihal/references/response-style.md
9
- @.rihal/references/karpathy-guidelines.md
9
+ @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/no-unauthorized-git-ops.md
11
11
 
12
12
  <role>
@@ -7,8 +7,8 @@ color: cyan
7
7
 
8
8
 
9
9
  @.rihal/references/response-style.md
10
-
11
-
10
+ @.rihal/references/karpathy-guidelines.md
11
+ @.rihal/brain/best-practices/no-theoretical-suggestions.md
12
12
 
13
13
  <role>
14
14
  You are a Rihal phase researcher. You answer "What do I need to know to PLAN this phase well?" and produce a single RESEARCH.md that the planner consumes.
@@ -6,8 +6,9 @@ color: green
6
6
  ---
7
7
 
8
8
  @.rihal/references/response-style.md
9
- @.rihal/references/karpathy-guidelines.md
9
+ @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/output-realism.md
11
+ @.rihal/brain/best-practices/no-theoretical-suggestions.md
11
12
 
12
13
  <role>
13
14
  Rihal sprint planner. Create executable SPRINT.md files with story breakdown, dependency analysis, and goal-backward verification.
@@ -129,7 +130,7 @@ Output: [Artifacts created]
129
130
  </objective>
130
131
 
131
132
  <execution_context>
132
- @.rihal/workflows/execute-plan.md
133
+ @.rihal/workflows/execute.md
133
134
  @.rihal/templates/summary.md
134
135
  </execution_context>
135
136
 
@@ -8,6 +8,7 @@ color: purple
8
8
 
9
9
  @.rihal/references/response-style.md
10
10
  @.rihal/references/output-realism.md
11
+ @.rihal/references/karpathy-guidelines.md
11
12
 
12
13
  <role>
13
14
  You are a rihal roadmapper. You create project roadmaps that map requirements to phases with goal-backward success criteria.
@@ -6,7 +6,7 @@ color: darkred
6
6
  ---
7
7
 
8
8
  @.rihal/references/response-style.md
9
- @.rihal/references/karpathy-guidelines.md
9
+ @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/no-unauthorized-git-ops.md
11
11
 
12
12
  # Rihal Security Adversary
@@ -6,7 +6,7 @@ color: purple
6
6
  ---
7
7
 
8
8
  @.rihal/references/response-style.md
9
- @.rihal/references/karpathy-guidelines.md
9
+ @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/no-unauthorized-git-ops.md
11
11
 
12
12
  # Rihal Security Auditor
@@ -7,7 +7,7 @@ color: green
7
7
 
8
8
 
9
9
  @.rihal/references/response-style.md
10
- @.rihal/references/karpathy-guidelines.md
10
+ @.rihal/references/karpathy-guidelines-full.md
11
11
 
12
12
  <role>
13
13
  You are a Rihal sprint checker. Verify that sprints WILL achieve the phase goal, not just that they look complete.
@@ -6,7 +6,7 @@ color: green
6
6
  ---
7
7
 
8
8
  @.rihal/references/response-style.md
9
- @.rihal/references/karpathy-guidelines.md
9
+ @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/no-unauthorized-git-ops.md
11
11
 
12
12
  <role>
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * Roadmap — Rihal ROADMAP.md parsing and mutation helpers.
3
3
  *
4
- * Self-contained (stdlib only). Matches GSD output shapes for the subset of
5
- * commands that Rihal workflows currently invoke: get-phase, list-phases,
6
- * update-plan-progress, and clear.
4
+ * Self-contained (stdlib only). Subcommands invoked by Rihal workflows:
5
+ * get-phase, list-phases, update-plan-progress, clear.
7
6
  */
8
7
 
9
8
  const fs = require('fs');
@@ -1950,7 +1950,7 @@ function cmdState(subArgs) {
1950
1950
  // --- promote-backlog <from> --to <target> ---
1951
1951
  // Promote a 999.x parking-lot phase to a real phase number.
1952
1952
  // Mutates state.phases[]; renames the on-disk directory if present.
1953
- // Tracks issue #159 (M2.5 — GSD-parity 999.x convention).
1953
+ // Tracks issue #159 (M2.5 — 999.x parking-lot convention).
1954
1954
  if (sub === 'promote-backlog') {
1955
1955
  const from = subArgs[1];
1956
1956
  const flags = parseFlags(2);
@@ -2568,8 +2568,12 @@ function cmdResolveModel(agentId) {
2568
2568
  }
2569
2569
 
2570
2570
  /**
2571
- * config set --key <k> --value <v> — update a key in .rihal/config.yaml
2572
- * Writes YAML-style `key: value` (quotes strings with spaces).
2571
+ * config set --key <k> --value <v> — DEPRECATED legacy form.
2572
+ *
2573
+ * Closes #233. The original implementation used a flat YAML parser that
2574
+ * destroyed the nested `workflow:` and `git:` sections on every save.
2575
+ * This shim now delegates to the nested-safe writer in lib/config.cjs and
2576
+ * emits a one-line deprecation warning to stderr so callers migrate.
2573
2577
  */
2574
2578
  function cmdConfigSet(subArgs) {
2575
2579
  const flags = {};
@@ -2587,34 +2591,10 @@ function cmdConfigSet(subArgs) {
2587
2591
  if (!key) throw new Error('config set requires --key <key> --value <value>\n e.g. config set --key language --value Arabic');
2588
2592
  if (!value) throw new Error('config set requires --key <key> --value <value>\n e.g. config set --key language --value Arabic');
2589
2593
 
2590
- const configPath = path.join(RIHAL_DIR, 'config.yaml');
2591
- fs.mkdirSync(RIHAL_DIR, { recursive: true });
2592
-
2593
- let content = '';
2594
- if (fs.existsSync(configPath)) {
2595
- content = fs.readFileSync(configPath, 'utf8');
2596
- }
2597
-
2598
- // Parse current config
2599
- const config = parseSimpleYaml(content);
2600
-
2601
- // Update the key
2602
- config[key] = value;
2603
-
2604
- // Serialize back to YAML
2605
- const lines = [];
2606
- for (const [k, v] of Object.entries(config)) {
2607
- const needsQuotes = /\s/.test(v);
2608
- const yamlValue = needsQuotes ? `"${v.replace(/"/g, '\\"')}"` : v;
2609
- lines.push(`${k}: ${yamlValue}`);
2610
- }
2611
-
2612
- const newContent = lines.join('\n') + '\n';
2613
- const tmp = configPath + '.tmp';
2614
- fs.writeFileSync(tmp, newContent, 'utf8');
2615
- fs.renameSync(tmp, configPath);
2594
+ process.stderr.write(`[deprecated] 'config set --key X --value Y' — use 'config-set X Y' instead (preserves nested YAML).\n`);
2616
2595
 
2617
- return { ok: true, key, value, path: configPath };
2596
+ const cfg = require(path.join(__dirname, 'lib', 'config.cjs'));
2597
+ return cfg.cmdSet(PROJECT_ROOT, key, value);
2618
2598
  }
2619
2599
 
2620
2600
  /**
@@ -3033,7 +3013,7 @@ function cmdBrain(args) {
3033
3013
  }
3034
3014
 
3035
3015
  /**
3036
- * cmdProgress — single pre-computed progress blob (GSD-parity, issue #159).
3016
+ * cmdProgress — single pre-computed progress blob (issue #159).
3037
3017
  *
3038
3018
  * Subcommands:
3039
3019
  * progress init Full snapshot — everything /rihal:progress needs.
@@ -0,0 +1,56 @@
1
+ # No Theoretical Suggestions Rule
2
+
3
+ Referenced by all agents that propose plans, file changes, or implementation steps.
4
+
5
+ ## The Rule
6
+
7
+ **Every suggestion, plan, or implementation step must be grounded in what actually exists in the codebase.** Never propose a change based on assumed structure, naming conventions, documentation, or what "probably" exists.
8
+
9
+ ## What This Means in Practice
10
+
11
+ Before including any file path, function name, config key, or field in a plan:
12
+
13
+ 1. Confirm it exists — use `Read`, `grep`, `find`, or `glob`.
14
+ 2. If it doesn't exist, say so explicitly: "this doesn't exist yet."
15
+ 3. Only then decide whether to create it (if the user asked) or report the gap (if they didn't).
16
+
17
+ ## The Test
18
+
19
+ Could every line of your plan be traced to a specific file and line number in the repo right now? If not, the plan contains theoretical content — do not ship it.
20
+
21
+ ## Failure Pattern to Avoid
22
+
23
+ - Agent reads an investigation doc or workflow description.
24
+ - Agent produces a plan based on what the doc *says* should exist.
25
+ - Agent never verifies the described files/fields/functions actually exist.
26
+ - Plan references symbols that are missing, misnamed, or not yet implemented.
27
+ - Execution fails or produces wrong results.
28
+
29
+ This pattern is forbidden. Investigation documents describe intent, not ground truth. Code is ground truth.
30
+
31
+ ## Correct Behavior
32
+
33
+ ```
34
+ # WRONG — theoretical
35
+ "Fix the force_web_search toggle in backend/config.py"
36
+ (without checking if force_web_search actually exists in that file)
37
+
38
+ # RIGHT — grounded
39
+ grep -r "force_web_search" backend/
40
+ → no results
41
+ → "force_web_search doesn't exist in the codebase yet. The investigation doc was theoretical. Here's what actually exists: ..."
42
+ ```
43
+
44
+ ## When You Can't Find Something
45
+
46
+ - Do NOT assume it's in a different file or under a different name.
47
+ - Do NOT write a plan that assumes you'll find it later.
48
+ - STOP and report: "I searched for X and found nothing. Either it doesn't exist yet or the investigation was theoretical."
49
+
50
+ ## Applies To
51
+
52
+ - `rihal-planner` — every task in SPRINT.md must reference real files
53
+ - `rihal-executor` — read the target file before writing any change
54
+ - `rihal-phase-researcher` — cite actual code paths, not presumed ones
55
+ - `rihal-sprint-checker` — flag plans that reference non-existent symbols
56
+ - All council agents — proposals must name real constraints, not theoretical ones
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rihal:add-phase
3
- description: Execute add-phase workflow
4
- argument-hint: ""
3
+ description: "Add a new integer phase to the end of the current milestone. Auto-calculates the next phase number, creates the phase directory, and updates ROADMAP.md. Use when scope expands mid-milestone."
4
+ argument-hint: "<phase-name>"
5
5
  allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: rihal:audit
3
+ description: Single audit entry point — asks what to audit (phase, milestone, UAT, code, fix, work) and dispatches to the right subroute. Honours .rihal/config.yaml mode.
4
+ argument-hint: "[phase | milestone | uat | code | fix | work] [...subroute args]"
5
+ allowed-tools: Read, Write, Bash, AskUserQuestion
6
+ ---
7
+
8
+ @.rihal/workflows/audit.md
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: rihal:checkpoint-preview
3
+ description: Human-in-the-loop change review — makes sense of a diff, focuses attention where it matters, and walks through testing. Use when you say "checkpoint", "walk me through this", or "human review".
4
+ argument-hint: "[<branch-or-diff>]"
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Grep
9
+ - Glob
10
+ - AskUserQuestion
11
+ ---
12
+
13
+ @.rihal/workflows/checkpoint-preview.md
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rihal:cleanup
3
- description: Execute cleanup workflow
4
- argument-hint: ""
3
+ description: "Archive completed milestone phase directories into .planning/milestones/. Run after /rihal:complete-milestone to keep .planning/ tidy. Shows a dry-run summary before moving anything."
4
+ argument-hint: "[--dry-run]"
5
5
  allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion, Agent
6
6
  ---
7
7
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: rihal:config
3
- description: View or edit Rihal configuration (language, mode, model profile, branching strategy)
4
- argument-hint: "[show | set <key> <value>]"
5
- allowed-tools: Read, Bash, AskUserQuestion
3
+ description: Alias for /rihal:settings — view or edit Rihal config (language, mode, model profile, workflow gates, git strategy)
4
+ argument-hint: "[show | get <key> | set <key> <value>]"
5
+ allowed-tools: Read, Write, Bash, AskUserQuestion
6
6
  ---
7
7
 
8
- @.rihal/workflows/config.md
8
+ @.rihal/workflows/settings.md
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rihal:pr-branch
3
- description: Execute pr-branch workflow
4
- argument-hint: ""
3
+ description: "Create a clean PR branch that strips all Rihal planning artifacts (.planning/, SPRINT.md, SUMMARY.md, STATE.md). Reviewers see only code changes. Use before /rihal:ship when you want a clean git history in the PR."
4
+ argument-hint: "[<base-branch>]"
5
5
  allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: rihal:prfaq
3
+ description: Working Backwards PRFAQ challenge — stress-test a product concept by writing the press release before building it. Produces a battle-hardened PRFAQ document + PRD distillate.
4
+ argument-hint: "[<idea>] [--headless] [--customer=<persona>] [--problem=<problem>] [--stakes=<why>] [--solution=<concept>]"
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Write
9
+ - Agent
10
+ - AskUserQuestion
11
+ - WebSearch
12
+ - WebFetch
13
+ ---
14
+
15
+ @.rihal/workflows/prfaq.md
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rihal:remove-phase
3
- description: Execute remove-phase workflow
4
- argument-hint: ""
3
+ description: "Remove an unstarted future phase from ROADMAP.md, delete its directory, and renumber all subsequent phases to maintain a clean sequence. Cannot remove a phase already in progress or completed."
4
+ argument-hint: "<phase-number>"
5
5
  allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rihal:research-phase
3
- description: Execute research-phase workflow
4
- argument-hint: ""
3
+ description: "Research how to implement a phase before planning. Spawns rihal-phase-researcher with phase context. Standalone tool — /rihal:plan already runs this automatically. Use only when you want research without immediately creating a plan."
4
+ argument-hint: "<phase-number>"
5
5
  allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rihal:settings
3
- description: Interactive configuration wizard for Rihal project settings. Update model profile, research strategy, execution gates, and branching strategy.
4
- argument-hint: ""
3
+ description: View or edit Rihal project settings (mode, model_profile, workflow gates, git strategy). Supports show / get / set / interactive modes.
4
+ argument-hint: "[show | get <key> | set <key> <value>]"
5
5
  allowed-tools: Read, Write, Bash, AskUserQuestion
6
6
  ---
7
7
 
@@ -1,12 +1,24 @@
1
1
  ---
2
2
  name: rihal:ship
3
- description: Execute ship workflow
4
- argument-hint: ""
3
+ description: "After a phase is verified, create a PR: push branch, auto-generate PR body from planning artifacts (ROADMAP, VERIFICATION, SUMMARY), and optionally request review. Closes the plan→execute→verify→ship loop."
4
+ argument-hint: "[<phase>] [--draft]"
5
5
  allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
8
8
  <objective>
9
- Execute ship workflow
9
+ Ship a completed, verified phase by pushing its feature branch and opening a
10
+ pull request with an auto-generated body drawn from planning artifacts.
11
+
12
+ **When to use:**
13
+ - You have finished `/rihal:execute <phase>` and `/rihal:verify-phase <phase>` passed
14
+ - You want to open a PR from your feature branch into main/develop
15
+ - You want the PR body auto-filled with phase goal, changes, requirements addressed, and verification status
16
+
17
+ **When NOT to use:**
18
+ - Publishing a package to npm → use `npm publish` directly
19
+ - Tagging a release → use `git tag` + `git push --tags`
20
+ - You are inside the rihal-code framework repo itself (no phases exist here)
21
+ - Your project uses `git.branching_strategy: none` and you commit directly to main
10
22
  </objective>
11
23
 
12
24
  <execution_context>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rihal:validate-phase
3
3
  description: Audit Nyquist validation gaps for a completed phase. Generate missing tests. Update VALIDATION.md.
4
- argument-hint: ""
4
+ argument-hint: "<phase-number>"
5
5
  allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion, Agent
6
6
  ---
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rihal:verify-phase
3
- description: Verify phase goal achievement through goal-backward analysis. Check that the codebase delivers what the phase promised,
4
- argument-hint: ""
3
+ description: "Goal-backward audit does the codebase actually deliver what the phase promised? Produces VERIFICATION.md with pass/fail. Required before /rihal:ship. Run after /rihal:execute completes."
4
+ argument-hint: "<phase-number>"
5
5
  allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion, Agent
6
6
  ---
7
7
 
@@ -0,0 +1,12 @@
1
+ # Agent Contracts
2
+
3
+ Conventions Rihal sub-agents follow when invoked from a workflow.
4
+
5
+ - **Input**: a single prompt string. The orchestrator passes structured data
6
+ inline (path lists, JSON blobs) — sub-agents do not stream args.
7
+ - **Output**: one final message back to the orchestrator. No partial state
8
+ is visible mid-run.
9
+ - **Side effects**: each agent's tool list is its full surface — any tool
10
+ not granted in the agent definition is unavailable.
11
+ - **Failure**: agents that hit an obstacle return a structured "blocked"
12
+ message rather than fabricating output.
@@ -0,0 +1,79 @@
1
+ # Karpathy Coding Guidelines
2
+
3
+ Behavioral guidelines derived from [Andrej Karpathy's observations](https://x.com/karpathy/status/2015883857489522876) on LLM coding pitfalls. Every rihal agent that writes, reviews, or refactors code must internalize these four principles.
4
+
5
+ **Tradeoff:** These bias toward caution over speed. For trivial tasks, use judgment.
6
+
7
+ ## 1. Think Before Coding
8
+
9
+ **Don't assume. Don't hide confusion. Surface tradeoffs.**
10
+
11
+ Before implementing:
12
+ - State assumptions explicitly. If uncertain, ask.
13
+ - If multiple interpretations exist, present them — don't pick silently.
14
+ - If a simpler approach exists, say so. Push back when warranted.
15
+ - If something is unclear, stop. Name what's confusing. Ask.
16
+
17
+ **Rihal application:** In Round 1 of council/chain, every agent's response must include an `## Assumptions` block listing load-bearing assumptions. rihal-planner must ask via AskUserQuestion before writing a plan when scope is ambiguous. rihal-executor must stop on Rule 4 deviations and return a checkpoint, not silently guess.
18
+
19
+ ## 2. Simplicity First
20
+
21
+ **Minimum code that solves the problem. Nothing speculative.**
22
+
23
+ - No features beyond what was asked.
24
+ - No abstractions for single-use code.
25
+ - No "flexibility" or "configurability" that wasn't requested.
26
+ - No error handling for impossible scenarios.
27
+ - If you write 200 lines and it could be 50, rewrite it.
28
+
29
+ Test: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
30
+
31
+ **Rihal application:** rihal-planner tasks must be single-purpose. rihal-executor must not add abstractions during task execution (deviation Rule 2 applies only to missing critical functionality, not speculative flexibility). rihal-code-review explicitly flags overengineering.
32
+
33
+ ## 3. Surgical Changes
34
+
35
+ **Touch only what you must. Clean up only your own mess.**
36
+
37
+ When editing existing code:
38
+ - Don't "improve" adjacent code, comments, or formatting.
39
+ - Don't refactor things that aren't broken.
40
+ - Match existing style, even if you'd do it differently.
41
+ - If you notice unrelated dead code, mention it — don't delete it.
42
+
43
+ When your changes create orphans:
44
+ - Remove imports/variables/functions that YOUR changes made unused.
45
+ - Don't remove pre-existing dead code unless asked.
46
+
47
+ The test: Every changed line should trace directly to the user's request.
48
+
49
+ **Rihal application:** rihal-executor commits must only include files its tasks touched. The deviation scope boundary (out-of-scope warnings logged to deferred-items.md, not fixed) enforces this. rihal-code-review-fix must not change style in files it's auditing.
50
+
51
+ ## 4. Goal-Driven Execution
52
+
53
+ **Define success criteria. Loop until verified.**
54
+
55
+ Transform tasks into verifiable goals:
56
+ - "Add validation" → "Write tests for invalid inputs, then make them pass"
57
+ - "Fix the bug" → "Write a test that reproduces it, then make it pass"
58
+ - "Refactor X" → "Ensure tests pass before and after"
59
+
60
+ For multi-step tasks, state a brief plan:
61
+ ```
62
+ 1. [Step] → verify: [check]
63
+ 2. [Step] → verify: [check]
64
+ ```
65
+
66
+ Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
67
+
68
+ **Rihal application:** Every task in a SPRINT.md must have a "Done when:" clause that's externally verifiable. rihal-executor self-check loop verifies Done-when conditions were met. rihal-sprint-checker rejects plans where tasks have vague success criteria.
69
+
70
+ ## Enforcement
71
+
72
+ Agents that write or modify code (rihal-executor, rihal-planner, rihal-tech-writer, rihal-codebase-mapper when producing code docs) must:
73
+ 1. @-include this file
74
+ 2. Apply the 4 principles as hard constraints, not suggestions
75
+ 3. Reference the specific principle when refusing to make a change (e.g., "Declining per Karpathy #3: that's adjacent to the requested change but not part of it")
76
+
77
+ ## Credit
78
+
79
+ Original principles by Andrej Karpathy. Reference implementation by Forrest Chang at github.com/forrestchang/andrej-karpathy-skills. Adapted and extended for rihal's multi-agent architecture.