herdr-orchestra 6.48.4 → 6.49.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,49 @@
2
2
 
3
3
  All notable changes. Versions follow [semantic versioning](https://semver.org).
4
4
 
5
+ ## [6.49.0] - 2026-12-03
6
+
7
+ Agent profiles (beta): each project can now keep its own specialists in `.orchestrate/profiles.md`. This file stays on your machine and is never committed. A profile says which folders it owns, the house rules for that part of the repo, its skills and its check. When the lead writes `Profile: web` on a milestone, that coder gets the web profile's role, folders, rules, skills and check, and none of the backend rules. A project without the file works exactly as before.
8
+
9
+ ```markdown
10
+ ## web
11
+ Role: senior frontend engineer with a designer's eye
12
+ Owns: apps/web/
13
+ Check: cd apps/web && pnpm test
14
+ Skills: frontend-design, ~/.claude/skills/react-patterns
15
+ Rules:
16
+ - New screens go in apps/web/src/features/<feature>/, like the others
17
+ Review: keyboard access
18
+
19
+ ## reviewer
20
+ Rules:
21
+ - Every new API route has a test that calls it
22
+ ```
23
+
24
+ - **What the milestone says comes first.** Its own `Role:`, `Skills:` and `Side:` win, then the profile, then the plan's `Check command`. `Profile: none`, or no line, means no profile.
25
+ - **Skills from outside the repo:** a personal skill (`~/.claude/skills/react-patterns`) or a plugin skill (`plugin:<plugin>:<skill>`). When the coder's tool reads that folder by itself, the task names the skill. When it doesn't (a Codex coder and a Claude skill), the task gives the file to open.
26
+ - **The `reviewer` profile** goes into every review by itself (normal mode and Pi subagent mode), through the reviewer the run already has. No new agent. A coder profile's `Review:` points are added to that milestone's review.
27
+ - **`orch sync`** stops on an unknown profile. It warns about a folder that is gone, a skill that isn't there, `Likely files` outside the profile's folders, an unknown line, a profile over 1,200 characters, a rule that `AGENTS.md`, `CLAUDE.md` or `coding-standards.md` already has, and a rule two profiles share (that one belongs in `AGENTS.md`). orch never edits `AGENTS.md`.
28
+ - **Kept across follow-ups and away from git:** `orch fix` keeps the milestone's `Profile:`, so the follow-up gets the same rules, folders, check and review points. orch hides `.orchestrate/` from git as soon as it reads or suggests profiles, and `orch onboard done` refuses any path under `.orchestrate/`, so `profiles.md` is never committed or pushed.
29
+ - **Safe paths and skills:** an absolute `Owns:` path or one with `..` stops the plan with a clear error (it crashed before). A glob like `apps/*/` works, and a folder with a space goes in backticks. Each review names the files the milestone changed outside its profile's folders. A personal or plugin skill that does orch's job (like `using-git-worktrees`) gets the same warning as a repo skill and is never handed to a coder. A plugin skill comes from the installed plugin (`installed_plugins.json`, else the newest cached version), never a marketplace copy; Claude is told it has it (as `design:ui`) only when the plugin is turned on.
30
+ - **`/orch-onboard`** offers only the profiles your repo's folders call for: one per part when there are two or more (`apps/web` and `apps/api`), a database, tests or infra profile when the repo has those folders, and always `reviewer`. You tick which ones to write. A repo with one app is offered only `reviewer`. It also points at an `AGENTS.md` line that is about one part only, so you can move it yourself.
31
+
32
+ Tokens: wake-ups, `orch lead run` and the quick and full plan parts are unchanged. Without a profiles file, nothing any agent reads changes. With a file, `orch lead plan` prints one short AGENT PROFILES block (about 360 characters for 2 profiles plus `reviewer`), and the lead writes `Profile: web` instead of a long `Role:` and `Skills:` line. A coder brief with a profile is about 200 characters longer than one with the lead's own role line: those are the house rules. A review task is about 300 characters longer when a `reviewer` profile exists. `orch lead onboard`, read once per project, grew by about 860 characters, because it now explains how to offer profiles.
33
+
34
+ ## [6.48.5] - 2026-12-03
35
+
36
+ `orch team up` now puts the lead in the `team` tab too. Before, the coders and the reviewer opened in the `team` tab and the lead stayed alone in its own tab, so you could not watch the lead and its team at the same time. Now the lead's pane moves into the `team` tab, top left, and the team fills the rest. The lead keeps running: only its place changes, nothing is restarted or closed. Its pane is at least as big as any other (2 agents: the lead on top across the whole width, the 2 below; 3 agents: a 2×2 grid). A big team still spills into `team 2`, without the lead. `orch team tidy` does the same for panes that are already open.
37
+
38
+ The lead stays where it is, and orch says why in one `NOTE` line, when herdr can't find the lead's pane, when herdr can't move it, when the screen is so small it fits only one agent a tab, or when the lead already sits beside agents of this run. `orch team up --here` works as before.
39
+
40
+ Example (`orch team up` with codex-1, codex-2 and the reviewer):
41
+ ```
42
+ OPENED codex-1: pane w1:p3 in app-wt/codex-1 ...
43
+ TAB the lead and the team are in the herdr tab "team", the lead top left (`orch team tidy` moves panes opened by hand there too)
44
+ ```
45
+
46
+ No agent gets any new text to read: the lead's playbooks, wake-ups, task files and review prompts are unchanged. The one line `orch team up` prints at the end got shorter.
47
+
5
48
  ## [6.48.4] - 2026-12-03
6
49
 
7
50
  The board's Tokens tab has a new **fresh** column: in minus cached, the part the agent read new. A coder can show "10.8M in" and look very costly, but most of that is its own chat read again from the cache, which costs much less. Fresh shows the part that really costs. It is in each agent's row, the total row, the top line (`tokens 257k so far · fresh 57k`), the agent details (total, now and each milestone) and the browser view's tokens per agent. The numbers are the ones the board already reads from each agent's own log, so no agent spends a single extra token. A tool whose log gives no cached number shows fresh as "n/a", and the total fresh then reads "at least" (`57k+`).
package/README.md CHANGED
@@ -135,7 +135,7 @@ Version choice, first match wins: `--version` flag › `ORCH_VERSION` env › `.
135
135
 
136
136
  `orch agents launch <kind> --model <id>` prints the command with the model (`--role reviewer` gives the reviewer's command: for Claude Code its edit tools are off, it only reads the change and writes its review file); `orch models` lists the models and their tiers. Use whatever your installed agents already reach.
137
137
 
138
- **Only one tool installed, or just one window open?** Open only the lead and start the plan playbook. The lead sees it is alone and builds the team from its own tool: `orch team codex` picks coders and a reviewer of that tool on the models the catalog allows, spread over its tiers, and the lead writes them into the plan. When you say go, `orch team up` opens their panes in a herdr tab of their own called `team`, as a grid of equal panes (2 side by side, 3 as two on top and the reviewer below, 4 as 2×2; a fifth goes to `team 2`, and a small screen gets fewer per tab), each in its own folder and on its model, and names them. The lead keeps its whole tab. `orch team tidy` moves panes that are already open (by hand, or next to the lead) into that grid; `orch team up --here` splits next to the lead as before. You never type either command yourself (you can: `orch team codex --coders 1`, `orch team up --dry-run`). Each pane is a separate session of the same tool, on your existing login.
138
+ **Only one tool installed, or just one window open?** Open only the lead and start the plan playbook. The lead sees it is alone and builds the team from its own tool: `orch team codex` picks coders and a reviewer of that tool on the models the catalog allows, spread over its tiers, and the lead writes them into the plan. When you say go, `orch team up` opens their panes in a herdr tab of their own called `team`, as a grid of equal panes (2 side by side, 3 as two on top and the reviewer below, 4 as 2×2; a fifth goes to `team 2`, and a small screen gets fewer per tab), each in its own folder and on its model, and names them. The lead's pane moves into that tab too, top left, so you see the lead and its team together (it keeps running; if herdr can't move it, it stays where it is and orch says so). `orch team tidy` moves panes that are already open (by hand, or next to the lead) into that grid; `orch team up --here` splits next to the lead as before. You never type either command yourself (you can: `orch team codex --coders 1`, `orch team up --dry-run`). Each pane is a separate session of the same tool, on your existing login.
139
139
 
140
140
  ```
141
141
  you (1 Codex pane) ──► $orch-plan add a login page
@@ -237,6 +237,8 @@ The first `/orch-plan` in a project checks what the project has for its agents:
237
237
 
238
238
  Skip it once and orch won't ask again in that project. `/orch-onboard` runs it by hand. In a run, each milestone gets a `Skills:` line and the coder's task lists those skills. Skills that do orch's job (their own worktree, merging, helper agents) are named as "don't use in this task". Details: [Project setup](https://herdr-orchestra.vercel.app/docs/project-setup/).
239
239
 
240
+ **Agent profiles (beta):** `.orchestrate/profiles.md` (only on your machine) holds this project's specialists, e.g. `web` and `api`: the folders each owns, its house rules, skills (also `~/...` personal ones) and check. A milestone with `Profile: web` gives its coder only that profile's rules; what the milestone says itself wins. A `reviewer` profile goes into every review. `/orch-onboard` offers only the profiles your repo's folders call for. No file, no change. Details: [Agent profiles](https://herdr-orchestra.vercel.app/docs/project-setup/#agent-profiles-beta).
241
+
240
242
  The orch-plan and orch-run skills and slash commands are thin wrappers: the playbooks themselves live in `orch` (`orch lead plan`, `orch lead run`), so every agent follows the same, versioned instructions. They are printed in parts so the lead reads only what it needs: `orch lead plan` prints research and the quick-or-full decision, then `orch lead plan quick` (a quick run's steps and rules) or `orch lead plan full` (steps 3 to 10). `orch lead run` prints only the start at go, and during a run only the rules, the developer's part and the steps for the open events; on a wake-up, `orch events` prints the rules (in short after the first time) and the steps for those events. News (a milestone landed) waits for the lead's next real wake-up, and the lead's chat is compacted once after go.
241
243
 
242
244
  ### Agent registry
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.48.4
1
+ 6.49.0
Binary file
package/bin/orch CHANGED
@@ -1846,10 +1846,106 @@ def cmd_sync(args):
1846
1846
  sk_all = project_skills(ROOT, registry(required=False) or {})
1847
1847
  have, clash = {x["name"] for x in sk_all}, clash_skills(sk_all)
1848
1848
  for n in names:
1849
- if n in clash:
1849
+ okind, opath, _ = outside_skill(n)
1850
+ if okind: # `~/...` or `plugin:<p>:<s>`: a skill on this machine, not in the repo
1851
+ why = outside_clash(n, opath)
1852
+ if why:
1853
+ warns.append(f"{tid} Skills: {n} does orch's job in a run ({why}) — leave it out")
1854
+ elif not opath:
1855
+ warns.append(f"{tid} Skills: {n} is not on this machine")
1856
+ elif n in clash:
1850
1857
  warns.append(f"{tid} Skills: {n} does orch's job in a run ({clash[n]}) — leave it out")
1851
1858
  elif n not in have:
1852
1859
  warns.append(f"{tid} Skills: {n} is not a skill in this repo (`orch onboard skills` lists them)")
1860
+ # agent profiles (.orchestrate/profiles.md): a milestone's `Profile:` must name one; warn on a profile that is
1861
+ # set up wrong or repeats a rule AGENTS.md / CLAUDE.md / coding-standards.md already has
1862
+ prof_path, profs = load_profiles({"workspace": workspace})
1863
+ prof_of = {t["id"]: plan_profile(t) for t in tasks}
1864
+ used = sorted({prof_of[tid] for tid in enabled if prof_of[tid]})
1865
+ if any(prof_of[tid] for tid in enabled) and not prof_path:
1866
+ errors += [f"{tid} has `Profile: {prof_of[tid]}`, but there is no .orchestrate/profiles.md — write it, or "
1867
+ f"use `Profile: none`" for tid in enabled if prof_of[tid]]
1868
+ elif prof_path:
1869
+ for tid in enabled:
1870
+ pn = prof_of[tid]
1871
+ if pn and pn not in profs:
1872
+ errors.append(f"{tid} has `Profile: {pn}`, but "
1873
+ f"{'.orchestrate/profiles.md' if prof_path.parent == ORCH else short(prof_path)} has no `## {pn}` "
1874
+ f"(profiles: {', '.join(profs) or 'none'})")
1875
+ elif pn == "reviewer":
1876
+ errors.append(f"{tid} has `Profile: reviewer`: that profile is for the reviewer and goes into every "
1877
+ f"review by itself — give the milestone a coder profile or `Profile: none`")
1878
+ elif pn:
1879
+ pr = profs[pn]
1880
+ ok_owns = [o for o in pr["owns"] if not owns_problem(o)]
1881
+ outside = sorted(f for f in files[tid] if ok_owns and not owns_match(f, ok_owns)
1882
+ and not any(path_allowed(o, [f]) for o in ok_owns))
1883
+ if outside:
1884
+ warns.append(f"{tid}'s Likely files {outside} are outside profile {pn}'s folders "
1885
+ f"({', '.join(pr['owns'])}) — another profile, or add the folder to its Owns")
1886
+ rp = field(by_id[tid], "repo").split()
1887
+ if pr["repo"] and rp and rp[0].lower() != pr["repo"].lower():
1888
+ warns.append(f"{tid} is `Repo: {rp[0]}` but profile {pn} is for repo {pr['repo']}")
1889
+ house = None
1890
+ two = {}
1891
+ for pn in [*used, *(["reviewer"] if "reviewer" in profs and reviewer else [])]:
1892
+ pr = profs.get(pn)
1893
+ if not pr or pn in two:
1894
+ continue
1895
+ two[pn] = True
1896
+ if pr["unknown"]:
1897
+ warns.append(f"profile {pn}: unknown line(s) {', '.join(pr['unknown'])} — a profile has Role, Owns, "
1898
+ f"Check, Skills, Rules, Review, Repo")
1899
+ if not (pr["rules"] or pr["owns"] or (pn == "reviewer" and pr["role"])):
1900
+ warns.append(f"profile {pn} has no Rules and no Owns, so it adds nothing — give it this part's rules")
1901
+ if pr["size"] > PROFILE_MAX_CHARS:
1902
+ warns.append(f"profile {pn} is {pr['size']} characters (over {PROFILE_MAX_CHARS}): it goes into every "
1903
+ f"brief it is used for — keep only the rules for this part")
1904
+ for o in pr["owns"]:
1905
+ bad = owns_problem(o)
1906
+ if bad:
1907
+ errors.append(f"profile {pn} Owns: {o} {bad}")
1908
+ continue
1909
+ try:
1910
+ there = (ROOT / o).exists() or any(ROOT.glob(o.rstrip("/")))
1911
+ except (ValueError, NotImplementedError, OSError):
1912
+ there = False
1913
+ if not there:
1914
+ warns.append(f"profile {pn} owns {o}, which is not in this repo — renamed or moved?")
1915
+ for n in pr["skills"]:
1916
+ kind_, path_, _ = outside_skill(n)
1917
+ if kind_ and not path_:
1918
+ warns.append(f"profile {pn} Skills: {n} is not on this machine")
1919
+ elif kind_ and outside_clash(n, path_):
1920
+ warns.append(f"profile {pn} Skills: {n} does orch's job in a run ({outside_clash(n, path_)}) — "
1921
+ f"leave it out")
1922
+ elif not kind_:
1923
+ if sk_all is None:
1924
+ sk_all = project_skills(ROOT, registry(required=False) or {})
1925
+ have, clash = {x["name"] for x in sk_all}, clash_skills(sk_all)
1926
+ if n in clash:
1927
+ warns.append(f"profile {pn} Skills: {n} does orch's job in a run ({clash[n]}) — leave it out")
1928
+ elif n not in have:
1929
+ warns.append(f"profile {pn} Skills: {n} is not a skill in this repo (`orch onboard skills` "
1930
+ f"lists them; a personal one is written `~/.claude/skills/{n}`)")
1931
+ if house is None:
1932
+ house = house_rule_lines(dst)
1933
+ for r in pr["rules"] + pr["review"]:
1934
+ if _norm_rule(r) in house:
1935
+ warns.append(f"profile {pn}: \"{r[:80]}\" is already in {house[_norm_rule(r)]} — remove it from "
1936
+ f"the profile (coders read {house[_norm_rule(r)]} anyway)")
1937
+ warns += [f"profiles.md has two `## {pn}` sections: only the last one counts — merge them into one"
1938
+ for pn, pr in profs.items() if pr.get("dup")]
1939
+ seen_rule = {}
1940
+ for pn, pr in profs.items():
1941
+ if pn == "reviewer":
1942
+ continue
1943
+ for r in pr["rules"]:
1944
+ seen_rule.setdefault(_norm_rule(r), []).append(pn)
1945
+ for r, names in seen_rule.items():
1946
+ if len(names) > 1 and any(n in used for n in names):
1947
+ warns.append(f"profiles {', '.join(names)} all have the rule \"{r[:80]}\": a rule for the whole repo "
1948
+ f"belongs in AGENTS.md (your call; orch never edits it)")
1853
1949
  max_tasks = int(os.environ.get("ORCH_MAX_TASKS", "0") or 0) # no limit unless you set one
1854
1950
  if max_tasks and len(enabled) > max_tasks:
1855
1951
  warns.append(f"{len(enabled)} enabled milestones (> ORCH_MAX_TASKS={max_tasks}). Merge coupled milestones "
@@ -1967,7 +2063,8 @@ def cmd_sync(args):
1967
2063
  "wait": o.get("wait"),
1968
2064
  "files": sorted(files[tid]),
1969
2065
  "parallel": field(t, "parallel", "").lower().startswith("allow"),
1970
- "tier": tiers[tid], "needs": needs[tid], "model_why": field(t, "model why"), "role": field(t, "role"),
2066
+ "tier": tiers[tid], "needs": needs[tid], "model_why": field(t, "model why"),
2067
+ "role": field(t, "role") or (profs[prof_of[tid]]["role"] if prof_of.get(tid) in profs else ""),
1971
2068
  "model": locks.get(tid), # locked by the developer: only coders on this model take it
1972
2069
  "estimate_s": estimates[tid],
1973
2070
  # for the developer (`orch plan show`): the milestone in plain words, and the plan's own reasons
@@ -1976,6 +2073,16 @@ def cmd_sync(args):
1976
2073
  "door": "one-way" if tid in doors else None, "door_why": doors.get(tid) or None,
1977
2074
  "side": side_of.get(tid), "ext_deps": ext_deps.get(tid) or [],
1978
2075
  }
2076
+ if prof_of.get(tid) in profs: # `Profile:`: only when the plan names one, so old state stays as it was
2077
+ st["tasks"][tid]["profile"] = prof_of[tid]
2078
+ pc = profs[prof_of[tid]]["check"]
2079
+ if pc and pc.lower() not in ("none", "-") and not side_of.get(tid):
2080
+ st["tasks"][tid]["pcheck"] = pc
2081
+ else:
2082
+ st["tasks"][tid].pop("pcheck", None)
2083
+ else:
2084
+ for k in ("profile", "pcheck"):
2085
+ st["tasks"][tid].pop(k, None)
1979
2086
  if status != st["tasks"][tid]["status"]:
1980
2087
  move(st, tid, status, {"skipped": "unticked in plan.md", "needs-answer": "open questions in plan.md"}
1981
2088
  .get(status, ""), force=True)
@@ -3271,9 +3378,10 @@ def review_findings(tid, k):
3271
3378
 
3272
3379
 
3273
3380
  def check_for(st, tid=None):
3274
- """The check command for milestone tid: its side's (`Side: frontend` + `Check frontend: ...`), else the plan's."""
3275
- side = (st.get("tasks", {}).get(tid) or {}).get("side") if tid else None
3276
- return (st.get("sides") or {}).get(side) or st.get("check") or ""
3381
+ """The check command for milestone tid: its side's (`Side: frontend` + `Check frontend: ...`), else its profile's
3382
+ `Check:`, else the plan's."""
3383
+ t = (st.get("tasks", {}).get(tid) or {}) if tid else {}
3384
+ return (st.get("sides") or {}).get(t.get("side")) or t.get("pcheck") or st.get("check") or ""
3277
3385
 
3278
3386
 
3279
3387
  def full_check(st, tid=None):
@@ -4107,7 +4215,18 @@ def cmd_review(args):
4107
4215
  except OSError:
4108
4216
  rules = project_rules(st, "")
4109
4217
  rules_txt = "\n".join(project_rules_lines(st, rules))
4218
+ prof = task_profile(st, tid)
4219
+ prof_rv = reviewer_profile_lines(st, prof)
4220
+ if prof_rv:
4221
+ rules_txt = (rules_txt + "\n" if rules_txt else "") + "\n".join(prof_rv) + "\n"
4110
4222
  scope = t.get("out_of_scope") or []
4223
+ oo = [] # the milestone's real diff against its profile's folders (`Owns:`)
4224
+ ok_ = [o for o in (prof or {}).get("owns", []) if not owns_problem(o)]
4225
+ if ok_:
4226
+ oo = [f for f in sorted(set(re.findall(r"^diff --git a/.+ b/(.+)$", diff, re.M)))
4227
+ if not _skip_path(f) and not owns_match(f, ok_)]
4228
+ owns_txt = (f" It also changed files outside profile `{prof['name']}`'s folders ({', '.join(prof['owns'])}): "
4229
+ f"{', '.join(oo)}. Say whether each one was needed." if oo else "")
4111
4230
  (rd / f"review-task-{k}.md").write_text(
4112
4231
  f"# Review {tid}: {t['title']} (round {k})\n\n"
4113
4232
  f"Spec and acceptance criteria: {rel}/task.md (criteria ids AC1, AC2… in {rel}/task.json)\n"
@@ -4126,11 +4245,13 @@ def cmd_review(args):
4126
4245
  "database query, a shell command, a file path, HTML or a redirect (injection, path traversal, XSS).\n"
4127
4246
  " When one does not apply (e.g. no new endpoint), there is nothing to report for it."
4128
4247
  + (f" orch saw changes outside the milestone's Likely files: {', '.join(scope)}. Say whether each one was "
4129
- "needed." if scope else "") + "\n"
4248
+ "needed." if scope else "") + owns_txt + "\n"
4130
4249
  "2. `rules`: does it follow the project's own written rules: "
4131
4250
  + (f"{rules['standards']}" if rules["standards"] else "AGENTS.md / CLAUDE.md when the repo has them")
4132
4251
  + (", the decisions listed above" if rules["adrs"] else "")
4133
- + (", the words listed above" if rules["glossary"] else "") +
4252
+ + (", the words listed above" if rules["glossary"] else "")
4253
+ + (f", the house rules of profile `{prof['name']}` in task.md" if prof and prof["rules"] else "")
4254
+ + (", the reviewer profile above" if prof_rv else "") +
4134
4255
  "? A `rules` finding names the rule it breaks in `rule`. Only written rules count: a matter of taste is at "
4135
4256
  "most a suggestion.\n"
4136
4257
  f"The check command (`{check_for(st, tid)}`) runs on this work by itself: don't report what lint, type checks or "
@@ -5332,6 +5453,258 @@ def project_rules_lines(st, rules):
5332
5453
  return out + [""]
5333
5454
 
5334
5455
 
5456
+ # ---------------------------------------------------------------- agent profiles: one project's specialists (6.49.0)
5457
+ # .orchestrate/profiles.md (only on this machine, never committed): `## <name>` sections, each with Role, Owns, Check,
5458
+ # Skills, Rules and Review. A milestone's `Profile: <name>` brings that profile's role, house rules, folders, skills
5459
+ # and check; what the milestone writes itself wins. `## reviewer` is added to every review. No file = nothing changes.
5460
+ PROFILES_FILE = "profiles.md"
5461
+ PROFILE_MAX_CHARS = 1200 # one profile's text; longer ones bloat every brief they go into
5462
+ PROFILE_LIST_FIELDS = ("owns", "skills", "rules", "review")
5463
+ PROFILE_FIELDS = ("role", "check", "repo", *PROFILE_LIST_FIELDS)
5464
+ PROFILE_BULLET_RE = re.compile(r"^\s*(?:[-*+]|\d+[.)])\s+")
5465
+
5466
+
5467
+ def profiles_path(st=None):
5468
+ """The profiles file of this run: .orchestrate/profiles.md, else (a repo of a workspace) the workspace's. None
5469
+ when there is none."""
5470
+ cands = [ORCH / PROFILES_FILE] if ORCH else []
5471
+ ws = (st or {}).get("workspace")
5472
+ if ws:
5473
+ cands.append(Path(ws) / ".orchestrate" / PROFILES_FILE)
5474
+ return next((p for p in cands if p.is_file()), None)
5475
+
5476
+
5477
+ def parse_profiles(text):
5478
+ """profiles.md -> {name: {name, role, check, repo, owns, skills, rules, review, size, unknown}}. A field is
5479
+ `Key: value`; Rules and Review take one item per following line (a bullet starts a new one)."""
5480
+ out, cur, key = {}, None, None
5481
+ for raw in (text or "").splitlines():
5482
+ line = raw.rstrip()
5483
+ m = re.match(r"^##\s+(.+?)\s*#*$", line)
5484
+ if m:
5485
+ name = m.group(1).strip().strip("`*").strip().lower()
5486
+ cur = {"name": name, **{k: "" for k in ("role", "check", "repo")}, **{k: [] for k in PROFILE_LIST_FIELDS},
5487
+ "size": 0, "unknown": [], "dup": name in out} # a second `## web` replaces the first
5488
+ out[name], key = cur, None
5489
+ continue
5490
+ if cur is None or not line.strip() or line.lstrip().startswith("<!--"):
5491
+ continue
5492
+ cur["size"] += len(line.strip()) + 1
5493
+ fm = re.match(r"^([A-Za-z][A-Za-z ]*):\s*(.*)$", line)
5494
+ if fm and not PROFILE_BULLET_RE.match(line) and not line.startswith((" ", "\t")):
5495
+ k = fm.group(1).strip().lower()
5496
+ if k not in PROFILE_FIELDS and key in ("rules", "review"):
5497
+ _profile_add(cur, key, line.strip(), inline=False) # "Note: ..." or a URL is a rule, not a field
5498
+ continue
5499
+ if k not in PROFILE_FIELDS:
5500
+ cur["unknown"].append(fm.group(1).strip())
5501
+ key = None
5502
+ continue
5503
+ key, val = k, fm.group(2).strip()
5504
+ if val:
5505
+ _profile_add(cur, key, val, inline=True)
5506
+ continue
5507
+ if key:
5508
+ _profile_add(cur, key, line.strip(), inline=False, bullet=bool(PROFILE_BULLET_RE.match(line)))
5509
+ return out
5510
+
5511
+
5512
+ def _profile_add(p, key, val, inline, bullet=True):
5513
+ if key in ("role", "check", "repo"):
5514
+ p[key] = (p[key] + " " + val).strip()
5515
+ elif key in ("owns", "skills"):
5516
+ # comma or space separated; `apps/my web/` in backticks keeps its space
5517
+ toks = re.findall(r"`([^`]+)`|([^,\s`]+)", PROFILE_BULLET_RE.sub("", val))
5518
+ p[key] += [w for w in ((a or b).strip().strip("*") for a, b in toks) if w]
5519
+ else: # rules, review
5520
+ items = [x.strip() for x in val.split(";")] if inline and key == "review" else [val]
5521
+ for it in items:
5522
+ it = PROFILE_BULLET_RE.sub("", it).strip()
5523
+ if not it:
5524
+ continue
5525
+ if not bullet and not inline and p[key]:
5526
+ p[key][-1] = p[key][-1] + " " + it # a wrapped line belongs to the item above
5527
+ else:
5528
+ p[key].append(it)
5529
+
5530
+
5531
+ def load_profiles(st=None):
5532
+ """(path, {name: profile}) of this run, or (None, {}) without a profiles file."""
5533
+ p = profiles_path(st)
5534
+ if not p:
5535
+ return None, {}
5536
+ hide_orch_dir(p.parent.parent)
5537
+ try:
5538
+ return p, parse_profiles(p.read_text(errors="replace"))
5539
+ except OSError:
5540
+ return None, {}
5541
+
5542
+
5543
+ def hide_orch_dir(root):
5544
+ """Hide .orchestrate/ (and so profiles.md) from git on this machine (.git/info/exclude), the way `orch start`
5545
+ does, so `git add -A` never picks it up. Nothing happens outside a git repo or when it is hidden already."""
5546
+ with contextlib.suppress(Exception):
5547
+ gd = git_common_dir(root)
5548
+ if not gd or Path(gd).resolve().parent != Path(root).resolve():
5549
+ return # a workspace folder that is not itself a repo
5550
+ ex = Path(gd) / "info" / "exclude"
5551
+ lines = ex.read_text().splitlines() if ex.exists() else []
5552
+ if not {".orchestrate/", "/.orchestrate/", ".orchestrate", "/.orchestrate"} & set(lines):
5553
+ ex.parent.mkdir(parents=True, exist_ok=True)
5554
+ ex.write_text("\n".join(lines + [".orchestrate/"]) + "\n")
5555
+
5556
+
5557
+ def owns_problem(o):
5558
+ """Why an `Owns:` entry can't be used (an absolute path, or one that leaves the repo), else None."""
5559
+ if o.startswith(("/", "~", "\\")) or re.match(r"^[A-Za-z]:[\\/]", o):
5560
+ return "is an absolute path: write it from the repo's top folder, like apps/web/"
5561
+ if ".." in re.split(r"[\\/]", o):
5562
+ return "leaves the repo (..): write a folder inside it, like apps/web/"
5563
+ return None
5564
+
5565
+
5566
+ def owns_match(path, owns):
5567
+ """True when repo path `path` is inside one of the profile's folders. A folder may be a glob: `apps/*/` holds
5568
+ apps/web/a.ts. Entries owns_problem refuses never match."""
5569
+ parts = path.strip("/").split("/")
5570
+ for o in owns:
5571
+ o2 = o.strip().rstrip("/")
5572
+ if not o2 or owns_problem(o):
5573
+ continue
5574
+ if path == o2 or path.startswith(o2 + "/"):
5575
+ return True
5576
+ if any(c in o2 for c in "*?["):
5577
+ if any(fnmatch.fnmatchcase("/".join(parts[:i]), o2) for i in range(1, len(parts) + 1)):
5578
+ return True
5579
+ return False
5580
+
5581
+
5582
+ def plan_profile(t):
5583
+ """The profile name a plan milestone gives (`Profile: web`), None for none or no line."""
5584
+ v = field(t, "profile").strip().strip("`").split()
5585
+ return None if not v or v[0].lower() in ("none", "-", "n/a") else v[0].lower().strip("`")
5586
+
5587
+
5588
+ def task_profile(st, tid):
5589
+ """The profile dict of milestone tid in this run, or None."""
5590
+ name = (st["tasks"].get(tid) or {}).get("profile")
5591
+ return load_profiles(st)[1].get(name) if name else None
5592
+
5593
+
5594
+ def profile_lines(p):
5595
+ """The house rules block of a coder's task file for profile p ([] when it has no rules and no folders)."""
5596
+ if not (p["rules"] or p["owns"]):
5597
+ return []
5598
+ out = [f"House rules for this part of the repo (profile `{p['name']}`; the review checks them)."
5599
+ + (f" Your folders: {', '.join(p['owns'])} (ask before you change anything outside them)." if p["owns"] else "")]
5600
+ return out + [f"- {r}" for r in p["rules"]]
5601
+
5602
+
5603
+ def reviewer_profile_lines(st, prof):
5604
+ """What a review adds from the profiles: the `reviewer` profile (every review) and the milestone's own profile's
5605
+ `Review:` points. [] when there is neither."""
5606
+ rp = load_profiles(st)[1].get("reviewer")
5607
+ out = []
5608
+ if rp and (rp["role"] or rp["rules"]):
5609
+ out.append("This project's reviewer profile" + (f": review as {rp['role']}" if rp["role"] else "")
5610
+ + (". Check these in every review:" if rp["rules"] else "."))
5611
+ out += [f"- {r}" for r in rp["rules"]]
5612
+ if prof and prof["review"]:
5613
+ out.append(f"Also check for this part (profile `{prof['name']}`):")
5614
+ out += [f"- {r}" for r in prof["review"]]
5615
+ return out
5616
+
5617
+
5618
+ def _norm_rule(s):
5619
+ """A rule line for comparing: lower case, no bullet, no markdown, single spaces, no end punctuation."""
5620
+ s = PROFILE_BULLET_RE.sub("", s or "")
5621
+ s = re.sub(r"[`*_]", "", s).lower()
5622
+ return re.sub(r"\s+", " ", s).strip(" .;:!")
5623
+
5624
+
5625
+ def house_rule_lines(st=None):
5626
+ """{normalized line: file} of AGENTS.md, CLAUDE.md and coding-standards.md, for finding rules a profile repeats."""
5627
+ out = {}
5628
+ files = [ROOT / "AGENTS.md", ROOT / "CLAUDE.md", docs_root(st)[0] / "coding-standards.md"]
5629
+ for f in files:
5630
+ try:
5631
+ lines = f.read_text(errors="replace").splitlines() if f.is_file() else []
5632
+ except OSError:
5633
+ lines = []
5634
+ for l in lines:
5635
+ n = _norm_rule(l)
5636
+ if len(n) >= 12 and not l.lstrip().startswith("#"):
5637
+ out.setdefault(n, f.name)
5638
+ return out
5639
+
5640
+
5641
+ def outside_skill(name):
5642
+ """(kind, path or None, folder or None) of a skill named outside the repo: `~/...` or `/...` (a personal skill)
5643
+ or `plugin:<plugin>:<skill>`. kind is None for an ordinary project skill name."""
5644
+ if name.startswith(("~", "/")):
5645
+ p = Path(os.path.expanduser(name))
5646
+ f = p / "SKILL.md" if p.is_dir() or p.name != "SKILL.md" else p
5647
+ return "path", (f if f.is_file() else None), f.parent.parent
5648
+ m = re.fullmatch(r"plugin:([\w.-]+):([\w.-]+)", name)
5649
+ if m:
5650
+ return "plugin", plugin_skill(m.group(1), m.group(2))[0], None
5651
+ return None, None, None
5652
+
5653
+
5654
+ def _plugin_version_key(v):
5655
+ return tuple(int(x) for x in re.findall(r"\d+", str(v or ""))) or (0,)
5656
+
5657
+
5658
+ def plugin_skill(plugin, skill):
5659
+ """(SKILL.md path or None, plugin id `<plugin>@<marketplace>` or None) of a skill in an INSTALLED Claude Code
5660
+ plugin: from installed_plugins.json (its installPath), else the newest version in the plugin cache
5661
+ (cache/<marketplace>/<plugin>/<version>/). A marketplace's own copy is not an install and is never used."""
5662
+ base = Path(os.environ.get("CLAUDE_CODE_PLUGIN_CACHE_DIR") or Path.home() / ".claude" / "plugins")
5663
+ found = [] # (version key, path, id)
5664
+ with contextlib.suppress(Exception):
5665
+ data = json.loads((base / "installed_plugins.json").read_text())
5666
+ for pid, ents in (data.get("plugins") or {}).items():
5667
+ if pid.split("@")[0] != plugin:
5668
+ continue
5669
+ for e in ents if isinstance(ents, list) else [ents]:
5670
+ f = Path(os.path.expanduser(str((e or {}).get("installPath") or ""))) / "skills" / skill / "SKILL.md"
5671
+ if (e or {}).get("installPath") and f.is_file():
5672
+ found.append((_plugin_version_key(e.get("version")), f, pid))
5673
+ if not found:
5674
+ with contextlib.suppress(Exception):
5675
+ for f in (base / "cache").glob(f"*/{plugin}/*/skills/{skill}/SKILL.md"):
5676
+ found.append((_plugin_version_key(f.parents[2].name), f, f"{plugin}@{f.parents[4].name}"))
5677
+ if not found:
5678
+ return None, None
5679
+ _, f, pid = max(found, key=lambda x: x[0])
5680
+ return f, pid
5681
+
5682
+
5683
+ def plugin_enabled(pid):
5684
+ """True / False when a Claude Code settings file turns plugin `pid` on or off (the most specific file wins:
5685
+ the repo's .claude/settings.local.json, then .claude/settings.json, then ~/.claude/settings.json); None when
5686
+ none says."""
5687
+ val = None
5688
+ for f in (Path.home() / ".claude" / "settings.json", ROOT / ".claude" / "settings.json",
5689
+ ROOT / ".claude" / "settings.local.json"):
5690
+ with contextlib.suppress(Exception):
5691
+ ep = json.loads(f.read_text()).get("enabledPlugins") or {}
5692
+ if pid in ep:
5693
+ val = bool(ep[pid])
5694
+ return val
5695
+
5696
+
5697
+ def outside_clash(name, path):
5698
+ """Why a skill outside the repo (`~/...`, `plugin:`) does orch's job in a run, like clash_skills does for the
5699
+ repo's own skills; None when it doesn't."""
5700
+ nm, desc = skill_front(path) if path else (None, "")
5701
+ n = nm or (Path(path).parent.name if path else name.rsplit(":", 1)[-1].rstrip("/").rsplit("/", 1)[-1])
5702
+ why = CLASH_SKILLS.get(n)
5703
+ if not why and CLASH_RE.search(desc or ""):
5704
+ why = "it runs the work itself (its own branch, worktree or helper agents); orch does that in a run"
5705
+ return why
5706
+
5707
+
5335
5708
  # ---------------------------------------------------------------- onboard: set a project up for its agents (6.33.0)
5336
5709
  # `orch onboard` looks at a repo (stack, commands, rule files, the skills each agent can see) with no AI. The lead then
5337
5710
  # proposes only what is missing (`orch lead onboard`), the developer ticks what they want, and `orch onboard done`
@@ -5623,6 +5996,7 @@ def onboard_scan(root, reg=None, everyone=False):
5623
5996
  gaps.append({"id": f"twice:{k}", "say": f"{k} sees these skills twice: {', '.join(a['twice'])}"})
5624
5997
  if clashes:
5625
5998
  gaps.append({"id": "clash", "say": f"{len(clashes)} skill(s) clash with orch in a run: {', '.join(clashes)}"})
5999
+ prof_sugg = profile_suggestions(root, pm)
5626
6000
  st = onboard_state(root)
5627
6001
  if st.get("status") in ("done", "skipped"):
5628
6002
  decide = "quiet"
@@ -5634,7 +6008,91 @@ def onboard_scan(root, reg=None, everyone=False):
5634
6008
  "skills": [{k: s[k] for k in ("name", "description", "path")} for s in skills],
5635
6009
  "agents": {k: {"reads": a["reads"], "sees": len(a["skills"]), "twice": a["twice"]} for k, a in agents.items()},
5636
6010
  "clash": clashes, "gaps": gaps, "state": st.get("status") or "never", "when": st.get("when"),
5637
- "decide": decide, "team": sorted(installed) if left_out else None, "not_in_team": left_out}
6011
+ "decide": decide, "team": sorted(installed) if left_out else None, "not_in_team": left_out,
6012
+ "profiles": prof_sugg, "profiles_file": (root / ".orchestrate" / PROFILES_FILE).is_file(),
6013
+ "part_lines": part_only_lines(root, prof_sugg)}
6014
+
6015
+
6016
+ APP_DIRS = ("frontend", "backend", "client", "server", "web", "api", "mobile", "admin") # a part of the repo
6017
+ APP_PARENTS = ("apps", "services") # monorepo parts
6018
+ APP_MARKS = ("package.json", "pyproject.toml", "requirements.txt", "go.mod", "Cargo.toml", "src")
6019
+ DB_DIRS = ("supabase/migrations", "prisma/migrations", "db/migrations", "migrations", "alembic", "prisma")
6020
+ SKIP_WALK = {"node_modules", ".git", ".orchestrate", "dist", "build", ".next", "vendor", "target", ".venv", "venv"}
6021
+
6022
+
6023
+ def _find_dirs(root, rels, depth=3):
6024
+ """The folders (relative, first found first) under root whose path ends with one of rels, at most depth deep."""
6025
+ out, root = [], Path(root)
6026
+ for cur, dirs, _ in os.walk(root):
6027
+ rel = os.path.relpath(cur, root)
6028
+ lvl = 0 if rel == "." else rel.count(os.sep) + 1
6029
+ dirs[:] = sorted(d for d in dirs if d not in SKIP_WALK) if lvl < depth else []
6030
+ for d in dirs:
6031
+ r = (d if rel == "." else f"{rel}/{d}").replace(os.sep, "/")
6032
+ if any(r == x or r.endswith("/" + x) for x in rels) and not any(r.startswith(o + "/") for o in out):
6033
+ out.append(r)
6034
+ return out
6035
+
6036
+
6037
+ def profile_suggestions(root, pm=None):
6038
+ """Profiles worth offering for this repo, from its real folders and manifests (no AI, no fixed list):
6039
+ [{name, owns, check, why}]. Parts of the repo (apps/*, services/*, or frontend/ + backend/ ...) only when there
6040
+ are two or more (one app needs no split); then a database, tests and infra profile when the repo has those.
6041
+ The `reviewer` profile is always offered: it goes into every review."""
6042
+ root = Path(root)
6043
+ pm = pm or next((m for f, m in (("pnpm-lock.yaml", "pnpm"), ("yarn.lock", "yarn"), ("bun.lockb", "bun"),
6044
+ ("bun.lock", "bun")) if (root / f).exists()), None)
6045
+ apps = []
6046
+ for par in APP_PARENTS:
6047
+ d = root / par
6048
+ for c in sorted(d.iterdir(), key=lambda x: x.name) if d.is_dir() else []:
6049
+ if c.is_dir() and any((c / m).exists() for m in APP_MARKS):
6050
+ apps.append((c.name, f"{par}/{c.name}"))
6051
+ for n in APP_DIRS:
6052
+ if (root / n).is_dir() and any((root / n / m).exists() for m in APP_MARKS) and n not in {a for a, _ in apps}:
6053
+ apps.append((n, n))
6054
+ out = []
6055
+ if len(apps) >= 2:
6056
+ for name, rel in apps:
6057
+ stk, cmds, apm = stack_of(root / rel)
6058
+ test = next((c for c in cmds if c.split()[-1] == "test" or c in ("pytest", "go test ./...", "cargo test")), "")
6059
+ if test and apm == "npm" and pm and pm != "npm" and not (root / rel / "package-lock.json").exists():
6060
+ test = test.replace("npm", pm, 1)
6061
+ out.append({"name": name, "owns": [rel + "/"], "check": f"cd {shlex.quote(rel)} && {test}" if test else "",
6062
+ "why": ", ".join(stk[:3]) or "a part of the repo"})
6063
+ db = _find_dirs(root, DB_DIRS)
6064
+ if db:
6065
+ out.append({"name": "database", "owns": [db[0] + "/"], "check": "", "why": "migrations in " + db[0]})
6066
+ e2e = _find_dirs(root, ("e2e", "tests/e2e", "cypress"), 2)
6067
+ if e2e or any(root.glob("playwright.config.*")):
6068
+ out.append({"name": "tests", "owns": [x + "/" for x in e2e[:2]] or ["playwright.config.*"], "check": "",
6069
+ "why": "end-to-end tests"})
6070
+ infra = [x for x in (".github/workflows/", "Dockerfile", "docker-compose.yml", "infra/", "terraform/")
6071
+ if (root / x.rstrip("/")).exists()]
6072
+ if infra:
6073
+ out.append({"name": "infra", "owns": infra, "check": "", "why": "CI and deployment files"})
6074
+ out.append({"name": "reviewer", "owns": [], "check": "", "why": "goes into every review"})
6075
+ return out
6076
+
6077
+
6078
+ def part_only_lines(root, sugg):
6079
+ """AGENTS.md / CLAUDE.md lines that name exactly one suggested part's folder: [(profile, file, line)]. Only a
6080
+ suggestion to move them into that profile; orch never edits those files."""
6081
+ parts = {s["name"]: [o.rstrip("/*") for o in s["owns"] if o.endswith("/")] for s in sugg if s["name"] != "reviewer"}
6082
+ out = []
6083
+ for f in ("AGENTS.md", "CLAUDE.md"):
6084
+ try:
6085
+ lines = (Path(root) / f).read_text(errors="replace").splitlines() if (Path(root) / f).is_file() else []
6086
+ except OSError:
6087
+ lines = []
6088
+ for l in lines:
6089
+ if l.lstrip().startswith("#") or len(l.strip()) < 12:
6090
+ continue
6091
+ hit = [n for n, os_ in parts.items() if any(re.search(r"(?<![\w/.-])" + re.escape(o) + r"(?![\w-])", l)
6092
+ for o in os_)]
6093
+ if len(hit) == 1:
6094
+ out.append((hit[0], f, l.strip()[:160]))
6095
+ return out[:8]
5638
6096
 
