@hanzlaa/rcode 4.14.0 → 4.15.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.
- package/cli/install.js +93 -6
- package/cli/uninstall.js +13 -0
- package/dist/rcode.js +195 -195
- package/package.json +1 -1
- package/rcode/agents/rcode-orchestrator.md +3 -0
- package/rcode/agents/rules/orchestrator/contract.md +18 -0
- package/rcode/agents/rules/roadmapper/detailed-guide.md +4 -2
- package/rcode/agents/rules/sprint-checker/dimensions.md +45 -0
- package/rcode/agents/rules/sprint-checker/plan-quality-rubric.md +110 -0
- package/rcode/bin/lib/customize.cjs +115 -0
- package/rcode/bin/lib/memlog.cjs +124 -0
- package/rcode/bin/rcode-tools.cjs +13 -0
- package/rcode/references/agent-shared-rules.md +40 -0
- package/rcode/references/roadmapper-playbook.md +8 -0
- package/rcode/references/sprint-checker-playbook.md +11 -0
- package/rcode/references/universal-anti-patterns.md +26 -0
- package/rcode/skills/actions/4-implementation/rcode-code-review/SKILL.md +12 -5
- package/rcode/skills/actions/4-implementation/rcode-code-review/steps/step-02-review.md +61 -10
- package/rcode/skills/actions/4-implementation/rcode-code-review/steps/step-03-triage.md +28 -3
- package/rcode/skills/actions/4-implementation/rcode-code-review/workflow.md +8 -1
- package/rcode/skills/agents/haitham-frontend/SKILL.md +1 -1
- package/rcode/skills/agents/hanzla-engineer/SKILL.md +1 -1
- package/rcode/skills/agents/hussain-pm/SKILL.md +1 -1
- package/rcode/skills/agents/noor-writer/SKILL.md +2 -2
- package/rcode/skills/agents/orchestrator/SKILL.md +35 -5
- package/rcode/skills/agents/yousef-backend/SKILL.md +2 -2
- package/rcode/skills/agents/zayd-ml/SKILL.md +1 -1
- package/rcode/skills/core/rcode-help/SKILL.md +2 -1
- package/rcode/workflows/execute-sprint.md +1 -1
- package/rcode/workflows/execute.md +5 -0
- package/rcode/workflows/new-project-research-decision.md +2 -0
- package/rcode/workflows/new-project.md +5 -0
- package/rcode/workflows/plan.md +9 -0
- package/rcode/workflows/secure-phase.md +3 -1
- package/rcode/skills/rcode-init/SKILL.md +0 -134
|
@@ -7,9 +7,11 @@ failed_layers: '' # set at runtime: comma-separated list of layers that failed o
|
|
|
7
7
|
## RULES
|
|
8
8
|
|
|
9
9
|
- YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
- Each angle is a SEPARATE agent with a NARROW question. An agent asked to
|
|
11
|
+
"find problems" returns generic ones; an agent asked "what did this change
|
|
12
|
+
remove, and was every removal safe?" returns specific ones. Narrowness is the
|
|
13
|
+
whole mechanism — do not merge angles to save tokens.
|
|
14
|
+
- Angles get different context on purpose. Two of them are deliberately blind.
|
|
13
15
|
|
|
14
16
|
## INSTRUCTIONS
|
|
15
17
|
|
|
@@ -17,16 +19,65 @@ failed_layers: '' # set at runtime: comma-separated list of layers that failed o
|
|
|
17
19
|
|
|
18
20
|
2. Launch parallel subagents without conversation context. If subagents are not available, generate prompt files in `{implementation_artifacts}` — one per reviewer role below — and HALT. Ask the user to run each in a separate session (ideally a different LLM) and paste back the findings. When findings are pasted, resume from this point and proceed to step 3.
|
|
19
21
|
|
|
20
|
-
**
|
|
22
|
+
**Angles.** Three gather evidence, four exercise judgment. Run all of them in
|
|
23
|
+
parallel, in one message. They map to agents shipped in `.claude/agents/` —
|
|
24
|
+
`rcode-review-adversarial-general` and `rcode-review-edge-case-hunter` are
|
|
25
|
+
SKILLS, not subagents, and `Task(subagent_type=...)` cannot reach them.
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
`Task(subagent_type="rcode-security-adversary", model="{review_model}", prompt="<adversarial review of diff>")`. The security-adversary persona's cynical mindset is the right fit for an isolated diff-only review.
|
|
27
|
+
### Evidence angles — what is actually in this change
|
|
24
28
|
|
|
25
|
-
- **
|
|
26
|
-
|
|
29
|
+
- **scan** — `rcode-security-adversary`, diff only, NO project access.
|
|
30
|
+
*"Read this diff cold. What is wrong with it on its own terms?"* Blind on
|
|
31
|
+
purpose: an agent that can see the codebase rationalises what it finds.
|
|
27
32
|
|
|
28
|
-
- **
|
|
29
|
-
|
|
33
|
+
- **removed** — `rcode-reviewer`, diff + project read.
|
|
34
|
+
*"What did this change DELETE or stop calling, and was every removal safe?"*
|
|
35
|
+
Deletions are where regressions hide, and no reviewer asked to "review the
|
|
36
|
+
diff" ever looks at them properly — added lines are simply louder.
|
|
37
|
+
|
|
38
|
+
- **trace** — `rcode-reviewer`, diff + project read.
|
|
39
|
+
*"Pick the primary path this change touches and trace it end to end. Where
|
|
40
|
+
does the new code get called from, and what calls that?"* This is the angle
|
|
41
|
+
that catches code with no caller — the failure rcode has hit in its own
|
|
42
|
+
projects.
|
|
43
|
+
|
|
44
|
+
### Judgment angles — is this change any good
|
|
45
|
+
|
|
46
|
+
- **reuse** — `rcode-reviewer`, diff + project read.
|
|
47
|
+
*"Does this reimplement something the codebase already has?"* Look for
|
|
48
|
+
bespoke helpers duplicating a canonical one, and for logic placed outside
|
|
49
|
+
the layer that owns it.
|
|
50
|
+
|
|
51
|
+
- **simplify** — `rcode-reviewer`, diff + project read.
|
|
52
|
+
*"What would this look like with fewer moving pieces?"* Prefer
|
|
53
|
+
simplifications that REMOVE machinery over refactors that spread the same
|
|
54
|
+
complexity around. Flag thin wrappers and identity abstractions that add
|
|
55
|
+
indirection without simplifying anything. If the change missed a dramatic
|
|
56
|
+
simplification, say so plainly — a missed simplification is a finding.
|
|
57
|
+
|
|
58
|
+
- **efficiency** — `rcode-yousef`, diff + project read.
|
|
59
|
+
*"What is now O(n²), unbounded, or on the hot path that was not before?"*
|
|
60
|
+
Name the input that has to grow for it to matter. An efficiency finding
|
|
61
|
+
with no growth story is noise.
|
|
62
|
+
|
|
63
|
+
- **altitude** — `rcode-waleed`, diff + project read + the phase goal.
|
|
64
|
+
*"Is this solving the problem at the right level?"* A correct fix at the
|
|
65
|
+
wrong altitude is a symptom patch: it works, it ships, and the cause is
|
|
66
|
+
still there. Say which one this is.
|
|
67
|
+
|
|
68
|
+
- **acceptance** (only when `{review_mode}` = `"full"`) — `rcode-reviewer`,
|
|
69
|
+
diff + `{spec_file}` + context docs.
|
|
70
|
+
*"Which acceptance criterion or spec constraint does this violate?"* Cite
|
|
71
|
+
the AC id and the diff evidence.
|
|
72
|
+
|
|
73
|
+
**Every angle returns the same shape** so triage can merge them: one-line
|
|
74
|
+
title, `file:line`, a concrete failure scenario (inputs or state → wrong
|
|
75
|
+
output), and the fix. **A finding with no failure scenario is an opinion** —
|
|
76
|
+
the angle should drop it rather than pad its list.
|
|
77
|
+
|
|
78
|
+
**If subagents are unavailable:** write one prompt file per angle into
|
|
79
|
+
`{implementation_artifacts}` and HALT. Ask the user to run each in a separate
|
|
80
|
+
session (ideally a different model) and paste the findings back. Resume here.
|
|
30
81
|
|
|
31
82
|
3. **Subagent failure handling**: If any subagent fails, times out, or returns empty results, append the layer name to `{failed_layers}` (comma-separated) and proceed with findings from the remaining layers.
|
|
32
83
|
|
|
@@ -37,11 +37,36 @@
|
|
|
37
37
|
|
|
38
38
|
If `{review_mode}` = `"no-spec"` and a finding would otherwise be `decision_needed`, reclassify it as `patch` (if the fix is unambiguous) or `defer` (if not).
|
|
39
39
|
|
|
40
|
-
4. **
|
|
40
|
+
4. **Verify every surviving finding adversarially, before it reaches the user.**
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
Seven angles running in parallel produce false positives — an angle that
|
|
43
|
+
found nothing is under pressure to return something, and a confident wrong
|
|
44
|
+
finding costs the user more than a missed one, because they go and check it.
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
Spawn one verifier per `patch` and `decision_needed` finding, in parallel,
|
|
47
|
+
each with NO knowledge of the other findings and no stake in the original:
|
|
48
|
+
|
|
49
|
+
> A reviewer claims: {finding}. Prove it wrong.
|
|
50
|
+
> Read the actual code at {file:line} and the paths that reach it.
|
|
51
|
+
> Does the stated failure scenario actually occur? Walk the inputs.
|
|
52
|
+
> Return CONFIRMED with the evidence, or REFUTED with why it cannot happen.
|
|
53
|
+
|
|
54
|
+
- **REFUTED** → reclassify as `dismiss`.
|
|
55
|
+
- **CONFIRMED** → keep, and carry the verifier's evidence into the report.
|
|
56
|
+
- **Uncertain** → keep it, but mark the finding `unverified` in the output so
|
|
57
|
+
the user knows which ones were not proven. Do not silently promote an
|
|
58
|
+
uncertain finding to confirmed.
|
|
59
|
+
|
|
60
|
+
Skip verification only for `defer` findings — they are not being acted on.
|
|
61
|
+
|
|
62
|
+
5. **Drop** all `dismiss` findings. Record the dismiss count AND the refuted
|
|
63
|
+
count separately for the summary. A high refuted count is worth surfacing: it
|
|
64
|
+
means the angles are firing loosely and the review needs tightening, not that
|
|
65
|
+
the code was fine.
|
|
66
|
+
|
|
67
|
+
6. If `{failed_layers}` is non-empty, report which layers failed before announcing results. If zero findings remain after dropping dismissed AND `{failed_layers}` is non-empty, warn the user that the review may be incomplete rather than announcing a clean review.
|
|
68
|
+
|
|
69
|
+
7. If zero findings remain after triage (all rejected or none raised): state "✅ Clean review — all layers passed." (Step 3 already warned if any review layers failed via `{failed_layers}`.)
|
|
45
70
|
|
|
46
71
|
|
|
47
72
|
## NEXT
|
|
@@ -4,7 +4,14 @@ main_config: '{project-root}/.rcode/config.json'
|
|
|
4
4
|
|
|
5
5
|
# Code Review Workflow
|
|
6
6
|
|
|
7
|
-
**Goal:** Review code changes
|
|
7
|
+
**Goal:** Review code changes from seven narrow parallel angles, verify every
|
|
8
|
+
finding adversarially, and triage what survives.
|
|
9
|
+
|
|
10
|
+
**Why angles and not one reviewer:** an agent asked to "find problems" returns
|
|
11
|
+
generic ones. An agent asked "what did this change delete, and was every deletion
|
|
12
|
+
safe?" returns specific ones. The narrowness is the mechanism — three angles
|
|
13
|
+
gather evidence (a deliberately blind cold read, the removals, the call-path
|
|
14
|
+
trace) and four judge it (reuse, simplification, efficiency, altitude).
|
|
8
15
|
|
|
9
16
|
**Your Role:** You are an elite code reviewer. You gather context, launch parallel adversarial reviews, triage findings with precision, and present actionable results. No noise, no filler.
|
|
10
17
|
|
|
@@ -45,7 +45,10 @@ user-invocable: true
|
|
|
45
45
|
|
|
46
46
|
## Overview
|
|
47
47
|
|
|
48
|
-
Raees (رئيس)
|
|
48
|
+
Raees (رئيس) **owns the run**: works out who should own what, then dispatches
|
|
49
|
+
them and reports back. He reasons about every agent's authority and dependencies,
|
|
50
|
+
identifies what can run in parallel vs. what must sequence strictly, and flags
|
|
51
|
+
when a question should escalate to Majlis instead. Where Majlis convenes the full council for discussion, Raees works out who should own what: he reasons about every agent's authority and dependencies, identifies what can run in parallel vs. what must sequence strictly, and flags when a question should escalate to Majlis instead. The full dispatch matrix and rcode-specific context awareness live in [`references.md`](references.md).
|
|
49
52
|
|
|
50
53
|
**No live routing mechanism exists yet.** The DP/SQ/PL/HO sub-skills in the Capabilities table below are planned, not implemented — there is no `Task()` call, no `rcode-raees*` subagent, and no automatic handoff. Raees writes the plan; a human or another command (e.g. `/rcode-execute`) is what actually carries it out today.
|
|
51
54
|
|
|
@@ -53,7 +56,7 @@ Raees (رئيس) produces a dispatch **plan** — text output for a human (or an
|
|
|
53
56
|
|
|
54
57
|
| Code | Description | Skill |
|
|
55
58
|
|---|---|---|
|
|
56
|
-
| DP | Dispatch a request to the right specialist(s) | `
|
|
59
|
+
| DP | Dispatch a request to the right specialist(s) | `Task(subagent_type=...)` per the plan's named owners |
|
|
57
60
|
| SQ | Build an execution sequence for a multi-step request | `rcode-raees-sequence` [planned — not yet implemented] |
|
|
58
61
|
| PL | Identify parallel vs sequential work | `rcode-raees-parallel` [planned — not yet implemented] |
|
|
59
62
|
| HO | Set up an explicit handoff between two agents | `rcode-raees-handoff` [planned — not yet implemented] |
|
|
@@ -90,14 +93,41 @@ Step 3 (BLOCKING): <agent> → <skill> — gate
|
|
|
90
93
|
|
|
91
94
|
Always show: primary owner, dependencies (arrows or "blocked by"), parallel opportunities.
|
|
92
95
|
|
|
93
|
-
Save the plan to `.rcode/progress/dispatch-{date}.md
|
|
96
|
+
Save the plan to `.rcode/progress/dispatch-{date}.md`, then **carry it out**.
|
|
94
97
|
|
|
95
|
-
|
|
98
|
+
**Raees dispatches. An orchestrator that writes a plan and hands it back is a
|
|
99
|
+
planner with a different name** — and asking "shall I start?" after the user
|
|
100
|
+
already said "execute end to end" spends their turn on a question they have
|
|
101
|
+
already answered.
|
|
102
|
+
|
|
103
|
+
Present the plan and wait ONLY when one of these is true:
|
|
104
|
+
|
|
105
|
+
- **The request did not authorize execution.** "Who should own this?", "what
|
|
106
|
+
order?", "build me a dispatch plan" ask for the plan itself. Deliver it and stop.
|
|
107
|
+
- **A gate needs a human.** A checkpoint the user locked earlier (content review
|
|
108
|
+
before publish, a credential, a deploy), or an outward-facing action. Run
|
|
109
|
+
everything up to it, then stop AT the gate and say which step is blocked and why.
|
|
110
|
+
- **Scope is genuinely ambiguous** in a way that changes what gets built — not
|
|
111
|
+
merely large. Ask the one question that resolves it, not for permission.
|
|
112
|
+
|
|
113
|
+
Otherwise dispatch: spawn the named agents via `Task()`, in parallel where the
|
|
114
|
+
plan says parallel, report each dispatch as it goes out and each return as it
|
|
115
|
+
lands, and close with what changed, what is still open, and the single next step.
|
|
116
|
+
|
|
117
|
+
Two things Raees still never does: **implement anything himself** (the moment he
|
|
118
|
+
edits a file instead of dispatching, the run has no orchestrator), and **declare
|
|
119
|
+
work complete** — completion comes from the verification path, and a `passed`
|
|
120
|
+
with no `falsification: upheld` is self-certified.
|
|
121
|
+
|
|
122
|
+
Do NOT include: diffuse responsibility, unowned tasks, or silent handoffs. Do NOT synthesise strategic decisions — that's Majlis's job. Do NOT override specialist authority. Report dispatch accurately: say "dispatching X" when you are actually spawning X,
|
|
123
|
+
and "recommended: X" only when you are stopping at a gate and X has not been
|
|
124
|
+
spawned. Never claim a dispatch that did not happen, and never describe a real
|
|
125
|
+
dispatch as a recommendation.
|
|
96
126
|
|
|
97
127
|
## Examples
|
|
98
128
|
|
|
99
129
|
**Happy path — feature request**
|
|
100
|
-
"Add Arabic RTL support to our dashboard" → touches UX (Layla), FE (Haitham), BE (Yousef), QA (Fatima), localisation (Noor) → produces a 5-step plan with Layla blocking, Haitham/Yousef/Noor in parallel, Fatima gate, Khalid ship → saved to `.rcode/progress/dispatch-{date}.md
|
|
130
|
+
"Add Arabic RTL support to our dashboard" → touches UX (Layla), FE (Haitham), BE (Yousef), QA (Fatima), localisation (Noor) → produces a 5-step plan with Layla blocking, Haitham/Yousef/Noor in parallel, Fatima gate, Khalid ship → saved to `.rcode/progress/dispatch-{date}.md` → then spawns Layla, and on her return spawns Haitham/Yousef/Noor in parallel. Stops at Khalid's ship step, which is outward-facing and needs the user.
|
|
101
131
|
|
|
102
132
|
**Happy path — government proposal**
|
|
103
133
|
"Ministry of Housing wants a property management proposal" → context triggers compliance-first + Arabic-first + data residency → plan sequences: Sadiq (research) → Waleed (compliance) → parallel Mariam + Zayd → Noor (full document Arabic + English) → Sadiq final review.
|
|
@@ -3,7 +3,8 @@ name: rcode-help
|
|
|
3
3
|
description: "Answers rcode questions and recommends the next skill to run, based on current project state."
|
|
4
4
|
triggers:
|
|
5
5
|
# English
|
|
6
|
-
|
|
6
|
+
# NOTE: no bare "help" trigger. It matched almost every message, and
|
|
7
|
+
# "rcode help" already covers the intent without the false positives.
|
|
7
8
|
- "rcode help"
|
|
8
9
|
- "what should I do next"
|
|
9
10
|
- "what can rcode do"
|
|
@@ -565,7 +565,7 @@ fi
|
|
|
565
565
|
grep -A 50 "^user_setup:" .planning/phases/XX-name/{phase}-{plan}-SPRINT.md | head -50
|
|
566
566
|
```
|
|
567
567
|
|
|
568
|
-
If user_setup exists: create `{phase}-USER-SETUP.md` using
|
|
568
|
+
If user_setup exists: create `{phase}-USER-SETUP.md` using `.rcode/templates/user-setup.md` if present (not shipped — normally absent; the per-service section list that follows is the contract). Per service: env vars table, account setup checklist, dashboard config, local dev notes, verification commands. Status "Incomplete". Set `USER_SETUP_CREATED=true`. If empty/missing: skip.
|
|
569
569
|
</step>
|
|
570
570
|
|
|
571
571
|
<step name="create_summary">
|
|
@@ -41,8 +41,13 @@ a dashboard frozen at `planned`. See issue #915.
|
|
|
41
41
|
is authorized from here:
|
|
42
42
|
```bash
|
|
43
43
|
node ".rcode/bin/rcode-tools.cjs" state set-intent build --source execute.md
|
|
44
|
+
node ".rcode/bin/rcode-tools.cjs" memlog append --type event --text "Execution started for phase ${PHASE_NUMBER}" --phase "${PHASE_NUMBER}"
|
|
44
45
|
```
|
|
45
46
|
|
|
47
|
+
Log every deviation, checkpoint decision, and override with
|
|
48
|
+
`memlog append` as it happens — a deviation nobody recorded is
|
|
49
|
+
indistinguishable from a plan that was followed.
|
|
50
|
+
|
|
46
51
|
**Mandatory before execution begins.** Run these checks first and surface
|
|
47
52
|
findings BEFORE any subagents are spawned. If any check fails, stop and
|
|
48
53
|
route back to the user.
|
|
@@ -281,6 +281,8 @@ Record the answer with `state add-decision`, including the premise it rests on:
|
|
|
281
281
|
```bash
|
|
282
282
|
node ".rcode/bin/rcode-tools.cjs" state add-decision \
|
|
283
283
|
"Stack: {chosen}. Premise: {the one reason}. Confirmed by user {date}."
|
|
284
|
+
node ".rcode/bin/rcode-tools.cjs" memlog append --type decision \
|
|
285
|
+
--text "Stack: {chosen}. Premise: {the one reason}. User-confirmed at the stack gate."
|
|
284
286
|
```
|
|
285
287
|
|
|
286
288
|
### The premise is part of the decision
|
|
@@ -711,6 +711,11 @@ This document evolves at phase transitions and milestone boundaries.
|
|
|
711
711
|
5. Assumptions Index — any row still `unconfirmed` after a whole milestone is a
|
|
712
712
|
finding, not a formality. Resolve or escalate it
|
|
713
713
|
6. Key Decisions — check every premise still holds
|
|
714
|
+
7. **Memlog audit** — `rcode-tools.cjs memlog open` lists every assumption,
|
|
715
|
+
override, and blocker logged during the milestone. Walk it: each one is
|
|
716
|
+
captured in PROJECT.md, resolved, or explicitly deferred with an owner.
|
|
717
|
+
Entries that survive a whole milestone unexamined are the ones that turn into
|
|
718
|
+
"nobody knows why this is like this"
|
|
714
719
|
|
|
715
720
|
---
|
|
716
721
|
*Last updated: {date} after initialization*
|
package/rcode/workflows/plan.md
CHANGED
|
@@ -103,9 +103,18 @@ exists to prevent (see step 8).
|
|
|
103
103
|
## 0.4. Record the authorized scope
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
+
# Project overrides for this workflow — appended after everything below, and
|
|
107
|
+
# they win on conflict. The installer never writes .rcode/custom/, so these
|
|
108
|
+
# survive `rcode install`.
|
|
109
|
+
node ".rcode/bin/rcode-tools.cjs" customize resolve plan
|
|
106
110
|
node ".rcode/bin/rcode-tools.cjs" state set-intent plan --source plan.md
|
|
111
|
+
node ".rcode/bin/rcode-tools.cjs" memlog append --type event --text "Planning started for phase ${PHASE}" --phase "${PHASE}"
|
|
107
112
|
```
|
|
108
113
|
|
|
114
|
+
**Log as you go from here.** Every decision the panel forces, every checker issue
|
|
115
|
+
you accept or reject, every assumption the planner had to make — one
|
|
116
|
+
`memlog append` line each, at the moment it happens.
|
|
117
|
+
|
|
109
118
|
This is what the user asked for on THIS invocation, and it is what `resume-work`
|
|
110
119
|
will restore later. Planning does not authorize building — see step 15.
|
|
111
120
|
|
|
@@ -132,7 +132,9 @@ Handle return:
|
|
|
132
132
|
## 6. Write/Update SECURITY.md
|
|
133
133
|
|
|
134
134
|
**State B (create):**
|
|
135
|
-
1. Read
|
|
135
|
+
1. Read `.rcode/templates/SECURITY.md` **if it exists** — it is not shipped, so
|
|
136
|
+
normally it will not. Build the document from step 2's section list instead;
|
|
137
|
+
that list is the contract, the template was only ever a convenience.
|
|
136
138
|
2. Fill: frontmatter, threat register, accepted risks, audit trail
|
|
137
139
|
3. Write to `${PHASE_DIR}/${PADDED_PHASE}-SECURITY.md`
|
|
138
140
|
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: rcode-init
|
|
3
|
-
internal: true
|
|
4
|
-
description: "INTERNAL config loader for skills. Loads .rcode/ vars; lives in .rcode/skills/ not .claude/skills/."
|
|
5
|
-
argument-hint: "[--module=module_code] [--vars=var1:default1,var2] [--skill-path=/path/to/calling/skill]"
|
|
6
|
-
triggers:
|
|
7
|
-
- "init"
|
|
8
|
-
---
|
|
9
|
-
@.rcode/references/karpathy-guidelines.md
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## Overview
|
|
13
|
-
|
|
14
|
-
This skill is the configuration entry point for all rcode skills. It has two modes:
|
|
15
|
-
|
|
16
|
-
- **Fast path**: Config exists for the requested module — returns vars as JSON. Done.
|
|
17
|
-
- **Init path**: Config is missing — walks the user through configuration, writes config files, then returns vars.
|
|
18
|
-
|
|
19
|
-
Every rcode skill should call this on activation to get its config vars. The caller never needs to know whether init happened — they just get their config back.
|
|
20
|
-
|
|
21
|
-
The script `rcode_init.py` is located in this skill's `scripts/` directory. Locate and run it using python for all commands below.
|
|
22
|
-
|
|
23
|
-
## On Activation — Fast Path
|
|
24
|
-
|
|
25
|
-
Run the `rcode_init.py` script with the `load` subcommand. Pass `--project-root` set to the project root directory.
|
|
26
|
-
|
|
27
|
-
- If a module code was provided by the calling skill, include `--module {module_code}`
|
|
28
|
-
- To load all vars, include `--all`
|
|
29
|
-
- To request specific variables with defaults, use `--vars var1:default1,var2`
|
|
30
|
-
- If no module was specified, omit `--module` to get core vars only
|
|
31
|
-
|
|
32
|
-
**If the script returns JSON vars** — store them as `{var-name}` and return to the calling skill. Done.
|
|
33
|
-
|
|
34
|
-
**If the script returns an error or `init_required`** — proceed to the Init Path below.
|
|
35
|
-
|
|
36
|
-
## Init Path — First-Time Setup
|
|
37
|
-
|
|
38
|
-
When the fast path fails (config missing for a module), run this init flow.
|
|
39
|
-
|
|
40
|
-
### Step 1: Check what needs setup
|
|
41
|
-
|
|
42
|
-
Run `rcode_init.py` with the `check` subcommand, passing `--module {module_code}`, `--skill-path {calling_skill_path}`, and `--project-root`.
|
|
43
|
-
|
|
44
|
-
The response tells you what's needed:
|
|
45
|
-
|
|
46
|
-
- `"status": "ready"` — Config is fine. Re-run load.
|
|
47
|
-
- `"status": "no_project"` — Can't find project root. Ask user to confirm the project path.
|
|
48
|
-
- `"status": "core_missing"` — Core config doesn't exist. Must ask core questions first.
|
|
49
|
-
- `"status": "module_missing"` — Core exists but module config doesn't. Ask module questions.
|
|
50
|
-
|
|
51
|
-
The response includes:
|
|
52
|
-
- `core_module` — Core module.yaml questions (when core setup needed)
|
|
53
|
-
- `target_module` — Target module.yaml questions (when module setup needed, discovered from `--skill-path` or `_rcode/{module}/`)
|
|
54
|
-
- `core_vars` — Existing core config values (when core exists but module doesn't)
|
|
55
|
-
|
|
56
|
-
### Step 2: Ask core questions (if `core_missing`)
|
|
57
|
-
|
|
58
|
-
The check response includes `core_module` with header, subheader, and variable definitions.
|
|
59
|
-
|
|
60
|
-
1. Show the `header` and `subheader` to the user
|
|
61
|
-
2. For each variable, present the `prompt` and `default`
|
|
62
|
-
3. For variables with `single-select`, show the options as a numbered list
|
|
63
|
-
4. For variables with multi-line `prompt` (array), show all lines
|
|
64
|
-
5. Let the user accept defaults or provide values
|
|
65
|
-
|
|
66
|
-
### Step 3: Ask module questions (if module was requested)
|
|
67
|
-
|
|
68
|
-
The check response includes `target_module` with the module's questions. Variables may reference core answers in their defaults (e.g., `{output_folder}`).
|
|
69
|
-
|
|
70
|
-
1. Resolve defaults by running `rcode_init.py` with the `resolve-defaults` subcommand, passing `--module {module_code}`, `--core-answers '{core_answers_json}'`, and `--project-root`
|
|
71
|
-
2. Show the module's `header` and `subheader`
|
|
72
|
-
3. For each variable, present the prompt with resolved default
|
|
73
|
-
4. For `single-select` variables, show options as a numbered list
|
|
74
|
-
|
|
75
|
-
### Step 4: Write config
|
|
76
|
-
|
|
77
|
-
Collect all answers and run `rcode_init.py` with the `write` subcommand, passing `--answers '{all_answers_json}'` and `--project-root`.
|
|
78
|
-
|
|
79
|
-
The `--answers` JSON format:
|
|
80
|
-
|
|
81
|
-
```json
|
|
82
|
-
{
|
|
83
|
-
"core": {
|
|
84
|
-
"user_name": "rcode",
|
|
85
|
-
"communication_language": "English",
|
|
86
|
-
"document_output_language": "English",
|
|
87
|
-
"output_folder": "_rcode-output"
|
|
88
|
-
},
|
|
89
|
-
"bmb": {
|
|
90
|
-
"rcode_builder_output_folder": "_rcode-output/skills",
|
|
91
|
-
"rcode_builder_reports": "_rcode-output/reports"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Note: Pass the **raw user answers** (before result template expansion). The script applies result templates and `{project-root}` expansion when writing.
|
|
97
|
-
|
|
98
|
-
The script:
|
|
99
|
-
- Creates `_rcode/core/config.yaml` with core values (if core answers provided)
|
|
100
|
-
- Creates `_rcode/{module}/config.yaml` with core values + module values (result-expanded)
|
|
101
|
-
- Creates any directories listed in the module.yaml `directories` array
|
|
102
|
-
|
|
103
|
-
### Step 5: Return vars
|
|
104
|
-
|
|
105
|
-
After writing, re-run `rcode_init.py` with the `load` subcommand (same as the fast path) to return resolved vars. Store returned vars as `{var-name}` and return them to the calling skill.
|
|
106
|
-
|
|
107
|
-
## Output Format
|
|
108
|
-
|
|
109
|
-
JSON config vars returned to the calling skill. When init path runs, interactive Q&A with the user, then config files written to `_rcode/`.
|
|
110
|
-
|
|
111
|
-
## Workflow
|
|
112
|
-
|
|
113
|
-
1. Read the user request and extract key parameters.
|
|
114
|
-
2. Execute the skill logic as described in the Overview.
|
|
115
|
-
3. Return output in the format specified below.
|
|
116
|
-
|
|
117
|
-
## Examples
|
|
118
|
-
|
|
119
|
-
### Happy path (fast path)
|
|
120
|
-
**Calling skill:** invokes rcode-init with `--module bmb`
|
|
121
|
-
**Result:** Config exists → returns `{"output_folder": "_rcode-output", ...}` instantly
|
|
122
|
-
|
|
123
|
-
### Edge case (init path)
|
|
124
|
-
**Calling skill:** invokes rcode-init, no config exists
|
|
125
|
-
**Result:** Asks core questions → asks module questions → writes config → returns vars
|
|
126
|
-
|
|
127
|
-
### Negative boundary
|
|
128
|
-
**User:** "initialize my project"
|
|
129
|
-
**Result:** rcode-init is internal — user should use `rcode-scaffold-project` or `/rcode-install` instead
|
|
130
|
-
|
|
131
|
-
## Memory Bank Hooks
|
|
132
|
-
|
|
133
|
-
- **Reads:** `package.json`, existing `.rcode/state.json` to detect prior runs
|
|
134
|
-
- **Writes:** `.rcode/config.yaml`, `.rcode/state.json`, `.rcode/context/active.md`, `.rcode/context/project-brief.md`, `.rcode/JOURNEY.md`. Bootstraps the project so all subsequent rcode skills have a stable root.
|