@hanzlaa/rcode 2.2.0 → 2.3.1

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 (72) hide show
  1. package/CONTRIBUTING.md +138 -0
  2. package/README.md +76 -17
  3. package/cli/install.js +312 -80
  4. package/cli/uninstall.js +8 -0
  5. package/dist/rcode.js +19777 -0
  6. package/package.json +17 -4
  7. package/rihal/DOCS-AUDIT.md +14 -0
  8. package/rihal/agents/rihal-code-reviewer.md +1 -1
  9. package/rihal/agents/rihal-codebase-mapper.md +1 -1
  10. package/rihal/agents/rihal-docs-auditor.md +1 -1
  11. package/rihal/agents/rihal-edge-case-hunter.md +1 -1
  12. package/rihal/agents/rihal-executor.md +1 -1
  13. package/rihal/agents/rihal-hussain-pm.md +1 -0
  14. package/rihal/agents/rihal-nyquist-auditor.md +1 -1
  15. package/rihal/agents/rihal-phase-researcher.md +1 -2
  16. package/rihal/agents/rihal-planner.md +1 -1
  17. package/rihal/agents/rihal-roadmapper.md +1 -0
  18. package/rihal/agents/rihal-security-adversary.md +1 -1
  19. package/rihal/agents/rihal-security-auditor.md +1 -1
  20. package/rihal/agents/rihal-sprint-checker.md +1 -1
  21. package/rihal/agents/rihal-verifier.md +1 -1
  22. package/rihal/bin/lib/roadmap.cjs +2 -3
  23. package/rihal/bin/rihal-tools.cjs +11 -31
  24. package/rihal/commands/audit.md +8 -0
  25. package/rihal/commands/checkpoint-preview.md +13 -0
  26. package/rihal/commands/config.md +4 -4
  27. package/rihal/commands/prfaq.md +15 -0
  28. package/rihal/commands/settings.md +2 -2
  29. package/rihal/references/agent-contracts.md +12 -0
  30. package/rihal/references/karpathy-guidelines-full.md +79 -0
  31. package/rihal/references/karpathy-guidelines.md +8 -76
  32. package/rihal/references/model-profile-resolution.md +8 -0
  33. package/rihal/references/phase-argument-parsing.md +11 -0
  34. package/rihal/references/revision-loop.md +11 -0
  35. package/rihal/references/universal-anti-patterns.md +15 -0
  36. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +10 -0
  37. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +3 -1
  38. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +3 -1
  39. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-10-complete.md +1 -1
  40. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +13 -0
  41. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +4 -2
  42. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +10 -0
  43. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +3 -1
  44. package/rihal/skills/agents/hussain-pm/SKILL.md +8 -0
  45. package/rihal/skills/agents/hussain-sm/SKILL.md +8 -0
  46. package/rihal/templates/UAT.md +29 -0
  47. package/rihal/templates/milestone.md +2 -0
  48. package/rihal/templates/sprint.md +11 -28
  49. package/rihal/templates/summary.md +30 -0
  50. package/rihal/templates/verification-report.md +28 -0
  51. package/rihal/workflows/audit-milestone.md +34 -2
  52. package/rihal/workflows/audit.md +172 -0
  53. package/rihal/workflows/autonomous.md +67 -0
  54. package/rihal/workflows/checkpoint-preview.md +7 -0
  55. package/rihal/workflows/council.md +3 -1
  56. package/rihal/workflows/debug.md +8 -1
  57. package/rihal/workflows/diagnose-issues.md +34 -0
  58. package/rihal/workflows/do.md +47 -3
  59. package/rihal/workflows/execute-sprint.md +11 -4
  60. package/rihal/workflows/execute.md +9 -3
  61. package/rihal/workflows/karpathy-audit.md +7 -14
  62. package/rihal/workflows/pause-work.md +7 -1
  63. package/rihal/workflows/prfaq.md +7 -0
  64. package/rihal/workflows/profile-user.md +2 -2
  65. package/rihal/workflows/settings.md +116 -118
  66. package/rihal/workflows/sprint-planning.md +39 -8
  67. package/rihal/workflows/status.md +5 -0
  68. package/rihal/workflows/ui-phase.md +3 -3
  69. package/rihal/workflows/update.md +80 -22
  70. package/rihal/workflows/validate-phase.md +7 -1
  71. package/rihal/agents/rihal-ui-designer.md +0 -6
  72. 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",
