@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.
Files changed (29) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +2 -2
  3. package/cli/doctor.js +17 -0
  4. package/cli/github-sync.js +3 -2
  5. package/cli/lib/manifest.cjs +13 -0
  6. package/cli/set-mode.js +10 -0
  7. package/cli/set-profile.js +10 -0
  8. package/cli/uninstall.js +100 -39
  9. package/dist/rcode.js +215 -213
  10. package/package.json +1 -1
  11. package/rcode/skills/SKILLS_INDEX.md +4 -3
  12. package/rcode/skills/actions/1-analysis/rcode-document-project/SKILL.md +6 -0
  13. package/rcode/skills/actions/3-solutioning/rcode-check-implementation-readiness/SKILL.md +6 -0
  14. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/SKILL.md +162 -0
  15. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/references.md +136 -0
  16. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/backlog-building.md +113 -0
  17. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/composition-with-herdr.md +85 -0
  18. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/integration-branch.md +191 -0
  19. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/merge-strategy.md +113 -0
  20. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/orchestrator-rhythm.md +119 -0
  21. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/wave-design.md +100 -0
  22. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/BACKLOG-template.md +34 -0
  23. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/STATE-template.md +40 -0
  24. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/heartbeat.sh +29 -0
  25. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/wave-prompt.md +69 -0
  26. package/rcode/templates/sprint.md +16 -0
  27. package/rcode/workflows/plan-spawn-planner.md +96 -0
  28. package/rcode/workflows/plan.md +67 -0
  29. package/server/dashboard.js +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzlaa/rcode",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "rcode — the AI team that never forgets. Persistent memory, specialist agents, and slash commands for AI IDEs. Works in Claude Code, Cursor, Gemini, VS Code, and Antigravity.",
5
5
  "main": "cli/index.js",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  # rcode — Skills Index
2
2
 
3
- All 85 skills in rcode, organized by category: 23 agent skills, 37 action skills, 25 core skills, plus 2 shared modules.
3
+ All 86 skills in rcode, organized by category: 23 agent skills, 38 action skills, 25 core skills, plus 2 shared modules.
4
4
 
5
5
  ## Agent Skills (23)
6
6
 
@@ -36,7 +36,7 @@ Note: Hussain has two hats — **PM** (strategic product management) and **SM**
36
36
 
37
37
  ---
38
38
 
39
- ## Action Skills (37)
39
+ ## Action Skills (38)
40
40
 
41
41
  Invoked by agents via the capabilities table in their SKILL.md. Organized by SDLC phase.
42
42
 
@@ -63,7 +63,7 @@ Invoked by agents via the capabilities table in their SKILL.md. Organized by SDL
63
63
  - `actions/3-solutioning/rcode-check-implementation-readiness` — verify PRD/UX/arch alignment
64
64
  - `actions/3-solutioning/rcode-generate-project-context` — generate project-context.md
65
65
 
66
- ### 4 — Implementation (20)
66
+ ### 4 — Implementation (21)
67
67
  - `actions/4-implementation/rcode-dev-story` — execute a story (write tests + code)
68
68
  - `actions/4-implementation/rcode-review` — comprehensive code review
69
69
  - `actions/4-implementation/rcode-qa-generate-e2e-tests` — generate e2e test suite
@@ -84,6 +84,7 @@ Invoked by agents via the capabilities table in their SKILL.md. Organized by SDL
84
84
  - `actions/4-implementation/rcode-prove-it` — test-first development
85
85
  - `actions/4-implementation/rcode-source-truth` — cite official docs before writing framework code
86
86
  - `actions/4-implementation/rcode-trim` — code simplification
87
+ - `actions/4-implementation/rcode-herdr-orchestration` — orchestrate parallel cld agents in herdr; single-shot fan-out OR long-running autonomous wave-based fix campaign with durable backlog + integration branch + heartbeat
87
88
 
88
89
  ---
89
90
 
@@ -27,6 +27,12 @@ Analyze an existing codebase and produce documentation for both human and LLM co
27
27
 