5639
6097
 
5640
6098
  def onboard_report_lines(r):
@@ -5651,6 +6109,16 @@ def onboard_report_lines(r):
5651
6109
  + (f", TWICE: {', '.join(a['twice'])}" if a["twice"] else ""))
5652
6110
  out.append("Gaps:" if r["gaps"] else "Gaps: none")
5653
6111
  out += [f" - {g['say']}" for g in r["gaps"]]
6112
+ if r.get("profiles"):
6113
+ out.append("Profiles you could add (.orchestrate/profiles.md, only on this machine; " +
6114
+ ("profiles.md exists" if r.get("profiles_file") else "none yet") + "):")
6115
+ out += [f" - {p['name']}: " + (", ".join(f"`{o}`" if " " in o else o for o in p["owns"]) + "; "
6116
+ if p["owns"] else "") + p["why"]
6117
+ + (f"; check `{p['check']}`" if p["check"] else "") for p in r["profiles"]]
6118
+ if r.get("part_lines"):
6119
+ out.append("AGENTS.md / CLAUDE.md lines about one part only (suggest moving each to that profile; orch never "
6120
+ "edits these files):")
6121
+ out += [f" - {n} ({f}): {l}" for n, f, l in r["part_lines"]]
5654
6122
  out.append(f"Set up before: {r['state']}" + (f" ({r['when']})" if r.get("when") else ""))
