@mmerterden/multi-agent-pipeline 23.5.0 → 23.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +7 -6
  3. package/README.tr.md +7 -6
  4. package/docs/architecture.md +8 -6
  5. package/docs/ecosystem.md +15 -15
  6. package/docs/engineering.md +1 -1
  7. package/docs/facts.json +11 -10
  8. package/docs/features.md +1 -1
  9. package/package.json +1 -1
  10. package/pipeline/commands/multi-agent/SKILL.md +3 -2
  11. package/pipeline/commands/multi-agent/resume/SKILL.md +2 -0
  12. package/pipeline/commands/multi-agent/review-rounds/SKILL.md +94 -0
  13. package/pipeline/commands/multi-agent/sync/SKILL.md +3 -3
  14. package/pipeline/lib/usage-names.generated.mjs +12 -0
  15. package/pipeline/multi-agent-refs/_input-parser.md +1 -1
  16. package/pipeline/multi-agent-refs/component-dispatch.md +2 -2
  17. package/pipeline/multi-agent-refs/cross-cli-contract.md +3 -3
  18. package/pipeline/multi-agent-refs/features/autopilot-circuit-breaker.md +4 -4
  19. package/pipeline/multi-agent-refs/features/review-delta.md +1 -1
  20. package/pipeline/multi-agent-refs/features/review-rounds.md +40 -0
  21. package/pipeline/multi-agent-refs/features/rework-escalation.md +5 -4
  22. package/pipeline/multi-agent-refs/features/usage-reporting.md +1 -1
  23. package/pipeline/multi-agent-refs/help/en.md +4 -2
  24. package/pipeline/multi-agent-refs/help/tr.md +4 -2
  25. package/pipeline/multi-agent-refs/orchestrator/copilot-pipeline.md +1 -1
  26. package/pipeline/multi-agent-refs/outside-the-pipeline.md +2 -1
  27. package/pipeline/multi-agent-refs/phases/operations.md +1 -1
  28. package/pipeline/multi-agent-refs/phases/phase-0-init.md +1 -1
  29. package/pipeline/multi-agent-refs/phases/phase-2-dev.md +4 -4
  30. package/pipeline/multi-agent-refs/phases/phase-3-review.md +7 -3
  31. package/pipeline/multi-agent-refs/resume/details.md +2 -0
  32. package/pipeline/multi-agent-refs/toolkit-tools.md +1 -0
  33. package/pipeline/office/index.html +2 -2
  34. package/pipeline/office/toolkit.json +1 -1
  35. package/pipeline/rules/outside-the-pipeline.md +1 -1
  36. package/pipeline/schemas/agent-state.schema.json +19 -1
  37. package/pipeline/schemas/phases.json +2 -2
  38. package/pipeline/schemas/prefs.schema.json +15 -3
  39. package/pipeline/schemas/token-budget.json +2 -2
  40. package/pipeline/schemas/toolkit-path-params.json +40 -1
  41. package/pipeline/scripts/_stack-routing.mjs +1 -0
  42. package/pipeline/scripts/gen-facts.mjs +9 -4
  43. package/pipeline/scripts/health-report.mjs +35 -8
  44. package/pipeline/scripts/review-rounds.mjs +592 -0
  45. package/pipeline/scripts/rework-escalation.mjs +7 -3
  46. package/pipeline/scripts/usage-health.mjs +10 -1
  47. package/pipeline/scripts/validate-state.mjs +19 -11
  48. package/pipeline/skills/.skill-manifest.json +13 -5
  49. package/pipeline/skills/.skills-index.json +23 -1
  50. package/pipeline/skills/shared/README.md +7 -5
  51. package/pipeline/skills/shared/core/multi-agent/SKILL.md +3 -3
  52. package/pipeline/skills/shared/core/multi-agent-resume/SKILL.md +1 -1
  53. package/pipeline/skills/shared/core/multi-agent-review-rounds/SKILL.md +92 -0
  54. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +3 -3
  55. package/pipeline/skills/shared/external/ink-animation/SKILL.md +230 -0
  56. package/pipeline/skills/shared/external/ink-animation/evals/evals.json +41 -0
  57. package/pipeline/skills/skills-index.md +3 -1
  58. package/manifest.json +0 -2056
@@ -36,7 +36,7 @@ double quotes and unescape, then classify the value.
36
36
  `freetext`, and a structured token inside a sentence stays free text:
37
37
  `"PROJ-1 crashes on login"` is a task description, never an issue fetch.
38
38
  - **The closing quote** is the first `"` that is not escaped. Everything after
39
- it is modifiers: `autopilot`, `--loop N`, and the branch name that may follow
39
+ it is modifiers: `autopilot`, `--loop N`, `--review-rounds N` (1 to 3; `review-rounds.mjs parse` reads it), and the branch name that may follow
40
40
  a Jira key (`"PROJ-1" "feature/PROJ-1-desc"`). A quoted branch name is
41
41
  unquoted and unescaped the same way: strip its surrounding double quotes,
42
42
  `\"` becomes `"`, and `\\` becomes `\` before a quote or at the end. A word
@@ -114,9 +114,9 @@ Multi-agent does **not** split the component task into per-repo Phase 2 runs -
114
114
  On failure (the plugin skill returns an unrecoverable build/test error, or the dispatch hits retry cap):
115
115
 
116
116
  1. The dispatch layer persists `{error, buildLog, testLog}` to `state.phases["2"].errors[]`.
117
- 2. Multi-agent increments `state.phases["2"].retryCount`.
117
+ 2. Multi-agent increments `state.phases["2"].retryCount` (the build-retry counter; review reworks are counted separately in `reworkCount`).
118
118
  3. Retry re-invokes the plugin skill (it is idempotent on an existing component; it reconciles rather than duplicating). There is no bundled `phase-<N>` resume anymore.
119
- 4. Hard kill at `retryCount === 3` → surface the errors to the user, halt Phase 2. Do not loop indefinitely.
119
+ 4. Hard kill when `retryCount` reaches the build-retry cap (3, unrelated to the review limit) → surface the errors to the user, halt Phase 2. Do not loop indefinitely.
120
120
 
121
121
  ## Cross-CLI behaviour (intentional divergence)
122
122
 
@@ -1,7 +1,7 @@
1
1
  # Cross-CLI Contract (Claude Code · Copilot CLI · Codex CLI)
2
2
 
3
3
  <!-- toc -->
4
- - [1. Command Inventory (80 commands)](#1-command-inventory-80-commands)
4
+ - [1. Command Inventory (81 commands)](#1-command-inventory-81-commands)
5
5
  - [2. Canonical Placeholder Vocabulary](#2-canonical-placeholder-vocabulary)
6
6
  - [2.6 Intentional structural divergence - two entry files over one set of refs](#26-intentional-structural-divergence---two-entry-files-over-one-set-of-refs)
7
7
  - [2.7 One switch, three different meanings: `fable-on` / `fable-off`](#27-one-switch-three-different-meanings-fable-on-fable-off)
@@ -20,7 +20,7 @@
20
20
 
21
21
  ---
22
22
 
23
- ## 1. Command Inventory (80 commands)
23
+ ## 1. Command Inventory (81 commands)
24
24
 
25
25
  ```
