herdr-orchestra 6.13.0 → 6.14.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 +17 -0
- package/README.md +2 -0
- package/VERSION +1 -1
- package/agents.default.toml +9 -0
- package/bin/__pycache__/orchcpython-314.pyc +0 -0
- package/bin/orch +259 -9
- package/package.json +1 -1
- package/playbooks/run.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes. Versions follow [semantic versioning](https://semver.org).
|
|
4
4
|
|
|
5
|
+
## [6.14.0] - 2026-11-26
|
|
6
|
+
|
|
7
|
+
A coder's and the reviewer's chat no longer keeps growing from milestone to milestone. When one is done with a milestone, orch types its tool's `/compact` into its pane while it is idle, so the tool swaps the long chat for a short summary. Every job orch gives an agent is already written down in files (`task.md`, `task.json`, fix and review files), so the next milestone loses nothing it needs.
|
|
8
|
+
|
|
9
|
+
Example: `claude-1` builds M2 and M2 lands. `claude-1` is idle, so orch sends `/compact`. When herdr shows it idle again, it gets `Read .orch-task/M4/task.md ...`. `orch story` reads `the event manager did: claude-1 finished M2: orch sent /compact so its chat does not keep growing`.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **`/compact` between milestones**, on by default for Claude Code, Codex and AGY. orch sends it only while herdr shows the agent idle and it holds no job: as soon as its milestone lands, or just before it starts a different milestone (then that milestone waits until the compact is done). Never in the middle of work, never for a fix or review round of the same milestone, and never for the lead.
|
|
13
|
+
- While it compacts, the agent shows as `compacting` in `orch status`, `orch status --json`, `orch view` and `orch board`, and gets no new work. It is free again once herdr shows it idle for `ORCH_COMPACT_SETTLE_S` (10 s). Still working after `ORCH_COMPACT_MAX_S` (5 min): orch stops waiting and says so.
|
|
14
|
+
- **`orch config compact on|off`** (and `ORCH_COMPACT=0|1`) turns it on or off for this machine. `orch config` shows it.
|
|
15
|
+
- Registry keys **`compact`** (the command, `/compact`) and **`compact_min_version`**. AGY added `/compact` in 1.2.15: an older or unreadable `agy --version` means no compacting, said once in `orch story`, and `orch doctor agy` shows it. OpenCode, amp, Pi and Hermes stay off until their command is checked; `compact = "/compact"` in your `agents.toml` turns it on for a kind, `compact = ""` turns it off.
|
|
16
|
+
- Restart recovery: what each agent's chat holds and a compact in progress are kept across `orch sync` and `orch resume`. A compact that was cut short by a restart does no harm: the agent just gets its next job.
|
|
17
|
+
- Docs: [Compact between milestones](https://herdr-orchestra.vercel.app/docs/agents/#compact-between-milestones), the new keys and variables in Configuration, the command in Commands.
|
|
18
|
+
|
|
19
|
+
### Not yet tried
|
|
20
|
+
- With real Claude Code, Codex and AGY windows. It was tested with orch's simulated agents and herdr. The command name was checked in each tool's docs (AGY: from 1.2.15).
|
|
21
|
+
|
|
5
22
|
## [6.13.0] - 2026-11-26
|
|
6
23
|
|
|
7
24
|
The views no longer pass an old run off as the current one, and orch says when a plan file has a name it does not read.
|
package/README.md
CHANGED
|
@@ -85,6 +85,7 @@ orch update --check # only say whether a new version is out
|
|
|
85
85
|
orch update --version v5.8.0 # install that exact version (this is also how you go back)
|
|
86
86
|
orch config # auto-update on/off, the installed version, the last check
|
|
87
87
|
orch config auto-update off # or: on
|
|
88
|
+
orch config compact off # or: on (coders and the reviewer get /compact between milestones)
|
|
88
89
|
```
|
|
89
90
|
|
|
90
91
|
- **The check.** At most once a day, at `orch lead plan` or `orch version`, orch asks GitHub for the latest release (3 seconds at most; nothing about you or your project is sent). With no internet it stays silent and asks again the next day. `ORCH_NO_UPDATE_CHECK=1` turns the check off.
|
|
@@ -341,6 +342,7 @@ Three views show a run while it goes; none of them changes it.
|
|
|
341
342
|
| Attempts keep getting lost (unreachable, gone, rate-limited) | after 4 (`ORCH_MAX_LOST`) the task fails with the history instead of looping |
|
|
342
343
|
| 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 |
|
|
343
344
|
| 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)) |
|
|
345
|
+
| 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, never the lead. `orch config compact off` turns it off |
|
|
344
346
|
| 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 |
|
|
345
347
|
| 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 |
|
|
346
348
|
| 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.14.0
|
package/agents.default.toml
CHANGED
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
# interrupt_keys the keys that stop its current step, as `herdr agent send-keys` names them (default ["esc"]).
|
|
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
|
+
# compact the command that shrinks the tool's chat to a short summary (e.g. "/compact"). orch types it into a
|
|
20
|
+
# coder's or the reviewer's pane when its milestone is done, before it starts another one, while
|
|
21
|
+
# herdr shows it idle (never the lead). Leave it out (or "") for a tool where it is not known to work
|
|
22
|
+
# compact_min_version the first version of the tool that has that command: an older (or unreadable)
|
|
23
|
+
# `<binary> --version` means no compacting, said once in `orch story`
|
|
19
24
|
# roles any of "lead", "coder", "reviewer"
|
|
20
25
|
# skills_dirs global SKILL.md folders the installer may put the orch-plan / orch-run / orch-explain skills into
|
|
21
26
|
# (first = preferred)
|
|
@@ -43,6 +48,7 @@ review_launch = "claude --permission-mode acceptEdits --disallowedTools Edit,Not
|
|
|
43
48
|
model_flag = "--model"
|
|
44
49
|
herdr_detect = true
|
|
45
50
|
interrupt_keys = ["esc"]
|
|
51
|
+
compact = "/compact"
|
|
46
52
|
roles = ["lead", "coder", "reviewer"]
|
|
47
53
|
skills_dirs = ["~/.claude/skills"]
|
|
48
54
|
skills_one_wins = true
|
|
@@ -63,6 +69,7 @@ model_flag = "--model"
|
|
|
63
69
|
effort_flag = "-c model_reasoning_effort={effort}"
|
|
64
70
|
herdr_detect = true
|
|
65
71
|
interrupt_keys = ["esc"]
|
|
72
|
+
compact = "/compact"
|
|
66
73
|
roles = ["lead", "coder", "reviewer"]
|
|
67
74
|
skills_dirs = ["~/.agents/skills", "~/.codex/skills"]
|
|
68
75
|
skills_reads = ["~/.agents/skills", "~/.codex/skills"]
|
|
@@ -116,6 +123,8 @@ binary = "agy"
|
|
|
116
123
|
launch = "agy --mode accept-edits"
|
|
117
124
|
herdr_detect = true
|
|
118
125
|
interrupt_keys = ["esc"]
|
|
126
|
+
compact = "/compact"
|
|
127
|
+
compact_min_version = "1.2.15"
|
|
119
128
|
roles = ["lead", "coder", "reviewer"]
|
|
120
129
|
skills_dirs = ["~/.gemini/config/skills"]
|
|
121
130
|
invoke = "use the orch-plan skill: <feature>"
|
|
Binary file
|
package/bin/orch
CHANGED
|
@@ -41,6 +41,10 @@ STOP_WAIT_S = float(os.environ.get("ORCH_STOP_WAIT_S", "60")) # `orch stop` wa
|
|
|
41
41
|
HALT_WAIT_S = float(os.environ.get("ORCH_HALT_WAIT_S", "5")) # `orch set/park` waits this long for it to go idle
|
|
42
42
|
HALT_SETTLE_S = float(os.environ.get("ORCH_HALT_SETTLE_S", "10")) # idle at least this long after the stop note
|
|
43
43
|
HALT_REPEAT_S = float(os.environ.get("ORCH_HALT_REPEAT_S", "90")) # still working after this: interrupt it again
|
|
44
|
+
# a coder or reviewer whose milestone is done gets its tool's compact command (`/compact`), so its chat does not keep
|
|
45
|
+
# growing from milestone to milestone. It counts as busy until herdr shows it idle for COMPACT_SETTLE_S
|
|
46
|
+
COMPACT_SETTLE_S = float(os.environ.get("ORCH_COMPACT_SETTLE_S", "10"))
|
|
47
|
+
COMPACT_MAX_S = float(os.environ.get("ORCH_COMPACT_MAX_S", "300")) # still working after this: stop waiting for it
|
|
44
48
|
TEAM_CONFIRM_S = float(os.environ.get("ORCH_TEAM_CONFIRM_S", "5")) # `team up` looks again after this: still running?
|
|
45
49
|
LOG_MAX_B = int(float(os.environ.get("ORCH_LOG_MAX_MB", "2")) * 1024 * 1024) # autopilot.log; one old copy is kept
|
|
46
50
|
CRASH_KEEP = int(os.environ.get("ORCH_CRASH_KEEP", "20")) # saved agent screens in .orchestrate/crash/
|
|
@@ -1666,7 +1670,7 @@ def cmd_sync(args):
|
|
|
1666
1670
|
"reviewer_info": ({"kind": rev_kind, "pane": rev_pane, "detect": detect(rev_kind, rev_pane, "Reviewer"),
|
|
1667
1671
|
"model": models.get(reviewer), "tier": tier_of(reviewer),
|
|
1668
1672
|
**({k: v for k, v in (old.get("reviewer_info") or {}).items()
|
|
1669
|
-
if k in ("cooldown_until", "cooldown_reason") and v is not None}
|
|
1673
|
+
if k in ("cooldown_until", "cooldown_reason", "ctx", "compacting") and v is not None}
|
|
1670
1674
|
if old.get("reviewer") == reviewer else {})}
|
|
1671
1675
|
if reviewer else None),
|
|
1672
1676
|
"reviewer_busy": old.get("reviewer_busy") if old.get("reviewer") == reviewer else None,
|
|
@@ -1681,6 +1685,7 @@ def cmd_sync(args):
|
|
|
1681
1685
|
"lead_seq": old.get("lead_seq", 0),
|
|
1682
1686
|
"lead_wake": old.get("lead_wake"),
|
|
1683
1687
|
"lead_ready_told": old.get("lead_ready_told"),
|
|
1688
|
+
"compact_told": old.get("compact_told") or [],
|
|
1684
1689
|
"tree_task": old.get("tree_task"),
|
|
1685
1690
|
"workers": {},
|
|
1686
1691
|
"order": ids,
|
|
@@ -1692,6 +1697,8 @@ def cmd_sync(args):
|
|
|
1692
1697
|
"cooldown_reason": ow.get("cooldown_reason", ""),
|
|
1693
1698
|
**({"off": ow["off"]} if ow.get("off") else {}), # kept until `orch bench <w> on`
|
|
1694
1699
|
**({"stopping": ow["stopping"]} if ow.get("stopping") else {}), # told to stop
|
|
1700
|
+
**({k: ow[k] for k in ("ctx", "compacting") if ow.get(k)}
|
|
1701
|
+
if ow.get("kind") in (None, kind) else {}), # what its chat holds
|
|
1695
1702
|
"dir": ow.get("dir"), "setup_done": ow.get("setup_done", False),
|
|
1696
1703
|
"setup_hash": ow.get("setup_hash"), "delivery_fails": ow.get("delivery_fails", 0),
|
|
1697
1704
|
"pane": pane, "detect": detect(kind, pane, "Workers"),
|
|
@@ -1986,6 +1993,132 @@ def stopping_line(st, name, w):
|
|
|
1986
1993
|
f"it gets no new work until herdr shows it idle — `orch free {name}` if you checked its pane)")
|
|
1987
1994
|
|
|
1988
1995
|
|
|
1996
|
+
# ---------------------------------------------------------------- compacting a coder's or the reviewer's chat
|
|
1997
|
+
# Every job orch gives a coder or the reviewer is written down in files (task.md, task.json, fix and review files),
|
|
1998
|
+
# so the chat itself only holds what the agent did on its LAST milestone. Before the agent starts a different
|
|
1999
|
+
# milestone (and as soon as the milestone it worked on has landed) orch types its tool's compact command
|
|
2000
|
+
# (`/compact` in Claude Code, Codex and AGY): the tool replaces the long chat with a short summary. Only when herdr
|
|
2001
|
+
# shows the agent idle, never while it works, and never the lead. A fix or review round of the SAME milestone keeps
|
|
2002
|
+
# the chat. `orch config compact off` (or ORCH_COMPACT=0) turns it off; `compact = ""` in agents.toml turns it off
|
|
2003
|
+
# for one tool.
|
|
2004
|
+
|
|
2005
|
+
def compact_on():
|
|
2006
|
+
env = os.environ.get("ORCH_COMPACT")
|
|
2007
|
+
if env in ("0", "1"):
|
|
2008
|
+
return env == "1"
|
|
2009
|
+
return settings_load().get("compact", True) is not False
|
|
2010
|
+
|
|
2011
|
+
|
|
2012
|
+
_VERSIONS = {}
|
|
2013
|
+
|
|
2014
|
+
|
|
2015
|
+
def _version_of(binary):
|
|
2016
|
+
"""The x.y.z version `<binary> --version` prints, or None (asked once per process)."""
|
|
2017
|
+
if binary not in _VERSIONS:
|
|
2018
|
+
_VERSIONS[binary] = _ask_version(binary)
|
|
2019
|
+
return _VERSIONS[binary]
|
|
2020
|
+
|
|
2021
|
+
|
|
2022
|
+
def _ask_version(binary):
|
|
2023
|
+
try:
|
|
2024
|
+
r = subprocess.run([binary, "--version"], text=True, capture_output=True, timeout=10)
|
|
2025
|
+
except (OSError, subprocess.SubprocessError):
|
|
2026
|
+
return None
|
|
2027
|
+
m = re.search(r"(\d+)\.(\d+)\.(\d+)", (r.stdout or "") + (r.stderr or ""))
|
|
2028
|
+
return tuple(int(x) for x in m.groups()) if m else None
|
|
2029
|
+
|
|
2030
|
+
|
|
2031
|
+
def compact_command(st, kind):
|
|
2032
|
+
"""(command, None) when orch can compact this kind of agent, else (None, why). A tool whose registry entry has
|
|
2033
|
+
`compact_min_version` is asked its version (once per process); too old or unknown: no compacting."""
|
|
2034
|
+
if not compact_on():
|
|
2035
|
+
return None, "turned off (`orch config compact on` turns it on)"
|
|
2036
|
+
v = (registry(required=False) or {}).get(kind) or {}
|
|
2037
|
+
cmd = str(v.get("compact") or "").strip()
|
|
2038
|
+
if not cmd:
|
|
2039
|
+
return None, f"{kind} has no compact command in the agent list"
|
|
2040
|
+
need_v = str(v.get("compact_min_version") or "").strip()
|
|
2041
|
+
if need_v:
|
|
2042
|
+
have = _version_of(v.get("binary", kind))
|
|
2043
|
+
want = tuple(int(x) for x in re.findall(r"\d+", need_v)[:3])
|
|
2044
|
+
if not have or have < want:
|
|
2045
|
+
return None, (f"{kind} {'.'.join(map(str, have))} is older than {need_v}, the first version with {cmd}"
|
|
2046
|
+
if have else f"could not read {kind}'s version (`{v.get('binary', kind)} --version`); "
|
|
2047
|
+
f"{cmd} needs {need_v} or newer")
|
|
2048
|
+
return cmd, None
|
|
2049
|
+
|
|
2050
|
+
|
|
2051
|
+
def compact_unsupported(st, name, kind):
|
|
2052
|
+
"""Why this agent's chat can't be compacted although its tool has a compact command (an old version), or None."""
|
|
2053
|
+
v = (registry(required=False) or {}).get(kind) or {}
|
|
2054
|
+
if not compact_on() or not str(v.get("compact") or "").strip():
|
|
2055
|
+
return None
|
|
2056
|
+
return compact_command(st, kind)[1]
|
|
2057
|
+
|
|
2058
|
+
|
|
2059
|
+
def compact_agents(st):
|
|
2060
|
+
"""(name, info dict, holds a job) for every coder and the reviewer. The lead is never compacted."""
|
|
2061
|
+
out = [(n, w, bool(w.get("task"))) for n, w in st.get("workers", {}).items()]
|
|
2062
|
+
if st.get("reviewer") and st.get("reviewer_info") is not None:
|
|
2063
|
+
out.append((st["reviewer"], st["reviewer_info"], bool(st.get("reviewer_busy"))))
|
|
2064
|
+
return out
|
|
2065
|
+
|
|
2066
|
+
|
|
2067
|
+
def still_compacting(st, name, w=None):
|
|
2068
|
+
"""True while an agent that got the compact command may still be compacting: herdr shows it working, or it has
|
|
2069
|
+
been idle for less than COMPACT_SETTLE_S. Such an agent is busy: it gets no new work."""
|
|
2070
|
+
w = w if w is not None else agent_info(st, name)
|
|
2071
|
+
h = (w or {}).get("compacting")
|
|
2072
|
+
if not h or not w.get("detect", True):
|
|
2073
|
+
return False
|
|
2074
|
+
if now() - h.get("ts", 0) > COMPACT_MAX_S:
|
|
2075
|
+
return False
|
|
2076
|
+
s = herdr_state(name)
|
|
2077
|
+
if s is None:
|
|
2078
|
+
return False
|
|
2079
|
+
if busy_word(s):
|
|
2080
|
+
return True
|
|
2081
|
+
return now() - (h.get("idle_since") or h.get("ts", 0)) < COMPACT_SETTLE_S
|
|
2082
|
+
|
|
2083
|
+
|
|
2084
|
+
def compact_due(st, name, w, next_tid=None):
|
|
2085
|
+
"""The compact command to send now, or None. Due when the agent's chat holds another milestone than next_tid
|
|
2086
|
+
(or, with no next_tid, a milestone that has landed), it holds no job, and herdr shows it idle."""
|
|
2087
|
+
ctx = w.get("ctx")
|
|
2088
|
+
if not ctx or ctx == next_tid or w.get("compacting") or not w.get("detect", True) or w.get("off"):
|
|
2089
|
+
return None
|
|
2090
|
+
if next_tid is None and (st["tasks"].get(ctx) or {}).get("status", "merged") not in ("merged", "skipped"):
|
|
2091
|
+
return None
|
|
2092
|
+
if w.get("stopping") or cooling(name, w):
|
|
2093
|
+
return None
|
|
2094
|
+
cmd, _ = compact_command(st, w.get("kind"))
|
|
2095
|
+
if not cmd:
|
|
2096
|
+
return None
|
|
2097
|
+
s = herdr_state(name)
|
|
2098
|
+
if s is None or busy_word(s):
|
|
2099
|
+
return None
|
|
2100
|
+
return cmd
|
|
2101
|
+
|
|
2102
|
+
|
|
2103
|
+
def start_compact(st, name, w, cmd, before=None):
|
|
2104
|
+
"""Type the compact command into the agent's pane. The caller saves the state. Returns True when it was sent."""
|
|
2105
|
+
after = w.get("ctx")
|
|
2106
|
+
try:
|
|
2107
|
+
deliver(st, name, cmd)
|
|
2108
|
+
except DeliveryError:
|
|
2109
|
+
return False
|
|
2110
|
+
w["compacting"] = {"ts": now(), "after": after, "cmd": cmd, "before": before}
|
|
2111
|
+
story_note(st, f"{name} finished {after}: orch sent {cmd} so its chat does not keep growing"
|
|
2112
|
+
+ (f" (before it starts {before})" if before else ""), who="event manager")
|
|
2113
|
+
return True
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
def compacting_line(st, name, w):
|
|
2117
|
+
h = w.get("compacting") or {}
|
|
2118
|
+
return (f"compacting its chat after {h.get('after') or '?'} ({h.get('cmd') or '/compact'}, sent "
|
|
2119
|
+
f"{_fmt_secs(now() - h.get('ts', now()))} ago; it gets new work once herdr shows it idle)")
|
|
2120
|
+
|
|
2121
|
+
|
|
1989
2122
|
def commit_message(st, tid):
|
|
1990
2123
|
"""Commit message for a landed milestone: the coder's `COMMIT:` line (what changed), else the title.
|
|
1991
2124
|
The milestone id is a trailer, never the subject."""
|
|
@@ -2509,7 +2642,7 @@ def cmd_ready(args):
|
|
|
2509
2642
|
slots = 1 # shared mode: a queued fix job IS the active milestone, and it needs a coder
|
|
2510
2643
|
# only coders herdr can see count as free: a coder with no agent can't take work, whatever its task field says
|
|
2511
2644
|
present = [n for n, w in st["workers"].items() if not w.get("task") and not w.get("off") and not cooling(n, w)
|
|
2512
|
-
and not still_stopping(st, n, w)
|
|
2645
|
+
and not still_stopping(st, n, w) and not still_compacting(st, n, w)
|
|
2513
2646
|
and (not w.get("detect", True) or w.get("pane") or herdr_state(n) is not None)]
|
|
2514
2647
|
gone = [n for n, w in st["workers"].items() if not w.get("task") and not w.get("off") and w.get("detect", True)
|
|
2515
2648
|
and not w.get("pane") and herdr_state(n) is None]
|
|
@@ -2535,7 +2668,8 @@ def cooling(name, info):
|
|
|
2535
2668
|
|
|
2536
2669
|
|
|
2537
2670
|
def worker_free(st, name, w):
|
|
2538
|
-
if w.get("task") or w.get("off") or cooling(name, w) or still_stopping(st, name, w)
|
|
2671
|
+
if w.get("task") or w.get("off") or cooling(name, w) or still_stopping(st, name, w) \
|
|
2672
|
+
or still_compacting(st, name, w):
|
|
2539
2673
|
return False
|
|
2540
2674
|
if not w.get("detect", True): # herdr can't watch it: no task + no cooldown = free
|
|
2541
2675
|
return True
|
|
@@ -2580,6 +2714,15 @@ def cmd_prepare(args):
|
|
|
2580
2714
|
f"(or `orch free {worker}` after you checked its pane)")
|
|
2581
2715
|
sys.exit(3)
|
|
2582
2716
|
w.pop("stopping", None)
|
|
2717
|
+
if still_compacting(st, worker, w):
|
|
2718
|
+
print(f"BUSY {worker} is {compacting_line(st, worker, w)}")
|
|
2719
|
+
sys.exit(3)
|
|
2720
|
+
squash = None if w.get("task") == tid else compact_due(st, worker, w, tid)
|
|
2721
|
+
if squash and start_compact(st, worker, w, squash, tid):
|
|
2722
|
+
save(st)
|
|
2723
|
+
print(f"BUSY {worker} is compacting its chat after {w['compacting']['after']} first ({squash}); {tid} starts "
|
|
2724
|
+
f"there once herdr shows it idle")
|
|
2725
|
+
sys.exit(3)
|
|
2583
2726
|
if not holds(st, tid) and free_slots(st) <= 0 and not (st["isolation"] == "shared" and t["status"] in ("conflict", "needs-fix")):
|
|
2584
2727
|
die("no free slot (max parallel reached)")
|
|
2585
2728
|
d = Path(w["dir"] or ROOT)
|
|
@@ -2802,6 +2945,8 @@ def cmd_send(args):
|
|
|
2802
2945
|
"result": str(d / rel / f"result-{k}.json"), "since": now(), "started": now(), "kind": "coder",
|
|
2803
2946
|
"prompt": text, "nudges": 0, "file": fname, "delivering": True,
|
|
2804
2947
|
"model": st["workers"][t["worker"]].get("model"), "tier": st["workers"][t["worker"]].get("tier")}
|
|
2948
|
+
st["workers"][t["worker"]]["ctx"] = tid # its chat now holds this milestone (compacted before another)
|
|
2949
|
+
st["workers"][t["worker"]].pop("compacting", None)
|
|
2805
2950
|
save(st)
|
|
2806
2951
|
try:
|
|
2807
2952
|
deliver(st, t["worker"], text)
|
|
@@ -2895,10 +3040,15 @@ def cmd_review(args):
|
|
|
2895
3040
|
die("no reviewer configured")
|
|
2896
3041
|
ri = st.get("reviewer_info") or {}
|
|
2897
3042
|
busy = st.get("reviewer_busy") and st["reviewer_busy"] != tid
|
|
2898
|
-
if busy or cooling(st["reviewer"], ri)
|
|
3043
|
+
squash = None if busy or cooling(st["reviewer"], ri) or still_compacting(st, st["reviewer"], ri) else \
|
|
3044
|
+
compact_due(st, st["reviewer"], ri, tid)
|
|
3045
|
+
if squash and not start_compact(st, st["reviewer"], ri, squash, tid):
|
|
3046
|
+
squash = None
|
|
3047
|
+
if busy or cooling(st["reviewer"], ri) or still_compacting(st, st["reviewer"], ri):
|
|
2899
3048
|
move(st, tid, "awaiting-review")
|
|
2900
3049
|
save(st)
|
|
2901
|
-
why = f"is on {st['reviewer_busy']}" if busy else "is benched (cooldown)"
|
|
3050
|
+
why = (f"is on {st['reviewer_busy']}" if busy else "is benched (cooldown)" if cooling(st["reviewer"], ri)
|
|
3051
|
+
else compacting_line(st, st["reviewer"], ri))
|
|
2902
3052
|
print(f"BUSY reviewer {why}; {tid} queued as awaiting-review")
|
|
2903
3053
|
sys.exit(3)
|
|
2904
3054
|
d = task_dir(t, tid)
|
|
@@ -2969,6 +3119,9 @@ def cmd_review(args):
|
|
|
2969
3119
|
rtext = f"Read {rel}/review-task-{k}.md and do exactly what it says."
|
|
2970
3120
|
t["review_round"] = k
|
|
2971
3121
|
st["reviewer_busy"] = tid
|
|
3122
|
+
if st.get("reviewer_info") is not None:
|
|
3123
|
+
st["reviewer_info"]["ctx"] = tid # its chat now holds this milestone (compacted before another)
|
|
3124
|
+
st["reviewer_info"].pop("compacting", None)
|
|
2972
3125
|
move(st, tid, "reviewing")
|
|
2973
3126
|
t["wait"] = {"agent": st["reviewer"], "sentinel": str(sentinel), "report": str(rd / f"review-{k}.md"),
|
|
2974
3127
|
"result": str(rd / f"review-{k}.json"), "since": now(), "started": now(), "kind": "reviewer",
|
|
@@ -3150,6 +3303,12 @@ def cmd_poll(args):
|
|
|
3150
3303
|
if events:
|
|
3151
3304
|
print("\n".join(events))
|
|
3152
3305
|
return
|
|
3306
|
+
# an agent that got /compact and is idle again can take its next milestone now: back to the event manager
|
|
3307
|
+
squashed = [n for n, w, holding in compact_agents(st) if w.get("compacting") and not holding
|
|
3308
|
+
and not still_compacting(st, n, w)]
|
|
3309
|
+
if squashed:
|
|
3310
|
+
print(f"WAITING compacted: {' '.join(squashed)} (free for new work)")
|
|
3311
|
+
sys.exit(10)
|
|
3153
3312
|
if time.time() >= end:
|
|
3154
3313
|
running = [f"{tid}:{st['tasks'][tid]['status']}" for tid in st["order"]
|
|
3155
3314
|
if st["tasks"][tid]["status"] in ("coding", "reviewing", "conflict")]
|
|
@@ -3642,7 +3801,9 @@ def cmd_status(args):
|
|
|
3642
3801
|
if st.get("mode") == "quick":
|
|
3643
3802
|
print(f"QUICK RUN because: {st.get('quick_because') or '-'}")
|
|
3644
3803
|
print(f"branch={st['branch']} base={st.get('base')} isolation={st['isolation']} "
|
|
3645
|
-
f"max_parallel={st['max_parallel']} reviewer={st['reviewer']} (busy: {st.get('reviewer_busy')})"
|
|
3804
|
+
f"max_parallel={st['max_parallel']} reviewer={st['reviewer']} (busy: {st.get('reviewer_busy')})"
|
|
3805
|
+
+ (f" — reviewer {compacting_line(st, st['reviewer'], st['reviewer_info'])}"
|
|
3806
|
+
if st.get("reviewer") and still_compacting(st, st["reviewer"], st.get("reviewer_info") or {}) else ""))
|
|
3646
3807
|
vu = view_url()
|
|
3647
3808
|
print(f"live view: {vu}" if vu else "live view: off — `orch view` shows this run as a picture in your browser")
|
|
3648
3809
|
for n in run_notices(st):
|
|
@@ -3656,6 +3817,7 @@ def cmd_status(args):
|
|
|
3656
3817
|
state = ("OFF (" + (w["off"].get("why") or "developer") + ")" if w.get("off") else
|
|
3657
3818
|
f"coding {w['task']}" if w.get("task") else
|
|
3658
3819
|
stopping_line(st, n, w) if still_stopping(st, n, w) else
|
|
3820
|
+
compacting_line(st, n, w) if still_compacting(st, n, w) else
|
|
3659
3821
|
f"benched {cd // 60}m ({w.get('cooldown_reason') or 'cooldown'})" if cd else "free")
|
|
3660
3822
|
if state == "free" and h == "ok" and w.get("detect", True) and busy_word(herdr_state(n)):
|
|
3661
3823
|
state = "free, but herdr shows it working: look at its pane before it gets new work"
|
|
@@ -5702,6 +5864,70 @@ def _autopilot(args):
|
|
|
5702
5864
|
+ f". It gets no new work until it is idle; look at its pane (`orch free {n}` once it has "
|
|
5703
5865
|
f"stopped)", h.get("again", 0) >= 1)
|
|
5704
5866
|
|
|
5867
|
+
def _agent_of(s_, name):
|
|
5868
|
+
return s_["workers"].get(name) if name in s_.get("workers", {}) else \
|
|
5869
|
+
(s_.get("reviewer_info") if name == s_.get("reviewer") else None)
|
|
5870
|
+
|
|
5871
|
+
def tend_compacts():
|
|
5872
|
+
"""Coders and the reviewer whose milestone landed get their tool's compact command while they are idle and
|
|
5873
|
+
hold no job; one that is compacting is free again once herdr shows it idle (or after COMPACT_MAX_S)."""
|
|
5874
|
+
st_ = load()
|
|
5875
|
+
for n, w, holding in compact_agents(st_):
|
|
5876
|
+
if holding:
|
|
5877
|
+
continue
|
|
5878
|
+
h = w.get("compacting")
|
|
5879
|
+
if h:
|
|
5880
|
+
s = herdr_state(n) if w.get("detect", True) else None
|
|
5881
|
+
busy = s is not None and busy_word(s)
|
|
5882
|
+
if busy and h.get("idle_since"):
|
|
5883
|
+
h["idle_since"] = None
|
|
5884
|
+
elif s is not None and not busy and not h.get("idle_since"):
|
|
5885
|
+
h["idle_since"] = now()
|
|
5886
|
+
late = now() - h.get("ts", 0) > COMPACT_MAX_S
|
|
5887
|
+
done = not still_compacting(st_, n, w)
|
|
5888
|
+
|
|
5889
|
+
def upd(s_, n=n, idle=h.get("idle_since"), done=done, late=late, busy=busy):
|
|
5890
|
+
a = _agent_of(s_, n)
|
|
5891
|
+
if not a or not a.get("compacting"):
|
|
5892
|
+
return
|
|
5893
|
+
if not done:
|
|
5894
|
+
a["compacting"]["idle_since"] = idle
|
|
5895
|
+
return
|
|
5896
|
+
a.pop("compacting", None)
|
|
5897
|
+
a["ctx"] = None
|
|
5898
|
+
if late and busy:
|
|
5899
|
+
story_note(s_, f"{n} was still busy {_fmt_secs(COMPACT_MAX_S)} after {h.get('cmd')}: orch "
|
|
5900
|
+
f"stopped waiting for it", who="event manager")
|
|
5901
|
+
patch_state(upd)
|
|
5902
|
+
if done:
|
|
5903
|
+
say(f"{n} is still working {_fmt_secs(COMPACT_MAX_S)} after {h.get('cmd')}: look at its pane"
|
|
5904
|
+
if late and busy else f"COMPACTED {n}: its chat after {h.get('after')} is now a short summary",
|
|
5905
|
+
late and busy)
|
|
5906
|
+
continue
|
|
5907
|
+
if not compact_due(st_, n, w):
|
|
5908
|
+
why = w.get("ctx") and w.get("detect", True) and compact_unsupported(st_, n, w.get("kind"))
|
|
5909
|
+
if why and w.get("kind") not in st_.get("compact_told", []):
|
|
5910
|
+
def told(s_, n=n, k=w.get("kind"), why=why):
|
|
5911
|
+
if k not in s_.setdefault("compact_told", []):
|
|
5912
|
+
s_["compact_told"].append(k)
|
|
5913
|
+
story_note(s_, f"{n}'s chat is not compacted: {why}", who="event manager")
|
|
5914
|
+
patch_state(told)
|
|
5915
|
+
say(f"{n}'s chat is not compacted: {why}")
|
|
5916
|
+
continue
|
|
5917
|
+
sent_ = {}
|
|
5918
|
+
|
|
5919
|
+
def go(s_, n=n, ctx=w.get("ctx")):
|
|
5920
|
+
a = _agent_of(s_, n)
|
|
5921
|
+
holds_ = (a or {}).get("task") if n in s_.get("workers", {}) else s_.get("reviewer_busy")
|
|
5922
|
+
if not a or holds_ or a.get("ctx") != ctx or a.get("compacting"):
|
|
5923
|
+
return
|
|
5924
|
+
cmd, _ = compact_command(s_, a.get("kind"))
|
|
5925
|
+
if cmd and start_compact(s_, n, a, cmd):
|
|
5926
|
+
sent_["cmd"] = cmd
|
|
5927
|
+
patch_state(go)
|
|
5928
|
+
if sent_:
|
|
5929
|
+
say(f"{n} finished {w.get('ctx')} and is idle: sent {sent_['cmd']} so its chat does not keep growing")
|
|
5930
|
+
|
|
5705
5931
|
def dispatch(kind, tid, worker):
|
|
5706
5932
|
code, prep = run("prepare", tid, worker, ok=(0, 3))
|
|
5707
5933
|
if code == 3: # the coder is busy after all (still stopping its last milestone): next loop
|
|
@@ -5906,6 +6132,7 @@ def _autopilot(args):
|
|
|
5906
6132
|
patch_state(lambda s_: (s_["run"].get("manager") or {}).update(procs))
|
|
5907
6133
|
watch_herdr()
|
|
5908
6134
|
tend_stops()
|
|
6135
|
+
tend_compacts()
|
|
5909
6136
|
# 0. budget: driving time adds up across restarts (time spent only waiting for an answer doesn't count)
|
|
5910
6137
|
el, last_tick = time.time() - last_tick, time.time()
|
|
5911
6138
|
asleep = slept()
|
|
@@ -7102,6 +7329,7 @@ def view_model(st=None, recent=40):
|
|
|
7102
7329
|
for n, w in st.get("workers", {}).items():
|
|
7103
7330
|
cd = max(0, w.get("cooldown_until", 0) - t_now)
|
|
7104
7331
|
state = ("off" if w.get("off") else "stopping" if w.get("stopping") else
|
|
7332
|
+
"compacting" if w.get("compacting") and not w.get("task") else
|
|
7105
7333
|
(VIEW_WORDS.get(tasks.get(w["task"], {}).get("status"), "working") if w.get("task") else
|
|
7106
7334
|
f"benched {cd // 60}m" if cd else "free"))
|
|
7107
7335
|
agents.append({"name": n, "role": "coder", "kind": w.get("kind"), "model": w.get("model"),
|
|
@@ -7110,7 +7338,8 @@ def view_model(st=None, recent=40):
|
|
|
7110
7338
|
ri = st.get("reviewer_info") or {}
|
|
7111
7339
|
busy = st.get("reviewer_busy")
|
|
7112
7340
|
agents.append({"name": st["reviewer"], "role": "reviewer", "kind": ri.get("kind"), "model": ri.get("model"),
|
|
7113
|
-
"tier": ri.get("tier"), "task": busy, "state": "reviewing" if busy else
|
|
7341
|
+
"tier": ri.get("tier"), "task": busy, "state": "reviewing" if busy else
|
|
7342
|
+
"compacting" if ri.get("compacting") else "free"})
|
|
7114
7343
|
groups = [m["group"] for m in ms]
|
|
7115
7344
|
run = st.get("run") or {}
|
|
7116
7345
|
return {
|
|
@@ -7743,6 +7972,8 @@ USAGE = """usage: orch <command> [args]
|
|
|
7743
7972
|
version print the installed herdr-orchestra version
|
|
7744
7973
|
update [--check] [--version vX.Y.Z] install the latest release (or that one) and show what is new
|
|
7745
7974
|
config [auto-update on|off] this machine's settings: keep orch up to date by itself, or only be told
|
|
7975
|
+
config compact on|off a coder or the reviewer gets /compact when its milestone is done (on by default for
|
|
7976
|
+
Claude Code, Codex and AGY 1.2.15+; never the lead). ORCH_COMPACT=0|1 overrides it
|
|
7746
7977
|
lead plan|run print the lead playbook (any agent can lead: "Run `orch lead plan` and follow it")
|
|
7747
7978
|
lead plan quick|full the rest of the plan playbook: a quick run's rules, or steps 3-10 of the full process
|
|
7748
7979
|
lead run --section <EVENT|ALL_DONE|rules> one part of the run playbook (orch events prints these for you)
|
|
@@ -8550,6 +8781,10 @@ def cmd_doctor(args):
|
|
|
8550
8781
|
continue
|
|
8551
8782
|
bad = [m for ok, m in res if not ok]
|
|
8552
8783
|
broken += bool(bad)
|
|
8784
|
+
if str(reg[k].get("compact") or "").strip(): # information only: no compacting is never "broken"
|
|
8785
|
+
cmd, why = compact_command({}, k)
|
|
8786
|
+
res.append((True, f"compact: {cmd} between milestones (coders and the reviewer)" if cmd else
|
|
8787
|
+
f"compact: not sent — {why}"))
|
|
8553
8788
|
print(f"{'BROKEN' if bad else 'ok':<7} {k}" + ("" if reg[k].get("verified") else " (registry entry unverified)"))
|
|
8554
8789
|
for ok, m in res:
|
|
8555
8790
|
print(f" {'ok ' if ok else 'BAD'} {m}")
|
|
@@ -9296,7 +9531,7 @@ def cmd_sub(args):
|
|
|
9296
9531
|
|
|
9297
9532
|
|
|
9298
9533
|
def cmd_config(args):
|
|
9299
|
-
"""orch config -> this machine's settings; orch config auto-update on|off."""
|
|
9534
|
+
"""orch config -> this machine's settings; orch config auto-update on|off; orch config compact on|off."""
|
|
9300
9535
|
if args[:1] == ["auto-update"] and args[1:2] and args[1].lower() in ("on", "off"):
|
|
9301
9536
|
s = settings_load()
|
|
9302
9537
|
s["auto_update"] = args[1].lower() == "on"
|
|
@@ -9305,13 +9540,28 @@ def cmd_config(args):
|
|
|
9305
9540
|
"never during a run" if s["auto_update"] else " — orch only tells you when a new version is out; "
|
|
9306
9541
|
"update with `orch update`"))
|
|
9307
9542
|
return
|
|
9543
|
+
if args[:1] == ["compact"] and args[1:2] and args[1].lower() in ("on", "off"):
|
|
9544
|
+
s = settings_load()
|
|
9545
|
+
s["compact"] = args[1].lower() == "on"
|
|
9546
|
+
settings_save(s)
|
|
9547
|
+
print(f"compact: {args[1].lower()}" + (" — a coder or the reviewer gets its tool's compact command "
|
|
9548
|
+
"(/compact) when its milestone is done, before it starts another one" if s["compact"] else
|
|
9549
|
+
" — orch never compacts an agent's chat; the tools still compact by themselves when the chat is full"))
|
|
9550
|
+
return
|
|
9308
9551
|
if args:
|
|
9309
|
-
die("usage: orch config | orch config auto-update on|off")
|
|
9552
|
+
die("usage: orch config | orch config auto-update on|off | orch config compact on|off")
|
|
9310
9553
|
s = settings_load()
|
|
9311
9554
|
env = os.environ.get("ORCH_AUTO_UPDATE")
|
|
9312
9555
|
print(f"auto-update: {'on' if auto_update_on() else 'off'}"
|
|
9313
9556
|
+ (f" (ORCH_AUTO_UPDATE={env} overrides the saved setting)" if env else "")
|
|
9314
9557
|
+ ("" if "auto_update" in s or env else " (never asked: `orch config auto-update on` turns it on)"))
|
|
9558
|
+
cenv = os.environ.get("ORCH_COMPACT")
|
|
9559
|
+
reg = registry(required=False) or {}
|
|
9560
|
+
kinds = [k for k, v in reg.items() if str(v.get("compact") or "").strip()]
|
|
9561
|
+
print(f"compact: {'on' if compact_on() else 'off'}"
|
|
9562
|
+
+ (f" (ORCH_COMPACT={cenv} overrides the saved setting)" if cenv in ("0", "1") else "")
|
|
9563
|
+
+ (f" — coders and the reviewer on {', '.join(kinds)} get /compact between milestones; "
|
|
9564
|
+
"`orch config compact off` turns it off" if compact_on() and kinds else ""))
|
|
9315
9565
|
print(f"installed: {installed_version()}" + ("" if release_install() else " (not a release install: no update checks)"))
|
|
9316
9566
|
lc = int(s.get("last_check") or 0)
|
|
9317
9567
|
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.14.0",
|
|
4
4
|
"description": "Orchestrate AI coding agents (Claude Code, Codex, OpenCode, Amp, Pi) as one team: a lead plans, coders build, a reviewer checks, you get one PR. Runs in Herdr panes, or in one Pi window with subagents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
package/playbooks/run.md
CHANGED
|
@@ -60,7 +60,7 @@ If you changed plan.md by hand, run `orch sync` (it works once the event manager
|
|
|
60
60
|
|
|
61
61
|
**Swap a coder** (for example, AGY instead of OpenCode): `orch stop` (the event manager finishes its current step and exits; nothing is lost), change `Workers:` in plan.md, `orch sync`, `orch team up`, check that `orch status` shows the new worker as `herdr=ok`, then `orch resume`. Never kill the event manager by hand.
|
|
62
62
|
|
|
63
|
-
**Move a milestone to another coder** (for example M7 from rs-agy-1 to rs-claude-1): `orch set M7 paused`, then `orch dispatch M7 --to rs-claude-1`. orch presses the old coder's interrupt key and tells it to stop. Tell the developer it has stopped only when `orch status` no longer shows it as `stopping M7`; until then it may still be editing files, and it gets no new work.
|
|
63
|
+
**Move a milestone to another coder** (for example M7 from rs-agy-1 to rs-claude-1): `orch set M7 paused`, then `orch dispatch M7 --to rs-claude-1`. orch presses the old coder's interrupt key and tells it to stop. Tell the developer it has stopped only when `orch status` no longer shows it as `stopping M7`; until then it may still be editing files, and it gets no new work. A coder or the reviewer shown as `compacting` got `/compact` after its last milestone (orch does this by itself between milestones, never mid-work): it takes its next milestone in a minute, nothing to do.
|
|
64
64
|
|
|
65
65
|
**Before `orch dispatch --to <worker>`**, `orch status` must show that worker as `herdr=ok`. dispatch refuses a worker with no agent (`NO AGENT`, `SHELL ONLY`); do what it says (`orch team up`) and try again. If `orch team up` reports `QUIT <worker>`, the agent quit as soon as it started: show the developer the pane and the saved screen it names.
|
|
66
66
|
|