5655
6123
  return out
5656
6124
 
@@ -5684,6 +6152,31 @@ def onboard_plan_note(cwd=None):
5684
6152
  return ("\n".join(out) + "\n\n") if out else ""
5685
6153
 
5686
6154
 
6155
+ def profiles_plan_note():
6156
+ """What `orch lead plan` prints about the project's agent profiles, or "" when it has no profiles file."""
6157
+ try:
6158
+ ws = find_workspace(Path.cwd())
6159
+ root = ws or onboard_root() # `orch lead` runs before ROOT is set
6160
+ p = (root / ".orchestrate" / PROFILES_FILE) if root else None
6161
+ p = p if p and p.is_file() else None
6162
+ if p:
6163
+ hide_orch_dir(root) # a profiles file written by hand: never committed
6164
+ profs = parse_profiles(p.read_text(errors="replace")) if p else {}
6165
+ except Exception: # a problem here never stops the plan
6166
+ return ""
6167
+ coders = [x for n, x in profs.items() if n != "reviewer"]
6168
+ if not coders and "reviewer" not in profs:
6169
+ return ""
6170
+ out = ["AGENT PROFILES (.orchestrate/profiles.md): " + (", ".join(
6171
+ x["name"] + (f" ({', '.join(x['owns'][:3])})" if x["owns"] else "") for x in coders) or "none for coders")
6172
+ + ("; `reviewer` goes into every review by itself" if "reviewer" in profs else "") + "."]
6173
+ if coders:
6174
+ out.append(" Give a milestone that fits one `Profile: <name>`: it brings that part's Role, Skills, Check and "
6175
+ "house rules to the coder, so leave those lines out unless this milestone needs other ones (its "
6176
+ "own line wins). No line or `Profile: none` = no profile.")
6177
+ return "\n".join(out) + "\n\n"
6178
+
6179
+
5687
6180
  def exclude_file(root):
