herdr-orchestra 5.3.0 → 5.4.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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes. Versions follow [semantic versioning](https://semver.org).
4
4
 
5
+ ## [5.4.0] - 2026-11-14
6
+
7
+ ### Fixed
8
+ - **Skills no longer show up twice.** An update always wrote over the same files, but the installer put each skill in a shared folder (`~/.agents/skills`) and in every agent's own folder, and several tools read more than one of them. Codex reads `~/.agents/skills` and `~/.codex/skills`, and its docs say two skills with the same name both show up, so it listed `orch-plan` and `orch-run` twice. OpenCode got its slash commands in both `commands` and the older `command` folder. Claude Code, OpenCode and Amp skills were not shown twice (their docs say one copy wins), but an old copy could be the one that wins. Now the agent registry lists every folder a tool reads (`skills_reads`, `commands_reads`, and `skills_one_wins` for tools that show one copy), and `orch agents sync` (run by the installer) writes the fewest folders so each installed agent reads one copy. Example: with Claude, Codex and OpenCode it writes `~/.claude/skills` (Claude) and `~/.agents/skills` (Codex, OpenCode), and removes the copies in `~/.codex/skills`. Claude Code gets the skill only, since a skill is already the `/orch-plan` command and wins over a command file of the same name; the old `~/.claude/commands/orch-*.md` copies are removed.
9
+ - **Updates clean up after older versions.** Every sync removes orch's copies from folders it no longer uses, and any skill an older version installed under a name that is no longer shipped (from the install manifest). Only orch's own thin wrappers are removed; your own skills, even ones named `orch-...`, are left alone. A copy in a folder that no installed agent reads is kept (its agent may just be missing from PATH right now), and a skills folder that is a symlink to another one counts as one folder. Installing three times in a row leaves exactly the same files.
10
+
11
+ ### Added
12
+ - `orch agents check` (and `orch doctor`) report `DUPLICATE` when an agent would see a skill twice, with the two folders, and tell you to run `orch agents sync`.
5
13
  ## [5.3.0] - 2026-11-13
6
14
 
7
15
  ### Fixed
package/README.md CHANGED
@@ -59,8 +59,10 @@ It installs:
59
59
  | What | Where |
60
60
  |---|---|
61
61
  | `orch` CLI (scheduler + autopilot) | `~/.local/bin/orch` |
62
- | `orch-plan`, `orch-run` skills (read by Amp and OpenCode) | `~/.agents/skills/` |
62
+ | `orch-plan`, `orch-run` skills, one copy per agent (an agent never lists them twice) | `~/.agents/skills/` or the agent's own skills folder |
63
63
  | `/orch-plan`, `/orch-run` OpenCode commands | `~/.config/opencode/commands/` |
64
+
65
+ Updating replaces the skills, it never adds a second copy: the installer picks one folder per agent and removes orch's older copies from the rest (your own skills are left alone). `orch agents check` says `DUPLICATE` if an agent would still see a skill twice.
64
66
  | every installed version, side by side | `~/.local/share/herdr-orchestra/` |
65
67
 
66
68
  Install once — you don't need to run the installer again when you add an agent. After installing Claude, Hermes, Amp or anything else, run:
@@ -192,7 +194,7 @@ roles = ["coder"]
192
194
  skills_dirs = ["~/.myagent/skills"]
193
195
  ```
194
196
 
195
- `orch doctor [kind]` checks an installed agent against the real tool (version, whether the launch flags still exist in its `--help`, skills, herdr detection). `orch agents launch <kind>` prints the command · `orch team <kind>` / `orch team up` build and open a whole team from one tool · `orch agents sync` installs the skills for every installed agent (run it after adding a new one) · `orch agents check` confirms the skills are installed for every installed agent. The installer copies the skills into each installed agent's folders (`~/.claude/skills`, `~/.codex/skills`, `~/.agents/skills`, `~/.hermes/skills`, `~/.gemini/config/skills`) plus Claude Code and OpenCode slash commands.
197
+ `orch doctor [kind]` checks an installed agent against the real tool (version, whether the launch flags still exist in its `--help`, skills, herdr detection). `orch agents launch <kind>` prints the command · `orch team <kind>` / `orch team up` build and open a whole team from one tool · `orch agents sync` installs the skills for every installed agent (run it after adding a new one) · `orch agents check` confirms every installed agent sees each skill exactly once (not missing, not twice). Many tools read more than one folder (Codex reads `~/.agents/skills` and `~/.codex/skills` and lists a skill found in both twice), so the installer writes the fewest folders that give each installed agent one copy, e.g. with Claude, Codex and OpenCode: `~/.claude/skills` (Claude) and `~/.agents/skills` (Codex; OpenCode reads both, and its docs say one copy wins). Claude Code gets the skill only (a skill is already the `/orch-plan` command); OpenCode gets slash commands in `~/.config/opencode/commands`.
196
198
 
197
199
  ### Agents herdr can't watch
198
200
  For a kind with `herdr_detect = false` (or one missing from the registry, which `orch sync` warns about), `orch` relies only on the **done file and the time budget**: it never reports GONE, BLOCKED or IDLE for it, treats it as free whenever it has no task, and `orch status` marks it `detect:off`. If herdr doesn't recognise the pane as an agent at all, address it by pane id: `Workers: hermes-1 (hermes @pane:w1:p3)`. `orch` then types prompts into that pane, and `orch start` reports a `STALE pane` when the id has changed (`herdr pane list` shows the current ids).
package/VERSION CHANGED
@@ -1 +1 @@
1
- 5.3.0
1
+ 5.4.0
@@ -7,8 +7,17 @@
7
7
  # out when the tool has none or it is unverified, and choose the model inside the tool
8
8
  # herdr_detect herdr can tell idle / working / blocked for it (false: orch relies on the done file only)
9
9
  # roles any of "lead", "coder", "reviewer"
10
- # skills_dirs global SKILL.md folders the installer puts the thin orch-plan / orch-run skills into
11
- # commands_dirs slash-command folders the installer puts orch-plan.md / orch-run.md into
10
+ # skills_dirs global SKILL.md folders the installer may put the thin orch-plan / orch-run skills into
11
+ # (first = preferred)
12
+ # skills_reads every global skills folder the tool reads, its own and shared ones (e.g. ~/.agents/skills).
13
+ # `orch agents sync` picks the fewest folders so each installed tool reads exactly ONE copy
14
+ # of each skill (a skill in two folders it reads is listed twice), and removes orch's copies
15
+ # from every other folder
16
+ # commands_dirs slash-command folders the installer may put orch-plan.md / orch-run.md into
17
+ # skills_one_wins true when the tool shows a skill once even if two folders it reads have it (its docs
18
+ # say one copy wins); false or unset: it lists both, so orch keeps exactly one copy
19
+ # commands_reads every slash-command folder the tool reads (same one-copy rule)
20
+ # old_dirs folders older versions installed into and no longer use: sync removes orch's copies there
12
21
  # commands_from which command flavour to install there: "claude-commands" or "opencode-commands"
13
22
  # invoke how the developer starts the plan playbook in that agent
14
23
  # verified true only when the launch option and skills folder were checked against the real tool
@@ -24,11 +33,11 @@ model_flag = "--model"
24
33
  herdr_detect = true
25
34
  roles = ["lead", "coder", "reviewer"]
26
35
  skills_dirs = ["~/.claude/skills"]
27
- commands_dirs = ["~/.claude/commands"]
28
- commands_from = "claude-commands"
36
+ skills_one_wins = true
37
+ old_dirs = ["~/.claude/commands"]
29
38
  invoke = "/orch-plan <feature>"
30
39
  verified = true
31
- notes = "Claude Code 2.1: --permission-mode acceptEdits in --help; ~/.claude/skills present; herdr kind 'claude'."
40
+ notes = "Claude Code 2.1: --permission-mode acceptEdits in --help; ~/.claude/skills present; herdr kind 'claude'. A skill is also a slash command (/orch-plan) and its docs say a skill beats a ~/.claude/commands file of the same name, so no commands copy is installed."
32
41
 
33
42
  [codex]
34
43
  binary = "codex"
@@ -36,10 +45,11 @@ launch = "codex --approve-for-me"
36
45
  model_flag = "--model"
37
46
  herdr_detect = true
38
47
  roles = ["lead", "coder", "reviewer"]
39
- skills_dirs = ["~/.codex/skills"]
48
+ skills_dirs = ["~/.agents/skills", "~/.codex/skills"]
49
+ skills_reads = ["~/.agents/skills", "~/.codex/skills"]
40
50
  invoke = "$orch-plan <feature> (or: use the orch-plan skill: <feature>)"
41
51
  verified = true
42
- notes = "codex-cli 0.167: --full-auto is gone; --approve-for-me routes approvals to automatic review in the workspace-write sandbox. Reads ~/.codex/skills and ~/.agents/skills."
52
+ notes = "codex-cli 0.167: --full-auto is gone; --approve-for-me routes approvals to automatic review in the workspace-write sandbox. Reads ~/.codex/skills and ~/.agents/skills (its docs name ~/.agents/skills as the user folder, and say two skills with the same name both show up, so orch keeps one copy)."
43
53
 
44
54
  [amp]
45
55
  binary = "amp"
@@ -47,6 +57,8 @@ launch = "amp"
47
57
  herdr_detect = true
48
58
  roles = ["lead", "coder", "reviewer"]
49
59
  skills_dirs = ["~/.config/agents/skills", "~/.agents/skills"]
60
+ skills_reads = ["~/.config/agents/skills", "~/.agents/skills"]
61
+ skills_one_wins = true
50
62
  invoke = "use the orch-plan skill: <feature>"
51
63
  verified = true
52
64
  notes = "No auto-approve CLI flag; set amp.dangerouslyAllowAll or `amp permissions add` rules in its settings. `amp skill list` lists skills."
@@ -58,7 +70,10 @@ model_flag = "--model"
58
70
  herdr_detect = true
59
71
  roles = ["lead", "coder", "reviewer"]
60
72
  skills_dirs = []
73
+ skills_reads = ["~/.agents/skills", "~/.claude/skills"]
74
+ skills_one_wins = true
61
75
  commands_dirs = ["~/.config/opencode/commands"]
76
+ commands_reads = ["~/.config/opencode/commands", "~/.config/opencode/command"]
62
77
  commands_from = "opencode-commands"
63
78
  invoke = "/orch-plan <feature>"
64
79
  verified = true
Binary file
package/bin/orch CHANGED
@@ -4003,8 +4003,9 @@ USAGE = """usage: orch <command> [args]
4003
4003
  answer <Mn> <text> (lead) the developer's answer: into plan.md, and back to the same coder
4004
4004
  fix <Mn> <text> [--to <worker>] a change to something Mn already landed: a small follow-up milestone, sent
4005
4005
  straight to the coder who built Mn (no new plan; check, review and summary still apply)
4006
- agents sync [kind...] install the orch-plan / orch-run skills for every installed agent (run it after adding a new agent)
4007
- agents check check the orch-plan / orch-run skills are installed for every installed agent
4006
+ agents sync [kind...] install the orch-plan / orch-run skills so every installed agent sees each one exactly once,
4007
+ and remove old copies (run it after adding a new agent; the installer runs it)
4008
+ agents check check every installed agent sees each orch skill once (not missing, not twice)
4008
4009
  doctor [kind...] check installed agents against the real tool: version, launch flags, skills, herdr
4009
4010
  sync parse .orchestrate/plan.md -> state.json (validates deps, cycles, overlaps)
4010
4011
  start create/switch to the feature branch (plan `Branch:`); create worker worktrees (worktree mode)
@@ -4119,15 +4120,25 @@ def short(p):
4119
4120
  return "~" + p[len(home):] if p.startswith(home) else p
4120
4121
 
4121
4122
 
4122
- def manifest_record(*paths):
4123
- """Append paths to the installer's manifest so `install.sh --uninstall` removes them."""
4123
+ def manifest_lines():
4124
+ mf = manifest_path()
4125
+ return mf.read_text().splitlines() if mf.exists() else []
4126
+
4127
+
4128
+ def manifest_write(lines):
4124
4129
  mf = manifest_path()
4125
4130
  mf.parent.mkdir(parents=True, exist_ok=True)
4126
- lines = mf.read_text().splitlines() if mf.exists() else []
4127
- for p in paths:
4128
- if str(p) not in lines:
4129
- lines.append(str(p))
4130
- mf.write_text("".join(line + "\n" for line in lines))
4131
+ seen, out = set(), []
4132
+ for line in lines:
4133
+ if line and line not in seen:
4134
+ seen.add(line)
4135
+ out.append(line)
4136
+ mf.write_text("".join(line + "\n" for line in out))
4137
+
4138
+
4139
+ def manifest_record(*paths):
4140
+ """Append paths to the installer's manifest so `install.sh --uninstall` removes them."""
4141
+ manifest_write(manifest_lines() + [str(p) for p in paths])
4131
4142
 
4132
4143
 
4133
4144
  def _copy_asset(src, dst):
@@ -4139,74 +4150,214 @@ def _copy_asset(src, dst):
4139
4150
  return True
4140
4151
 
4141
4152
 
4142
- def sync_skills(d):
4143
- """Copy orch-plan / orch-run into <d>/<skill>/SKILL.md. Returns (changed, paths to record)."""
4153
+ SHARED_SKILLS = "~/.agents/skills" # read by several tools; used when it doesn't make a second copy
4154
+ SHARED_COMMANDS = ("~/.config/opencode/commands", "opencode-commands") # written even before OpenCode is installed
4155
+
4156
+
4157
+ def shipped_skills():
4144
4158
  src = asset("skills") or die("skills/ not found next to orch or in the install")
4145
- changed, recs = False, []
4146
- for s in ("orch-plan", "orch-run"):
4147
- changed |= _copy_asset(src / s / "SKILL.md", d / s / "SKILL.md")
4148
- recs.append(d / s)
4149
- return changed, recs
4159
+ return sorted(p.name for p in src.iterdir() if (p / "SKILL.md").exists() and p.name.startswith("orch-"))
4150
4160
 
4151
4161
 
4152
- def sync_commands(d, flavor):
4153
- """Copy the orch-*.md slash commands into d. Returns (changed, paths to record)."""
4162
+ def shipped_commands(flavor):
4154
4163
  src = asset(flavor)
4155
- if not src:
4156
- return False, []
4157
- changed, recs = False, []
4158
- for f in sorted(src.glob("orch-*.md")):
4159
- changed |= _copy_asset(f, d / f.name)
4160
- recs.append(d / f.name)
4161
- return changed, recs
4164
+ return sorted(f.name for f in src.glob("orch-*.md")) if src else []
4162
4165
 
4163
4166
 
4164
- def agent_assets(v):
4165
- """[(path, installed?)] for every skill/slash-command the registry says an agent should have."""
4166
- out = []
4167
- for d in v.get("skills_dirs", []):
4168
- for s in ("orch-plan", "orch-run"):
4169
- p = expand(d) / s / "SKILL.md"
4170
- out.append((p, p.exists()))
4171
- for d in v.get("commands_dirs", []):
4172
- for s in ("orch-plan", "orch-run"):
4173
- p = expand(d) / f"{s}.md"
4174
- out.append((p, p.exists()))
4167
+ def _dirs(v, key):
4168
+ return [expand(d) for d in v.get(key, []) or []]
4169
+
4170
+
4171
+ def _same(d):
4172
+ """A folder's identity: two paths that are one folder (a symlinked skills folder) count once."""
4173
+ return os.path.realpath(d)
4174
+
4175
+
4176
+ def agent_reads(v, what):
4177
+ """Every global folder the tool reads skills (or slash commands) from: `skills_reads` / `commands_reads`
4178
+ plus the folders the registry installs into. Order kept, no repeats (a symlink to a listed folder is the
4179
+ same folder)."""
4180
+ out, seen = [], set()
4181
+ for d in _dirs(v, f"{what}_reads") + _dirs(v, f"{what}_dirs"):
4182
+ if _same(d) not in seen:
4183
+ seen.add(_same(d))
4184
+ out.append(d)
4175
4185
  return out
4176
4186
 
4177
4187
 
4178
- def agents_sync(reg, installed, want=None):
4179
- """Copy the orch skills/commands into the shared dirs + every installed agent's folders.
4180
- Idempotent; records each written path in the uninstall manifest. Prints a status table."""
4181
- home = expand("~")
4182
- targets = [("base", [("skills", home / ".agents/skills", None)] +
4183
- [("commands", d, "opencode-commands")
4184
- for d in (home / ".config/opencode/commands", home / ".config/opencode/command")], "")]
4188
+ def pick_dirs(agents, shared=None):
4189
+ """agents: [(kind, reads, candidates, one_wins)]. Pick the fewest folders to write so every agent reads exactly
4190
+ one copy (an agent with one_wins shows a skill once even when two folders have it, so two copies are fine).
4191
+ Returns (chosen folders, {kind: [folders it reads a copy from]}). Prefers the shared folder, then the folders
4192
+ each agent lists first. When no exact choice exists, the fewest agents with two copies."""
4193
+ import itertools
4194
+ pool = []
4195
+ for _, reads, cands, _ in agents:
4196
+ for d in cands:
4197
+ if _same(d) not in {_same(p) for p in pool}:
4198
+ pool.append(d)
4199
+ if shared is not None and _same(shared) not in {_same(p) for p in pool}:
4200
+ pool.append(shared)
4201
+ if not agents:
4202
+ return ([shared] if shared is not None else []), {}
4203
+
4204
+ def rank(d):
4205
+ return min((c.index(d) for _, _, c, _ in agents if d in c), default=9)
4206
+
4207
+ best = None
4208
+ for n in range(1, len(pool) + 1):
4209
+ for combo in itertools.combinations(pool, n):
4210
+ s = {_same(d) for d in combo}
4211
+ seen = [(len(s & {_same(d) for d in reads}), ow) for _, reads, _, ow in agents]
4212
+ cost = (sum(c == 0 for c, _ in seen), sum(c > 1 and not ow for c, ow in seen), n,
4213
+ 0 if shared is not None and _same(shared) in s else 1, sum(rank(d) for d in combo))
4214
+ if best is None or cost < best[0]:
4215
+ best = (cost, combo)
4216
+ if best and best[0][:2] == (0, 0):
4217
+ break # bigger sets only cost more
4218
+ chosen = list(best[1])
4219
+ ids = {_same(d) for d in chosen}
4220
+ return chosen, {k: [d for d in reads if _same(d) in ids] for k, reads, _, _ in agents}
4221
+
4222
+
4223
+ def _ours(p):
4224
+ """Is this skill folder / command file one of orch's thin wrappers (so safe to remove)?"""
4225
+ f = p / "SKILL.md" if p.is_dir() else p
4226
+ try:
4227
+ text = f.read_text(errors="replace") if f.is_file() else ""
4228
+ except OSError:
4229
+ return False
4230
+ # every version's skills and commands: thin wrappers say "orch lead", the first (4.0) skills "Orchestrator step"
4231
+ return "orch lead" in text or "Orchestrator step" in text
4232
+
4233
+
4234
+ def _remove(p):
4235
+ if p.is_dir() and not p.is_symlink():
4236
+ shutil.rmtree(p)
4237
+ else:
4238
+ p.unlink()
4239
+
4240
+
4241
+ def sync_plan(reg, installed):
4242
+ """What `orch agents sync` writes: {(kind of item, folder): flavor}, plus the per-agent view."""
4243
+ agents = [(k, agent_reads(v, "skills"), _dirs(v, "skills_dirs") or agent_reads(v, "skills"),
4244
+ bool(v.get("skills_one_wins")))
4245
+ for k, v in reg.items() if installed[k]]
4246
+ agents = [a for a in agents if a[1]]
4247
+ sdirs, sview = pick_dirs(agents, expand(SHARED_SKILLS))
4248
+ flavor, cagents = {}, []
4185
4249
  for k, v in reg.items():
4186
- if want is not None and k not in want:
4250
+ if not installed[k] or not agent_reads(v, "commands"):
4187
4251
  continue
4188
- if not installed[k]:
4189
- if want is not None:
4252
+ cands = _dirs(v, "commands_dirs") or agent_reads(v, "commands")
4253
+ for d in cands:
4254
+ flavor.setdefault(d, v.get("commands_from", "claude-commands"))
4255
+ cagents.append((k, agent_reads(v, "commands"), cands, False))
4256
+ shared = expand(SHARED_COMMANDS[0])
4257
+ flavor.setdefault(shared, SHARED_COMMANDS[1])
4258
+ cdirs, cview = pick_dirs(cagents, shared)
4259
+ return sdirs, sview, [(d, flavor[d]) for d in cdirs], cview
4260
+
4261
+
4262
+ def agents_sync(reg, installed, want=None):
4263
+ """Copy the orch skills/commands so that every installed agent reads exactly one copy, and remove orch's
4264
+ copies from every other folder (old folders, renamed or dropped skills). Idempotent; keeps the uninstall
4265
+ manifest in step. Prints a status table."""
4266
+ if want is not None:
4267
+ for k in sorted(want):
4268
+ if not installed.get(k):
4190
4269
  print(f"skip {k:<9} not installed")
4270
+ was_ok = {k: all(st == "ok" for _, st in agent_assets(v)) for k, v in reg.items() if installed[k]}
4271
+ sdirs, sview, cdirs, cview = sync_plan(reg, installed)
4272
+ skills = shipped_skills()
4273
+ keep, changed_dirs = set(), set()
4274
+ for d in sdirs:
4275
+ src = asset("skills")
4276
+ for s in skills:
4277
+ if _copy_asset(src / s / "SKILL.md", d / s / "SKILL.md"):
4278
+ changed_dirs.add(d)
4279
+ keep.add(d / s)
4280
+ for d, fl in cdirs:
4281
+ src = asset(fl)
4282
+ for name in shipped_commands(fl):
4283
+ if _copy_asset(src / name, d / name):
4284
+ changed_dirs.add(d)
4285
+ keep.add(d / name)
4286
+
4287
+ # Remove the copies that make a tool list a skill twice: orch's copies in any folder an installed agent
4288
+ # reads (or used to read: old_dirs) that is not a chosen one, and skills orch no longer ships (renamed or
4289
+ # dropped) wherever an earlier install put them. A copy in a folder no installed agent reads is left: it
4290
+ # shows up nowhere, and it may belong to an agent that is only missing from PATH right now.
4291
+ removed = []
4292
+ lines = manifest_lines()
4293
+ keep_ids = {_same(p) for p in keep}
4294
+ read_ids = {_same(d) for k, v in reg.items() if installed[k]
4295
+ for d in agent_reads(v, "skills") + agent_reads(v, "commands") + _dirs(v, "old_dirs")}
4296
+ current = set(skills) | {n for fl in ("claude-commands", "opencode-commands") for n in shipped_commands(fl)}
4297
+ candidates = [Path(p) for p in lines if Path(p).name.startswith("orch-")]
4298
+ for k, v in reg.items():
4299
+ if installed[k]:
4300
+ for d in agent_reads(v, "skills") + agent_reads(v, "commands") + _dirs(v, "old_dirs"):
4301
+ if d.is_dir():
4302
+ candidates += [p for p in sorted(d.iterdir()) if p.name.startswith("orch-")]
4303
+ for p in candidates:
4304
+ if not (p.exists() or p.is_symlink()) or _same(p) in keep_ids or p in removed:
4305
+ continue
4306
+ if not (str(p) in lines or _ours(p)):
4307
+ continue # the developer's own orch-... skill
4308
+ if p.name in current and _same(p.parent) not in read_ids:
4191
4309
  continue
4192
- items = [("skills", expand(d), None) for d in v.get("skills_dirs", [])]
4193
- items += [("commands", expand(d), v.get("commands_from", "claude-commands"))
4194
- for d in v.get("commands_dirs", [])]
4195
- targets.append((k, items, v.get("invoke", "Run `orch lead plan` and follow it. Feature: <feature>")))
4310
+ _remove(p)
4311
+ removed.append(p)
4312
+ manifest_write([p for p in lines if Path(p) not in removed] + [str(p) for p in sorted(keep)])
4313
+
4196
4314
  new = same = 0
4197
- for k, items, invoke in targets:
4198
- changed, recs = False, []
4199
- for what, d, flavor in items:
4200
- c, r = sync_skills(d) if what == "skills" else sync_commands(d, flavor)
4201
- changed, recs = changed or c, recs + r
4202
- manifest_record(*recs)
4315
+ for k, v in reg.items():
4316
+ if not installed[k] or (want is not None and k not in want):
4317
+ continue
4318
+ mine = sview.get(k, []) + [d for d in cview.get(k, [])]
4319
+ changed = not was_ok[k] or any(d in changed_dirs for d in mine)
4203
4320
  new += changed
4204
4321
  same += not changed
4205
- status, whats = ("NEW" if changed else "ok "), " ".join(
4206
- f"{what}: {short(d)}" for what, d, _ in items)
4207
- print(f" {status} {k:<8} {whats}" + (f" {invoke}" if invoke else ""))
4208
- print(f"synced {len(targets)} row(s): {new} new, {same} unchanged — "
4209
- f"restart running agents so they pick up the skills")
4322
+ parts = []
4323
+ if k in sview:
4324
+ parts.append("skills: " + (", ".join(short(d) for d in sview[k]) or "NONE"))
4325
+ if k in cview:
4326
+ parts.append("commands: " + (", ".join(short(d) for d in cview[k]) or "NONE"))
4327
+ dup = len(cview.get(k, [])) > 1 or (len(sview.get(k, [])) > 1 and not v.get("skills_one_wins"))
4328
+ status = "DUP " if dup else ("NEW " if changed else "ok ")
4329
+ print(f" {status} {k:<8} {' '.join(parts)} {v.get('invoke', 'Run `orch lead plan` and follow it. Feature: <feature>')}")
4330
+ for d, what, view in ((expand(SHARED_SKILLS), "skills", sview), (expand(SHARED_COMMANDS[0]), "commands", cview)):
4331
+ if d in (sdirs if what == "skills" else [c for c, _ in cdirs]) and not any(d in x for x in view.values()):
4332
+ print(f" {'NEW ' if d in changed_dirs else 'ok '} {'shared':<8} {what}: {short(d)}")
4333
+ for p in removed:
4334
+ print(f" removed old copy {short(p)}")
4335
+ print(f"synced {new + same} agent(s): {new} new, {same} unchanged, {len(removed)} old cop"
4336
+ f"{'y' if len(removed) == 1 else 'ies'} removed — every agent sees each skill once. "
4337
+ f"Restart running agents so they pick up the skills")
4338
+
4339
+
4340
+ def agent_assets(v):
4341
+ """[(text, state)] per skill / slash command an installed agent should see once: state is ok, missing or
4342
+ duplicate (the same skill in two folders the tool reads, so it is listed twice)."""
4343
+ out = []
4344
+ reads = agent_reads(v, "skills")
4345
+ for s in shipped_skills() if reads else []:
4346
+ copies = [d for d in reads if (d / s / "SKILL.md").exists()]
4347
+ out.append(_asset_state(f"skill {s}", copies[:1] if v.get("skills_one_wins") else copies, reads))
4348
+ reads = agent_reads(v, "commands")
4349
+ for name in shipped_commands(v.get("commands_from", "claude-commands")) if reads else []:
4350
+ copies = [d for d in reads if (d / name).exists()]
4351
+ out.append(_asset_state(f"command {name}", copies, reads))
4352
+ return out
4353
+
4354
+
4355
+ def _asset_state(label, copies, reads):
4356
+ if not copies:
4357
+ return f"{label} not in {', '.join(short(d) for d in reads)}", "missing"
4358
+ if len(copies) > 1:
4359
+ return f"{label} twice: {' and '.join(short(d) for d in copies)}", "duplicate"
4360
+ return f"{label} {short(copies[0])}", "ok"
4210
4361
 
4211
4362
 
4212
4363
  def cmd_agents(args):
@@ -4226,27 +4377,25 @@ def cmd_agents(args):
4226
4377
  f"(add it in {user_agents_file()})")
4227
4378
  print(launch_cmd(kind, v, model))
4228
4379
  return
4229
- if sub == "dirs": # for install.sh: <kind>\t<skills|commands|invoke>\t<dir or text>[\t<commands_from>]
4230
- for k, v in reg.items():
4231
- if not installed[k]:
4232
- continue
4233
- print(f"{k}\tinvoke\t{v.get('invoke', 'Run `orch lead plan` and follow it. Feature: <feature>')}")
4234
- for d in v.get("skills_dirs", []):
4235
- print(f"{k}\tskills\t{expand(d)}")
4236
- for d in v.get("commands_dirs", []):
4237
- print(f"{k}\tcommands\t{expand(d)}\t{v.get('commands_from', 'claude-commands')}")
4380
+ if sub == "dirs": # the folders `orch agents sync` writes: <skills|commands>\t<dir>[\t<commands_from>]
4381
+ sdirs, _, cdirs, _ = sync_plan(reg, installed)
4382
+ for d in sdirs:
4383
+ print(f"skills\t{d}")
4384
+ for d, fl in cdirs:
4385
+ print(f"commands\t{d}\t{fl}")
4238
4386
  return
4239
4387
  if sub == "check":
4240
- bad = 0
4388
+ bad = {"missing": 0, "duplicate": 0}
4241
4389
  for k, v in reg.items():
4242
4390
  if not installed[k]:
4243
4391
  continue
4244
- for p, ok in agent_assets(v):
4245
- bad += not ok
4246
- label = "skill " if p.name == "SKILL.md" else "command "
4247
- print(f"{'ok ' if ok else 'MISSING'} {k:<9} {label}{p}")
4248
- if bad:
4249
- print(f"{bad} missing — run: orch agents sync")
4392
+ for text, state in agent_assets(v):
4393
+ if state != "ok":
4394
+ bad[state] += 1
4395
+ print(f"{ {'ok': 'ok ', 'missing': 'MISSING ', 'duplicate': 'DUPLICATE'}[state]} {k:<9} {text}")
4396
+ if bad["missing"] or bad["duplicate"]:
4397
+ print(", ".join(f"{n} {w}" for w, n in bad.items() if n) + " — run: orch agents sync"
4398
+ + (" (a duplicate means the tool lists that skill twice)" if bad["duplicate"] else ""))
4250
4399
  sys.exit(1)
4251
4400
  return
4252
4401
  if sub == "sync":
@@ -4266,9 +4415,9 @@ def cmd_agents(args):
4266
4415
  f"{'yes' if v.get('verified') else 'no':<8} {','.join(v.get('roles', [])):<22} "
4267
4416
  f"{v.get('launch', v.get('binary', k))}")
4268
4417
  missing = [k for k, v in reg.items()
4269
- if installed[k] and any(not ok for _, ok in agent_assets(v))]
4418
+ if installed[k] and any(st != "ok" for _, st in agent_assets(v))]
4270
4419
  if missing:
4271
- print(f"\n{', '.join(missing)}: orch-plan/orch-run missing — run: orch agents sync")
4420
+ print(f"\n{', '.join(missing)}: orch-plan/orch-run missing or listed twice — run: orch agents sync")
4272
4421
  print(f"\nOverride or add kinds in {user_agents_file()}")
4273
4422
 
4274
4423
 
@@ -4308,8 +4457,9 @@ def doctor_kind(kind, v, full=True):
4308
4457
  out.append((False, f"launch flag {fl} is NOT in `{hcmd}` — the launch command in the registry may be out "
4309
4458
  f"of date (override it in {short(user_agents_file())})"))
4310
4459
  if full:
4311
- for p, ok in agent_assets(v):
4312
- out.append((ok, f"skill {short(p)}" + ("" if ok else " missing — run `orch agents sync`")))
4460
+ for text, st in agent_assets(v):
4461
+ out.append((st == "ok", " ".join(text.split()) + ("" if st == "ok" else
4462
+ f" ({st}) — run `orch agents sync`")))
4313
4463
  if v.get("herdr_detect", True):
4314
4464
  code, txt = _probe([HERDR, "agent"])
4315
4465
  if code == 0:
package/install.sh CHANGED
@@ -89,7 +89,7 @@ case "$ACTION" in
89
89
  uninstall)
90
90
  if [[ -f "$MANIFEST" ]]; then # everything the installer put into agents' folders
91
91
  while IFS= read -r p; do
92
- case "$(basename "$p")" in orch-plan|orch-run|orch-plan.md|orch-run.md) rm -rf "$p";; esac
92
+ case "$(basename "$p")" in orch-*) rm -rf "$p";; esac
93
93
  done < "$MANIFEST"
94
94
  fi
95
95
  rm -f "$BIN/orch"
@@ -184,7 +184,8 @@ if ! "$CUR/bin/orch" agents sync; then
184
184
  # Python < 3.11 (no agent registry): fall back to the shared dirs only, as in 4.2
185
185
  warn "per-agent skills skipped (orch agents sync failed — Python >= 3.11 needed for the agent registry)"
186
186
  install_skills "$SKILLS" # ~/.agents/skills: Amp, OpenCode and Codex read it
187
- for d in "${OC_CMDS[@]}"; do install_commands "$d" opencode-commands; done
187
+ install_commands "${OC_CMDS[0]}" opencode-commands # one folder only: OpenCode reads both, two = listed twice
188
+ rm -f "${OC_CMDS[1]}/orch-plan.md" "${OC_CMDS[1]}/orch-run.md"
188
189
  fi
189
190
 
190
191
  # clean up files from pre-repo kit versions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herdr-orchestra",
3
- "version": "5.3.0",
3
+ "version": "5.4.0",
4
4
  "description": "Orchestrate AI coding agents (Claude Code, Codex, OpenCode, Amp) as one team in Herdr: a lead plans, coders build in parallel, a reviewer checks, you get one PR.",
5
5
  "license": "MIT",
6
6
  "bin": {