26
26
  address-review, analysis, analysis-jira, analysis-resolve, autopilot-off,
@@ -31,7 +31,7 @@ garbage-collect, graph, health, help, ios-coding-standard, issue, jira, kill,
31
31
  language, log, manual-test, office-off, office-on, office-status, pair,
32
32
  postmortem, prune-logs,
33
33
  prune-prompts, purge, refactor, research, resume, review,
34
- review-analysis, review-issue, review-jira, review-priority, route-off, route-on,
34
+ review-analysis, review-issue, review-jira, review-priority, review-rounds, route-off, route-on,
35
35
  route-status, routines, routines-browse, routines-delete, routines-import,
36
36
  routines-share, routines-update, save, scaffold, scan, scenario-audit, search,
37
37
  security-review, serve, setup, stack, status, steer, store-ready, sync, test, test-accessibility,
@@ -11,7 +11,7 @@
11
11
 
12
12
  **Pattern**: autopilot runs with zero interaction, which is exactly when a silent failure loop is most expensive - an agent can burn a budget re-attempting the same broken fix, or thrash between two phases, with nobody watching. A circuit-breaker converts "keep going no matter what" into "keep going until a defined unsafe condition, then halt and hand back to the user." This is the sanctioned autopilot pause (same class as the Phase 5 channels pause): the run stops, records why, and waits for an explicit `resume`.
13
13
 
14
- **Gated by `prefs.global.autopilotCircuitBreaker`** (`enabled` default true, `identicalFindingCycles` default 2, `maxReworkCycles` default 3; `schemas/prefs.schema.json`). Halting is always safe, so the breaker itself defaults on. Disable per-run only with an explicit override. Complements, does not replace, the existing autopilot safety rules (build-fail max 3 retries, Phase 4 blocking-finding rework, destructive-op confirmations).
14
+ **Gated by `prefs.global.autopilotCircuitBreaker`** (`enabled` default true, `identicalFindingCycles` default 2, `maxReworkCycles` optional, no default; `schemas/prefs.schema.json`). Halting is always safe, so the breaker itself defaults on. Disable per-run only with an explicit override. Complements, does not replace, the existing autopilot safety rules (build-fail max 3 retries, Phase 4 blocking-finding rework, destructive-op confirmations).
15
15
 
16
16
  ## Trip conditions
17
17
 
@@ -19,9 +19,9 @@ Any one trips the breaker. All are evaluated from `agent-state.json` + telemetry
19
19
 
20
20
  | # | Trigger | Detection | Default threshold |
21
21
  |---|---|---|---|
22
- | 1 | **No-progress stall** | two consecutive phase checkpoints with no forward transition (same `phase` + `step` + `reworkCount`, no new artifact/commit) | 2 checkpoints |
22
+ | 1 | **No-progress stall** | two consecutive phase checkpoints with no forward transition (same `phase` + `step` + `phases["2"].reworkCount`, no new artifact/commit) | 2 checkpoints |
23
23
  | 2 | **Identical repeated failure** | same normalized build-error signature, or the same Phase 4 finding fingerprint, recurs across consecutive Phase 3 rework cycles | 2 cycles |
24
- | 3 | **Rework storm** | Phase 4 -> Phase 3 rework cycles exceed the cap (distinct from the build-retry cap) | `maxReworkCycles` = 3 |
24
+ | 3 | **Rework storm** | `phases["2"].reworkCount` reaches the review limit with accepted findings still open (distinct from the build-retry cap, `retryCount`) | the review rework limit (`features/review-rounds.md`, default 2, 1 to 3), lowered in autopilot by `maxReworkCycles` when that is set |
25
25
  | 4 | **Cost drift** | cumulative spend crosses the `costBudget` ceiling, or the projected next-phase spend would exceed it, after model-fallback has already downgraded | `costBudget` ceiling |
26
26
  | 5 | **Merge/rebase conflict** | Phase 4 push blocked by a conflict that requires history reconciliation | any conflict |
27
27
 
@@ -32,7 +32,7 @@ Trigger 2 is the key addition over the plain build-retry cap: a build can "fail
32
32
  | Trigger | Evaluated by | Status |
33
33
  |---|---|---|
34
34
  | 2, finding half | `review-delta.mjs` exit 3 at Phase 3 Step 3.8: a blocking/important finding whose `fingerprint` (finding-fingerprint.mjs) stays in the accepted set for `identicalFindingCycles` consecutive rounds | **code** (v16.20.0) |
35
- | 3 | Phase 3 re-entry item 6: at `retryCount === 3`, `rework-rulings.mjs` rules on every open finding; the hard-kill, and the trip, happen only when a ruling is `escalate`. All parked: no trip, the run continues to Phase 4 with them as follow-ups | **code** (v16.20.0, rulings 20.34.0) |
35
+ | 3 | Phase 3 Step 4: `review-rounds.mjs next` answers `rule` once `reworkCount >= limit`, the limit being lowered by `maxReworkCycles` in an autopilot run; then `rework-rulings.mjs` rules on every open finding of the current triage; the hard-kill, and the trip, happen only when a ruling is `escalate`. All parked: no trip, the run continues to Phase 4 with them as follow-ups | **code** (v16.20.0, rulings 20.34.0) |
36
36
  | 2, build-error half | needs a build-log signature normaliser | documented behaviour, no script yet |
37
37
  | 1 | needs checkpoint-to-checkpoint artifact diffing | documented behaviour, no script yet |
38
38
  | 4 | belongs to `cost-budget-check.mjs` | documented behaviour, no script yet |
@@ -77,7 +77,7 @@ $HOME/.claude/scripts/log-metric.sh "$TASK_ID" 3 review.delta iteration=$ITERATI
77
77
  | 3 | A blocking/important finding survived `identicalFindingCycles` consecutive rework cycles | **Autopilot** with `enabled`: trip the breaker. `state.circuitBreaker = {tripped: true, trigger: 2, detail: "finding <fingerprint> (<file>: <issue>) survived <n> consecutive rework cycles", checkpoint: {phase: 4, step: "3.8", iteration: N}, trippedAt, counters: {identicalFindingCycles: <max recurrence>, reworkCycles: N-1}}`, then the halt-visibility protocol from `phases/operations.md` (`status=paused`, `haltReason="4:circuit-breaker:identical-finding"`, tracker meta, the `>&2 HALT` line, the usage report). **Interactive modes**: do not trip; show `delta.stillPresent` and ask (picker-contract) `Continue rework` / `Escalate to me` / `Accept as deferred`, the last moving those findings to `deferred[]` with reason `circuit-breaker: accepted by user after <n> cycles`. |
78
78
  | 1 | Unreadable round file | Log `review.delta_skipped reason=invalid` and continue; the delta is advisory and never blocks on its own failure. |
79
79
 