5688
6181
  return Path(git_common_dir(root)) / "info" / "exclude"
5689
6182
 
@@ -5732,6 +6225,7 @@ def cmd_onboard(args):
5732
6225
  rest = args[1:] if args and not args[0].startswith("-") else args
5733
6226
  reg = registry(required=False) or {}
5734
6227
  if sub == "scan":
6228
+ hide_orch_dir(root) # it suggests profiles: .orchestrate/profiles.md is never committed
5735
6229
  r = onboard_scan(root, reg, everyone="--all" in rest)
5736
6230
  if "--json" in rest:
5737
6231
  print(json.dumps(r, indent=2))
@@ -5818,6 +6312,11 @@ def cmd_onboard_done(root, args):
5818
6312
  paths = [a.strip("/") for a in args if not a.startswith("--")]
5819
6313
  if mode not in ("local", "shared"):
5820
6314
  die("usage: orch onboard done --mode local|shared [--no-push] [--no-clash-note] <path>...")
6315
+ orchd = (root / ".orchestrate").resolve()
6316
+ own = [p for p in paths if (root / p).resolve() == orchd or orchd in (root / p).resolve().parents]
6317
+ if own: # profiles.md and the rest of .orchestrate/ stay on this machine
6318
+ die(f"{', '.join(own)}: .orchestrate/ is orch's own folder (profiles.md included) and stays on this machine "
6319
+ f"— never committed, never pushed. Leave it out of `orch onboard done`")
5821
6320
  d = onboard_state(root)
