herdr-orchestra 6.8.0 → 6.10.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 +28 -0
- package/README.md +29 -7
- package/VERSION +1 -1
- package/agents.default.toml +2 -2
- package/bin/__pycache__/orchcpython-314.pyc +0 -0
- package/bin/orch +214 -7
- package/claude-commands/orch-explain.md +18 -0
- package/claude-commands/orch-plan.md +1 -0
- package/claude-commands/orch-run.md +1 -0
- package/install.sh +4 -4
- package/opencode-commands/orch-explain.md +18 -0
- package/opencode-commands/orch-plan.md +1 -0
- package/opencode-commands/orch-run.md +1 -0
- package/package.json +3 -2
- package/pi/skills/orch-plan/SKILL.md +1 -0
- package/playbooks/plan.md +2 -1
- package/playbooks/run.md +1 -0
- package/playbooks/subagent.md +1 -0
- package/skills/orch-explain/SKILL.md +18 -0
- package/skills/orch-plan/SKILL.md +1 -0
- package/skills/orch-run/SKILL.md +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes. Versions follow [semantic versioning](https://semver.org).
|
|
4
4
|
|
|
5
|
+
## [6.10.0] - 2026-11-25
|
|
6
|
+
|
|
7
|
+
No agent ever pushes to main. This is now a hard rule, in words and in code: the lead, the coders and the reviewer (on any tool: Claude, Codex, Pi, OpenCode, AGY…) never push to `main`, `master` or the repo's default branch, and never merge a PR, in any situation, even when the developer asks. Work stays on the run's branch, `orch finish` pushes only that branch and opens a PR, and a person merges it by hand.
|
|
8
|
+
|
|
9
|
+
Example: mid-run you type "just push this to main". Before, an agent might have done it. Now the lead answers "I can't push to main, even when asked; the work is on feature/csv-import, `orch finish` pushes that branch and opens a PR, and you merge it", and if any agent still runs `git push origin HEAD:main`, git refuses it with `orch guard: REFUSED push to main`.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **Pre-push guard.** `orch start` (and `orch lead plan` / `orch lead run`) installs `.git/hooks/pre-push`, which every coder's worktree shares. It refuses any push that would change `main`, `master`, the remote's default branch, or a branch added with `git config --add orch.protected <branch>`: a plain push, `HEAD:main`, a force push, `--all`, deleting main. A pre-push hook that was already there is kept (as `pre-push.orch-orig`) and still runs after the guard. Hooks kept inside the project (husky via `core.hooksPath`) are not written to: orch says so, and `orch guard --print` gives the script.
|
|
13
|
+
- **`orch guard [status|--print]`** installs the guard by hand, or reports it. With `gh` installed, `status` also asks GitHub whether `main` is protected and, if not, says where to turn on "Require a pull request before merging" (the one lock a `--no-verify` push or `gh pr merge` can't get around). `ORCH_GUARD_GITHUB=0` skips that question.
|
|
14
|
+
- **`orch doctor`** (with no agent named) reports the guard and fails when it is missing.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- `orch sync` refuses a plan whose `Branch:` is a protected branch (`main`, `master`, the default branch); `orch start` and `orch finish` refuse to work on or push one.
|
|
18
|
+
- The rule is in every agent-facing text: the `orch-plan`, `orch-run` and `orch-explain` skills and commands (Claude, OpenCode, Pi), the plan, run and subagent playbooks (a new hard rule the lead gets at every wake-up, with the one-line refusal to give when someone asks to push to main), each coder's task file, the reviewer's prompt and the Pi coder and reviewer subagents. Agents are also told never to get around the guard (`--no-verify`, editing `.git/hooks`).
|
|
19
|
+
|
|
20
|
+
### Not yet tried
|
|
21
|
+
- With real agents. The guard was tested with real git pushes to a local remote (every refused form, worktrees, a kept hook, husky); the agents' refusal is in their instructions and was tested with simulated agents only.
|
|
22
|
+
|
|
23
|
+
## [6.9.0] - 2026-11-25
|
|
24
|
+
|
|
25
|
+
A new skill, `orch-explain`, makes any agent explain a concept, a code flow, a bug fix or an architecture change simply and visually.
|
|
26
|
+
|
|
27
|
+
Example: in Claude Code type `/orch-explain how does orch fix work`. The answer comes in four parts: 2–3 plain bullets with an everyday analogy, a small table of the parts involved, an ASCII flowchart under 65 characters wide (so it fits a narrow herdr pane), and a 3-row "why it matters" table, all using one example such as `Turn T1`.
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- **`orch-explain` skill** (`skills/orch-explain/SKILL.md`), installed next to `orch-plan` and `orch-run`: one copy per agent through `orch agents sync`, recorded for `--uninstall`, checked by `orch agents check`. OpenCode gets a `/orch-explain` command; Pi loads it from the package (`/skill:orch-explain`). Unlike the other two it is not a thin wrapper: the playbook is in the skill itself and it needs no run.
|
|
31
|
+
- An `orch-explain` copy in a folder orch no longer uses (such as OpenCode's old `command/`) is recognised as orch's own and removed, like old `orch-plan` / `orch-run` copies, so no agent lists it twice.
|
|
32
|
+
|
|
5
33
|
## [6.8.0] - 2026-11-24
|
|
6
34
|
|
|
7
35
|
An all-Codex team (Codex as the lead, the coders and the reviewer) now runs without getting stuck and without an approval check on every orch command.
|
package/README.md
CHANGED
|
@@ -59,8 +59,8 @@ It installs:
|
|
|
59
59
|
| What | Where |
|
|
60
60
|
|---|---|
|
|
61
61
|
| `orch` CLI (scheduler + autopilot) | `~/.local/bin/orch` |
|
|
62
|
-
| `orch-plan`, `orch-run` skills, one copy per agent (an agent never lists them twice) | `~/.agents/skills/` or the agent's own skills folder |
|
|
63
|
-
| `/orch-plan`, `/orch-run` OpenCode commands | `~/.config/opencode/commands/` |
|
|
62
|
+
| `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 |
|
|
63
|
+
| `/orch-plan`, `/orch-run`, `/orch-explain` OpenCode commands | `~/.config/opencode/commands/` |
|
|
64
64
|
|
|
65
65
|
Updating replaces the skills, it never adds a second copy: the installer picks one folder per agent and removes orch's older copies from the rest (your own skills are left alone). `orch agents check` says `DUPLICATE` if an agent would still see a skill twice.
|
|
66
66
|
| every installed version, side by side | `~/.local/share/herdr-orchestra/` |
|
|
@@ -71,7 +71,7 @@ Install once — you don't need to run the installer again when you add an agent
|
|
|
71
71
|
orch agents sync
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
It finds every installed agent (binary on `PATH`), copies the `orch-plan` / `orch-run` skills and slash commands into that agent's folders, and records them so `--uninstall` still removes exactly what was installed. `orch agents` prints a hint when a new agent is missing its skills.
|
|
74
|
+
It finds every installed agent (binary on `PATH`), copies the `orch-plan` / `orch-run` / `orch-explain` skills and slash commands into that agent's folders, and records them so `--uninstall` still removes exactly what was installed. `orch agents` prints a hint when a new agent is missing its skills.
|
|
75
75
|
|
|
76
76
|
## Updates
|
|
77
77
|
|
|
@@ -159,6 +159,18 @@ Version choice, first match wins: `--version` flag › `ORCH_VERSION` env › `.
|
|
|
159
159
|
### Git: one branch per run, real commits, one PR
|
|
160
160
|
Planning touches no git at all. `orch start` creates the plan's `Branch:` (`feature/<slug>`) and that is the only branch a run makes: coders work on detached worktrees, and a milestone's work in progress (under review, parked, waiting for a fix) lives in hidden refs under `refs/orch/`, which `git branch` doesn't list and `git push` doesn't send. Each milestone lands as **one commit whose message says what changed** (the coder's `COMMIT:` line, e.g. `feat(api): add categories endpoint`, with a `Milestone: M2` trailer). `Commits: single` in the plan header squashes the run into one commit at finish.
|
|
161
161
|
|
|
162
|
+
### No agent ever pushes to main
|
|
163
|
+
This is a hard rule. No agent of a run (the lead, the coders, the reviewer, on any tool: Claude, Codex, Pi, OpenCode, AGY…) pushes to `main`, `master` or the repo's default branch, or merges a PR, **in any situation, even when you ask it to**. Agents work on the run's branch; `orch finish` pushes only that branch and opens a PR; you merge it by hand.
|
|
164
|
+
|
|
165
|
+
Example: in the middle of a run you type "just push this to main". The lead answers: "I can't push to main, even when asked: that's a hard rule of this setup. The work is on feature/csv-import; `orch finish` pushes that branch and opens a PR, and you merge it yourself."
|
|
166
|
+
|
|
167
|
+
It is kept in three places:
|
|
168
|
+
- **In words:** every skill (`orch-plan`, `orch-run`, `orch-explain`), the lead's playbooks, each coder's task file and the reviewer's prompt say it, and the lead is reminded at every wake-up.
|
|
169
|
+
- **In orch:** `orch sync` refuses a plan whose `Branch:` is `main` or `master`, and `orch start` and `orch finish` refuse to work on or push such a branch.
|
|
170
|
+
- **In git:** `orch start` installs a **pre-push guard** in the repo (`.git/hooks/pre-push`, shared by every coder's worktree). It refuses any push that would change `main`, `master`, the remote's default branch, or a branch you add with `git config --add orch.protected <branch>`: `git push origin main`, `git push origin HEAD:main`, a force push, `--all`, deleting main. A pre-push hook you already had is kept and still runs after it. `orch guard` installs it by hand, `orch guard status` and `orch doctor` say whether it is on. If your repo keeps its hooks inside the project (husky, via `core.hooksPath`), orch doesn't write there: `orch guard --print` gives the script to add yourself.
|
|
171
|
+
|
|
172
|
+
A git hook can be skipped (`git push --no-verify`), and a PR can be merged with `gh pr merge`. The agents are told never to do either, but the lock nobody can skip is on GitHub: **Settings > Rules > Rulesets > New branch ruleset**, target `main`, tick "Require a pull request before merging" and "Block force pushes". `orch guard status` checks it when `gh` is installed and tells you when it is off.
|
|
173
|
+
|
|
162
174
|
A good feature request: Feature · Why · Must · Must not · Already decided · Done when · Mode (`shared` or `worktree`).
|
|
163
175
|
|
|
164
176
|
### Models and tiers
|
|
@@ -202,7 +214,17 @@ The agent whose pane you start the plan playbook in becomes the lead. orch names
|
|
|
202
214
|
| Antigravity (`agy`) | "use the orch-plan skill: <feature>" |
|
|
203
215
|
| **any agent** | "Run `orch lead plan` and follow it. Feature: <feature>" |
|
|
204
216
|
|
|
205
|
-
|
|
217
|
+
### Explain something simply
|
|
218
|
+
`orch-explain` makes any agent explain a concept, a code flow, a bug fix or an architecture change in plain words, in four parts: a short summary with an everyday analogy, a table of the parts involved, an ASCII flowchart under 65 characters wide (it fits a narrow pane), and a 3-row "why it matters" table, with one example used all the way through. It needs no run and no `orch` command.
|
|
219
|
+
|
|
220
|
+
| Agent | Ask it |
|
|
221
|
+
|---|---|
|
|
222
|
+
| Claude Code, OpenCode | `/orch-explain how does the event manager wake the lead` |
|
|
223
|
+
| Codex | `$orch-explain how does orch fix work` |
|
|
224
|
+
| Pi | `/skill:orch-explain <topic>` |
|
|
225
|
+
| any other | "use the orch-explain skill: <topic>" (or just "explain X simply") |
|
|
226
|
+
|
|
227
|
+
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.
|
|
206
228
|
|
|
207
229
|
### Agent registry
|
|
208
230
|
`orch agents` shows every known kind: installed or not, roles, whether herdr can watch it, and its launch command. Defaults ship in `agents.default.toml`; add or fix kinds in `~/.config/herdr-orchestra/agents.toml` (merged key by key):
|
|
@@ -259,7 +281,7 @@ pi install npm:herdr-orchestra
|
|
|
259
281
|
|
|
260
282
|
You can also install it straight from GitHub (same files, no npm needed): `pi install git:github.com/arunnarangali/herdr-orchestra` (add `@vX.Y.Z` to pin a release). Step-by-step setup: the [Pi page](https://herdr-orchestra.vercel.app/docs/pi/) of the docs.
|
|
261
283
|
|
|
262
|
-
Pi then has the `orch-plan` and `orch-
|
|
284
|
+
Pi then has the `orch-plan`, `orch-run` and `orch-explain` skills and two commands. The first time, Pi says the `orch` command is missing (or older than the package): type `/orch-setup` once and it runs this package's installer. Pi may warn once that `orch-plan` / `orch-run` were found twice (the installer also puts them in `~/.agents/skills` for Codex, Amp and OpenCode); it keeps one copy and works.
|
|
263
285
|
|
|
264
286
|
Runs have two modes. Nothing changes for anyone who never picks the second one.
|
|
265
287
|
|
|
@@ -370,9 +392,9 @@ Every status change is written to `.orchestrate/events.jsonl`, and `orch report
|
|
|
370
392
|
Optional plan header lines: `Lead mode: events | off` (default `events` when the plan has a `Lead:` line) · `Scope: warn | strict` · `Risk hold: on | off` · `Budget: 3h` (autopilot stops when its running time is used up) · `Estimate: 1h30m` (the lead's estimate for the feature) · `Setup inputs: <globs>` (which files mean "run setup again"; default: lockfiles and manifests). Per milestone: `Why separate` (why it is its own milestone; needed when the plan has more than one) · `Tier`, `Needs`, `Model why` (see [Models and tiers](#models-and-tiers)) · `Estimate: 40m` (dispatch to landed if nothing goes wrong) · `Parallel: allow` lets it run next to a milestone that shares its `Likely files`.
|
|
371
393
|
|
|
372
394
|
### Commands
|
|
373
|
-
`orch status` · `orch resume` · `orch report` · `orch approve Mn` · `orch models [show|check <id>]` · `orch events [--peek]` · `orch dispatch Mn... [--to <worker>] [--tier <tier>]` · `orch answer Mn [--defer AC2] "<answer>"` · `orch defer Mn AC2 "<reason>"` · `orch fix Mn "<change>" [--to <worker>]` · `orch doctor [kind]` · `orch ready` · `orch autopilot` · `orch lead plan|run|check|whoami` · `orch agents [launch <kind> [--model <id>]|sync|check]` · `orch handoff Mn` · `orch needs-fix Mn` · `orch set M3 pending` · `orch park M2 paused "why"` · `orch cooldown claude-1 60` · `orch bench claude-1 off|on` · `orch stop [--now]` · `orch doctor --crash` · `orch cleanup` · `orch finish [--no-push]` · `orch version` · `orch update [--check] [--version vX.Y.Z]` · `orch config [auto-update on|off]` · `orch mode [panes|subagent]` · `orch setup [--mode panes|subagent]` · `orch check [Mn]` · `orch sub next|done Mn` · `orch` (full help)
|
|
395
|
+
`orch status` · `orch resume` · `orch report` · `orch approve Mn` · `orch models [show|check <id>]` · `orch events [--peek]` · `orch dispatch Mn... [--to <worker>] [--tier <tier>]` · `orch answer Mn [--defer AC2] "<answer>"` · `orch defer Mn AC2 "<reason>"` · `orch fix Mn "<change>" [--to <worker>]` · `orch doctor [kind]` · `orch guard [status|--print]` · `orch ready` · `orch autopilot` · `orch lead plan|run|check|whoami` · `orch agents [launch <kind> [--model <id>]|sync|check]` · `orch handoff Mn` · `orch needs-fix Mn` · `orch set M3 pending` · `orch park M2 paused "why"` · `orch cooldown claude-1 60` · `orch bench claude-1 off|on` · `orch stop [--now]` · `orch doctor --crash` · `orch cleanup` · `orch finish [--no-push]` · `orch version` · `orch update [--check] [--version vX.Y.Z]` · `orch config [auto-update on|off]` · `orch mode [panes|subagent]` · `orch setup [--mode panes|subagent]` · `orch check [Mn]` · `orch sub next|done Mn` · `orch` (full help)
|
|
374
396
|
|
|
375
|
-
Tunables: `ORCH_CODER_BUDGET_MIN` (45) · `ORCH_REVIEW_BUDGET_MIN` (15) · `ORCH_CHECK_TIMEOUT_MIN` (30) · `ORCH_COOLDOWN_MIN` (60) · `ORCH_MAX_TASKS` (unset: no limit) · `ORCH_GONE_COOLDOWN_MIN` (10) · `ORCH_SEND_RETRY_S` (120) · `ORCH_HERDR_TIMEOUT_S` (30) · `ORCH_MAX_LOST` (4) · `ORCH_UNREACHABLE_MIN` (30) · `ORCH_CONFIRM_S` (30) · `ORCH_DOWN_MIN_S` (120: an event manager silent for longer was down, and that time is not counted) · `ORCH_RISK_MAX_LINES` (1500) · `ORCH_LEAD_WAIT_MIN` (15: ready work the lead hasn't dispatched starts by itself) · `ORCH_LEAD_CONFIRM_S` (30: a wake-up the lead did not pick up is sent again, doubling) · `ORCH_LEAD_REWAKE_S` (300) · `ORCH_LEAD_MAX_WAKES` (3) · `ORCH_LEAD_IDLE_MAX_MIN` (720: how long the event manager waits for an answer) · `ORCH_NO_AUTOSTART=1` (the lead's commands never start the event manager)
|
|
397
|
+
Tunables: `ORCH_CODER_BUDGET_MIN` (45) · `ORCH_REVIEW_BUDGET_MIN` (15) · `ORCH_CHECK_TIMEOUT_MIN` (30) · `ORCH_COOLDOWN_MIN` (60) · `ORCH_MAX_TASKS` (unset: no limit) · `ORCH_GONE_COOLDOWN_MIN` (10) · `ORCH_SEND_RETRY_S` (120) · `ORCH_HERDR_TIMEOUT_S` (30) · `ORCH_MAX_LOST` (4) · `ORCH_UNREACHABLE_MIN` (30) · `ORCH_CONFIRM_S` (30) · `ORCH_DOWN_MIN_S` (120: an event manager silent for longer was down, and that time is not counted) · `ORCH_RISK_MAX_LINES` (1500) · `ORCH_LEAD_WAIT_MIN` (15: ready work the lead hasn't dispatched starts by itself) · `ORCH_LEAD_CONFIRM_S` (30: a wake-up the lead did not pick up is sent again, doubling) · `ORCH_LEAD_REWAKE_S` (300) · `ORCH_LEAD_MAX_WAKES` (3) · `ORCH_LEAD_IDLE_MAX_MIN` (720: how long the event manager waits for an answer) · `ORCH_NO_AUTOSTART=1` (the lead's commands never start the event manager) · `ORCH_GUARD_GITHUB=0` (`orch guard status` doesn't ask GitHub whether main is protected)
|
|
376
398
|
|
|
377
399
|
## Develop and release
|
|
378
400
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.10.0
|
package/agents.default.toml
CHANGED
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
# orch presses them when a milestone is paused or moved while the coder still works, before the
|
|
18
18
|
# STOP note: a typed message is only read after the current step (agy queues it)
|
|
19
19
|
# roles any of "lead", "coder", "reviewer"
|
|
20
|
-
# skills_dirs global SKILL.md folders the installer may put the
|
|
20
|
+
# skills_dirs global SKILL.md folders the installer may put the orch-plan / orch-run / orch-explain skills into
|
|
21
21
|
# (first = preferred)
|
|
22
22
|
# skills_reads every global skills folder the tool reads, its own and shared ones (e.g. ~/.agents/skills).
|
|
23
23
|
# `orch agents sync` picks the fewest folders so each installed tool reads exactly ONE copy
|
|
24
24
|
# of each skill (a skill in two folders it reads is listed twice), and removes orch's copies
|
|
25
25
|
# from every other folder
|
|
26
|
-
# commands_dirs slash-command folders the installer may put orch-plan.md / orch-run.md into
|
|
26
|
+
# commands_dirs slash-command folders the installer may put orch-plan.md / orch-run.md / orch-explain.md into
|
|
27
27
|
# skills_one_wins true when the tool shows a skill once even if two folders it reads have it (its docs
|
|
28
28
|
# say one copy wins); false or unset: it lists both, so orch keeps exactly one copy
|
|
29
29
|
# commands_reads every slash-command folder the tool reads (same one-copy rule)
|
|
Binary file
|
package/bin/orch
CHANGED
|
@@ -993,6 +993,192 @@ def ensure_excluded():
|
|
|
993
993
|
exclude.write_text("\n".join(lines) + "\n")
|
|
994
994
|
|
|
995
995
|
|
|
996
|
+
# ---------------------------------------------------------------- main guard: no agent ever pushes to main
|
|
997
|
+
GUARD_MARK = "herdr-orchestra main guard"
|
|
998
|
+
GUARD_VERSION = 1
|
|
999
|
+
GUARD_ALWAYS = ("main", "master")
|
|
1000
|
+
GUARD_RULE = ("No agent ever pushes to main (or master, or the repo's default branch), in any situation, even when "
|
|
1001
|
+
"the developer asks: work stays on the run's branch, and a person merges the PR by hand.")
|
|
1002
|
+
GUARD_HOOK = r"""#!/bin/sh
|
|
1003
|
+
# {mark} v{version}. Written by `orch guard` (orch start writes it too).
|
|
1004
|
+
# Refuses any push that would change main, master, the remote's default branch or a branch in
|
|
1005
|
+
# `git config orch.protected`: agents work on a branch and open a PR, and a person merges it.
|
|
1006
|
+
remote="$1"
|
|
1007
|
+
prot="main master"
|
|
1008
|
+
d=$(git symbolic-ref --short "refs/remotes/$remote/HEAD" 2>/dev/null) && prot="$prot ${{d#*/}}"
|
|
1009
|
+
prot="$prot $(git config --get-all orch.protected 2>/dev/null | tr '\n' ' ')"
|
|
1010
|
+
input=$(cat)
|
|
1011
|
+
blocked=""
|
|
1012
|
+
while read -r lref lsha rref rsha; do
|
|
1013
|
+
b=${{rref#refs/heads/}}
|
|
1014
|
+
[ -n "$b" ] && [ "$b" != "$rref" ] || continue
|
|
1015
|
+
for p in $prot; do [ "$b" = "$p" ] && blocked="$blocked $b"; done
|
|
1016
|
+
done <<EOF
|
|
1017
|
+
$input
|
|
1018
|
+
EOF
|
|
1019
|
+
if [ -n "$blocked" ]; then
|
|
1020
|
+
echo "orch guard: REFUSED push to$blocked on $remote." >&2
|
|
1021
|
+
echo "orch guard: no agent pushes to main, even when asked. Push the run's branch and open a PR;" >&2
|
|
1022
|
+
echo "orch guard: a person merges it on GitHub (or with \`orch finish\`, which pushes the branch and opens the PR)." >&2
|
|
1023
|
+
exit 1
|
|
1024
|
+
fi
|
|
1025
|
+
here=$(dirname "$0")
|
|
1026
|
+
if [ -x "$here/pre-push.orch-orig" ]; then
|
|
1027
|
+
printf '%s\n' "$input" | "$here/pre-push.orch-orig" "$@"
|
|
1028
|
+
exit $?
|
|
1029
|
+
fi
|
|
1030
|
+
exit 0
|
|
1031
|
+
"""
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
def guard_root():
|
|
1035
|
+
"""The repo the guard is for: the run's repo, or (for commands that run outside a run) the one we are in."""
|
|
1036
|
+
if ROOT:
|
|
1037
|
+
return ROOT
|
|
1038
|
+
r = git("rev-parse", "--path-format=absolute", "--git-common-dir", check=False)
|
|
1039
|
+
return Path(r.stdout.strip()).parent if r.returncode == 0 else None
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
def protected_branches():
|
|
1043
|
+
"""Branches no agent may push to: main, master, origin's default branch, and any in `git config orch.protected`
|
|
1044
|
+
(the same list the pre-push guard reads)."""
|
|
1045
|
+
names = set(GUARD_ALWAYS)
|
|
1046
|
+
r = git("symbolic-ref", "--short", "refs/remotes/origin/HEAD", cwd=ROOT, check=False)
|
|
1047
|
+
if r.returncode == 0 and "/" in r.stdout.strip():
|
|
1048
|
+
names.add(r.stdout.strip().split("/", 1)[1])
|
|
1049
|
+
names |= set(git("config", "--get-all", "orch.protected", cwd=ROOT, check=False).stdout.split())
|
|
1050
|
+
return names
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
def refuse_protected(branch, what):
|
|
1054
|
+
"""Stop with the rule when `branch` is one nobody's agent may push to."""
|
|
1055
|
+
if branch in protected_branches():
|
|
1056
|
+
die(f"{what}: {branch} is a protected branch. {GUARD_RULE} Use `Branch: feature/<slug>` (or fix/<slug>).")
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
def guard_hook_path():
|
|
1060
|
+
hooks = Path(git("rev-parse", "--path-format=absolute", "--git-path", "hooks", cwd=guard_root()).stdout.strip())
|
|
1061
|
+
return hooks / "pre-push"
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
def guard_state():
|
|
1065
|
+
"""(state, hook path, note): state is `on`, `old` (an older orch wrote it), `off` or `blocked` (the repo keeps
|
|
1066
|
+
its hooks inside the project, e.g. husky via core.hooksPath: orch doesn't write into the project's files)."""
|
|
1067
|
+
hook = guard_hook_path()
|
|
1068
|
+
root = guard_root()
|
|
1069
|
+
try:
|
|
1070
|
+
inside = hook.parent.resolve().is_relative_to(root.resolve()) and not hook.parent.resolve().is_relative_to(
|
|
1071
|
+
Path(git("rev-parse", "--path-format=absolute", "--git-common-dir", cwd=root).stdout.strip()).resolve())
|
|
1072
|
+
except (OSError, ValueError):
|
|
1073
|
+
inside = False
|
|
1074
|
+
text = hook.read_text(errors="replace") if hook.is_file() else ""
|
|
1075
|
+
if GUARD_MARK in text:
|
|
1076
|
+
m = re.search(rf"{re.escape(GUARD_MARK)} v(\d+)", text)
|
|
1077
|
+
ok = m and int(m.group(1)) >= GUARD_VERSION and os.access(hook, os.X_OK)
|
|
1078
|
+
return ("on" if ok else "old"), hook, ""
|
|
1079
|
+
if inside:
|
|
1080
|
+
return "blocked", hook, (f"this repo keeps its git hooks in {hook.parent} (core.hooksPath), inside the "
|
|
1081
|
+
f"project, so orch does not write there")
|
|
1082
|
+
return "off", hook, ("another pre-push hook is there; orch keeps it and runs it after its own check"
|
|
1083
|
+
if text else "")
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
def guard_install():
|
|
1087
|
+
"""Write the pre-push guard into the repo's hooks folder (shared by every worktree). Keeps a pre-push hook that
|
|
1088
|
+
was already there: it moves to pre-push.orch-orig and runs after orch's check. Returns (state, line)."""
|
|
1089
|
+
state, hook, note = guard_state()
|
|
1090
|
+
if state == "on":
|
|
1091
|
+
return state, f"GUARD on: {short(hook)} refuses pushes to {', '.join(sorted(protected_branches()))}"
|
|
1092
|
+
if state == "blocked":
|
|
1093
|
+
return state, f"WARN GUARD not installed: {note}. Save the output of `orch guard --print` as the pre-push hook there yourself."
|
|
1094
|
+
hook.parent.mkdir(parents=True, exist_ok=True)
|
|
1095
|
+
if state == "off" and hook.exists():
|
|
1096
|
+
os.replace(hook, hook.with_name("pre-push.orch-orig"))
|
|
1097
|
+
hook.write_text(GUARD_HOOK.format(mark=GUARD_MARK, version=GUARD_VERSION))
|
|
1098
|
+
hook.chmod(0o755)
|
|
1099
|
+
kept = " (your own pre-push hook still runs after it)" if hook.with_name("pre-push.orch-orig").exists() else ""
|
|
1100
|
+
return "on", (f"GUARD {'updated' if state == 'old' else 'installed'}: {short(hook)} refuses pushes to "
|
|
1101
|
+
f"{', '.join(sorted(protected_branches()))}{kept}")
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
def guard_ensure(say_changes=True):
|
|
1105
|
+
"""Install or refresh the guard (never fails the caller). Prints when it could not be installed, and when it
|
|
1106
|
+
installed or updated it (unless say_changes is False)."""
|
|
1107
|
+
if not guard_root():
|
|
1108
|
+
return
|
|
1109
|
+
with contextlib.suppress(Exception, SystemExit):
|
|
1110
|
+
before = guard_state()[0]
|
|
1111
|
+
state, line = guard_install()
|
|
1112
|
+
if state != "on" or (say_changes and before != "on"):
|
|
1113
|
+
print(line)
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
def github_protection(branch):
|
|
1117
|
+
"""'protected', 'open' or None (unknown: no gh, not GitHub, no network) for `branch` on origin, via gh."""
|
|
1118
|
+
if os.environ.get("ORCH_GUARD_GITHUB", "1") == "0" or not shutil.which("gh"):
|
|
1119
|
+
return None
|
|
1120
|
+
url = git("remote", "get-url", "origin", cwd=ROOT, check=False).stdout.strip()
|
|
1121
|
+
m = re.search(r"github\.com[:/]([^/]+)/([^/]+?)(?:\.git)?/?$", url)
|
|
1122
|
+
if not m:
|
|
1123
|
+
return None
|
|
1124
|
+
try:
|
|
1125
|
+
r = subprocess.run(["gh", "api", f"repos/{m[1]}/{m[2]}/branches/{branch}", "--jq", ".protected"],
|
|
1126
|
+
cwd=ROOT, text=True, capture_output=True, timeout=15)
|
|
1127
|
+
if r.returncode == 0 and r.stdout.strip() == "true":
|
|
1128
|
+
return "protected"
|
|
1129
|
+
r2 = subprocess.run(["gh", "api", f"repos/{m[1]}/{m[2]}/rules/branches/{branch}", "--jq", "length"],
|
|
1130
|
+
cwd=ROOT, text=True, capture_output=True, timeout=15)
|
|
1131
|
+
except (OSError, subprocess.TimeoutExpired):
|
|
1132
|
+
return None
|
|
1133
|
+
if r2.returncode == 0 and r2.stdout.strip().isdigit():
|
|
1134
|
+
return "protected" if int(r2.stdout.strip()) > 0 else "open"
|
|
1135
|
+
return "open" if r.returncode == 0 else None
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
def guard_report():
|
|
1139
|
+
"""Lines for `orch guard status` and `orch doctor`: (ok, text) pairs."""
|
|
1140
|
+
state, hook, note = guard_state()
|
|
1141
|
+
prot = ", ".join(sorted(protected_branches()))
|
|
1142
|
+
out = [(state == "on", {"on": f"pre-push guard is on ({short(hook)}): pushes to {prot} are refused",
|
|
1143
|
+
"old": f"pre-push guard is from an older orch ({short(hook)}): run `orch guard` to update it",
|
|
1144
|
+
"off": f"pre-push guard is missing ({short(hook)}): run `orch guard` (orch start also "
|
|
1145
|
+
f"installs it)" + (f"; {note}" if note else ""),
|
|
1146
|
+
"blocked": f"pre-push guard can't be installed: {note}. Save the output of "
|
|
1147
|
+
f"`orch guard --print` as the pre-push hook there yourself"}[state])]
|
|
1148
|
+
for b in sorted(protected_branches()):
|
|
1149
|
+
if not branch_exists(b):
|
|
1150
|
+
continue
|
|
1151
|
+
gh = github_protection(b)
|
|
1152
|
+
if gh == "open":
|
|
1153
|
+
out.append((False, f"GitHub does not protect {b}: a push that skips git hooks (--no-verify) would still "
|
|
1154
|
+
f"land. Turn on Settings > Rules > Rulesets > New branch ruleset > target {b} > "
|
|
1155
|
+
f"\"Require a pull request before merging\" and \"Block force pushes\""))
|
|
1156
|
+
elif gh == "protected":
|
|
1157
|
+
out.append((True, f"GitHub protects {b}: changes reach it only through a PR"))
|
|
1158
|
+
return out
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
def cmd_guard(args):
|
|
1162
|
+
"""orch guard [status | --print] -> install the pre-push guard that refuses pushes to main (status: report only;
|
|
1163
|
+
--print: the hook script, to add to a hooks folder orch can't write)."""
|
|
1164
|
+
sub = args[0] if args else ""
|
|
1165
|
+
if sub == "--print":
|
|
1166
|
+
print(GUARD_HOOK.format(mark=GUARD_MARK, version=GUARD_VERSION), end="")
|
|
1167
|
+
return
|
|
1168
|
+
if sub not in ("", "status"):
|
|
1169
|
+
die("usage: orch guard [status | --print]")
|
|
1170
|
+
if not guard_root():
|
|
1171
|
+
die("not inside a git repository: run `orch guard` in the project's folder")
|
|
1172
|
+
print(GUARD_RULE)
|
|
1173
|
+
if sub == "":
|
|
1174
|
+
print(guard_install()[1])
|
|
1175
|
+
bad = 0
|
|
1176
|
+
for ok, m in guard_report():
|
|
1177
|
+
print(f" {'ok ' if ok else 'BAD'} {m}")
|
|
1178
|
+
bad += not ok
|
|
1179
|
+
sys.exit(1 if bad else 0)
|
|
1180
|
+
|
|
1181
|
+
|
|
996
1182
|
def is_dirty(path):
|
|
997
1183
|
return bool(git("status", "--porcelain", cwd=path).stdout.strip())
|
|
998
1184
|
|
|
@@ -1098,6 +1284,9 @@ def cmd_sync(args):
|
|
|
1098
1284
|
f"(orch no longer makes per-milestone branches either way)")
|
|
1099
1285
|
if git("check-ref-format", "--branch", branch, cwd=ROOT, check=False).returncode != 0:
|
|
1100
1286
|
errors.append(f"Branch {branch!r} is not a valid git branch name")
|
|
1287
|
+
if branch in protected_branches():
|
|
1288
|
+
errors.append(f"Branch {branch} is a protected branch: a run never works on it or pushes to it. {GUARD_RULE} "
|
|
1289
|
+
f"Use `Branch: feature/<slug>` (or fix/<slug>)")
|
|
1101
1290
|
commits = get("commits", "per-milestone").split()[0].lower()
|
|
1102
1291
|
if commits not in ("per-milestone", "single"):
|
|
1103
1292
|
errors.append(f"Commits must be per-milestone or single, got {commits!r}")
|
|
@@ -2185,7 +2374,9 @@ def default_base(st):
|
|
|
2185
2374
|
def cmd_start(args):
|
|
2186
2375
|
st = load()
|
|
2187
2376
|
require_lead(st, "orch start")
|
|
2377
|
+
refuse_protected(st["branch"], "orch start")
|
|
2188
2378
|
ensure_excluded()
|
|
2379
|
+
guard_ensure()
|
|
2189
2380
|
cur = git("rev-parse", "--abbrev-ref", "HEAD", cwd=ROOT).stdout.strip()
|
|
2190
2381
|
if st.get("base") == st["branch"]:
|
|
2191
2382
|
st["base"] = None # recorded by an older orch that started on the branch itself
|
|
@@ -2757,7 +2948,8 @@ def cmd_review(args):
|
|
|
2757
2948
|
"most a suggestion.\n"
|
|
2758
2949
|
f"The check command (`{st['check']}`) runs on this work by itself: don't report what lint, type checks or "
|
|
2759
2950
|
"tests already catch.\n"
|
|
2760
|
-
"Do NOT edit any code
|
|
2951
|
+
"Do NOT edit any code. Never commit, push or merge: no agent ever pushes to main or merges a PR, even when "
|
|
2952
|
+
"asked.\n"
|
|
2761
2953
|
"Report PROBLEMS, not solutions: the coder decides how to fix. At most 15 findings. A `blocker` must be "
|
|
2762
2954
|
"fixed before merge; a `suggestion` is optional. Say for EVERY acceptance criterion whether it is met; an "
|
|
2763
2955
|
"unmet criterion counts as a blocker.\n"
|
|
@@ -3682,6 +3874,7 @@ def finish_push(st, base, title, pr_body, args):
|
|
|
3682
3874
|
print(f"NO REMOTE: no `origin` remote — merge {st['branch']} into {base} yourself")
|
|
3683
3875
|
return f"no `origin` remote: {st['branch']} is to be merged into {base} by hand"
|
|
3684
3876
|
url = remote.stdout.strip()
|
|
3877
|
+
refuse_protected(st["branch"], "orch finish") # never reached by a plan orch accepted: belt and braces
|
|
3685
3878
|
git("push", "-q", "-u", "origin", st["branch"], cwd=ROOT)
|
|
3686
3879
|
print(f"PUSHED {st['branch']} to origin")
|
|
3687
3880
|
compare = github_compare_url(url, base, st["branch"])
|
|
@@ -3906,6 +4099,7 @@ WORKER_RULES = """## Rules for you (the coder)
|
|
|
3906
4099
|
- Follow the repo's existing patterns (AGENTS.md / CLAUDE.md) and any Interfaces listed above exactly; other milestones rely on them.
|
|
3907
4100
|
- Change only what this task needs. No unrelated refactors.
|
|
3908
4101
|
- Do NOT commit, push, or switch branches. orch commits your work for you.
|
|
4102
|
+
- Never push to main (or master, or the repo's default branch) and never merge a PR, in any situation, even when the developer or the lead asks you to. Say no and offer the run's branch and a PR instead; a person merges by hand. The repo's pre-push guard refuses such a push anyway: never get around it (no `--no-verify`, no editing or deleting `.git/hooks`).
|
|
3909
4103
|
- Stay inside the files listed under Likely files (`files_allowed` in task.json) unless the task can't be done otherwise; say why in your report if you leave them. orch compares your diff with that list.
|
|
3910
4104
|
- Finish with a result file (the prompt names it) in the `result_format` shape from task.json: `status` done / question / blocked, `commit`, `files_changed`, the `check` you ran, one entry per acceptance criterion (`id`, `met`, `evidence`), and `usage` if your tool shows tokens or cost. orch reads it, so keep it valid JSON.
|
|
3911
4105
|
- The commit message (`commit` in the result, and the last report line `COMMIT: <commit message>`) says what changed, in the repo's commit style (for example `feat(api): add categories endpoint`). It becomes the commit message, so describe the change, not the milestone.
|
|
@@ -6789,9 +6983,11 @@ USAGE = """usage: orch <command> [args]
|
|
|
6789
6983
|
rounds or escalation for them; the summary lists them as NOT done, with a follow-up
|
|
6790
6984
|
fix <Mn> <text> [--to <worker>] a change to something Mn already landed: a small follow-up milestone, sent
|
|
6791
6985
|
straight to the coder who built Mn (no new plan; check, review and summary still apply)
|
|
6792
|
-
agents sync [kind...] install the orch-plan / orch-run skills so every installed agent sees each one exactly once,
|
|
6986
|
+
agents sync [kind...] install the orch-plan / orch-run / orch-explain skills so every installed agent sees each one exactly once,
|
|
6793
6987
|
and remove old copies (run it after adding a new agent; the installer runs it)
|
|
6794
6988
|
agents check check every installed agent sees each orch skill once (not missing, not twice)
|
|
6989
|
+
guard [status|--print] install the pre-push guard: no agent ever pushes to main/master/the default branch
|
|
6990
|
+
(orch start installs it too); status: report it and whether GitHub protects main
|
|
6795
6991
|
doctor [kind...] check installed agents against the real tool: version, launch flags, skills, herdr
|
|
6796
6992
|
sync parse .orchestrate/plan.md -> state.json (validates deps, cycles, overlaps)
|
|
6797
6993
|
start create/switch to the feature branch (plan `Branch:`); create worker worktrees (worktree mode)
|
|
@@ -7094,6 +7290,7 @@ def cmd_lead(args):
|
|
|
7094
7290
|
print(line)
|
|
7095
7291
|
if not part and not subagent:
|
|
7096
7292
|
lead_self_name()
|
|
7293
|
+
guard_ensure(say_changes=False) # no agent pushes to main: the repo refuses it from the start
|
|
7097
7294
|
if subagent and sub == "plan":
|
|
7098
7295
|
print(SUBAGENT_PLAN_NOTE, end="")
|
|
7099
7296
|
print(plan_playbook_part(pb.read_text(), part) if sub == "plan" else pb.read_text(), end="")
|
|
@@ -7250,8 +7447,9 @@ def _ours(p):
|
|
|
7250
7447
|
text = f.read_text(errors="replace") if f.is_file() else ""
|
|
7251
7448
|
except OSError:
|
|
7252
7449
|
return False
|
|
7253
|
-
# every version's skills and commands: thin wrappers say "orch lead", the first (4.0) skills "Orchestrator step"
|
|
7254
|
-
|
|
7450
|
+
# every version's skills and commands: thin wrappers say "orch lead", the first (4.0) skills "Orchestrator step",
|
|
7451
|
+
# orch-explain (6.9) carries its playbook, whose heading is "Simple & Visual Explanation Playbook"
|
|
7452
|
+
return "orch lead" in text or "Orchestrator step" in text or "Simple & Visual Explanation Playbook" in text
|
|
7255
7453
|
|
|
7256
7454
|
|
|
7257
7455
|
def _remove(p):
|
|
@@ -7447,7 +7645,7 @@ def cmd_agents(args):
|
|
|
7447
7645
|
missing = [k for k, v in reg.items()
|
|
7448
7646
|
if installed[k] and any(st != "ok" for _, st in agent_assets(v))]
|
|
7449
7647
|
if missing:
|
|
7450
|
-
print(f"\n{', '.join(missing)}: orch-plan/orch-run missing or listed twice — run: orch agents sync")
|
|
7648
|
+
print(f"\n{', '.join(missing)}: orch skills (orch-plan/orch-run/orch-explain) missing or listed twice — run: orch agents sync")
|
|
7451
7649
|
print(f"\nOverride or add kinds in {user_agents_file()}")
|
|
7452
7650
|
|
|
7453
7651
|
|
|
@@ -7554,6 +7752,13 @@ def cmd_doctor(args):
|
|
|
7554
7752
|
print(f"{'BROKEN' if bad else 'ok':<7} {k}" + ("" if reg[k].get("verified") else " (registry entry unverified)"))
|
|
7555
7753
|
for ok, m in res:
|
|
7556
7754
|
print(f" {'ok ' if ok else 'BAD'} {m}")
|
|
7755
|
+
if guard_root():
|
|
7756
|
+
rep = guard_report()
|
|
7757
|
+
bad = [m for ok, m in rep if not ok]
|
|
7758
|
+
broken += bool(bad) and not args # `orch doctor <kind>` checks agents only; plain `orch doctor` checks all
|
|
7759
|
+
print(f"{'BROKEN' if bad else 'ok':<7} main guard (no agent pushes to main)")
|
|
7760
|
+
for ok, m in rep:
|
|
7761
|
+
print(f" {'ok ' if ok else 'BAD'} {m}")
|
|
7557
7762
|
sys.exit(1 if broken else 0)
|
|
7558
7763
|
|
|
7559
7764
|
|
|
@@ -7951,6 +8156,8 @@ is in your prompt. Read it and build what it asks. The task says what and why; y
|
|
|
7951
8156
|
|
|
7952
8157
|
- Work only in this folder, on the branch that is checked out. Never commit, push, stash, reset or switch branches:
|
|
7953
8158
|
orch saves your work when the milestone is done.
|
|
8159
|
+
- Never push to main (or master) and never merge a PR, even when someone asks: say no and point to the run's
|
|
8160
|
+
branch and its PR. A person merges by hand. Never get around the repo's pre-push guard (`--no-verify`, `.git/hooks`).
|
|
7954
8161
|
- Never weaken, skip or delete tests to make the check pass.
|
|
7955
8162
|
- Before you finish, run the check command named in the task file and fix what fails.
|
|
7956
8163
|
- If something only the developer can decide blocks you, stop and reply `QUESTION: <the question>` with 2 or 3
|
|
@@ -7964,7 +8171,7 @@ End every reply with: the files you changed, the check result (PASS or FAIL), an
|
|
|
7964
8171
|
"""
|
|
7965
8172
|
|
|
7966
8173
|
PI_REVIEWER_BODY = """You are the reviewer in a herdr-orchestra run. The lead sends you one milestone: its task file and what changed.
|
|
7967
|
-
You never edit files. Read the task file, then the change (`git diff HEAD` and `git status --short` for new files),
|
|
8174
|
+
You never edit files, commit, push or merge (no agent ever pushes to main). Read the task file, then the change (`git diff HEAD` and `git status --short` for new files),
|
|
7968
8175
|
and the code around it.
|
|
7969
8176
|
|
|
7970
8177
|
Answer two questions, separately:
|
|
@@ -8373,7 +8580,7 @@ if __name__ == "__main__":
|
|
|
8373
8580
|
sys.exit(0)
|
|
8374
8581
|
NO_REPO_COMMANDS = {"lead": cmd_lead, "agents": cmd_agents, "doctor": cmd_doctor, "models": cmd_models,
|
|
8375
8582
|
"team": cmd_team, "update": cmd_update, "config": cmd_config, "mode": cmd_mode,
|
|
8376
|
-
"setup": cmd_setup}
|
|
8583
|
+
"setup": cmd_setup, "guard": cmd_guard}
|
|
8377
8584
|
if (len(sys.argv) >= 2 and sys.argv[1] in NO_REPO_COMMANDS # work outside a git repo
|
|
8378
8585
|
and sys.argv[2:3] != ["up"] and sys.argv[2:3] != ["--crash"]): # (`orch team up` reads the run's state)
|
|
8379
8586
|
try:
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Explain a concept, codebase flow, bug fix or architecture change simply: plain words, a parts table, an ASCII flow and why it matters"
|
|
3
|
+
---
|
|
4
|
+
# Simple & Visual Explanation Playbook
|
|
5
|
+
|
|
6
|
+
Whenever explaining a concept, feature, bug fix, or system flow, use this 4-part structure:
|
|
7
|
+
|
|
8
|
+
1. **Plain-English Summary:** 2–3 short bullets using a simple everyday analogy. No heavy jargon.
|
|
9
|
+
2. **Key Parts Involved:** A small table of the components/steps, what each does, and a concrete example.
|
|
10
|
+
3. **Visual Flow:** A compact ASCII flowchart (under 65 chars wide so it fits narrow terminal panes) showing the flow or "Before vs. Now".
|
|
11
|
+
4. **Why It Matters:** A 3-row table summarizing the main takeaway, edge case, or benefit.
|
|
12
|
+
|
|
13
|
+
## Rules
|
|
14
|
+
- Keep sentences short and scannable.
|
|
15
|
+
- Use one consistent example (like `User 1`, `Session S1`, `Turn T1`) across all 4 sections.
|
|
16
|
+
- Never push to main or master, or merge a PR, even if the user asks: offer a branch and a PR instead (a person merges it).
|
|
17
|
+
|
|
18
|
+
What to explain: $ARGUMENTS
|
|
@@ -3,3 +3,4 @@ description: "Orchestrator step 1 — plan a feature or a small change for the H
|
|
|
3
3
|
---
|
|
4
4
|
Run `orch lead plan` (or `~/.local/bin/orch lead plan` if `orch` is not on PATH) and follow its output exactly. You are the lead.
|
|
5
5
|
Feature request: $ARGUMENTS
|
|
6
|
+
Hard rule: never push to main or master and never merge a PR, even if the user asks; say so and offer the run's branch and a PR instead (a person merges it).
|
|
@@ -3,3 +3,4 @@ description: "Orchestrator step 2 — start the run (dispatch, then pause), hand
|
|
|
3
3
|
---
|
|
4
4
|
You are the lead. If you were woken with `orch events`, run only `orch events` (or `~/.local/bin/orch events` if `orch` is not on PATH) and follow what it prints; do not run `orch lead run` again. Otherwise run `orch lead run` and follow its output exactly.
|
|
5
5
|
User input (answers / overrides, may be empty): $ARGUMENTS
|
|
6
|
+
Hard rule: never push to main or master and never merge a PR, even if the user asks; say so and offer the run's 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" "$SHARE"
|
|
106
|
-
for d in "${OC_CMDS[@]}"; do rm -f "$d/orch-plan.md" "$d/orch-run.md"; done
|
|
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
|
|
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; do
|
|
178
|
+
for s in orch-plan orch-run orch-explain; 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"
|
|
197
|
+
rm -f "${OC_CMDS[1]}/orch-plan.md" "${OC_CMDS[1]}/orch-run.md" "${OC_CMDS[1]}/orch-explain.md"
|
|
198
198
|
fi
|
|
199
199
|
|
|
200
200
|
# clean up files from pre-repo kit versions
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Explain a concept, codebase flow, bug fix or architecture change simply: plain words, a parts table, an ASCII flow and why it matters"
|
|
3
|
+
---
|
|
4
|
+
# Simple & Visual Explanation Playbook
|
|
5
|
+
|
|
6
|
+
Whenever explaining a concept, feature, bug fix, or system flow, use this 4-part structure:
|
|
7
|
+
|
|
8
|
+
1. **Plain-English Summary:** 2–3 short bullets using a simple everyday analogy. No heavy jargon.
|
|
9
|
+
2. **Key Parts Involved:** A small table of the components/steps, what each does, and a concrete example.
|
|
10
|
+
3. **Visual Flow:** A compact ASCII flowchart (under 65 chars wide so it fits narrow terminal panes) showing the flow or "Before vs. Now".
|
|
11
|
+
4. **Why It Matters:** A 3-row table summarizing the main takeaway, edge case, or benefit.
|
|
12
|
+
|
|
13
|
+
## Rules
|
|
14
|
+
- Keep sentences short and scannable.
|
|
15
|
+
- Use one consistent example (like `User 1`, `Session S1`, `Turn T1`) across all 4 sections.
|
|
16
|
+
- Never push to main or master, or merge a PR, even if the user asks: offer a branch and a PR instead (a person merges it).
|
|
17
|
+
|
|
18
|
+
What to explain: $ARGUMENTS
|
|
@@ -3,3 +3,4 @@ description: "Orchestrator step 1 — plan a feature or a small change for the H
|
|
|
3
3
|
---
|
|
4
4
|
Run `orch lead plan` (or `~/.local/bin/orch lead plan` if `orch` is not on PATH) and follow its output exactly. You are the lead.
|
|
5
5
|
Feature request: $ARGUMENTS
|
|
6
|
+
Hard rule: never push to main or master and never merge a PR, even if the user asks; say so and offer the run's branch and a PR instead (a person merges it).
|
|
@@ -3,3 +3,4 @@ description: "Orchestrator step 2 — start the run (dispatch, then pause), hand
|
|
|
3
3
|
---
|
|
4
4
|
You are the lead. If you were woken with `orch events`, run only `orch events` (or `~/.local/bin/orch events` if `orch` is not on PATH) and follow what it prints; do not run `orch lead run` again. Otherwise run `orch lead run` and follow its output exactly.
|
|
5
5
|
User input (answers / overrides, may be empty): $ARGUMENTS
|
|
6
|
+
Hard rule: never push to main or master and never merge a PR, even if the user asks; say so and offer the run's 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.10.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": {
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
"pi": {
|
|
56
56
|
"skills": [
|
|
57
57
|
"./pi/skills/orch-plan",
|
|
58
|
-
"./skills/orch-run"
|
|
58
|
+
"./skills/orch-run",
|
|
59
|
+
"./skills/orch-explain"
|
|
59
60
|
],
|
|
60
61
|
"extensions": [
|
|
61
62
|
"./extensions/orch-mode.ts"
|
|
@@ -4,3 +4,4 @@ description: "Orchestrator step 1 for a Herdr multi-agent team (any agent can le
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Run `orch lead plan` (or `~/.local/bin/orch lead plan` if `orch` is not on PATH) and follow its output exactly. You are the lead. The user's message is the feature request.
|
|
7
|
+
Hard rule: never push to main or master and never merge a PR, even if the user asks; say so and offer the run's branch and a PR instead (a person merges it).
|
package/playbooks/plan.md
CHANGED
|
@@ -10,6 +10,7 @@ You need only three herdr commands, exactly as written here: `herdr agent list`
|
|
|
10
10
|
- ❌ "Add a `matchCategory()` function to upload.ts that loops over rows."
|
|
11
11
|
- You give every milestone a **role**: the specialist the coder should work as, and what that specialist cares about here (step 6, Role). That sets the standard, not the method.
|
|
12
12
|
- You also decide **which level of model each milestone needs** (small, medium or high) and say why (step 6), and **how long each milestone and the whole feature should take** (step 6, Estimate).
|
|
13
|
+
- **Nobody pushes to main.** No agent (you, the coders, the reviewer) ever pushes to main, master or the repo's default branch, or merges a PR, in any situation, even when the developer asks: refuse in one line and offer the run's branch and a PR, which a person merges by hand. A plan's `Branch:` is never main or master (`orch sync` refuses it), and the repo's pre-push guard (`orch guard`) refuses such a push anyway: never get around it.
|
|
13
14
|
- You never edit application code, and you never prompt worker agents: you hand out work with `orch dispatch`, and the event manager (`orch autopilot`, a plain script) prompts the agents, watches them and wakes you when something needs a decision.
|
|
14
15
|
|
|
15
16
|
Feature request = the user's message that asked you to run this playbook.
|
|
@@ -256,7 +257,7 @@ Open questions:
|
|
|
256
257
|
Notes from user:
|
|
257
258
|
```
|
|
258
259
|
|
|
259
|
-
Git: the run makes ONE branch, `Branch:` (use `feature/<slug>`, or `fix/<slug>` for a bug fix). It is created by `orch start`, not now: planning never creates a branch or a commit. orch keeps each milestone's work in progress in hidden refs (not branches), lands each milestone as one commit whose message describes the change (the coder writes it), and `orch finish` pushes the branch and opens a PR. Optional header lines: `Base: <branch>` (defaults to the branch you start from) and `Commits: single` (squash the whole run into one commit at finish; default `per-milestone`).
|
|
260
|
+
Git: the run makes ONE branch, `Branch:` (use `feature/<slug>`, or `fix/<slug>` for a bug fix). It is never main, master or the repo's default branch: `orch sync` refuses that, since no agent ever pushes there. It is created by `orch start`, not now: planning never creates a branch or a commit. orch keeps each milestone's work in progress in hidden refs (not branches), lands each milestone as one commit whose message describes the change (the coder writes it), and `orch finish` pushes the branch and opens a PR. Optional header lines: `Base: <branch>` (defaults to the branch you start from) and `Commits: single` (squash the whole run into one commit at finish; default `per-milestone`).
|
|
260
261
|
|
|
261
262
|
Optional header line `Docs: <folder>` names the folder with the repo's glossary.md, adr/ and coding-standards.md (default `docs`). Optional header lines: `Scope: strict` sends a milestone back when its coder changes files outside `Likely files` (default `warn`: listed in the summary); `Budget: 3h` stops autopilot when its running time is used up; `Risk hold: off` lets risky changes (deleted files, migrations, CI config, secrets files, unlisted dependency changes, very large diffs) land without `orch approve`; `Setup inputs: <globs>` names the files that mean "run the setup command again" (default: lockfiles and manifests); `Lead mode: off` makes the event manager dispatch by itself and stop for the developer instead of waking you (default with a `Lead:` line: `events`). Speed lines (leave them out unless the developer asks; the defaults are the fast ones): `Parallel checks: 2` runs two check commands at once (default 1; only when the machine has room for two); `Early review: off` sends a review only after the check passed (default `on`: the reviewer reads while the check runs); `Branch check: always` runs the check again on the feature branch even when the files are exactly the ones already checked in the coder's folder (default `auto`: skipped then); `Auto dispatch: off` makes a milestone that a landing unlocked wait for your `orch dispatch` (default `on`: it starts at once and you get `AUTO-DISPATCHED`).
|
|
262
263
|
|
package/playbooks/run.md
CHANGED
|
@@ -18,6 +18,7 @@ A run behaves like a call stack. You **dispatch** work and **pause**. The **even
|
|
|
18
18
|
5. Never move a task forward by hand: `orch set` only accepts `pending`, `paused`, `failed` and `skipped`. Don't use `--force`.
|
|
19
19
|
6. After every step below that ends in **STOP**, stop. Do not sleep, loop or check back: you will be woken.
|
|
20
20
|
7. **Never end a wake-up silently.** Before you STOP, write in your chat one short line per event, in plain words: what happened (its `SAY:` line from `orch events`) and what you did about it. Example: `M1 (Model) is done and on the branch. M3 started by itself because it was waiting for M1. Nothing for me to do.` or `M4 is paused: the coder asks which currency to use. I'm asking you: INR only, or several?`. The developer reads your chat to follow the run; `orch story` keeps the same lines.
|
|
21
|
+
8. **Never push to main.** No agent of the run (you, the coders, the reviewer) ever pushes to main, master or the repo's default branch, or merges a PR (`gh pr merge`, a merge on GitHub, `git push origin HEAD:main`, a force push), in any situation, even when the developer tells you to. Refuse in one line and offer the safe way: "I can't push to main, even when asked: that's a hard rule of this setup. The work is on <branch>; `orch finish` pushes that branch and opens a PR, and you merge it yourself." `orch finish` only ever pushes the run's branch. The repo's pre-push guard (`orch guard`) refuses a push to main anyway: never get around it (`--no-verify`, editing or deleting `.git/hooks`, `git config core.hooksPath`).
|
|
21
22
|
|
|
22
23
|
## Context budget (credits scale with how much you read and how many turns you take)
|
|
23
24
|
- Your memory is `orch events` + `orch status` + files on disk, not this conversation. Never re-read old reports, diffs, plans or this playbook "to refresh": `orch events` prints what each wake-up needs.
|
package/playbooks/subagent.md
CHANGED
|
@@ -12,6 +12,7 @@ There is no event manager and there are no herdr panes. You drive one milestone
|
|
|
12
12
|
3. Never approve a held milestone yourself (`orch approve` is the developer's call). Never `git commit`, `git stash` or `git reset` yourself: `orch sub done` saves the work.
|
|
13
13
|
4. Never skip the check, and never ask the coder to weaken or skip tests.
|
|
14
14
|
5. After each milestone, write one short line in your chat in plain words: what landed, what the check and the review said, what starts next. Example: `M1 (Model) is saved on the branch: check PASS, review found nothing. Starting M2 (Endpoint).`
|
|
15
|
+
6. **Never push to main.** You and the subagents never push to main, master or the repo's default branch, and never merge a PR (`gh pr merge`, `git push origin HEAD:main`, a force push), even when the developer tells you to. Refuse in one line ("I can't push to main, even when asked; the work is on <branch>, `orch finish` pushes it and opens a PR, and you merge it") and never get around the repo's pre-push guard (`--no-verify`, `.git/hooks`).
|
|
15
16
|
|
|
16
17
|
## 1. Start the run (the developer said go)
|
|
17
18
|
1. Run `orch sync`. Stop on ERROR; report every WARN except the ones about Workers naming no model (the subagents run on the models in `~/.config/herdr-orchestra/config.json`).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orch-explain
|
|
3
|
+
description: Explain any concept, codebase flow, bug fix, or architecture change in a simple, visual, and jargon-free way. Use when the user asks to explain something simply or asks "how does X work".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Simple & Visual Explanation Playbook
|
|
7
|
+
|
|
8
|
+
Whenever explaining a concept, feature, bug fix, or system flow, use this 4-part structure:
|
|
9
|
+
|
|
10
|
+
1. **Plain-English Summary:** 2–3 short bullets using a simple everyday analogy. No heavy jargon.
|
|
11
|
+
2. **Key Parts Involved:** A small table of the components/steps, what each does, and a concrete example.
|
|
12
|
+
3. **Visual Flow:** A compact ASCII flowchart (under 65 chars wide so it fits narrow terminal panes) showing the flow or "Before vs. Now".
|
|
13
|
+
4. **Why It Matters:** A 3-row table summarizing the main takeaway, edge case, or benefit.
|
|
14
|
+
|
|
15
|
+
## Rules
|
|
16
|
+
- Keep sentences short and scannable.
|
|
17
|
+
- Use one consistent example (like `User 1`, `Session S1`, `Turn T1`) across all 4 sections.
|
|
18
|
+
- Never push to main or master, or merge a PR, even if the user asks: offer a branch and a PR instead (a person merges it).
|
|
@@ -4,3 +4,4 @@ description: Orchestrator step 1 for a Herdr multi-agent team (any agent can lea
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Run `orch lead plan` (or `~/.local/bin/orch lead plan` if `orch` is not on PATH) and follow its output exactly. You are the lead. The user's message is the feature request.
|
|
7
|
+
Hard rule: never push to main or master and never merge a PR, even if the user asks; say so and offer the run's branch and a PR instead (a person merges it).
|
package/skills/orch-run/SKILL.md
CHANGED
|
@@ -4,3 +4,4 @@ description: Orchestrator step 2 for a Herdr multi-agent team. Use when the user
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
You are the lead. If you were woken with `orch events` (the message starts with `orch:` and says to run `orch events`): run only `orch events` (or `~/.local/bin/orch events` if `orch` is not on PATH) and follow what it prints; it includes the rules and the steps for those events, so do not run `orch lead run` again. Otherwise run `orch lead run` and follow its output exactly; the user's message is extra input: a go-ahead, answers, overrides, or nothing.
|
|
7
|
+
Hard rule: never push to main or master and never merge a PR, even if the user asks; say so and offer the run's branch and a PR instead (a person merges it).
|