3
+ "version": "2.3.1",
4
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.",
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,7 +6,7 @@ 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
12
 
@@ -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,7 @@ color: cyan
7
7
 
8
8
 
9
9
  @.rihal/references/response-style.md
10
-
11
-
10
+ @.rihal/references/karpathy-guidelines.md
12
11
 
13
12
  <role>
14
13
  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,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/output-realism.md
11
11
 
12
12
  <role>
@@ -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,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,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
@@ -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: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
 
@@ -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.
@@ -1,79 +1,11 @@
1
- # Karpathy Coding Guidelines
1
+ # Karpathy Guidelines — Quick Reference
2
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.
3
+ Four hard constraints for every agent that writes, reviews, or modifies code or artifacts.
4
+ Full text with Rihal-specific application notes: `@.rihal/references/karpathy-guidelines-full.md`
4
5
 
5
- **Tradeoff:** These bias toward caution over speed. For trivial tasks, use judgment.
6
+ 1. **Think first (P1)** State assumptions explicitly before acting. If scope is ambiguous, ask. Never guess silently.
7
+ 2. **Simplicity (P2)** — Minimum code/scope that solves the problem. No speculative features, abstractions, or error handling for impossible cases.
8
+ 3. **Surgical (P3)** — Touch only what the task requires. Don't improve adjacent code, don't refactor what isn't broken.
9
+ 4. **Goal-driven (P4)** — Define a verifiable success criterion before starting. "Done when: X can be verified externally."
6
10
 
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.
11
+ When refusing a change, cite the principle: `"Declining per Karpathy P3 — that's adjacent to the requested change."`
@@ -0,0 +1,8 @@
1
+ # Model Profile Resolution
2
+
3
+ Workflows pick a model via `node .rihal/bin/rihal-tools.cjs resolve-model
4
+ <role>`, which reads `.rihal/config.yaml` `model_profile` and returns the
5
+ concrete model id for that role per `rihal/config/model-profiles.json`.
6
+
7
+ If `model_profile` is unset, default is `balanced`. Unknown profile falls
8
+ back to `balanced` with a stderr warning.
@@ -0,0 +1,11 @@
1
+ # Phase Argument Parsing
2
+
3
+ Workflows accept a phase argument in two forms:
4
+
5
+ - **Numeric**: `01`, `2`, `02.1` — resolved via
6
+ `node .rihal/bin/rihal-tools.cjs init phase-op "$ARG"` to the matching
7
+ phase directory under `.planning/phases/`.
8
+ - **Path**: a direct `.planning/phases/<slug>/PLAN.md` path — used as-is.
9
+
10
+ If the resolver returns `phase_found: false`, workflows must STOP with a
11
+ "phase not found" message rather than fabricating a target.
@@ -0,0 +1,11 @@
1
+ # Plan Revision Loop
2
+
3
+ When `workflow.plan_checker` is enabled (`/rihal:settings`), `/rihal:plan`
4
+ runs the rihal-plan-checker after the planner. Findings drive a bounded
5
+ revision loop:
6
+
7
+ 1. Planner produces PLAN.md.
8
+ 2. Plan-checker scores against goal-backward criteria.
9
+ 3. If BLOCK / FLAG: planner revises with the findings as added input.
10
+ 4. Up to 2 revision rounds. After that, surface to user for manual
11
+ confirmation rather than loop indefinitely.
@@ -0,0 +1,15 @@
1
+ # Universal Anti-Patterns (Discuss-Phase)
2
+
3
+ Common failure modes the discuss workflow checks for:
4
+
5
+ - **Solution-first framing**: jumping to implementation before constraints
6
+ are explicit.
7
+ - **Hidden binary choice**: presenting a "decision" that has only one
8
+ viable option.
9
+ - **Unowned action**: a "we should X" with no owner or deadline.
10
+ - **Sunk-cost continuation**: defending an existing plan instead of
11
+ evaluating fresh evidence.
12
+ - **Scope inflation**: bundling new work into the current decision.
13
+
14
+ Discuss-phase flags any of these and asks for explicit framing before
15
+ proceeding.
@@ -3,6 +3,16 @@ name: rihal-prfaq
3
3
  description: Working Backwards PRFAQ challenge to forge product concepts. Use when the user requests to 'create a PRFAQ', 'work backwards', or 'run the PRFAQ challenge'.