5822
6321
  links = [x["path"] for x in onboard_links(root, d)]
5823
6322
  missing = [p for p in paths if not (root / p).exists() and not (root / p).is_symlink()]
@@ -5957,23 +6456,54 @@ def plan_skills(section):
5957
6456
  return [w for w in names if w and w.lower() not in ("none", "n/a")]
5958
6457
 
5959
6458
 
5960
- def task_skill_lines(section):
5961
- """The task file's skills blocks: the skills the plan gave this milestone (`Skills:`), and the skills the coder
5962
- must not use in a run because orch does their job."""
6459
+ def task_skill_lines(section, prof=None, kind=None):
6460
+ """The task file's skills blocks: the skills the plan gave this milestone (`Skills:`, else its profile's), and
6461
+ the skills the coder must not use in a run because orch does their job. A skill outside the repo (`~/...`,
6462
+ `plugin:<plugin>:<skill>`) is named when the coder's tool reads it by itself, else given as a file to read."""
5963
6463
  root = ROOT
5964
6464
  reg = registry(required=False) or {}
5965
6465
  skills = project_skills(root, reg)
5966
6466
  by_name = {s["name"]: s for s in skills}
5967
- want = plan_skills(section)
5968
- out = []
6467
+ want = plan_skills(section) or (list(prof["skills"]) if prof else [])
6468
+ out, use, seen, oclash = [], [], set(), {}
5969
6469
  if want:
