herdr-orchestra 6.5.0 → 6.7.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 +34 -0
- package/README.md +6 -5
- package/VERSION +1 -1
- package/agents.default.toml +5 -1
- package/bin/__pycache__/orchcpython-314.pyc +0 -0
- package/bin/orch +453 -32
- package/package.json +1 -1
- package/playbooks/plan.md +30 -6
- package/playbooks/run.md +1 -1
- package/playbooks/subagent.md +4 -1
- package/skills/orch-run/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes. Versions follow [semantic versioning](https://semver.org).
|
|
4
4
|
|
|
5
|
+
## [6.7.0] - 2026-11-22
|
|
6
|
+
|
|
7
|
+
The coder and reviewer agents now follow Claude Code's subagent guide (code.claude.com/docs/en/sub-agents): each agent does one job, has only the tools that job needs, and has a description that names exactly when to use it.
|
|
8
|
+
|
|
9
|
+
Example: your reviewer pane is Claude Code. `orch team up` now starts it as `claude --permission-mode acceptEdits --disallowedTools Edit,NotebookEdit --model opus`, so it can read the change and write its review file, but it cannot "just fix" the code itself and slip an unreviewed change into the milestone. In Pi subagent mode, asking Pi "fix this typo" in a normal chat no longer starts orch's `coder`: its description now says it is only for orch runs.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **Read-only Claude reviewer.** New optional registry key `review_launch`: the command for the reviewer pane. Claude Code's turns off `Edit` and `NotebookEdit` (it keeps `Write` for its review file). `orch team up` uses it for the reviewer, the "start it yourself" hints after a restart show it, `orch agents launch <kind> --role reviewer` prints it, and `orch doctor` checks its flags too. A kind without it starts its reviewer like a coder, as before. If your own `agents.toml` sets `launch` for a kind but no `review_launch`, your `launch` is used for the reviewer too.
|
|
13
|
+
- **Pi subagents: `max_turns`.** `"max_turns": 80` under `subagent.coder` or `subagent.reviewer` in `~/.config/herdr-orchestra/config.json` stops a looping subagent after that many turns. The subagent playbook tells the lead to resume a coder that stopped early once, then ask you. Not set: no limit, as before.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- **Pi subagent descriptions** say they are only for herdr-orchestra runs, so Pi does not pick `coder` or `reviewer` for other work. The Pi reviewer also lists `disallowed_tools: edit, write`, so an extension's edit tool cannot reach it either. Run `orch setup --mode subagent` (or `/orch-mode subagent` in Pi) to refresh the two agent files.
|
|
17
|
+
|
|
18
|
+
## [6.6.0] - 2026-11-22
|
|
19
|
+
|
|
20
|
+
Three upgrades that make plans and reviews follow your project, and show you where the risk is. Each one stays out of the way when you don't use it: a repo without the new files, and a plan without the new lines, run exactly as before.
|
|
21
|
+
|
|
22
|
+
Example: you ask for "add discounts to orders". The lead reads the code and your `docs/glossary.md` and `docs/adr/`, then asks you 3 questions in one message before it writes any plan. You answer `1 whole order, 2 both, 3 no`, and the plan is written once. M2 (a new column on a 2-million-row table) is marked hard to undo. The reviewer of M3 reports `[spec] AC2 not met: a negative discount is accepted` and `[rules: ADR 0001: money is whole paise] discount kept as a decimal` separately. M2 waits for your `orch approve` with its coder's proof (`migration ran on a copy: 2M rows in 14s, no lock`), and the PR shows a table of what is hard to undo and how much each milestone could break.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- **House rules.** Optional files in your repo: `docs/glossary.md` (your words, and words to avoid: `- **Discount**: money off an order total. Avoid: coupon, promo`), `docs/adr/*.md` (decisions already made) and `docs/coding-standards.md`. Each coder's task file gets a short "Project rules" block: only the glossary words its milestone uses (orch matches the words, so a long glossary costs nothing extra), one line per decision, and where the coding rules are. task.json lists them under `project_rules`. The plan header `Docs: <folder>` names another folder.
|
|
26
|
+
- **Two-question review.** The reviewer answers separately: `spec` (did it build what was asked, no more and no less? orch tells it which files changed outside Likely files) and `rules` (does it follow the repo's written rules? it names the rule). It is told not to report what the check command already catches. `review-N.json` findings get `axis` and `rule` (both optional: older reviews read as before). Blocker and suggestion lines carry `[spec]` or `[rules: <rule>]`. The summary has "Review findings: spec and rules" with the rules broken most often, and `orch report` (and `--json`) counts them. Pi subagent mode's reviewer gets the same two questions (run `orch setup --mode subagent` to refresh its agent file).
|
|
27
|
+
- **Lead asks first.** Plan playbook step 2a: after research and before any plan, the lead asks what only you can decide, all in one message, each question with 2 or 3 choices and its own suggestion, then waits. No questions when the code settles everything. Start a request with `grill:` for one question at a time. Your answers go into the plan where they apply. The questions are kept in `.orchestrate/questions.md`, and `orch lead run` refuses to start a run from an older plan while they are unanswered (your answer is planning, not "go").
|
|
28
|
+
- **New words and decisions get written down.** A plan can list `## Glossary additions`; the milestone that brings the word (or a hard-to-change decision, as `docs/adr/NNNN-*.md`) writes it, through an acceptance criterion. `orch sync` warns when the plan uses a word the glossary says to avoid, when a new word has no milestone with `docs/glossary.md` in its Likely files, and when an acceptance criterion names a glossary or decision file that is not in the milestone's Likely files. `orch plan show` lists the new words.
|
|
29
|
+
- **Risky-change label.** `Door: one-way (why)` on a milestone that is hard to undo once it runs (a migration on real data, a public API others call, deleting data, sending emails). It always waits for your `orch approve`, even when no file looks risky, and its coder is asked for proof (`proof` in the result file, or a `PROOF:` report line). `Risk hold: off` still turns every hold off (`orch sync` warns). A quick run is never one-way (`orch sync` refuses it).
|
|
30
|
+
- **Blast radius.** orch measures how much each milestone could break, with no AI: risky files, how many milestones build on it, shared hotspot files, deleted files, its size. Small, medium or large, with the reasons. The hold message and `orch status` show it with the proof; the summary (and so the PR) gets an "Undo and blast radius" table when something in it is hard to undo or more than small; `orch report` lists it too.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
- When a held milestone was the last thing in progress, the event manager could stop before it said "is HELD for your approval" (and before the desktop notification): it now handles a background merge that just ended before it stops.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- The `orch-run` skill no longer claims the developer's answers to the lead's questions before the plan exists.
|
|
37
|
+
- Docs: new Q&As (why the lead asks first, how to give the agents your rules, what "hard to undo" means), the plan file fields `Docs:`, `Door:` and `## Glossary additions`, the two-question review, and the contracts.
|
|
38
|
+
|
|
5
39
|
## [6.5.0] - 2026-11-22
|
|
6
40
|
|
|
7
41
|
Subagent mode is now set up from inside Pi with one slash command. Before, `/orch-mode subagent` only saved the mode and printed `NEXT run orch setup --mode subagent`, which you had to run in a separate, normal terminal. Now the slash command does that work itself.
|
package/README.md
CHANGED
|
@@ -128,9 +128,9 @@ Version choice, first match wins: `--version` flag › `ORCH_VERSION` env › `.
|
|
|
128
128
|
| Lead | any agent, e.g. `claude` or `opencode` | `lead` (the playbook does it) |
|
|
129
129
|
| Coder (medium work) | `claude --permission-mode acceptEdits --model sonnet` | `claude-1` |
|
|
130
130
|
| Coder (small work) | `claude --permission-mode acceptEdits --model haiku` | `claude-2` |
|
|
131
|
-
| Reviewer (optional) | `claude --model opus`, `agy --mode accept-edits` or a spare agent | `reviewer` |
|
|
131
|
+
| Reviewer (optional) | `claude --permission-mode acceptEdits --disallowedTools Edit,NotebookEdit --model opus`, `agy --mode accept-edits` or a spare agent | `reviewer` |
|
|
132
132
|
|
|
133
|
-
`orch agents launch <kind> --model <id>` prints the command with the model; `orch models` lists the models and their tiers. Use whatever your installed agents already reach.
|
|
133
|
+
`orch agents launch <kind> --model <id>` prints the command with the model (`--role reviewer` gives the reviewer's command: for Claude Code its edit tools are off, it only reads the change and writes its review file); `orch models` lists the models and their tiers. Use whatever your installed agents already reach.
|
|
134
134
|
|
|
135
135
|
**Only one tool installed, or just one window open?** Open only the lead and start the plan playbook. The lead sees it is alone and builds the team from its own tool: `orch team codex` picks coders and a reviewer of that tool on the models the catalog allows, spread over its tiers, and the lead writes them into the plan. When you say go, `orch team up` opens their panes next to the lead, each in its own folder and on its model, and names them. You never type either command yourself (you can: `orch team codex --coders 1`, `orch team up --dry-run`). Each pane is a separate session of the same tool, on your existing login.
|
|
136
136
|
|
|
@@ -208,6 +208,7 @@ The skills and slash commands are thin wrappers: the playbooks themselves live i
|
|
|
208
208
|
```toml
|
|
209
209
|
[claude]
|
|
210
210
|
launch = "claude --permission-mode acceptEdits"
|
|
211
|
+
review_launch = "claude --permission-mode acceptEdits --disallowedTools Edit,NotebookEdit" # the reviewer pane
|
|
211
212
|
model_flag = "--model" # what `orch agents launch claude --model <id>` appends
|
|
212
213
|
|
|
213
214
|
[myagent] # a new kind
|
|
@@ -218,7 +219,7 @@ roles = ["coder"]
|
|
|
218
219
|
skills_dirs = ["~/.myagent/skills"]
|
|
219
220
|
```
|
|
220
221
|
|
|
221
|
-
`orch doctor [kind]` checks an installed agent against the real tool (version, whether the launch flags still exist in its `--help`, skills, herdr detection). `orch agents launch <kind>` prints the command · `orch team <kind>` / `orch team up` build and open a whole team from one tool · `orch agents sync` installs the skills for every installed agent (run it after adding a new one) · `orch agents check` confirms every installed agent sees each skill exactly once (not missing, not twice). Many tools read more than one folder (Codex reads `~/.agents/skills` and `~/.codex/skills` and lists a skill found in both twice), so the installer writes the fewest folders that give each installed agent one copy, e.g. with Claude, Codex and OpenCode: `~/.claude/skills` (Claude) and `~/.agents/skills` (Codex; OpenCode reads both, and its docs say one copy wins). Claude Code gets the skill only (a skill is already the `/orch-plan` command); OpenCode gets slash commands in `~/.config/opencode/commands`.
|
|
222
|
+
`orch doctor [kind]` checks an installed agent against the real tool (version, whether the launch flags still exist in its `--help`, skills, herdr detection; the `review_launch` flags too). `orch agents launch <kind>` prints the command · If you set your own `launch` for a kind and no `review_launch`, your `launch` is used for the reviewer too · `orch team <kind>` / `orch team up` build and open a whole team from one tool · `orch agents sync` installs the skills for every installed agent (run it after adding a new one) · `orch agents check` confirms every installed agent sees each skill exactly once (not missing, not twice). Many tools read more than one folder (Codex reads `~/.agents/skills` and `~/.codex/skills` and lists a skill found in both twice), so the installer writes the fewest folders that give each installed agent one copy, e.g. with Claude, Codex and OpenCode: `~/.claude/skills` (Claude) and `~/.agents/skills` (Codex; OpenCode reads both, and its docs say one copy wins). Claude Code gets the skill only (a skill is already the `/orch-plan` command); OpenCode gets slash commands in `~/.config/opencode/commands`.
|
|
222
223
|
|
|
223
224
|
### Agents herdr can't watch
|
|
224
225
|
For a kind with `herdr_detect = false` (or one missing from the registry, which `orch sync` warns about), `orch` relies only on the **done file and the time budget**: it never reports GONE, BLOCKED or IDLE for it, treats it as free whenever it has no task, and `orch status` marks it `detect:off`. If herdr doesn't recognise the pane as an agent at all, address it by pane id: `Workers: hermes-1 (hermes @pane:w1:p3)`. `orch` then types prompts into that pane, and `orch start` reports a `STALE pane` when the id has changed (`herdr pane list` shows the current ids).
|
|
@@ -273,13 +274,13 @@ Switch with `/orch-mode subagent` in Pi; `/orch-mode` alone shows the mode, and
|
|
|
273
274
|
orch setup --mode subagent # or: npx herdr-orchestra@latest --mode subagent, or orch team up --mode subagent
|
|
274
275
|
```
|
|
275
276
|
|
|
276
|
-
Setup writes `~/.pi/agent/agents/coder.md` and `reviewer.md` (the reviewer cannot edit files) and installs `npm:@tintinweb/pi-subagents`. Pick their models in the config file; with none, they use the lead's model. A model the policy denies is refused, and a file you edited yourself (without orch's line in it) is left alone.
|
|
277
|
+
Setup writes `~/.pi/agent/agents/coder.md` and `reviewer.md` (the reviewer cannot edit files) and installs `npm:@tintinweb/pi-subagents`. Pick their models in the config file; with none, they use the lead's model. `max_turns` (optional) stops a subagent that loops after that many turns; the lead then resumes it once or asks you. A model the policy denies is refused, and a file you edited yourself (without orch's line in it) is left alone. Both agents' descriptions say they are only for orch runs, so a normal Pi chat does not hand its own work to them.
|
|
277
278
|
|
|
278
279
|
```json
|
|
279
280
|
{
|
|
280
281
|
"mode": "subagent",
|
|
281
282
|
"subagent": {
|
|
282
|
-
"coder": { "model": "anthropic/claude-sonnet-4-5", "thinking": "medium" },
|
|
283
|
+
"coder": { "model": "anthropic/claude-sonnet-4-5", "thinking": "medium", "max_turns": 80 },
|
|
283
284
|
"reviewer": { "model": "openai/gpt-5", "thinking": "high" }
|
|
284
285
|
}
|
|
285
286
|
}
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.7.0
|
package/agents.default.toml
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
#
|
|
4
4
|
# binary executable that must be on PATH for the kind to count as installed
|
|
5
5
|
# launch command to start it in a herdr pane, with its auto-approve-edits option
|
|
6
|
+
# review_launch optional: the command for the REVIEWER pane, with the tool's code-editing tools turned off (the
|
|
7
|
+
# reviewer only reads the change and writes its review file). `orch team up` uses it for the reviewer;
|
|
8
|
+
# `orch agents launch <kind> --role reviewer` prints it. Left out: the reviewer starts like a coder
|
|
6
9
|
# model_flag the launch option that picks the model (`orch agents launch <kind> --model <id>`); leave it
|
|
7
10
|
# out when the tool has none or it is unverified, and choose the model inside the tool
|
|
8
11
|
# herdr_detect herdr can tell idle / working / blocked for it (false: orch relies on the done file only)
|
|
@@ -32,6 +35,7 @@
|
|
|
32
35
|
[claude]
|
|
33
36
|
binary = "claude"
|
|
34
37
|
launch = "claude --permission-mode acceptEdits"
|
|
38
|
+
review_launch = "claude --permission-mode acceptEdits --disallowedTools Edit,NotebookEdit"
|
|
35
39
|
model_flag = "--model"
|
|
36
40
|
herdr_detect = true
|
|
37
41
|
interrupt_keys = ["esc"]
|
|
@@ -41,7 +45,7 @@ skills_one_wins = true
|
|
|
41
45
|
old_dirs = ["~/.claude/commands"]
|
|
42
46
|
invoke = "/orch-plan <feature>"
|
|
43
47
|
verified = true
|
|
44
|
-
notes = "Claude Code 2.1: --permission-mode acceptEdits in --help; ~/.claude/skills present; herdr kind 'claude'. A skill is also a slash command (/orch-plan) and its docs say a skill beats a ~/.claude/commands file of the same name, so no commands copy is installed."
|
|
48
|
+
notes = "Claude Code 2.1: --permission-mode acceptEdits in --help; ~/.claude/skills present; herdr kind 'claude'. A skill is also a slash command (/orch-plan) and its docs say a skill beats a ~/.claude/commands file of the same name, so no commands copy is installed. review_launch: --disallowedTools is in --help (2.1); the reviewer keeps Write for its review file."
|
|
45
49
|
|
|
46
50
|
[codex]
|
|
47
51
|
binary = "codex"
|
|
Binary file
|
package/bin/orch
CHANGED
|
@@ -734,6 +734,8 @@ def registry(required=True):
|
|
|
734
734
|
if uf.exists():
|
|
735
735
|
for kind, vals in tomllib.loads(uf.read_text()).items():
|
|
736
736
|
if isinstance(vals, dict):
|
|
737
|
+
if "launch" in vals and "review_launch" not in vals:
|
|
738
|
+
reg.get(kind, {}).pop("review_launch", None) # your own launch command wins for the reviewer too
|
|
737
739
|
reg.setdefault(kind, {}).update(vals)
|
|
738
740
|
except tomllib.TOMLDecodeError as e:
|
|
739
741
|
die(f"agent registry: {e}")
|
|
@@ -1252,6 +1254,52 @@ def cmd_sync(args):
|
|
|
1252
1254
|
if has_open_questions(by_id[tid]):
|
|
1253
1255
|
errors.append(f"{tid} has open questions — a quick run needs a clear change; answer them or use "
|
|
1254
1256
|
f"`Mode: full`")
|
|
1257
|
+
# hard to undo (`Door: one-way (why)`): always waits for the developer's `orch approve` before it lands
|
|
1258
|
+
doors = {}
|
|
1259
|
+
for tid in ids:
|
|
1260
|
+
dv = field(by_id[tid], "door")
|
|
1261
|
+
if not dv:
|
|
1262
|
+
continue
|
|
1263
|
+
kind_ = re.match(r"\s*(one|two)[\s-]*way", dv, re.I)
|
|
1264
|
+
if not kind_:
|
|
1265
|
+
warns.append(f"{tid}: `Door: {dv}` — write `Door: one-way (why it is hard to undo)`, or leave the line out "
|
|
1266
|
+
f"(easy to undo)")
|
|
1267
|
+
continue
|
|
1268
|
+
why_ = dv[kind_.end():].strip(" \t:-—–").strip()
|
|
1269
|
+
why_ = why_[1:-1].strip() if why_.startswith("(") and why_.endswith(")") else why_
|
|
1270
|
+
if kind_.group(1).lower() == "one":
|
|
1271
|
+
doors[tid] = why_
|
|
1272
|
+
if tid in enabled and not why_:
|
|
1273
|
+
warns.append(f"{tid} is `Door: one-way` without a reason — say why it is hard to undo, e.g. "
|
|
1274
|
+
f"`Door: one-way (rewrites the orders table, 2M rows)`")
|
|
1275
|
+
if tid in enabled and quick:
|
|
1276
|
+
errors.append(f"{tid} is `Door: one-way` (hard to undo) — a quick run never is; use `Mode: full`")
|
|
1277
|
+
if tid in enabled and not risk_hold:
|
|
1278
|
+
warns.append(f"{tid} is `Door: one-way`, but `Risk hold: off` lets it land without your `orch approve`")
|
|
1279
|
+
# the repo's own words: the plan should use them, and a new word or decision needs a milestone that writes it down
|
|
1280
|
+
dst = {"docs": (get("docs").split() or [None])[0]}
|
|
1281
|
+
drel = docs_root(dst)[1]
|
|
1282
|
+
secs_all, glob_all = plan_sections()
|
|
1283
|
+
gl = glossary(dst)
|
|
1284
|
+
for tid in [*enabled, None]:
|
|
1285
|
+
text = glob_all if tid is None else re.split(r"(?im)^notes from user:", secs_all.get(tid, ""))[0]
|
|
1286
|
+
hits = sorted({(a, g["term"]) for g in gl for a in g["avoid"] if word_in(a, text) and not word_in(g["term"], a)})
|
|
1287
|
+
for a, term in hits:
|
|
1288
|
+
warns.append(f"{tid or 'Global instructions'} says {a!r}, but {drel}/glossary.md says to use {term!r} "
|
|
1289
|
+
f"instead — use the project's word, or change the glossary on purpose")
|
|
1290
|
+
gloss_add = glossary_additions(plan_text)
|
|
1291
|
+
gpath = f"{drel}/glossary.md"
|
|
1292
|
+
if gloss_add and not any(path_allowed(gpath, files[tid]) for tid in enabled):
|
|
1293
|
+
warns.append(f"`## Glossary additions` lists {len(gloss_add)} new word(s), but no milestone has {gpath} in its "
|
|
1294
|
+
f"Likely files — give the milestone that brings the word an acceptance criterion like "
|
|
1295
|
+
f"\"{gpath} defines <word>\" and list the file")
|
|
1296
|
+
for tid in enabled:
|
|
1297
|
+
crit = " ".join(by_id[tid]["fields"].get("acceptance criteria", []))
|
|
1298
|
+
named = sorted(set(re.findall(re.escape(drel) + r"/(?:adr/[\w.\-]+\.md|glossary\.md|coding-standards\.md)", crit)))
|
|
1299
|
+
for pth in named:
|
|
1300
|
+
if not path_allowed(pth, files[tid]):
|
|
1301
|
+
warns.append(f"{tid}'s acceptance criteria name {pth}, which is not in its Likely files — add it, so "
|
|
1302
|
+
f"the coder may write it")
|
|
1255
1303
|
max_tasks = int(os.environ.get("ORCH_MAX_TASKS", "0") or 0) # no limit unless you set one
|
|
1256
1304
|
if max_tasks and len(enabled) > max_tasks:
|
|
1257
1305
|
warns.append(f"{len(enabled)} enabled milestones (> ORCH_MAX_TASKS={max_tasks}). Merge coupled milestones "
|
|
@@ -1293,6 +1341,8 @@ def cmd_sync(args):
|
|
|
1293
1341
|
"setup_inputs": [p.strip("`") for p in re.split(r"[,\s]+", get("setup inputs")) if p.strip("`")],
|
|
1294
1342
|
"scope": scope,
|
|
1295
1343
|
"risk_hold": risk_hold,
|
|
1344
|
+
"docs": (get("docs").split() or [None])[0], # where the repo keeps glossary.md, adr/, coding-standards.md
|
|
1345
|
+
"glossary_additions": gloss_add,
|
|
1296
1346
|
"parallel_checks": par_checks,
|
|
1297
1347
|
"early_review": early_review,
|
|
1298
1348
|
"branch_check": branch_check,
|
|
@@ -1363,6 +1413,8 @@ def cmd_sync(args):
|
|
|
1363
1413
|
"estimate_s": estimates[tid],
|
|
1364
1414
|
# for the developer (`orch plan show`): the milestone in plain words, and the plan's own reasons
|
|
1365
1415
|
"plain": field(t, "plain"), "why_sep": field(t, "why separate"), "deps_text": field(t, "depends on"),
|
|
1416
|
+
# hard to undo: always held for `orch approve`, with the coder's proof (None = easy to undo)
|
|
1417
|
+
"door": "one-way" if tid in doors else None, "door_why": doors.get(tid) or None,
|
|
1366
1418
|
}
|
|
1367
1419
|
if status != st["tasks"][tid]["status"]:
|
|
1368
1420
|
move(st, tid, status, {"skipped": "unticked in plan.md", "needs-answer": "open questions in plan.md"}
|
|
@@ -1659,12 +1711,14 @@ RESULT_FORMAT = {
|
|
|
1659
1711
|
"criteria": [{"id": "AC1", "met": True, "evidence": "test 'rejects a missing amount column' passes"}],
|
|
1660
1712
|
"questions": ["only when status is question: what you need decided, with 2-3 options"],
|
|
1661
1713
|
"usage": {"input_tokens": None, "output_tokens": None, "cost_usd": None},
|
|
1714
|
+
"proof": "only when task.md says the milestone is hard to undo: what you ran to show it is safe, and what it showed",
|
|
1662
1715
|
}
|
|
1663
1716
|
REVIEW_FORMAT = {
|
|
1664
1717
|
"verdict": "approve | changes",
|
|
1665
1718
|
"criteria": [{"id": "AC1", "met": True, "note": "covered by test_upload_rejects_missing_amount"}],
|
|
1666
|
-
"findings": [{"severity": "blocker | suggestion", "file": "src/upload.ts", "line": 42,
|
|
1667
|
-
"problem": "what is wrong", "why": "why it matters", "criterion": "AC1"
|
|
1719
|
+
"findings": [{"severity": "blocker | suggestion", "axis": "spec | rules", "file": "src/upload.ts", "line": 42,
|
|
1720
|
+
"problem": "what is wrong", "why": "why it matters", "criterion": "AC1",
|
|
1721
|
+
"rule": "only for axis rules: the written rule it breaks, e.g. ADR 0001: money is whole paise"}],
|
|
1668
1722
|
}
|
|
1669
1723
|
|
|
1670
1724
|
|
|
@@ -1698,6 +1752,77 @@ def read_usage(path):
|
|
|
1698
1752
|
return {k: v for k, v in u.items() if v is not None} or None if isinstance(u, dict) else None
|
|
1699
1753
|
|
|
1700
1754
|
|
|
1755
|
+
def finding_axis(f):
|
|
1756
|
+
"""Which of the reviewer's two questions a finding answers: "spec" (built what was asked?) or "rules" (follows
|
|
1757
|
+
the repo's written rules?); None for a review written before 6.6.0 that does not say."""
|
|
1758
|
+
a = str(f.get("axis") or "").strip().lower()
|
|
1759
|
+
return "rules" if a.startswith(("rule", "standard")) else "spec" if a.startswith("spec") else None
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
def review_axes(st):
|
|
1763
|
+
"""Every finding of every review round in this run, by question: {"spec": [...], "rules": [...]}, and
|
|
1764
|
+
{rule: count} for the rules findings. Rounds without an `axis` (older reviews, .md reviews) are left out."""
|
|
1765
|
+
by, rules = {"spec": [], "rules": []}, {}
|
|
1766
|
+
for tid, t in st["tasks"].items():
|
|
1767
|
+
for k in range(1, t.get("review_round", 0) + 1):
|
|
1768
|
+
d, _ = read_json(ORCH / "review" / tid / f"review-{k}.json")
|
|
1769
|
+
for f in (d or {}).get("findings", []) if isinstance(d, dict) and isinstance(d.get("findings"), list) else []:
|
|
1770
|
+
ax = finding_axis(f) if isinstance(f, dict) else None
|
|
1771
|
+
if not ax:
|
|
1772
|
+
continue
|
|
1773
|
+
sev = "blocker" if str(f.get("severity", "")).lower().startswith("block") else "suggestion"
|
|
1774
|
+
by[ax].append(f"- {tid} round {k}, {sev}: " + (f"[{f['rule']}] " if ax == "rules" and f.get("rule") else "")
|
|
1775
|
+
+ f"{f.get('file', '?')}:{f.get('line', '?')} — {f.get('problem', '')}")
|
|
1776
|
+
if ax == "rules":
|
|
1777
|
+
r = str(f.get("rule") or "(rule not named)").strip()
|
|
1778
|
+
rules[r] = rules.get(r, 0) + 1
|
|
1779
|
+
return by, rules
|
|
1780
|
+
|
|
1781
|
+
|
|
1782
|
+
def review_axes_section(st):
|
|
1783
|
+
"""The summary's review findings by question, or "" when no review said which question it answers."""
|
|
1784
|
+
by, rules = review_axes(st)
|
|
1785
|
+
if not (by["spec"] or by["rules"]):
|
|
1786
|
+
return ""
|
|
1787
|
+
return ("## Review findings: spec and rules\nEvery finding of every review round (fixed or not), by the question it "
|
|
1788
|
+
"answers. Spec: did it build what was asked? Rules: does it follow the repo's written rules?\n\n"
|
|
1789
|
+
f"Spec ({len(by['spec'])}):\n" + ("\n".join(by["spec"]) or "none") + "\n\n"
|
|
1790
|
+
f"Rules ({len(by['rules'])}):\n" + ("\n".join(by["rules"]) or "none") + "\n\n"
|
|
1791
|
+
+ ("Rules broken most often: " + "; ".join(f"{r} ({n}x)" for r, n in
|
|
1792
|
+
sorted(rules.items(), key=lambda x: (-x[1], x[0]))[:10]) + "\n\n"
|
|
1793
|
+
if rules else ""))
|
|
1794
|
+
|
|
1795
|
+
|
|
1796
|
+
def risk_rows(st):
|
|
1797
|
+
"""One row per landed milestone: (Mn and title, easy|hard to undo and why, could break, proof)."""
|
|
1798
|
+
rows = []
|
|
1799
|
+
for tid in st["order"]:
|
|
1800
|
+
t = st["tasks"][tid]
|
|
1801
|
+
if t.get("status") != "merged" or not (t.get("blast") or t.get("door")):
|
|
1802
|
+
continue
|
|
1803
|
+
b = t.get("blast") or {}
|
|
1804
|
+
hard = t.get("door") == "one-way"
|
|
1805
|
+
rows.append((f"{tid} {t['title']}", ("**hard**" + (f": {t['door_why']}" if t.get("door_why") else "")) if hard
|
|
1806
|
+
else "easy", (f"{b['level']}: " + "; ".join(b.get("why", []))) if b else "-",
|
|
1807
|
+
(t.get("proof") or "none given") if hard else "-"))
|
|
1808
|
+
# only worth a table when something in it is hard to undo or could break more than a little
|
|
1809
|
+
keep = any(st["tasks"][tid].get("door") == "one-way" or (st["tasks"][tid].get("blast") or {}).get("level") != "small"
|
|
1810
|
+
for tid in st["order"] if st["tasks"][tid].get("status") == "merged" and st["tasks"][tid].get("blast"))
|
|
1811
|
+
return rows if keep else []
|
|
1812
|
+
|
|
1813
|
+
|
|
1814
|
+
def risk_section(st):
|
|
1815
|
+
"""The summary's (and so the PR's) table: what is hard to undo and how much each milestone could break."""
|
|
1816
|
+
rows = risk_rows(st)
|
|
1817
|
+
if not rows:
|
|
1818
|
+
return ""
|
|
1819
|
+
esc = lambda x: str(x).replace("|", "\\|").replace("\n", " ")
|
|
1820
|
+
return ("## Undo and blast radius\nWhere to look hardest before you merge. Hard to undo = the plan says it can't "
|
|
1821
|
+
"simply be reverted (it waited for your `orch approve`). Could break = measured from the change: risky "
|
|
1822
|
+
"files, how many milestones build on it, its size.\n\n| Milestone | Undo | Could break | Proof |\n"
|
|
1823
|
+
"|---|---|---|---|\n" + "\n".join("| " + " | ".join(esc(c) for c in r) + " |" for r in rows) + "\n\n")
|
|
1824
|
+
|
|
1825
|
+
|
|
1701
1826
|
def review_findings(tid, k):
|
|
1702
1827
|
"""(blockers, suggestions, known) for review round k: review-k.json, else the BLOCKER:/SUGGESTION: lines of
|
|
1703
1828
|
review-k.md. known=False when neither is usable."""
|
|
@@ -1709,6 +1834,9 @@ def review_findings(tid, k):
|
|
|
1709
1834
|
if not isinstance(f, dict):
|
|
1710
1835
|
continue
|
|
1711
1836
|
line = f"{f.get('file', '?')}:{f.get('line', '?')} — {f.get('problem', '')} — {f.get('why', '')}"
|
|
1837
|
+
ax = finding_axis(f)
|
|
1838
|
+
if ax:
|
|
1839
|
+
line = (f"[rules: {f['rule']}] " if ax == "rules" and f.get("rule") else f"[{ax}] ") + line
|
|
1712
1840
|
if f.get("criterion"):
|
|
1713
1841
|
line += f" ({f['criterion']})"
|
|
1714
1842
|
(blockers if str(f.get("severity", "")).lower().startswith("block") else sugg).append(line)
|
|
@@ -1817,13 +1945,68 @@ def changed_files(st, t):
|
|
|
1817
1945
|
return sorted((vs_base & vs_tip) | untracked)
|
|
1818
1946
|
|
|
1819
1947
|
|
|
1948
|
+
def dependents_of(st, tid):
|
|
1949
|
+
"""Milestones that build on Mn, directly or through another milestone (skipped ones left out)."""
|
|
1950
|
+
out, todo = set(), [tid]
|
|
1951
|
+
while todo:
|
|
1952
|
+
cur = todo.pop()
|
|
1953
|
+
for k, v in st["tasks"].items():
|
|
1954
|
+
if cur in v.get("deps", []) and k not in out and v.get("status") != "skipped":
|
|
1955
|
+
out.add(k)
|
|
1956
|
+
todo.append(k)
|
|
1957
|
+
return sorted(out, key=lambda k: st["order"].index(k) if k in st.get("order", []) else 0)
|
|
1958
|
+
|
|
1959
|
+
|
|
1960
|
+
def blast_radius(st, tid, diff_args, cwd):
|
|
1961
|
+
"""How much could break if Mn is wrong, measured (no AI) from its real change and the plan: small, medium or
|
|
1962
|
+
large, with the reasons in plain words. Saved on the task for the hold message, the summary and the PR."""
|
|
1963
|
+
names = git("diff", "--name-status", "--no-renames", *diff_args, cwd=cwd, check=False).stdout.splitlines()
|
|
1964
|
+
files, deleted, risky = [], [], []
|
|
1965
|
+
for line in names:
|
|
1966
|
+
parts = line.split("\t")
|
|
1967
|
+
if len(parts) < 2:
|
|
1968
|
+
continue
|
|
1969
|
+
files.append(parts[-1])
|
|
1970
|
+
if parts[0].startswith("D"):
|
|
1971
|
+
deleted.append(parts[-1])
|
|
1972
|
+
risky += [what for rx, what in RISK_RULES if rx.search(parts[-1])]
|
|
1973
|
+
if LOCKFILE_RE.search(parts[-1]):
|
|
1974
|
+
risky.append("dependency change")
|
|
1975
|
+
lines = 0
|
|
1976
|
+
for line in git("diff", "--numstat", *diff_args, cwd=cwd, check=False).stdout.splitlines():
|
|
1977
|
+
a, b = (line.split("\t") + ["0", "0"])[:2]
|
|
1978
|
+
lines += (int(a) if a.isdigit() else 0) + (int(b) if b.isdigit() else 0)
|
|
1979
|
+
hot = sorted({f for f in files if HOTSPOT_RE.search(f)})
|
|
1980
|
+
deps = dependents_of(st, tid)
|
|
1981
|
+
big, mid = [], []
|
|
1982
|
+
if risky:
|
|
1983
|
+
big.append(", ".join(sorted(set(risky))))
|
|
1984
|
+
if len(deps) >= 2:
|
|
1985
|
+
big.append(f"{len(deps)} milestones build on it ({', '.join(deps)})")
|
|
1986
|
+
elif deps:
|
|
1987
|
+
mid.append(f"{deps[0]} builds on it")
|
|
1988
|
+
if lines > 500:
|
|
1989
|
+
big.append(f"{lines} lines changed")
|
|
1990
|
+
elif lines > 100:
|
|
1991
|
+
mid.append(f"{lines} lines changed")
|
|
1992
|
+
if deleted:
|
|
1993
|
+
mid.append(f"deletes {len(deleted)} file(s)")
|
|
1994
|
+
if hot:
|
|
1995
|
+
mid.append("touches shared files: " + ", ".join(hot[:3]) + (" …" if len(hot) > 3 else ""))
|
|
1996
|
+
if len(files) > 10:
|
|
1997
|
+
mid.append(f"{len(files)} files changed")
|
|
1998
|
+
level = "large" if big else "medium" if mid else "small"
|
|
1999
|
+
why = big + mid or [f"{len(files)} file(s), {lines} lines, nothing else builds on it"]
|
|
2000
|
+
return {"level": level, "why": why, "files": len(files), "lines": lines}
|
|
2001
|
+
|
|
2002
|
+
|
|
1820
2003
|
def risk_flags(st, tid, diff_args, cwd):
|
|
1821
2004
|
"""Deterministic reasons to hold a milestone for the developer's approval before it lands."""
|
|
1822
2005
|
if not st.get("risk_hold", True):
|
|
1823
2006
|
return []
|
|
1824
2007
|
t = st["tasks"][tid]
|
|
1825
2008
|
likely = t.get("files") or []
|
|
1826
|
-
out = []
|
|
2009
|
+
out = [f"hard to undo: {t.get('door_why') or 'the plan says Door: one-way'}"] if t.get("door") == "one-way" else []
|
|
1827
2010
|
for line in git("diff", "--name-status", "--no-renames", *diff_args, cwd=cwd, check=False).stdout.splitlines():
|
|
1828
2011
|
parts = line.split("\t")
|
|
1829
2012
|
if len(parts) < 2:
|
|
@@ -2435,12 +2618,32 @@ def cmd_review(args):
|
|
|
2435
2618
|
+ ". Report each as `met: false` with a note; it is not a blocker. Don't raise a blocker for the "
|
|
2436
2619
|
"missing deferred part. Do review everything that WAS built, including partial work on it.\n\n"
|
|
2437
2620
|
) if dfr else ""
|
|
2621
|
+
try:
|
|
2622
|
+
rules = project_rules(st, plan_sections()[0].get(tid, ""))
|
|
2623
|
+
except OSError:
|
|
2624
|
+
rules = project_rules(st, "")
|
|
2625
|
+
rules_txt = "\n".join(project_rules_lines(st, rules))
|
|
2626
|
+
scope = t.get("out_of_scope") or []
|
|
2438
2627
|
(rd / f"review-task-{k}.md").write_text(
|
|
2439
2628
|
f"# Review {tid}: {t['title']} (round {k})\n\n"
|
|
2440
2629
|
f"Spec and acceptance criteria: {rel}/task.md (criteria ids AC1, AC2… in {rel}/task.json)\n"
|
|
2441
|
-
f"Changes: {rel}/diff.patch\n\n" + resolution.replace("{rel}", rel) + deferred_txt
|
|
2442
|
-
|
|
2443
|
-
"
|
|
2630
|
+
f"Changes: {rel}/diff.patch\n\n" + resolution.replace("{rel}", rel) + deferred_txt
|
|
2631
|
+
+ (rules_txt + "\n" if rules_txt else "") +
|
|
2632
|
+
"Answer two questions, separately, and give every finding the `axis` of the one it answers:\n"
|
|
2633
|
+
"1. `spec`: did it build what the task asks, no more and no less? Every acceptance criterion met, nothing "
|
|
2634
|
+
"missing, no behaviour the task did not ask for. Correctness, API/contract consistency, UI/UX, security, "
|
|
2635
|
+
"edge cases and missing tests belong here."
|
|
2636
|
+
+ (f" orch saw changes outside the milestone's Likely files: {', '.join(scope)}. Say whether each one was "
|
|
2637
|
+
"needed." if scope else "") + "\n"
|
|
2638
|
+
"2. `rules`: does it follow the project's own written rules: "
|
|
2639
|
+
+ (f"{rules['standards']}" if rules["standards"] else "AGENTS.md / CLAUDE.md when the repo has them")
|
|
2640
|
+
+ (", the decisions listed above" if rules["adrs"] else "")
|
|
2641
|
+
+ (", the words listed above" if rules["glossary"] else "") +
|
|
2642
|
+
"? A `rules` finding names the rule it breaks in `rule`. Only written rules count: a matter of taste is at "
|
|
2643
|
+
"most a suggestion.\n"
|
|
2644
|
+
f"The check command (`{st['check']}`) runs on this work by itself: don't report what lint, type checks or "
|
|
2645
|
+
"tests already catch.\n"
|
|
2646
|
+
"Do NOT edit any code.\n"
|
|
2444
2647
|
"Report PROBLEMS, not solutions: the coder decides how to fix. At most 15 findings. A `blocker` must be "
|
|
2445
2648
|
"fixed before merge; a `suggestion` is optional. Say for EVERY acceptance criterion whether it is met; an "
|
|
2446
2649
|
"unmet criterion counts as a blocker.\n"
|
|
@@ -2676,6 +2879,7 @@ def cmd_commit(args):
|
|
|
2676
2879
|
d = task_dir(t, tid)
|
|
2677
2880
|
if st["isolation"] == "shared":
|
|
2678
2881
|
git("add", "-A", cwd=d)
|
|
2882
|
+
t["blast"] = blast_radius(st, tid, ["--cached", "HEAD"], d)
|
|
2679
2883
|
risks = [] if t.get("approved") else risk_flags(st, tid, ["--cached", "HEAD"], d)
|
|
2680
2884
|
if risks:
|
|
2681
2885
|
git("reset", "-q", cwd=d) # unstage; the work stays in the tree until approved
|
|
@@ -2770,8 +2974,9 @@ def _merge_start(tid):
|
|
|
2770
2974
|
die(f"main tree must be clean and on {st['branch']}")
|
|
2771
2975
|
src = work_ref(st, tid) or die(f"{tid} has no saved work ({task_ref(st, tid)}) — run `orch commit {tid}` first")
|
|
2772
2976
|
src_sha = git("rev-parse", src, cwd=ROOT).stdout.strip()
|
|
2977
|
+
mb = git("merge-base", st["branch"], src_sha, cwd=ROOT).stdout.strip()
|
|
2978
|
+
t["blast"] = blast_radius(st, tid, [mb, src_sha], ROOT)
|
|
2773
2979
|
if not t.get("approved"):
|
|
2774
|
-
mb = git("merge-base", st["branch"], src_sha, cwd=ROOT).stdout.strip()
|
|
2775
2980
|
risks = risk_flags(st, tid, [mb, src_sha], ROOT)
|
|
2776
2981
|
if risks:
|
|
2777
2982
|
_hold(st, tid, risks)
|
|
@@ -2827,10 +3032,18 @@ def _hold(st, tid, risks):
|
|
|
2827
3032
|
if st["isolation"] == "worktree" and holds(st, tid): # its work is saved in the hidden ref: free the coder
|
|
2828
3033
|
st["workers"][t["worker"]]["task"] = None
|
|
2829
3034
|
t["last_worker"], t["worker"] = t["worker"], None
|
|
3035
|
+
b = t.get("blast") or {}
|
|
3036
|
+
proof = ((t.get("proof") or ("the coder's PROOF: line, in the lead's chat" if run_mode(st) == "subagent"
|
|
3037
|
+
else "none given by the coder")) if t.get("door") == "one-way" else None)
|
|
2830
3038
|
move(st, tid, "held", "waiting for `orch approve " + tid + "`: " + "; ".join(risks[:3])
|
|
2831
|
-
+ (f" (+{len(risks) - 3} more)" if len(risks) > 3 else "")
|
|
3039
|
+
+ (f" (+{len(risks) - 3} more)" if len(risks) > 3 else "")
|
|
3040
|
+
+ (f" · could break: {b['level']}" if b else "") + (f" · proof: {proof[:200]}" if proof else ""))
|
|
2832
3041
|
save(st)
|
|
2833
3042
|
print(f"HELD {tid} for approval — " + "; ".join(risks))
|
|
3043
|
+
if b:
|
|
3044
|
+
print(f"Could break: {b['level']} ({'; '.join(b['why'])})")
|
|
3045
|
+
if proof:
|
|
3046
|
+
print(f"Proof from the coder: {proof}")
|
|
2834
3047
|
print(f"Look at it, then run `orch approve {tid}` (or `orch set {tid} paused` to stop it)")
|
|
2835
3048
|
sys.exit(7)
|
|
2836
3049
|
|
|
@@ -3470,6 +3683,110 @@ def plan_sections():
|
|
|
3470
3683
|
return secs, glob
|
|
3471
3684
|
|
|
3472
3685
|
|
|
3686
|
+
# ---------------------------------------------------------------- the repo's own rules: words, decisions, coding rules
|
|
3687
|
+
# Optional files in the repo (plan header `Docs: <folder>`, default docs/): glossary.md, adr/*.md, coding-standards.md.
|
|
3688
|
+
# A repo without them gets nothing new. Nothing here is AI: orch reads the files and matches words.
|
|
3689
|
+
GLOSS_BOLD_RE = re.compile(r"^\s*(?:[-*+]\s+|\d+[.)]\s+)?\*\*([^*]+?)\*\*\s*(?:[:—–-]\s*)?(.*)$")
|
|
3690
|
+
GLOSS_HEAD_RE = re.compile(r"^#{2,4}\s+(.+?)\s*#*\s*$")
|
|
3691
|
+
AVOID_RE = re.compile(r"\bavoid\s*:\s*([^.\n;]+)", re.I)
|
|
3692
|
+
|
|
3693
|
+
|
|
3694
|
+
def glossary_additions(plan_text):
|
|
3695
|
+
"""The `- **Word**: meaning` lines under the plan's `## Glossary additions`: new words this feature brings."""
|
|
3696
|
+
m = re.search(r"(?ims)^##\s+glossary additions\s*$(.*?)(?=^##\s|\Z)", plan_text or "")
|
|
3697
|
+
items = [re.sub(r"^[-*+]\s+", "", l.strip()).strip() for l in (m.group(1).splitlines() if m else [])]
|
|
3698
|
+
return [i for i in items if i and i.lower().strip("<>\"") != "none"]
|
|
3699
|
+
|
|
3700
|
+
|
|
3701
|
+
def docs_root(st=None):
|
|
3702
|
+
"""(absolute folder, folder as written) of the repo's rules files: plan header `Docs:`, default `docs`."""
|
|
3703
|
+
rel = str((st or {}).get("docs") or "docs").strip().strip("`").strip("/") or "docs"
|
|
3704
|
+
return ROOT / rel, rel
|
|
3705
|
+
|
|
3706
|
+
|
|
3707
|
+
def word_in(word, text):
|
|
3708
|
+
"""`word` (or its plural) appears in `text` as a whole word, any case."""
|
|
3709
|
+
word = (word or "").strip()
|
|
3710
|
+
return bool(word) and bool(re.search(r"(?<![\w-])" + re.escape(word) + r"(?:e?s)?(?![\w-])", text or "", re.I))
|
|
3711
|
+
|
|
3712
|
+
|
|
3713
|
+
def glossary(st=None):
|
|
3714
|
+
"""docs/glossary.md -> [{"term", "text", "avoid": [words]}]. An entry is a bold word at the start of a line
|
|
3715
|
+
(`- **Discount**: money taken off an order total, in paise. Avoid: coupon, promo`); a glossary with no bold
|
|
3716
|
+
entries uses its `##` / `###` headings as the words, with the text under each one."""
|
|
3717
|
+
p = docs_root(st)[0] / "glossary.md"
|
|
3718
|
+
try:
|
|
3719
|
+
lines = p.read_text(errors="replace").splitlines() if p.is_file() else []
|
|
3720
|
+
except OSError:
|
|
3721
|
+
lines = []
|
|
3722
|
+
bold = any(GLOSS_BOLD_RE.match(l) for l in lines)
|
|
3723
|
+
out, cur = [], None
|
|
3724
|
+
for line in lines:
|
|
3725
|
+
m = GLOSS_BOLD_RE.match(line) if bold else None
|
|
3726
|
+
h = GLOSS_HEAD_RE.match(line)
|
|
3727
|
+
if m:
|
|
3728
|
+
cur = {"term": m.group(1).strip().rstrip(":").strip(), "text": m.group(2).strip()}
|
|
3729
|
+
out.append(cur)
|
|
3730
|
+
elif h:
|
|
3731
|
+
cur = {"term": h.group(1).strip().rstrip(":").strip(), "text": ""} if not bold else None
|
|
3732
|
+
if cur:
|
|
3733
|
+
out.append(cur)
|
|
3734
|
+
elif cur is not None and line.strip() and (not bold or line[:1] in (" ", "\t")):
|
|
3735
|
+
cur["text"] = (cur["text"] + " " + line.strip()).strip()
|
|
3736
|
+
elif bold and not line.strip():
|
|
3737
|
+
cur = None
|
|
3738
|
+
for g in out:
|
|
3739
|
+
g["avoid"] = [w for m in AVOID_RE.findall(g["text"])
|
|
3740
|
+
for w in (x.strip(" \t`'\"*") for x in re.split(r",|/|\bor\b", m)) if w]
|
|
3741
|
+
return [g for g in out if g["term"]]
|
|
3742
|
+
|
|
3743
|
+
|
|
3744
|
+
def adrs(st=None):
|
|
3745
|
+
"""docs/adr/*.md -> [(path as the repo writes it, title)]: the decisions already made, one line each."""
|
|
3746
|
+
root, rel = docs_root(st)
|
|
3747
|
+
out = []
|
|
3748
|
+
d = root / "adr"
|
|
3749
|
+
for p in sorted(d.glob("*.md")) if d.is_dir() else []:
|
|
3750
|
+
if p.name.lower() in ("readme.md", "template.md", "index.md") or "template" in p.stem.lower():
|
|
3751
|
+
continue
|
|
3752
|
+
try:
|
|
3753
|
+
title = next((l[2:].strip() for l in p.read_text(errors="replace").splitlines() if l.startswith("# ")), "")
|
|
3754
|
+
except OSError:
|
|
3755
|
+
title = ""
|
|
3756
|
+
out.append((f"{rel}/adr/{p.name}", title or p.stem))
|
|
3757
|
+
return out
|
|
3758
|
+
|
|
3759
|
+
|
|
3760
|
+
def standards_file(st=None):
|
|
3761
|
+
root, rel = docs_root(st)
|
|
3762
|
+
return f"{rel}/coding-standards.md" if (root / "coding-standards.md").is_file() else None
|
|
3763
|
+
|
|
3764
|
+
|
|
3765
|
+
def project_rules(st, text):
|
|
3766
|
+
"""The repo's rules for one milestone: the glossary words that appear in its text (or a word the glossary says to
|
|
3767
|
+
avoid), every decision record's title, and the coding rules file. Empty lists / None when the repo has none."""
|
|
3768
|
+
words = [g for g in glossary(st) if word_in(g["term"], text) or any(word_in(a, text) for a in g["avoid"])]
|
|
3769
|
+
return {"glossary": words, "adrs": adrs(st), "standards": standards_file(st)}
|
|
3770
|
+
|
|
3771
|
+
|
|
3772
|
+
def project_rules_lines(st, rules):
|
|
3773
|
+
"""The `## Project rules` block of a coder's task file and of a review task, or [] when the repo has no rules."""
|
|
3774
|
+
if not (rules["glossary"] or rules["adrs"] or rules["standards"]):
|
|
3775
|
+
return []
|
|
3776
|
+
rel = docs_root(st)[1]
|
|
3777
|
+
out = ["## Project rules", "This repo's own words, decisions and coding rules. Follow them: the review checks them."]
|
|
3778
|
+
if rules["glossary"]:
|
|
3779
|
+
out.append(f"Words (from {rel}/glossary.md): use these names exactly, in code, UI text and messages.")
|
|
3780
|
+
out += [f"- **{g['term']}**" + (f": {g['text'][:300]}" if g["text"] else "") for g in rules["glossary"]]
|
|
3781
|
+
if rules["adrs"]:
|
|
3782
|
+
out.append(f"Decisions already made ({rel}/adr/): read the one your change touches; don't go against one "
|
|
3783
|
+
f"without asking (status `question`).")
|
|
3784
|
+
out += [f"- {p}: {title}" for p, title in rules["adrs"]]
|
|
3785
|
+
if rules["standards"]:
|
|
3786
|
+
out.append(f"Coding rules: {rules['standards']}")
|
|
3787
|
+
return out + [""]
|
|
3788
|
+
|
|
3789
|
+
|
|
3473
3790
|
WORKER_RULES = """## Rules for you (the coder)
|
|
3474
3791
|
- You own the HOW: the approach, the design inside this milestone, the code, the tests and every fix. This file says what and why; it deliberately doesn't say how.
|
|
3475
3792
|
- Follow the repo's existing patterns (AGENTS.md / CLAUDE.md) and any Interfaces listed above exactly; other milestones rely on them.
|
|
@@ -3485,7 +3802,7 @@ WORKER_RULES = """## Rules for you (the coder)
|
|
|
3485
3802
|
|
|
3486
3803
|
|
|
3487
3804
|
# plan.md lines that are for the lead and orch, not the coder: they stay in plan.md and task.json
|
|
3488
|
-
LEAD_ONLY_FIELDS = {"depends on", "why separate", "prefer", "tier", "needs", "model why", "estimate", "role",
|
|
3805
|
+
LEAD_ONLY_FIELDS = {"depends on", "why separate", "prefer", "tier", "needs", "model why", "estimate", "role", "door",
|
|
3489
3806
|
"review", "parallel", "plain"}
|
|
3490
3807
|
|
|
3491
3808
|
|
|
@@ -3527,6 +3844,20 @@ def cmd_write_task(args):
|
|
|
3527
3844
|
drop_criteria=bool(contract["acceptance_criteria"])), ""]
|
|
3528
3845
|
if glob and glob.lower() not in ("none", "<empty — user may fill in>"):
|
|
3529
3846
|
parts += ["## Global instructions", glob, ""]
|
|
3847
|
+
rules = project_rules(st, secs[tid] + "\n" + (glob or ""))
|
|
3848
|
+
parts += project_rules_lines(st, rules)
|
|
3849
|
+
if t.get("door") == "one-way":
|
|
3850
|
+
parts += ["## Hard to undo: show proof",
|
|
3851
|
+
"This milestone is hard to undo once it runs" + (f" ({t['door_why']})" if t.get("door_why") else "")
|
|
3852
|
+
+ ". The check is not enough: the developer approves it before it lands, and decides from your "
|
|
3853
|
+
"proof. Run something that shows it is safe, and put what you ran and what it showed in `proof` in "
|
|
3854
|
+
"your result file, and on a last report line `PROOF: <the same, short>`. For example: the migration "
|
|
3855
|
+
"run on a copy of the data (rows, time, no lock), a rollback test, the exact request the new API "
|
|
3856
|
+
"answers, a screenshot path.", ""]
|
|
3857
|
+
contract["door"] = {"kind": "one-way", "why": t.get("door_why")}
|
|
3858
|
+
if rules["glossary"] or rules["adrs"] or rules["standards"]:
|
|
3859
|
+
contract["project_rules"] = {"glossary": [g["term"] for g in rules["glossary"]],
|
|
3860
|
+
"decisions": [p for p, _ in rules["adrs"]], "coding_rules": rules["standards"]}
|
|
3530
3861
|
ctx = []
|
|
3531
3862
|
for dep in t["deps"]:
|
|
3532
3863
|
dd = st["tasks"][dep].get("dir")
|
|
@@ -4063,6 +4394,9 @@ def cmd_plan(args):
|
|
|
4063
4394
|
bits.append(f"about {_short_dur(t['estimate_s'])}")
|
|
4064
4395
|
bits.append(f"reviewed by {st['reviewer']}" if t.get("review") and st.get("reviewer") else "no review")
|
|
4065
4396
|
print(" " + " · ".join(bits))
|
|
4397
|
+
if t.get("door") == "one-way":
|
|
4398
|
+
print(" Hard to undo" + (f": {t['door_why']}" if t.get("door_why") else "") + ". It waits for your OK "
|
|
4399
|
+
f"(`orch approve {tid}`) before it lands, with the coder's proof that it is safe.")
|
|
4066
4400
|
if t["status"] != "pending":
|
|
4067
4401
|
now_ = {"merged": "done, on the branch", "coding": "being built", "verifying": "being checked",
|
|
4068
4402
|
"awaiting-review": "waiting for the reviewer", "reviewing": "being reviewed",
|
|
@@ -4076,6 +4410,10 @@ def cmd_plan(args):
|
|
|
4076
4410
|
for i, g in enumerate(steps, 1):
|
|
4077
4411
|
print(f" {i}. {' and '.join(g)}" + (" at the same time" if len(g) > 1 else "")
|
|
4078
4412
|
+ ("" if i == 1 else f" (after {' and '.join(steps[i - 2])})"))
|
|
4413
|
+
if st.get("glossary_additions"):
|
|
4414
|
+
print(f"\nNew words this feature adds to {docs_root(st)[1]}/glossary.md:")
|
|
4415
|
+
for g in st["glossary_additions"]:
|
|
4416
|
+
print(f" - {g}")
|
|
4079
4417
|
if missing:
|
|
4080
4418
|
print(f"\nWARN no `Plain:` line for {', '.join(missing)}: add one sentence in plain words to each "
|
|
4081
4419
|
f"(what the developer will get, no code words), then `orch sync`.")
|
|
@@ -4593,7 +4931,9 @@ def _autopilot(args):
|
|
|
4593
4931
|
write_and_send(tid, f"{fname_prefix}-{n}.md", body(n))
|
|
4594
4932
|
|
|
4595
4933
|
def held(tid, out):
|
|
4934
|
+
extra = [l.strip() for l in out.splitlines() if l.startswith(("Could break:", "Proof from the coder:"))]
|
|
4596
4935
|
say(f"{tid} is HELD for your approval: {out.splitlines()[0].split('—', 1)[-1].strip()}. "
|
|
4936
|
+
+ "".join(f"{l}. " for l in extra) +
|
|
4597
4937
|
f"Look at it, then run `orch approve {tid}`; autopilot keeps going with the rest", True)
|
|
4598
4938
|
|
|
4599
4939
|
# ---- background jobs: a check or a merge runs beside the event loop, and its end is one more event (like a
|
|
@@ -4909,6 +5249,11 @@ def _autopilot(args):
|
|
|
4909
5249
|
if q:
|
|
4910
5250
|
park(tid, "paused", q[0].strip()[9:].strip() or "worker asked a question")
|
|
4911
5251
|
return False
|
|
5252
|
+
# proof that a hard-to-undo milestone is safe: the result's `proof`, else the report's PROOF: line
|
|
5253
|
+
pf = (str(res.get("proof") or "").strip() if res else "") or next(
|
|
5254
|
+
(l.split(":", 1)[1].strip() for l in rtext.splitlines() if l.strip().upper().startswith("PROOF:")), "")
|
|
5255
|
+
if pf:
|
|
5256
|
+
patch_state(lambda s2: s2["tasks"][tid].update(proof=pf[:500]))
|
|
4912
5257
|
# scope: the real diff against the milestone's Likely files
|
|
4913
5258
|
s_ = load()
|
|
4914
5259
|
allowed = s_["tasks"][tid].get("files") or []
|
|
@@ -5319,6 +5664,7 @@ def _autopilot(args):
|
|
|
5319
5664
|
f"\n\n## Commits\n```\n{log_}```\n\n## Files changed\n```\n{stat}```\n\n"
|
|
5320
5665
|
"## Changed outside Likely files\n" + ("\n".join(scope) or "none") + "\n\n"
|
|
5321
5666
|
"## Reviewer suggestions not applied\n" + ("\n".join(sugg) or "none") + "\n\n"
|
|
5667
|
+
+ review_axes_section(st) + risk_section(st)
|
|
5322
5668
|
+ ("## Deferred: not done, follow-ups\nThe developer approved leaving these out of this run. They were "
|
|
5323
5669
|
"NOT built.\n" + "\n".join(deferred_lines(st)) + "\n\n" if deferred_lines(st) else "")
|
|
5324
5670
|
+ ("## Models: planned and actual\n| Milestone | Planned tier | Ran on | Escalated | Why this tier |\n"
|
|
@@ -5391,6 +5737,7 @@ def _autopilot(args):
|
|
|
5391
5737
|
continue
|
|
5392
5738
|
waiting_since = None
|
|
5393
5739
|
if not active and not ready:
|
|
5740
|
+
bg_reap() # a background merge that just ended (held, failed) says so before we stop
|
|
5394
5741
|
waiting = [f" {k} {v['status']}: {v.get('reason') or ''}" for k, v in tasks.items()
|
|
5395
5742
|
if v["status"] in ("paused", "failed", "needs-answer", "pending", "held")]
|
|
5396
5743
|
say("STOPPED — needs you:\n" + "\n".join(waiting) +
|
|
@@ -5736,8 +6083,13 @@ def cmd_report(args):
|
|
|
5736
6083
|
rate and wasted work for this run."""
|
|
5737
6084
|
st = load()
|
|
5738
6085
|
rep_ = run_report(st)
|
|
6086
|
+
by_axis, rules_broken = review_axes(st)
|
|
5739
6087
|
if "--json" in args:
|
|
5740
6088
|
rep_["time"] = time_account(st)
|
|
6089
|
+
rep_["review_axes"] = {"spec": len(by_axis["spec"]), "rules": len(by_axis["rules"]), "rules_broken": rules_broken}
|
|
6090
|
+
rep_["risk"] = [{"task": k, "door": v.get("door") or "two-way", "door_why": v.get("door_why"),
|
|
6091
|
+
"blast": v.get("blast"), "proof": v.get("proof")}
|
|
6092
|
+
for k, v in st["tasks"].items() if v.get("blast") or v.get("door")]
|
|
5741
6093
|
print(json.dumps(rep_, indent=2))
|
|
5742
6094
|
return
|
|
5743
6095
|
if "--no-time" not in args:
|
|
@@ -5767,12 +6119,26 @@ def cmd_report(args):
|
|
|
5767
6119
|
f"{tot['output_tokens']} output tokens, ${tot['cost_usd']:.2f}")
|
|
5768
6120
|
else:
|
|
5769
6121
|
print("tokens/cost: unknown (no agent reported `usage` in its result file)")
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
6122
|
+
if "--no-time" in args: # the summary (its only caller) has its own sections for the lines below
|
|
6123
|
+
return
|
|
6124
|
+
rows = risk_rows(st)
|
|
6125
|
+
if rows:
|
|
6126
|
+
print("\nundo and blast radius (where to look hardest before you merge):")
|
|
6127
|
+
for r in rows:
|
|
6128
|
+
print(f" {r[0]} — undo: {r[1].replace('**', '')} — could break: {r[2]}"
|
|
6129
|
+
+ (f" — proof: {r[3]}" if r[3] != "-" else ""))
|
|
6130
|
+
if by_axis["spec"] or by_axis["rules"]:
|
|
6131
|
+
print(f"review findings: {len(by_axis['spec'])} spec (built what was asked?), {len(by_axis['rules'])} rules "
|
|
6132
|
+
f"(followed the repo's rules?)")
|
|
6133
|
+
for r, n in sorted(rules_broken.items(), key=lambda x: (-x[1], x[0])):
|
|
6134
|
+
print(f" rule broken {n}x: {r}")
|
|
6135
|
+
|
|
6136
|
+
|
|
6137
|
+
def launch_cmd(kind, v, model=None, strict=True, role=None):
|
|
5773
6138
|
"""The shell command that starts agent `kind` in a pane, on `model` when given. With strict=False a kind
|
|
5774
|
-
without a model_flag starts on its default model instead of failing (the caller says so).""
|
|
5775
|
-
|
|
6139
|
+
without a model_flag starts on its default model instead of failing (the caller says so). role="reviewer"
|
|
6140
|
+
uses the kind's `review_launch` when it has one: the same tool with its code-editing tools turned off."""
|
|
6141
|
+
cmd = (v.get("review_launch") if role == "reviewer" else None) or v.get("launch") or v.get("binary", kind)
|
|
5776
6142
|
if model:
|
|
5777
6143
|
cat = models_catalog()
|
|
5778
6144
|
why = model_denied(cat, model)
|
|
@@ -5939,7 +6305,7 @@ def team_up(args):
|
|
|
5939
6305
|
print(f"SKIP {name}: kind {kind!r} is not in the agent registry — start it yourself in {d}")
|
|
5940
6306
|
failed += 1
|
|
5941
6307
|
continue
|
|
5942
|
-
cmd = launch_cmd(kind, v, model, strict=False)
|
|
6308
|
+
cmd = launch_cmd(kind, v, model, strict=False, role="reviewer" if name == st.get("reviewer") else None)
|
|
5943
6309
|
split = [HERDR, "pane", "split"] + ([last] if last else []) + \
|
|
5944
6310
|
["--direction", "down" if last else "right", "--cwd", d, "--no-focus"]
|
|
5945
6311
|
if dry:
|
|
@@ -6111,7 +6477,9 @@ def rename_lost(st, hints=True, keep_out=()):
|
|
|
6111
6477
|
continue
|
|
6112
6478
|
still[n] = pick if own else None
|
|
6113
6479
|
v = reg.get(w.get("kind"))
|
|
6114
|
-
cmd = launch_cmd(w.get("kind"), v, w.get("model"), strict=False
|
|
6480
|
+
cmd = (launch_cmd(w.get("kind"), v, w.get("model"), strict=False,
|
|
6481
|
+
role="reviewer" if n == st.get("reviewer") else None)
|
|
6482
|
+
if v else (w.get("kind") or "<its agent>"))
|
|
6115
6483
|
say(f"LOST {n}: pane {pick} is in its folder ({short(d)}), but herdr sees no agent running in it. "
|
|
6116
6484
|
+ (f"`orch team up` starts it there; or start it yourself (`{cmd}`)" if own else
|
|
6117
6485
|
f"Start it there (`{cmd}`)") + f", then: herdr agent rename {pick} {n}")
|
|
@@ -6250,7 +6618,8 @@ USAGE = """usage: orch <command> [args]
|
|
|
6250
6618
|
setup [--mode panes|subagent] get this machine ready for a mode; subagent: write ~/.pi/agent/agents/coder.md and
|
|
6251
6619
|
reviewer.md from ~/.config/herdr-orchestra/config.json and install pi-subagents
|
|
6252
6620
|
agents the agent registry: kinds, installed?, roles, herdr detection, launch commands
|
|
6253
|
-
agents launch <kind> [--model <id>] print the command that starts <kind> in a pane
|
|
6621
|
+
agents launch <kind> [--model <id>] [--role reviewer] print the command that starts <kind> in a pane
|
|
6622
|
+
(auto-approve edits; --role reviewer: its read-only reviewer command when it has one)
|
|
6254
6623
|
models the model catalog: tiers (small / medium / high), ratings, and what policy forbids
|
|
6255
6624
|
models show|check <id> one model's ratings and evidence / is it allowed?
|
|
6256
6625
|
resume after a restart (computer off, herdr closed): name the agents' panes again, save unsaved
|
|
@@ -6533,6 +6902,9 @@ def cmd_lead(args):
|
|
|
6533
6902
|
if sub == "run" and part == "--section":
|
|
6534
6903
|
print(run_playbook_part(pb.read_text(), args[2] if len(args) > 2 else ""), end="")
|
|
6535
6904
|
return
|
|
6905
|
+
if sub == "run" and asked_before_plan():
|
|
6906
|
+
print(ASKED_NOTE, end="")
|
|
6907
|
+
return
|
|
6536
6908
|
label = f"{sub} ({part})" if part else sub
|
|
6537
6909
|
subagent = current_mode()[0] == "subagent"
|
|
6538
6910
|
if subagent and sub == "run":
|
|
@@ -6837,15 +7209,22 @@ def cmd_agents(args):
|
|
|
6837
7209
|
installed = {k: bool(shutil.which(v.get("binary", k))) for k, v in reg.items()}
|
|
6838
7210
|
if sub == "launch":
|
|
6839
7211
|
rest = args[1:]
|
|
6840
|
-
model = None
|
|
7212
|
+
model, role = None, None
|
|
7213
|
+
use = "usage: orch agents launch <kind> [--model <id>] [--role coder|reviewer]"
|
|
6841
7214
|
if "--model" in rest:
|
|
6842
7215
|
i = rest.index("--model")
|
|
6843
|
-
model = rest[i + 1] if len(rest) > i + 1 else die(
|
|
7216
|
+
model = rest[i + 1] if len(rest) > i + 1 else die(use)
|
|
6844
7217
|
del rest[i:i + 2]
|
|
6845
|
-
|
|
7218
|
+
if "--role" in rest:
|
|
7219
|
+
i = rest.index("--role")
|
|
7220
|
+
role = rest[i + 1] if len(rest) > i + 1 else die(use)
|
|
7221
|
+
if role not in ("coder", "reviewer", "lead"):
|
|
7222
|
+
die(f"--role must be coder, reviewer or lead, got {role!r} — {use}")
|
|
7223
|
+
del rest[i:i + 2]
|
|
7224
|
+
kind = rest[0] if rest else die(use)
|
|
6846
7225
|
v = reg.get(kind) or die(f"unknown agent kind {kind!r} — known: {', '.join(reg)} "
|
|
6847
7226
|
f"(add it in {user_agents_file()})")
|
|
6848
|
-
print(launch_cmd(kind, v, model))
|
|
7227
|
+
print(launch_cmd(kind, v, model, role=role))
|
|
6849
7228
|
return
|
|
6850
7229
|
if sub == "dirs": # the folders `orch agents sync` writes: <skills|commands>\t<dir>[\t<commands_from>]
|
|
6851
7230
|
sdirs, _, cdirs, _ = sync_plan(reg, installed)
|
|
@@ -6913,11 +7292,13 @@ def doctor_kind(kind, v, full=True):
|
|
|
6913
7292
|
out.append((True, f"version: {first}" if code == 0 and first else f"version: unknown (`{vcmd}` failed)"))
|
|
6914
7293
|
hcmd = v.get("help_cmd") or f"{binary} --help"
|
|
6915
7294
|
code, help_ = _probe(hcmd)
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
7295
|
+
flags = []
|
|
7296
|
+
for key in ("launch", "review_launch"):
|
|
7297
|
+
try:
|
|
7298
|
+
launch = shlex.split(v.get(key) or binary)
|
|
7299
|
+
except ValueError:
|
|
7300
|
+
launch = [binary]
|
|
7301
|
+
flags += [f for f in (tok.split("=")[0] for tok in launch[1:] if tok.startswith("-")) if f not in flags]
|
|
6921
7302
|
for fl in flags:
|
|
6922
7303
|
if code is None:
|
|
6923
7304
|
out.append((False, f"launch flag {fl}: `{hcmd}` did not run ({help_.strip()[:80]})"))
|
|
@@ -7315,6 +7696,27 @@ def run_mode(st):
|
|
|
7315
7696
|
return m if m in ORCH_MODES else "panes"
|
|
7316
7697
|
|
|
7317
7698
|
|
|
7699
|
+
ASKED_NOTE = """PLANNING, NOT A RUN. The lead asked the developer questions before writing the plan
|
|
7700
|
+
(.orchestrate/questions.md), and no plan was written after them. If the developer just answered them, this is not
|
|
7701
|
+
a go: carry on with planning from step 2b of the plan playbook (`orch lead plan` prints it again), with their
|
|
7702
|
+
answers written into the plan where they apply. Show the plan and wait for **go**. Nothing starts before that.
|
|
7703
|
+
"""
|
|
7704
|
+
|
|
7705
|
+
|
|
7706
|
+
def asked_before_plan():
|
|
7707
|
+
"""True when .orchestrate/questions.md (the lead's questions before planning) is newer than plan.md: the
|
|
7708
|
+
developer's answer is part of planning, so `orch lead run` must not start a run from an old plan."""
|
|
7709
|
+
r = git("rev-parse", "--path-format=absolute", "--git-common-dir", check=False)
|
|
7710
|
+
if r.returncode != 0:
|
|
7711
|
+
return False
|
|
7712
|
+
d = Path(r.stdout.strip()).parent / ".orchestrate"
|
|
7713
|
+
q, p = d / "questions.md", d / "plan.md"
|
|
7714
|
+
try:
|
|
7715
|
+
return q.exists() and (not p.exists() or q.stat().st_mtime > p.stat().st_mtime)
|
|
7716
|
+
except OSError:
|
|
7717
|
+
return False
|
|
7718
|
+
|
|
7719
|
+
|
|
7318
7720
|
def _repo_state_path():
|
|
7319
7721
|
""".orchestrate/state.json of the repo this shell is in, or None (outside a repo, or no run yet)."""
|
|
7320
7722
|
r = git("rev-parse", "--path-format=absolute", "--git-common-dir", check=False)
|
|
@@ -7366,6 +7768,8 @@ is in your prompt. Read it and build what it asks. The task says what and why; y
|
|
|
7366
7768
|
- If something only the developer can decide blocks you, stop and reply `QUESTION: <the question>` with 2 or 3
|
|
7367
7769
|
concrete options. Don't guess.
|
|
7368
7770
|
- When the lead sends you a failing check or review findings, fix exactly those and run the check again.
|
|
7771
|
+
- When the task file says the milestone is hard to undo, run something that shows it is safe and end with
|
|
7772
|
+
`PROOF: <what you ran and what it showed>`.
|
|
7369
7773
|
|
|
7370
7774
|
End every reply with: the files you changed, the check result (PASS or FAIL), and one line per acceptance criterion:
|
|
7371
7775
|
`AC<n>: met|not met - <evidence: a test, a command, or file:line>`.
|
|
@@ -7375,10 +7779,18 @@ PI_REVIEWER_BODY = """You are the reviewer in a herdr-orchestra run. The lead se
|
|
|
7375
7779
|
You never edit files. Read the task file, then the change (`git diff HEAD` and `git status --short` for new files),
|
|
7376
7780
|
and the code around it.
|
|
7377
7781
|
|
|
7782
|
+
Answer two questions, separately:
|
|
7783
|
+
- `spec`: did it build what the task asks, no more and no less? Every acceptance criterion, correctness, security,
|
|
7784
|
+
edge cases, missing tests.
|
|
7785
|
+
- `rules`: does it follow the project's written rules: the task file's "Project rules" (coding rules file, decisions,
|
|
7786
|
+
words), or AGENTS.md / CLAUDE.md? Only written rules count; name the rule it breaks.
|
|
7787
|
+
Don't report what the check command (lint, types, tests) already catches.
|
|
7788
|
+
|
|
7378
7789
|
Reply with one line per finding, most serious first:
|
|
7379
|
-
- `BLOCKER: <file:line> - <problem> - <why it matters> (AC<n> when it breaks a criterion)` for a bug, a broken
|
|
7380
|
-
missing acceptance criterion, a missing test for new behaviour, or a security problem.
|
|
7381
|
-
- `
|
|
7790
|
+
- `BLOCKER: [spec] <file:line> - <problem> - <why it matters> (AC<n> when it breaks a criterion)` for a bug, a broken
|
|
7791
|
+
or missing acceptance criterion, a missing test for new behaviour, or a security problem.
|
|
7792
|
+
- `BLOCKER: [rules: <the rule>] <file:line> - <problem>` when it breaks a written rule.
|
|
7793
|
+
- `SUGGESTION: [spec] <file:line> - <idea>` (or `[rules: ...]`) for something nice to have.
|
|
7382
7794
|
- `NO FINDINGS` when there is nothing to report.
|
|
7383
7795
|
Then one line per acceptance criterion: `AC<n>: met|not met - <evidence>`.
|
|
7384
7796
|
"""
|
|
@@ -7387,15 +7799,23 @@ Then one line per acceptance criterion: `AC<n>: met|not met - <evidence>`.
|
|
|
7387
7799
|
def pi_agent_text(role, conf):
|
|
7388
7800
|
"""coder.md / reviewer.md for pi-subagents: front matter from the config, then the role's instructions."""
|
|
7389
7801
|
model, thinking = (conf or {}).get("model"), (conf or {}).get("thinking")
|
|
7390
|
-
|
|
7391
|
-
|
|
7802
|
+
turns = (conf or {}).get("max_turns")
|
|
7803
|
+
# One description per agent that names who starts it, so a normal Pi chat never hands its own work to them
|
|
7804
|
+
# (Claude Code's subagent docs: write descriptions that single out one subagent).
|
|
7805
|
+
desc = ("Only for a herdr-orchestra run: the orch lead starts it with one milestone's task file and it builds "
|
|
7806
|
+
"that milestone. Not for other coding work." if role == "coder" else
|
|
7807
|
+
"Only for a herdr-orchestra run: the orch lead starts it to review one milestone. Read-only, never edits "
|
|
7808
|
+
"files. Not for other reviews.")
|
|
7392
7809
|
fm = [f"name: {role}", f"description: {desc}"]
|
|
7393
7810
|
if role == "reviewer":
|
|
7394
7811
|
fm.append("tools: read, bash, grep, find, ls")
|
|
7812
|
+
fm.append("disallowed_tools: edit, write")
|
|
7395
7813
|
if model:
|
|
7396
7814
|
fm.append(f"model: {model}")
|
|
7397
7815
|
if thinking:
|
|
7398
7816
|
fm.append(f"thinking: {thinking}")
|
|
7817
|
+
if isinstance(turns, int) and not isinstance(turns, bool) and turns > 0:
|
|
7818
|
+
fm.append(f"max_turns: {turns}")
|
|
7399
7819
|
fm += ["prompt_mode: append", "skills: false", "run_in_background: false"]
|
|
7400
7820
|
body = PI_CODER_BODY if role == "coder" else PI_REVIEWER_BODY
|
|
7401
7821
|
return "---\n" + "\n".join(fm) + "\n---\n\n" + PI_AGENT_MARK + "\n\n" + body
|
|
@@ -7428,7 +7848,8 @@ def pi_setup():
|
|
|
7428
7848
|
p.parent.mkdir(parents=True, exist_ok=True)
|
|
7429
7849
|
p.write_text(text)
|
|
7430
7850
|
print(f"WROTE {short(p)} (model: {rc.get('model') or 'the same as the lead'}"
|
|
7431
|
-
+ (f", thinking: {rc['thinking']}" if rc.get("thinking") else "")
|
|
7851
|
+
+ (f", thinking: {rc['thinking']}" if rc.get("thinking") else "")
|
|
7852
|
+
+ (f", max_turns: {rc['max_turns']}" if f"max_turns: {rc.get('max_turns')}" in text else "") + ")")
|
|
7432
7853
|
pi = shutil.which(pi_bin())
|
|
7433
7854
|
if not pi:
|
|
7434
7855
|
print(f"NO PI `{pi_bin()}` is not on PATH. Install Pi (npm install -g @earendil-works/pi-coding-agent), "
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "herdr-orchestra",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.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/plan.md
CHANGED
|
@@ -27,13 +27,31 @@ Feature request = the user's message that asked you to run this playbook.
|
|
|
27
27
|
- Map the parts of the codebase the feature touches: entry points, the modules and files involved, existing patterns to follow (how similar features are built), data models and tables, tests and how they run.
|
|
28
28
|
- **Monorepo?** (workspaces in `package.json`/`pnpm-workspace.yaml`/`turbo.json`/`nx.json`, or folders like `apps/*`, `packages/*`, `backend/` + `frontend/`, `server/` + `client/`): list each app/package the feature touches, what it owns (API, web UI, mobile, shared types), and how each one is checked. For a feature that spans backend and frontend, understand BOTH sides well enough to write the contract between them: endpoints, request/response fields, where the shared types live.
|
|
29
29
|
- Find the **shared hotspot files** this feature will need to change: `package.json`/lockfiles, `pubspec.yaml`, `go.mod`, routes/router, `App.tsx`, nav/menu, global store, `docker-compose.yml`, `Makefile`, shared types.
|
|
30
|
+
- **The repo's own rules**, when it has them (in `docs/`, or the folder a `Docs:` plan header names): `glossary.md` (the words the project uses for things, and words to avoid), `adr/*.md` (decisions already made, and why), `coding-standards.md`. Use the glossary's words in the plan. Don't plan against a decision record; if the feature needs to change one, that is a question for the developer (step 2a).
|
|
30
31
|
- Use web docs only for facts the repo can't answer (a library's API, a protocol).
|
|
31
|
-
-
|
|
32
|
+
- If your tool has a read-only research helper (for example Claude Code's Explore agent), use it for wide searches across many files and keep only the facts it reports: your own context stays small for planning.
|
|
33
|
+
- Keep notes short: you'll put the relevant facts into each milestone's **Context**. List anything you could not determine as a question; never assume.
|
|
34
|
+
|
|
35
|
+
## 2a. Ask before you plan
|
|
36
|
+
A wrong guess in the plan is the most expensive mistake in a run: every coder builds on it. So before you write any plan, settle what only the developer can decide.
|
|
37
|
+
- From your research, list what the code, the docs and the request do NOT settle: business rules ("can a discount bring the total to zero?"), data shapes nobody has defined, auth or security trade-offs, which of two existing patterns to follow, a change to a decision record. Not questions the code answers: look those up yourself.
|
|
38
|
+
- **Nothing to ask?** Go straight on to step 2b. Don't invent questions.
|
|
39
|
+
- **Something to ask?** Write the questions to `.orchestrate/questions.md` and show the developer the same text, **all in one message**: one line each, numbered, with 2 or 3 concrete choices and your own suggestion and why (from what you found). End with: "Answer by number (for example `1 a, 2 both, 3 no`). I write the plan after your answers; nothing runs until you say go." Then **STOP** and wait.
|
|
40
|
+
Example:
|
|
41
|
+
```
|
|
42
|
+
Before I plan, 3 questions:
|
|
43
|
+
1. Discount on the whole order or on each item? (a) whole order (b) each item. I suggest (a): the cart has no per-item price changes today.
|
|
44
|
+
2. Percent, fixed amount, or both? I suggest both: the admin screen already has a type dropdown.
|
|
45
|
+
3. Can a discount bring the total to zero? I suggest no: the payment step refuses a zero total.
|
|
46
|
+
```
|
|
47
|
+
- The developer started the request with `grill:`: ask **one question at a time** instead, each with your suggestion, until nothing is left that only they can decide. Then go on.
|
|
48
|
+
- **When the answers come**, add them under `## Answers` in `.orchestrate/questions.md`, then carry on from step 2b. Write each answer into the plan where it applies: the `Constraints` of the milestones it affects, or `## Global instructions` when it affects all of them (e.g. `Decided by the developer: a discount applies to the whole order, never to one item`). The open questions inside milestones (step 9) are only for what still comes up later.
|
|
49
|
+
- **New words and decisions get written down.** When the feature brings a new name for something (Discount, not coupon or promo), list it under `## Glossary additions` in the plan (`- **Discount**: money taken off an order total, in paise`), and give the milestone that introduces it an acceptance criterion `docs/glossary.md defines Discount`, with `docs/glossary.md` in its Likely files. A decision that will be hard to change later (money in paise, one discount per order) gets a decision record the same way: `docs/adr/<next number>-<short-name>.md records the decision and why`. The coder writes these files; you never do. Skip both in a repo that keeps no glossary or decision records, unless the developer asks.
|
|
32
50
|
|
|
33
51
|
## 2b. Quick or full: decide from what you found, not from how the request sounds
|
|
34
52
|
A request that sounds small can be big ("add `discount` to the orders API" when there is no discount column yet), and one that sounds big can be small. Decide from your research. It is a **quick run** only when all four are true:
|
|
35
53
|
1. **One coder can do it in one go.** Nothing in it earns its own milestone (step 4b): no parallel part, no foundation, not too big for one sitting.
|
|
36
|
-
2. **It is clear.** You have no open questions for the developer about what they want.
|
|
54
|
+
2. **It is clear.** You have no open questions for the developer about what they want (after step 2a, if you asked).
|
|
37
55
|
3. **It stays out of risky areas:** no database schema or migration, no auth, login, permissions or sessions, no payments or billing, no new or upgraded packages, no CI, no secrets or `.env` files.
|
|
38
56
|
4. **It follows what is already there.** It copies a pattern the code already has, and it does not change how two parts talk to each other (an API shape another app or team depends on, shared types).
|
|
39
57
|
|
|
@@ -204,6 +222,9 @@ Reviewer: reviewer (claude: opus) | none
|
|
|
204
222
|
- <one line per real piece of work: what changes and where>
|
|
205
223
|
- <how the pieces connect, and why this number of milestones>
|
|
206
224
|
|
|
225
|
+
## Glossary additions
|
|
226
|
+
- <**New word**: what it means here — or "none"; step 2a>
|
|
227
|
+
|
|
207
228
|
## [x] M1: <title>
|
|
208
229
|
Depends on: none
|
|
209
230
|
Why separate: <why this is its own milestone; leave the line out when the plan has one milestone>
|
|
@@ -215,6 +236,7 @@ Model why: <one line: what in this milestone makes it that tier>
|
|
|
215
236
|
Estimate: <e.g. 40m: dispatch to landed if nothing goes wrong>
|
|
216
237
|
Role: <the specialist the coder works as, and what they care about in this milestone>
|
|
217
238
|
Review: yes | no
|
|
239
|
+
Door: <leave this line out (easy to undo) | one-way (why it is hard to undo)>
|
|
218
240
|
Likely files: src/a.ts, src/b.ts, src/feature/
|
|
219
241
|
Parallel: <leave this line out | allow>
|
|
220
242
|
Goal: <the outcome, one or two sentences>
|
|
@@ -236,7 +258,7 @@ Notes from user:
|
|
|
236
258
|
|
|
237
259
|
Git: the run makes ONE branch, `Branch:` (use `feature/<slug>`, or `fix/<slug>` for a bug fix). It is created by `orch start`, not now: planning never creates a branch or a commit. orch keeps each milestone's work in progress in hidden refs (not branches), lands each milestone as one commit whose message describes the change (the coder writes it), and `orch finish` pushes the branch and opens a PR. Optional header lines: `Base: <branch>` (defaults to the branch you start from) and `Commits: single` (squash the whole run into one commit at finish; default `per-milestone`).
|
|
238
260
|
|
|
239
|
-
Optional header lines: `Scope: strict` sends a milestone back when its coder changes files outside `Likely files` (default `warn`: listed in the summary); `Budget: 3h` stops autopilot when its running time is used up; `Risk hold: off` lets risky changes (deleted files, migrations, CI config, secrets files, unlisted dependency changes, very large diffs) land without `orch approve`; `Setup inputs: <globs>` names the files that mean "run the setup command again" (default: lockfiles and manifests); `Lead mode: off` makes the event manager dispatch by itself and stop for the developer instead of waking you (default with a `Lead:` line: `events`). Speed lines (leave them out unless the developer asks; the defaults are the fast ones): `Parallel checks: 2` runs two check commands at once (default 1; only when the machine has room for two); `Early review: off` sends a review only after the check passed (default `on`: the reviewer reads while the check runs); `Branch check: always` runs the check again on the feature branch even when the files are exactly the ones already checked in the coder's folder (default `auto`: skipped then); `Auto dispatch: off` makes a milestone that a landing unlocked wait for your `orch dispatch` (default `on`: it starts at once and you get `AUTO-DISPATCHED`).
|
|
261
|
+
Optional header line `Docs: <folder>` names the folder with the repo's glossary.md, adr/ and coding-standards.md (default `docs`). Optional header lines: `Scope: strict` sends a milestone back when its coder changes files outside `Likely files` (default `warn`: listed in the summary); `Budget: 3h` stops autopilot when its running time is used up; `Risk hold: off` lets risky changes (deleted files, migrations, CI config, secrets files, unlisted dependency changes, very large diffs) land without `orch approve`; `Setup inputs: <globs>` names the files that mean "run the setup command again" (default: lockfiles and manifests); `Lead mode: off` makes the event manager dispatch by itself and stop for the developer instead of waking you (default with a `Lead:` line: `events`). Speed lines (leave them out unless the developer asks; the defaults are the fast ones): `Parallel checks: 2` runs two check commands at once (default 1; only when the machine has room for two); `Early review: off` sends a review only after the check passed (default `on`: the reviewer reads while the check runs); `Branch check: always` runs the check again on the feature branch even when the files are exactly the ones already checked in the coder's folder (default `auto`: skipped then); `Auto dispatch: off` makes a milestone that a landing unlocked wait for your `orch dispatch` (default `on`: it starts at once and you get `AUTO-DISPATCHED`).
|
|
240
262
|
|
|
241
263
|
Rules for every milestone:
|
|
242
264
|
- **Role**: from step 6, on every milestone. The standard to work to, never a how-to.
|
|
@@ -253,14 +275,16 @@ Rules for every milestone:
|
|
|
253
275
|
<!-- /quick -->
|
|
254
276
|
- **Prefer**: a worker kind or name from `Workers:` when a tool (not a model) suits the work better, otherwise `any`. A preference, not a lock; the tier comes first.
|
|
255
277
|
- **Review**: `yes` for UI, API contracts, auth, payments and schema; `no` for mechanical milestones.
|
|
278
|
+
- **Door**: most changes are easy to undo: if they are wrong, a revert fixes it and nobody is hurt. Write `Door: one-way (why)` only on a milestone that git can't take back once it runs: a migration that changes real data, a public API or event other apps or teams depend on, deleting data, sending emails or messages, charging money, publishing a package. Example: `Door: one-way (adds a column to orders, 2M rows in production)`. Such a milestone always waits for the developer's `orch approve` before it lands, even when no file looks risky, and its coder is asked for proof that it is safe (a dry run on a copy, a rollback test). Never mark everything one-way: the label tells the developer where to look hardest. orch measures how much each milestone could break by itself (risky files, how many milestones build on it, its size); you don't write that.
|
|
256
279
|
- **ZERO GUESSWORK**: missing business rules, undefined data shapes, and auth or security trade-offs go under **Open questions** with 2–3 concrete options. `orch sync` marks such milestones `needs-answer`, and their dependents wait.
|
|
257
|
-
- Each section must stand alone: autopilot hands it to the coder (without the lines only orch uses: `Depends on`, `Why separate`, `Prefer`, `Tier`, `Needs`, `Model why`, `Estimate`, `Review`, `Parallel`; `Role` goes at the top as the coder's role), together with the global instructions and the reports of merged dependencies.
|
|
280
|
+
- Each section must stand alone: autopilot hands it to the coder (without the lines only orch uses: `Depends on`, `Why separate`, `Prefer`, `Tier`, `Needs`, `Model why`, `Estimate`, `Review`, `Parallel`, `Door`; `Role` goes at the top as the coder's role), together with the global instructions and the reports of merged dependencies.
|
|
258
281
|
|
|
259
282
|
## 10. Validate and show the plan
|
|
260
|
-
- Run `orch sync`. Fix every ERROR. Fix or consciously accept every WARN: missing dependency reasons, hotspot files in parallel milestones, "how" in a milestone, overlap, a milestone without `Why separate` or `Estimate`, independent milestones in shared mode, coders left idle by a fully sequential plan, a tier no coder reaches, a model outside the catalog.
|
|
283
|
+
- Run `orch sync`. Fix every ERROR. Fix or consciously accept every WARN: a word the glossary says to avoid, a new word or decision record no milestone writes down, missing dependency reasons, hotspot files in parallel milestones, "how" in a milestone, overlap, a milestone without `Why separate` or `Estimate`, independent milestones in shared mode, coders left idle by a fully sequential plan, a tier no coder reaches, a model outside the catalog.
|
|
261
284
|
- Run `orch plan show` and give the developer its cards as they are: each milestone in plain words, what it waits for and why, who builds it on which model, how long, and the order. Fix every `WARN no Plain: line` first. Then add, in plain words too:
|
|
262
285
|
- **the team and model table**: each milestone, its tier, which coder and model it will go to, the `Model why`, and its estimate, plus the estimate for the whole feature;
|
|
263
|
-
- the research facts that shaped the plan, and all open questions
|
|
286
|
+
- the research facts that shaped the plan, the answers from step 2a and where they went, and all open questions;
|
|
287
|
+
- which milestones are hard to undo and why (the cards say so), and the new glossary words.
|
|
264
288
|
Keep code words (file names, functions, endpoints) out of what you write here: they are in plan.md for whoever wants them.
|
|
265
289
|
- Then say: "Plan written to .orchestrate/plan.md. Edit it if you like: untick `[x]` to skip a milestone, change `Tier` / `Depends on` / `Prefer`, answer open questions under 'Notes from user' and set 'Open questions: - none'. Say **go** (or `/orch-run`, "use the orch-run skill", "Run `orch lead run` and follow it") and I will start the run: I dispatch the milestones, the event manager runs them, and I come back when one finishes, asks a question or needs a decision."
|
|
266
290
|
- STOP and wait for the developer. Do not dispatch before they say so.
|
package/playbooks/run.md
CHANGED
|
@@ -45,7 +45,7 @@ Run `orch events`. It lists the new events, the ones still open, the milestones
|
|
|
45
45
|
| `FAILED Mn`: lost N attempts | The agents kept being unreachable, gone or rate-limited. Tell the developer which agents to restart or wait for; then `orch dispatch Mn`. |
|
|
46
46
|
| `WORKER-LOST Mn` | A coder vanished while it worked (pane closed, the agent quit and left a shell, herdr restarted). **Not routine:** tell the developer at once, with the exact fix in the event text (`orch resume`, or `orch team up`). The milestone waits for the next free coder with its work so far; nothing else to do. |
|
|
47
47
|
| `HERDR-RESTART` | Most agents vanished at once. Tell the developer to run `orch resume`, then `orch team up` for any agent it reports `LOST`. |
|
|
48
|
-
| `HELD Mn` | Risky changes (deleted files, migrations, CI config, secrets files, unlisted dependency changes, a very large diff) wait for the developer. Show the reasons from `orch status`, and tell the developer to look and run `orch approve Mn` (or `orch set Mn paused`). |
|
|
48
|
+
| `HELD Mn` | Risky changes (a milestone the plan marks hard to undo, deleted files, migrations, CI config, secrets files, unlisted dependency changes, a very large diff) wait for the developer. Show the reasons from `orch status`, how much it could break and, for a hard-to-undo milestone, the coder's proof, and tell the developer to look and run `orch approve Mn` (or `orch set Mn paused`). Never approve it yourself. |
|
|
49
49
|
| `NEEDS-ANSWER Mn` | Open questions in the plan: ask the developer, write the answers under "Notes from user", set "Open questions:" to `- none`, `orch sync`, then `orch dispatch Mn`. |
|
|
50
50
|
| `ESCALATED Mn`, `AUTO-DISPATCHED Mn` | Information: nothing to dispatch. Mention an escalation in the final summary. |
|
|
51
51
|
| `FINISHED` | The developer ran `orch finish`. Post the MANUAL TESTS list that `orch events` prints under it in your chat, numbered and word for word, under "Try these by hand before you merge", plus the PR link from the event when there is one. If it says none, say there is nothing to try by hand and why. Nothing else to do: the run is over. |
|
package/playbooks/subagent.md
CHANGED
|
@@ -21,10 +21,11 @@ There is no event manager and there are no herdr panes. You drive one milestone
|
|
|
21
21
|
## 2. One milestone
|
|
22
22
|
1. Run `orch sub next`. It prints `NEXT Mn: <title>`, `TASK <path to task.md>` and `REVIEW yes|no`. (`CURRENT Mn` means a milestone was started and not saved: carry on with it from step 2. `HELD`, `WAITING` or `ALL_DONE`: see below.)
|
|
23
23
|
2. **Coder.** Call the `Agent` tool: `subagent_type: "coder"`, `description: "Mn <short title>"`, `run_in_background: false`, and a prompt like `Build milestone Mn. Read the task file <TASK path> and follow it. The check command is: <check command>. There is no result file or done file in this run: put your report in your reply.`
|
|
24
|
+
- If the coder's reply says it stopped early (its turn limit, `max_turns` in the config), resume the same coder once with `Carry on with Mn from where you stopped.` If it stops early again, tell the developer what it reported and **STOP**.
|
|
24
25
|
- If the coder replies `QUESTION: ...`: answer it from the plan or the code (say where the answer comes from), or ask the developer with 2–3 options and **STOP**. Write the answer under that milestone's "Notes from user" in `.orchestrate/plan.md`, then send it to the same coder with the `Agent` tool's `resume` (its agent id), so it carries on from its work.
|
|
25
26
|
3. **Check.** Run `orch check Mn`. On `CHECK FAIL`, resume the same coder with the failing output (the last lines `orch check` printed) and ask it to fix the cause. Run `orch check Mn` again. At most 3 fix rounds; after that, run `orch set Mn failed "<what keeps failing>"`, explain it to the developer in two lines, and **STOP**.
|
|
26
27
|
4. **Review** (only when `REVIEW yes`). Call the `Agent` tool: `subagent_type: "reviewer"`, `run_in_background: false`, prompt `Review milestone Mn. Task file: <TASK path>. Look at the change with git diff HEAD and git status --short.` Each `BLOCKER:` line goes back to the same coder (resume it with those lines only), then `orch check Mn` again, then one more review. At most 2 review rounds; blockers still left after that: `orch set Mn failed "<the blockers>"`, tell the developer, **STOP**. `SUGGESTION:` lines do not block: keep them for the summary.
|
|
27
|
-
5. **Save.** Run `orch sub done Mn`. `MERGED Mn` means it is committed on the feature branch. `HELD Mn` (exit 7) means risky changes (deleted files, migrations, CI config, secrets files, unlisted dependency changes, a very large diff) wait for the developer: show the reasons from `orch status
|
|
28
|
+
5. **Save.** Run `orch sub done Mn`. `MERGED Mn` means it is committed on the feature branch. `HELD Mn` (exit 7) means risky changes (a milestone the plan marks hard to undo, deleted files, migrations, CI config, secrets files, unlisted dependency changes, a very large diff) wait for the developer: show the reasons from `orch status` and what `orch sub done` printed (how much it could break; for a hard-to-undo milestone, the coder's `PROOF:` line from its reply), tell them to look and run `orch approve Mn`, and **STOP**; after their approval run `orch sub done Mn` again.
|
|
28
29
|
6. Write your one line in the chat (hard rule 5), and go back to step 1 for the next milestone.
|
|
29
30
|
|
|
30
31
|
`orch sub next` printing `WAITING` means nothing is ready (a milestone is paused, failed or needs an answer): tell the developer which and why (`orch status`), and **STOP**. When it is sorted out, `orch set Mn pending` and carry on.
|
|
@@ -36,6 +37,8 @@ There is no event manager and there are no herdr panes. You drive one milestone
|
|
|
36
37
|
- **Tasks**: one line per milestone, what it does now.
|
|
37
38
|
- **Checked**: the final `orch check` result, each review, and one line per acceptance criterion with its evidence (a test, a command, or `file:line`). Run a command or read the code to settle anything you can.
|
|
38
39
|
- **Reviewer suggestions not applied.**
|
|
40
|
+
- **Undo and blast radius**: the "undo and blast radius" lines of `orch report`, as a table (milestone, easy or hard to undo, could break, proof). Leave it out when `orch report` has none.
|
|
41
|
+
- **Review findings: spec and rules**: each review finding under the question it answered: `[spec]` (did it build what was asked?) or `[rules: <rule>]` (does it follow the repo's written rules?), and which rules were broken more than once. Leave the section out when no review had findings.
|
|
39
42
|
- **Manual verification checklist**: ONLY what a person must see or do (how the UI looks, a click-through in a real browser, a real email arriving). For a backend-only change write `Nothing to check by hand: <why>`.
|
|
40
43
|
2. Tell the developer: "All milestones are saved on <branch>. Review .orchestrate/summary.md. <m> need your eyes:", then the manual checklist items, numbered, one per line (or: nothing needs checking by hand). Then: "Run `orch finish`: it re-runs the check (or reuses it), pushes <branch> and opens a PR (`orch finish --no-push` to only clean up)." Run `orch finish` yourself only when the developer says so: it pushes. Never add a "Generated with …", `Co-Authored-By` or session line to a commit or a PR of the run: they are the developer's. **STOP.**
|
|
41
44
|
3. **After `orch finish`** (you ran it, or the developer tells you they did): post its MANUAL TESTS list in your chat, numbered and word for word, under "Try these by hand before you merge" (`orch manual` prints it again). If it says none, say there is nothing to try by hand. **STOP.**
|
package/skills/orch-run/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: orch-run
|
|
3
|
-
description: Orchestrator step 2 for a Herdr multi-agent team. Use when the user says "orch-run", "go", "start the run", "continue the plan", or answers a question; and whenever you are told to run `orch events`. The lead dispatches milestones and pauses; the event manager (`orch autopilot`) runs them and wakes the lead for questions, failures, held or ready milestones, and the final summary.
|
|
3
|
+
description: Orchestrator step 2 for a Herdr multi-agent team. Use when the user says "orch-run", "go", "start the run", "continue the plan", or answers a question during a run (not the questions the lead asks before it writes the plan); and whenever you are told to run `orch events`. The lead dispatches milestones and pauses; the event manager (`orch autopilot`) runs them and wakes the lead for questions, failures, held or ready milestones, and the final summary.
|
|
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.
|