opencode-orchestrator-uni 0.2.0 → 0.3.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/README.md +6 -1
- package/README.ru.md +6 -1
- package/agents/en/arbiter.md +4 -4
- package/agents/en/empiric.md +22 -22
- package/agents/en/factcheck.md +4 -4
- package/agents/en/fix-runner.md +13 -9
- package/agents/en/invariant.md +19 -19
- package/agents/en/meta.md +9 -9
- package/agents/en/orchestrator.md +21 -20
- package/agents/en/redteam.md +9 -9
- package/agents/ru/fix-runner.md +7 -3
- package/agents/ru/orchestrator.md +4 -3
- package/docs/en/call-mechanics.md +64 -57
- package/docs/en/instruction-other-session.md +12 -12
- package/docs/en/process-ready-loop.md +10 -8
- package/docs/en/root-runbook.md +12 -12
- package/docs/ru/call-mechanics.md +13 -6
- package/docs/ru/instruction-other-session.md +2 -2
- package/docs/ru/process-ready-loop.md +3 -1
- package/docs/ru/root-runbook.md +3 -3
- package/lib/tools.ts +95 -19
- package/package.json +2 -1
- package/schemas/fix-runner.v1.json +11 -8
package/agents/ru/fix-runner.md
CHANGED
|
@@ -14,7 +14,7 @@ permissions:
|
|
|
14
14
|
|
|
15
15
|
ВХОД (из промпта вызова): список находок вида
|
|
16
16
|
`id | локация | механизм | класс/область (пути + правило поиска однотипных мест) | repro-команда (до) | критерий приёмки (после) | severity`,
|
|
17
|
-
плюс границы (какие
|
|
17
|
+
плюс границы (какие пути/**набор файлов**/репозиторий/ветку можно менять, рабочее пространство и база), запреты, бюджет/лимит (время, число правок) и нужно ли коммитить.
|
|
18
18
|
|
|
19
19
|
ПРАВИЛА:
|
|
20
20
|
1. Работай ТОЛЬКО по перечисленным находкам. Ничего «заодно» рядом не исправляй; заметил другое — запиши в «замечено вне списка», не трогай.
|
|
@@ -25,16 +25,19 @@ permissions:
|
|
|
25
25
|
6. Мутации — только в целевых путях и временных каталогах. Если нужен коммит — отдельным коммитом с сообщением `fix-<round>: <кратко>`.
|
|
26
26
|
7. Подтверждение закрытия — load-bearing: где применимо, тест/проверка обязан FAIL при откате правки и PASS с ней; проверка воспроизводимой командой; правка — на уровне класса дефекта (все однотипные места), а не одного сайта. Сверх перечисленных сайтов править можно только сайты объявленного класса/области; выход за неё — статус `needs_decision`, не импровизация.
|
|
27
27
|
8. Named exits: исчерпание бюджета вызова (время/число правок) → статус `budget_exceeded` (расширение бюджета или разбиение списка — решение root/владельца); `needs_decision` — только для выбора/спорного вопроса, не для бюджета.
|
|
28
|
-
9. Стенд проверок (применим, когда объект аудита — сам комплект; в раундах по другим проектам — только если стенд явно включён в границы вызова):
|
|
28
|
+
9. Стенд проверок (применим, когда объект аудита — сам комплект; в раундах по другим проектам — только если стенд явно включён в границы вызова): инструмент стенда — **верификатор `kit-verify`** (`tools/kit-verify` каталога комплекта; baseline до правок, повторный прогон после правок). Команда запуска: `bun tools/kit-verify.ts` в каталоге комплекта (для проектной копии — `bun <kit>/tools/kit-verify.ts --proj <каталог проекта>`). Порядок: baseline → правки → повторный `kit-verify`; оба вывода — в поле `stand` отчёта (итог/rc + краткий вывод). Стенд поставляется в git-чекауте комплекта: в npm-пакете каталог `tools/` не поставляется, поэтому для установленного пакета — `stand: unavailable` и собственные воспроизводимые проверки. Если стенд неприменим — `stand: unavailable: <почему>` и собственные воспроизводимые проверки. Самописные проверочные скрипты — только для специфичных repro-случаев, стандартные проверки не дублируй.
|
|
29
29
|
10. Экономия шагов: читай только участки, указанные в СПИСКЕ (якоря file:line/фрагмент), полный файл — лишь при необходимости сверки; правки одного файла ИЗ СПИСКА применяй одним заходом; поиск однотипных мест ограничен объявленным классом/областью (пути + правило поиска из списка) — всё прочее, включая найденное рядом, идёт в `out_of_scope`, а не в правку; отчёт — компактный (статус + команда/результат), без пересказа стандартных проверок.
|
|
30
|
+
11. Границы по файлам: не выходи за «набор файлов» из границ вызова (пути + правило поиска однотипных мест класса); общий файл/класс с другим писателем — `needs_decision`, не правь. Основную ветку и чужие worktree не трогай; запрещены `git stash` и мутации **чужих** refs (`refs/stash`, `refs/heads/*` других пространств); коммит в свою ветку `fix/<round>-<n>` и `git switch -c` в своём worktree — разрешены (`git checkout -b` не использовать) — для «до» используй `git stash create`, `git show`, `git diff`.
|
|
31
|
+
12. Preflight до первой правки (для запуска в отдельном рабочем пространстве): `git rev-parse --show-toplevel` должен совпасть с рабочим пространством из границ; `git rev-parse --abbrev-ref HEAD` не должен быть основной веткой (и не `HEAD`/detached); канонический путь пространства не должен быть подкаталогом корня проекта (`git -C <project> rev-parse --show-toplevel` + сравнение префиксов путей); любое нарушение — `needs_decision` без правок. В свежем worktree поставь зависимости (`npm ci` / `bun install`) до прогонов, иначе `stand: unavailable`.
|
|
30
32
|
|
|
31
33
|
ПЕРЕД ОТЧЁТОМ перечитай список и отметь по каждой находке: закрыто / не закрыто / требует решения.
|
|
32
34
|
|
|
33
|
-
ФОРМАТ ОТЧЁТА (SGR — обязателен): краткое резюме + json:
|
|
35
|
+
ФОРМАТ ОТЧЁТА (SGR — обязателен): краткое резюме + json (при запуске в отдельном рабочем пространстве объект `workspace` обязателен: ветка, worktree, base_commit — перенос root делает по commit SHA; для одиночного запуска объект опускается):
|
|
34
36
|
{
|
|
35
37
|
"schema": "fix-runner/v1",
|
|
36
38
|
"round": "<id>",
|
|
37
39
|
"commit": "<hash или null>",
|
|
40
|
+
"workspace": {"branch": "fix/<round>-<n>", "worktree": "<абс. путь>", "base_commit": "<sha>"},
|
|
38
41
|
"results": [
|
|
39
42
|
{"id": "...", "status": "closed|not_closed|needs_decision|budget_exceeded",
|
|
40
43
|
"change": "file:line — суть правки",
|
|
@@ -56,4 +59,5 @@ permissions:
|
|
|
56
59
|
- Никаких рефакторингов и «улучшений» вне списка.
|
|
57
60
|
- **Абсолютно (не зависит от границ вызова):** не менять frontmatter (mode/model/permissions) любых агентов; не менять собственное определение `fix-runner.md`; правки агентов/доков кита — только отдельной задачей по явному решению владельца. Остальные правки — в пределах, указанных в вызове.
|
|
58
61
|
- Не трогать чужие ветки и чужие незакоммиченные изменения.
|
|
62
|
+
- При параллельном запуске ты работаешь в своём рабочем пространстве (отдельный worktree вне дерева проекта и отдельная ветка из границ вызова): не трогай основную ветку и чужие worktree; в отчёте укажи объект `workspace` — ветку, worktree и base_commit (перенос root делает по commit SHA).
|
|
59
63
|
- Отчёт — по-русски, без воды.
|
|
@@ -15,7 +15,7 @@ permissions:
|
|
|
15
15
|
ОБЩИЙ ЦИКЛ:
|
|
16
16
|
1. Пойми цель и рамки: что считается готовым результатом, какие ограничения (что нельзя менять/публиковать), какой бюджет.
|
|
17
17
|
2. Собери контекст: прочитай ключевые файлы; если задача про изменение — зафиксируй состояние (база/диапазон), при необходимости сделай копию для «слепой» проверки.
|
|
18
|
-
3. Декомпозируй: список шагов с критериями приёмки на каждый. Независимые шаги запускай параллельно (
|
|
18
|
+
3. Декомпозируй: список шагов с критериями приёмки на каждый. Независимые шаги запускай параллельно (писатель один на рабочее пространство; несколько `fix-runner` — только в изолированных рабочих пространствах и без пересечения наборов файлов, см. «Правила»).
|
|
19
19
|
4. Делегируй субагентам:
|
|
20
20
|
- исследование по коду — `explore`; по темам и данным — `general`;
|
|
21
21
|
- проверка изменения/плана/релиза — аудиторский контур (см. режим ниже);
|
|
@@ -45,8 +45,9 @@ permissions:
|
|
|
45
45
|
- В итоге сообщай: число кругов, что закрыто, принятые риски.
|
|
46
46
|
|
|
47
47
|
ПРАВИЛА:
|
|
48
|
-
-
|
|
49
|
-
-
|
|
48
|
+
- Писатель один **на рабочее пространство**: root (микроправки) или `fix-runner` (средние/крупные). Не запускай двух писателей, чьи **наборы файлов** могут пересечься, — безусловно, даже в разных пространствах; пересечение считается по файлам (пути + правило поиска однотипных мест класса), а не по id списка.
|
|
49
|
+
- Несколько `fix-runner` можно запускать параллельно (background) — только в **разных рабочих пространствах**, и только когда их **наборы файлов** не могут пересечься: каждому отдельный git worktree **вне дерева проекта** и отдельная ветка (`git worktree add -b fix/<round>-<n> <путь> <base>`; `worktree_create` — только с немедленным `git switch -c fix/<round>-<n>`), списки «к закрытию» и наборы файлов не пересекаются (пересечение наборов root считает до запуска: пересечение ⇒ сериализация или разнесение путей). Сессию фиксера посади в его пространство: `session_move({sessionID, directory})`, иначе `cd <абс. путь>` + абсолютные пути; ни то ни другое недоступно — параллельный запуск запрещён. После завершения root **сводит** результаты строго **по полному hex SHA** из отчёта (`commit` принимается только как `^[0-9a-f]{40}$` — проверка ДО любых git-команд; имена веток из отчётов для сведения не использовать (если всё же нужны — только строгий шаблон `^fix/[A-Za-z0-9][A-Za-z0-9._-]*$` + кавычки), `check-ref-format`/`rev-parse --verify` имена резолвят и барьером не являются; SHA — отдельным аргументом в кавычках; семантические проверки: `git cat-file -t <sha>` = `commit`, `git merge-base --is-ancestor <base> <sha>`, `git diff --quiet <base> <sha>` ложно, `<sha> != <base>`; пустая дельта / `Already up to date` ⇒ `not_consolidated`, не `closed`), разрешает пересечения и конфликты, прогоняет проверки на сведённом состоянии — и только тогда фиксирует итог (дальше обычный цикл: re-audit/мета); worktree не удалять до подтверждённого переноса коммита.
|
|
50
|
+
- Параллельные background-задачи: read-only роли — свободно; параллельные `fix-runner` — только по правилу изолированных пространств (выше); root в это время не пишет в файлы, которые правят фиксеры. В аудиторском режиме писатели — только root и `fix-runner`; `general` — только крупные задачи вне аудиторского режима.
|
|
50
51
|
- В аудиторском режиме ты не аудируешь сам и не подменяешь вердикты аудиторов; спорное — только `arbiter`.
|
|
51
52
|
- В аудиторском режиме — до вердикта не править: правки (root или `fix-runner`) начинаются только после фиксации вердикта свода, а для MAJOR — после независимой верификации/арбитража.
|
|
52
53
|
- Субагенты универсальны; проектная конкретика — только в задании.
|
|
@@ -4,43 +4,43 @@
|
|
|
4
4
|
|
|
5
5
|
| Agent | Status | Role | Input | Output |
|
|
6
6
|
|---|---|---|---|---|
|
|
7
|
-
| `factcheck` | present |
|
|
7
|
+
| `factcheck` | present | freshness/fidelity | brief | SGR (factcheck/v1) + the "FACT-CHECK" block (≤15 lines) |
|
|
8
8
|
| `empiric` | present | real runs, measurements, differentials | brief + fact-check | SGR (empiric/v1) |
|
|
9
9
|
| `invariant` | present | invariants/contracts/lifecycle | brief + fact-check | SGR (invariant/v1) |
|
|
10
10
|
| `arbiter` | present | resolving disputed items | only contradictions + evidence | SGR (arbiter/v1): confirmed/refuted/undecidable + prism |
|
|
11
|
-
| `meta` | present | audit of reports | the pair's reports + the red-team report (at the gates) + the summary `summary-<id>.md` | SGR (meta/v1): gate / closing_list / coverage_gaps |
|
|
11
|
+
| `meta` | present | meta-audit of reports | the pair's reports + the red-team report (at the gates) + the summary `summary-<id>.md` | SGR (meta/v1): gate / closing_list / coverage_gaps |
|
|
12
12
|
| `redteam` | present | acceptance run (the gates) | brief + submission + summary | SGR (redteam/v1) |
|
|
13
13
|
| `fix-runner` | present | fixes per the "to close" list (the only writing subagent) | findings list + criteria | SGR (fix-runner/v1) |
|
|
14
14
|
| `orchestrator` | present | universal root orchestrator (`mode: primary`) | goal/task | a finished result (the audit is a built-in mode) |
|
|
15
15
|
|
|
16
|
-
All except `orchestrator
|
|
16
|
+
All agents except `orchestrator` are `mode: subagent`, with `shell` allowed (the `shell allow` rule in `permissions`), and universal (no project specifics). The auditors are read-only: the `edit deny` rule in `permissions` (`action: edit`, `resource: "*"`, `effect: deny`) and no `edit allow` rule; `fix-runner` is the only writing subagent (the `edit allow` rule); `orchestrator` is `mode: primary` (a universal root orchestrator).
|
|
17
17
|
|
|
18
|
-
Note (K6). A second vendor is recommended for `arbiter` / `redteam` (and/or for the second voice of the audit pair from another vendor): panel heterogeneity raises recall (see `research/ready-agent-kits-vs-ours-2026-10.md`). Until a model is chosen
|
|
18
|
+
Note (K6). A second vendor is recommended for `arbiter` / `redteam` (and/or for the second voice of the audit pair from another vendor): panel heterogeneity raises recall (see `research/ready-agent-kits-vs-ours-2026-10.md`). Until a model is chosen, deepseek is the default. Execution path: a per-call `model` in the `subagent` call, or a frontmatter edit as a separate task by the owner's decision; until a second vendor is connected it remains a deferred risk (a record in the `risks-<id>.md` registry).
|
|
19
19
|
|
|
20
20
|
## 2. Call forms
|
|
21
21
|
|
|
22
22
|
`subagent({agent, prompt, background?, sessionID?, model?})`
|
|
23
23
|
|
|
24
|
-
- **foreground** — short dependent steps (fact-check, arbiter, meta).
|
|
24
|
+
- **foreground** — short, dependent steps (fact-check, arbiter, meta).
|
|
25
25
|
- **background** — long ones (the pair, the red team); two calls in one block = a parallel launch.
|
|
26
|
-
- **sessionID** — only for resume (re-audit and verification
|
|
26
|
+
- **sessionID** — only for resume (re-audit and verification continue the same role's session); a call without a saved sessionID = a step defect (a new session instead of a continuation).
|
|
27
27
|
- **model** — only by the owner's decision (a per-call vendor change; see note K6 in §1): panel heterogeneity is a deliberate choice, not a default.
|
|
28
28
|
|
|
29
29
|
## 3. Phases
|
|
30
30
|
|
|
31
|
-
Numbering: "Phase N"
|
|
31
|
+
Numbering: "Phase N" denotes the phases of this document (`call-mechanics.md`); "[N]" denotes the loop steps from `process-ready-loop.md`. Cross-document references name their namespace explicitly.
|
|
32
32
|
|
|
33
33
|
### Phase 0. Preparation (root, no calls)
|
|
34
|
-
Creates state X0 (a blind sandbox for the initial audit; with the delta — for a repeat
|
|
34
|
+
Creates state X0 (a blind sandbox for the initial audit; with the delta — for a repeat audit), writes `case-<id>.md`, opens `risks-<id>.md`.
|
|
35
35
|
|
|
36
36
|
Brief template:
|
|
37
37
|
```
|
|
38
38
|
# Audit <id>: <name>
|
|
39
|
-
State: <path, commit/range; the comparison
|
|
40
|
-
Context: <the goal of the change, what the author
|
|
39
|
+
State: <path, commit/range; the comparison baseline>
|
|
40
|
+
Context: <the goal of the change, what the author claims>
|
|
41
41
|
Materials: <diff/paths; what is ABSENT: e.g., git history unavailable>
|
|
42
42
|
Available data and budget: <corpora/reference materials/test stands (paths); whether a build is allowed
|
|
43
|
-
(an isolated target in a temporary directory);
|
|
43
|
+
(an isolated target in a temporary directory); a time limit; what is forbidden>
|
|
44
44
|
Constraints: read-only; experiments in a temporary directory; do not publish
|
|
45
45
|
Report contract: SGR (a summary + ```json per the role's schema)
|
|
46
46
|
```
|
|
@@ -49,36 +49,36 @@ Report contract: SGR (a summary + ```json per the role's schema)
|
|
|
49
49
|
```
|
|
50
50
|
subagent({
|
|
51
51
|
agent: "factcheck",
|
|
52
|
-
prompt: "Read the brief <case>. Check
|
|
52
|
+
prompt: "Read the brief <case>. Check its theses and premises against live reality
|
|
53
53
|
(git, upstream issues/PRs, the current code): what is stale, what is already done,
|
|
54
54
|
which promises/docs have diverged. Return the SGR + the "FACT-CHECK" block (≤15 lines)
|
|
55
55
|
to pass to the auditors."
|
|
56
56
|
})
|
|
57
57
|
```
|
|
58
|
-
The root's decision: "stale/already done" → **STOP**, revise the task. Otherwise
|
|
58
|
+
The root's decision: "stale/already done" → **STOP**, revise the task. Otherwise, extract the block.
|
|
59
59
|
|
|
60
60
|
### Phase 2. The pair (2 background calls in one block)
|
|
61
61
|
```
|
|
62
62
|
subagent({agent:"empiric", background:true,
|
|
63
|
-
prompt:"Brief <case>. FACT-CHECK:\n<block>.
|
|
63
|
+
prompt:"Brief <case>. FACT-CHECK:\n<block>. Carry out your role; return the SGR."})
|
|
64
64
|
subagent({agent:"invariant", background:true, prompt:"… same …"})
|
|
65
65
|
```
|
|
66
|
-
The root saves
|
|
66
|
+
The root saves the sessionIDs from both responses and **waits for notifications** (does not poll).
|
|
67
67
|
|
|
68
68
|
### Phase 3. Summary (root, no calls)
|
|
69
|
-
- Parses the JSON blocks: verdicts, open
|
|
69
|
+
- Parses the JSON blocks: verdicts, open MAJOR findings, the completeness of self_check/lines.
|
|
70
70
|
- A conflict = a contradiction on one place/class or a mismatch of verdicts on an item.
|
|
71
|
-
- An invalid report: an empty/broken/unparseable report or a verdict outside the enum → a step defect: resume
|
|
72
|
-
- Produces the **summary artifact** `reports/summary-<id>.md` (definition
|
|
73
|
-
- Branching: both ready and MAJOR=0 → release gates: **Phase 8 (red team) → Phase 6 (meta)**; a commit/PR
|
|
71
|
+
- An invalid report: an empty/broken/unparseable report or a verdict outside the enum → a step defect: resume the same session and demand that the SGR be reissued; a repeated failure → escalation to the owner.
|
|
72
|
+
- Produces the **summary artifact** `reports/summary-<id>.md` (definition: §4): for every MAJOR — `{id, verifier_role, verdict, evidence}`; an explicit refuted list; accepted risks; the state revision.
|
|
73
|
+
- Branching: both ready and MAJOR=0 → release gates: **Phase 8 (red team) → Phase 6 (meta)**; a commit/PR → Phase 7; otherwise → Phase 3.5 (MAJOR verification) → Phases 4/5.
|
|
74
74
|
|
|
75
75
|
### Phase 3.5. Verification of MAJOR findings (cross-verification)
|
|
76
|
-
Every MAJOR finding goes through an independent check
|
|
76
|
+
Every MAJOR finding goes through an independent check in **the opposite role's session** (a sibling auditor, not the author of the finding; the standard pair is `empiric` ↔ `invariant`) — by resuming that session:
|
|
77
77
|
```
|
|
78
78
|
subagent({agent:"<sibling>", sessionID:<session>,
|
|
79
79
|
prompt:"A counterpart's finding <id>: <text>. The author's evidence: <command→output>.
|
|
80
|
-
State revision: <directory hash/commit>. Confirm or refute it by
|
|
81
|
-
|
|
80
|
+
State revision: <directory hash/commit>. Confirm or refute it by reproducing
|
|
81
|
+
it yourself; the default is not confirmed. Return: verdict + evidence."})
|
|
82
82
|
```
|
|
83
83
|
The verifier's response schema (mandatory):
|
|
84
84
|
```
|
|
@@ -89,10 +89,10 @@ Rules:
|
|
|
89
89
|
- `verifier_role` ≠ the role of the finding's author — the verifier is not the one who found it.
|
|
90
90
|
- `partial` and `unavailable` are treated as **"not confirmed"** — the finding does not go into fixes.
|
|
91
91
|
- A verifier failure/timeout → "not confirmed" (`unavailable`) + a record in the audit noise (see §5).
|
|
92
|
-
- Fail-closed: without an explicit confirmation by one's own reproduction the finding is considered **not confirmed**.
|
|
93
|
-
- The state revision is recorded together with the verdict: the verification is valid only for the revision on which it was
|
|
92
|
+
- Fail-closed: without an explicit confirmation by one's own reproduction the finding is considered **not confirmed**. A dispute → Phase 4 (arbiter). The refuted ones (`refuted`) are collected into the summary's refuted list and go into the audit noise.
|
|
93
|
+
- The state revision is recorded together with the verdict: the verification is valid only for the revision on which it was performed (see §7).
|
|
94
94
|
- The verification statuses (`verifier_role` + `verdict` + evidence) are appended to the summary `reports/summary-<id>.md`.
|
|
95
|
-
- Mutual reproduction: if a MAJOR finding is independently reproduced by both roles in their own runs (their own commands, one state revision) — this counts as cross-verification; a separate verifier run is not required, both sides are
|
|
95
|
+
- Mutual reproduction: if a MAJOR finding is independently reproduced by both roles in their own runs (their own commands, one state revision) — this counts as cross-verification; a separate verifier run is not required, both sides are recorded in the summary (`verifier_role` of each role + evidence).
|
|
96
96
|
|
|
97
97
|
### Phase 4. Arbiter (conditional; only on conflicts)
|
|
98
98
|
```
|
|
@@ -100,33 +100,38 @@ subagent({
|
|
|
100
100
|
agent: "arbiter",
|
|
101
101
|
prompt: "Disputed items:
|
|
102
102
|
1) <item> — evidence A: <command→output>; evidence B: <command→output>.
|
|
103
|
-
For each: confirmed/refuted/undecidable + the
|
|
103
|
+
For each: confirmed/refuted/undecidable + the method of checking +
|
|
104
104
|
the prism (reproducibility|contract|falsification|not_applicable;
|
|
105
105
|
for several — an array of prisms). Check nothing beyond this."
|
|
106
106
|
})
|
|
107
107
|
```
|
|
108
|
-
Outcome: confirmed → a fix; refuted → dismiss + a record in the audit noise; undecidable → the owner's decision: the root frames the question, records the risk (`risks-<id>.md`) and escalates.
|
|
108
|
+
Outcome: confirmed → a fix; refuted → dismiss it + a record in the audit noise; undecidable → the owner's decision: the root frames the question, records the risk (`risks-<id>.md`) and escalates.
|
|
109
109
|
|
|
110
110
|
### Phase 5. Fixes and repeat
|
|
111
|
-
- Fixes start only after the summary verdict is recorded (and verification/arbitration
|
|
112
|
-
- Fixes by threshold: micro-fixes (1–3 lines, texts/docs) — the root itself; medium/large ones (multi-file, logic, tests) — the `fix-runner` subagent; a disputed matter
|
|
111
|
+
- Fixes start only after the summary's verdict is recorded (and verification/arbitration has been done). Do not fix before the verdict.
|
|
112
|
+
- Fixes by threshold: micro-fixes (1–3 lines, texts/docs) — the root itself; medium/large ones (multi-file, logic, tests) — the `fix-runner` subagent; a disputed matter is decided by the root before delegation (after the arbiter).
|
|
113
|
+
- Several `fix-runner` instances in parallel — only in separate workspaces, and only when their **file sets** cannot overlap. The rule is unconditional: "one writer per workspace; do not run two writers whose **file sets** may overlap" (even in different workspaces). Non-overlap is counted by files (paths + the search rule for similar places of the class), not by list ids; an overlap of the sets ⇒ serialization of the fixers or splitting the paths.
|
|
114
|
+
- The fixer's workspace is a git worktree **outside the project tree** with its own branch: the main path is `git worktree add -b fix/<round>-<n> <path> <base>`; `worktree_create` — only with an immediate `git switch -c fix/<round>-<n>` (a detached HEAD is unusable for consolidation). Placing the session: `session_move({sessionID, directory})` if the tool is available, otherwise `cd <absolute path>` and absolute paths; if neither is available — a parallel launch is forbidden.
|
|
115
|
+
- Consolidation is strictly **by the full hex SHA** from the report: `commit` is accepted only as a full hex SHA — the check `^[0-9a-f]{40}$` runs BEFORE any git command (`git check-ref-format --branch` is NOT a barrier: a refname admits `; & | > # $()` and backticks; `git rev-parse --verify '<x>^{commit}'` also resolves names). The SHA is passed to commands as a **separate quoted argument** (`git cat-file -t "$sha"`); report strings are never substituted into shell words. Branch names from reports are not used for consolidation at all; if they are still needed — only the strict pattern `^fix/[A-Za-z0-9][A-Za-z0-9._-]*$` + quotes. Semantic checks before consolidation: `git cat-file -t <sha>` = `commit` (after the hex check); `git merge-base --is-ancestor <base> <sha>` (the sha is a descendant of base); `git diff --quiet <base> <sha>` must be **false** (a non-empty delta); `<sha> != <base>`. `Already up to date` (an empty delta) ⇒ the status **`not_consolidated`**, not `closed`; no `commit` or `workspace` in the report ⇒ **`not_closed`** (the root's precondition). Do not merge a branch/commits without a `closed` report; `closed` and the acceptance proof (after/stand) are recorded on the consolidated commit SHA; do not remove the worktree before the commit's transfer is confirmed, afterwards — `git worktree remove --force` and a deliberate decision on the branch. No report arrived (`no_report`: the fixer crashed/timed out) — the root records the work (worktree, branch, base SHA) and `no_report` in the summary; the priority is a resume in the same worktree, otherwise remove the worktree and decide the branch's fate; a partial commit without a report is not merged into the main branch.
|
|
113
116
|
- Calling the fix-runner:
|
|
114
117
|
```
|
|
115
118
|
subagent({agent:"fix-runner", prompt:"To close:\n1) <id | location | mechanism |
|
|
116
119
|
class/area (paths + a search rule for similar places) | repro command (before) |
|
|
117
|
-
acceptance criterion (after) | severity>\nBoundaries: <paths
|
|
118
|
-
|
|
120
|
+
acceptance criterion (after) | severity>\nBoundaries: file set: <paths>; workspace:
|
|
121
|
+
<absolute path of a worktree outside the project tree>; branch: fix/<round>-<n>; base: <sha>;
|
|
122
|
+
budget/limit: <time, number of fixes>; commit: <yes/no, message fix-<round>>.
|
|
123
|
+
Return fix-runner/v1."})
|
|
119
124
|
```
|
|
120
|
-
- The root checks the delta (`git
|
|
121
|
-
- The round's test stand (if the kit ships a verification stand — the
|
|
122
|
-
- **re-audit =
|
|
125
|
+
- The root checks the delta (`git diff <round-base>..HEAD --stat` + a key run) before the re-audit and updates the registry.
|
|
126
|
+
- The round's test stand (if the kit ships a verification stand — the tool `tools/kit-verify` (the verifier) in the kit directory; in rounds on other projects — only if the stand is explicitly included in the call boundaries): baseline → fixes → a repeat run of the stand; the baseline→after delta is attached to the report (the `stand` field). The stand is shipped in the kit's git checkout: the npm package does not ship the `tools/` directory → `stand: unavailable` and your own reproducible checks.
|
|
127
|
+
- **re-audit = resuming the same sessions**:
|
|
123
128
|
```
|
|
124
129
|
subagent({agent:"empiric", sessionID:<emp>, background:true,
|
|
125
130
|
prompt:"Fixes: <range/commits + the actual list of changed files>; closed: <…>. Check the closure of your
|
|
126
|
-
findings and
|
|
131
|
+
findings and that there are no regressions on the new state; return the updated SGR."})
|
|
127
132
|
subagent({agent:"invariant", sessionID:<inv>, background:true, prompt:"… same …"})
|
|
128
133
|
```
|
|
129
|
-
- →
|
|
134
|
+
- → Phase 3. From round 3 on, unresolved items — the arbiter one by one; recurring false findings — close as noise.
|
|
130
135
|
|
|
131
136
|
### Phase 6. Meta-audit (mandatory at the release gates = publication of a release/tag)
|
|
132
137
|
```
|
|
@@ -135,14 +140,14 @@ subagent({
|
|
|
135
140
|
prompt: "Reports: <paths>; summary: <path to summary-<id>.md>. Check the MAJOR
|
|
136
141
|
verification statuses in the summary (verdict + verifier_role); the evidence of every
|
|
137
142
|
finding; the completeness of
|
|
138
|
-
lines/items; whether there is "green tests = checked". Return pass/fail
|
|
143
|
+
lines/items; whether there is any "green tests = checked". Return pass/fail
|
|
139
144
|
per report and the list of non-conformities."
|
|
140
145
|
})
|
|
141
146
|
```
|
|
142
|
-
`meta` → fail: ship is forbidden; a targeted list of non-conformities → fixes/rebuild of the reports →
|
|
147
|
+
`meta` → fail: ship is forbidden; a targeted list of non-conformities → fixes/rebuild of the reports → a repeat of the meta-audit; a repeated fail → escalation to the owner. The meta's verdict carries the only blocking aggregate `gate` (pass|fail; `verdict` is a synonym of `gate`); additionally `closing_list` (ids of red-team findings mandatory for closure) and `coverage_gaps` — what could not be checked. `gate`=pass requires "`closing_list` is empty/closed"; `coverage_gaps` can only be accepted by the owner, with a record in `risks-<id>.md`.
|
|
143
148
|
|
|
144
149
|
### Phase 7. Light exit (commit/PR)
|
|
145
|
-
Condition: all roles ready, MAJOR=0, the risks accepted, **no fixes after the verdict** (otherwise
|
|
150
|
+
Condition: all roles ready, MAJOR=0, the risks accepted, **no fixes after the verdict** (otherwise, a repeat run or an explicit downgrade of the verdict, see §7). The PR carries the line "audit loop: N rounds; verdicts ready; accepted risks: …".
|
|
146
151
|
|
|
147
152
|
### Phase 8. Gates (release)
|
|
148
153
|
- Freeze candidate Xn.
|
|
@@ -152,9 +157,9 @@ subagent({agent:"redteam", background:true,
|
|
|
152
157
|
Falsification mandate: reproduce every claim with your own instruments;
|
|
153
158
|
available data: <corpora/test stands>; generate crafted inputs. Return the SGR."})
|
|
154
159
|
```
|
|
155
|
-
- not_ready → a repeat of Phases 3.5–5 (MAJOR verification + fixes,
|
|
156
|
-
- The red team's MAJOR findings go through the same verification (Phase 3.5): the verifier is the session of the opposite role as directed by the root; a dispute → the arbiter (Phase 4).
|
|
157
|
-
- **Ship condition (
|
|
160
|
+
- not_ready → a repeat of Phases 3.5–5 (MAJOR verification + fixes, with the red team resumed); then Phase 6 (`meta`, see above; without duplicating the rules). The gate verdict carries `closing_list` (ids of findings that must be closed for a pass) and `coverage_gaps` (what could not be checked/attacked).
|
|
161
|
+
- The red team's MAJOR findings go through the same verification (Phase 3.5): the verifier is the session of the opposite role, as directed by the root; a dispute → the arbiter (Phase 4).
|
|
162
|
+
- **Ship condition (the same for all documents):** SHIP ⟺ `meta.gate`=pass ∧ `closing_list` is empty/closed ∧ `coverage_gaps` accepted by the owner (a record in `risks-<id>.md`); otherwise ship is forbidden.
|
|
158
163
|
|
|
159
164
|
## 4. Data transfer
|
|
160
165
|
|
|
@@ -165,7 +170,7 @@ subagent({agent:"redteam", background:true,
|
|
|
165
170
|
| the pair → root | full SGR reports | JSON blocks |
|
|
166
171
|
| root → the arbiter | only disputed items + evidence from both sides | list |
|
|
167
172
|
| root → the verifier | a MAJOR finding (id, text, the author's evidence, the state revision) | text |
|
|
168
|
-
| root → fix-runner | the "to close" list (id, location, class/area, repro command (before), acceptance criterion (after), severity) + boundaries
|
|
173
|
+
| root → fix-runner | the "to close" list (id, location, class/area, repro command (before), acceptance criterion (after), severity) + boundaries (file set, workspace, branch, base) and budget | text |
|
|
169
174
|
| root → re-audit | the fixes delta + the actual list of changed files + the list of what was closed | text |
|
|
170
175
|
| root → redteam | the submission + the summary of all rounds | text |
|
|
171
176
|
| redteam → root | SGR | JSON |
|
|
@@ -174,30 +179,31 @@ subagent({agent:"redteam", background:true,
|
|
|
174
179
|
|
|
175
180
|
### The summary artifact `summary-<id>.md` (in `reports/`)
|
|
176
181
|
|
|
177
|
-
The materialized summary of a round — the input
|
|
182
|
+
The materialized summary of a round — the input to Phase 6 (`meta`) and the anchor tying the verdict to the state. Composition:
|
|
178
183
|
- for every MAJOR — `{id, verifier_role, verdict, evidence}`;
|
|
179
184
|
- the refuted list — an explicit section, even if empty (`verifications: —`);
|
|
180
185
|
- accepted risks (id/gist + a reference to `risks-<id>.md`);
|
|
181
186
|
- the state revision (directory hash/commit) on which the verdicts and the verification were recorded.
|
|
182
187
|
|
|
183
|
-
Writers: Phase 3 creates/updates it; Phase 3.5 appends the verification statuses; Phase 5
|
|
188
|
+
Writers: Phase 3 creates/updates it; Phase 3.5 appends the verification statuses; Phase 5 records the closed/accepted items; the state revision is recorded together with every verdict.
|
|
184
189
|
|
|
185
|
-
Persistence (all kit documents): the SGR reports of all roles, including **the SGR reports of `fix-runner`**, and the summary `summary-<id>.md` are kept in `reports/` (next to `case-<id>.md` and `risks-<id>.md`); the reports are the machine-readable input
|
|
190
|
+
Persistence (all kit documents): the SGR reports of all roles, including **the SGR reports of `fix-runner`**, and the summary `summary-<id>.md` are kept in `reports/` (next to `case-<id>.md` and `risks-<id>.md`); the reports are the machine-readable input to the following phases (meta, the verifier), not just text in the chat.
|
|
186
191
|
|
|
187
192
|
### The `orch_uni_*` tools (if registered by the plugin)
|
|
188
193
|
|
|
189
194
|
- the state revision → `orch_uni_snapshot` (aggregate = the directory hash): recorded together with the verdict and the verification;
|
|
190
|
-
- a role's report → `orch_uni_validate_report` (path or text): `valid=false` → a step defect, resume
|
|
195
|
+
- a role's report → `orch_uni_validate_report` (path or text): `valid=false` → a step defect, resume the same session and demand that the SGR be reissued; do not ignore `warnings`;
|
|
191
196
|
- the roles' sessionIDs, their model and cost → `orch_uni_sessions`;
|
|
192
|
-
- if the tools are unavailable
|
|
197
|
+
- if the tools are unavailable, work manually, as before.
|
|
193
198
|
|
|
194
199
|
## 5. Failures and recovery
|
|
195
200
|
|
|
196
|
-
- A subagent crashed/was interrupted → resume with "continue from where you stopped, do not redo"; on `Agent not found` — check the agent files. Do not mix the sources: agent definitions
|
|
201
|
+
- A subagent crashed/was interrupted → resume with "continue from where you stopped, do not redo"; on `Agent not found` — check the agent files. Do not mix the sources: the agent definitions are in the kit directory (`agents/`); the copies are in your harness's global agents directory (the path depends on the OS) and the harness's project agents directory; configuration snapshot/restore is `tools/config-guard` (the kit's configuration guard, if shipped), not the agents.
|
|
202
|
+
- A repeated fixer launch after an incident in the same space — a resume in the same worktree or an explicit removal/rename of the branch by the root's decision (a repeated `git worktree add -b fix/<round>-<n>` fails while the branch is busy); a `locked` worktree — `git worktree unlock` or `git worktree remove -f -f`.
|
|
197
203
|
- The model/provider is unavailable → wait/switch the model by the owner's decision, keep the sessions.
|
|
198
204
|
- A restricted environment (Code Mode: actions only via `execute`+directory, `subagent` unavailable) → the audit loop does not start; the outcome is "done; the regular audit is deferred" with the revision and the run plan (§8).
|
|
199
205
|
- The `arbiter` is unavailable or its budget is exhausted → the root examines the disputed item one by one on facts/quotes and records it as a risk and escalates to the owner.
|
|
200
|
-
- The MAJOR verifier (Phase 3.5) failed or
|
|
206
|
+
- The MAJOR verifier (Phase 3.5) failed or timed out → the finding is considered **not confirmed** (`unavailable`), does not go into fixes, the fact is recorded in the audit noise.
|
|
201
207
|
- A server restart in the middle of a run → resume by sessionID.
|
|
202
208
|
- No polling: the notifications arrive automatically.
|
|
203
209
|
|
|
@@ -216,20 +222,21 @@ Persistence (all kit documents): the SGR reports of all roles, including **the S
|
|
|
216
222
|
|
|
217
223
|
## 7. Process invariants
|
|
218
224
|
|
|
219
|
-
- The root does not audit and does not substitute for the verdicts;
|
|
225
|
+
- The root does not audit and does not substitute for the verdicts; there is a single writer **per workspace**: the root (micro-fixes) or `fix-runner` (medium/large ones); several `fix-runner` instances — in parallel only in separate worktrees, with the root consolidating afterwards.
|
|
226
|
+
- Do not run two writers whose **file sets** may overlap — unconditionally, regardless of the workspace: non-overlapping "to close" lists do not replace the check of overlapping file sets (paths + the class's search rule).
|
|
220
227
|
- The auditors are read-only; project specifics — only in the brief.
|
|
221
|
-
- Fixes start only after the summary verdict is recorded (and MAJOR verification/arbitration
|
|
228
|
+
- Fixes start only after the summary's verdict is recorded (and MAJOR verification/arbitration has been done). Do not fix before the verdict.
|
|
222
229
|
- MAJOR findings go into fixes only after independent verification (Phase 3.5); the verifier's default is "not confirmed" (fail-closed).
|
|
223
|
-
- Disputed — `arbiter`; the unprovable → the owner's decision: the root frames the question, records the risk and escalates; recurring false
|
|
230
|
+
- Disputed matters — `arbiter`; the unprovable → the owner's decision: the root frames the question, records the risk and escalates; recurring false findings — noise and closure.
|
|
224
231
|
- The verdict and the verification are recorded together with the state revision (directory hash/commit); any fix after the verdict is recorded → a repeat run (re-audit) or an explicit downgrade of the verdict.
|
|
225
|
-
- "Ready" = all findings are closed or explicitly accepted; the loop
|
|
232
|
+
- "Ready" = all findings are closed or explicitly accepted; the loop runs until full ready.
|
|
226
233
|
|
|
227
234
|
## 8. Restricted environments (Code Mode)
|
|
228
235
|
|
|
229
236
|
The session's environment can change in the course of work: direct tools are replaced by a call via `execute`+directory, the `subagent` tool disappears — the audit loop is impossible in such a session.
|
|
230
237
|
|
|
231
|
-
- Preflight: before the audit phase check that `subagent` is available; if not — do not start the loop.
|
|
232
|
-
- The outcome status: "done; the regular audit is deferred".
|
|
238
|
+
- Preflight: before the audit phase, check that `subagent` is available; if not — do not start the loop.
|
|
239
|
+
- The outcome status: "done; the regular audit is deferred". The outcome includes the state revision (commit/directory hash), compensating checks as a list (explicitly as checks), and the run plan in a normal session.
|
|
233
240
|
- Forbidden: passing a self-check/`ai` review off as an independent audit; marking the task as audited; writing "ready".
|
|
234
|
-
- Handoff: the audit on the recorded revision in a normal session; or the roles are launched as separate processes `opencode run --agent <role> "<brief>"` in the project directory (if the environment provides a shell — for example, AetherShell); keep the roles' sessionIDs (Phase 3.5/re-audit).
|
|
241
|
+
- Handoff: the audit is run on the recorded revision in a normal session; or the roles are launched as separate processes `opencode run --agent <role> "<brief>"` in the project directory (if the environment provides a shell — for example, AetherShell); keep the roles' sessionIDs (Phase 3.5/re-audit).
|
|
235
242
|
- If the environment is restored before completion — run the deferred audit and update the verdict.
|
|
@@ -5,7 +5,7 @@ The agents are universal (without project specifics). Definitions: your harness'
|
|
|
5
5
|
|
|
6
6
|
## How to use
|
|
7
7
|
|
|
8
|
-
1. Open a session in the target project's directory — or choose the primary agent `orchestrator` (its audit loop is a built-in mode;
|
|
8
|
+
1. Open a session in the target project's directory — or choose the primary agent `orchestrator` (its audit loop is a built-in mode; you only need to specify the project/change/data/budget).
|
|
9
9
|
2. Copy the prompt below into it and fill in the placeholders:
|
|
10
10
|
- `<PROJECT_PATH>` — the path to the project;
|
|
11
11
|
- `<CHANGE>` — a branch / a commit range / an uncommitted diff;
|
|
@@ -27,7 +27,7 @@ Budget: <BUDGET>
|
|
|
27
27
|
Mode: <MODE>
|
|
28
28
|
|
|
29
29
|
The loop's rules:
|
|
30
|
-
- The auditors are read-only subagents; you make the fixes (micro-fixes) or delegate them to `fix-runner` (medium/large ones). You are the orchestrator: the brief, the launch, the consolidation of the reports, decisions, fixes. You do not audit yourself.
|
|
30
|
+
- The auditors are read-only subagents; you make the fixes (micro-fixes) or delegate them to `fix-runner` (medium/large ones). You are the orchestrator: the brief, the launch, the consolidation of the reports, decisions, fixes. You do not audit yourself. Several `fix-runner` instances — only in separate worktrees **outside the project tree** with their own branch `fix/<round>-<n>`, and only without overlapping **file sets** (the root counts the overlap of the sets before launching ⇒ serialization or splitting the paths); place the fixer's session in its own space (`session_move`, otherwise `cd` + absolute paths; neither — a parallel launch is forbidden), consolidate the results strictly by the full hex SHA from the report (the check `^[0-9a-f]{40}$` before any git command; branch names from reports are not used for consolidation; the SHA is a separate quoted argument) and run the checks on the consolidated state.
|
|
31
31
|
- Communication — via the brief file and SGR reports. Do NOT poll background subagents: the notifications arrive on their own.
|
|
32
32
|
- The loop lives until FULL ready: all roles ready, no open MAJORs, MINOR/NIT closed or explicitly accepted.
|
|
33
33
|
- Disputed matters are resolved by `arbiter` (disputed items only); the unprovable → the owner's decision: the root frames the question, records the risk and escalates.
|
|
@@ -43,22 +43,22 @@ Steps:
|
|
|
43
43
|
subagent(agent="empiric", background=true, prompt="Brief <path>. FACT-CHECK:\n<block>. Do your role; return the SGR.")
|
|
44
44
|
subagent(agent="invariant", background=true, prompt="Brief <path>. FACT-CHECK:\n<block>. Do your role; return the SGR.")
|
|
45
45
|
Save both sessionIDs from the responses.
|
|
46
|
-
3) Summary: parse the SGRs (verdicts, open MAJORs, conflicts by
|
|
46
|
+
3) Summary: parse the SGRs (verdicts, open MAJORs, conflicts by location/class); materialize the summary `reports/summary-<id>.md` (for every MAJOR — id, verifier_role, verdict, evidence; the refuted list; accepted risks; the state revision).
|
|
47
47
|
4) Verification of MAJORs (cross-verification, fail-closed): every MAJOR finding is confirmed by the session of the opposite role (not by the author of the finding) —
|
|
48
|
-
subagent(agent="<sibling>", sessionID="<session of the opposite role>", prompt="A counterpart's finding <id>: <text>. The author's evidence: <command→output>. State revision: <directory hash/commit>. Confirm or refute it by
|
|
49
|
-
partial/unavailable = "not confirmed"; a verifier failure/timeout — the same + noise. The refuted ones — into the refuted list; write the statuses into the summary reports/summary-<id>.md
|
|
50
|
-
Conflicts → subagent(agent="arbiter", prompt="Disputed items: <item → evidence A → evidence B>. For each: confirmed/refuted/undecidable + the prism (reproducibility|contract|falsification|not_applicable; for several — an array) + the
|
|
48
|
+
subagent(agent="<sibling>", sessionID="<session of the opposite role>", prompt="A counterpart's finding <id>: <text>. The author's evidence: <command→output>. State revision: <directory hash/commit>. Confirm or refute it by reproducing it yourself; the default is not confirmed. Return: {id, verifier_role, verdict: confirmed|refuted|partial|unavailable, evidence}.")
|
|
49
|
+
partial/unavailable = "not confirmed"; a verifier failure/timeout — the same + noise. The refuted ones — into the refuted list; write the statuses into the summary `reports/summary-<id>.md`; an unconfirmed MAJOR does not go into fixes.
|
|
50
|
+
Conflicts → subagent(agent="arbiter", prompt="Disputed items: <item → evidence A → evidence B>. For each: confirmed/refuted/undecidable + the prism (reproducibility|contract|falsification|not_applicable; for several — an array) + the method of checking. Only these items.")
|
|
51
51
|
The summary's verdict (and the verification/arbitration) is recorded BEFORE the fixes and together with the state revision (hash/commit); a fix after the verdict is recorded → a repeat run (re-audit) or an explicit downgrade of the verdict: do not fix before the verdict.
|
|
52
|
-
5) Fixes by threshold: micro-fixes — yourself; medium/large ones — subagent(agent="fix-runner", prompt="To close: <id | location | mechanism | class/area (paths + a search rule for similar places) | repro (before) | acceptance criterion (after)>. Boundaries:
|
|
53
|
-
6) Re-audit —
|
|
52
|
+
5) Fixes by threshold: micro-fixes — yourself; medium/large ones — subagent(agent="fix-runner", prompt="To close: <id | location | mechanism | class/area (paths + a search rule for similar places) | repro (before) | acceptance criterion (after)>. Boundaries: file set: <paths>; workspace: <absolute path of a worktree outside the project tree>; branch: fix/<round>-<n>; base: <sha>; budget/limit: <time, number of fixes>; commit fix-<round>. Return fix-runner/v1."). Before the re-audit check the delta (git diff <round-base>..HEAD --stat + a key run) and the consolidation by the full hex SHA (^[0-9a-f]{40}$ before any git command + git cat-file -t <sha> = commit, git merge-base --is-ancestor <base> <sha>, a non-empty delta: git diff --quiet <base> <sha> false; an empty delta / Already up to date ⇒ not_consolidated, not closed); update risks.md (closed / accepted-risk with a reason).
|
|
53
|
+
6) Re-audit — resuming the SAME sessions (background, one block):
|
|
54
54
|
subagent(agent="empiric", sessionID="<emp>", background=true, prompt="Fixes: <range + the actual list of changed files>; closed: <…>. Check the closure of your findings and the absence of regressions on the new state; return the updated SGR.")
|
|
55
55
|
subagent(agent="invariant", sessionID="<inv>", background=true, prompt="… same …")
|
|
56
|
-
7) Repeat steps 3–6 until full ready is reached (the number of rounds is unlimited). From round 3 on, unresolved items — the arbiter one by one; recurring false ones — dismiss and record
|
|
56
|
+
7) Repeat steps 3–6 until full ready is reached (the number of rounds is unlimited). From round 3 on, unresolved items — the arbiter one by one; recurring false ones — dismiss and record in the audit noise.
|
|
57
57
|
8) Release mode (the gates; order: red team → meta): freeze the candidate →
|
|
58
58
|
subagent(agent="redteam", background=true, prompt="Brief <path>. The author's submission: <…>. The summary of previous rounds: <…>. Falsification mandate: reproduce every claim with your own instruments; available data: <…>; generate crafted inputs. Return the SGR.")
|
|
59
|
-
→ the same loop (fixes; the red team's MAJOR findings — with verification by the session of the opposite role as directed by the root; a dispute → `arbiter`) with the red team
|
|
59
|
+
→ the same loop (fixes; the red team's MAJOR findings — with verification by the session of the opposite role as directed by the root; a dispute → `arbiter`) with the red team resumed until it is ready → subagent(agent="meta", prompt="Reports: <paths>; summary: <path to summary-<id>.md>. Check the MAJOR verification statuses in the summary (verdict + verifier_role); the evidence of every finding; the completeness of the self-checks, the absence of "green tests = checked". Return pass/fail.") → a check of the SHIP condition (below); ship only when it holds.
|
|
60
60
|
SHIP ⟺ meta.gate=pass ∧ closing_list is empty/closed ∧ coverage_gaps accepted by the owner (a record in risks.md). In all other cases ship is forbidden.
|
|
61
|
-
9) Final: a
|
|
61
|
+
9) Final: a round-by-round summary (the verdicts, what was closed, the accepted risks); save the reports in `reports/` of the audit's working directory.
|
|
62
62
|
|
|
63
63
|
Brief template `case.md`:
|
|
64
64
|
# Audit <id>: <name>
|
|
@@ -77,5 +77,5 @@ If a subagent is unavailable ("Agent not found"): check the agent files in your
|
|
|
77
77
|
- The fact-check ran and either dismissed the stale task or gave a block for the pair.
|
|
78
78
|
- The pair produced SGR reports; the conflicts (if any) were resolved by the arbiter.
|
|
79
79
|
- The loop reached full ready (all verdicts ready; no open MAJORs).
|
|
80
|
-
- `reports\` holds all the reports and the summary `summary-<id>.md
|
|
80
|
+
- `reports\` holds all the reports and the summary `summary-<id>.md`; `risks.md` holds the accepted risks.
|
|
81
81
|
- No agent changed the project (check the target project's `git status`).
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Rule: the audit is considered complete only when **all roles** have issued `verdict=ready` and all findings are processed. No "stops after N rounds": the loop runs to full ready; when it does not converge — escalation, not endless repeats on the same state.
|
|
4
4
|
|
|
5
|
-
Numbering: "[N]" — the steps of this document (`process-ready-loop.md`); "Phase N" — the phases of `call-mechanics.md`. Cross-document references
|
|
5
|
+
Numbering: "[N]" — the steps of this document (`process-ready-loop.md`); "Phase N" — the phases of `call-mechanics.md`. Cross-document references name their namespace explicitly.
|
|
6
6
|
|
|
7
7
|
## Tree
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
[0] FACT-CHECKER (the
|
|
10
|
+
[0] FACT-CHECKER (the freshness of premises/issues/PRs)
|
|
11
11
|
│
|
|
12
12
|
├─ the task is stale/done → STOP (revise the task)
|
|
13
13
|
▼
|
|
@@ -16,12 +16,14 @@ Numbering: "[N]" — the steps of this document (`process-ready-loop.md`); "Phas
|
|
|
16
16
|
▼
|
|
17
17
|
VERDICT: all ready and no open MAJORs?
|
|
18
18
|
├─ YES ──► for the release gates: [4] RED TEAM → [5] META
|
|
19
|
-
│ (input of [5]: the pair's reports + the red team's report + the summary reports/summary-<id>.md)
|
|
19
|
+
│ (input of [5]: the pair's reports + the red team's report + the summary `reports/summary-<id>.md`)
|
|
20
20
|
│ ├─ SHIP ⟺ `meta.gate`=pass ∧ closing_list is empty/closed ∧ coverage_gaps accepted by the owner (a record in risks-<id>.md)
|
|
21
21
|
│ ├─ otherwise ship is forbidden; a targeted list of non-conformities → fixes/rebuild of the reports → another meta pass; a repeated fail → escalation to the owner
|
|
22
22
|
│ for a commit/PR: SHIP if there were no fixes after the verdict (the red team and meta are not mandatory)
|
|
23
23
|
└─ NO ─► [2] FIXES (close the MAJORs; MINOR/NIT — close or explicitly accept with a rationale, a record in risks-<id>.md)
|
|
24
24
|
▼
|
|
25
|
+
[2a] CONSOLIDATION (if there were several fixers: merge the branches by commit SHA → checks on the consolidated state)
|
|
26
|
+
▼
|
|
25
27
|
[3] NEW STATE X1 (the fixes are committed/recorded)
|
|
26
28
|
▼
|
|
27
29
|
repeat [1] on X1 (both auditors, the same brief)
|
|
@@ -39,7 +41,7 @@ At the release gates the loop is the same, plus after the first full ready — t
|
|
|
39
41
|
1. All roles (the empiric, the invariant; at the gates — the red team as well) — `verdict=ready`.
|
|
40
42
|
2. No open MAJORs. MINOR/NIT: closed or **explicitly accepted** with a reason (a record in `risks-<id>.md`; in the summary/PR: "accepted as debt: …").
|
|
41
43
|
3. All discrepancies are resolved by the arbiter; the unprovable → the owner's decision: the root frames the question, records the risk and escalates.
|
|
42
|
-
4. The repeat run
|
|
44
|
+
4. The repeat run is based **on the state after the fixes**, not on the old diff. No "re-votings" on the same snapshot. With several fixers, X1 is reached by consolidating their branches by commit SHA and by checks on the consolidated state; `closed` is recorded after consolidation.
|
|
43
45
|
5. At the release gates — `meta` = pass (`gate`=pass), `closing_list` is empty/closed, `coverage_gaps` accepted by the owner (a record in `risks-<id>.md`). **SHIP ⟺ `meta.gate`=pass ∧ `closing_list` is empty/closed ∧ `coverage_gaps` accepted by the owner (a record in `risks-<id>.md`); otherwise ship is forbidden.**
|
|
44
46
|
6. MAJOR findings go into fixes only after independent verification; the verifier's default is "not confirmed" (fail-closed).
|
|
45
47
|
7. The verdict and the verification are recorded together with the state revision (directory hash/commit); any fix after the verdict is recorded → a repeat run (re-audit) or an explicit downgrade of the verdict.
|
|
@@ -50,7 +52,7 @@ At the release gates the loop is the same, plus after the first full ready — t
|
|
|
50
52
|
- "refuted" — the finding is dismissed, recorded as a false positive of the auditor (noise data for calibration);
|
|
51
53
|
- "undecidable" — the owner's decision: the root frames the question, records the risk and escalates;
|
|
52
54
|
- "confirmed" — a mandatory fix, the loop continues.
|
|
53
|
-
- A sign of a
|
|
55
|
+
- A sign of a pointless continuation: the same false/undecidable findings repeat without new facts. This is not "not ready", this is an audit defect — record it and close it.
|
|
54
56
|
|
|
55
57
|
## Loop data (per round)
|
|
56
58
|
|
|
@@ -61,6 +63,6 @@ At the release gates the loop is the same, plus after the first full ready — t
|
|
|
61
63
|
|
|
62
64
|
## Notes
|
|
63
65
|
|
|
64
|
-
- "Ready" is not "zero findings" but "all findings are processed": closed or
|
|
65
|
-
- The
|
|
66
|
-
- History confirms the model: PR #37 (bsl-context) — the pair
|
|
66
|
+
- "Ready" is not "zero findings" but "all findings are processed": closed or knowingly accepted.
|
|
67
|
+
- The loop itself accounts for the variance of single runs: the next round gives a new sample; hence the loop to convergence, not "a single run in a cage".
|
|
68
|
+
- History confirms the model: PR #37 (bsl-context) — the pair issued ready with caveats, acceptance found 8 defects, after the fixes and a re-acceptance — v0.22.0 and full ready.
|
package/docs/en/root-runbook.md
CHANGED
|
@@ -21,17 +21,17 @@ A "Fact-check (pre-pass): …" block is added to the pair's prompts — 5–15 l
|
|
|
21
21
|
## Call checklist (order)
|
|
22
22
|
|
|
23
23
|
1. **Fact-check**: `subagent(agent="factcheck", prompt="<brief> + check the theses against live reality: git/upstream issues/PRs/code; what is stale, what is already done, which promises have diverged")`.
|
|
24
|
-
- If "stale/already done" → **STOP** and revise the task (the cheapest saving).
|
|
24
|
+
- If "stale/already done" → **STOP** and revise the task (the cheapest possible saving).
|
|
25
25
|
2. **The pair in parallel**: `subagent(agent="empiric", background=true, prompt="<brief> + the fact-check block")` and the same for `invariant`. Do not poll — wait for notifications.
|
|
26
|
-
3. **Summary by the root**: parse the JSON blocks;
|
|
27
|
-
4. **Verification of MAJORs (cross-verification, fail-closed)**: every MAJOR finding is confirmed independently by **the session of the opposite role** (not by the author of the finding) — `subagent(agent="<sibling>", sessionID=<session of the opposite role>, prompt="A counterpart's finding <id>: <text>. The author's evidence: <command→output>. State revision: <directory hash/commit>. Confirm or refute it by
|
|
26
|
+
3. **Summary by the root**: parse the JSON blocks; determine the verdicts (ready/not_ready), open MAJORs, intersections and discrepancies (by location+mechanism). Materialize the summary artifact `reports/summary-<id>.md` (definition — `call-mechanics.md` §4): for every MAJOR — {id, verifier_role, verdict, evidence}; the refuted list (explicit, even if empty); accepted risks; the state revision (directory hash/commit).
|
|
27
|
+
4. **Verification of MAJORs (cross-verification, fail-closed)**: every MAJOR finding is confirmed independently by **the session of the opposite role** (not by the author of the finding) — `subagent(agent="<sibling>", sessionID=<session of the opposite role>, prompt="A counterpart's finding <id>: <text>. The author's evidence: <command→output>. State revision: <directory hash/commit>. Confirm or refute it by reproducing it yourself; the default is not confirmed. Return: {id, verifier_role, verdict: confirmed|refuted|partial|unavailable, evidence}.")`. `verifier_role` ≠ the author's role; `partial`/`unavailable` = "not confirmed"; `refuted` — into the refuted list for the summary; a verifier failure/timeout — "not confirmed" + noise. Not confirmed → it does not go into fixes (a dispute → step 5, the arbiter); the verification statuses are written to the summary `reports/summary-<id>.md` (step 3). If a MAJOR finding is independently reproduced by both roles in their own runs — the mutual confirmation counts as verification (both sides are recorded in the summary), a separate run is not required. The sessionID in the call is mandatory: without it this is a new session, not a continuation — a step defect.
|
|
28
28
|
5. **The arbiter — only on discrepancies**: `subagent(agent="arbiter", prompt="Disputed items: <item → evidence A → evidence B>. For each: confirmed/refuted/undecidable + a command/quote.")`. The summary's verdict (and the verification/arbitration) is recorded BEFORE the fixes and **together with the state revision** (directory hash/commit); any fix after the verdict is recorded → a repeat run (re-audit) or an explicit downgrade of the verdict: do not fix before the verdict.
|
|
29
|
-
6. **Fixes** by threshold: micro — the root itself; medium/large ones — `fix-runner` (input: the "to close" list — id, location, mechanism, **class/area** (paths + a search rule for similar places), repro (before), acceptance criterion (after), severity — plus the boundaries and the **budget/limit (time, number of fixes)**; output: fix-runner/v1 with before/after/`proof`/tests). Separate commits `fix-<round>`; update the registry: `closed` / `accepted-risk` (with a reason). The root checks the delta before the re-audit. The round's test stand (if the kit ships a verification stand — the
|
|
30
|
-
7. **Re-audit =
|
|
31
|
-
8. **Repeat steps 3–7 until full ready is reached** (the number of rounds is unlimited; all roles ready, MAJOR=0). From round 3 on, unresolved items — the arbiter one by one; recurring false ones — dismiss and record
|
|
29
|
+
6. **Fixes** by threshold: micro-fixes — the root itself; medium/large ones — `fix-runner` (input: the "to close" list — id, location, mechanism, **class/area** (paths + a search rule for similar places), repro (before), acceptance criterion (after), severity — plus the boundaries and the **budget/limit (time, number of fixes)**; output: fix-runner/v1 with before/after/`proof`/tests). Separate commits `fix-<round>`; update the registry: `closed` / `accepted-risk` (with a reason). The root checks the round's delta — `git diff <round-base>..HEAD --stat` (not only `git show --stat`) — before the re-audit. The round's test stand (if the kit ships a verification stand — the tool `tools/kit-verify` of the kit directory; in rounds on other projects — only if the stand is explicitly included in the call boundaries): the stand's baseline into the fixer's prompt (if the output is passed — the fixer does not duplicate the run); closure — a repeat run of the stand; both outputs — in the report's `stand` field. The stand is shipped in the kit's git checkout: the npm package does not ship the `tools/` directory → `stand: unavailable` and your own reproducible checks. `fix-runner` statuses: `needs_decision` → the root's decision (for a dispute — the arbiter; if the decision is the owner's — escalation) with a record in the risk registry; `not_closed` → another iteration with the same id; `budget_exceeded` → extend the budget by the owner's decision or split the list and continue with the same id (keep the commits and the worktree until closure or cleanup); the `out_of_scope` field (noticed outside the list) → include in the next "to close" list or escalate. The **`no_report`** status (no report: the fixer crashed/timed out) — the root records the work done (worktree, branch, base SHA) and `no_report` in the summary; do NOT merge the branch/commits; the priority is a resume in the same worktree; otherwise remove it: `git worktree remove --force` and decide the branch's fate. A partial commit without a report is not merged into the main branch. Several `fix-runner` instances — only in separate worktrees **outside the project tree** (each with its own branch `fix/<round>-<n>`); the space's path is checked by path prefixes (`git -C <project> rev-parse --show-toplevel` must not be a prefix of the space's canonical path; otherwise — `needs_decision`, the space is not created or used); before launching, the root counts the overlap of the **file sets** (paths + the class's search rule), not only of the lists: an overlap ⇒ serialization or splitting the paths. Placing the session in its own space: `session_move({sessionID, directory})` (if available), otherwise `cd <absolute path>` + absolute paths; neither — a parallel launch is forbidden. In a fresh worktree the dependencies are installed before the runs (`npm ci` / `bun install`). Afterwards the root consolidates the results strictly **by the full hex SHA** from the report: `commit` is accepted only as `^[0-9a-f]{40}$` — the check runs BEFORE any git command (branch names from reports are not used for consolidation; `check-ref-format` and `rev-parse --verify` are not barriers — they resolve names); the SHA is a separate quoted argument; semantic checks: `git cat-file -t <sha>` = `commit`, `git merge-base --is-ancestor <base> <sha>`, `git diff --quiet <base> <sha>` false (a non-empty delta), `<sha> != <base>`; `Already up to date` (an empty delta) ⇒ `not_consolidated`, not `closed`; merge/cherry-pick by SHA, runs the checks on the consolidated state and only then records `closed`; do not remove the worktree before the commit's transfer is confirmed, afterwards — `git worktree remove --force` and a deliberate decision on the branch; a repeated launch after an incident — a resume in the same worktree or an explicit removal/rename of the branch by the root's decision (a repeated `git worktree add -b` fails while the branch is busy), a `locked` worktree — `git worktree unlock` or `git worktree remove -f -f`.
|
|
30
|
+
7. **Re-audit = resuming the same sessions** (the sessionID from step 2): "Fixes: <range + the actual list of changed files>. Check the closure of your findings and the absence of regressions; return the updated SGR." — historically, that is how it was done (a continuation of the GLM/DS sessions). The sessionID is mandatory: a call without it (a new session instead of a continuation) — a step defect. Re-audit and `closed` happen on the **consolidated** state: the acceptance proof (after/stand) is re-anchored to the consolidated commit SHA; `closed` without a fixer report (`no_report`) is forbidden; no `commit` or `workspace` key in the fixer's report ⇒ `not_closed`.
|
|
31
|
+
8. **Repeat steps 3–7 until full ready is reached** (the number of rounds is unlimited; all roles ready, MAJOR=0). From round 3 on, unresolved items — the arbiter one by one; recurring false ones — dismiss and record in the audit noise.
|
|
32
32
|
9. **Gates (release; order: red team → meta)**: a frozen commit → `redteam` (the falsification mandate + corpora/test stands) → a loop over its findings (MAJORs — with verification by the session of the opposite role) → `meta` (input: the reports + the summary `reports/summary-<id>.md`; evidence, completeness, the absence of "green tests = checked").
|
|
33
33
|
- **SHIP ⟺ `meta.gate`=pass ∧ `closing_list` is empty/closed ∧ `coverage_gaps` accepted by the owner (a record in `risks-<id>.md`); otherwise ship is forbidden.**
|
|
34
|
-
- `meta` → fail: ship is forbidden; a targeted list of non-conformities → fixes/rebuild of the reports → another meta pass; a repeated fail → escalation to the owner. Ship — only after the meta's pass and
|
|
34
|
+
- `meta` → fail: ship is forbidden; a targeted list of non-conformities → fixes/rebuild of the reports → another meta pass; a repeated fail → escalation to the owner. Ship — only after the meta's pass and once the ship condition above is met.
|
|
35
35
|
|
|
36
36
|
## Data transfer between nodes
|
|
37
37
|
|
|
@@ -41,14 +41,14 @@ A "Fact-check (pre-pass): …" block is added to the pair's prompts — 5–15 l
|
|
|
41
41
|
- the root → re-audit: the fixes range + a brief "what was closed";
|
|
42
42
|
- the root → the red team: the author's submission + the summary of all previous rounds (the object of falsification);
|
|
43
43
|
- the root → meta: the reports (paths) + the summary `reports/summary-<id>.md`;
|
|
44
|
-
- the root → fix-runner: the "to close" list (with the class/area) + boundaries + budget/limit (time, number of fixes)
|
|
44
|
+
- the root → fix-runner: the "to close" list (with the class/area) + boundaries (including the **file set**, the worktree outside the project tree, the branch `fix/<round>-<n>`, the base SHA) + budget/limit (time, number of fixes); for a parallel launch — a separate space and branch per fixer, and the root checks the file sets for overlap before launching;
|
|
45
45
|
|
|
46
46
|
## Subtleties
|
|
47
47
|
|
|
48
|
-
- The `orch_uni_*` tools (if registered by the plugin): the state revision — `orch_uni_snapshot` (aggregate), an SGR report check — `orch_uni_validate_report` (invalid → resume
|
|
49
|
-
- The brief and the risk registry — as files; the subagents return the reports
|
|
50
|
-
- "Blind" runs — a sandbox without git history (without fix commits); re-audit —
|
|
51
|
-
- The root's verdict does not substitute for the auditors' verdicts:
|
|
48
|
+
- The `orch_uni_*` tools (if registered by the plugin): the state revision — `orch_uni_snapshot` (aggregate), an SGR report check — `orch_uni_validate_report` (invalid → resume the session and demand that the SGR be reissued), the roles' sessionID/model/cost — `orch_uni_sessions`; otherwise — manually, as before.
|
|
49
|
+
- The brief and the risk registry — as files; the subagents return the reports to the chat (the `edit deny` rule in `permissions`; `shell` is allowed), the root itself saves what is needed.
|
|
50
|
+
- "Blind" runs — a sandbox without git history (without fix commits); re-audit — by contrast, the fixes delta is shown.
|
|
51
|
+
- The root's verdict does not substitute for the auditors' verdicts: until both roles are ready, the loop lives (plus the escalation rules from `process-ready-loop.md`).
|
|
52
52
|
- Timings are approximate: fact-check ~1–2 min, the pair ~5–10 min, the arbiter ~1–3 min per item, the red team — hours (the gates only).
|
|
53
53
|
- Universality: both auditors and the types being added carry no project specifics; all project specifics — in the briefs and reference materials.
|
|
54
54
|
- **Environment preflight (Code Mode)**: if `subagent` is unavailable — the loop does not start; the outcome is "done; the regular audit is deferred" (the revision + compensating checks + the run plan), details — `call-mechanics.md` §8.
|