@hanzlaa/rcode 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/README.md +2 -2
- package/cli/doctor.js +17 -0
- package/cli/github-sync.js +3 -2
- package/cli/lib/manifest.cjs +13 -0
- package/cli/set-mode.js +10 -0
- package/cli/set-profile.js +10 -0
- package/cli/uninstall.js +100 -39
- package/dist/rcode.js +215 -213
- package/package.json +1 -1
- package/rcode/skills/SKILLS_INDEX.md +4 -3
- package/rcode/skills/actions/1-analysis/rcode-document-project/SKILL.md +6 -0
- package/rcode/skills/actions/3-solutioning/rcode-check-implementation-readiness/SKILL.md +6 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/SKILL.md +162 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/references.md +136 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/backlog-building.md +113 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/composition-with-herdr.md +85 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/integration-branch.md +191 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/merge-strategy.md +113 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/orchestrator-rhythm.md +119 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/wave-design.md +100 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/BACKLOG-template.md +34 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/STATE-template.md +40 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/heartbeat.sh +29 -0
- package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/wave-prompt.md +69 -0
- package/rcode/templates/sprint.md +16 -0
- package/rcode/workflows/plan-spawn-planner.md +96 -0
- package/rcode/workflows/plan.md +67 -0
- package/server/dashboard.js +2 -2
package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/wave-prompt.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Wave-Agent Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this as the body of `herdr pane send-text` when dispatching each agent in a wave. Replace the placeholders.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
You are in an isolated worktree at <WORKTREE_PATH> on branch <BRANCH_NAME>. <REPO_NAME> repo.
|
|
9
|
+
|
|
10
|
+
YOUR PARENT BRANCH IS <INTEGRATION_BRANCH> (NOT master). Your branch was forked from <INTEGRATION_BRANCH>. When you finish, the orchestrator will merge your branch INTO <INTEGRATION_BRANCH> (not master). Master stays untouched throughout the campaign.
|
|
11
|
+
|
|
12
|
+
If you need to pull the latest parent work (rare, only between waves):
|
|
13
|
+
git fetch origin
|
|
14
|
+
git merge origin/<INTEGRATION_BRANCH> --no-edit
|
|
15
|
+
|
|
16
|
+
CAMPAIGN MODE — pick top 3-5 pending P1/P2 items from <AUDIT_DOC_PATH> and ship them. Long-running autonomous fix campaign — your branch will be merged into the campaign integration branch when done.
|
|
17
|
+
|
|
18
|
+
PROTOCOL
|
|
19
|
+
1. Read <AUDIT_DOC_PATH> fully. Identify items marked pending, ⏳, [ ], TODO, or labeled P1/P2 that are NOT already shipped (cross-reference `git log <INTEGRATION_BRANCH>` to avoid double-fixing).
|
|
20
|
+
2. Pick 3-5 items that are surgical, well-scoped, and unrelated to other in-flight campaign agents (no overlap with: <IN_FLIGHT_AREAS>).
|
|
21
|
+
3. Implement each item as a small, separately-committed change. Conventional commit format (e.g. `fix(area): summary` / `feat(area): summary`). Each commit message must reference the audit finding.
|
|
22
|
+
4. STRICT auto-heal from project CLAUDE.md while editing:
|
|
23
|
+
- super_admin in role filters
|
|
24
|
+
- no silent .catch(()=>{}) — use logger.warn with reason
|
|
25
|
+
- no React.FC, no style={{}}, no raw <button> (use Button component)
|
|
26
|
+
- no alert()/confirm() — use toast/AlertDialog
|
|
27
|
+
- Prisma schema changes need migration files via `prisma migrate dev --create-only --name <slug>`
|
|
28
|
+
- new /api routes need server/middleware/routeSecurity.js MANIFEST entries
|
|
29
|
+
5. Keep TSC at baseline. Run `pnpm tsc --noEmit` before final commit. If you introduce a NEW error, fix it before committing.
|
|
30
|
+
6. STAY on branch <BRANCH_NAME>. Do NOT push. Do NOT merge to master. Do NOT merge to <INTEGRATION_BRANCH>. Do NOT touch other audit areas.
|
|
31
|
+
7. End with a short numbered summary listing each commit (hash + one-line message) and what audit item it addressed.
|
|
32
|
+
|
|
33
|
+
DO NOT
|
|
34
|
+
- Touch master at all
|
|
35
|
+
- Merge into the integration branch (the orchestrator does that — your job is to commit on your own branch and stop)
|
|
36
|
+
- Touch out-of-scope code outside the audit area
|
|
37
|
+
- Add new abstractions or refactor wholesale
|
|
38
|
+
- Make schema changes without a migration file
|
|
39
|
+
- Write tests "as a bonus" unless the audit specifically called for them
|
|
40
|
+
- Push to origin
|
|
41
|
+
|
|
42
|
+
Begin by reading the audit doc and listing the candidate items you'll fix.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Placeholders
|
|
48
|
+
|
|
49
|
+
| Placeholder | Source |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `<WORKTREE_PATH>` | `../sm-worktrees/camp-<area>` |
|
|
52
|
+
| `<BRANCH_NAME>` | `campaign-<area>` |
|
|
53
|
+
| `<INTEGRATION_BRANCH>` | `campaign-integration` (default) or `campaign-<topic>` for named campaigns |
|
|
54
|
+
| `<REPO_NAME>` | e.g. `LeadLyze` |
|
|
55
|
+
| `<AUDIT_DOC_PATH>` | `.planning/audits/AUDIT-<area>.md` |
|
|
56
|
+
| `<IN_FLIGHT_AREAS>` | Comma-list from STATE.md |
|
|
57
|
+
|
|
58
|
+
## When to deviate from this template
|
|
59
|
+
- **Heavy schema work**: add explicit migration-naming guidance and require `prisma migrate diff` review before commit.
|
|
60
|
+
- **Pure UI/CSS area**: drop the routeSecurity MANIFEST bullet, add "use design tokens not hex codes".
|
|
61
|
+
- **Authentication / RBAC area**: add "no role-relation rename without checking every call site; super_admin always included".
|
|
62
|
+
|
|
63
|
+
## Related templates
|
|
64
|
+
- `BACKLOG-template.md` — initial backlog format
|
|
65
|
+
- `heartbeat.sh` — secondary heartbeat process
|
|
66
|
+
|
|
67
|
+
## Related rules
|
|
68
|
+
- `rules/integration-branch.md` — why the parent branch is `<INTEGRATION_BRANCH>` and not master
|
|
69
|
+
- `rules/merge-strategy.md` — what happens after sub-agent commits land on the branch
|
|
@@ -35,6 +35,22 @@
|
|
|
35
35
|
| Risk | Impact | Mitigation |
|
|
36
36
|
|------|--------|------------|
|
|
37
37
|
|
|
38
|
+
## Files Touched
|
|
39
|
+
|
|
40
|
+
<!-- Planner must populate before handoff to executor. Used by wave-overlap checker and merge reviewers. -->
|
|
41
|
+
|
|
42
|
+
**Creates:**
|
|
43
|
+
<!-- - `exact/path/new-file.ts` — one-line responsibility -->
|
|
44
|
+
|
|
45
|
+
**Modifies:**
|
|
46
|
+
<!-- - `exact/path/existing.ts` — what changes -->
|
|
47
|
+
|
|
48
|
+
**Tests:**
|
|
49
|
+
<!-- - `tests/exact/path/test.ts` — tests for -->
|
|
50
|
+
|
|
51
|
+
**Aggregator files (append-only — never replace):**
|
|
52
|
+
<!-- - `packages/shared/src/index.ts` — adds export for X -->
|
|
53
|
+
|
|
38
54
|
## Sprint Review
|
|
39
55
|
|
|
40
56
|
<!-- Fill at sprint completion only — omit this section until then -->
|
|
@@ -111,6 +111,31 @@ Output consumed by /rcode-execute. Plans need:
|
|
|
111
111
|
- Tasks in XML format with read_first, files, acceptance_criteria, verify (with `<automated>` child), and done fields (MANDATORY on every task)
|
|
112
112
|
- Verification criteria
|
|
113
113
|
- must_haves for goal-backward verification
|
|
114
|
+
- **`## Files Touched`** section (see below) — required on every SPRINT.md
|
|
115
|
+
|
|
116
|
+
### Required: ## Files Touched Section
|
|
117
|
+
|
|
118
|
+
Every SPRINT.md must end with a `## Files Touched` section that the planner populates:
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+
## Files Touched
|
|
122
|
+
|
|
123
|
+
**Creates:**
|
|
124
|
+
- `exact/path/to/new/file.ts` — [one-line responsibility]
|
|
125
|
+
|
|
126
|
+
**Modifies:**
|
|
127
|
+
- `exact/path/to/existing.ts` — [what changes]
|
|
128
|
+
|
|
129
|
+
**Tests:**
|
|
130
|
+
- `tests/exact/path/test.ts` — [tests for]
|
|
131
|
+
|
|
132
|
+
**Aggregator files (append-only):**
|
|
133
|
+
- `packages/shared/src/index.ts` — adds export for Foo, Bar
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
This section is read by the wave-overlap checker and by human reviewers to quickly audit
|
|
137
|
+
cross-sprint file ownership before merging. If a file appears in `## Files Touched` for two
|
|
138
|
+
plans in the same wave, the later plan must declare `sequential: true`.
|
|
114
139
|
</downstream_consumer>
|
|
115
140
|
|
|
116
141
|
<deep_work_rules>
|
|
@@ -133,6 +158,72 @@ Rules:
|
|
|
133
158
|
- This map is what informs task decomposition — each task should produce self-contained changes
|
|
134
159
|
- In existing codebases: follow established patterns; only restructure files if a file is genuinely unwieldy and the split is included as its own task
|
|
135
160
|
|
|
161
|
+
## File-Ownership & Conflict-Avoidance (MANDATORY)
|
|
162
|
+
|
|
163
|
+
**Evidence from overnight parallel builds (calorie-calculator-ai, 2026-05-26):**
|
|
164
|
+
- Sprints 1-2 and 3-1 both created `diary.py` with divergent content — 3-1's mock-history
|
|
165
|
+
endpoints were silently lost at merge.
|
|
166
|
+
- Sprints 3-3 and 3-4 both created `HistoryScreen.tsx` — collision required manual triage.
|
|
167
|
+
- Sprints 1-4 and 1-5 both created `CalorieRing`, `MealSlotCard`, and related components.
|
|
168
|
+
- `packages/shared/src/index.ts` was modified by 4 independent sprints — every merge required
|
|
169
|
+
conflict resolution.
|
|
170
|
+
- Wave-4 executors stubbed missing deps locally while master had an unmerged upstream; the
|
|
171
|
+
stubs collided with canonical implementations at merge.
|
|
172
|
+
|
|
173
|
+
### Cross-Sprint File Manifest (produce before task decomposition)
|
|
174
|
+
|
|
175
|
+
After the File Structure Map, build a cross-sprint ownership table:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
CROSS-SPRINT FILE MANIFEST:
|
|
179
|
+
Sprint 1: creates [path/a.ts, path/b.ts] modifies [path/c.ts]
|
|
180
|
+
Sprint 2: creates [path/d.ts] modifies [path/c.ts] ← OVERLAP on path/c.ts
|
|
181
|
+
Sprint 3: creates [path/b.ts] modifies [] ← COLLISION — b.ts in sprint 1 too
|
|
182
|
+
...
|
|
183
|
+
OWNERSHIP ASSIGNMENTS:
|
|
184
|
+
path/c.ts — sprint 1 writes canonical, sprint 2 must be sequential_after: 1
|
|
185
|
+
path/b.ts — DEFECT: only one sprint may create a file; merge or sequence
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Rules:**
|
|
189
|
+
- Only ONE sprint may _create_ a given file. Two sprints creating the same file is a plan defect — either merge the tasks into one sprint or sequence them and have the later sprint extend (not recreate).
|
|
190
|
+
- If two sprints in the same wave both _modify_ the same file, the later sprint MUST have `sequential: true` and `sequential_after: <earlier_sprint_id>` in its frontmatter.
|
|
191
|
+
- Frontmatter `files_modified:` must list ALL files from `<files>` blocks — this is the source-of-truth for the executor's intra-wave overlap checker.
|
|
192
|
+
|
|
193
|
+
### Aggregator-File Rule
|
|
194
|
+
|
|
195
|
+
These files are known aggregators — multiple sprints always want to add to them:
|
|
196
|
+
|
|
197
|
+
| Pattern | Examples |
|
|
198
|
+
|---------|---------|
|
|
199
|
+
| Barrel exports | `**/index.ts`, `**/index.tsx` |
|
|
200
|
+
| State store | `**/store/index.ts`, `**/store/index.js` |
|
|
201
|
+
| Types barrel | `**/types/index.ts`, `**/types.ts` |
|
|
202
|
+
| Python entrypoints | `main.py`, `app.py`, `router/__init__.py`, `**/__init__.py` |
|
|
203
|
+
| Package manifest | `package.json` (scripts / deps blocks) |
|
|
204
|
+
|
|
205
|
+
**Hard rule:** For aggregator files, the `<action>` block MUST say:
|
|
206
|
+
|
|
207
|
+
> "Append to existing exports — do NOT overwrite or replace the full file. Use `Edit`
|
|
208
|
+
> (old_string / new_string) with a targeted insertion. Preserve all existing content."
|
|
209
|
+
|
|
210
|
+
Never use `Write` on an aggregator file in a plan that other sprints also touch.
|
|
211
|
+
|
|
212
|
+
### Verify-Command Accuracy
|
|
213
|
+
|
|
214
|
+
In every `<verify><automated>` block, prefer `pnpm run <script>` over raw tool invocations
|
|
215
|
+
to avoid the mismatch where the planner writes `tsc --noEmit` but the project calls it `type-check`:
|
|
216
|
+
|
|
217
|
+
| Raw invocation (avoid) | pnpm script form (prefer) |
|
|
218
|
+
|------------------------|--------------------------|
|
|
219
|
+
| `tsc --noEmit` | `pnpm run type-check` or `pnpm run typecheck` |
|
|
220
|
+
| `eslint .` | `pnpm run lint` |
|
|
221
|
+
| `jest` / `vitest` | `pnpm run test` |
|
|
222
|
+
| `python -m pytest` | check `pyproject.toml` for script alias |
|
|
223
|
+
|
|
224
|
+
Check `package.json` scripts before writing a verify command. If `package.json` is not yet
|
|
225
|
+
read, add it to `<read_first>` for any task that writes a verify command.
|
|
226
|
+
|
|
136
227
|
## No-Placeholders Rule (HARD BLOCKER)
|
|
137
228
|
|
|
138
229
|
Every step must contain the actual content the executor needs. These are **plan failures** — never write them:
|
|
@@ -217,9 +308,14 @@ Every task MUST include these fields — they are NOT optional:
|
|
|
217
308
|
|
|
218
309
|
<quality_gate>
|
|
219
310
|
- [ ] File structure map written before first task (files_to_create / files_to_modify / files_for_tests)
|
|
311
|
+
- [ ] Cross-sprint file manifest built — no file in 2+ same-wave sprints without `sequential: true`
|
|
312
|
+
- [ ] No file created by more than one sprint (creation collision = plan defect)
|
|
313
|
+
- [ ] Aggregator files (index.ts, __init__.py, main.py, package.json, etc.) use append-only `Edit`, not `Write`
|
|
314
|
+
- [ ] Verify commands use `pnpm run <script>` not raw tool invocations (tsc, eslint, jest)
|
|
220
315
|
- [ ] No placeholder patterns: no TBD/TODO/implement-later, no "similar to Task N", no code steps without code
|
|
221
316
|
- [ ] SPRINT.md files created in phase directory
|
|
222
317
|
- [ ] Each plan has valid frontmatter including `files_modified:` array aggregating all `<files>` paths across tasks (consumed by execute.md intra-wave overlap checker)
|
|
318
|
+
- [ ] Each plan's `## Files Touched` section populated with create/modify/test lists
|
|
223
319
|
- [ ] Tasks are specific and actionable
|
|
224
320
|
- [ ] Every task has `<read_first>` with at least the file being modified
|
|
225
321
|
- [ ] Every task has `<files>` listing exact files this task will modify or create
|
package/rcode/workflows/plan.md
CHANGED
|
@@ -460,6 +460,73 @@ Proceed to Step 8 only if user selects 2 or 3.
|
|
|
460
460
|
|
|
461
461
|
@.rcode/workflows/plan-spawn-planner.md
|
|
462
462
|
|
|
463
|
+
## 8.5. File-Ownership & Conflict-Avoidance
|
|
464
|
+
|
|
465
|
+
After the planner returns SPRINT.md files, run these checks before advancing to step 9.
|
|
466
|
+
These rules were added after overnight parallel builds exposed silent merge-time data loss
|
|
467
|
+
(calorie-calculator-ai, 2026-05-26). The wave-overlap CLI check in step 12.5 catches
|
|
468
|
+
same-wave/same-file issues mechanically; this step catches plan-level ownership gaps earlier.
|
|
469
|
+
|
|
470
|
+
**Step 1 — Build the cross-sprint file manifest.**
|
|
471
|
+
|
|
472
|
+
Read each SPRINT.md produced this run and collect its `files_modified:` frontmatter list.
|
|
473
|
+
Produce a de-duplicated map: `file → [sprint_ids that touch it]`.
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
# Quick grep of frontmatter to build the manifest
|
|
477
|
+
grep -A 50 "^files_modified:" "${PHASE_DIR}"/*-SPRINT.md 2>/dev/null
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
**Step 2 — Flag collisions.**
|
|
481
|
+
|
|
482
|
+
For each file that appears in 2+ sprint lists:
|
|
483
|
+
|
|
484
|
+
| Type | Rule |
|
|
485
|
+
|------|------|
|
|
486
|
+
| Two sprints **create** the same file | Plan defect — merge tasks or sequence; only one sprint may create a file |
|
|
487
|
+
| Two same-wave sprints **modify** the same file | Later sprint MUST have `sequential: true` + `sequential_after:` in frontmatter |
|
|
488
|
+
| An aggregator file touched by multiple sprints | Each sprint's `<action>` must use append-only `Edit`, not `Write` |
|
|
489
|
+
|
|
490
|
+
Aggregator patterns (known high-collision targets):
|
|
491
|
+
- `**/index.ts`, `**/index.tsx` (barrel exports)
|
|
492
|
+
- `**/store/index.ts`, `**/store/index.js`
|
|
493
|
+
- `**/types/index.ts`, `**/types.ts`
|
|
494
|
+
- `main.py`, `app.py`, `router/__init__.py`, `**/__init__.py`
|
|
495
|
+
- `package.json` (scripts / deps blocks)
|
|
496
|
+
|
|
497
|
+
**Step 3 — Verify-command accuracy.**
|
|
498
|
+
|
|
499
|
+
Scan every `<verify><automated>` block for raw tool invocations (`tsc --noEmit`, `eslint .`,
|
|
500
|
+
`jest`, `vitest`). If found, check `package.json` scripts and replace with the `pnpm run <script>`
|
|
501
|
+
equivalent. Mismatch example from overnight build: plan wrote `tsc --noEmit` but the project's
|
|
502
|
+
script was named `type-check`.
|
|
503
|
+
|
|
504
|
+
**Step 4 — Report and gate.**
|
|
505
|
+
|
|
506
|
+
If any creation collision found → **BLOCK plan acceptance**. Edit the colliding sprint to remove
|
|
507
|
+
the duplicate creation task (have the second sprint import/extend from the first sprint's output).
|
|
508
|
+
|
|
509
|
+
If any modify-collision found in the same wave → edit the later sprint's frontmatter immediately:
|
|
510
|
+
```yaml
|
|
511
|
+
sequential: true
|
|
512
|
+
sequential_after: <earlier_sprint_id>
|
|
513
|
+
conflicting_files: [<shared_files...>]
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
Display a summary:
|
|
517
|
+
```
|
|
518
|
+
File-Ownership Check:
|
|
519
|
+
✓ N files with single owner
|
|
520
|
+
⚠ M aggregator files — append-only instructions verified
|
|
521
|
+
✗ K creation collisions (blocked — fixed inline)
|
|
522
|
+
~ J sequential flags added
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
If no issues: `File-Ownership Check: ✓ no collisions.`
|
|
526
|
+
|
|
527
|
+
**This check is informational for warnings and blocking for creation collisions.**
|
|
528
|
+
It never silently passes a plan where two sprints create the same file.
|
|
529
|
+
|
|
463
530
|
## 9. Handle Planner Return
|
|
464
531
|
|
|
465
532
|
- **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): skip to step 13. Otherwise: step 10.
|
package/server/dashboard.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* server/lib/html/client.js - Client-side JS (routing, rendering, etc.)
|
|
18
18
|
*
|
|
19
19
|
* Run: node server/dashboard.js
|
|
20
|
-
* Stop: kill $(
|
|
20
|
+
* Stop: kill $(ss -ltnp 'sport = :7717' | awk 'NR>1{match($6,/pid=([0-9]+)/,m); print m[1]}')
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
const http = require('http');
|
|
@@ -145,7 +145,7 @@ server.listen(PORT, '127.0.0.1', () => {
|
|
|
145
145
|
console.log(` Scanning: ${RCODE_DIR}`);
|
|
146
146
|
console.log(` Refresh: 30s soft poll`);
|
|
147
147
|
console.log(` Keys: R=refresh 1-9=views F=filter`);
|
|
148
|
-
console.log(` Stop: kill $(
|
|
148
|
+
console.log(` Stop: kill $(ss -ltnp 'sport = :${PORT}' | awk 'NR>1{match($6,/pid=([0-9]+)/,m); print m[1]}')`);
|
|
149
149
|
console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`);
|
|
150
150
|
});
|
|
151
151
|
|