80
- `plateau` (the still-present set unchanged from the previous delta) is logged, not acted on: at the default threshold it coincides with trigger 2 and with the Phase 3 `retryCount` hard-kill. The rework-storm cap itself is trigger 3, recorded by the Phase 3 re-entry. The Phase 3 reflection prompt names each accepted finding by `fingerprint` and quotes `delta.stillPresent` first, marked `STILL PRESENT after round N-1's fix`.
80
+ `plateau` (the still-present set unchanged from the previous delta) is logged, not acted on: at the default threshold it coincides with trigger 2 and with the review rework limit at its default. The rework-storm cap itself is trigger 3, recorded by Phase 3 Step 4. The Phase 3 reflection prompt names each accepted finding by `fingerprint` and quotes `delta.stillPresent` first, marked `STILL PRESENT after round N-1's fix`.
81
81
 
82
82
  ## Why fingerprints are computed, not stored
83
83
 
@@ -0,0 +1,40 @@
1
+ # Feature: Review rework limit
2
+
3
+ **Pattern**: Phase 3 sends accepted blocking findings back to Phase 2 for rework. How many times it may do that before the run stops is one number, resolved in one place, so the phase docs, the escalation script and the circuit-breaker cannot disagree about it.
4
+
5
+ The range is 1 to 3 and the default is <!-- fact:reworkDefault -->2<!-- /fact -->. The ceiling, <!-- fact:reworkCap -->3<!-- /fact -->, is the schema cap on `phases["2"].reworkCount`.
6
+
7
+ ## Contract
8
+
9
+ With limit N, review sends work back to development N times, every rework is reviewed again, and the run stops when a review still has accepted findings after N reworks: N reworks, at most N + 1 reviews. `state.phases["2"].reworkCount` counts the reworks; `retryCount` counts build and component-dispatch retries and is a separate counter. `retryCount` is cumulative across the run (nothing resets it between Phase 2 entries) with its own cap of 3, so build retries can stop a run independently of the review limit. A state file without `reworkCount` counts from zero.
10
+
11
+ `next` is idempotent per review iteration: it records `phases["2"].reworkForIteration` (the length of `reviewIterations`) in the same write that increments `reworkCount`, and asked again for that iteration it answers `rework` without recording. A resumed run whose `reworkForIteration` equals the number of `reviewIterations` re-enters the rework instead of deciding again.
12
+
13
+ ## Resolution
14
+
15
+ `node $HOME/.claude/scripts/review-rounds.mjs get [--state "$STATE_FILE"] [--json | --value]`. First valid value wins:
16
+
17
+ | Source | Where it lives | Set by |
18
+ |---|---|---|
19
+ | `flag` | `state.reviewRounds` | `--review-rounds N` on `/multi-agent`, stored by Phase 0 (`review-rounds.mjs record`) |
20
+ | `repo` | `prefs.projects.<project>.maxReworkCycles` | `/multi-agent:review-rounds N --repo` |
21
+ | `global` | `prefs.global.review.maxReworkCycles` | `/multi-agent:review-rounds N` |
22
+ | `default` | the schema default | nothing set |
23
+
24
+ `<project>` is the main repository's folder name as is, the value of `state.project`; the command and the run use the same key. A stored value outside 1 to 3, or not an integer, is ignored and listed under `ignored[]`; it is never clamped. In an autopilot run (`state.autopilot`, or `MULTI_AGENT_UNATTENDED=1`) with the circuit-breaker enabled, `prefs.global.autopilotCircuitBreaker.maxReworkCycles` lowers the result and the source reads `breaker`; it never raises it. `--json` also reports `configured` (before that bound) and `breakerCap`.
25
+
26
+ ## Where a run reads it
27
+
28
+ | Step | Reads |
29
+ |---|---|
30
+ | Phase 0, right after `agent-state.json` is created, when the input carried `--review-rounds N` | writes `state.reviewRounds` |
31
+ | Phase 3 Step 4, accepted blocking or important findings | `review-rounds.mjs next --state "$STATE_FILE"`: `rework` (after recording `reworkCount + 1`) or `rule` (`reworkCount >= limit`; the comparison is `shouldRule` in the script) |
32
+ | `rule` | `rework-rulings.mjs` on the current triage; `escalate` stops the run and records autopilot trigger 3 |
33
+ | Phase 2 re-entry | reads neither the limit nor the count |
34
+ | Rework dispatch | `rework-escalation.mjs`, whose last round is the limit and whose round is `reworkCount` |
35
+
36
+ Attended and autopilot runs take the same path. At the limit every open finding is ruled on (`escalate` or `parked`): a blocking or security finding stops the run for the user, and the rest continue to Phase 4 as follow-ups.
37
+
38
+ ## Changing it
39
+
40
+ `/multi-agent:review-rounds` with no argument shows the value and its source and asks. `status` prints, `1`, `2` or `3` sets it globally, `--repo` scopes it to the current repository, `reset` removes the override. Setting needs an explicit argument in an unattended run, which never opens a picker.
@@ -18,12 +18,13 @@ On by default because it fires at most on the rounds where a failure costs the m
18
18
  ```bash
19
19
  node $HOME/.claude/scripts/cost-budget-check.mjs --task-id "$TASK_ID" --prefs "$PREFS_FILE" >/dev/null; BUDGET_RC=$?
20
20
  STILL=$(jq '.reviewIterations[-1].delta.counts.stillPresent // 0' "$STATE_FILE")
21
- ESC=$(node $HOME/.claude/scripts/rework-escalation.mjs --iteration "$ITERATION" --max-iterations 3 \
21
+ REWORK_ROUND=$(jq '.phases["2"].reworkCount // 1' "$STATE_FILE")
22
+ ESC=$(node $HOME/.claude/scripts/rework-escalation.mjs --iteration "$REWORK_ROUND" \
22
23
  --still-present "$STILL" --current-tier "$DEV_TIER" --budget-exit "$BUDGET_RC" \
23
24
  --prefs "$PREFS_FILE" --state "$STATE_FILE" ${FELL_BACK:+--fallen-back})
24
25
  ```
25
26
 
