herdr-orchestra 6.32.0 → 6.33.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 +24 -0
- package/README.md +11 -2
- package/VERSION +1 -1
- package/agents.default.toml +9 -0
- package/bin/__pycache__/orchcpython-314.pyc +0 -0
- package/bin/orch +664 -6
- package/claude-commands/orch-onboard.md +6 -0
- package/install.sh +4 -4
- package/opencode-commands/orch-onboard.md +6 -0
- package/package.json +3 -2
- package/playbooks/onboard.md +50 -0
- package/playbooks/plan.md +5 -2
- package/skills/orch-onboard/SKILL.md +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes. Versions follow [semantic versioning](https://semver.org).
|
|
4
4
|
|
|
5
|
+
## [6.33.0] - 2026-11-28
|
|
6
|
+
|
|
7
|
+
Project setup before the first plan (`orch-onboard`). orch checks what a project has for its agents: the stack, the commands, the rule files and the skills each agent can see. If something is missing, the lead offers it in one list and writes only what you tick.
|
|
8
|
+
|
|
9
|
+
Example: you type `/orch-plan add budget alerts` in rupee-flow. Its 21 skills are in `.agent/skills`, which only AGY reads. Before planning, the lead shows: `[x] Link .agents/skills -> .agent/skills so Codex sees your 21 skills`, `[x] Add the test and lint commands to AGENTS.md`, `[x] Tell coders to skip 4 skills that clash with orch`, and asks **Only for me** or **Share with the repo**. You tick, it sets things up, then it plans budget alerts in the same turn. Next time it says nothing.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **`orch lead plan` checks the project by itself.** A project with no skills, or one never checked that has a real gap, gets a `PROJECT SETUP` line: the lead runs `orch lead onboard` right after preflight and then plans as usual. A project set up or skipped before gets no line. `ORCH_ONBOARD=0` turns the check off.
|
|
13
|
+
- **`orch lead onboard`** (the `orch-onboard` skill, `/orch-onboard`): what orch found, then the setup playbook. The lead proposes only gaps: an `AGENTS.md` with the commands, up to 3 new short skills about this repo when none covers a topic, a folder link, and the clash note. It asks once with the agent's question picker. Rules: nothing written without a tick, your skills and rule files never edited, no skill pack ever downloaded or suggested, no skill created under a name an agent already sees.
|
|
14
|
+
- **`orch onboard [--json]`**: the look itself, with no AI and no changes. Stack from `package.json`, `pyproject.toml`, `go.mod` and others, commands from scripts and the Makefile, rule files, every project skill, what each installed agent sees, and the gaps. `orch onboard skills` lists the skills with what each is for. `orch onboard check` reports a skill an agent sees twice (in the repo and its home folder, or in two folders it reads).
|
|
15
|
+
- **`orch onboard link <folder> <to>`**: one relative folder link (`.agents/skills -> .agent/skills`) so another agent reads the same skills. It never replaces a folder, and it undoes itself if an agent would then see a skill twice.
|
|
16
|
+
- **`orch onboard done --mode local|shared`**:
|
|
17
|
+
- `local`: new files are hidden from git on this machine only, in `.git/info/exclude`. The repo's `.gitignore` is never touched.
|
|
18
|
+
- `shared`: the files are committed on their own branch, `orch/onboard`, without switching branch or touching your index. orch pushes it and opens a PR, and you merge it.
|
|
19
|
+
- Either way, orch never changes a tracked file quietly. Lines you add to a tracked `AGENTS.md` go between `<!-- orch-onboard -->` marks. In local mode they move to `.orchestrate/onboard-notes.md` and the file goes back to how git has it.
|
|
20
|
+
- `orch onboard skip` stops the offer in that project, and `orch onboard status` shows what was done.
|
|
21
|
+
- **Coders get what stayed on this machine.** When a worktree is made or a milestone starts in it, orch links each hidden file and the folder link into the coder's folder. git there stays clean, and nothing lands in a commit.
|
|
22
|
+
- **`Skills:` per milestone.** The plan playbook lists the project's skills (`PROJECT SKILLS`), and the lead gives each milestone the ones that fit. The coder's task file gets **Skills for this step** (each with what it is for), **Skills orch does for you** (skills like `using-git-worktrees`, `finishing-a-development-branch`, `dispatching-parallel-agents` and `subagent-driven-development` are not to be used in a run, because orch does their job) and **Project notes (orch onboard)**. `task.json` lists `skills`. `orch sync` warns about a `Skills:` name the repo doesn't have, or one that clashes.
|
|
23
|
+
- Agent registry: `project_skills_reads`, the skill folders inside a repo each tool reads: Claude Code `.claude/skills`, Codex and Amp `.agents/skills`, AGY `.agent/skills`, Pi `.pi/skills` and `.agents/skills`, OpenCode `.opencode/skills`, `.claude/skills` and `.agents/skills`. These come from each tool's documentation. They were not tried live with every tool, and Hermes is left out.
|
|
24
|
+
- Site: a new page, "Project setup (orch-onboard)", a how-to answer, and the commands and configuration rows.
|
|
25
|
+
|
|
26
|
+
### After updating
|
|
27
|
+
Nothing to do. `orch update` (or the auto-update) installs the `orch-onboard` skill for every agent. The next `/orch-plan` in each project offers the setup once if the project needs it.
|
|
28
|
+
|
|
5
29
|
## [6.32.0] - 2026-11-28
|
|
6
30
|
|
|
7
31
|
The board key (`prefix+a`) opens the board again. Since 6.22.0 the popup flashed open and closed at once.
|
package/README.md
CHANGED
|
@@ -61,8 +61,8 @@ It installs:
|
|
|
61
61
|
| What | Where |
|
|
62
62
|
|---|---|
|
|
63
63
|
| `orch` CLI (scheduler + autopilot) | `~/.local/bin/orch` |
|
|
64
|
-
| `orch-plan`, `orch-run`, `orch-explain` skills, one copy per agent (an agent never lists them twice) | `~/.agents/skills/` or the agent's own skills folder |
|
|
65
|
-
| `/orch-plan`, `/orch-run`, `/orch-explain` OpenCode commands | `~/.config/opencode/commands/` |
|
|
64
|
+
| `orch-plan`, `orch-run`, `orch-explain`, `orch-onboard` skills, one copy per agent (an agent never lists them twice) | `~/.agents/skills/` or the agent's own skills folder |
|
|
65
|
+
| `/orch-plan`, `/orch-run`, `/orch-explain`, `/orch-onboard` OpenCode commands | `~/.config/opencode/commands/` |
|
|
66
66
|
|
|
67
67
|
Updating replaces the skills, it never adds a second copy: the installer picks one folder per agent and removes orch's older copies from the rest (your own skills are left alone). `orch agents check` says `DUPLICATE` if an agent would still see a skill twice.
|
|
68
68
|
| every installed version, side by side | `~/.local/share/herdr-orchestra/` |
|
|
@@ -227,6 +227,15 @@ The agent whose pane you start the plan playbook in becomes the lead. orch names
|
|
|
227
227
|
| Pi | `/skill:orch-explain <topic>` |
|
|
228
228
|
| any other | "use the orch-explain skill: <topic>" (or just "explain X simply") |
|
|
229
229
|
|
|
230
|
+
### Set a project up for its agents
|
|
231
|
+
The first `/orch-plan` in a project checks what the project has for its agents: the stack, the commands, the rule files and the skills each agent can see. It's plain file reading, with no AI. If something is missing, the lead offers it in one list before it plans, and writes only what you tick:
|
|
232
|
+
|
|
233
|
+
- **No skills yet:** an `AGENTS.md` with your commands, and up to 3 short skills about this repo (real folders and commands, never a downloaded pack).
|
|
234
|
+
- **Skills already there:** only the real gaps. For example, Codex reads `.agents/skills` but your skills are in AGY's `.agent/skills`, so one folder link (`.agents/skills -> .agent/skills`) lets both see the same skills. Or no file names your test command, so it goes in one marked block in `AGENTS.md`. Your own skills are never changed.
|
|
235
|
+
- **Where it goes:** **only for me** (hidden from git on your machine with `.git/info/exclude`, nothing committed) or **share with the repo** (its own branch, `orch/onboard`, and a PR). Coders get the files either way.
|
|
236
|
+
|
|
237
|
+
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/).
|
|
238
|
+
|
|
230
239
|
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 rules) or `orch lead plan full` (steps 3 to 10); on a wake-up, `orch events` prints the rules and steps for those events, so the run playbook is read once.
|
|
231
240
|
|
|
232
241
|
### Agent registry
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.33.0
|
package/agents.default.toml
CHANGED
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
# `orch agents sync` picks the fewest folders so each installed tool reads exactly ONE copy
|
|
33
33
|
# of each skill (a skill in two folders it reads is listed twice), and removes orch's copies
|
|
34
34
|
# from every other folder
|
|
35
|
+
# project_skills_reads the skill folders INSIDE a repo the tool reads (relative to the repo), e.g. ".agents/skills".
|
|
36
|
+
# `orch onboard` shows which project skills each agent sees, finds one it can't see or sees twice,
|
|
37
|
+
# and links a folder (never copies) so it sees the same ones; unset: not known for that tool
|
|
35
38
|
# commands_dirs slash-command folders the installer may put orch-plan.md / orch-run.md / orch-explain.md into
|
|
36
39
|
# skills_one_wins true when the tool shows a skill once even if two folders it reads have it (its docs
|
|
37
40
|
# say one copy wins); false or unset: it lists both, so orch keeps exactly one copy
|
|
@@ -59,6 +62,7 @@ skills_one_wins = true
|
|
|
59
62
|
old_dirs = ["~/.claude/commands"]
|
|
60
63
|
invoke = "/orch-plan <feature>"
|
|
61
64
|
verified = true
|
|
65
|
+
project_skills_reads = [".claude/skills"]
|
|
62
66
|
notes = "Claude Code 2.1: --permission-mode acceptEdits in --help; ~/.claude/skills present; herdr kind 'claude'. A skill is also a slash command (/orch-plan) and its docs say a skill beats a ~/.claude/commands file of the same name, so no commands copy is installed. review_launch: --disallowedTools is in --help (2.1); the reviewer keeps Write for its review file."
|
|
63
67
|
|
|
64
68
|
[codex]
|
|
@@ -83,6 +87,7 @@ skills_dirs = ["~/.agents/skills", "~/.codex/skills"]
|
|
|
83
87
|
skills_reads = ["~/.agents/skills", "~/.codex/skills"]
|
|
84
88
|
invoke = "$orch-plan <feature> (or: use the orch-plan skill: <feature>)"
|
|
85
89
|
verified = true
|
|
90
|
+
project_skills_reads = [".agents/skills"]
|
|
86
91
|
notes = "codex-cli 0.167: --full-auto is gone; --approve-for-me routes approvals to automatic review in the workspace-write sandbox. Reads ~/.codex/skills and ~/.agents/skills (its docs name ~/.agents/skills as the user folder, and say two skills with the same name both show up, so orch keeps one copy). codex-cli 0.172 (checked with `codex sandbox`): in workspace-write, .git is read-only and connecting to a local socket is refused; sandbox_workspace_write.network_access=true lets the herdr socket through (it also allows the internet) and writable_roots with the repo's .git lets git work. Thinking level: -c model_reasoning_effort=low|medium|high|xhigh|max. `codex debug models` lists the models this Codex has (see [discover.codex] in models.default.toml). codex-cli 0.172 (checked with `codex features list`): default_mode_request_user_input is an 'under development' feature, off by default; -c features.default_mode_request_user_input=true turns it on (request_user_input is refused in `codex exec`)."
|
|
87
92
|
|
|
88
93
|
[amp]
|
|
@@ -96,6 +101,7 @@ skills_reads = ["~/.config/agents/skills", "~/.agents/skills"]
|
|
|
96
101
|
skills_one_wins = true
|
|
97
102
|
invoke = "use the orch-plan skill: <feature>"
|
|
98
103
|
verified = true
|
|
104
|
+
project_skills_reads = [".agents/skills"]
|
|
99
105
|
notes = "No auto-approve CLI flag; set amp.dangerouslyAllowAll or `amp permissions add` rules in its settings. `amp skill list` lists skills."
|
|
100
106
|
|
|
101
107
|
[opencode]
|
|
@@ -113,6 +119,7 @@ commands_reads = ["~/.config/opencode/commands", "~/.config/opencode/command"]
|
|
|
113
119
|
commands_from = "opencode-commands"
|
|
114
120
|
invoke = "/orch-plan <feature>"
|
|
115
121
|
verified = true
|
|
122
|
+
project_skills_reads = [".opencode/skills", ".claude/skills", ".agents/skills"]
|
|
116
123
|
notes = "Reads ~/.agents/skills and ~/.claude/skills, so only its slash commands are installed."
|
|
117
124
|
|
|
118
125
|
[hermes]
|
|
@@ -137,6 +144,7 @@ roles = ["lead", "coder", "reviewer"]
|
|
|
137
144
|
skills_dirs = ["~/.gemini/config/skills"]
|
|
138
145
|
invoke = "use the orch-plan skill: <feature>"
|
|
139
146
|
verified = true
|
|
147
|
+
project_skills_reads = [".agent/skills"]
|
|
140
148
|
notes = "Antigravity CLI 1.5: --mode accept-edits|auto|plan and --dangerously-skip-permissions. The binary documents ~/.gemini/config/skills/<name>/SKILL.md as the global skills folder."
|
|
141
149
|
|
|
142
150
|
[pi]
|
|
@@ -150,4 +158,5 @@ skills_dirs = ["~/.agents/skills"]
|
|
|
150
158
|
skills_reads = ["~/.pi/agent/skills", "~/.agents/skills"]
|
|
151
159
|
invoke = "/skill:orch-plan <feature>"
|
|
152
160
|
verified = false
|
|
161
|
+
project_skills_reads = [".pi/skills", ".agents/skills"]
|
|
153
162
|
notes = "Pi (pi.dev, npm @earendil-works/pi-coding-agent 1.6): `pi install npm:herdr-orchestra` adds the orch skills and the orch-mode extension (/orch-mode, /orch-setup). Pi also reads ~/.agents/skills, so it may warn once that orch-plan / orch-run are found twice; it keeps the first copy. Docs list `--model`; herdr detection of Pi is unverified, so orch relies on the done file in panes mode. Subagent mode (one Pi window): `/orch-mode subagent` in Pi sets it up (or `orch setup --mode subagent` in a terminal)."
|
|
Binary file
|
package/bin/orch
CHANGED
|
@@ -173,7 +173,7 @@ def state_lock():
|
|
|
173
173
|
# usable while autopilot drives: reads, and the lead's requests (the event manager carries them out)
|
|
174
174
|
LEASE_FREE = {"status", "ready", "pick", "report", "approve", "autopilot", "events", "dispatch", "answer", "defer",
|
|
175
175
|
"fix", "team", "resume", "bench", "stop", "doctor", "plan", "story", "check", "free", "manual", "view",
|
|
176
|
-
"board", "changes"}
|
|
176
|
+
"board", "changes", "onboard"}
|
|
177
177
|
_LEASE = None
|
|
178
178
|
|
|
179
179
|
|
|
@@ -1664,6 +1664,21 @@ def cmd_sync(args):
|
|
|
1664
1664
|
if not path_allowed(pth, files[tid]):
|
|
1665
1665
|
warns.append(f"{tid}'s acceptance criteria name {pth}, which is not in its Likely files — add it, so "
|
|
1666
1666
|
f"the coder may write it")
|
|
1667
|
+
sk_all = None
|
|
1668
|
+
for tid in enabled: # `Skills:` names skills the repo has, and none that clash with a run
|
|
1669
|
+
vals = by_id[tid]["fields"].get("skills", [])
|
|
1670
|
+
names = [w.strip(" `*-") for v in vals for w in re.split(r"[,;]", v)]
|
|
1671
|
+
names = [w for w in names if w and w.lower() not in ("none", "n/a")]
|
|
1672
|
+
if not names:
|
|
1673
|
+
continue
|
|
1674
|
+
if sk_all is None:
|
|
1675
|
+
sk_all = project_skills(ROOT, registry(required=False) or {})
|
|
1676
|
+
have, clash = {x["name"] for x in sk_all}, clash_skills(sk_all)
|
|
1677
|
+
for n in names:
|
|
1678
|
+
if n in clash:
|
|
1679
|
+
warns.append(f"{tid} Skills: {n} does orch's job in a run ({clash[n]}) — leave it out")
|
|
1680
|
+
elif n not in have:
|
|
1681
|
+
warns.append(f"{tid} Skills: {n} is not a skill in this repo (`orch onboard skills` lists them)")
|
|
1667
1682
|
max_tasks = int(os.environ.get("ORCH_MAX_TASKS", "0") or 0) # no limit unless you set one
|
|
1668
1683
|
if max_tasks and len(enabled) > max_tasks:
|
|
1669
1684
|
warns.append(f"{len(enabled)} enabled milestones (> ORCH_MAX_TASKS={max_tasks}). Merge coupled milestones "
|
|
@@ -2620,6 +2635,7 @@ def cmd_start(args):
|
|
|
2620
2635
|
git("worktree", "add", "--detach", str(p), st["branch"], cwd=ROOT)
|
|
2621
2636
|
w["setup_done"] = False
|
|
2622
2637
|
print(f"CREATED worktree {p}")
|
|
2638
|
+
onboard_overlay(p)
|
|
2623
2639
|
w["dir"] = str(p)
|
|
2624
2640
|
else:
|
|
2625
2641
|
for w in st["workers"].values():
|
|
@@ -2848,6 +2864,8 @@ def cmd_prepare(args):
|
|
|
2848
2864
|
src = task_ref(st, tid)
|
|
2849
2865
|
if not in_place:
|
|
2850
2866
|
git("switch", "-q", "--detach", src or st["branch"], cwd=d)
|
|
2867
|
+
for rel in onboard_overlay(d): # project setup kept on this machine: git can't bring it there
|
|
2868
|
+
print(f"LINKED {rel} into {worker}'s folder (project setup, hidden from git)")
|
|
2851
2869
|
else:
|
|
2852
2870
|
if git("rev-parse", "--abbrev-ref", "HEAD", cwd=ROOT).stdout.strip() != st["branch"]:
|
|
2853
2871
|
die(f"main tree is not on {st['branch']}")
|
|
@@ -4389,6 +4407,615 @@ def project_rules_lines(st, rules):
|
|
|
4389
4407
|
return out + [""]
|
|
4390
4408
|
|
|
4391
4409
|
|
|
4410
|
+
# ---------------------------------------------------------------- onboard: set a project up for its agents (6.33.0)
|
|
4411
|
+
# `orch onboard` looks at a repo (stack, commands, rule files, the skills each agent can see) with no AI. The lead then
|
|
4412
|
+
# proposes only what is missing (`orch lead onboard`), the developer ticks what they want, and `orch onboard done`
|
|
4413
|
+
# keeps it on their machine only (.git/info/exclude) or puts it on its own branch with a PR. `orch lead plan` runs the
|
|
4414
|
+
# look by itself, so the developer never has to remember the command.
|
|
4415
|
+
ONBOARD_FILE = "onboard.json" # .orchestrate/onboard.json: done or skipped, the mode, the files orch wrote
|
|
4416
|
+
ONBOARD_NOTES = "onboard-notes.md" # .orchestrate/onboard-notes.md: notes for coders that a tracked file can't take
|
|
4417
|
+
ONBOARD_MARK = ("<!-- orch-onboard -->", "<!-- /orch-onboard -->")
|
|
4418
|
+
ONBOARD_BRANCH = "orch/onboard"
|
|
4419
|
+
# project skill folders orch looks in (each agent's own list is `project_skills_reads` in the agent registry)
|
|
4420
|
+
PROJECT_SKILL_DIRS = (".agent/skills", ".agents/skills", ".claude/skills", ".pi/skills", ".opencode/skills")
|
|
4421
|
+
RULE_FILES = ("AGENTS.md", "CLAUDE.md", "GEMINI.md", ".agent/rules", ".agents/rules", ".cursor/rules", ".cursorrules",
|
|
4422
|
+
".github/copilot-instructions.md")
|
|
4423
|
+
# skills that run the work themselves (their own git folder, merging, helper agents): in a run orch does that
|
|
4424
|
+
CLASH_SKILLS = {
|
|
4425
|
+
"using-git-worktrees": "it makes its own git worktree; orch already gave you a folder",
|
|
4426
|
+
"finishing-a-development-branch": "it merges or pushes the branch; orch lands your work and a person merges the PR",
|
|
4427
|
+
"dispatching-parallel-agents": "it starts helper agents; orch already split the work into milestones",
|
|
4428
|
+
"subagent-driven-development": "it starts helper agents; orch already split the work into milestones",
|
|
4429
|
+
}
|
|
4430
|
+
CLASH_RE = re.compile(r"git worktree|\bworktrees?\b|\bmerg(?:e|es|ing) (?:the |a |this |your )?(?:feature |development )?"
|
|
4431
|
+
r"branch|\bparallel (?:sub)?agents\b", re.I)
|
|
4432
|
+
# package.json dependency -> what it means, in the words a developer uses
|
|
4433
|
+
STACK_NPM = (("next", "Next.js"), ("react-native", "React Native"), ("expo", "Expo"), ("react", "React"),
|
|
4434
|
+
("nuxt", "Nuxt"), ("vue", "Vue"), ("@sveltejs/kit", "SvelteKit"), ("svelte", "Svelte"),
|
|
4435
|
+
("@angular/core", "Angular"), ("@nestjs/core", "NestJS"), ("express", "Express"), ("fastify", "Fastify"),
|
|
4436
|
+
("hono", "Hono"), ("@supabase/supabase-js", "Supabase"), ("@supabase/ssr", "Supabase"),
|
|
4437
|
+
("firebase", "Firebase"), ("@prisma/client", "Prisma"), ("prisma", "Prisma"),
|
|
4438
|
+
("drizzle-orm", "Drizzle"), ("mongoose", "MongoDB (Mongoose)"), ("@trpc/server", "tRPC"),
|
|
4439
|
+
("tailwindcss", "Tailwind"), ("@tanstack/react-query", "TanStack Query"), ("zod", "Zod"),
|
|
4440
|
+
("stripe", "Stripe"), ("razorpay", "Razorpay"), ("next-intl", "i18n (next-intl)"),
|
|
4441
|
+
("i18next", "i18n (i18next)"), ("vitest", "Vitest"), ("jest", "Jest"),
|
|
4442
|
+
("@playwright/test", "Playwright"), ("cypress", "Cypress"), ("typescript", "TypeScript"))
|
|
4443
|
+
# a file in the repo -> what it means
|
|
4444
|
+
STACK_FILES = (("supabase/config.toml", "Supabase"), ("prisma/schema.prisma", "Prisma"), ("go.mod", "Go"),
|
|
4445
|
+
("Cargo.toml", "Rust"), ("pubspec.yaml", "Flutter"), ("Gemfile", "Ruby"), ("composer.json", "PHP"),
|
|
4446
|
+
("pyproject.toml", "Python"), ("requirements.txt", "Python"), ("docker-compose.yml", "Docker Compose"),
|
|
4447
|
+
("compose.yaml", "Docker Compose"))
|
|
4448
|
+
STACK_PY = (("django", "Django"), ("fastapi", "FastAPI"), ("flask", "Flask"), ("pytest", "pytest"))
|
|
4449
|
+
SCRIPT_KEYS = ("dev", "build", "test", "lint", "typecheck", "type-check", "check", "format", "e2e")
|
|
4450
|
+
|
|
4451
|
+
|
|
4452
|
+
def onboard_root(cwd=None):
|
|
4453
|
+
"""The repo's main folder (a coder's worktree counts as its main repo), or None outside a git repo."""
|
|
4454
|
+
gd = git_common_dir(cwd or Path.cwd())
|
|
4455
|
+
return Path(gd).parent if gd else None
|
|
4456
|
+
|
|
4457
|
+
|
|
4458
|
+
def onboard_state(root):
|
|
4459
|
+
p = Path(root) / ".orchestrate" / ONBOARD_FILE
|
|
4460
|
+
try:
|
|
4461
|
+
d = json.loads(p.read_text()) if p.is_file() else {}
|
|
4462
|
+
except (OSError, ValueError):
|
|
4463
|
+
d = {}
|
|
4464
|
+
return d if isinstance(d, dict) else {}
|
|
4465
|
+
|
|
4466
|
+
|
|
4467
|
+
def onboard_save(root, d):
|
|
4468
|
+
p = Path(root) / ".orchestrate" / ONBOARD_FILE
|
|
4469
|
+
p.parent.mkdir(parents=True, exist_ok=True)
|
|
4470
|
+
ex = exclude_file(root) # .orchestrate/ is orch's own: never shown by git (as `orch start` does)
|
|
4471
|
+
lines = ex.read_text().splitlines() if ex.exists() else []
|
|
4472
|
+
if ".orchestrate/" not in lines:
|
|
4473
|
+
ex.parent.mkdir(parents=True, exist_ok=True)
|
|
4474
|
+
ex.write_text("\n".join(lines + [".orchestrate/"]) + "\n")
|
|
4475
|
+
p.write_text(json.dumps(d, indent=2) + "\n")
|
|
4476
|
+
|
|
4477
|
+
|
|
4478
|
+
def skill_front(path):
|
|
4479
|
+
"""SKILL.md -> (name, description) from its front matter (plain `key: value` lines, quoted or folded)."""
|
|
4480
|
+
try:
|
|
4481
|
+
text = Path(path).read_text(errors="replace")
|
|
4482
|
+
except OSError:
|
|
4483
|
+
return None, ""
|
|
4484
|
+
m = re.match(r"?---\s*\n(.*?)\n---", text, re.S)
|
|
4485
|
+
if not m:
|
|
4486
|
+
return None, ""
|
|
4487
|
+
out, key = {}, None
|
|
4488
|
+
for line in m.group(1).splitlines():
|
|
4489
|
+
km = re.match(r"([A-Za-z_-]+):\s*(.*)$", line)
|
|
4490
|
+
if km and not line.startswith((" ", "\t")):
|
|
4491
|
+
key, val = km.group(1).lower(), km.group(2).strip()
|
|
4492
|
+
out[key] = "" if val in (">", "|", ">-", "|-") else val.strip("'\"")
|
|
4493
|
+
elif key and line.strip():
|
|
4494
|
+
out[key] = (out[key] + " " + line.strip()).strip()
|
|
4495
|
+
return out.get("name") or None, out.get("description", "")
|
|
4496
|
+
|
|
4497
|
+
|
|
4498
|
+
def project_skill_dirs(reg):
|
|
4499
|
+
"""Every project skill folder orch knows of: its own list plus each agent's `project_skills_reads`."""
|
|
4500
|
+
out = list(PROJECT_SKILL_DIRS)
|
|
4501
|
+
for v in (reg or {}).values():
|
|
4502
|
+
for d in v.get("project_skills_reads", []) or []:
|
|
4503
|
+
if d not in out:
|
|
4504
|
+
out.append(d)
|
|
4505
|
+
return out
|
|
4506
|
+
|
|
4507
|
+
|
|
4508
|
+
def project_skills(root, reg):
|
|
4509
|
+
"""[{name, description, folder, path, real}] of every SKILL.md in the repo's project skill folders. `folder` is the
|
|
4510
|
+
folder as the repo writes it (`.agent/skills`); `real` is where the skill really is (a link counts once)."""
|
|
4511
|
+
out, real_dirs = [], set()
|
|
4512
|
+
for d in project_skill_dirs(reg):
|
|
4513
|
+
base = Path(root) / d
|
|
4514
|
+
if not base.is_dir() or os.path.realpath(base) in real_dirs: # a linked folder holds the same skills
|
|
4515
|
+
continue
|
|
4516
|
+
real_dirs.add(os.path.realpath(base))
|
|
4517
|
+
for child in sorted(base.iterdir(), key=lambda p: p.name):
|
|
4518
|
+
f = child / "SKILL.md"
|
|
4519
|
+
if not f.is_file():
|
|
4520
|
+
continue
|
|
4521
|
+
name, desc = skill_front(f)
|
|
4522
|
+
out.append({"name": name or child.name, "description": desc, "folder": d, "path": f"{d}/{child.name}",
|
|
4523
|
+
"real": os.path.realpath(child)})
|
|
4524
|
+
return out
|
|
4525
|
+
|
|
4526
|
+
|
|
4527
|
+
def global_skill_names(v):
|
|
4528
|
+
"""Names of the skills in the home folders an agent reads (orch's own and the developer's)."""
|
|
4529
|
+
names = set()
|
|
4530
|
+
for d in agent_reads(v, "skills"):
|
|
4531
|
+
if d.is_dir():
|
|
4532
|
+
names |= {c.name for c in d.iterdir() if (c / "SKILL.md").is_file()}
|
|
4533
|
+
return names
|
|
4534
|
+
|
|
4535
|
+
|
|
4536
|
+
def agent_project_view(root, kind, v, skills):
|
|
4537
|
+
"""What one agent sees of the repo's skills: {reads, skills (one per real folder), twice: names it sees twice}."""
|
|
4538
|
+
reads = list(v.get("project_skills_reads", []) or [])
|
|
4539
|
+
real_dirs, seen, twice = set(), {}, set()
|
|
4540
|
+
for d in reads:
|
|
4541
|
+
p = Path(root) / d
|
|
4542
|
+
if not p.is_dir():
|
|
4543
|
+
continue
|
|
4544
|
+
rd = os.path.realpath(p)
|
|
4545
|
+
if rd in real_dirs: # two names for one folder (a link): one copy
|
|
4546
|
+
continue
|
|
4547
|
+
real_dirs.add(rd)
|
|
4548
|
+
for s in skills:
|
|
4549
|
+
if os.path.realpath(Path(root) / s["folder"]) != rd:
|
|
4550
|
+
continue
|
|
4551
|
+
if s["name"] in seen and seen[s["name"]]["real"] != s["real"]:
|
|
4552
|
+
twice.add(s["name"])
|
|
4553
|
+
seen.setdefault(s["name"], s)
|
|
4554
|
+
home = {n for n in global_skill_names(v) if not n.startswith("orch-")}
|
|
4555
|
+
if v.get("skills_one_wins") is not True:
|
|
4556
|
+
twice |= set(seen) & home # a project skill with the name of one in its home folder: listed twice
|
|
4557
|
+
return {"reads": reads, "skills": list(seen.values()), "twice": sorted(twice)}
|
|
4558
|
+
|
|
4559
|
+
|
|
4560
|
+
def stack_of(root):
|
|
4561
|
+
"""(stack names, commands, package manager) found in the repo's manifests. Plain file reading, no AI."""
|
|
4562
|
+
root = Path(root)
|
|
4563
|
+
stack, cmds, pm = [], [], None
|
|
4564
|
+
pj = root / "package.json"
|
|
4565
|
+
if pj.is_file():
|
|
4566
|
+
try:
|
|
4567
|
+
data = json.loads(pj.read_text(errors="replace"))
|
|
4568
|
+
except ValueError:
|
|
4569
|
+
data = {}
|
|
4570
|
+
deps = {**(data.get("dependencies") or {}), **(data.get("devDependencies") or {})}
|
|
4571
|
+
for dep, label in STACK_NPM:
|
|
4572
|
+
if dep in deps and label not in stack:
|
|
4573
|
+
stack.append(label)
|
|
4574
|
+
pm = ("pnpm" if (root / "pnpm-lock.yaml").exists() else "yarn" if (root / "yarn.lock").exists()
|
|
4575
|
+
else "bun" if (root / "bun.lockb").exists() or (root / "bun.lock").exists() else "npm")
|
|
4576
|
+
scripts = data.get("scripts") or {}
|
|
4577
|
+
for k in SCRIPT_KEYS:
|
|
4578
|
+
if k in scripts:
|
|
4579
|
+
cmds.append(f"{pm} test" if k == "test" and pm in ("npm", "yarn", "pnpm") else f"{pm} run {k}")
|
|
4580
|
+
for f, label in STACK_FILES:
|
|
4581
|
+
if (root / f).exists() and label not in stack:
|
|
4582
|
+
stack.append(label)
|
|
4583
|
+
py = " ".join((root / f).read_text(errors="replace").lower() for f in ("pyproject.toml", "requirements.txt")
|
|
4584
|
+
if (root / f).is_file())
|
|
4585
|
+
for word, label in STACK_PY:
|
|
4586
|
+
if re.search(r"\b" + word + r"\b", py) and label not in stack:
|
|
4587
|
+
stack.append(label)
|
|
4588
|
+
if "pytest" in stack:
|
|
4589
|
+
cmds.append("pytest")
|
|
4590
|
+
if (root / "go.mod").exists():
|
|
4591
|
+
cmds.append("go test ./...")
|
|
4592
|
+
if (root / "Cargo.toml").exists():
|
|
4593
|
+
cmds.append("cargo test")
|
|
4594
|
+
mk = root / "Makefile"
|
|
4595
|
+
if mk.is_file():
|
|
4596
|
+
targets = re.findall(r"^([A-Za-z][\w-]*):", mk.read_text(errors="replace"), re.M)
|
|
4597
|
+
cmds += [f"make {t}" for t in ("test", "lint", "check", "build") if t in targets]
|
|
4598
|
+
return stack, cmds, pm
|
|
4599
|
+
|
|
4600
|
+
|
|
4601
|
+
def rule_files(root):
|
|
4602
|
+
return [f for f in RULE_FILES if (Path(root) / f).exists()] + \
|
|
4603
|
+
[f"docs/{f}" for f in ("glossary.md", "coding-standards.md", "adr") if (Path(root) / "docs" / f).exists()]
|
|
4604
|
+
|
|
4605
|
+
|
|
4606
|
+
def clash_skills(skills):
|
|
4607
|
+
"""The repo's skills that run the work themselves, with why they clash with a run: {name: why}."""
|
|
4608
|
+
out = {}
|
|
4609
|
+
for s in skills:
|
|
4610
|
+
why = CLASH_SKILLS.get(s["name"])
|
|
4611
|
+
if not why and CLASH_RE.search(s["description"] or ""):
|
|
4612
|
+
why = "it runs the work itself (its own branch, worktree or helper agents); orch does that in a run"
|
|
4613
|
+
if why:
|
|
4614
|
+
out[s["name"]] = why
|
|
4615
|
+
return out
|
|
4616
|
+
|
|
4617
|
+
|
|
4618
|
+
def is_tracked(root, rel):
|
|
4619
|
+
return git("ls-files", "--error-unmatch", "--", rel, cwd=root, check=False).returncode == 0
|
|
4620
|
+
|
|
4621
|
+
|
|
4622
|
+
def onboard_scan(root, reg=None):
|
|
4623
|
+
"""The whole look at one repo, as a dict (`orch onboard --json`): stack, commands, rule files, skills, what each
|
|
4624
|
+
installed agent sees, the gaps, and what to do now: full (no project skills: set it up), gaps (never set up, and
|
|
4625
|
+
something is missing), quiet (set up or skipped before, or nothing missing)."""
|
|
4626
|
+
root = Path(root)
|
|
4627
|
+
reg = reg if reg is not None else (registry(required=False) or {})
|
|
4628
|
+
stack, cmds, pm = stack_of(root)
|
|
4629
|
+
rules = rule_files(root)
|
|
4630
|
+
skills = project_skills(root, reg)
|
|
4631
|
+
installed = {k: v for k, v in reg.items() if shutil.which(v.get("binary", k))}
|
|
4632
|
+
agents = {k: agent_project_view(root, k, v, skills) for k, v in sorted(installed.items())}
|
|
4633
|
+
clashes = clash_skills(skills)
|
|
4634
|
+
rules_text = ""
|
|
4635
|
+
for f in rules:
|
|
4636
|
+
p = root / f
|
|
4637
|
+
files = [p] if p.is_file() else sorted(p.rglob("*.md")) if p.is_dir() else []
|
|
4638
|
+
for q in files[:50]:
|
|
4639
|
+
try:
|
|
4640
|
+
rules_text += q.read_text(errors="replace") + "\n"
|
|
4641
|
+
except OSError:
|
|
4642
|
+
pass
|
|
4643
|
+
gaps = []
|
|
4644
|
+
if not skills:
|
|
4645
|
+
gaps.append({"id": "skills", "say": "no project skills: no agent here has a skill about this project"})
|
|
4646
|
+
non_claude = [k for k in installed if k != "claude"]
|
|
4647
|
+
if "AGENTS.md" not in rules and (non_claude or "CLAUDE.md" not in rules):
|
|
4648
|
+
gaps.append({"id": "agents-md", "say": "no AGENTS.md: coders don't know the commands and where things live"})
|
|
4649
|
+
elif cmds and not any(c in rules_text for c in cmds):
|
|
4650
|
+
gaps.append({"id": "commands", "say": f"the rule files don't name the commands ({', '.join(cmds[:4])})"})
|
|
4651
|
+
names = {s["name"] for s in skills}
|
|
4652
|
+
for k, a in agents.items():
|
|
4653
|
+
if skills and a["reads"] and not a["skills"]:
|
|
4654
|
+
src = sorted({s["folder"] for s in skills})[0]
|
|
4655
|
+
gaps.append({"id": f"link:{k}", "say": f"{k} can't see the {len(names)} skill(s) in {src} (it reads "
|
|
4656
|
+
f"{', '.join(a['reads'])})", "link": [a["reads"][0], src]})
|
|
4657
|
+
if a["twice"]:
|
|
4658
|
+
gaps.append({"id": f"twice:{k}", "say": f"{k} sees these skills twice: {', '.join(a['twice'])}"})
|
|
4659
|
+
if clashes:
|
|
4660
|
+
gaps.append({"id": "clash", "say": f"{len(clashes)} skill(s) clash with orch in a run: {', '.join(clashes)}"})
|
|
4661
|
+
st = onboard_state(root)
|
|
4662
|
+
if st.get("status") in ("done", "skipped"):
|
|
4663
|
+
decide = "quiet"
|
|
4664
|
+
elif not skills:
|
|
4665
|
+
decide = "full"
|
|
4666
|
+
else:
|
|
4667
|
+
decide = "gaps" if any(g["id"] != "clash" for g in gaps) else "quiet"
|
|
4668
|
+
return {"root": str(root), "stack": stack, "commands": cmds, "package_manager": pm, "rules": rules,
|
|
4669
|
+
"skills": [{k: s[k] for k in ("name", "description", "path")} for s in skills],
|
|
4670
|
+
"agents": {k: {"reads": a["reads"], "sees": len(a["skills"]), "twice": a["twice"]} for k, a in agents.items()},
|
|
4671
|
+
"clash": clashes, "gaps": gaps, "state": st.get("status") or "never", "when": st.get("when"),
|
|
4672
|
+
"decide": decide}
|
|
4673
|
+
|
|
4674
|
+
|
|
4675
|
+
def onboard_report_lines(r):
|
|
4676
|
+
out = [f"Stack: {', '.join(r['stack']) or 'nothing found in the manifests'}",
|
|
4677
|
+
f"Commands: {', '.join(r['commands']) or 'none found'}",
|
|
4678
|
+
f"Rule files: {', '.join(r['rules']) or 'none'}",
|
|
4679
|
+
f"Project skills: {len(r['skills'])}" + (f" ({', '.join(sorted({s['path'].rsplit('/', 1)[0] for s in r['skills']}))})"
|
|
4680
|
+
if r["skills"] else "")]
|
|
4681
|
+
for k, a in r["agents"].items():
|
|
4682
|
+
out.append(f" {k} reads {', '.join(a['reads']) or 'no project folder (not known)'}: sees {a['sees']}"
|
|
4683
|
+
+ (f", TWICE: {', '.join(a['twice'])}" if a["twice"] else ""))
|
|
4684
|
+
out.append("Gaps:" if r["gaps"] else "Gaps: none")
|
|
4685
|
+
out += [f" - {g['say']}" for g in r["gaps"]]
|
|
4686
|
+
out.append(f"Set up before: {r['state']}" + (f" ({r['when']})" if r.get("when") else ""))
|
|
4687
|
+
return out
|
|
4688
|
+
|
|
4689
|
+
|
|
4690
|
+
def onboard_plan_note(cwd=None):
|
|
4691
|
+
"""What `orch lead plan` prints about project setup before the playbook: the ONBOARD step when the project needs
|
|
4692
|
+
it, the project's skills for `Skills:` lines, or nothing. Never stops the plan."""
|
|
4693
|
+
if os.environ.get("ORCH_ONBOARD") == "0":
|
|
4694
|
+
return ""
|
|
4695
|
+
try:
|
|
4696
|
+
root = onboard_root(cwd)
|
|
4697
|
+
if root is None or find_workspace(Path.cwd()) is not None:
|
|
4698
|
+
return ""
|
|
4699
|
+
r = onboard_scan(root)
|
|
4700
|
+
except Exception as e: # a problem here never stops the plan
|
|
4701
|
+
return f"NOTE project setup check failed ({e}); planning goes on without it.\n\n"
|
|
4702
|
+
out = []
|
|
4703
|
+
if r["decide"] in ("full", "gaps"):
|
|
4704
|
+
why = ("this project has no skills for its agents yet" if r["decide"] == "full"
|
|
4705
|
+
else "this project was never checked for its agents: " + "; ".join(g["say"] for g in r["gaps"]
|
|
4706
|
+
if g["id"] != "clash"))
|
|
4707
|
+
out += [f"PROJECT SETUP: {why}.",
|
|
4708
|
+
" Do this right after step 1 (preflight), before step 2: run `orch lead onboard` and follow it. It asks the developer in one "
|
|
4709
|
+
"list and writes nothing without their tick; the developer can say skip.",
|
|
4710
|
+
" Then come back here and plan the feature request as usual, in the same turn."]
|
|
4711
|
+
if r["skills"]:
|
|
4712
|
+
names = ", ".join(s["name"] for s in r["skills"][:40]) + (" ..." if len(r["skills"]) > 40 else "")
|
|
4713
|
+
out.append(f"PROJECT SKILLS ({len(r['skills'])}, `orch onboard skills` shows what each is for): {names}")
|
|
4714
|
+
if r["clash"]:
|
|
4715
|
+
out.append(f" Never give a milestone these (orch does their job in a run): {', '.join(r['clash'])}")
|
|
4716
|
+
return ("\n".join(out) + "\n\n") if out else ""
|
|
4717
|
+
|
|
4718
|
+
|
|
4719
|
+
def exclude_file(root):
|
|
4720
|
+
return Path(git_common_dir(root)) / "info" / "exclude"
|
|
4721
|
+
|
|
4722
|
+
|
|
4723
|
+
def exclude_add(root, rels):
|
|
4724
|
+
"""Hide paths from git on this machine only: .git/info/exclude (the repo's .gitignore is never touched)."""
|
|
4725
|
+
ex = exclude_file(root)
|
|
4726
|
+
ex.parent.mkdir(parents=True, exist_ok=True)
|
|
4727
|
+
lines = ex.read_text().splitlines() if ex.exists() else []
|
|
4728
|
+
added = []
|
|
4729
|
+
for rel in rels:
|
|
4730
|
+
pat = "/" + rel.strip("/")
|
|
4731
|
+
if pat not in lines:
|
|
4732
|
+
if "# orch onboard: only on this machine" not in lines:
|
|
4733
|
+
lines.append("# orch onboard: only on this machine")
|
|
4734
|
+
lines.append(pat)
|
|
4735
|
+
added.append(pat)
|
|
4736
|
+
ex.write_text("\n".join(lines) + "\n")
|
|
4737
|
+
return added
|
|
4738
|
+
|
|
4739
|
+
|
|
4740
|
+
def take_marked_block(root, rel):
|
|
4741
|
+
"""A tracked file the lead added an orch-onboard block to: take the block out (the file is as git has it again)
|
|
4742
|
+
and return its text, so it reaches the coders through the notes file instead of a quiet change to a tracked file."""
|
|
4743
|
+
p = Path(root) / rel
|
|
4744
|
+
text = p.read_text(errors="replace") if p.is_file() else ""
|
|
4745
|
+
a, b = ONBOARD_MARK
|
|
4746
|
+
i, j = text.find(a), text.find(b)
|
|
4747
|
+
if i < 0 or j < i:
|
|
4748
|
+
return None
|
|
4749
|
+
block = text[i + len(a):j].strip()
|
|
4750
|
+
git("checkout", "-q", "--", rel, cwd=root)
|
|
4751
|
+
return block
|
|
4752
|
+
|
|
4753
|
+
|
|
4754
|
+
def onboard_links(root, d):
|
|
4755
|
+
return [x for x in d.get("files", []) if x.get("type") == "link"]
|
|
4756
|
+
|
|
4757
|
+
|
|
4758
|
+
def cmd_onboard(args):
|
|
4759
|
+
"""orch onboard [scan] [--json] | skills [--json] | check | link <folder> <to> | done --mode local|shared [paths]
|
|
4760
|
+
| skip | status."""
|
|
4761
|
+
args = list(args)
|
|
4762
|
+
root = onboard_root() or die("not inside a git repository")
|
|
4763
|
+
sub = args[0] if args and not args[0].startswith("-") else "scan"
|
|
4764
|
+
rest = args[1:] if args and not args[0].startswith("-") else args
|
|
4765
|
+
reg = registry(required=False) or {}
|
|
4766
|
+
if sub == "scan":
|
|
4767
|
+
r = onboard_scan(root, reg)
|
|
4768
|
+
if "--json" in rest:
|
|
4769
|
+
print(json.dumps(r, indent=2))
|
|
4770
|
+
return
|
|
4771
|
+
print("\n".join(onboard_report_lines(r)))
|
|
4772
|
+
print({"full": "NEEDED this project has no skills for its agents: `orch lead onboard` sets it up",
|
|
4773
|
+
"gaps": "NEEDED some things are missing: `orch lead onboard` offers them",
|
|
4774
|
+
"quiet": "OK nothing to set up now"}[r["decide"]])
|
|
4775
|
+
return
|
|
4776
|
+
if sub == "skills":
|
|
4777
|
+
skills = project_skills(root, reg)
|
|
4778
|
+
clashes = clash_skills(skills)
|
|
4779
|
+
if "--json" in rest:
|
|
4780
|
+
print(json.dumps([{**{k: s[k] for k in ("name", "description", "path")}, "clash": s["name"] in clashes}
|
|
4781
|
+
for s in skills], indent=2))
|
|
4782
|
+
return
|
|
4783
|
+
if not skills:
|
|
4784
|
+
print("no project skills (`orch lead onboard` can write some)")
|
|
4785
|
+
for s in skills:
|
|
4786
|
+
print(f"{s['name']} ({s['path']}){' [clashes with orch in a run]' if s['name'] in clashes else ''}: "
|
|
4787
|
+
f"{s['description'][:160]}")
|
|
4788
|
+
return
|
|
4789
|
+
if sub == "check":
|
|
4790
|
+
r = onboard_scan(root, reg)
|
|
4791
|
+
bad = False
|
|
4792
|
+
for k, a in r["agents"].items():
|
|
4793
|
+
if a["twice"]:
|
|
4794
|
+
bad = True
|
|
4795
|
+
print(f"TWICE {k} sees {', '.join(a['twice'])} twice (in two folders it reads)")
|
|
4796
|
+
else:
|
|
4797
|
+
print(f"OK {k} sees {a['sees']} project skill(s), each once")
|
|
4798
|
+
sys.exit(1 if bad else 0)
|
|
4799
|
+
if sub == "link":
|
|
4800
|
+
if len(rest) < 2:
|
|
4801
|
+
die("usage: orch onboard link <folder> <to-folder> e.g. orch onboard link .agents/skills .agent/skills")
|
|
4802
|
+
link, to = rest[0].strip("/"), rest[1].strip("/")
|
|
4803
|
+
lp, tp = root / link, root / to
|
|
4804
|
+
if not tp.is_dir():
|
|
4805
|
+
die(f"{to} is not a folder in this repo")
|
|
4806
|
+
if lp.exists() or lp.is_symlink():
|
|
4807
|
+
die(f"{link} already exists: orch never replaces a folder (put the skills in one of them by hand)")
|
|
4808
|
+
lp.parent.mkdir(parents=True, exist_ok=True)
|
|
4809
|
+
os.symlink(os.path.relpath(tp, lp.parent), lp)
|
|
4810
|
+
twice = {k: a["twice"] for k, a in onboard_scan(root, reg)["agents"].items() if a["twice"]}
|
|
4811
|
+
if twice:
|
|
4812
|
+
lp.unlink()
|
|
4813
|
+
die("not linked: then " + "; ".join(f"{k} would see {', '.join(n)} twice" for k, n in twice.items()))
|
|
4814
|
+
d = onboard_state(root)
|
|
4815
|
+
d.setdefault("files", []).append({"path": link, "type": "link", "to": to})
|
|
4816
|
+
onboard_save(root, d)
|
|
4817
|
+
print(f"LINKED {link} -> {to} (one copy of the skills; no file copied)")
|
|
4818
|
+
return
|
|
4819
|
+
if sub == "skip":
|
|
4820
|
+
d = onboard_state(root)
|
|
4821
|
+
d.update({"status": "skipped", "when": time.strftime("%Y-%m-%d")})
|
|
4822
|
+
onboard_save(root, d)
|
|
4823
|
+
print("SKIPPED project setup: orch won't ask again here (`orch lead onboard` still sets it up by hand)")
|
|
4824
|
+
return
|
|
4825
|
+
if sub == "status":
|
|
4826
|
+
d = onboard_state(root)
|
|
4827
|
+
print(f"{d.get('status') or 'never'}" + (f" {d.get('when')}" if d.get("when") else "")
|
|
4828
|
+
+ (f", mode {d['mode']}" if d.get("mode") else ""))
|
|
4829
|
+
for x in d.get("files", []):
|
|
4830
|
+
print(f" {x['path']}" + (f" -> {x['to']}" if x.get("type") == "link" else ""))
|
|
4831
|
+
return
|
|
4832
|
+
if sub == "done":
|
|
4833
|
+
cmd_onboard_done(root, rest)
|
|
4834
|
+
return
|
|
4835
|
+
die("usage: orch onboard [scan|skills|check|link <folder> <to>|done --mode local|shared <paths>|skip|status]")
|
|
4836
|
+
|
|
4837
|
+
|
|
4838
|
+
def cmd_onboard_done(root, args):
|
|
4839
|
+
"""Record what onboarding wrote. local: hide each new path with .git/info/exclude. shared: commit them on their own
|
|
4840
|
+
branch (the working folder and the current branch stay as they are), push it and open a PR. Either way a tracked
|
|
4841
|
+
file's orch-onboard block moves to .orchestrate/onboard-notes.md for this run's coders."""
|
|
4842
|
+
args = list(args)
|
|
4843
|
+
mode = None
|
|
4844
|
+
if "--mode" in args:
|
|
4845
|
+
i = args.index("--mode")
|
|
4846
|
+
mode = args[i + 1] if i + 1 < len(args) else None
|
|
4847
|
+
del args[i:i + 2]
|
|
4848
|
+
no_push = "--no-push" in args
|
|
4849
|
+
no_clash = "--no-clash-note" in args
|
|
4850
|
+
paths = [a.strip("/") for a in args if not a.startswith("--")]
|
|
4851
|
+
if mode not in ("local", "shared"):
|
|
4852
|
+
die("usage: orch onboard done --mode local|shared [--no-push] [--no-clash-note] <path>...")
|
|
4853
|
+
d = onboard_state(root)
|
|
4854
|
+
links = [x["path"] for x in onboard_links(root, d)]
|
|
4855
|
+
missing = [p for p in paths if not (root / p).exists() and not (root / p).is_symlink()]
|
|
4856
|
+
if missing:
|
|
4857
|
+
die(f"not found: {', '.join(missing)}")
|
|
4858
|
+
notes, new, changed, marked = [], [], [], []
|
|
4859
|
+
for p in paths:
|
|
4860
|
+
if (root / p).is_file() and is_tracked(root, p):
|
|
4861
|
+
text = (root / p).read_text(errors="replace")
|
|
4862
|
+
if ONBOARD_MARK[0] in text and ONBOARD_MARK[1] in text:
|
|
4863
|
+
marked.append(p)
|
|
4864
|
+
elif mode == "local":
|
|
4865
|
+
die(f"{p} is tracked by git and has no {ONBOARD_MARK[0]} block: orch never changes a tracked file "
|
|
4866
|
+
f"quietly. Put the lines between {ONBOARD_MARK[0]} and {ONBOARD_MARK[1]}.")
|
|
4867
|
+
changed.append(p)
|
|
4868
|
+
elif p not in links:
|
|
4869
|
+
new.append(p)
|
|
4870
|
+
if mode == "local":
|
|
4871
|
+
for p in marked:
|
|
4872
|
+
notes.append((p, take_marked_block(root, p)))
|
|
4873
|
+
pr = None
|
|
4874
|
+
if mode == "local":
|
|
4875
|
+
exclude_add(root, new + links)
|
|
4876
|
+
else:
|
|
4877
|
+
pr = onboard_commit(root, new + changed + links, no_push)
|
|
4878
|
+
for p in changed: # committed on the branch; here the file is as git has it again
|
|
4879
|
+
block = take_marked_block(root, p) if p in marked else None
|
|
4880
|
+
if block:
|
|
4881
|
+
notes.append((p, block))
|
|
4882
|
+
else:
|
|
4883
|
+
git("checkout", "-q", "--", p, cwd=root)
|
|
4884
|
+
exclude_add(root, new + links) # until the PR merges, this run's coders still get them
|
|
4885
|
+
if notes:
|
|
4886
|
+
np = root / ".orchestrate" / ONBOARD_NOTES
|
|
4887
|
+
np.write_text("".join(f"From orch onboard (for {p}):\n{b}\n\n" for p, b in notes))
|
|
4888
|
+
d.update({"status": "done", "when": time.strftime("%Y-%m-%d"), "mode": mode, "clash_note": not no_clash,
|
|
4889
|
+
"files": [x for x in d.get("files", []) if x.get("type") == "link"]
|
|
4890
|
+
+ [{"path": p, "type": "file"} for p in new]})
|
|
4891
|
+
if pr:
|
|
4892
|
+
d["branch"] = pr["branch"]
|
|
4893
|
+
onboard_save(root, d)
|
|
4894
|
+
print(f"DONE project setup ({'only on this machine' if mode == 'local' else 'shared with the repo'}): "
|
|
4895
|
+
f"{len(new)} new, {len(links)} link(s)" + (f", notes for {', '.join(p for p, _ in notes)}" if notes else ""))
|
|
4896
|
+
if mode == "local":
|
|
4897
|
+
print(" hidden from git on this machine only (.git/info/exclude); the repo's .gitignore is unchanged")
|
|
4898
|
+
print(" every coder's folder gets them when its milestone starts")
|
|
4899
|
+
|
|
4900
|
+
|
|
4901
|
+
def onboard_commit(root, rels, no_push):
|
|
4902
|
+
"""Commit `rels` (as they are in the working folder) on top of HEAD into branch orch/onboard, without switching
|
|
4903
|
+
branch or touching the index: a separate index file. Push it and open a PR when there is an origin."""
|
|
4904
|
+
head = git("rev-parse", "HEAD", cwd=root).stdout.strip()
|
|
4905
|
+
base = git("rev-parse", "--abbrev-ref", "HEAD", cwd=root).stdout.strip()
|
|
4906
|
+
branch, n = ONBOARD_BRANCH, 1
|
|
4907
|
+
while git("rev-parse", "-q", "--verify", f"refs/heads/{branch}", cwd=root, check=False).returncode == 0:
|
|
4908
|
+
n += 1
|
|
4909
|
+
branch = f"{ONBOARD_BRANCH}-{n}"
|
|
4910
|
+
fd, idx = tempfile.mkstemp(prefix="orch-onboard-index-")
|
|
4911
|
+
os.close(fd)
|
|
4912
|
+
env = {**os.environ, "GIT_INDEX_FILE": idx}
|
|
4913
|
+
try:
|
|
4914
|
+
subprocess.run(["git", "read-tree", head], cwd=root, env=env, check=True, capture_output=True)
|
|
4915
|
+
subprocess.run(["git", "add", "-f", "--", *rels], cwd=root, env=env, check=True, capture_output=True)
|
|
4916
|
+
tree = subprocess.run(["git", "write-tree"], cwd=root, env=env, check=True, capture_output=True,
|
|
4917
|
+
text=True).stdout.strip()
|
|
4918
|
+
finally:
|
|
4919
|
+
with contextlib.suppress(OSError):
|
|
4920
|
+
os.unlink(idx)
|
|
4921
|
+
msg = "chore: set up agent rules and skills (orch onboard)"
|
|
4922
|
+
commit = git("commit-tree", tree, "-p", head, "-m", msg, cwd=root).stdout.strip()
|
|
4923
|
+
git("update-ref", f"refs/heads/{branch}", commit, cwd=root)
|
|
4924
|
+
print(f"COMMITTED {len(rels)} path(s) on branch {branch} (your branch {base} and folder are unchanged)")
|
|
4925
|
+
if no_push:
|
|
4926
|
+
print(f"NOT PUSHED (--no-push): push {branch} and open a PR into {base} when ready")
|
|
4927
|
+
return {"branch": branch}
|
|
4928
|
+
remote = git("remote", "get-url", "origin", cwd=root, check=False)
|
|
4929
|
+
if remote.returncode != 0:
|
|
4930
|
+
print(f"NO REMOTE: no `origin` remote — merge {branch} into {base} yourself")
|
|
4931
|
+
return {"branch": branch}
|
|
4932
|
+
r = git("push", "-q", "-u", "origin", branch, cwd=root, check=False)
|
|
4933
|
+
if r.returncode != 0:
|
|
4934
|
+
print(f"NOTE push failed: {(r.stdout + r.stderr).strip()} — push {branch} yourself")
|
|
4935
|
+
return {"branch": branch}
|
|
4936
|
+
print(f"PUSHED {branch} to origin")
|
|
4937
|
+
compare = github_compare_url(remote.stdout.strip(), base, branch)
|
|
4938
|
+
if compare and shutil.which("gh"):
|
|
4939
|
+
body = ("Agent rules and skills for this repo, set up by `orch onboard`. Nothing in the app changes.\n\n"
|
|
4940
|
+
+ "".join(f"- `{p}`\n" for p in rels))
|
|
4941
|
+
try:
|
|
4942
|
+
g = subprocess.run(["gh", "pr", "create", "--base", base, "--head", branch, "--title", msg, "--body", body],
|
|
4943
|
+
cwd=root, text=True, capture_output=True, timeout=120)
|
|
4944
|
+
except (OSError, subprocess.TimeoutExpired) as e:
|
|
4945
|
+
g = subprocess.CompletedProcess([], 1, "", str(e))
|
|
4946
|
+
if g.returncode == 0:
|
|
4947
|
+
print(f"PR {g.stdout.strip().splitlines()[-1] if g.stdout.strip() else 'created'}")
|
|
4948
|
+
return {"branch": branch}
|
|
4949
|
+
print(f"NOTE gh pr create failed: {(g.stdout + g.stderr).strip()}")
|
|
4950
|
+
print(f"OPEN A PR from {branch} into {base}" + (f": {compare}" if compare else ""))
|
|
4951
|
+
return {"branch": branch}
|
|
4952
|
+
|
|
4953
|
+
|
|
4954
|
+
def onboard_overlay(dest):
|
|
4955
|
+
"""Put what onboarding kept on this machine into a coder's folder: a link to each new file or skill (git can't
|
|
4956
|
+
carry them, they are hidden from it), and the same folder links. Paths that already exist there are left alone."""
|
|
4957
|
+
if ROOT is None or Path(dest).resolve() == Path(ROOT).resolve():
|
|
4958
|
+
return []
|
|
4959
|
+
d = onboard_state(ROOT)
|
|
4960
|
+
if d.get("status") != "done":
|
|
4961
|
+
return []
|
|
4962
|
+
made = []
|
|
4963
|
+
for x in d.get("files", []):
|
|
4964
|
+
rel = x["path"]
|
|
4965
|
+
dst = Path(dest) / rel
|
|
4966
|
+
if dst.exists() or dst.is_symlink():
|
|
4967
|
+
continue
|
|
4968
|
+
if x.get("type") == "link":
|
|
4969
|
+
target = os.readlink(ROOT / rel) if (ROOT / rel).is_symlink() else None
|
|
4970
|
+
if not target:
|
|
4971
|
+
continue
|
|
4972
|
+
else:
|
|
4973
|
+
src = ROOT / rel
|
|
4974
|
+
if not src.exists():
|
|
4975
|
+
continue
|
|
4976
|
+
target = str(src)
|
|
4977
|
+
with contextlib.suppress(OSError):
|
|
4978
|
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
4979
|
+
os.symlink(target, dst)
|
|
4980
|
+
made.append(rel)
|
|
4981
|
+
return made
|
|
4982
|
+
|
|
4983
|
+
|
|
4984
|
+
def plan_skills(section):
|
|
4985
|
+
"""The skill names a milestone's `Skills:` line gives (`Skills: supabase-changes, test-driven-development`)."""
|
|
4986
|
+
_, tasks = parse_plan(section)
|
|
4987
|
+
vals = tasks[0]["fields"].get("skills", []) if tasks else []
|
|
4988
|
+
names = [w.strip(" `*-") for v in vals for w in re.split(r"[,;]", v)]
|
|
4989
|
+
return [w for w in names if w and w.lower() not in ("none", "n/a")]
|
|
4990
|
+
|
|
4991
|
+
|
|
4992
|
+
def task_skill_lines(section):
|
|
4993
|
+
"""The task file's skills blocks: the skills the plan gave this milestone (`Skills:`), and the skills the coder
|
|
4994
|
+
must not use in a run because orch does their job."""
|
|
4995
|
+
root = ROOT
|
|
4996
|
+
reg = registry(required=False) or {}
|
|
4997
|
+
skills = project_skills(root, reg)
|
|
4998
|
+
by_name = {s["name"]: s for s in skills}
|
|
4999
|
+
want = plan_skills(section)
|
|
5000
|
+
out = []
|
|
5001
|
+
if want:
|
|
5002
|
+
out += ["## Skills for this step", "Use these skills while you work on this task (your tool lists them):"]
|
|
5003
|
+
for w in want:
|
|
5004
|
+
s = by_name.get(w)
|
|
5005
|
+
out.append(f"- {w}" + (f" ({s['path']}): {s['description'][:200]}" if s else " (not found in this repo)"))
|
|
5006
|
+
out.append("")
|
|
5007
|
+
clashes = clash_skills(skills)
|
|
5008
|
+
if clashes and onboard_state(root).get("clash_note", True):
|
|
5009
|
+
out += ["## Skills orch does for you",
|
|
5010
|
+
"orch handles your folder, the branch, merging and splitting the work. In this task don't use:"]
|
|
5011
|
+
out += [f"- {n}: {why}" for n, why in clashes.items()]
|
|
5012
|
+
out.append("")
|
|
5013
|
+
np = root / ".orchestrate" / ONBOARD_NOTES
|
|
5014
|
+
if np.is_file() and np.read_text(errors="replace").strip():
|
|
5015
|
+
out += ["## Project notes (orch onboard)", np.read_text(errors="replace").strip(), ""]
|
|
5016
|
+
return out, want
|
|
5017
|
+
|
|
5018
|
+
|
|
4392
5019
|
WORKER_RULES = """## Rules for you (the coder)
|
|
4393
5020
|
- You own the HOW: the approach, the design inside this milestone, the code, the tests and every fix. This file says what and why; it deliberately doesn't say how.
|
|
4394
5021
|
- Follow the repo's existing patterns (AGENTS.md / CLAUDE.md) and any Interfaces listed above exactly; other milestones rely on them.
|
|
@@ -4405,7 +5032,7 @@ WORKER_RULES = """## Rules for you (the coder)
|
|
|
4405
5032
|
|
|
4406
5033
|
|
|
4407
5034
|
# plan.md lines that are for the lead and orch, not the coder: they stay in plan.md and task.json
|
|
4408
|
-
LEAD_ONLY_FIELDS = {"depends on", "why separate", "prefer", "model", "tier", "needs", "model why", "estimate", "role", "door",
|
|
5035
|
+
LEAD_ONLY_FIELDS = {"depends on", "why separate", "prefer", "model", "tier", "needs", "model why", "estimate", "role", "door", "skills",
|
|
4409
5036
|
"review", "parallel", "plain", "side", "repo"}
|
|
4410
5037
|
|
|
4411
5038
|
|
|
@@ -4449,6 +5076,10 @@ def cmd_write_task(args):
|
|
|
4449
5076
|
parts += ["## Global instructions", glob, ""]
|
|
4450
5077
|
rules = project_rules(st, secs[tid] + "\n" + (glob or ""))
|
|
4451
5078
|
parts += project_rules_lines(st, rules)
|
|
5079
|
+
skill_lines, skill_names = task_skill_lines(secs[tid])
|
|
5080
|
+
parts += skill_lines
|
|
5081
|
+
if skill_names:
|
|
5082
|
+
contract["skills"] = skill_names
|
|
4452
5083
|
if t.get("door") == "one-way":
|
|
4453
5084
|
parts += ["## Hard to undo: show proof",
|
|
4454
5085
|
"This milestone is hard to undo once it runs" + (f" ({t['door_why']})" if t.get("door_why") else "")
|
|
@@ -8972,10 +9603,11 @@ COMMANDS = {
|
|
|
8972
9603
|
"escalate": cmd_escalate, "fix": cmd_fix, "plan": cmd_plan, "story": cmd_story, "manual": cmd_manual, "team": cmd_team, "bench": cmd_bench, "stop": cmd_stop,
|
|
8973
9604
|
"free": cmd_free, "doctor": lambda a: cmd_doctor_crash(a), "check": lambda a: cmd_check(a), "sub": lambda a: cmd_sub(a),
|
|
8974
9605
|
"view": lambda a: cmd_view(a), "board": lambda a: cmd_board(a), "changes": lambda a: cmd_changes(a),
|
|
9606
|
+
"onboard": lambda a: cmd_onboard(a),
|
|
8975
9607
|
}
|
|
8976
9608
|
# they lock per step instead of for the whole command (long-running, or they start the event manager after)
|
|
8977
9609
|
UNLOCKED = {"manual", "autopilot", "poll", "merge", "events", "dispatch", "answer", "defer", "fix", "team", "resume", "bench", "stop",
|
|
8978
|
-
"doctor", "check", "free", "view", "board", "changes"}
|
|
9610
|
+
"doctor", "check", "free", "view", "board", "changes", "onboard"}
|
|
8979
9611
|
|
|
8980
9612
|
USAGE = """usage: orch <command> [args]
|
|
8981
9613
|
version print the installed herdr-orchestra version
|
|
@@ -8986,6 +9618,17 @@ USAGE = """usage: orch <command> [args]
|
|
|
8986
9618
|
lead plan|run print the lead playbook (any agent can lead: "Run `orch lead plan` and follow it")
|
|
8987
9619
|
lead plan quick|full the rest of the plan playbook: a quick run's rules, or steps 3-10 of the full process
|
|
8988
9620
|
lead run --section <EVENT|ALL_DONE|rules> one part of the run playbook (orch events prints these for you)
|
|
9621
|
+
lead onboard the setup playbook: set this project up for its agents (rules, skills) with the
|
|
9622
|
+
developer's tick; `orch lead plan` points the lead to it when a project needs it
|
|
9623
|
+
onboard [--json] what the project has for its agents: stack, commands, rule files, the skills each
|
|
9624
|
+
installed agent sees, and what is missing (no AI, changes nothing)
|
|
9625
|
+
onboard skills|check|status the project's skills (for a milestone's `Skills:`) / skills an agent sees twice /
|
|
9626
|
+
what setup did here
|
|
9627
|
+
onboard link <folder> <to> one folder link so another agent sees the same skills (.agents/skills -> .agent/skills)
|
|
9628
|
+
onboard done --mode local|shared [--no-push] [--no-clash-note] <path>... record the setup: local hides the
|
|
9629
|
+
files from git on this machine only (.git/info/exclude); shared commits them on branch
|
|
9630
|
+
orch/onboard and opens a PR. Coders' folders get them either way
|
|
9631
|
+
onboard skip don't offer project setup here again
|
|
8989
9632
|
lead check preflight: is this agent in a Herdr pane / can it reach herdr?
|
|
8990
9633
|
lead whoami show the lead's own herdr pane and name it as the plan's `Lead:` (default `lead`)
|
|
8991
9634
|
team <kind> [--coders N] [--models a,b] [--no-reviewer] [--prefix <name>]
|
|
@@ -9024,7 +9667,7 @@ USAGE = """usage: orch <command> [args]
|
|
|
9024
9667
|
rounds or escalation for them; the summary lists them as NOT done, with a follow-up
|
|
9025
9668
|
fix <Mn> <text> [--to <worker>] a change to something Mn already landed: a small follow-up milestone, sent
|
|
9026
9669
|
straight to the coder who built Mn (no new plan; check, review and summary still apply)
|
|
9027
|
-
agents sync [kind...] install the orch-plan / orch-run / orch-explain skills so every installed agent sees each one exactly once,
|
|
9670
|
+
agents sync [kind...] install the orch-plan / orch-run / orch-explain / orch-onboard skills so every installed agent sees each one exactly once,
|
|
9028
9671
|
and remove old copies (run it after adding a new agent; the installer runs it)
|
|
9029
9672
|
agents check check every installed agent sees each orch skill once (not missing, not twice)
|
|
9030
9673
|
guard [status|--print] install the pre-push guard: no agent ever pushes to main/master/the default branch
|
|
@@ -9348,10 +9991,23 @@ def cmd_lead(args):
|
|
|
9348
9991
|
guard_ensure(say_changes=False) # no agent pushes to main: the repo refuses it from the start
|
|
9349
9992
|
if sub == "plan" and not part:
|
|
9350
9993
|
print(picker_note(lead_kind()), end="")
|
|
9994
|
+
print(onboard_plan_note(), end="") # a project never set up for its agents: set it up first
|
|
9351
9995
|
if subagent and sub == "plan":
|
|
9352
9996
|
print(SUBAGENT_PLAN_NOTE, end="")
|
|
9353
9997
|
print(plan_playbook_part(pb.read_text(), part) if sub == "plan" else pb.read_text(), end="")
|
|
9354
9998
|
return
|
|
9999
|
+
if sub == "onboard":
|
|
10000
|
+
pb = asset("playbooks/onboard.md") or die("playbooks/onboard.md not found next to orch or in the install")
|
|
10001
|
+
root = onboard_root() or die("not inside a git repository: run it in the repo to set up")
|
|
10002
|
+
if find_workspace(Path.cwd()) is not None:
|
|
10003
|
+
die("this folder is a workspace of several repos: run `orch lead onboard` inside each repo")
|
|
10004
|
+
r = onboard_scan(root)
|
|
10005
|
+
print(f"herdr-orchestra {installed_version()} — lead playbook: onboard\n")
|
|
10006
|
+
print(picker_note(lead_kind()), end="")
|
|
10007
|
+
print("WHAT ORCH FOUND (`orch onboard --json` has all of it):")
|
|
10008
|
+
print("\n".join(" " + l for l in onboard_report_lines(r)) + "\n")
|
|
10009
|
+
print(pb.read_text(), end="")
|
|
10010
|
+
return
|
|
9355
10011
|
if sub == "check":
|
|
9356
10012
|
lead_check()
|
|
9357
10013
|
return
|
|
@@ -9383,7 +10039,7 @@ def cmd_lead(args):
|
|
|
9383
10039
|
print(f"This pane is YOU (the lead). Name it: herdr agent rename {pid or '<pane id>'} {name}")
|
|
9384
10040
|
print(f"Write `Lead: {name} (<your kind>)` in the plan header, and never prompt this pane.")
|
|
9385
10041
|
return
|
|
9386
|
-
die("usage: orch lead plan | run | check | whoami")
|
|
10042
|
+
die("usage: orch lead plan | run | onboard | check | whoami")
|
|
9387
10043
|
|
|
9388
10044
|
|
|
9389
10045
|
def manifest_path():
|
|
@@ -9702,7 +10358,7 @@ def cmd_agents(args):
|
|
|
9702
10358
|
missing = [k for k, v in reg.items()
|
|
9703
10359
|
if installed[k] and any(st != "ok" for _, st in agent_assets(v))]
|
|
9704
10360
|
if missing:
|
|
9705
|
-
print(f"\n{', '.join(missing)}: orch skills (orch-plan/orch-run/orch-explain) missing or listed twice — run: orch agents sync")
|
|
10361
|
+
print(f"\n{', '.join(missing)}: orch skills (orch-plan/orch-run/orch-explain/orch-onboard) missing or listed twice — run: orch agents sync")
|
|
9706
10362
|
print(f"\nOverride or add kinds in {user_agents_file()}")
|
|
9707
10363
|
|
|
9708
10364
|
|
|
@@ -11027,6 +11683,8 @@ def workspace_main(ws, cmd, args):
|
|
|
11027
11683
|
print(f"== {name} ({paths[name]})")
|
|
11028
11684
|
sys.stdout.flush()
|
|
11029
11685
|
return subprocess.run(me + [cmd, *a], cwd=paths[name]).returncode
|
|
11686
|
+
if cmd == "onboard":
|
|
11687
|
+
die(f"project setup is per repo: run `orch onboard` inside each repo ({', '.join(paths.values())})")
|
|
11030
11688
|
if cmd in ("view", "board"):
|
|
11031
11689
|
die(f"`orch {cmd}` shows one repo's run: run it inside one of the repos ({', '.join(paths.values())})")
|
|
11032
11690
|
if cmd == "sub":
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Set this project up for its agents: AGENTS.md, short skills about this repo, one skill folder every agent sees; nothing written without your tick"
|
|
3
|
+
---
|
|
4
|
+
Run `orch lead onboard` (or `~/.local/bin/orch lead onboard` if `orch` is not on PATH) and follow its output exactly.
|
|
5
|
+
Notes from the developer: $ARGUMENTS
|
|
6
|
+
Hard rule: never push to main or master and never merge a PR, even if the user asks; say so and offer a branch and a PR instead (a person merges it).
|
package/install.sh
CHANGED
|
@@ -102,8 +102,8 @@ case "$ACTION" in
|
|
|
102
102
|
done < "$MANIFEST"
|
|
103
103
|
fi
|
|
104
104
|
rm -f "$BIN/orch"
|
|
105
|
-
rm -rf "$SKILLS/orch-plan" "$SKILLS/orch-run" "$SKILLS/orch-explain" "$SHARE"
|
|
106
|
-
for d in "${OC_CMDS[@]}"; do rm -f "$d/orch-plan.md" "$d/orch-run.md" "$d/orch-explain.md"; done
|
|
105
|
+
rm -rf "$SKILLS/orch-plan" "$SKILLS/orch-run" "$SKILLS/orch-explain" "$SKILLS/orch-onboard" "$SHARE"
|
|
106
|
+
for d in "${OC_CMDS[@]}"; do rm -f "$d/orch-plan.md" "$d/orch-run.md" "$d/orch-explain.md" "$d/orch-onboard.md"; done
|
|
107
107
|
say "herdr-orchestra removed. (The herdr skill and your projects' .orchestrate/ folders were left alone.)"
|
|
108
108
|
exit 0;;
|
|
109
109
|
esac
|
|
@@ -175,7 +175,7 @@ touch "$MANIFEST"
|
|
|
175
175
|
record() { grep -qxF "$1" "$MANIFEST" || echo "$1" >> "$MANIFEST"; }
|
|
176
176
|
install_skills() { # install_skills <skills dir>
|
|
177
177
|
local s
|
|
178
|
-
for s in orch-plan orch-run orch-explain; do
|
|
178
|
+
for s in orch-plan orch-run orch-explain orch-onboard; do
|
|
179
179
|
rm -rf "${1:?}/$s"; mkdir -p "$1/$s"
|
|
180
180
|
cp "$CUR/skills/$s/SKILL.md" "$1/$s/SKILL.md"; record "$1/$s"
|
|
181
181
|
done
|
|
@@ -194,7 +194,7 @@ if ! "$CUR/bin/orch" agents sync; then
|
|
|
194
194
|
warn "per-agent skills skipped (orch agents sync failed — Python >= 3.11 needed for the agent registry)"
|
|
195
195
|
install_skills "$SKILLS" # ~/.agents/skills: Amp, OpenCode and Codex read it
|
|
196
196
|
install_commands "${OC_CMDS[0]}" opencode-commands # one folder only: OpenCode reads both, two = listed twice
|
|
197
|
-
rm -f "${OC_CMDS[1]}/orch-plan.md" "${OC_CMDS[1]}/orch-run.md" "${OC_CMDS[1]}/orch-explain.md"
|
|
197
|
+
rm -f "${OC_CMDS[1]}/orch-plan.md" "${OC_CMDS[1]}/orch-run.md" "${OC_CMDS[1]}/orch-explain.md" "${OC_CMDS[1]}/orch-onboard.md"
|
|
198
198
|
fi
|
|
199
199
|
# the board popup plugin: a link made by an older version points at that version's folder; move it to `current`
|
|
200
200
|
ORCH_SHARE="$SHARE" "$CUR/bin/orch" view plugin refresh 2>/dev/null || true
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Set this project up for its agents: AGENTS.md, short skills about this repo, one skill folder every agent sees; nothing written without your tick"
|
|
3
|
+
---
|
|
4
|
+
Run `orch lead onboard` (or `~/.local/bin/orch lead onboard` if `orch` is not on PATH) and follow its output exactly.
|
|
5
|
+
Notes from the developer: $ARGUMENTS
|
|
6
|
+
Hard rule: never push to main or master and never merge a PR, even if the user asks; say so and offer a branch and a PR instead (a person merges it).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "herdr-orchestra",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.33.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": {
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"skills": [
|
|
58
58
|
"./pi/skills/orch-plan",
|
|
59
59
|
"./skills/orch-run",
|
|
60
|
-
"./skills/orch-explain"
|
|
60
|
+
"./skills/orch-explain",
|
|
61
|
+
"./skills/orch-onboard"
|
|
61
62
|
],
|
|
62
63
|
"extensions": [
|
|
63
64
|
"./extensions/orch-mode.ts"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
You are setting this project up for its agents (project setup, `orch onboard`). You may be the lead of a plan that sent you here (`PROJECT SETUP` in `orch lead plan`), or the developer asked for it (`/orch-onboard`). The look at the repo is above: WHAT ORCH FOUND. It is the same on every run and cost nothing; now you add judgement.
|
|
2
|
+
|
|
3
|
+
Hard rules:
|
|
4
|
+
- **Nothing is written without the developer's tick.** You propose; they choose.
|
|
5
|
+
- **Never edit, move or delete a skill or rule file the developer already has.** A missing fact goes in `AGENTS.md` (below), a missing topic becomes a NEW skill.
|
|
6
|
+
- **Never create a skill whose name an agent already sees** (in the repo or its home folder): `orch onboard skills` lists the repo's.
|
|
7
|
+
- **No outside skill packs.** Never download, install or suggest one. You only write short skills from this repo's own code.
|
|
8
|
+
- **Never push to main** or merge a PR, even if the developer asks. Shared setup goes on its own branch with a PR that a person merges.
|
|
9
|
+
|
|
10
|
+
## 1. Look (read-only, a few minutes at most)
|
|
11
|
+
- Read the rule files listed above, `README`, and 3 to 5 real files that show how this repo works: one page or route, one API handler, one database change or migration, one test. Run `orch onboard skills` to see what the existing skills cover.
|
|
12
|
+
- Note facts only: the commands, where things live (`app/`, `supabase/migrations/`), the patterns the code follows (server actions, RLS on every table, tests next to the file).
|
|
13
|
+
|
|
14
|
+
## 2. Propose only the gaps
|
|
15
|
+
Make one short list. Each item is a file you would write, and only when something is really missing:
|
|
16
|
+
- **`AGENTS.md`** (Codex, Pi, OpenCode and Amp read it by themselves, and orch's task files point every coder to it): the commands (`npm test`, `npm run lint`, `npm run build`), where things live, and the house patterns, in under 40 lines. Claude-only team: `CLAUDE.md` instead. When the file exists and only some facts are missing (for example it never names the test command), propose adding just those lines **inside one marked block**, never touching the developer's own lines:
|
|
17
|
+
```
|
|
18
|
+
<!-- orch-onboard -->
|
|
19
|
+
Tests: npm test (Vitest, test files next to the code)
|
|
20
|
+
<!-- /orch-onboard -->
|
|
21
|
+
```
|
|
22
|
+
- **A new skill** for a topic this repo does often and no existing skill covers (match on the name and the description: `frontend-developer` already covers Next.js pages, so no "nextjs" skill). Only when the folder list above says **no project skills**, or for a clear gap. Each skill is about THIS repo: real folder names, real commands, the pattern to copy and one example file to look at, at most 80 lines. Example for a Next.js + Supabase repo: `supabase-changes` ("Use when adding or changing a table: migrations live in supabase/migrations, every table gets RLS rules, run `supabase db diff` ..."). Never a general best-practices essay. At most 3 new skills.
|
|
23
|
+
- **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` so Codex sees the same skills as AGY. One copy, no files copied.
|
|
24
|
+
- **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.
|
|
25
|
+
|
|
26
|
+
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.
|
|
27
|
+
|
|
28
|
+
## 3. Ask once, in the picker
|
|
29
|
+
Use your question picker (the `QUESTION PICKER` line above names it; chat when there is none) with two questions:
|
|
30
|
+
1. **What should I set up?** Multi-select: each item from step 2 as a short line (`AGENTS.md with npm test / lint / build`, `New skill supabase-changes: how this repo adds tables`, `Link .agents/skills -> .agent/skills so Codex sees your 21 skills`, `Tell coders to skip 4 skills that clash with orch`). Recommended: all ticked. Plus **Skip: don't set up this project**.
|
|
31
|
+
2. **Where should it go?**
|
|
32
|
+
- **Only for me** (recommended for a company or team repo, or when the repo's remote is not the developer's own): the files stay in this folder, hidden from git on this machine only (`.git/info/exclude`; the repo's `.gitignore` is not touched). Nothing is committed, teammates never see them.
|
|
33
|
+
- **Share with the repo** (recommended for the developer's own project): the files go on branch `orch/onboard` with a PR; the developer merges it.
|
|
34
|
+
|
|
35
|
+
Skip, or the picker closed without an answer: run `orch onboard skip` and say "Skipped project setup; I won't ask again here." Then go back to the plan if one sent you.
|
|
36
|
+
|
|
37
|
+
## 4. Write what was ticked
|
|
38
|
+
- Write the files. A new skill is `<folder>/<name>/SKILL.md` with front matter `name:` and `description:` ("Use when ..."), then the body.
|
|
39
|
+
- An existing tracked `AGENTS.md`: add only the marked block (step 2).
|
|
40
|
+
- Run each ticked `orch onboard link ...`.
|
|
41
|
+
- Then record it, with every path you wrote (not the links, orch knows them):
|
|
42
|
+
```
|
|
43
|
+
orch onboard done --mode local AGENTS.md .agent/skills/supabase-changes
|
|
44
|
+
orch onboard done --mode shared AGENTS.md .agent/skills/supabase-changes
|
|
45
|
+
```
|
|
46
|
+
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.
|
|
47
|
+
- `orch onboard check` must print no `TWICE` line.
|
|
48
|
+
|
|
49
|
+
## 5. Tell the developer, in three lines at most
|
|
50
|
+
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`).
|
package/playbooks/plan.md
CHANGED
|
@@ -25,6 +25,7 @@ Feature request = the user's message that asked you to run this playbook.
|
|
|
25
25
|
|
|
26
26
|
## 2. Research (read-only, before planning anything)
|
|
27
27
|
- Read `AGENTS.md` / `CLAUDE.md` / `README` and any spec the request points to.
|
|
28
|
+
- **The project's skills**, when the `PROJECT SKILLS` line above lists some: `orch onboard skills` says what each one is for. You give each milestone the ones that fit (`Skills:`, step 9); never one that line says orch does the job of.
|
|
28
29
|
- Map the parts of the codebase the feature touches: entry points, the modules and files involved, existing patterns to follow (how similar features are built), data models and tables, tests and how they run.
|
|
29
30
|
- **Monorepo?** (workspaces in `package.json`/`pnpm-workspace.yaml`/`turbo.json`/`nx.json`, or folders like `apps/*`, `packages/*`, `backend/` + `frontend/`, `server/` + `client/`): list each app/package the feature touches, what it owns (API, web UI, mobile, shared types), and how each one is checked. For a feature that spans backend and frontend, understand BOTH sides well enough to write the contract between them: endpoints, request/response fields, where the shared types live. When each side has its own quicker check (e.g. `cd frontend && npm test`), note it for a `Check <side>:` line (step 9a).
|
|
30
31
|
- **Several repos?** Frontend and backend in separate git repos under one folder (a workspace): research each repo the feature touches, its check and setup commands, and the contract between them (step 9a).
|
|
@@ -69,7 +70,7 @@ If any is false, use the full process: run `orch lead plan full` and follow its
|
|
|
69
70
|
- **First run `orch lead plan quick`.** It prints the rules a quick plan uses, word for word from the full process: the split test, the tiers, the estimate, the check command and how to write acceptance criteria and Likely files. Don't run `orch lead plan full` for a quick run.
|
|
70
71
|
- **Team: one coder, no reviewer.** Your pane is named `lead` already (`orch lead plan` did it; if it printed a rename command, run it). Pick ONE coder pane whose model fits the tier (a free pane of any kind; if only you are open, `orch team <your kind> --coders 1 --no-reviewer`). `Reviewer: none`, unless the developer wrote `quick review:`: then one reviewer pane and `Review: yes`. Why no reviewer: a quick change is small and stays out of risky areas, the check command (lint, types, tests) still has to pass before it lands, and the developer looks at UI changes in the browser anyway; the reviewer is often the slowest step of a small run.
|
|
71
72
|
- **One milestone** that holds every change in the request, with **one acceptance criterion per change**, so the coder and the summary go through them one by one.
|
|
72
|
-
- **Fields:** only `Tier`, `Estimate`, `Likely files`, `Goal`, `Acceptance criteria` and the `Context` facts the coder needs to find their way. Leave out `Feature breakdown`, `Why separate`, `Needs`, `Model why`, `Role`, `Interfaces` (none) and `Prefer` unless one really helps. A backend change gets an acceptance criterion a test can prove (e.g. "GET /orders returns `createdAt` as ISO 8601; a test covers it").
|
|
73
|
+
- **Fields:** only `Tier`, `Estimate`, `Likely files`, `Goal`, `Acceptance criteria` and the `Context` facts the coder needs to find their way (plus `Skills:` when a project skill fits). Leave out `Feature breakdown`, `Why separate`, `Needs`, `Model why`, `Role`, `Interfaces` (none) and `Prefer` unless one really helps. A backend change gets an acceptance criterion a test can prove (e.g. "GET /orders returns `createdAt` as ISO 8601; a test covers it").
|
|
73
74
|
- **Header:** `Mode: quick`, your `Quick because:` line, `Isolation: shared`, `Setup command: none` (shared mode uses your folder as it is), the `Check command`, `Estimate` = the milestone's.
|
|
74
75
|
- **Don't run the check yourself.** The event manager runs it before any work starts and tells you if it is already red (then handle it as in `orch lead run`, "Red baseline").
|
|
75
76
|
- Write the plan (format below), run `orch sync` and fix every ERROR, then show the developer five lines at most: the changes (one per line), the coder and model, the estimate and your `Quick because:`. Then let the developer choose the models (the block "Let the developer choose the models" below), and when they keep the team, say "Say **go**, or **full** if you want the normal process." **STOP** and wait for go, as in a full plan: the developer sees the short plan before anything changes.
|
|
@@ -240,6 +241,7 @@ Needs: <any of: reasoning, coding, architecture, long-context, tool-use, plannin
|
|
|
240
241
|
Model why: <one line: what in this milestone makes it that tier>
|
|
241
242
|
Estimate: <e.g. 40m: dispatch to landed if nothing goes wrong>
|
|
242
243
|
Role: <the specialist the coder works as, and what they care about in this milestone>
|
|
244
|
+
Skills: <leave this line out | the project skills that fit this milestone, from `orch onboard skills`>
|
|
243
245
|
Review: yes | no
|
|
244
246
|
Door: <leave this line out (easy to undo) | one-way (why it is hard to undo)>
|
|
245
247
|
Likely files: src/a.ts, src/b.ts, src/feature/
|
|
@@ -311,12 +313,13 @@ Rules for every milestone:
|
|
|
311
313
|
- **Estimate**: from step 6, on every milestone and in the header. `orch sync` refuses a value that is not a time (`40m`, `1h30m`, `2h`) and warns when one is missing.
|
|
312
314
|
- **Tier, Needs, Model why**: from step 6, on every milestone. The model in `Workers:` is what the pane really runs, never a wish. `orch sync` refuses a denied model and warns when no coder reaches a milestone's tier or the reviewer is weaker than the work.
|
|
313
315
|
<!-- /quick -->
|
|
316
|
+
- **Skills**: the project's skills that fit this milestone (`Skills: frontend-developer, test-driven-development`), by the names `orch onboard skills` prints. orch lists them in the coder's task file with what each is for. Leave the line out when none fits. Never a skill that runs the work itself (its own worktree, merging, helper agents): orch tells coders not to use those in a run, and `orch sync` warns.
|
|
314
317
|
- **Prefer**: a worker kind or name from `Workers:` when a tool (not a model) suits the work better, otherwise `any`. A preference, not a lock; the tier comes first.
|
|
315
318
|
- **Model**: never write it yourself. `orch plan model` writes `Model: <model>@<thinking>` when the developer picks a model for a milestone (step 10); it is a lock.
|
|
316
319
|
- **Review**: `yes` for UI, API contracts, auth, payments and schema; `no` for mechanical milestones.
|
|
317
320
|
- **Door**: most changes are easy to undo: if they are wrong, a revert fixes it and nobody is hurt. Write `Door: one-way (why)` only on a milestone that git can't take back once it runs: a migration that changes real data, a public API or event other apps or teams depend on, deleting data, sending emails or messages, charging money, publishing a package. Example: `Door: one-way (adds a column to orders, 2M rows in production)`. Such a milestone always waits for the developer's `orch approve` before it lands, even when no file looks risky, and its coder is asked for proof that it is safe (a dry run on a copy, a rollback test). Never mark everything one-way: the label tells the developer where to look hardest. orch measures how much each milestone could break by itself (risky files, how many milestones build on it, its size); you don't write that.
|
|
318
321
|
- **ZERO GUESSWORK**: missing business rules, undefined data shapes, and auth or security trade-offs go under **Open questions** with 2–3 concrete options. `orch sync` marks such milestones `needs-answer`, and their dependents wait.
|
|
319
|
-
- Each section must stand alone: autopilot hands it to the coder (without the lines only orch uses: `Depends on`, `Why separate`, `Prefer`, `Model`, `Tier`, `Needs`, `Model why`, `Estimate`, `Review`, `Parallel`, `Door`, `Side`, `Repo`; `Role` goes at the top as the coder's role), together with the global instructions and the reports of merged dependencies.
|
|
322
|
+
- Each section must stand alone: autopilot hands it to the coder (without the lines only orch uses: `Depends on`, `Why separate`, `Prefer`, `Model`, `Tier`, `Needs`, `Model why`, `Estimate`, `Review`, `Parallel`, `Door`, `Side`, `Repo`; `Role` goes at the top as the coder's role, `Skills` in its own block with what each skill is for), together with the global instructions and the reports of merged dependencies.
|
|
320
323
|
|
|
321
324
|
## 10. Validate and show the plan
|
|
322
325
|
- Run `orch sync`. Fix every ERROR. Fix or consciously accept every WARN: a word the glossary says to avoid, a new word or decision record no milestone writes down, missing dependency reasons, hotspot files in parallel milestones, "how" in a milestone, overlap, a milestone without `Why separate` or `Estimate`, independent milestones in shared mode, coders left idle by a fully sequential plan, a tier no coder reaches, a model outside the catalog.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orch-onboard
|
|
3
|
+
description: "Set a project up for its AI agents (Claude, Codex, Antigravity, Pi, OpenCode, Amp): finds the stack, commands, rule files and the skills each agent can see, then offers only what is missing (AGENTS.md, short skills about this repo, one folder link so every agent sees the same skills) and writes nothing without the developer's tick, either only on this machine or as a PR. Use when the user says orch-onboard or asks to set up skills or agent rules for a project. /orch-plan starts it by itself when a project needs it."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Run `orch lead onboard` (or `~/.local/bin/orch lead onboard` if `orch` is not on PATH) and follow its output exactly.
|
|
7
|
+
Hard rule: never push to main or master and never merge a PR, even if the user asks; say so and offer a branch and a PR instead (a person merges it).
|