herdr-orchestra 6.48.5 → 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 +29 -0
- package/README.md +2 -0
- package/VERSION +1 -1
- package/bin/__pycache__/orchcpython-314.pyc +0 -0
- package/bin/orch +568 -22
- package/package.json +1 -1
- package/playbooks/onboard.md +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
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
|
+
|
|
5
34
|
## [6.48.5] - 2026-12-03
|
|
6
35
|
|
|
7
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.
|
package/README.md
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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"),
|
|
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
|
|
3275
|
-
|
|
3276
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
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
|
-
|
|
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'}")
|
|
@@ -12018,6 +12562,7 @@ def cmd_lead(args):
|
|
|
12018
12562
|
if sub == "plan" and not part:
|
|
12019
12563
|
print(picker_note(lead_kind()), end="")
|
|
12020
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
|
|
12021
12566
|
if subagent and sub == "plan":
|
|
12022
12567
|
print(SUBAGENT_PLAN_NOTE, end="")
|
|
12023
12568
|
if sub == "plan":
|
|
@@ -12034,6 +12579,7 @@ def cmd_lead(args):
|
|
|
12034
12579
|
root = onboard_root() or die("not inside a git repository: run it in the repo to set up")
|
|
12035
12580
|
if find_workspace(Path.cwd()) is not None:
|
|
12036
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
|
|
12037
12583
|
r = onboard_scan(root)
|
|
12038
12584
|
print(f"herdr-orchestra {installed_version()} — lead playbook: onboard\n")
|
|
12039
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.
|
|
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": {
|
package/playbooks/onboard.md
CHANGED
|
@@ -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>`.
|