26
- `ITERATION` is the rework round about to run (1-based, `retryCount + 1`); `DEV_TIER` is the rung the Phase 2 dev dispatch resolves to without this override (persona and routing, `skills/shared/core/multi-agent/SKILL.md`), so escalations never compound; `FELL_BACK` is set when this run emitted a `model_fallback` metric. Pass `BUDGET_RC` on every call: without `--budget-exit` the budget counts as disabled only when `costBudget.enabled` is not `true`, otherwise the rung holds with `budget-unchecked`. Prefs come from `--prefs`, then `$MULTI_AGENT_PREFS`, then `~/.claude/multi-agent-preferences.json`. `--state` records the result as `reviewIterations[-1].reworkEscalation`, including a refusal and its reason, and in an autopilot run lists an escalation in `decisions[]` (`features/autopilot-decisions.md`). Exit 2 or 3: log `rework.escalation_skipped`, dispatch on `DEV_TIER`; it never blocks the rework.
27
+ The script resolves the review limit itself (1 to 3, default 2, the repo setting and the autopilot bound included), so the call passes no `--max-iterations`. `REWORK_ROUND` is the rework round about to run, 1-based: `state.phases["2"].reworkCount`, which Phase 3 Step 4 recorded before this dispatch (`retryCount` counts build retries and is not read here); `DEV_TIER` is the rung the Phase 2 dev dispatch resolves to without this override (persona and routing, `skills/shared/core/multi-agent/SKILL.md`), so escalations never compound; `FELL_BACK` is set when this run emitted a `model_fallback` metric. Pass `BUDGET_RC` on every call: without `--budget-exit` the budget counts as disabled only when `costBudget.enabled` is not `true`, otherwise the rung holds with `budget-unchecked`. Prefs come from `--prefs`, then `$MULTI_AGENT_PREFS`, then `~/.claude/multi-agent-preferences.json`. `--state` records the result as `reviewIterations[-1].reworkEscalation`, including a refusal and its reason, and in an autopilot run lists an escalation in `decisions[]` (`features/autopilot-decisions.md`). Exit 2 or 3: log `rework.escalation_skipped`, dispatch on `DEV_TIER`; it never blocks the rework.
27
28
 
28
29
  | `reason` | Meaning |
29
30
  |---|---|
@@ -42,8 +43,8 @@ Telemetry: `log-metric.sh "$TASK_ID" 2 rework.escalation escalate= from= to= rea
42
43
 
43
44
  `escalate: true` -> `PHASE_MODEL_OVERRIDE=<toTier>` for that one dev dispatch (the override outranks routing, so the fable and ceiling checks above are the only ones that apply). The agent is **fresh**: no forked history, no conversation. It gets files:
44
45
 
45
- - `$WORKTREE/.pipeline/triage-round-$ITERATION.json`: the persisted findings of the review that sent this round back (accepted, with fingerprints)
46
- - `$WORKTREE/.pipeline/rework-attempt-$((ITERATION-1)).diff`: the prior attempt's change, written by the orchestrator before the dispatch as `git diff <round start>..HEAD` (round 0 starts at the run's base), so the escalated agent sees what was tried without the conversation that tried it
46
+ - `$WORKTREE/.pipeline/triage-round-$REWORK_ROUND.json`: the persisted findings of the review that sent this round back (accepted, with fingerprints)
47
+ - `$WORKTREE/.pipeline/rework-attempt-$((REWORK_ROUND-1)).diff`: the prior attempt's change, written by the orchestrator before the dispatch as `git diff <round start>..HEAD` (round 0 starts at the run's base), so the escalated agent sees what was tried without the conversation that tried it
47
48
  - `delta.stillPresent[]` quoted first, as Phase 2 re-entry item 7 already requires
48
49
 
49
50
  An escalation is per dispatch: the next round asks again from `DEV_TIER`, so the rework never sits more than one rung above the dev dispatch.
@@ -89,7 +89,7 @@ Each record carries:
89
89
  | `services` | the apps this machine is connected to, at most 40 `{name, kind, connected}` rows: each logical key of `keychainMapping` (`kind: "token"`, `connected` while it is mapped and its last `serviceStatus` check did not fail) and each MCP server registered with Claude Code (`~/.claude.json`, user and project scope) or Copilot CLI (`~/.copilot/mcp-config.json`) (`kind: "mcp"`). The same rules as `creds` and `apps` hold here: a credential name is sent only when `prefs.schema.json` documents it, an MCP server only by its exact registered name from the shipped public list; every other name is folded into one `{name: "private", kind, connected, n}` row per kind, `n` the number of distinct names folded in. Names only: never a credential value, a server config or a path; a missing or unreadable config adds nothing |
90
90
  | `cmds` | which `/multi-agent` commands were typed on this machine since the last accepted send, at most 80 `{n, k}` rows: `n` the name of a command the package ships (the generated `SHIPPED_COMMANDS`) or the constant `other`, `k` an integer from 1 to 9999, most used first. The rows are deltas, not totals: the server adds them to what it holds for the machine, once per `cb` (below). A count above 9999 is sent as 9999 and the remainder goes in the next batch. An empty list means none were typed. Counted from the Claude Code `UserPromptSubmit` hook only (section 12); Copilot CLI and Codex have no counter, so their commands are not in it |
91
91
  | `cb` | present only with a non-empty `cmds`: the id of that batch of counts, 16 lowercase hex characters from `crypto.randomBytes`, made when the batch is claimed and sent again, unchanged, with the same counts, whenever that batch is sent again. It is a random nonce; nothing on the machine is hashed into it. The server adds a batch to the machine's totals once per `cb`: when it has already stored a `cb` for the machine it answers as accepted without adding the counts again, so a reply that was lost does not double them |
92
- | `health` | optional machine-health summary, `{generatedAt, overall, items: [{id, status, reason}]}`: one item per `health-report.mjs` section (`services`, `toolkit`, `install`, `sessions`, `autopilot`, `office`, `disk`, `gate`, `errors`; at most 30), `status` and `overall` one of `green`, `yellow`, `red`, `reason` the id of the section's message in `lib/health-messages.mjs` (for example `errors.recurring`), taken only from that catalogue's section families, otherwise `other`. No sentence and no message parameter (a service, host or branch name, a count) is sent; the panel renders the id in its own language. Read from a cache (`~/.claude/logs/multi-agent/usage-health.json`, 30-minute TTL). On a stale cache the event tries to create `usage-health.json.lock` exclusively with a random owner token; only when it gets the lock does it start a detached refresher (`usage-health.mjs --refresh --token <owner>`, never `--probe`) and wait for it, at most 5 seconds. An event waits only when it starts the refresh: one that finds the lock held sends at once without the field. A lock older than 3 minutes is taken over; a refresher exits at once when the lock is fresh and carries another token; a successful refresh removes the lock and a failed one rewrites it, so a failing report is retried at most every 3 minutes. The field is left out when no fresh summary is ready in time or anything fails; the panel then keeps the last one it had. `MULTI_AGENT_USAGE_HEALTH=cache` uses the cache without starting a refresher, `off` never sends the field |
92
+ | `health` | optional machine-health summary, `{generatedAt, overall, items: [{id, status, reason}]}`: one item per `health-report.mjs` section (`services`, `toolkit`, `install`, `sessions`, `autopilot`, `office`, `disk`, `gate`, `errors`; at most 30), `status` and `overall` one of `green`, `yellow`, `red`, `reason` the id of the section's message in `lib/health-messages.mjs` (for example `errors.recurring`), taken only from that catalogue's section families, otherwise `other`. A section built from several parts (services, install, sessions, autopilot, disk) sends the id of the part that decided its colour, carried as `lead` on the joined message in the report document and chosen by `summaryFromReport`. No sentence and no message parameter (a service, host or branch name, a count) is sent; the panel renders the id in its own language. Read from a cache (`~/.claude/logs/multi-agent/usage-health.json`, 30-minute TTL). On a stale cache the event tries to create `usage-health.json.lock` exclusively with a random owner token; only when it gets the lock does it start a detached refresher (`usage-health.mjs --refresh --token <owner>`, never `--probe`) and wait for it, at most 5 seconds. An event waits only when it starts the refresh: one that finds the lock held sends at once without the field. A lock older than 3 minutes is taken over; a refresher exits at once when the lock is fresh and carries another token; a successful refresh removes the lock and a failed one rewrites it, so a failing report is retried at most every 3 minutes. The field is left out when no fresh summary is ready in time or anything fails; the panel then keeps the last one it had. `MULTI_AGENT_USAGE_HEALTH=cache` uses the cache without starting a refresher, `off` never sends the field |
93
93
 
94
94
  `st` comes from the event when one is given (`--event`), otherwise from the
95
95
  state file: `haltReason` or `paused` is halted, `awaiting_input` or a
@@ -2,7 +2,7 @@
2
2
 
3
3
  <!-- facts: commandCount="commands" toolCount="tools, most for a RUNNING app" -->
4
4
  ```