5970
- out += ["## Skills for this step", "Use these skills while you work on this task (your tool lists them):"]
6470
+ v = reg.get(kind) if kind else None
6471
+ reads = {os.path.realpath(d) for d in agent_reads(v, "skills")} if v else set()
5971
6472
  for w in want:
6473
+ okind, path, folder = outside_skill(w)
6474
+ if okind:
6475
+ key = os.path.realpath(path) if path else w
6476
+ if key in seen: # the same skill named twice (its folder and its SKILL.md)
6477
+ continue
6478
+ seen.add(key)
6479
+ nm, desc = skill_front(path) if path else (None, "")
6480
+ why = outside_clash(w, path)
6481
+ if why: # a personal or plugin skill that does orch's job: never "use it"
6482
+ oclash[nm or w] = why
6483
+ continue
6484
+ label = (nm or path.parent.name) if okind == "path" and path else w
6485
+ if okind == "plugin" and path:
6486
+ pid = plugin_skill(*w.split(":")[1:3])[1]
6487
+ if kind == "claude" and pid and plugin_enabled(pid):
6488
+ use.append(f"- {w.split(':', 1)[1]} (your tool lists it): {desc[:200]}")
6489
+ continue
6490
+ if not path:
6491
+ use.append(f"- {w} (not found on this machine)")
6492
+ elif okind == "path" and folder and os.path.realpath(folder) in reads:
6493
+ use.append(f"- {label} (your tool lists it): {desc[:200]}")
6494
+ else:
6495
+ use.append(f"- {label}: open {path} and follow it: {desc[:200]}")
6496
+ continue
6497
+ if w in seen:
6498
+ continue
6499
+ seen.add(w)
5972
6500
  s = by_name.get(w)
5973
- out.append(f"- {w}" + (f" ({s['path']}): {s['description'][:200]}" if s else " (not found in this repo)"))
5974
- out.append("")
5975
- clashes = clash_skills(skills)
5976
- if clashes and onboard_state(root).get("clash_note", True):
6501
+ use.append(f"- {w}" + (f" ({s['path']}): {s['description'][:200]}" if s else " (not found in this repo)"))
6502
+ if use:
6503
+ out += ["## Skills for this step", "Use these skills while you work on this task (your tool lists them):"
6504
+ if not any(": open " in u for u in use) else "Use these skills while you work on this task:", *use, ""]
6505
+ clashes = {**(clash_skills(skills) if onboard_state(root).get("clash_note", True) else {}), **oclash}
6506
+ if clashes:
5977
6507
  out += ["## Skills orch does for you",
5978
6508
  "orch handles your folder, the branch, merging and splitting the work. In this task don't use:"]
5979
6509
  out += [f"- {n}: {why}" for n, why in clashes.items()]
@@ -6001,7 +6531,7 @@ WORKER_RULES = """## Rules for you (the coder)
6001
6531
 
6002
6532
  # plan.md lines that are for the lead and orch, not the coder: they stay in plan.md and task.json
6003
6533
  LEAD_ONLY_FIELDS = {"depends on", "why separate", "prefer", "model", "tier", "needs", "model why", "estimate", "role", "door", "skills",
6004
- "review", "parallel", "plain", "side", "repo"}
6534
+ "review", "parallel", "plain", "side", "repo", "profile"}
6005
6535
 
6006
6536
 
6007
6537
  def coder_section(text, drop_criteria):
@@ -6031,12 +6561,17 @@ def cmd_write_task(args):
6031
6561
  if tid not in secs:
6032
6562
  die(f"{tid} not found in plan.md")
6033
6563
  parts = [f"# Task {tid}: {t['title']}", ""]
6564
+ prof = task_profile(st, tid)
6565
+ house = profile_lines(prof) if prof else []
6034
6566
  if t.get("role"):
6035
6567
  parts += ["## Your role", f"For this task you are: **{t['role']}**.",
6036
6568
  "Work the way that person would. Before you write anything, read the code around the change and "
6037
6569
  "the patterns it already follows. Then build it to the standard that specialist would put their "
6038
6570
  "name on: \"the check passes\" is the floor, not the goal. Before you finish, look at your own "
6039
- "result as that specialist reviewing someone else's work, and fix what they would send back.", ""]
6571
+ "result as that specialist reviewing someone else's work, and fix what they would send back.",
6572
+ *house, ""]
6573
+ elif house:
6574
+ parts += ["## House rules", *house, ""]
6040
6575
  contract = task_contract(st, tid)
6041
6576
  parts += [coder_section(secs[tid].replace(f"## [x] {tid}:", "Title:", 1),
6042
6577
  drop_criteria=bool(contract["acceptance_criteria"])), ""]
@@ -6044,8 +6579,12 @@ def cmd_write_task(args):
6044
6579
  parts += ["## Global instructions", glob, ""]
6045
6580
  rules = project_rules(st, secs[tid] + "\n" + (glob or ""))
6046
6581
  parts += project_rules_lines(st, rules)
6047
- skill_lines, skill_names = task_skill_lines(secs[tid])
6582
+ kind = (st["workers"].get(t.get("worker") or "") or {}).get("kind")
6583
+ skill_lines, skill_names = task_skill_lines(secs[tid], prof, kind)
6048
6584
  parts += skill_lines
6585
+ rv = reviewer_profile_lines(st, prof) if st.get("orch_mode") == "subagent" and t.get("review") else []
6586
+ if rv: # Pi's reviewer subagent reads only this file
6587
+ parts += ["## For the reviewer (coder: you may skip this)", *rv, ""]
6049
6588
  if skill_names:
6050
6589
  contract["skills"] = skill_names
6051
6590
  if t.get("door") == "one-way":
@@ -6415,6 +6954,8 @@ def cmd_fix(args):
6415
6954
  "Estimate: none"]
6416
6955
  if field(src, "role"):
6417
6956
  sec.append(f"Role: {field(src, 'role')}")
6957
+ if field(src, "profile"): # the same profile: its house rules, folders, check and Review points
6958
+ sec.append(f"Profile: {field(src, 'profile')}")
6418
6959
  if field(src, "likely files"):
6419
6960
  sec.append(f"Likely files: {field(src, 'likely files')}")
6420
6961
  if t.get("tier"):
@@ -6431,8 +6972,11 @@ def cmd_fix(args):
6431
6972
  "status": "pending", "reason": f"fix for {tid}", "worker": None, "dir": None, "attempt": 0, "fix": 0,
6432
6973
  "review_round": 0, "wait": None, "files": list(t.get("files") or []), "parallel": False,
6433
6974
  "tier": t.get("tier"), "needs": [], "model_why": f"a fix to {tid}, for the coder who built it." if t.get("tier") else "",
6434
- "go": True, "fix_of": tid, "role": field(src, "role"),
6975
+ "go": True, "fix_of": tid, "role": field(src, "role") or (t.get("role") if t.get("profile") else ""),
6435
6976
  }
6977
+ for k in ("profile", "pcheck"): # what `orch sync` gives it from the Profile: line
6978
+ if t.get(k):
6979
+ st["tasks"][new][k] = t[k]
6436
6980
  if who:
6437
6981
  st["tasks"][new]["assign"] = who
6438
6982
  story_note(st, f"{new} added: a follow-up to {tid} (\"{text[:200]}\"), sent to {who or 'the next free coder'}")
@@ -9080,16 +9624,18 @@ def herdr_screen(pane=None):
9080
9624
  return ws, (w if isinstance(w, int) and w > 0 else None), (h if isinstance(h, int) and h > 0 else None)
9081
9625
 
9082
9626
 
9083
- def team_grid(n, width, height):
9627
+ def team_grid(n, width, height, lead=False):
9084
9628
  """How many panes go in one team tab, and the rows for n of them: [panes in row 1, row 2, ...]. Every pane gets
9085
9629
  at least PANE_MIN_COLS x PANE_MIN_ROWS of a screen this size (2 across when the size is unknown), at most