4
4
  ---
5
5
 
6
+ ## Do NOT use this skill for
7
+
8
+ - **Refining an existing PRD** — use `rihal-create-prd` or `rihal-edit-prd`.
9
+ - **Brainstorming raw ideas** before there's a concept — use `rihal-brainstorming` first; PRFAQ assumes a candidate concept exists.
10
+ - **Sprint or phase planning** — use `rihal-sprint-planning` / `rihal-create-milestone`.
11
+ - **Pure market research with no product hypothesis** — use a research workflow.
12
+ - **Single-question Q&A** — PRFAQ runs a multi-stage gauntlet; for a one-off answer, just answer.
13
+
14
+ If the user asks to "validate" or "polish" an existing PRD, redirect to `rihal-validate-prd`.
15
+
6
16
  ## Workflow
7
17
 
8
18
 
@@ -15,9 +15,11 @@ Follow the instructions in ./workflow.md.
15
15
  ## Output Format
16
16
 
17
17
  - Produces .rihal/phases/{phase}/epics.md with hierarchical structure
18
- - Each epic has: Title | Goal | Stories (list) | Priority | Estimate
18
+ - Each epic has: Title | Goal | Assumptions | Stories (list) | Priority | Estimate
19
19
  - Each story is independently testable and under 4-hour estimate
20
20
  - Do NOT create epics larger than 10 stories — split further
21
+ - Every epic must include an `Assumptions` line — at minimum one entry; "none" is not acceptable
22
+ - Every story must have a one-line verifiable AC before being listed — vague stories get flagged and blocked
21
23
 
22
24
  ## Examples
23
25
 
@@ -15,10 +15,12 @@ Follow the instructions in ./workflow.md.
15
15
  ## Output Format
16
16
 
17
17
  - Output: ROADMAP.md in `{planning_artifacts}/`
18
- - Structure: per milestone — Name, Window (dates), Goal (one sentence), Acceptance criteria, Kill criteria (binary), Phases (stub list), then a trailing Backlog / parking lot section
18
+ - Structure: per milestone — Name, Window (dates), Goal (one sentence), Assumptions, Acceptance criteria, Kill criteria (binary), Phases (stub list), then a trailing Backlog / parking lot section
19
19
  - Each kill criterion must be binary (number + threshold), not adjectival
20
20
  - Every milestone has an explicit window with start + end dates
21
+ - Every milestone must include an `Assumptions` block — decisions that, if wrong, invalidate this milestone's scope
21
22
  - Do NOT include: unquantified success language ("grow the user base"), open-ended milestones without dates, or more than 6 active milestones in one roadmap (split into v1/v2 if needed)
23
+ - If a milestone goal cannot be expressed as a single verifiable sentence, split it into two milestones
22
24
 
23
25
  ## Examples
24
26
 
@@ -33,7 +33,7 @@ Hard deadline: {deadline or "none specified"}
33
33
  [{completedAt}]
34
34
  ```
35
35
 
36
- ### 3. Next-step menu (intent-based, mirrors the GSD /progress Route A/B/C pattern)
36
+ ### 3. Next-step menu (intent-based Route A/B/C pattern)
37
37
 
38
38
  ```
39
39
  What's next?