herdr-orchestra 6.46.0 → 6.47.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 +16 -0
- package/README.md +4 -2
- package/VERSION +1 -1
- package/bin/__pycache__/orchcpython-314.pyc +0 -0
- package/bin/orch +268 -20
- package/package.json +1 -1
- package/pi/skills/orch-plan/SKILL.md +1 -1
- package/playbooks/plan.md +3 -1
- package/playbooks/run.md +20 -4
- package/skills/orch-onboard/SKILL.md +1 -1
- package/skills/orch-plan/SKILL.md +1 -1
- package/skills/orch-run/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes. Versions follow [semantic versioning](https://semver.org).
|
|
4
4
|
|
|
5
|
+
## [6.47.0] - 2026-11-30
|
|
6
|
+
|
|
7
|
+
The lead reads far less. Most of the playbook text a lead read was text it did not need at that moment: on "go" it got the whole run playbook (22,774 characters), including the event table and the summary steps that `orch events` prints again exactly when they are needed, and it got all of it again on every message the developer sent during a run. Every wake-up repeated the full hard rules. "M1 landed" woke the lead just to write one line. And the whole planning (the plan playbook, every file read while researching) stayed in the lead's chat for the rest of the run, sent again on every call.
|
|
8
|
+
|
|
9
|
+
Example: a 2-milestone run with a question. Before: go = 22,774 characters, each developer message = 22,774 more, 4 wake-ups with ~2,900 characters of rules each, one of them only to say "M5 landed, M4 started". Now: go = 8,654 characters, a developer message mid-run = the rules, the developer's part and the steps for the open events only, later wake-ups print the short rules, the news comes with the next real wake-up, and the lead's chat is compacted once after go. Sizes measured on the playbooks; the token saving of a whole run is still to be measured on a real run (the summary's token rows, 6.34.0).
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- **`orch lead run` prints what this moment needs.** At go: the intro, how a run works, the hard rules, the context budget, step 1 and a pointer to the rest (8,654 characters instead of 22,774). During a run (something was dispatched): `RUN IN PROGRESS`, the hard rules, the context budget, the new section 2b (what to do when the developer writes during a run: bench a coder, swap a coder, pick a model, move a milestone, red baseline), the event table rows for the events open now, and ALL_DONE when every milestone has landed. Subagent mode is unchanged. `orch lead run --section short|developer` print the new parts.
|
|
13
|
+
- **Later wake-ups print the hard rules in short.** The first wake-up after the lead was given the rules (by `orch lead run`, or after its compact) prints them in full; later ones print "Rules in short" (2,224 characters instead of 2,915). Rule 4 (permission prompts and approvals) and rule 8 (never push to main) are word for word in both.
|
|
14
|
+
- **News does not wake the lead on its own.** `MERGED`, `AUTO-DISPATCHED` and `ESCALATED` leave the lead nothing to decide: they wait in its queue and come with the next wake-up that needs it (a question, a failure, a held or ready milestone, at the latest ALL_DONE), and the lead gives their SAY lines then. The board, `orch view` and `orch story` show them at once. `orch config news-wake on` (or `ORCH_NEWS_WAKE=1`) wakes the lead for them again.
|
|
15
|
+
- **The lead's chat is compacted once, after go.** When the lead has dispatched and has been idle for 15 seconds (`ORCH_LEAD_COMPACT_IDLE_S`), the event manager types its tool's compact command (`/compact` for Claude Code, Codex, AGY 1.2.15+) into the lead's pane. Wake-ups wait until herdr shows it idle again, and the next one prints the full hard rules. A tool with no compact command is skipped, and `orch story` says why. `orch config lead-compact off` (or `ORCH_LEAD_COMPACT=0`) turns it off. Coders and the reviewer are compacted between milestones as before.
|
|
16
|
+
- **A full plan no longer reads the quick run's own steps.** The quick run's step-by-step and its plan format moved from `orch lead plan` to the start of `orch lead plan quick`, which only a quick run reads (`orch lead plan`: 15,878 characters instead of 19,384).
|
|
17
|
+
- **Shorter skill descriptions.** The orch-plan, orch-run and orch-onboard descriptions, which every agent's tool keeps in its system prompt on every call, are about half as long (1,800 to 900 characters for all four), with every trigger phrase kept ("orch-run", "go", "start the run", "continue the plan", answers during a run, `orch events`, "orch-plan", `quick:`/`full:`, "orch-onboard").
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- `orch lead run --section AUTO-DISPATCHED` (and a wake-up with only that event) found no row, because the row starts with `ESCALATED`. A row that names several events is found for each of them.
|
|
5
21
|
## [6.46.0] - 2026-11-30
|
|
6
22
|
|
|
7
23
|
The team's panes are readable. `orch team up` used to put every new pane in the lead's tab: the first one to the right of the lead, each next one split down from the one before. With two coders and a reviewer the lead got half the screen and the agents got thin strips, so text was cut off.
|
package/README.md
CHANGED
|
@@ -237,7 +237,7 @@ The first `/orch-plan` in a project checks what the project has for its agents:
|
|
|
237
237
|
|
|
238
238
|
Skip it once and orch won't ask again in that project. `/orch-onboard` runs it by hand. In a run, each milestone gets a `Skills:` line and the coder's task lists those skills. Skills that do orch's job (their own worktree, merging, helper agents) are named as "don't use in this task". Details: [Project setup](https://herdr-orchestra.vercel.app/docs/project-setup/).
|
|
239
239
|
|
|
240
|
-
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,
|
|
240
|
+
The orch-plan and orch-run skills and slash commands are thin wrappers: the playbooks themselves live in `orch` (`orch lead plan`, `orch lead run`), so every agent follows the same, versioned instructions. They are printed in parts so the lead reads only what it needs: `orch lead plan` prints research and the quick-or-full decision, then `orch lead plan quick` (a quick run's steps and rules) or `orch lead plan full` (steps 3 to 10). `orch lead run` prints only the start at go, and during a run only the rules, the developer's part and the steps for the open events; on a wake-up, `orch events` prints the rules (in short after the first time) and the steps for those events. News (a milestone landed) waits for the lead's next real wake-up, and the lead's chat is compacted once after go.
|
|
241
241
|
|
|
242
242
|
### Agent registry
|
|
243
243
|
`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):
|
|
@@ -370,7 +370,9 @@ Three views show a run while it goes; none of them changes it.
|
|
|
370
370
|
| Attempts keep getting lost (unreachable, gone, rate-limited) | after 4 (`ORCH_MAX_LOST`) the task fails with the history instead of looping |
|
|
371
371
|
| Autopilot is killed mid-step | the next run confirms or re-sends an unconfirmed prompt to the same agent, and finishes or undoes a half-done merge |
|
|
372
372
|
| The computer was off, herdr was closed, or the event manager died | `orch status` says so in its first lines. `orch resume` carries on: the time orch was down is not counted against any task, the agents' panes get their names back, unsaved work is saved and the tasks in progress are sent again (see [After a restart](#after-a-restart)) |
|
|
373
|
-
| A coder's or the reviewer's chat keeps growing, milestone after milestone | between milestones, while herdr shows it idle, orch types the tool's `/compact` (Claude Code, Codex, AGY 1.2.15+): its chat becomes a short summary, and `orch story` says so. Never mid-work, never for a fix round of the same milestone
|
|
373
|
+
| A coder's or the reviewer's chat keeps growing, milestone after milestone | between milestones, while herdr shows it idle, orch types the tool's `/compact` (Claude Code, Codex, AGY 1.2.15+): its chat becomes a short summary, and `orch story` says so. Never mid-work, never for a fix round of the same milestone. `orch config compact off` turns it off |
|
|
374
|
+
| The lead's chat still holds the whole planning (playbook, files it read) during the run | once per run, when the lead is idle after go, orch types its tool's `/compact`: the plan is on disk and every wake-up prints what the lead needs. Wake-ups wait until it is done. `orch config lead-compact off` turns it off |
|
|
375
|
+
| The lead is woken just to say "M1 landed" | `MERGED`, `AUTO-DISPATCHED` and `ESCALATED` are news only: they come with the lead's next real wake-up (at the latest ALL_DONE); the board, `orch view` and `orch story` show them at once. `orch config news-wake on` wakes the lead for them again |
|
|
374
376
|
| A milestone is paused or moved while its coder still works | orch presses the agent's interrupt key (Esc; set per agent kind as `interrupt_keys` in the registry), then types the STOP note. The coder shows as `stopping M7` in `orch status` and gets no new work until herdr shows it idle; the event manager presses the key again if it keeps going. `orch free <worker>` frees it once you have checked its pane |
|
|
375
377
|
| A paused coder keeps writing files | whatever it writes anyway is saved into the milestone the next time the milestone or that folder is used. orch never refuses a task because a folder has unsaved files |
|
|
376
378
|
| plan.md changed while a coder works on that milestone | its task.md is not rewritten mid-work; `orch sync` warns and says how to send the new text (`orch set Mn paused`, then `orch dispatch Mn`) |
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.47.0
|
|
Binary file
|
package/bin/orch
CHANGED
|
@@ -45,6 +45,7 @@ HALT_REPEAT_S = float(os.environ.get("ORCH_HALT_REPEAT_S", "90")) # still worki
|
|
|
45
45
|
# growing from milestone to milestone. It counts as busy until herdr shows it idle for COMPACT_SETTLE_S
|
|
46
46
|
COMPACT_SETTLE_S = float(os.environ.get("ORCH_COMPACT_SETTLE_S", "10"))
|
|
47
47
|
COMPACT_MAX_S = float(os.environ.get("ORCH_COMPACT_MAX_S", "300")) # still working after this: stop waiting for it
|
|
48
|
+
LEAD_COMPACT_IDLE_S = float(os.environ.get("ORCH_LEAD_COMPACT_IDLE_S", "15")) # the lead idle this long after go: /compact it
|
|
48
49
|
TEAM_CONFIRM_S = float(os.environ.get("ORCH_TEAM_CONFIRM_S", "5")) # `team up` looks again after this: still running?
|
|
49
50
|
LOG_MAX_B = int(float(os.environ.get("ORCH_LOG_MAX_MB", "2")) * 1024 * 1024) # autopilot.log; one old copy is kept
|
|
50
51
|
CRASH_KEEP = int(os.environ.get("ORCH_CRASH_KEEP", "20")) # saved agent screens in .orchestrate/crash/
|
|
@@ -1868,6 +1869,8 @@ def cmd_sync(args):
|
|
|
1868
1869
|
"lead_wake": old.get("lead_wake"),
|
|
1869
1870
|
"lead_ready_told": old.get("lead_ready_told"),
|
|
1870
1871
|
"compact_told": old.get("compact_told") or [],
|
|
1872
|
+
"lead_compact": old.get("lead_compact") if old.get("branch") == branch else None,
|
|
1873
|
+
"lead_rules": old.get("lead_rules") if old.get("branch") == branch else None,
|
|
1871
1874
|
"tree_task": old.get("tree_task"),
|
|
1872
1875
|
"workers": {},
|
|
1873
1876
|
"order": ids,
|
|
@@ -2182,7 +2185,7 @@ def stopping_line(st, name, w):
|
|
|
2182
2185
|
# so the chat itself only holds what the agent did on its LAST milestone. Before the agent starts a different
|
|
2183
2186
|
# milestone (and as soon as the milestone it worked on has landed) orch types its tool's compact command
|
|
2184
2187
|
# (`/compact` in Claude Code, Codex and AGY): the tool replaces the long chat with a short summary. Only when herdr
|
|
2185
|
-
# shows the agent idle, never while it works,
|
|
2188
|
+
# shows the agent idle, never while it works (the lead only once, after go: see below). A fix or review round of the SAME milestone keeps
|
|
2186
2189
|
# the chat. `orch config compact off` (or ORCH_COMPACT=0) turns it off; `compact = ""` in agents.toml turns it off
|
|
2187
2190
|
# for one tool.
|
|
2188
2191
|
|
|
@@ -2241,7 +2244,8 @@ def compact_unsupported(st, name, kind):
|
|
|
2241
2244
|
|
|
2242
2245
|
|
|
2243
2246
|
def compact_agents(st):
|
|
2244
|
-
"""(name, info dict, holds a job) for every coder and the reviewer. The lead is
|
|
2247
|
+
"""(name, info dict, holds a job) for every coder and the reviewer. The lead is compacted only once, after go
|
|
2248
|
+
(tend_lead_compact)."""
|
|
2245
2249
|
out = [(n, w, bool(w.get("task"))) for n, w in st.get("workers", {}).items()]
|
|
2246
2250
|
if st.get("reviewer") and st.get("reviewer_info") is not None:
|
|
2247
2251
|
out.append((st["reviewer"], st["reviewer_info"], bool(st.get("reviewer_busy"))))
|
|
@@ -2311,6 +2315,45 @@ def end_compact(st, name, w, note=True):
|
|
|
2311
2315
|
return h
|
|
2312
2316
|
|
|
2313
2317
|
|
|
2318
|
+
# ---------------------------------------------------------------- compacting the lead's chat once, after go
|
|
2319
|
+
# Planning fills the lead's chat: the plan playbook, the files it read, the questions. None of it is needed to run:
|
|
2320
|
+
# the plan is in plan.md and every wake-up (`orch events`) prints what the lead needs. So once per run, when the lead
|
|
2321
|
+
# is idle after go (it dispatched and stopped), the event manager types the lead's compact command into its pane.
|
|
2322
|
+
# Wake-ups wait until it is done. `orch config lead-compact off` (or ORCH_LEAD_COMPACT=0) turns it off.
|
|
2323
|
+
|
|
2324
|
+
def lead_compact_on():
|
|
2325
|
+
env = os.environ.get("ORCH_LEAD_COMPACT")
|
|
2326
|
+
if env in ("0", "1"):
|
|
2327
|
+
return env == "1"
|
|
2328
|
+
return settings_load().get("lead_compact", True) is not False
|
|
2329
|
+
|
|
2330
|
+
|
|
2331
|
+
def lead_compacting(st):
|
|
2332
|
+
"""True while the lead's one compact after go is sent and not over: wake-ups wait for it."""
|
|
2333
|
+
lc = st.get("lead_compact") or {}
|
|
2334
|
+
return bool(lc.get("sent")) and not lc.get("done")
|
|
2335
|
+
|
|
2336
|
+
|
|
2337
|
+
# ---------------------------------------------------------------- news-only lead events
|
|
2338
|
+
# MERGED, AUTO-DISPATCHED and ESCALATED leave the lead nothing to decide: they do not wake it on their own. They wait
|
|
2339
|
+
# in the queue and come with the next wake-up that needs the lead (at the latest ALL_DONE). The board, `orch view`
|
|
2340
|
+
# and `orch story` show them at once. `orch config news-wake on` (or ORCH_NEWS_WAKE=1) wakes the lead for them again.
|
|
2341
|
+
NEWS_KINDS = {"merged", "auto-dispatched", "escalated"}
|
|
2342
|
+
|
|
2343
|
+
|
|
2344
|
+
def news_wake_on():
|
|
2345
|
+
env = os.environ.get("ORCH_NEWS_WAKE")
|
|
2346
|
+
if env in ("0", "1"):
|
|
2347
|
+
return env == "1"
|
|
2348
|
+
return settings_load().get("news_wake") is True
|
|
2349
|
+
|
|
2350
|
+
|
|
2351
|
+
def wake_events(st):
|
|
2352
|
+
"""The unread events that are worth a wake-up of their own."""
|
|
2353
|
+
un = unread_events(st)
|
|
2354
|
+
return un if news_wake_on() else [e for e in un if e["kind"] not in NEWS_KINDS]
|
|
2355
|
+
|
|
2356
|
+
|
|
2314
2357
|
def compacting_line(st, name, w):
|
|
2315
2358
|
h = w.get("compacting") or {}
|
|
2316
2359
|
return (f"compacting its chat after {h.get('after') or '?'} ({h.get('cmd') or '/compact'}, sent "
|
|
@@ -6655,11 +6698,16 @@ def cmd_events(args):
|
|
|
6655
6698
|
if not new and not old and not hold:
|
|
6656
6699
|
print("Nothing needs you.")
|
|
6657
6700
|
kinds = list(dict.fromkeys([e["kind"] for e in new + old] + (["ready"] if hold else [])))
|
|
6701
|
+
rules_given = False
|
|
6658
6702
|
pb = asset("playbooks/run.md") if kinds else None
|
|
6659
6703
|
if pb: # the playbook's own words for these events: a wake-up never needs
|
|
6660
6704
|
text = pb.read_text() # `orch lead run` again, even after the lead's context was compacted
|
|
6661
6705
|
print("\nWHAT TO DO (from `orch lead run`; you need no other part of the playbook for these events):")
|
|
6662
|
-
|
|
6706
|
+
full = not st.get("lead_rules")
|
|
6707
|
+
print(run_playbook_part(text, "rules" if full else "short"), end="")
|
|
6708
|
+
if full and not peek:
|
|
6709
|
+
st["lead_rules"] = now()
|
|
6710
|
+
rules_given = True
|
|
6663
6711
|
rows = "".join(run_playbook_part(text, k) for k in kinds if k != "all_done")
|
|
6664
6712
|
if rows:
|
|
6665
6713
|
print("| Event | What you do |\n|---|---|\n" + rows, end="")
|
|
@@ -6677,6 +6725,8 @@ def cmd_events(args):
|
|
|
6677
6725
|
st["lead_wake"]["read_ts"] = now() # for the event manager's timing line
|
|
6678
6726
|
save(st)
|
|
6679
6727
|
write_story(st)
|
|
6728
|
+
elif rules_given:
|
|
6729
|
+
save(st)
|
|
6680
6730
|
|
|
6681
6731
|
|
|
6682
6732
|
def cmd_escalate(args):
|
|
@@ -6895,7 +6945,7 @@ def lead_unwoken(st):
|
|
|
6895
6945
|
woken because herdr can't find it, or it did not read the wake-ups), with what to do. "" when all is read."""
|
|
6896
6946
|
if not lead_on(st):
|
|
6897
6947
|
return ""
|
|
6898
|
-
un =
|
|
6948
|
+
un = wake_events(st)
|
|
6899
6949
|
if not un:
|
|
6900
6950
|
return ""
|
|
6901
6951
|
name, lw = st["lead"]["name"], st.get("lead_wake") or {}
|
|
@@ -7001,10 +7051,11 @@ def _autopilot(args):
|
|
|
7001
7051
|
s_ = load()
|
|
7002
7052
|
if not lead_on(s_):
|
|
7003
7053
|
return
|
|
7004
|
-
|
|
7054
|
+
un_all = unread_events(s_)
|
|
7055
|
+
un = wake_events(s_)
|
|
7005
7056
|
lw = s_.get("lead_wake") or {}
|
|
7006
7057
|
lead = s_["lead"]["name"]
|
|
7007
|
-
if not
|
|
7058
|
+
if not un_all:
|
|
7008
7059
|
if lw.get("n") and not lw.get("ack"):
|
|
7009
7060
|
patch_state(lambda s2: s2.update(lead_wake={**(s2.get("lead_wake") or {}), "ack": True}))
|
|
7010
7061
|
rt, first = lw.get("read_ts"), lw.get("first_ts") or lw.get("ts")
|
|
@@ -7012,6 +7063,10 @@ def _autopilot(args):
|
|
|
7012
7063
|
f" (read {max(0, rt - first)}s after the first wake-up, {max(0, rt - lw['oldest'])}s after the "
|
|
7013
7064
|
f"oldest event; seen here {max(0, now() - rt)}s later)" if rt and first and lw.get("oldest") else ""))
|
|
7014
7065
|
return
|
|
7066
|
+
if not un:
|
|
7067
|
+
return # news only: it comes with the next wake-up that needs the lead
|
|
7068
|
+
if lead_compacting(s_) and not force:
|
|
7069
|
+
return # the lead is compacting its chat after go: wake it after that
|
|
7015
7070
|
newest = max(e["id"] for e in un)
|
|
7016
7071
|
# a wake the lead has not acted on yet covers newer events too: it reads the whole queue when it comes
|
|
7017
7072
|
same = any(e["id"] <= lw.get("upto", 0) for e in un)
|
|
@@ -7036,7 +7091,7 @@ def _autopilot(args):
|
|
|
7036
7091
|
f"(if the wake-up text sits in its input box, press Enter), or tell it: run `orch events`. "
|
|
7037
7092
|
f"{len(un)} event(s) wait for it (`orch events --peek` shows them)", True)
|
|
7038
7093
|
return
|
|
7039
|
-
text = (f"orch: {len(
|
|
7094
|
+
text = (f"orch: {len(un_all)} new event(s) in the run on {s_['branch']} need the lead. Run `orch events` and "
|
|
7040
7095
|
f"handle what it prints, then stop.")
|
|
7041
7096
|
try:
|
|
7042
7097
|
deliver(s_, lead, text)
|
|
@@ -7051,15 +7106,91 @@ def _autopilot(args):
|
|
|
7051
7106
|
first_ts = lw.get("first_ts", lw.get("ts")) if n else now()
|
|
7052
7107
|
patch_state(lambda s2: s2.update(lead_wake={"upto": newest, "ts": now(), "n": n + 1, "wait": wait,
|
|
7053
7108
|
"first_ts": first_ts, "oldest": oldest}))
|
|
7054
|
-
what = ", ".join(f"{e['kind']}{' ' + e['task'] if e.get('task') else ''}" for e in
|
|
7109
|
+
what = ", ".join(f"{e['kind']}{' ' + e['task'] if e.get('task') else ''}" for e in un_all[:6])
|
|
7055
7110
|
if n:
|
|
7056
7111
|
say(f"the lead ({lead}) did not pick up its wake-up (" + ("idle again, " if watch else "")
|
|
7057
7112
|
+ f"events still unread after {now() - lw.get('ts', now())}s) -> sent it again "
|
|
7058
|
-
f"({n + 1} of {LEAD_MAX_WAKES}): {len(
|
|
7113
|
+
f"({n + 1} of {LEAD_MAX_WAKES}): {len(un_all)} event(s) — {what}")
|
|
7059
7114
|
else:
|
|
7060
|
-
say(f"woke the lead ({lead}): {len(
|
|
7115
|
+
say(f"woke the lead ({lead}): {len(un_all)} event(s) — {what} (sent; it counts once the lead reads them; "
|
|
7061
7116
|
f"oldest event {max(0, now() - oldest)}s old)")
|
|
7062
7117
|
|
|
7118
|
+
def tend_lead_compact():
|
|
7119
|
+
"""Once per run, when the lead is idle after go, type its tool's compact command into its pane, so the
|
|
7120
|
+
planning does not ride along on every later call. Wake-ups wait until herdr shows it idle again."""
|
|
7121
|
+
s_ = load()
|
|
7122
|
+
if not lead_on(s_):
|
|
7123
|
+
return
|
|
7124
|
+
lead = s_["lead"]
|
|
7125
|
+
name = lead["name"]
|
|
7126
|
+
lc = s_.get("lead_compact") or {}
|
|
7127
|
+
if lc.get("done"):
|
|
7128
|
+
return
|
|
7129
|
+
if lc.get("sent"):
|
|
7130
|
+
hs = herdr_state(name)
|
|
7131
|
+
busy = hs is not None and busy_word(hs)
|
|
7132
|
+
late = now() - lc["sent"] > COMPACT_MAX_S
|
|
7133
|
+
if not late and (busy or hs is None):
|
|
7134
|
+
if lc.get("idle_since"):
|
|
7135
|
+
patch_state(lambda s2: s2["lead_compact"].update(idle_since=None))
|
|
7136
|
+
return
|
|
7137
|
+
if not late and not lc.get("idle_since"):
|
|
7138
|
+
patch_state(lambda s2: s2["lead_compact"].update(idle_since=now()))
|
|
7139
|
+
return
|
|
7140
|
+
if not late and now() - lc["idle_since"] < COMPACT_SETTLE_S:
|
|
7141
|
+
return
|
|
7142
|
+
|
|
7143
|
+
def done(s2):
|
|
7144
|
+
s2["lead_compact"].update(done=now())
|
|
7145
|
+
s2["lead_rules"] = None # its next wake-up prints the full hard rules again
|
|
7146
|
+
story_note(s2, f"the lead's chat is now a short summary ({lc.get('cmd')}): the plan is in plan.md"
|
|
7147
|
+
if not late else f"the lead was still busy {_fmt_secs(COMPACT_MAX_S)} after "
|
|
7148
|
+
f"{lc.get('cmd')}: orch stopped waiting for its compact", who="event manager")
|
|
7149
|
+
patch_state(done)
|
|
7150
|
+
say(f"COMPACTED the lead ({name}): its chat after planning is now a short summary" if not late else
|
|
7151
|
+
f"the lead ({name}) is still busy {_fmt_secs(COMPACT_MAX_S)} after {lc.get('cmd')}: wake-ups go on")
|
|
7152
|
+
return
|
|
7153
|
+
tasks = s_["tasks"].values()
|
|
7154
|
+
if not any(t.get("go") for t in tasks) or all(t["status"] in ("merged", "skipped") for t in tasks):
|
|
7155
|
+
return # not started yet, or already over: nothing to gain
|
|
7156
|
+
if any(e["kind"] == "all_done" for e in s_.get("lead_events", [])):
|
|
7157
|
+
return
|
|
7158
|
+
if not lead_compact_on() or not watched(s_, name):
|
|
7159
|
+
return
|
|
7160
|
+
cmd, why = compact_command(s_, lead.get("kind"))
|
|
7161
|
+
if not cmd:
|
|
7162
|
+
if not lc.get("told"):
|
|
7163
|
+
def told(s2, why=why):
|
|
7164
|
+
s2["lead_compact"] = {"told": True, "done": now(), "skipped": why}
|
|
7165
|
+
story_note(s2, f"the lead's chat is not compacted after go: {why}", who="event manager")
|
|
7166
|
+
patch_state(told)
|
|
7167
|
+
say(f"the lead's chat is not compacted after go: {why}")
|
|
7168
|
+
return
|
|
7169
|
+
if wake_events(s_):
|
|
7170
|
+
return # it has news to read first; try again when it is idle
|
|
7171
|
+
hs = herdr_state(name)
|
|
7172
|
+
if hs is None or busy_word(hs):
|
|
7173
|
+
if lc.get("idle_seen"):
|
|
7174
|
+
patch_state(lambda s2: s2.update(lead_compact={**(s2.get("lead_compact") or {}), "idle_seen": None}))
|
|
7175
|
+
return
|
|
7176
|
+
if not lc.get("idle_seen"):
|
|
7177
|
+
patch_state(lambda s2: s2.update(lead_compact={**(s2.get("lead_compact") or {}), "idle_seen": now()}))
|
|
7178
|
+
return
|
|
7179
|
+
if now() - lc["idle_seen"] < LEAD_COMPACT_IDLE_S:
|
|
7180
|
+
return
|
|
7181
|
+
try:
|
|
7182
|
+
deliver(s_, name, cmd)
|
|
7183
|
+
except DeliveryError as e:
|
|
7184
|
+
say(f"could not send {cmd} to the lead ({name}): {e} — will retry")
|
|
7185
|
+
return
|
|
7186
|
+
|
|
7187
|
+
def sent(s2):
|
|
7188
|
+
s2["lead_compact"] = {"sent": now(), "cmd": cmd}
|
|
7189
|
+
story_note(s2, f"the lead dispatched and stopped: orch sent it {cmd} so the planning does not ride along "
|
|
7190
|
+
f"on every later call", who="event manager")
|
|
7191
|
+
patch_state(sent)
|
|
7192
|
+
say(f"the lead ({name}) is idle after go: sent {cmd} so its chat after planning becomes a short summary")
|
|
7193
|
+
|
|
7063
7194
|
def lead_ready():
|
|
7064
7195
|
"""Ready milestones the lead has not dispatched: tell it once per set; start them ourselves after LEAD_WAIT_S."""
|
|
7065
7196
|
s_ = load()
|
|
@@ -7949,6 +8080,7 @@ def _autopilot(args):
|
|
|
7949
8080
|
guarded(tid, lambda: dispatch(kind, tid, worker))
|
|
7950
8081
|
slots -= 1
|
|
7951
8082
|
lead_ready()
|
|
8083
|
+
tend_lead_compact()
|
|
7952
8084
|
wake_lead()
|
|
7953
8085
|
|
|
7954
8086
|
# 3. finished or stuck?
|
|
@@ -10831,10 +10963,15 @@ USAGE = """usage: orch <command> [args]
|
|
|
10831
10963
|
update [--check] [--version vX.Y.Z] install the latest release (or that one) and show what is new
|
|
10832
10964
|
config [auto-update on|off] this machine's settings: keep orch up to date by itself, or only be told
|
|
10833
10965
|
config compact on|off a coder or the reviewer gets /compact when its milestone is done (on by default for
|
|
10834
|
-
Claude Code, Codex and AGY 1.2.15
|
|
10835
|
-
lead
|
|
10836
|
-
|
|
10837
|
-
|
|
10966
|
+
Claude Code, Codex and AGY 1.2.15+). ORCH_COMPACT=0|1 overrides it
|
|
10967
|
+
config lead-compact on|off the lead gets /compact once per run, when it is idle after go (on by default).
|
|
10968
|
+
ORCH_LEAD_COMPACT=0|1 overrides it
|
|
10969
|
+
config news-wake on|off MERGED, AUTO-DISPATCHED and ESCALATED wake the lead at once (off by default: they come
|
|
10970
|
+
with its next wake-up). ORCH_NEWS_WAKE=0|1 overrides it
|
|
10971
|
+
lead plan|run print the lead playbook (any agent can lead: "Run `orch lead plan` and follow it");
|
|
10972
|
+
during a run, `lead run` prints only the rules, the developer's part and open events
|
|
10973
|
+
lead plan quick|full the rest of the plan playbook: a quick run's steps and rules, or steps 3-10 of the full process
|
|
10974
|
+
lead run --section <EVENT|ALL_DONE|rules|short|developer> one part of the run playbook (orch events prints these)
|
|
10838
10975
|
lead onboard the setup playbook: set this project up for its agents (rules, skills) with the
|
|
10839
10976
|
developer's tick; `orch lead plan` points the lead to it when a project needs it
|
|
10840
10977
|
onboard [--json] [--all] what the project has for its agents: stack, commands, rule files, the skills each
|
|
@@ -11097,10 +11234,17 @@ def plan_playbook_part(text, part):
|
|
|
11097
11234
|
"""The plan playbook in parts, so a quick run doesn't read the whole full process:
|
|
11098
11235
|
"" = the start (role, preflight, research, quick-or-full, plus the `<!-- start -->` blocks of the full part);
|
|
11099
11236
|
"quick" = the `<!-- quick: title -->` blocks (rules a quick plan uses, word for word from the full process);
|
|
11100
|
-
"full" = steps 3 to 10. start + full is every line of the
|
|
11237
|
+
"full" = steps 3 to 10. start + full + the quick run's own steps (first in "quick") is every line of the
|
|
11238
|
+
playbook exactly once."""
|
|
11101
11239
|
lines = text.splitlines(keepends=True)
|
|
11102
11240
|
cut = next((i for i, l in enumerate(lines) if l.strip() == "<!-- full -->"), len(lines))
|
|
11103
11241
|
head, rest = lines[:cut], lines[cut + 1:]
|
|
11242
|
+
# the quick run's own steps (in the start part, between <!-- quick-run --> marks) go only to a quick run
|
|
11243
|
+
q0 = next((i for i, l in enumerate(head) if l.strip() == "<!-- quick-run -->"), None)
|
|
11244
|
+
q1 = next((i for i, l in enumerate(head) if l.strip() == "<!-- /quick-run -->"), None)
|
|
11245
|
+
quick_steps = []
|
|
11246
|
+
if q0 is not None and q1 is not None and q1 > q0:
|
|
11247
|
+
quick_steps, head = head[q0 + 1:q1], head[:q0] + head[q1 + 1:]
|
|
11104
11248
|
blocks, out, cur, title = {"start": [], "quick": []}, [], None, ""
|
|
11105
11249
|
for l in rest:
|
|
11106
11250
|
m = PB_MARK_RE.match(l.strip())
|
|
@@ -11121,7 +11265,8 @@ def plan_playbook_part(text, part):
|
|
|
11121
11265
|
if part == "full":
|
|
11122
11266
|
return "".join(out)
|
|
11123
11267
|
if part == "quick":
|
|
11124
|
-
return
|
|
11268
|
+
return ((f"## A quick run, step by step (the rest of step 2b)\n{''.join(quick_steps)}\n" if quick_steps else "")
|
|
11269
|
+
+ "".join(f"## {t}\n{''.join(b)}\n" for t, b in blocks["quick"]))
|
|
11125
11270
|
return "".join(head) + "".join(f"\n## {t} (from the full process)\n{''.join(b)}" for t, b in blocks["start"])
|
|
11126
11271
|
|
|
11127
11272
|
|
|
@@ -11139,10 +11284,14 @@ def run_playbook_part(text, name):
|
|
|
11139
11284
|
secs = re.split(r"(?m)^(?=## )", text)
|
|
11140
11285
|
if key in ("rules", "hard rules"):
|
|
11141
11286
|
return next((x for x in secs if x.startswith("## Hard rules")), "")
|
|
11287
|
+
if key in ("short", "rules short"):
|
|
11288
|
+
return next((x for x in secs if x.startswith("## Rules in short")), "")
|
|
11289
|
+
if key in ("developer", "2b"):
|
|
11290
|
+
return next((x for x in secs if x.startswith("## 2b.")), "")
|
|
11142
11291
|
if key in ("all_done", "all-done", "3"):
|
|
11143
11292
|
return next((x for x in secs if x.startswith("## 3. ALL_DONE")), "")
|
|
11144
11293
|
kind = EVENT_ROWS.get(key, key.upper())
|
|
11145
|
-
rows = [l for l in text.splitlines() if re.match(rf"^\| `{re.escape(kind)}\b", l)
|
|
11294
|
+
rows = [l for l in text.splitlines() if re.match(rf"^\| (`[A-Z_-]+[^`]*`, )*`{re.escape(kind)}\b", l)
|
|
11146
11295
|
or (kind == "STOPPED" and l.startswith("| `STOPPED`"))]
|
|
11147
11296
|
if kind == "STOPPED":
|
|
11148
11297
|
rows += [l for l in text.splitlines() if l.startswith(("| `orch status` starts with", "**Red baseline.**",
|
|
@@ -11150,6 +11299,73 @@ def run_playbook_part(text, name):
|
|
|
11150
11299
|
return "\n".join(rows) + ("\n" if rows else "")
|
|
11151
11300
|
|
|
11152
11301
|
|
|
11302
|
+
RUN_GO_SKIP = ("## Rules in short", "## 2. ", "## 2b.", "## 3. ")
|
|
11303
|
+
|
|
11304
|
+
|
|
11305
|
+
def run_playbook_go(text):
|
|
11306
|
+
"""What `orch lead run` prints when the developer says go: the playbook without the parts that `orch events`
|
|
11307
|
+
prints exactly when they are needed (the event table, ALL_DONE) and without the part for the developer's
|
|
11308
|
+
messages during a run (`orch lead run` prints that once a run is going)."""
|
|
11309
|
+
secs = re.split(r"(?m)^(?=## )", text)
|
|
11310
|
+
return ("".join(x for x in secs if not x.startswith(RUN_GO_SKIP))
|
|
11311
|
+
+ "\n## Later in the run\nOn a wake-up, `orch events` prints the steps for its events (section 2 of this "
|
|
11312
|
+
"playbook) and, when every milestone has landed, section 3 (ALL_DONE). When the developer writes to you "
|
|
11313
|
+
"during the run, run `orch lead run` again: it prints the part for that. `orch lead run --section "
|
|
11314
|
+
"<EVENT | ALL_DONE | rules>` prints one part again.\n")
|
|
11315
|
+
|
|
11316
|
+
|
|
11317
|
+
def run_going(st):
|
|
11318
|
+
"""A run of this plan has started (something was dispatched) and the lead runs it through events."""
|
|
11319
|
+
return bool(st) and lead_on(st) and bool(st.get("tasks")) and (
|
|
11320
|
+
not plan_not_started(st) or any(t.get("go") for t in st["tasks"].values()))
|
|
11321
|
+
|
|
11322
|
+
|
|
11323
|
+
def run_playbook_mid(text, st):
|
|
11324
|
+
"""What `orch lead run` prints while a run is going (the developer wrote to the lead): the hard rules, the part
|
|
11325
|
+
for the developer's messages, the steps for every event open now, and ALL_DONE once every milestone landed."""
|
|
11326
|
+
secs = re.split(r"(?m)^(?=## )", text)
|
|
11327
|
+
intro = secs[0] if not secs[0].startswith("## ") else ""
|
|
11328
|
+
evs = [e for e in st.get("lead_events", []) if event_open(st, e)]
|
|
11329
|
+
kinds = list(dict.fromkeys([e["kind"] for e in evs] + (["ready"] if undispatched(st) else [])))
|
|
11330
|
+
done = all(st["tasks"][k]["status"] in ("merged", "skipped") for k in st["order"])
|
|
11331
|
+
out = [f"RUN IN PROGRESS on {st.get('branch')}: the developer's message is input to this run (an answer, an "
|
|
11332
|
+
f"approval, a change of team or model). Section 1 (go) is over: never run `orch start` or dispatch again "
|
|
11333
|
+
f"unless a step below says so.\n\n", intro,
|
|
11334
|
+
run_playbook_part(text, "rules"), next((x for x in secs if x.startswith("## Context budget")), ""),
|
|
11335
|
+
run_playbook_part(text, "developer")]
|
|
11336
|
+
rows = "".join(run_playbook_part(text, k) for k in kinds if k != "all_done")
|
|
11337
|
+
if rows:
|
|
11338
|
+
out.append("## Events open now (from section 2)\n| Event | What you do |\n|---|---|\n" + rows + "\n")
|
|
11339
|
+
if done or "all_done" in kinds:
|
|
11340
|
+
out.append(run_playbook_part(text, "ALL_DONE"))
|
|
11341
|
+
out.append("Any other event: `orch lead run --section <EVENT>` prints its steps; `orch events` lists what is "
|
|
11342
|
+
"open.\n")
|
|
11343
|
+
return "".join(out)
|
|
11344
|
+
|
|
11345
|
+
|
|
11346
|
+
def lead_run_state():
|
|
11347
|
+
"""`orch lead run` runs outside the repo commands: the state of this repo's run (binding ROOT, ORCH and STATE to
|
|
11348
|
+
it), or None when there is no run here."""
|
|
11349
|
+
global ROOT, ORCH, STATE
|
|
11350
|
+
with contextlib.suppress(Exception):
|
|
11351
|
+
p = _repo_state_path()
|
|
11352
|
+
if p:
|
|
11353
|
+
ROOT, ORCH, STATE = p.parent.parent, p.parent, p
|
|
11354
|
+
return load()
|
|
11355
|
+
return None
|
|
11356
|
+
|
|
11357
|
+
|
|
11358
|
+
def lead_rules_seen():
|
|
11359
|
+
"""The lead was just given the full hard rules (`orch lead run`): its next wake-ups print the short form."""
|
|
11360
|
+
with contextlib.suppress(Exception):
|
|
11361
|
+
if STATE and STATE.exists():
|
|
11362
|
+
with state_lock():
|
|
11363
|
+
s_ = load()
|
|
11364
|
+
if lead_on(s_):
|
|
11365
|
+
s_["lead_rules"] = now()
|
|
11366
|
+
save(s_)
|
|
11367
|
+
|
|
11368
|
+
|
|
11153
11369
|
def lead_name_here():
|
|
11154
11370
|
"""(state or None, the lead's name) for the repo this runs in: plan.md's `Lead:` first (it is what the developer
|
|
11155
11371
|
wrote, even before `orch sync`), then the run's state.json, else `lead`. Never fails."""
|
|
@@ -11223,7 +11439,14 @@ def cmd_lead(args):
|
|
|
11223
11439
|
print(onboard_plan_note(), end="") # a project never set up for its agents: set it up first
|
|
11224
11440
|
if subagent and sub == "plan":
|
|
11225
11441
|
print(SUBAGENT_PLAN_NOTE, end="")
|
|
11226
|
-
|
|
11442
|
+
if sub == "plan":
|
|
11443
|
+
print(plan_playbook_part(pb.read_text(), part), end="")
|
|
11444
|
+
elif subagent:
|
|
11445
|
+
print(pb.read_text(), end="")
|
|
11446
|
+
else:
|
|
11447
|
+
st = lead_run_state()
|
|
11448
|
+
print(run_playbook_mid(pb.read_text(), st) if run_going(st) else run_playbook_go(pb.read_text()), end="")
|
|
11449
|
+
lead_rules_seen()
|
|
11227
11450
|
return
|
|
11228
11451
|
if sub == "onboard":
|
|
11229
11452
|
pb = asset("playbooks/onboard.md") or die("playbooks/onboard.md not found next to orch or in the install")
|
|
@@ -13069,7 +13292,7 @@ def cmd_sub(args):
|
|
|
13069
13292
|
|
|
13070
13293
|
|
|
13071
13294
|
def cmd_config(args):
|
|
13072
|
-
"""orch config -> this machine's settings; orch config auto-update
|
|
13295
|
+
"""orch config -> this machine's settings; orch config auto-update|compact|lead-compact|news-wake on|off."""
|
|
13073
13296
|
if args[:1] == ["auto-update"] and args[1:2] and args[1].lower() in ("on", "off"):
|
|
13074
13297
|
s = settings_load()
|
|
13075
13298
|
s["auto_update"] = args[1].lower() == "on"
|
|
@@ -13086,8 +13309,25 @@ def cmd_config(args):
|
|
|
13086
13309
|
"(/compact) when its milestone is done, before it starts another one" if s["compact"] else
|
|
13087
13310
|
" — orch never compacts an agent's chat; the tools still compact by themselves when the chat is full"))
|
|
13088
13311
|
return
|
|
13312
|
+
if args[:1] == ["lead-compact"] and args[1:2] and args[1].lower() in ("on", "off"):
|
|
13313
|
+
s = settings_load()
|
|
13314
|
+
s["lead_compact"] = args[1].lower() == "on"
|
|
13315
|
+
settings_save(s)
|
|
13316
|
+
print(f"lead-compact: {args[1].lower()}" + (" — once per run, when the lead is idle after go, it gets its "
|
|
13317
|
+
"tool's compact command (/compact), so the planning does not ride along on every later call"
|
|
13318
|
+
if s["lead_compact"] else " — orch never compacts the lead's chat"))
|
|
13319
|
+
return
|
|
13320
|
+
if args[:1] == ["news-wake"] and args[1:2] and args[1].lower() in ("on", "off"):
|
|
13321
|
+
s = settings_load()
|
|
13322
|
+
s["news_wake"] = args[1].lower() == "on"
|
|
13323
|
+
settings_save(s)
|
|
13324
|
+
print(f"news-wake: {args[1].lower()}" + (" — MERGED, AUTO-DISPATCHED and ESCALATED wake the lead at once"
|
|
13325
|
+
if s["news_wake"] else " — MERGED, AUTO-DISPATCHED and ESCALATED wait for the lead's next wake-up "
|
|
13326
|
+
"(the board, orch view and orch story show them at once)"))
|
|
13327
|
+
return
|
|
13089
13328
|
if args:
|
|
13090
|
-
die("usage: orch config | orch config auto-update on|off | orch config compact on|off"
|
|
13329
|
+
die("usage: orch config | orch config auto-update on|off | orch config compact on|off | "
|
|
13330
|
+
"orch config lead-compact on|off | orch config news-wake on|off")
|
|
13091
13331
|
s = settings_load()
|
|
13092
13332
|
env = os.environ.get("ORCH_AUTO_UPDATE")
|
|
13093
13333
|
print(f"auto-update: {'on' if auto_update_on() else 'off'}"
|
|
@@ -13100,6 +13340,14 @@ def cmd_config(args):
|
|
|
13100
13340
|
+ (f" (ORCH_COMPACT={cenv} overrides the saved setting)" if cenv in ("0", "1") else "")
|
|
13101
13341
|
+ (f" — coders and the reviewer on {', '.join(kinds)} get /compact between milestones; "
|
|
13102
13342
|
"`orch config compact off` turns it off" if compact_on() and kinds else ""))
|
|
13343
|
+
lenv, nenv = os.environ.get("ORCH_LEAD_COMPACT"), os.environ.get("ORCH_NEWS_WAKE")
|
|
13344
|
+
print(f"lead-compact: {'on' if lead_compact_on() else 'off'}"
|
|
13345
|
+
+ (f" (ORCH_LEAD_COMPACT={lenv} overrides the saved setting)" if lenv in ("0", "1") else "")
|
|
13346
|
+
+ (" — the lead's chat is compacted once, after go" if lead_compact_on() else ""))
|
|
13347
|
+
print(f"news-wake: {'on' if news_wake_on() else 'off'}"
|
|
13348
|
+
+ (f" (ORCH_NEWS_WAKE={nenv} overrides the saved setting)" if nenv in ("0", "1") else "")
|
|
13349
|
+
+ (" — MERGED, AUTO-DISPATCHED and ESCALATED wake the lead at once" if news_wake_on() else
|
|
13350
|
+
" — MERGED, AUTO-DISPATCHED and ESCALATED come with the lead's next wake-up"))
|
|
13103
13351
|
print(f"installed: {installed_version()}" + ("" if release_install() else " (not a release install: no update checks)"))
|
|
13104
13352
|
lc = int(s.get("last_check") or 0)
|
|
13105
13353
|
print("last check: " + (time.strftime("%Y-%m-%d %H:%M", time.localtime(lc)) if lc else "never")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "herdr-orchestra",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.47.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": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: orch-plan
|
|
3
|
-
description: "
|
|
3
|
+
description: "Lead a Herdr agent team, step 1 - plan a feature or a small change (start the request with quick: or full: to choose). Use when the user says orch-plan or asks to plan or orchestrate a feature. Does NOT execute until the developer says go."
|
|
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.
|
package/playbooks/plan.md
CHANGED
|
@@ -68,7 +68,8 @@ If any is false, use the full process: run `orch lead plan full` and follow its
|
|
|
68
68
|
- The developer wrote `full:`: plan in full (`orch lead plan full`), even for a small change.
|
|
69
69
|
|
|
70
70
|
**A quick run, step by step** (in place of steps 3 to 10):
|
|
71
|
-
- **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.
|
|
71
|
+
- **First run `orch lead plan quick`.** It prints the rest of these steps (team, fields, header, the plan format) and 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.
|
|
72
|
+
<!-- quick-run -->
|
|
72
73
|
- **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.
|
|
73
74
|
- **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.
|
|
74
75
|
- **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").
|
|
@@ -109,6 +110,7 @@ Open questions:
|
|
|
109
110
|
```
|
|
110
111
|
|
|
111
112
|
Then the run is the same as any run (`orch lead run`): the coder builds it, the check runs, and it lands on the branch; when the check already passed on exactly the files on the branch, the final check and `orch finish` reuse that result instead of running it again. The summary is short (step 3 of `orch lead run`). The risk hold still applies: if the coder's change turns out to touch a migration, CI, secrets, a package or many lines, it is held: the lead may approve a migration file, CI, a package or many lines after reading the change (`orch approve M1 --lead "<why>"`); deleted files and secrets wait for the developer. After it lands, more small changes go straight to the same coder with `orch fix M1 "<change>"`.
|
|
113
|
+
<!-- /quick-run -->
|
|
112
114
|
|
|
113
115
|
<!-- full -->
|
|
114
116
|
## 3. Discover the team
|
package/playbooks/run.md
CHANGED
|
@@ -21,6 +21,19 @@ A run behaves like a call stack. You **dispatch** work and **pause**. The **even
|
|
|
21
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`).
|
|
22
22
|
9. **The developer's model choices stay.** A milestone with `Model:` in plan.md ("locked by you" in `orch plan team`) runs only on that model, and the reviewer keeps the model the developer gave it. Change one only when the developer asks: `orch plan model <Mn|reviewer> <model>@<thinking>`.
|
|
23
23
|
|
|
24
|
+
## Rules in short (later wake-ups)
|
|
25
|
+
`orch events` prints these on a wake-up once it has given you the full hard rules in this chat; they are the same rules, shorter. `orch lead run --section rules` prints the full text.
|
|
26
|
+
0. You decide what and why; coders decide how. A missing fact or constraint goes in the plan, never a how-to.
|
|
27
|
+
1. You never edit application code: only `orch`, its files and `.orchestrate/plan.md`.
|
|
28
|
+
2. You never prompt a worker or your own pane: only the event manager sends prompts.
|
|
29
|
+
3. Never guess: what only the developer can settle goes to them with 2–3 options; answer a coder yourself only when the request, the plan or the code settles it, and say where from.
|
|
30
|
+
4. Never answer a worker's permission prompt yourself. A held milestone: approve it yourself only when orch says the lead may (`orch approve Mn --lead "<why it is safe>"`, after you read the change). When it says only the developer may (hard to undo, deleted files, secrets files), run `orch approve Mn` only after the developer tells you to in your chat ("approve Mn"), never on your own.
|
|
31
|
+
5. `orch set` only to `pending`, `paused`, `failed` or `skipped`; never `--force`.
|
|
32
|
+
6. After a step that ends in **STOP**, stop: no sleep, loop or check back.
|
|
33
|
+
7. Never end a wake-up silently: one short line per event in your chat, its `SAY:` line and what you did about it.
|
|
34
|
+
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`).
|
|
35
|
+
9. A model the developer chose (`Model:`, "locked by you") stays; change it only when they ask: `orch plan model <Mn|reviewer> <model>@<thinking>`.
|
|
36
|
+
|
|
24
37
|
## Context budget (credits scale with how much you read and how many turns you take)
|
|
25
38
|
- 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.
|
|
26
39
|
- Never print whole files or logs into the conversation: logs → `tail -30 .orchestrate/autopilot.log`; reports → the report or result file only (workers keep them short); never open `diff.patch` yourself — that is the reviewer's job.
|
|
@@ -31,15 +44,15 @@ A run behaves like a call stack. You **dispatch** work and **pause**. The **even
|
|
|
31
44
|
2. Run `orch start`. It checks that herdr can wake you: it names your pane `lead` if it is not named yet (`NAMED`), or refuses with `NO LEAD` and the exact `herdr agent rename <pane> lead` command; give that to the developer and stop. `orch dispatch` makes the same check. If a worker or the reviewer shows `herdr=NOT FOUND`, run `orch team up`: it opens a pane for each missing agent in a herdr tab called `team` (your tab stays whole), in its folder (its worktree, or the repo), starts it on its plan model and gives it its plan name. Then run `orch start` again. If team up reports `WAITING` (the new pane shows a first-run question such as "trust this folder" or a sign-in) or `FAILED`, or a worker shows `STALE pane`, tell the developer exactly what to do in which pane (`orch agents launch <kind> --model <id>` gives the start command), and stop. `WARN agent <kind>: …` means a launch flag in the registry is out of date for the installed tool; show it (`orch doctor <kind>` has the detail). Workers shown as `detect:off` are fine.
|
|
32
45
|
3. Dispatch every milestone whose dependencies are met: `orch dispatch M1 M2`. It prints who can take each one, and starts the event manager if none is running. If it says it could not start it, ask the developer to run `orch autopilot` in a terminal.
|
|
33
46
|
- `--to <worker>` gives a milestone to one coder; `--tier high` asks for a stronger model than the plan says. Use them only with a reason, and tell the developer.
|
|
34
|
-
4. Tell the developer in two lines what is running where (milestone → coder and model). **STOP.**
|
|
47
|
+
4. Tell the developer in two lines what is running where (milestone → coder and model), and that you will compact your chat now. **STOP.** Once you are idle, orch types your tool's compact command (`/compact`) into your chat, once per run, so the planning (the plan playbook, the files you read) does not ride along on every later call. Nothing is lost: the plan is in `.orchestrate/plan.md`, the run is in `orch`'s files, and your next `orch events` gives you the hard rules again. (`orch config lead-compact off` turns it off.)
|
|
35
48
|
|
|
36
49
|
## 2. When you are woken (`orch events`)
|
|
37
|
-
Run `orch events`. It lists the new events, the ones still open, the milestones READY for your dispatch, the workers, and whether the event manager is running. Under `WHAT TO DO` it also prints the hard rules above and the rows of the table below for those events (on ALL_DONE, all of section 3), word for word, so on a wake-up you never need to run `orch lead run` again: not even in a fresh session or after your conversation was compacted. `orch lead run --section <EVENT>` prints one row again. Handle each line, then **STOP**.
|
|
50
|
+
Run `orch events`. It lists the new events, the ones still open, the milestones READY for your dispatch, the workers, and whether the event manager is running. Under `WHAT TO DO` it also prints the hard rules (in full the first time in this chat, then the short form above) and the rows of the table below for those events (on ALL_DONE, all of section 3), word for word, so on a wake-up you never need to run `orch lead run` again: not even in a fresh session or after your conversation was compacted. `orch lead run --section <EVENT>` prints one row again. Handle each line, then **STOP**.
|
|
38
51
|
|
|
39
52
|
| Event | What you do |
|
|
40
53
|
|---|---|
|
|
41
54
|
| `READY` | Dispatch them: `orch dispatch <Mn>...`. If you wait too long (15 minutes by default) the event manager starts them itself, so a run never stalls on you. A milestone that a landing unlocked does not come as READY: it starts at once and you get `AUTO-DISPATCHED` (unless the plan says `Auto dispatch: off`). |
|
|
42
|
-
| `MERGED Mn` | Nothing, unless it unlocked milestones listed under READY: dispatch those. |
|
|
55
|
+
| `MERGED Mn` | Nothing, unless it unlocked milestones listed under READY: dispatch those. `MERGED`, `AUTO-DISPATCHED` and `ESCALATED` are news only: they do not wake you on their own, they come with your next wake-up (at the latest with ALL_DONE). Give their SAY lines then. (`orch config news-wake on` wakes you for them again.) |
|
|
43
56
|
| `PAUSED Mn` with a coder's question | If the request, the plan or the code already answers it: `orch answer Mn "<answer> (from: <where>)"`. Otherwise put it to the developer with 2–3 options and STOP; when they answer, `orch answer Mn "<their answer>"`. The answer is written under that milestone's "Notes from user" and the **same coder** carries on from its saved work. |
|
|
44
57
|
| `PAUSED Mn`: a criterion can't be met (for example an outside API it needs does not exist) | Only the developer can drop part of a milestone. Ask them: build the rest and defer AC<n>, or wait. If they agree, `orch answer Mn --defer AC<n> "<their words>"`. Then a coder that reports AC<n> `met: false` gets no fix round and no escalation for it, the reviewer does not block on it, and the summary lists it as **not done**, with a follow-up. Never defer without the developer's yes, and never by writing it in the plan only: the check reads `--defer`, not prose. |
|
|
45
58
|
| `PAUSED Mn`: agent stopped twice / over its time budget / blocked / orch error | Look at what the agent shows (`herdr agent read <agent> --source recent-unwrapped --lines 60`) or the error in the log, and tell the developer. Don't work around it by hand. When it is sorted out: `orch dispatch Mn`. |
|
|
@@ -55,6 +68,9 @@ Run `orch events`. It lists the new events, the ones still open, the milestones
|
|
|
55
68
|
| `orch status` starts with `!! EVENT MANAGER NOT RUNNING`, or the developer says the computer or herdr was restarted | Run `orch resume` once and read what it prints. It leaves the time orch was down out of every time budget, gives the agents' panes their names back, saves unsaved work, sends the tasks in progress to their agents again and starts the event manager. For each `LOST` line, give the developer the exact command it prints (`herdr agent rename <pane> <name>`, or `orch team up` for a pane with no agent in it), then run `orch resume` again. Never fix this with git by hand, and never prompt a coder yourself. |
|
|
56
69
|
| `ALL_DONE` | Section 3. |
|
|
57
70
|
|
|
71
|
+
## 2b. When the developer writes to you during a run
|
|
72
|
+
`orch lead run` prints this part (with the hard rules and the steps for every event that is open now) when you run it while a run is going. Run `orch events` first if it shows unread events; when the developer talks to you and you have not run `orch events` in this turn, run it before you stop.
|
|
73
|
+
|
|
58
74
|
If you changed plan.md by hand, run `orch sync` (it works once the event manager is idle; `orch answer`, `orch defer` and `orch dispatch` work at any time).
|
|
59
75
|
|
|
60
76
|
**The developer says "stop sending work to <coder>"** (for example, no Claude today): run `orch bench <worker> off "<their reason>"`. It holds until `orch bench <worker> on`, across restarts, `orch sync` and `orch resume`; a usage-limit bench does not. Tell the developer what it still holds (`orch status`). Never try to keep a coder out by remembering it yourself.
|
|
@@ -81,4 +97,4 @@ If you changed plan.md by hand, run `orch sync` (it works once the event manager
|
|
|
81
97
|
4. **The developer asks for a change after the summary** (for example "the login button should be blue"). Do not plan again. Find the milestone that built that part (the summary's Tasks list and Likely files tell you), then run `orch fix Mn "<the change, in the developer's words>"`. It adds one small follow-up milestone to `plan.md`, sends it straight to the coder who built Mn, and starts the event manager; the check and the review (when Mn had one) still run. If it prints `LOST` and `WAITS` (exit 3), herdr can't find that coder or the reviewer (their panes were reopened and lost their names): tell the developer the exact fix it printed (usually `herdr agent rename <pane> <name>`, or `orch resume`); the fix starts by itself once herdr finds them. Name another coder only when the developer asks: `--to <worker>`. Then **STOP**: you are woken with ALL_DONE again, and the new summary keeps the old one in `.orchestrate/summary.prev.md`, so carry your notes and checklist over and add what changed. Never type into a coder's pane yourself.
|
|
82
98
|
|
|
83
99
|
## Runs without a lead (`Lead mode: off`)
|
|
84
|
-
The developer runs `orch autopilot` in a terminal. It dispatches by itself and exits 3 when a human is needed. Then you are asked to help: read `orch status` and `tail -30 .orchestrate/autopilot.log`, handle each paused, failed or held milestone as in the table
|
|
100
|
+
The developer runs `orch autopilot` in a terminal. It dispatches by itself and exits 3 when a human is needed. Then you are asked to help: read `orch status` and `tail -30 .orchestrate/autopilot.log`, handle each paused, failed or held milestone as in the event table of section 2 (`orch lead run --section <EVENT>` prints its row; `orch set Mn pending` instead of `orch dispatch Mn`), and tell the developer to run `orch autopilot` again.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: orch-onboard
|
|
3
|
-
description:
|
|
3
|
+
description: Set a project up for its AI agents (AGENTS.md, short skills about this repo, one skill folder every agent sees), writing nothing without the developer's tick. Use when the user says orch-onboard or asks to set up skills or agent rules for a project.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Run `orch lead onboard` (or `~/.local/bin/orch lead onboard` if `orch` is not on PATH) and follow its output exactly.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: orch-plan
|
|
3
|
-
description:
|
|
3
|
+
description: Lead a Herdr agent team, step 1 - plan a feature or a small change (start the request with quick: or full: to choose). Use when the user says orch-plan or asks to plan or orchestrate a feature. Does NOT execute until the developer says go.
|
|
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.
|
package/skills/orch-run/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: orch-run
|
|
3
|
-
description:
|
|
3
|
+
description: Lead a Herdr agent team, step 2 - run the plan. Use when the user says orch-run, go, start the run or continue the plan, or answers a question during a run (not the questions asked before the plan is written); and whenever you are told to run `orch events`.
|
|
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.
|