28
28
  Follow the instructions in ./workflow.md.
29
29
 
30
+ ## When NOT to use this skill
31
+
32
+ Do NOT use for writing net-new documentation from scratch (use a write-document prompt).
33
+ Do NOT invoke when the user wants to document a single file or function — scope this skill
34
+ to whole-codebase or whole-module brownfield analysis only.
35
+
30
36
  ## Output Format
31
37
 
32
38
  - Produces multi-file documentation: README summary, ARCHITECTURE.md, CONVENTIONS.md, project-context.md
@@ -28,6 +28,12 @@ Verify that PRD, UX designs, architecture decisions, and epics/stories are all a
28
28
 
29
29
  Follow the instructions in ./workflow.md.
30
30
 
31
+ ## When NOT to use this skill
32
+
33
+ Do NOT use during active implementation — if work is already in progress, use
34
+ `rcode-correct-course` instead. Do NOT invoke for a single-artifact review (e.g. "check
35
+ this PRD"); scope this skill to cross-artifact alignment checks before a phase starts.
36
+
31
37
  ## Output Format
32
38
 
33
39
  - Produces an alignment report with checklist format
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: rcode-herdr-orchestration
3
+ description: Orchestrate parallel cld agents in herdr — single-shot fan-out OR long-running autonomous wave-based fix campaign with durable backlog and integration branch. Do NOT use for a single quick task; invoke directly without herdr for that.
4
+ triggers:
5
+ # English — single-shot orchestration
6
+ - "orchestrate agents"
7
+ - "run agents in herdr"
8
+ - "parallel audit"
9
+ - "spin up agents"
10
+ - "use herdr to do"
11
+ - "split work across panes"
12
+ - "fan out work in herdr"
13
+ - "multi-agent in herdr"
14
+ # English — autonomous campaign mode
15
+ - "autonomous fix campaign"
16
+ - "auto mode"
17
+ - "auto loop"
18
+ - "run waves of agents"
19
+ - "dispatch waves"
20
+ - "100+ commits"
21
+ - "keep working until done"
22
+ - "complete site audit and fix"
23
+ # Roman Urdu / Hindi
24
+ - "herdr mein chalao"
25
+ - "parallel agents lagao"
26
+ - "panes mein todo"
27
+ - "ek saath kai agents"
28
+ - "auto mode chalao"
29
+ - "waves mein fix karo"
30
+ - "campaign chalao"
31
+ # Arabic native
32
+ - "شغّل وكلاء بالتوازي"
33
+ - "وزّع العمل على عدة وكلاء"
34
+ - "استخدم herdr"
35
+ - "حملة إصلاح تلقائية"
36
+ - "موجات من الوكلاء"
37
+ - "وضع تلقائي"
38
+ user-invocable: true
39
+ ---
40
+
41
+ # rcode-herdr-orchestration
42
+
43
+ ## Overview
44
+
45
+ Run many Claude agents in parallel inside `herdr` (terminal agent multiplexer), monitor
46
+ them, and merge their work back safely.
47
+
48
+ Two modes: **single-shot** (bounded fan-out, one sitting, merge back done) and
49
+ **autonomous campaign** (100+ commits across waves with durable backlog and integration
50
+ branch). Both share the same golden rules and pane mechanics. See `references.md` for
51
+ the full campaign workflow and deep-dive rules.
52
+
53
+ ---
54
+
55
+ ## Golden rules (NON-NEGOTIABLE — apply to BOTH modes)
56
+
57
+ 1. **Use `cld`, never `claude`.** `cld` is the alias for
58
+ `claude --dangerously-skip-permissions`. Send it via `herdr pane send-text` + `send-keys Enter`
59
+ so the shell alias resolves. Do NOT use `herdr pane run` for `cld`.
60
+ 2. **If you must invoke `claude` directly** (alias unavailable): pass
61
+ `--dangerously-skip-permissions` AND run in **interactive mode** (no `-p`/`--print`).
62
+ A non-interactive `claude -p` call is invisible to herdr.
63
+ 3. **One git worktree per agent.** Never share a working tree between orchestrated agents.
64
+ 4. **Work locally, commit locally. Never push to origin or deploy** during an
65
+ orchestration run unless the user explicitly authorizes it afterward.
66
+ 5. **The orchestrator NEVER claims a wakeup it cannot fire.** `ScheduleWakeup` only
67
+ fires when `/loop` is active — clarify the heartbeat path with the user first.
68
+ 6. **Ignore stray buffer text in panes.** Leftover user text at an idle prompt is NOT
69
+ an agent question — do not Enter it.
70
+
71
+ ---
72
+
73
+ ## herdr CLI reference
74
+
75
+ ```bash
76
+ herdr workspace list
77
+ herdr tab list --workspace <wid>
78
+ herdr tab create --workspace <wid> --label "X" --cwd PATH --focus
79
+ herdr tab close <tab_id> # IDs RENUMBER after a close — re-list
80
+ herdr pane list --workspace <wid> # pane_id, label, agent_status
81
+ herdr pane split <pane_id> --direction right|down --cwd PATH --no-focus
82
+ herdr pane rename <pane_id> "Label"
83
+ herdr pane read <pane_id> --source visible|recent --lines N --format text
84
+ herdr pane send-text <pane_id> "text" # types text (no newline)
85
+ herdr pane send-keys <pane_id> Enter|C-c|BSpace
86
+ ```
87
+
88
+ `agent_status`: `working`, `blocked` (waiting on question/permission), `idle`/`done`, `unknown`.
89
+
90
+ ---
91
+
92
+ ## MODE 1 — Single-shot orchestration
93
+
94
+ Use when work is bounded and can finish in one batch.
95
+
96
+ **Steps:**
97
+ 1. Decide N areas (4 per tab default — 2×2 grid). Each area = one agent = one worktree = one branch.
98
+ 2. Create worktrees: `git worktree add ../sm-worktrees/$A -b audit-$A master` for each area.
99
+ 3. Create tab + split panes, one per worktree.
100
+ 4. Launch `cld` in every pane (`send-text "cld"` + `send-keys Enter`). Sleep 7s after.
101
+ 5. Send each agent a self-contained prompt with worktree path, branch, and task.
102
+ - Audits: diagnose-only first. Fixes: incremental edits, no rewrites, commit each fix.
103
+ 6. Monitor: `herdr pane list` every ~2 min. Unblock stuck panes via `send-keys`/`send-text`.
104
+ 7. Merge back: `git add -f .planning/audits/*.md && git commit` inside each worktree, then
105
+ `git merge <branch> --no-edit` from main repo. Verify `pnpm tsc --noEmit` count unchanged.
106
+ 8. Cleanup: `git worktree remove --force` each tree. Close herdr tab (re-list IDs first).
107
+
108
+ ---
109
+
110
+ ## MODE 2 — Autonomous campaign (summary)
111
+
112
+ Use for `100+ commits`, `keep working until done`, `complete site audit and fix`.
113
+ Full Phase 0-3 protocol, integration-branch rules, wave cadence, and anti-patterns are
114
+ in **`references.md`** (sibling file). Key constraints:
115
+
116
+ - Maintain one `campaign-integration` branch; sub-agents fork from it, never master.
117
+ - Wave size: 3-5 agents, 10-15 min per wave. ScheduleWakeup ends EVERY turn.
118
+ - Phase 3: show user the full diff + ask explicitly how to land (PR / merge / squash / leave).
119
+ - Never push to origin master without an explicit yes — per campaign, not per session.
120
+
121
+ ---
122
+
123
+ ## When NOT to use this skill
124
+
125
+ - A single, quick, one-agent task — just run it directly on the main tree, no herdr.
126
+ - Anything the user wants to step through interactively — orchestration is for parallel,
127
+ hands-off batches.
128
+
129
+ ---
130
+
131
+ ## Output Format
132
+
133
+ **Single-shot:** one worktree per agent on `audit-<area>` branch, per-area audit doc at
134
+ `.planning/audits/AUDIT-<area>.md` (committed via `git add -f`), work merged back to
135
+ calling branch with commits preserved.
136
+
137
+ **Campaign:** durable backlog at `.planning/campaign/BACKLOG.md`, state log at
138
+ `.planning/campaign/STATE.md`, one long-lived `campaign-integration` branch accumulating
139
+ wave merges — master NOT touched until Phase 3 with explicit user consent.
140
+
141
+ In both modes, orchestrator chat output is concise wave/pane status only.
142
+
143
+ ---
144
+
145
+ ## Examples
146
+
147
+ **Happy path — single-shot 4-area parallel audit:**
148
+ User: "Fan out a security audit across the auth, API, DB, and frontend areas in parallel."
149
+ Orchestrator creates 4 worktrees on branches `audit-auth`, `audit-api`, `audit-db`,
150
+ `audit-frontend`. Sends each agent: "You are in `../sm-worktrees/auth` on branch
151
+ `audit-auth`. Diagnose security issues — report findings to `.planning/audits/AUDIT-auth.md`,
152
+ no code changes yet." Monitors until all idle, merges branches, confirms TSC count stable.
153
+
154
+ **Edge case — sub-agent goes silent past wave duration:**
155
+ If `herdr pane list` shows a pane stuck `working` past 25 min: `herdr pane read <id>` —
156
+ usually an AskUserQuestion blocking. Pick the safe option via `send-keys`. If still stuck
157
+ after another 10 min, `C-c` the pane, note the partial work, revert the branch, and
158
+ re-dispatch the item in the next wave.
159
+
160
+ **Negative example — when NOT to invoke this skill:**
161
+ User: "Fix the typo in README line 4." This is a one-line edit. Invoke herdr orchestration
162
+ for this is overkill — just edit the file directly on the current branch.
@@ -0,0 +1,136 @@
1
+ # rcode-herdr-orchestration — References
2
+
3
+ Overflow content split from SKILL.md per the 200-line budget. Read SKILL.md first.
4
+
5
+ ---
6
+
7
+ ## MODE 2 — Full campaign workflow
8
+
9
+ ### Extra hard rules (rules 7-11, in addition to the 6 golden rules in SKILL.md)
10
+
11
+ 7. **Durable backlog.** Commit `.planning/campaign/BACKLOG.md` at campaign start so the
12
+ campaign survives auto-compact. Don't keep the work list in conversation memory only.
13
+ 8. **Campaign integration branch.** Maintain ONE long-lived branch (default
14
+ `campaign-integration`). Sub-agents always fork from it — never directly from master.
15
+ Wave-N merges land on the integration branch; master only sees the campaign via a
16
+ single explicit merge at Phase 3. See `rules/integration-branch.md`.
17
+ 9. **Merge into the integration branch as you go.** Wave-N branches merge into the
18
+ integration branch BEFORE wave-(N+1) dispatches.
19
+ 10. **TSC stays at integration baseline.** Capture `pnpm tsc --noEmit | grep -c "error TS"`
20
+ at campaign start. Any wave that breaks the baseline is reverted before the next wave.
21
+ 11. **No push without explicit user consent — per campaign, not per session.** Per-change
22
+ consents earlier in the session do NOT extend.
23
+
24
+ ### Wave cadence
25
+
26
+ - **Wave size**: 3-5 sub-agents. More than 5 = harder to merge, more conflicts.
27
+ - **Wave duration**: 10-15 min target. If a wave runs past 25 min, peek for stuck agents.
28
+ - **Heartbeat**: orchestrator wakes every 10-15 min. Cache-window math: 270s, 720s, 1200s.
29
+
30
+ ### Backlog pipeline
31
+
32
+ ```
33
+ .planning/audits/AUDIT-*.md ──┐
34
+ grep TODO/FIXME/HACK ──┼──▶ .planning/campaign/BACKLOG.md ──▶ wave-1, wave-2, …
35
+ existing pending P1/P2 items ──┘ ▲
36
+
37
+ wave-N findings append back ↑
38
+ ```
39
+
40
+ ### Phase 0 — Initialize (one-time)
41
+
42
+ 1. Confirm baseline: `git branch --show-current` = master, clean tree, capture TSC count.
43
+ 2. Create the campaign integration branch:
44
+ ```bash
45
+ git checkout -b campaign-integration master
46
+ ```
47
+ 3. Mine the backlog into `.planning/campaign/BACKLOG.md` from audit docs +
48
+ `grep -rn "TODO\|FIXME\|HACK\|XXX"`. Commit it on the integration branch.
49
+ 4. Start the bash heartbeat (`bash templates/heartbeat.sh &`).
50
+
51
+ ### Phase 1 — Wave dispatch
52
+
53
+ 1. Read next 3-5 items from BACKLOG.md → move to STATE.md "In flight (wave N)".
54
+ 2. Create worktree + branch **forked from integration branch**:
55
+ ```bash
56
+ git worktree add ../sm-worktrees/camp-<area> -b campaign-<area> campaign-integration
57
+ ```
58
+ 3. Create/reuse herdr tab, split panes, launch `cld --model sonnet` in each.
59
+ 4. Send each agent a wave prompt (use `templates/wave-prompt.md`):
60
+ - Worktree path + branch + parent = `campaign-integration`
61
+ - Specific backlog item + audit doc reference
62
+ - "Do not push. Do not merge. Do not touch master or the integration branch directly."
63
+ 5. **End the turn with ScheduleWakeup. Always.**
64
+
65
+ ### Phase 2 — Heartbeat loop (every 10-15 min)
66
+
67
+ 1. `herdr pane list` — count panes in `working` vs `idle`/`done`.
68
+ 2. For every branch with new commits: merge into the integration branch (NOT master).
69
+ 3. After each merge: `pnpm tsc --noEmit` regression check. Bumped count = revert from integration.
70
+ 4. Do NOT push to origin master. Do NOT touch master.
71
+ 5. Move shipped items from STATE.md "in flight" → "shipped".
72
+ 6. If BACKLOG.md still has items → dispatch wave-(N+1). Else → Phase 3.
73
+ 7. **End the turn with ScheduleWakeup** while any pane is working OR BACKLOG.md is non-empty.
74
+
75
+ ### Phase 3 — Drain & Land
76
+
77
+ 1. When BACKLOG.md empty AND all panes idle: kill heartbeat bash loop.
78
+ 2. Show user the full diff of integration branch vs master.
79
+ 3. Ask explicitly: "Campaign work is on `campaign-integration` (N commits ahead of
80
+ master). How do you want to land it?" Options:
81
+ - PR: `gh pr create --base master --head campaign-integration`
82
+ - Merge to master locally (explicit yes required)
83
+ - Squash-merge for one tidy commit
84
+ - Leave the integration branch for human review
85
+ 4. Never `git push origin master` without an explicit yes.
86
+
87
+ ---
88
+
89
+ ## Key files (campaign mode)
90
+
91
+ | File | Purpose |
92
+ |------|---------|
93
+ | `.planning/campaign/BACKLOG.md` | Durable work list. Committed at campaign start. |
94
+ | `.planning/campaign/STATE.md` | Waves shipped, in-flight, TSC drift per wave. |
95
+ | `.planning/campaign/HEARTBEAT` | `touch`ed by bash loop every 30s — mtime proves orchestrator alive. |
96
+ | `templates/BACKLOG-template.md` | Starter for the backlog file. |
97
+ | `templates/STATE-template.md` | Starter for the state file. |
98
+ | `templates/heartbeat.sh` | Background heartbeat script template. |
99
+ | `templates/wave-prompt.md` | Per-agent prompt boilerplate. |
100
+
101
+ ---
102
+
103
+ ## Rules deep-dive
104
+
105
+ - **`rules/integration-branch.md`** ← READ FIRST for campaign mode
106
+ - `rules/orchestrator-rhythm.md` — heartbeat / ScheduleWakeup decision tree
107
+ - `rules/wave-design.md` — wave sizing
108
+ - `rules/backlog-building.md` — audit mining, TODO scan, dedup
109
+ - `rules/merge-strategy.md` — TSC gate
110
+ - `rules/composition-with-herdr.md` — how campaign mode layers on single-shot mechanics
111
+
112
+ ---
113
+
114
+ ## Gotchas (field-tested, both modes)
115
+
116
+ - **herdr renumbers tab IDs on close.** Always re-list before the next close.
117
+ - **Parallel agents tangle branches** if they share a working tree — one worktree per agent always.
118
+ - **`.planning/` is often gitignored** — audit docs need `git add -f`.
119
+ - **`make brain`'s `git push` is `|| true`** — it silently fails on a diverged branch.
120
+ Never assume a deploy shipped your local commits without checking.
121
+ - **Diverged local vs origin master** is the #1 risk after a long parallel run. Do NOT
122
+ auto-resolve conflicts unattended — surface to the user.
123
+ - Capture extra `sleep` after launching `cld` — it takes ~5-7s to boot.
124
+
125
+ ---
126
+
127
+ ## Anti-patterns (campaign mode)
128
+
129
+ | Failure | Prevented by |
130
+ |---|---|
131
+ | Cross-wave merge conflicts pile up | Integration branch — every wave inherits prior waves' work |
132
+ | Orchestrator goes silent mid-campaign | Hard rule 5 + heartbeat template |
133
+ | Lost backlog after auto-compact | Phase 0 commits BACKLOG.md on integration branch |
134
+ | Silent push to master without consent | Hard rule 11 + Phase 3 ask-before-land |
135
+ | TSC drift compounds | Phase 2 regression check + revert from integration branch |
136
+ | Integration branch never lands | Phase 3 mandatory "how to land it" question |
@@ -0,0 +1,113 @@
1
+ # Backlog Building
2
+
3
+ How to build a durable, prioritized, committed campaign backlog.
4
+
5
+ ## Purpose
6
+ The backlog is the campaign's spine. Without a durable file-on-disk backlog, an auto-compact erases the work plan and the campaign collapses. This rule encodes the build + maintain pipeline.
7
+
8
+ ## Rules
9
+
10
+ ### Source priority (highest signal first)
11
+
12
+ 1. **Existing audit docs** at `.planning/audits/AUDIT-*.md` — these are human-curated and already prioritized P1/P2. Most reliable source.
13
+ 2. **`/audit-fix` skill outputs** if available — Rihal projects often have these pre-generated.
14
+ 3. **Pending items** in the project's CHANGELOG / ROADMAP / `.planning/state.md`.
15
+ 4. **Code-level TODOs**: `grep -rn -E "// *(TODO|FIXME|HACK|XXX)[: ]"` in `server/` + `src/` — lowest signal, often stale.
16
+ 5. **CI failures / open GitHub issues** — only if explicit user request.
17
+
18
+ ### Backlog format
19
+
20
+ ```markdown
21
+ # CAMPAIGN BACKLOG
22
+ Generated: <ISO timestamp>
23
+ Baseline TSC errors: <count>
24
+
25
+ ## Open items
26
+ - [ ] **<area>** (P<priority>): <one-line description>. Source: <audit-doc>:<line>
27
+ - [ ] **<area>** (P<priority>): …
28
+
29
+ ## In flight (wave N)
30
+ - [~] **<area>**: assigned to pane <pane-id>, branch <branch>, started <time>
31
+
32
+ ## Shipped
33
+ - [x] **<area>**: commit <sha>, wave <N>, finished <time>
34
+ ```
35
+
36
+ ### Dedup rules
37
+ Before adding an item to the backlog, check:
38
+ - Is there an existing master commit covering it? `git log --oneline | grep -i <keyword>`
39
+ - Is there an in-flight branch covering it? `git branch | grep -i <keyword>`
40
+ - Is it identical to another backlog item with a different file:line? Merge them.
41
+
42
+ ### Maintenance during the campaign
43
+ - Every wave merge: move items from "In flight" → "Shipped" with the commit SHA.
44
+ - Every wave dispatch: move items from "Open" → "In flight" with pane + branch.
45
+ - New findings from a sub-agent's audit phase: append to "Open" with source attribution.
46
+ - Item rejected by a wave-agent (out of scope, blocked, etc.): mark `[skip]` with reason — do not delete.
47
+
48
+ ### Commit the backlog
49
+ ```bash
50
+ git add -f .planning/campaign/BACKLOG.md .planning/campaign/STATE.md
51
+ git commit -m "chore(campaign): backlog snapshot at wave <N>"
52
+ ```
53
+ The `-f` is required if `.planning/` is gitignored (common in Rihal projects).
54
+
55
+ ## Examples
56
+
57
+ ### Building backlog from audit docs
58
+
59
+ ```bash
60
+ {
61
+ echo "# CAMPAIGN BACKLOG"
62
+ echo "Generated: $(date -u +%FT%TZ)"
63
+ echo "Baseline TSC: $(pnpm tsc --noEmit 2>&1 | grep -c 'error TS')"
64
+ echo
65
+ echo "## Open items"
66
+ for f in .planning/audits/AUDIT-*.md; do
67
+ area=$(basename "$f" .md | sed 's/^AUDIT-//')
68
+ pending=$(grep -nE "(⏳|^- \[ \]|^### P[12])" "$f" 2>/dev/null | head -5)
69
+ [ -n "$pending" ] && echo "$pending" | sed "s|^|- [ ] **$area** (from $f) |"
70
+ done
71
+ } > .planning/campaign/BACKLOG.md
72
+ ```
73
+
74
+ ### State transition
75
+
76
+ ```diff
77
+ - [ ] **call-update-flow** (P1): add Sentry capture on EventBus handler errors. Source: AUDIT-call-update-flow.md:142
78
+ + [~] **call-update-flow**: assigned to pane w65..-8, branch campaign-call-update-flow, started 2026-05-26T14:32Z
79
+ ```
80
+ later:
81
+ ```diff
82
+ - [~] **call-update-flow**: assigned to pane w65..-8, branch campaign-call-update-flow, started 2026-05-26T14:32Z
83
+ + [x] **call-update-flow**: commit 40b908d9, wave 2, finished 2026-05-26T14:51Z
84
+ ```
85
+
86
+ ## Anti-Patterns
87
+
88
+ ### Backlog only in conversation memory
89
+
90
+ **Problem**: Auto-compact wipes it; the next turn can't resume.
91
+ **Instead**: File on disk, committed.
92
+
93
+ ### Massive backlog dumped once
94
+
95
+ **Problem**: A 200-item backlog overwhelms wave selection — orchestrator picks badly because it can't see the whole context.
96
+ **Instead**: Build in chunks. Top 20-30 items as "Open"; lower-priority items as a footnote or separate file.
97
+
98
+ ### Mining TODOs from test files
99
+
100
+ **Problem**: Test TODOs are often "this case is unimplemented" — they're test scaffolding, not real bugs.
101
+ **Instead**: `grep ... | grep -v "\.test\.\|\.spec\."` to filter them out.
102
+
103
+ ### Skipping dedup
104
+
105
+ **Problem**: Same bug fixed 3 times by 3 waves because none knew the others were working on it.
106
+ **Instead**: Always check master log + in-flight branches before adding.
107
+
108
+ ## Related
109
+ - `wave-design.md` — backlog drives wave composition
110
+ - `composition-with-herdr.md` — STATE.md ties to herdr pane labels
111
+
112
+ ## Changelog
113
+ - 2026-05-26: Initial.
@@ -0,0 +1,85 @@
1
+ # Composition with herdr-orchestration
2
+
3
+ This skill is a layer ON TOP OF `herdr-orchestration`. It does not replace it.
4
+
5
+ ## Purpose
6
+ Make the boundary explicit so the orchestrator never reinvents herdr mechanics inside this skill.
7
+
8
+ ## Rules
9
+
10
+ ### Always read herdr-orchestration first
11
+ At the start of any campaign session, load the `herdr-orchestration` skill BEFORE dispatching the first wave. Its golden rules (use `cld` not `claude`, worktree per agent, no push during run, interactive mode required) apply to every wave.
12
+
13
+ ### Division of responsibility
14
+
15
+ | Concern | Skill that owns it |
16
+ |---|---|
17
+ | Worktree creation | herdr-orchestration |
18
+ | Pane splitting + naming | herdr-orchestration |
19
+ | `cld --model sonnet` launch via shell alias | herdr-orchestration |
20
+ | Sending prompts via `send-text` + `send-keys` | herdr-orchestration |
21
+ | Polling `herdr pane list` for status | herdr-orchestration |
22
+ | Reading stale buffer text, ignoring stray "merge to master" | herdr-orchestration |
23
+ | Conflict resolution (superset rule) | herdr-orchestration |
24
+ | **Wave cadence (when to dispatch / merge / pause)** | **this skill** |
25
+ | **Backlog management (BACKLOG.md, STATE.md)** | **this skill** |
26
+ | **Heartbeat (ScheduleWakeup + bash file)** | **this skill** |
27
+ | **TSC baseline gate** | **this skill** |
28
+ | **Push-to-origin policy** | **this skill** |
29
+
30
+ ### Pane status mapping → campaign action
31
+
32
+ | herdr pane status | Campaign action |
33
+ |---|---|
34
+ | `working` | Leave alone. Re-check on next heartbeat. |
35
+ | `blocked` | Read the pane, answer the menu (per herdr-orchestration), continue. |
36
+ | `idle` with commits ahead of master | Merge candidate — try to merge this wave. |
37
+ | `idle` with 0 commits | Either still warming up or wave failed — peek and decide. |
38
+ | `done` | Same as idle-with-commits. Merge if any, then clean up. |
39
+ | `unknown` | Recently created; wait one heartbeat. |
40
+
41
+ ### Worktree path convention
42
+ Use `../sm-worktrees/camp-<area>` (project-relative `../sm-worktrees`). This matches the convention in herdr-orchestration examples and keeps a single shared place for all campaign worktrees.
43
+
44
+ ### Branch naming convention
45
+ - Wave fix branches: `campaign-<area>` (e.g. `campaign-crm-pipeline`)
46
+ - Rebase pass branches: `rebase-<area>`
47
+ - Post-merge cleanup: delete the branch after push lands
48
+
49
+ ## Examples
50
+
51
+ ### Correct skill load order (start of session)
52
+
53
+ ```
54
+ 1. Load herdr-orchestration (read SKILL.md, understand golden rules)
55
+ 2. Load autonomous-fix-campaign (this skill — wave cadence + backlog)
56
+ 3. Apply both: herdr mechanics for the per-wave dispatch, this skill for the campaign loop
57
+ ```
58
+
59
+ ### Correct cld invocation (delegated to herdr-orchestration)
60
+
61
+ ```
62
+ herdr pane send-text $P "cld --model sonnet"
63
+ herdr pane send-keys $P Enter
64
+ ```
65
+ NOT `claude -p` (would be invisible to herdr; see herdr-orchestration golden rule 2).
66
+
67
+ ## Anti-Patterns
68
+
69
+ ### Reimplementing herdr mechanics inside a campaign prompt
70
+
71
+ **Problem**: Drift between this skill and the upstream herdr-orchestration rules.
72
+ **Instead**: Reference herdr-orchestration; do not duplicate.
73
+
74
+ ### Skipping the herdr golden rules because "the campaign is special"
75
+
76
+ **Problem**: Campaigns still need worktree isolation, still need `cld` alias, still need to ignore stray buffer text.
77
+ **Instead**: Treat herdr-orchestration's rules as inviolable.
78
+
79
+ ## Related
80
+ - `~/.claude/skills/herdr-orchestration/SKILL.md` (upstream skill)
81
+ - `orchestrator-rhythm.md` (this skill — campaign cadence)
82
+ - `merge-strategy.md` (this skill — conflict resolution delegates to herdr)
83
+
84
+ ## Changelog
85
+ - 2026-05-26: Initial.