5
- Multi-Agent Pipeline - 80 commands, grouped by what you want to do
5
+ Multi-Agent Pipeline - 81 commands, grouped by what you want to do
6
6
 
7
7
  Start here:
8
8
 
@@ -22,6 +22,7 @@ Develop
22
22
  /multi-agent "task" Full run: plan, TDD, review, commit, report
23
23
  /multi-agent "task" autopilot Same run, no questions; commit and PR automatic
24
24
  /multi-agent "task" autopilot --loop N Up to N autopilot runs in the background
25
+ /multi-agent "task" --review-rounds N This run: N review rework rounds, 1 to 3
25
26
  /multi-agent:status Runs in every project: id, phase, branch, state
26
27
  /multi-agent:log [#id] A run's log (the latest by default)
27
28
  /multi-agent:resume [#id] [autopilot] Continue a stopped run, or finish a branch
@@ -60,6 +61,7 @@ Review and analysis
60
61
  /multi-agent:review [PR|branch] Parallel review of a PR or branch diff
61
62
  /multi-agent:address-review [PR] Answer review on our own PR; each write approved alone
62
63
  /multi-agent:diff-explain Map a review finding back to its diff lines
64
+ /multi-agent:review-rounds [1|2|3] How often review may send work back; default 2
63
65
  /multi-agent:analysis ["name"] Feature analysis from Figma, Swagger, Confluence, repos
64
66
  /multi-agent:analysis-resolve [doc] Answer an analysis doc's open questions one by one
65
67
  /multi-agent:review-analysis [doc] Review a written analysis against its rules
@@ -157,7 +159,7 @@ Access and usage reporting
157
159
  Plugins and tools (call them directly)
158
160
 
159
161
  Stack plugins ai-<stack>-toolkit:<skill>; catalog: ai-<stack>-toolkit:help
160
- Toolkit MCP multi-agent: 258 tools, most for a RUNNING app:
162
+ Toolkit MCP multi-agent: 267 tools, most for a RUNNING app:
161
163
  ios_*, android_*, web_*, design_*, store_*, the audits.
162
164
  Not registered means a silent no-op.
163
165
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  <!-- facts: commandCount="komut" toolCount="araç, çoğu" -->
4
4
  ```
5
- Multi-Agent Pipeline - 80 komut, ne yapmak istediğine göre gruplu
5
+ Multi-Agent Pipeline - 81 komut, ne yapmak istediğine göre gruplu
6
6
 
7
7
  Buradan başla:
8
8
 
@@ -22,6 +22,7 @@ Geliştir
22
22
  /multi-agent "task" Tam koşu: plan, TDD, review, commit, rapor
23
23
  /multi-agent "task" autopilot Aynı koşu, soru yok; commit ve PR kendiliğinden
24
24
  /multi-agent "task" autopilot --loop N Arka planda en fazla N autopilot koşusu
25
+ /multi-agent "task" --review-rounds N Bu koşu: N review rework turu, 1 ile 3
25
26
  /multi-agent:status Tüm projelerdeki koşular: id, faz, branch, durum
26
27
  /multi-agent:log [#id] Koşunun log'u (varsayılan: en sonuncusu)
27
28
  /multi-agent:resume [#id] [autopilot] Duran koşuyu sürdür ya da bir branch'i bitir
@@ -60,6 +61,7 @@ Review ve analiz
60
61
  /multi-agent:review [PR|branch] PR ya da branch diff'ine paralel review
61
62
  /multi-agent:address-review [PR] Kendi PR'ımızdaki review'u yanıtla; her yazma ayrı onaylı
62
63
  /multi-agent:diff-explain Review bulgusunu diff satırlarına bağla
64
+ /multi-agent:review-rounds [1|2|3] Review işi kaç kez geri yollar; varsayılan 2
63
65
  /multi-agent:analysis ["ad"] Figma, Swagger, Confluence ve repolardan analiz
64
66
  /multi-agent:analysis-resolve [doc] Analizin açık sorularını tek tek yanıtla
65
67
  /multi-agent:review-analysis [doc] Yazılmış analizi kurallarına göre incele
@@ -157,7 +159,7 @@ Erişim ve kullanım raporu
157
159
  Plugin'ler ve araçlar (doğrudan çağır)
158
160
 
159
161
  Stack plugin ai-<stack>-toolkit:<skill>; katalog: ai-<stack>-toolkit:help
160
- Toolkit MCP multi-agent: 258 araç, çoğu ÇALIŞAN uygulama için:
162
+ Toolkit MCP multi-agent: 267 araç, çoğu ÇALIŞAN uygulama için:
161
163
  ios_*, android_*, web_*, design_*, store_*, denetimler.
162
164
  Kayıtlı değilse sessizce hiçbir şey yapmaz.
163
165
 
@@ -79,7 +79,7 @@ Each persona file carries its own `modelRationale`. Observability: emit a `phase
79
79
 
80
80
  **Phase 2: Dev (Sonnet).** Per todo in dependency order: mark `in_progress`, TDD (failing test, verify RED, minimal code, verify GREEN, refactor), build via a task agent, on failure fix and rebuild (max 3, `retryCount` in `agent-state.json`), mark `done`, log `Phase 2: {todo-id} - Test ok, Build ok`.
81
81
 
82
- **Phase 3: Review (parallel + triage).** Step 0 diff risk scoring is advisory: `node $HOME/.claude/scripts/diff-risk-score.mjs --base "$BASE_BRANCH" --top 5`, injected as `${PRIORITY_FILES}`; off when `prefs.global.diffRiskAdvisory = false`. Reviewers by host: Claude Code runs `claude-fable-5-2` (security + architecture), `claude-opus-5-5` (edge cases), `claude-sonnet-5-5` (quality); Copilot CLI runs `gpt-5.4`, `claude-opus-4.7`, `claude-sonnet-4.6` (no Fable). Triage is one top-tier pass (`claude-fable-5-2` on Claude Code, `claude-opus-4.7` on Copilot CLI). Blocking findings go back to Phase 2 (max 3 iterations), important ones are fixed and re-reviewed, suggestions applied when reasonable.
82
+ **Phase 3: Review (parallel + triage).** Step 0 diff risk scoring is advisory: `node $HOME/.claude/scripts/diff-risk-score.mjs --base "$BASE_BRANCH" --top 5`, injected as `${PRIORITY_FILES}`; off when `prefs.global.diffRiskAdvisory = false`. Reviewers by host: Claude Code runs `claude-fable-5-2` (security + architecture), `claude-opus-5-5` (edge cases), `claude-sonnet-5-5` (quality); Copilot CLI runs `gpt-5.4`, `claude-opus-4.7`, `claude-sonnet-4.6` (no Fable). Triage is one top-tier pass (`claude-fable-5-2` on Claude Code, `claude-opus-4.7` on Copilot CLI). Blocking findings go back to Phase 2 (at most `review-rounds.mjs get --state "$STATE_FILE" --value` rework rounds, 1 to 3, default 2), important ones are fixed and re-reviewed, suggestions applied when reasonable.
83
83
 
84
84
  **Phase 4: Commit & PR.** Per-project steps and the GitHub issue body update: `orchestrator/phase-4-5-projects.md`.
85
85
 
@@ -114,9 +114,10 @@ another stack's toolkit in its place.
114
114
  | `graph_*` (`graph_stats`, `graph_hubs`, `graph_cluster`, `graph_query`, ...) | reading a built code graph without a shell |
115
115
  | `research_community` / `media_transcript` | what developers already reported about a problem, or the subtitles of a linked YouTube talk (`media-remote` cap, `yt-dlp`) |
116
116
  | `media_video_*` (`media_video_plan`, `media_video_render`, `media_video_check`, `media_video_reframe`), `media_music_beats`, `media_thumbnail_check` | a short video is wanted from screenshots, clips or a script: plan the scenes and timing, render, reframe for another aspect, cut on the music's beats, then check the file against the upload spec and the thumbnail at feed sizes (the `release-video` skill owns the flow) |
117
+ | `media_ink_*` (`media_ink_plan`, `media_ink_check`, `media_ink_render`) | a small looping pen-on-paper animation is wanted from a scene of figures, trees, houses and a day cycle: plan, check the motion numerically, render one animated SVG or HTML page, optionally an MP4 (the `ink-animation` skill owns the flow) |
117
118
  | `document_*` (`document_mrz_build`, `document_generate`, `document_pdf_inspect`) | a document-scan test needs a synthetic MRZ fixture, or a PDF the app produced needs its pages and text layer checked |
118
119
  | `thesis_*` (`thesis_bib_check`, `thesis_citation_check`, `thesis_structure_lint`, `thesis_reference_format`, `thesis_reference_verify`, `thesis_overlap`, `thesis_style_lint`) | a thesis or long paper needs its bibliography, citations, structure, reference list, self-overlap or academic style checked (the `thesis-writing` skill owns the flow) |
119
- | `vphone_*` | the device under test is a virtual iPhone from the separately installed vphone-launchpad host; `vphone_status` says whether the host is there |
120
+ | `vphone_*` (`vphone_list_apps`, `vphone_launch_app`, `vphone_open_url`, `vphone_tap_element`, `vphone_type_element`, `vphone_wait_for`, plus the lifecycle, screenshot, UI tree, key, swipe, tap and `vphone_rpc` tools) | the device under test is a virtual iPhone from the separately installed vphone-launchpad host; `vphone_status` says whether the host is there |
120
121
  | `voice_*` | the user runs the local voice host: speak, ask aloud, or answer a permission prompt by voice; `voice_status` says whether it is running |
121
122
  | `social_read` | the user asked for posts from X, Reddit, LinkedIn, Instagram or Facebook; reads through their own signed-in Chrome, off unless the `social` cap is set, confirmed per channel, never unattended |
122
123
  | `pass_*` (`pass_inspect`, `pass_validate`, `pass_certificates`, `pass_build`) | an Apple Wallet pass will not open, or a test pass is needed |
@@ -193,7 +193,7 @@ This keeps orchestrator context lean and enables programmatic routing.
193
193
 
194
194
  **Proactive compaction + phase-boundary checkpoint**: the orchestrator follows ~2,500 lines of phase prose in one session; once context fills, it starts dropping steps - the single biggest cause of "it got stuck / skipped a step." Two defenses, both required on full-pipeline runs:
195
195
 
196
- - *Phase-boundary checkpoint.* At every phase transition, before loading the next phase doc, write the durable state (`agent-state.json` phase status + `files[]` + `retryCount`) and append a structured handoff block to `agent-log.md` (format below). The next phase reads state + log, not the back-conversation - so a transition is a clean re-entry point even if context is later compacted. Then flush what the run has learned so far:
196
+ - *Phase-boundary checkpoint.* At every phase transition, before loading the next phase doc, write the durable state (`agent-state.json` phase status + `files[]` + `retryCount` + `reworkCount`) and append a structured handoff block to `agent-log.md` (format below). The next phase reads state + log, not the back-conversation - so a transition is a clean re-entry point even if context is later compacted. Then flush what the run has learned so far:
197
197
 
198
198
  ```bash
199
199
  bash $HOME/.claude/scripts/capture-flush.sh --state "$STATE_FILE" --quiet
@@ -518,7 +518,7 @@ git -C $PROJECT_ROOT config user.email "{identity.email}"
518
518
  `worktreePath` = `$PROJECT_ROOT`, `localMode` = `true`. Step 5b already recorded
519
519
  `workspaceSource`; this step does not decide, it applies.
520
520
 
521
- **If worktree** (Step 5b answered worktree, or autopilot resolved it): 2. Worktree path: Jira → `.worktrees/{jiraId}/`, GitHub → `.worktrees/GH{issueNo}/`, free-text → `.worktrees/task-{shortId}/` 3. **Prepare the worktree** (heal, residue guard, add or re-enter, identity: "Worktree preparation" below) 4. Create log dir + `agent-log.md` + `agent-state.json` at `${LOGS_ROOT:-$HOME/.claude/logs/multi-agent}/{project}/{task-id}/`, never inside the worktree:
521
+ **If worktree** (Step 5b answered worktree, or autopilot resolved it): 2. Worktree path: Jira → `.worktrees/{jiraId}/`, GitHub → `.worktrees/GH{issueNo}/`, free-text → `.worktrees/task-{shortId}/` 3. **Prepare the worktree** (heal, residue guard, add or re-enter, identity: "Worktree preparation" below) 4. Create log dir + `agent-log.md` + `agent-state.json` (with `--review-rounds N`, then run `node "$HOME/.claude/scripts/review-rounds.mjs" record --state "$STATE_FILE" --rounds N`) at `${LOGS_ROOT:-$HOME/.claude/logs/multi-agent}/{project}/{task-id}/`, never inside the worktree:
522
522
 
523
523
  **Worktree location convention (cited by every other command):** always `{projectRoot}/.worktrees/{taskId}`, inside the repo, never under `$HOME`. `{taskId}` is the directory name from the rule above (`DC-<shortId>` for `/multi-agent:design-check`). `.worktrees` is fixed, not a preference: no `worktreeBasePath` key exists, and `gc-worktrees.sh`, `purge.sh`, the cost renderers and `usage-report.mjs` resolve `<repo>/.worktrees/` by name. Multi-repo tasks get one worktree per repo (below); a local answer creates none and `worktreePath` is `$PROJECT_ROOT`.
524
524
 
@@ -59,7 +59,7 @@ Phase 2 consumes the Phase 1 output object conforming to `$HOME/.claude/schemas/
59
59
 
60
60
  #### Component tasks - delegated dispatch (taskType === "component")
61
61
 
62
- When Phase 0 Step 7 classified the task as `component`, Phase 2 delegates the entire phase to the enabled `ai-<platform>-toolkit` marketplace plugin's component skill (`create-component`, fallback `create-ui-component`) via the Skill tool and does NOT run the TDD loop below. The dispatch layer passes the plugin skill the analysis Section 6 (Bileşen Envanteri) entry + Section 13.1 conventions for the named component as context. Because plugin skills do not write pipeline state, the **dispatch layer** (not the skill) owns `state.phases["2"].subphases[]`, recording a coarse component-build row. Resolution, failure/resume, multi-repo and cross-CLI detail: `$HOME/.claude/multi-agent-refs/component-dispatch.md`. Phase 2 still owns: progress line `-> dispatching create-component <name>`, `retryCount` cap at 3, and fallthrough to the TDD path when dispatch prerequisites are missing (`taskType` absent OR the plugin is not enabled in this repo -> log anomaly, halt or run TDD per component-dispatch.md).
62
+ When Phase 0 Step 7 classified the task as `component`, Phase 2 delegates the entire phase to the enabled `ai-<platform>-toolkit` marketplace plugin's component skill (`create-component`, fallback `create-ui-component`) via the Skill tool and does NOT run the TDD loop below. The dispatch layer passes the plugin skill the analysis Section 6 (Bileşen Envanteri) entry + Section 13.1 conventions for the named component as context. Because plugin skills do not write pipeline state, the **dispatch layer** (not the skill) owns `state.phases["2"].subphases[]`, recording a coarse component-build row. Resolution, failure/resume, multi-repo and cross-CLI detail: `$HOME/.claude/multi-agent-refs/component-dispatch.md`. Phase 2 still owns: progress line `-> dispatching create-component <name>`, the build-retry cap (`retryCount`, 3), and fallthrough to the TDD path when dispatch prerequisites are missing (`taskType` absent OR the plugin is not enabled in this repo -> log anomaly, halt or run TDD per component-dispatch.md).
63
63
 
64
64
  For non-component taskTypes (`bugfix`, `feature`, `refactor`, `chore`), continue with the standard TDD section below.
65
65
 
@@ -75,7 +75,7 @@ Missing design data (variant, padding, copy) → HALT and instruct the user to r
75
75
 
76
76
  #### Re-entry from Phase 3 triage
77
77
 
78
- Phase 2 runs twice in the pipeline lifetime: first for initial development, then optionally for rework after Phase 3 review. **Phase 2 never acts on raw reviewer output.** It only consumes `triage.accepted` findings - Fable triage in Phase 3 already filtered false-positives, deferred out-of-scope items, and rejected noise.
78
+ Phase 2 runs first for initial development, then once per rework round after Phase 3 review (at most the review limit, 1 to 3, default 2). **Phase 2 never acts on raw reviewer output.** It only consumes `triage.accepted` findings - Fable triage in Phase 3 already filtered false-positives, deferred out-of-scope items, and rejected noise.
79
79
 
80
80
  When re-entering from Phase 3:
81
81
 
@@ -87,7 +87,7 @@ When re-entering from Phase 3:
87
87
  3. `accepted.suggestion` items are applied opportunistically (no TDD loop required) unless the user asked for suggestions to be treated strictly.
88
88
  4. `deferred` items are NOT actioned in this re-entry - Phase 4 Step 0b lists them before the commit and the PR description carries them as follow-ups.
89
89
  5. `rejected` items are never touched. Log their IDs + triage reasons for audit only; Step 3.7 checks it.
90
- 6. After rework, increment `state.phases["2"].retryCount`; at `retryCount === 3` run `node $HOME/.claude/scripts/rework-rulings.mjs --triage "{worktreePath}/triage-output.json" --state "$STATE_FILE"`: blocking or security findings `escalate` (hard-kill, escalate to the user), the rest are `parked` as follow-ups and the run continues to Phase 4; exit 2 or 3 escalates. Do not loop indefinitely. When `prefs.global.autopilotCircuitBreaker.enabled` is true (default), record the hard-kill before escalating as `state.circuitBreaker = {tripped: true, trigger: 3, detail: "rework cycles exhausted", checkpoint: {phase: 3, step: "re-entry", iteration: <n>}, trippedAt, counters: {reworkCycles: <n>}}`: the rework-storm trigger; `autopilotCircuitBreaker.maxReworkCycles` (default 3) is bounded above by this cap.
90
+ 6. The review limit and the rework count are owned by Phase 3 Step 4 (`features/review-rounds.md`): it decides `rework` or `rule` with `review-rounds.mjs next`, and a `rework` has already recorded one more `state.phases["2"].reworkCount` before this re-entry starts. This step neither increments a counter nor compares one: `retryCount` counts build retries only. The re-entry is the rework Step 4 recorded: `phases["2"].reworkForIteration` equals the number of `reviewIterations`; a resumed run with that state comes straight here and never repeats the decision. Run the rework, then return to Phase 3, which reviews it again. Do not loop indefinitely: the limit is 1 to 3 reworks, 2 by default.
91
91
  7. When `state.reviewIterations[-1].delta` exists, `stillPresent[]` findings come first in the task list, quoted `STILL PRESENT after round N-1's fix`; repeating the previous attempt is the loop the circuit-breaker stops.
92
92
  8. Before each rework dispatch, `rework-escalation.mjs` picks the rung; findings and the prior report go as files (`features/rework-escalation.md`).
93
93
 
@@ -168,7 +168,7 @@ For each task (respecting dependency order), on start and on end: `bash $HOME/.c
168
168
  - **ios, fallback (raw)**: same lock pair around `xcodebuild build -scheme "{scheme}" -destination "generic/platform=iOS" -derivedDataPath "{worktreePath}/.DerivedData" 2>&1 | tail -5`.
169
169
  - **android**: lock pair around `./gradlew assembleDebug 2>&1 | tail -5` (the Gradle daemon and `build/` outputs contend across parallel worktrees exactly as DerivedData does - the lock applies).
170
170
  - **backend / web**: `python -m compileall .` / run the command `node $HOME/.claude/scripts/package-manager.mjs run --dir "{worktreePath}" --script build` prints, `2>&1 | tail -5` (exit 3: no build script); no lock.
171
- 5. If build fails → fix → rebuild (max 3 attempts, track `retryCount` in state). A failure that says `ENOSPC` or no space left is not a code defect, and retrying will not fix it: save the output and run `node $HOME/.claude/lib/low-disk.mjs --scan <log>`, print its line, and stop retrying. Attended, name `/multi-agent:clean-disk` for the user to type; unattended, record the line and halt. Never delete anything from here.
171
+ 5. If build fails → fix → rebuild (max 3 attempts, the build-retry cap; track `retryCount` in state. It is one counter on `phases["2"]` that nothing resets, so it is cumulative across every Phase 2 entry of the run, initial development and each rework included, and reaching 3 stops the run whatever the review limit is). A failure that says `ENOSPC` or no space left is not a code defect, and retrying will not fix it: save the output and run `node $HOME/.claude/lib/low-disk.mjs --scan <log>`, print its line, and stop retrying. Attended, name `/multi-agent:clean-disk` for the user to type; unattended, record the line and halt. Never delete anything from here.
172
172
  6. **Intermediate commit** (after each completed task in the plan):
173
173
  ```bash
174
174
  git -C "{worktreePath}" add -A
@@ -581,7 +581,7 @@ Merge the JSON into `state.reviewIterations[-1].delta` via `write-state.mjs`; em
581
581
  | **3** | Autopilot with `prefs.global.autopilotCircuitBreaker.enabled` (default true): write `state.circuitBreaker = {tripped: true, trigger: 2, detail, checkpoint: {phase: 4, step: "3.8", iteration: N}, trippedAt, counters}`, then the `operations.md` halt protocol with `haltReason="4:circuit-breaker:identical-finding"`. Interactive: show `delta.stillPresent`, ask `Continue rework` / `Escalate to me` / `Accept as deferred`. |
582
582
  | **1** | Log `review.delta_skipped reason=invalid`, continue; the delta never blocks on its own failure. |
583
583
 
584
- `plateau` is logged, not acted on; trigger 3 (the rework cap) is recorded by the Phase 2 re-entry.
584
+ `plateau` is logged, not acted on; trigger 3 (the rework cap) is recorded by Step 4, on a `rule` whose ruling escalates.
585
585
 
586
586
  #### Step 4 - Consensus + Action (triage-driven)
587
587
 
@@ -589,8 +589,12 @@ If `triage.consensus.verdict` is `split` or `unverified`, surface `consensus.dis
589
589
 
590
590
  Act **only on triage.accepted**:
591
591
 
592
- - **accepted.blocking** → back to Phase 2 (max 3 iterations, rung per `features/rework-escalation.md`, reflection prompt cites only accepted items). The reflection prompt names findings by `fingerprint` and quotes `delta.stillPresent` first, marked `STILL PRESENT after round N-1's fix`. When Step 3.7 ran and `state.reviewIterations[-1].verifyByTest.redTests[]` is non-empty, the reflection prompt cites each red test: "a failing repro test already exists at <testRef>; make it green; do not delete or weaken it."
593
- - **accepted.important** → fix and re-review
592
+ - **accepted.blocking** (and **accepted.important**) → ask the limit, then send the work back or rule. With limit N (1 to 3, default 2; `features/review-rounds.md`) review sends work back N times, every rework is reviewed again, and the run stops when a review still has accepted findings after N reworks.
593
+ ```bash
594
+ ACTION=$(node $HOME/.claude/scripts/review-rounds.mjs next --state "$STATE_FILE")
595
+ ```
596
+ - `rework`: `next` has recorded one more `state.phases["2"].reworkCount` and the review iteration it decided for (`reworkForIteration`); asked again for that iteration it answers `rework` without recording, and `next --peek` never records. Back to Phase 2 (rung per `features/rework-escalation.md`; reflection prompt cites only accepted items). The reflection prompt names findings by `fingerprint` and quotes `delta.stillPresent` first, marked `STILL PRESENT after round N-1's fix`. When Step 3.7 ran and `state.reviewIterations[-1].verifyByTest.redTests[]` is non-empty, the reflection prompt cites each red test: "a failing repro test already exists at <testRef>; make it green; do not delete or weaken it." After the rework, review again.
597
+ - `rule`: the reworks done have reached the limit (anything `next` does not print as `rework`, or a non-zero exit, is also `rule`). Run `node $HOME/.claude/scripts/rework-rulings.mjs --triage "{worktreePath}/triage-output.json" --state "$STATE_FILE"` on THIS review's triage: blocking or security findings `escalate` (hard-kill, escalate to the user), the rest are `parked` as follow-ups and the run continues to Phase 4; exit 2 or 3 escalates. When `prefs.global.autopilotCircuitBreaker.enabled` is true (default), record it before escalating as `state.circuitBreaker` with `trigger: 3`, `detail: "rework cycles exhausted"` and `counters.reworkCycles` (shape: `features/autopilot-circuit-breaker.md`).
594
598
  - **accepted.suggestion** → apply if reasonable
595
599
  - **deferred** → Phase 4 Step 0b lists it before the commit; the PR follow-ups carry it (do not block)
596
600
  - **rejected** → log reasons for audit; do not touch
@@ -105,6 +105,8 @@ A run that stopped mid-phase to ask a human has `currentPhase` pointing at the p
105
105
  | `question` | The step `state.pendingQuestion.stepId` names, after the answer is recorded ("Answering a parked question") |
106
106
  | absent or `null` | `currentPhase + 1` (same pipeline as the main multi-agent command) |
107
107
 
108
+ A decided rework that was not finished is not a wait for a person, so it has no `waitingFor`: `state.phases["2"].reworkForIteration` equal to the number of `reviewIterations` means `review-rounds.mjs next` recorded a rework for the latest review and no later review exists. Resume re-enters the Phase 2 rework on that review's triage and never runs Phase 3 Step 4 again (a repeated Step 4 answers `rework` without counting it twice).
109
+
108
110
  A `waitingFor` that outlives the question it asked sends every later resume back to the step the user already answered, which is why it is cleared in the same write that records the answer.
109
111
 
110
112
  ## Untracked context
@@ -41,6 +41,7 @@ fail the gate.
41
41
  | `agent_*` | common | `phases/phase-2-dev.md`, `features/exploratory-testing.md` | several device, web or design steps in one call, or searching a large earlier result |
42
42
  | `context_*` | common | `knowledge.md`, `research/engine.md` | indexing a large result for ranked search |
43
43
  | `research_*` | common | `/multi-agent:research` | web research with citations, community answers |
44
+ | `media_ink_*` | common | `outside-the-pipeline.md` | a small looping pen-on-paper animation from a numeric scene: plan, check the motion, render one animated SVG or HTML page (the `ink-animation` skill) |
44
45
  | `media_transcript`, `social_read` | common | `/multi-agent:research` | subtitles of a linked YouTube talk, posts read in the user's own browser |
45
46
  | `llm_*` | common | `features/free-models.md` | handing a simple text task to a free model |
46
47
  | `repo_*` | common | `phases/phase-1-plan.md`, `platform-parity.md` | reading another repository of the product |