9086
- TEAM_MAX_PER_TAB per tab, rows as even as they can be (3 -> [2, 1], 4 -> [2, 2])."""
9630
+ TEAM_MAX_PER_TAB per tab, rows as even as they can be (3 -> [2, 1], 4 -> [2, 2]). lead: n counts the lead too,
9631
+ who takes one more place and sits first in the row with the fewest panes, so it is as big as any (3 -> [1, 2])."""
9087
9632
  cols = max(1, width // PANE_MIN_COLS) if width else 2
9088
9633
  rows = max(1, height // PANE_MIN_ROWS) if height else 2
9089
- cap = max(1, min(TEAM_MAX_PER_TAB, cols * rows))
9634
+ cap = max(1, min(TEAM_MAX_PER_TAB + (1 if lead else 0), cols * rows))
9090
9635
  n = min(n, cap)
9091
9636
  r = max(1, -(-n // min(cols, n))) if n else 0
9092
- return cap, [n // r + (1 if i < n % r else 0) for i in range(r)]
9637
+ out = [n // r + (1 if i < n % r else 0) for i in range(r)]
9638
+ return cap, out[::-1] if lead else out
9093
9639
 
9094
9640
 
9095
9641
  def build_grid(rows, first, split):
@@ -9127,22 +9673,61 @@ def _new_pane_id(ok, data, out, key="pane"):
9127
9673
  return pid or (re.search(r'"pane_id"\s*:\s*"([\w:.-]+)"', out or "") or [None, None])[1]
9128
9674
 
9129
9675
 
9130
- def team_tab_panes(new, dry=False, lead_pane=None, st=None):
9676
+ def herdr_tab_panes(pane):
9677
+ """The pane ids in the tab `pane` sits in, from `herdr pane layout` (empty when herdr can't tell)."""
9678
+ ok, data, _ = _herdr_json([HERDR, "pane", "layout", "--pane", pane])
9679
+ return {d["pane_id"] for d, _ in (_dicts_with(data, "pane_id") if ok and data is not None else [])}
9680
+
9681
+
9682
+ def lead_to_team_tab(lead_pane, ws, label, dry, q):
9683
+ """Move the lead's pane into a new tab `label`, focused: the lead keeps running, only its place changes. Returns
9684
+ (pane id, tab id) once moved; (None, None) after a NOTE that it stays where it is. dry: prints the command."""
9685
+ cmd = [HERDR, "pane", "move", lead_pane, "--new-tab"] + (["--workspace", ws] if ws else []) + ["--label", label]
9686
+ if dry:
9687
+ print(f"WOULD lead: {q(cmd)}")
9688
+ return lead_pane, f"<tab {label}>"
9689
+ ok, data, out = _herdr_json(cmd)
9690
+ res = ((data or {}).get("result") or {}).get("move_result") if ok and isinstance(data, dict) else None
9691
+ pane = (res or {}).get("pane") if isinstance(res, dict) else None
9692
+ pid, tab = _find_key(pane, "pane_id"), _find_key(pane, "tab_id")
9693
+ if pid and tab:
9694
+ return pid, tab
9695
+ print(f"NOTE the lead stays in its own tab: herdr could not move pane {lead_pane} "
9696
+ f"({out.splitlines()[-1] if out else 'no output'})")
9697
+ return None, None
9698
+
9699
+
9700
+ def team_tab_panes(new, dry=False, lead_pane=None, st=None, with_lead=False):
9131
9701
  """Open one pane per (name, folder) in `new`, in new herdr tabs ("team", "team 2", ...) laid out by team_grid.
9702
+ with_lead: the lead's pane moves into the first tab, top left (lead_to_team_tab), the team beside and below it.
9132
9703
  Returns ({name: pane id, None when herdr refused; dry: the command it would run}, {name: why it failed},
9133
- [tab labels]). When herdr can't make the first tab (an older herdr), returns ({}, {}, []) after a NOTE, and
9134
- team up opens the panes next to this one as before."""
9704
+ [tab labels], lead moved). When herdr can't make the first tab (an older herdr), returns ({}, {}, [], False)
9705
+ after a NOTE, and team up opens the panes next to this one as before."""
9135
9706
  ws, w, h = herdr_screen(lead_pane)
9136
9707
  cap, _ = team_grid(len(new), w, h)
9137
9708
  placed, errs, labels = {}, {}, []
9138
9709
  q = lambda c: " ".join(shlex.quote(str(x)) for x in c)
9139
- for c, i in enumerate(range(0, len(new), cap)):
9140
- chunk, label = new[i:i + cap], team_tab_label(c, st)
9141
- _, rows = team_grid(len(chunk), w, h)
9710
+ lead_tab = None
9711
+ if with_lead and lead_pane:
9712
+ if team_grid(len(new) + 1, w, h, lead=True)[0] < 2:
9713
+ print(f"NOTE the lead stays in its own tab: this screen ({w}x{h}) fits one agent a tab")
9714
+ else:
9715
+ lead_pane, lead_tab = lead_to_team_tab(lead_pane, ws, team_tab_label(0, st), dry, q)
9716
+ chunks, i = [], 0
9717
+ while i < len(new):
9718
+ k = team_grid(len(new) + 1, w, h, lead=True)[0] - 1 if lead_tab and not chunks else cap
9719
+ chunks.append(new[i:i + k])
9720
+ i += k
9721
+ for c, chunk in enumerate(chunks):
9722
+ label, lead_here = team_tab_label(c, st), bool(lead_tab) and c == 0
9723
+ rows = team_grid(len(chunk) + 1, w, h, lead=True)[1] if lead_here else team_grid(len(chunk), w, h)[1]
9724
+ slots = ([("lead", None)] if lead_here else []) + chunk
9142
9725
  tab_cmd = [HERDR, "tab", "create"] + (["--workspace", ws] if ws else []) + \
9143
9726
  ["--cwd", chunk[0][1], "--label", label, "--no-focus"]
9144
9727
 
9145
9728
  def first():
9729
+ if lead_here:
9730
+ return lead_pane
9146
9731
  if dry:
9147
9732
  placed[chunk[0][0]] = f"new tab: {q(tab_cmd)}"
9148
9733
  return f"<{chunk[0][0]}>"
@@ -9153,7 +9738,7 @@ def team_tab_panes(new, dry=False, lead_pane=None, st=None):
9153
9738
  return pid
9154
9739
 
9155
9740
  def split(cur, direction, ratio, slot):
9156
- name, d = chunk[slot]
9741
+ name, d = slots[slot]
9157
9742
  cmd = [HERDR, "pane", "split", cur, "--direction", direction, "--ratio", f"{ratio:.3f}",
9158
9743
  "--cwd", d, "--no-focus"]
9159
9744
  if dry:
@@ -9165,24 +9750,24 @@ def team_tab_panes(new, dry=False, lead_pane=None, st=None):
9165
9750
  errs[name] = out.splitlines()[-1] if out else "no output"
9166
9751
  return pid
9167
9752
 
9168
- pids = build_grid(rows, first, split)
9169
- if c == 0 and not pids[0] and not dry:
9753
+ pids = build_grid(rows, first, split)[1 if lead_here else 0:]
9754
+ if c == 0 and not lead_here and not pids[0] and not dry:
9170
9755
  print(f"NOTE herdr could not open a tab for the team ({errs.get(chunk[0][0])}), so the panes open "
9171
9756
  f"next to this one")
9172
- return {}, {}, []
9757
+ return {}, {}, [], False
9173
9758
  if not dry:
9174
9759
  placed.update({n: p for (n, _), p in zip(chunk, pids)})
9175
9760
  for (n, _), p in zip(chunk, pids):
9176
9761
  if not p and n not in errs:
9177
9762
  errs[n] = "the pane it splits from was not opened"
9178
9763
  labels.append(label)
9179
- return placed, errs, labels
9764
+ return placed, errs, labels, bool(lead_tab)
9180
9765
 
9181
9766
 
9182
9767
  def team_tidy(args):
9183
9768
  """Move the coders' and the reviewer's panes that are open now (opened by hand, or by an older orch next to the
9184
- lead) into team tabs, as a grid of equal panes, the same layout `orch team up` opens. The agents keep running
9185
- and keep their names. Never moves the lead's pane or the pane this runs in."""
9769
+ lead) into team tabs, as a grid of equal panes, the same layout `orch team up` opens: the lead's pane joins the
9770
+ first, top left. The agents and the lead keep running and keep their names."""
9186
9771
  usage = "usage: orch team tidy [--dry-run]"
9187
9772
  if any(a != "--dry-run" for a in args):
9188
9773
  die(usage)
@@ -9212,10 +9797,23 @@ def team_tidy(args):
9212
9797
  ws, w, h = herdr_screen(lead_pane)
9213
9798
  cap, _ = team_grid(len(panes), w, h)
9214
9799
  q = lambda c: " ".join(shlex.quote(str(x)) for x in c)
9215
- failed, labels = 0, []
9216
- for c, i in enumerate(range(0, len(panes), cap)):
9217
- chunk, label, tab = panes[i:i + cap], team_tab_label(c, st), [None]
9218
- _, rows = team_grid(len(chunk), w, h)
9800
+ failed, labels, lead_tab = 0, [], None
9801
+ if not lead_pane:
9802
+ print("NOTE the lead stays in its own tab: herdr can't find the lead's pane")
9803
+ elif team_grid(len(panes) + 1, w, h, lead=True)[0] < 2:
9804
+ print(f"NOTE the lead stays in its own tab: this screen ({w}x{h}) fits one agent a tab")
9805
+ else:
9806
+ lead_pane, lead_tab = lead_to_team_tab(lead_pane, ws, team_tab_label(0, st), dry, q)
9807
+ chunks, i = [], 0
9808
+ while i < len(panes):
9809
+ k = team_grid(len(panes) + 1, w, h, lead=True)[0] - 1 if lead_tab and not chunks else cap
9810
+ chunks.append(panes[i:i + k])
9811
+ i += k
9812
+ for c, chunk in enumerate(chunks):
9813
+ label, lead_here = team_tab_label(c, st), bool(lead_tab) and c == 0
9814
+ tab = [lead_tab if lead_here else None]
9815
+ rows = team_grid(len(chunk) + 1, w, h, lead=True)[1] if lead_here else team_grid(len(chunk), w, h)[1]
9816
+ slots = ([("lead", lead_pane)] if lead_here else []) + chunk
9219
9817
 
9220
9818
  def move(cmd, name, old):
9221
9819
  if dry:
@@ -9232,12 +9830,14 @@ def team_tidy(args):
9232
9830
  return pid
9233
9831
 
9234
9832
  def first():
9235
- n, p = chunk[0]
9833
+ n, p = slots[0]
9834
+ if lead_here:
9835
+ return p
9236
9836
  return move([HERDR, "pane", "move", p, "--new-tab"] + (["--workspace", ws] if ws else []) +
9237
9837
  ["--label", label, "--no-focus"], n, p)
9238
9838
 
9239
9839
  def split(cur, direction, ratio, slot):
9240
- n, p = chunk[slot]
9840
+ n, p = slots[slot]
9241
9841
  if not dry and not tab[0]:
9242
9842
  print(f"FAILED {n}: herdr did not say which tab \"{label}\" is, so pane {p} stays where it is")
9243
9843
  return None
@@ -9248,8 +9848,9 @@ def team_tidy(args):
9248
9848
  labels.append(label)
9249
9849
  if dry:
9250
9850
  return
9251
- print(f"TEAM TIDY: {'done' if not failed else f'{failed} pane(s) not moved — see above'}; the team is in the "
9252
- f"herdr tab{'s' if len(labels) > 1 else ''} " + ", ".join(f'"{t}"' for t in labels))
9851
+ print(f"TEAM TIDY: {'done' if not failed else f'{failed} pane(s) not moved — see above'}; the "
9852
+ f"{'lead and the team are' if lead_tab else 'team is'} in the herdr tab{'s' if len(labels) > 1 else ''} "
9853
+ + ", ".join(f'"{t}"' for t in labels))
9253
9854
  if failed:
9254
9855
  sys.exit(3)
9255
9856
 
@@ -9277,18 +9878,21 @@ def team_up(args):
9277
9878
  die(f"run `orch start` first: it makes each coder's folder ({', '.join(missing_dirs)} have none yet)")
9278
9879
  # after a restart: panes that only lost their name get it back, and a coder's own pane that came back as a
9279
9880
  # plain shell gets its agent started again, instead of a second pane next to it
9280
- lead_pane = agent_pane(st["lead"]["name"]) if (st.get("lead") or {}).get("name") else None
9881
+ lead_pane = (st.get("lead") or {}).get("pane") or \
9882
+ (agent_pane(st["lead"]["name"]) if (st.get("lead") or {}).get("name") else None)
9281
9883
  empty = {} if dry else rename_lost(dict(st, lead=None), hints=False, keep_out=[lead_pane] if lead_pane else [])
9282
- todo = []
9884
+ todo, running = [], []
9283
9885
  for name, w, d in agents:
9284
9886
  if w.get("pane"):
9285
9887
  ok, _, _ = _herdr_json([HERDR, "pane", "get", w["pane"]])
9286
9888
  print(f"ok {name}: pane {w['pane']}" if ok else
9287
9889
  f"STALE {name}: pane {w['pane']} is gone — remove `@pane:` from plan.md, `orch sync`, then "
9288
9890
  f"`orch team up` again")
9891
+ running.append(w["pane"] if ok else None)
9289
9892
  continue
9290
9893
  if herdr_state(name) is not None:
9291
9894
  print(f"ok {name}: already running")
9895
+ running.append(agent_pane(name))
9292
9896
  continue
9293
9897
  todo.append((name, w, d))
9294
9898
  if not todo:
@@ -9305,12 +9909,16 @@ def team_up(args):
9305
9909
  failed += 1
9306
9910
  continue
9307
9911
  runnable.append((name, w, d, v))
9308
- # new panes go in a herdr tab of their own ("team"), as a grid of equal panes, so the lead keeps its whole
9309
- # screen and every agent stays readable; --here (or a herdr that can't make tabs) splits next to this pane
9912
+ # new panes go in a herdr tab of their own ("team"), as a grid of equal panes, the lead's pane moved in top left
9913
+ # so the developer sees them all; --here (or a herdr that can't make tabs) splits next to this pane
9310
9914
  new = [(n, d) for n, w, d, v in runnable if not empty.get(n)]
9311
- placed, errs, tabs = {}, {}, []
9915
+ placed, errs, tabs, lead_moved = {}, {}, [], False
9312
9916
  if new and "--here" not in args:
9313
- placed, errs, tabs = team_tab_panes(new, dry, lead_pane, st)
9917
+ # the lead joins the team's tab, unless it already sits with agents of this run (it has its team in view)
9918
+ with_lead = bool(lead_pane) and not (set(running + list(empty.values())) - {None}) & herdr_tab_panes(lead_pane)
9919
+ if not lead_pane:
9920
+ print("NOTE the lead stays in its own tab: herdr can't find the lead's pane")
9921
+ placed, errs, tabs, lead_moved = team_tab_panes(new, dry, lead_pane, st, with_lead)
9314
9922
  for name, w, d, v in runnable:
9315
9923
  kind, model = w.get("kind"), w.get("model")
9316
9924
  cmd = launch_cmd(kind, v, model, strict=False, role="reviewer" if name == st.get("reviewer") else None, cwd=d)
@@ -9384,9 +9992,9 @@ def team_up(args):
9384
9992
  f"in pane {pid}")
9385
9993
  pane_labels(st, force=True) # each pane says who it is: "agy-2 · coder", "rev-1 · reviewer", "lead"
9386
9994
  if tabs and not dry:
9387
- print(f"TAB the team is in the herdr tab{'s' if len(tabs) > 1 else ''} " + ", ".join(f'"{t}"' for t in tabs)
9388
- + ", so the lead keeps its whole screen — switch tabs to watch them (`orch team tidy` moves panes "
9389
- "opened by hand there too)")
9995
+ print(f"TAB the {'lead and the team are' if lead_moved else 'team is'} in the herdr tab"
9996
+ f"{'s' if len(tabs) > 1 else ''} " + ", ".join(f'"{t}"' for t in tabs)
9997
+ + (", the lead top left" if lead_moved else "") + " (`orch team tidy` moves panes opened by hand there too)")
9390
9998
  print("TEAM UP: done — run `orch start` again; every agent should show herdr=found" if not failed else
9391
9999
  f"TEAM UP: {failed} agent(s) not ready — see above, then `orch team up` again")
9392
10000
  if failed:
@@ -11507,10 +12115,10 @@ USAGE = """usage: orch <command> [args]
11507
12115
  team up [--dry-run] [--here] [--mode panes|subagent]
11508
12116
  open a herdr pane for every agent in the plan herdr can't find, in its folder, and name it,
11509
12117
  in a herdr tab of their own ("team") as a grid of equal panes (at most 4 a tab, fewer on a
11510
- small screen; more go to "team 2"), so the lead keeps its whole screen. --here: split
12118
+ small screen; more go to "team 2"); the lead's pane moves in, top left. --here: split
11511
12119
  next to this pane instead (subagent mode: no panes; sets up the Pi subagents instead)
11512
12120
  team tidy [--dry-run] move the coder and reviewer panes already open (by hand, or next to the lead) into that
11513
- team tab grid; they keep running and keep their names. Never moves the lead's pane
12121
+ team tab grid, the lead top left; all keep running and keep their names
11514
12122
  mode [panes|subagent] [--agent <kind>] this agent's mode, or save one: panes (herdr panes, the default for
11515
12123
  every agent) or subagent (one Pi window; Pi only). Saved per agent in
11516
12124
  ~/.config/herdr-orchestra/config.json ("modes": {"pi": "subagent"}); ORCH_MODE=panes|subagent
@@ -11954,6 +12562,7 @@ def cmd_lead(args):
11954
12562
  if sub == "plan" and not part:
11955
12563
  print(picker_note(lead_kind()), end="")
11956
12564
  print(onboard_plan_note(), end="") # a project never set up for its agents: set it up first
12565
+ print(profiles_plan_note(), end="") # the project's specialists (.orchestrate/profiles.md), if any
11957
12566
  if subagent and sub == "plan":
11958
12567
  print(SUBAGENT_PLAN_NOTE, end="")
11959
12568
  if sub == "plan":
@@ -11970,6 +12579,7 @@ def cmd_lead(args):
11970
12579
  root = onboard_root() or die("not inside a git repository: run it in the repo to set up")
11971
12580
  if find_workspace(Path.cwd()) is not None:
11972
12581
  die("this folder is a workspace of several repos: run `orch lead onboard` inside each repo")
12582
+ hide_orch_dir(root) # the lead may write .orchestrate/profiles.md: never committed
11973
12583
  r = onboard_scan(root)
11974
12584
  print(f"herdr-orchestra {installed_version()} — lead playbook: onboard\n")
11975
12585
  print(picker_note(lead_kind()), end="")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herdr-orchestra",
3
- "version": "6.48.4",
3
+ "version": "6.49.0",
4
4
  "description": "Orchestrate AI coding agents (Claude Code, Codex, OpenCode, Amp, Pi) as one team: a lead plans, coders build, a reviewer checks, you get one PR. Runs in Herdr panes, or in one Pi window with subagents.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -24,6 +24,8 @@ Make one short list. Each item is a file you would write, and only when somethin
24
24
  - **A folder link** when an agent can't see the skills (the gap says `<agent> can't see ...`): `orch onboard link <its folder> <folder with the skills>`, for example `orch onboard link .agents/skills .agent/skills` when Codex is in the team and the skills are in `.agent/skills`. One copy, no files copied. No `can't see` gap: no link item.
25
25
  - **Skills that clash with orch** (the gap lists them): nothing to write. orch tells coders not to use them during a run; the skills stay as they are. Offer it as an item that is ticked by default.
26
26
 
27
+ - **Agent profiles**: one item per profile under `Profiles you could add` (never another), each a `## <name>` section of `.orchestrate/profiles.md`: `Role:`, `Owns:` and `Check:` as listed, fitting `Skills:`, and `Rules:` (2 to 6, for THAT part only, from its code: where new files go, what to reuse). Never a line AGENTS.md, CLAUDE.md or coding-standards.md has. `reviewer`: `Rules:` every review should check. A `lines about one part only` line: offer moving it to that profile; the developer deletes it from the file.
28
+
27
29
  Where do the new skills go: in the skill folder the repo already uses (the `Project skills:` line above), else `.agents/skills`. If the team has an agent that doesn't read that folder, add the link item too.
28
30
 
29
31
  ## 3. Ask once, in the picker
@@ -45,7 +47,8 @@ Skip, or the picker closed without an answer: run `orch onboard skip` and say "S
45
47
  orch onboard done --mode shared AGENTS.md .agent/skills/supabase-changes
46
48
  ```
47
49
  Add `--no-clash-note` if the developer unticked the clash item. In local mode, a block you added to a TRACKED file moves to orch's own notes for the coders and the file goes back to how git has it: orch never changes a tracked file quietly. In shared mode orch commits on `orch/onboard`, pushes it and opens the PR (your current branch and folder stay as they are), and this run's coders still get the files.
50
+ - Ticked profiles: add them to `.orchestrate/profiles.md`. It stays on this machine whatever the answer to question 2; not in `orch onboard done`.
48
51
  - `orch onboard check` must print no `TWICE` line.
49
52
 
50
53
  ## 5. Tell the developer, in three lines at most
51
- What was set up, where it lives (only on this machine, or the PR link), and that coders now get the matching skills per step. Then, if a plan sent you here, go straight back to it and plan the feature request; when you write milestones, give each one the skills that fit with a `Skills:` line (`Skills: supabase-changes, test-driven-development`).
54
+ What was set up, where it lives (only on this machine, or the PR link), and that coders now get the matching skills per step. Then, if a plan sent you here, go straight back to it and plan the feature request; when you write milestones, give each one the skills that fit with a `Skills:` line (`Skills: supabase-changes, test-driven-development`), or `Profile: <name>`.