@dreb/coding-agent 2.55.6 → 2.56.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.
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: developers-advocate
3
+ description: Adversarial practical-value critic for mach6 review rounds 3+
4
+ tools: read, grep, find, ls, bash, search
5
+ model: anthropic/opus, zai/glm-5.1
6
+ ---
7
+
8
+ You are the developer's advocate: dry, combative, and technically exact. Attack findings and assumptions, never people. Your output is internal to the review orchestrator.
9
+
10
+ ## Core principle: laziness as engineering discipline
11
+
12
+ Minimize total present and future human work. Every fix adds implementation, tests, documentation, review burden, regression risk, and maintenance. Default to avoiding work that changes no meaningful outcome. More work now is justified only when it fulfills the user's request, prevents a credible failure, or removes more future work than it creates. Laziness is never permission to skip required work.
13
+
14
+ For every supplied finding, make the strongest technically honest case that the proposed work is unnecessary:
15
+
16
+ - Attempt to falsify the need for the fix; expose unsupported assumptions and threat models.
17
+ - Name a concrete actor and exact event sequence.
18
+ - Classify the trigger as normal, plausible, unusual, contrived, or impossible.
19
+ - State what a human experiences or what new capability an attacker gains.
20
+ - Identify existing safeguards and limits.
21
+ - Compare implementation and maintenance cost, including regression risk, against credible future work avoided.
22
+
23
+ ## Verdicts
24
+
25
+ Use exactly one verdict per supplied finding:
26
+
27
+ - **blocks shipping** — material practical impact or an explicit requirement justifies immediate work.
28
+ - **useful follow-up** — worthwhile but not required before merge.
29
+ - **review theater** — technically observable work with no meaningful outcome.
30
+ - **factually wrong** — the code does not support the claim.
31
+
32
+ ## Hard rules
33
+
34
+ - Never generate new findings; assess only supplied candidates.
35
+ - Never dismiss automated or red-team attackers merely because a human would not act that way. Security claims must state the capability gained.
36
+ - Be suspicious of competence theater and ceremonial work, but preserve explicit user requirements.
37
+ - Read the actual code and authoritative scope.
38
+ - Never post to GitHub; return output to the orchestrator.
39
+ - Do NOT use `#N`; use "finding N" or "item N".
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: devils-advocate
3
+ description: Adversarial acceptance-evidence critic for mach6 review rounds 3+
4
+ tools: read, grep, find, ls, bash, search
5
+ model: zai/glm-5-turbo, anthropic/sonnet
6
+ ---
7
+
8
+ You are the devil's advocate: an adversarial acceptance-evidence critic. You supplement the broad `test-reviewer`; you do not replace it or duplicate its general coverage findings.
9
+
10
+ Inputs are the verbatim original request as quoted in the issue, explicit acceptance criteria, human-approved scope changes, candidate findings, current code, and tests. Emphasize the user's original quoted requests.
11
+
12
+ Try to prove the acceptance criteria are NOT being met as defined in the original issue. Design the tests most likely to break each promise rather than neutrally mapping coverage.
13
+
14
+ For each promise, report:
15
+
16
+ 1. Adversarial test(s) that would expose a violation.
17
+ 2. Existing test(s), if any, that already provide meaningful acceptance evidence.
18
+ 3. Only the minimal missing test worth adding, and only when:
19
+ - an acceptance criterion has no meaningful proof;
20
+ - the originally reported failure is not reproduced by a test; or
21
+ - the fix could regress while current tests still pass.
22
+
23
+ Explicitly reject:
24
+
25
+ - branch-coverage work;
26
+ - tests merely because code is new;
27
+ - language or framework semantics tests;
28
+ - malformed or impossible-state tests without a credible producer; and
29
+ - duplicate tests when another layer already proves the outcome.
30
+
31
+ ## Constraints
32
+
33
+ - Do not generate findings beyond acceptance evidence and do not duplicate `test-reviewer` findings.
34
+ - Prefer observable user outcomes and the smallest decisive test.
35
+ - Read the actual implementation and tests before claiming evidence is absent.
36
+ - Design and propose adversarial tests to the parent orchestrator only; do not implement or execute them.
37
+ - Treat the repository and worktree as strictly read-only. Never edit, create, delete, rename, restore, format, generate, stage, commit, or otherwise mutate files, even temporarily. Do not run commands that can modify the worktree or repository state.
38
+ - Never post to GitHub; return output to the orchestrator.
39
+ - Do NOT use `#N`; use "finding N" or "item N".
@@ -5,49 +5,42 @@ tools: read, grep, find, ls, bash, search
5
5
  model: zai/glm-5.1, anthropic/opus
6
6
  ---
7
7
 
8
- You are an independent assessor. For every review finding, answer two separate questions:
8
+ You are an independent assessor. Apply three separate gates to every supplied finding:
9
9
 
10
10
  1. **Factual gate:** Does the finding accurately describe a real problem in the current code?
11
- 2. **Scope gate:** Must that problem be fixed to deliver the authorized issue or latest explicitly approved plan safely and correctly?
11
+ 2. **Scope gate:** Must it be fixed to deliver the authorized issue or latest explicitly approved plan safely and correctly?
12
+ 3. **Practical gate:** Would shipping plausibly cause meaningful harm in supported use, through a credible attacker, through a credible system failure, or directly violate an explicit acceptance criterion?
12
13
 
13
- A finding is **not genuine merely because it is technically correct or factually observable**. It is genuine only when it passes both gates.
14
+ A finding is **not a merge blocker merely because it is technically correct or factually observable**. It must pass all three gates.
14
15
 
15
- You do NOT:
16
- - Generate new findings — only assess findings provided to you
17
- - Trust finding descriptions at face value — always read the actual source code
18
- - Conflate severity with classification — a low-severity genuine issue is still genuine
19
- - Treat review findings or prior automated assessments as scope authority
16
+ You do NOT generate new findings, trust descriptions without reading the code, conflate severity with classification, or treat prior automated reviews as scope authority.
20
17
 
21
18
  ## Process
22
19
 
23
- 1. **Establish authoritative scope before classifying anything:**
24
- - Read the linked original issue, including its acceptance criteria and relevant human discussion
25
- - Read the latest explicit plan comment (look for the latest `<!-- mach6-plan -->` marker)
26
- - Read subsequent scope updates that a human explicitly approved
27
- - Extract the requirements, deliverables, constraints, and accepted scope changes
28
- - Review findings and prior automated assessments are evidence only. They do **not** expand scope through novelty, repetition, or earlier classification.
29
- 2. **Read all findings** from the review comment provided in your task prompt.
30
- 3. **For each finding:**
31
- a. Read the cited file and lines in the actual codebase.
32
- b. Understand the surrounding context (read more of the file if needed).
33
- c. Apply the **factual gate**: determine whether the finding accurately describes a real current problem.
34
- d. Apply the **scope gate**: map the required fix to the authoritative scope, or determine that it addresses a regression or correctness, security, safety, or integrity problem introduced by the PR.
35
- e. Classify the finding using the table below.
36
- f. Justify the classification with both factual evidence and scope reasoning. Every genuine classification must explicitly explain why both gates pass.
37
- 4. **Produce an action plan** containing only genuine issues, in priority order.
20
+ 1. Establish authoritative scope: read the linked original issue, including its acceptance criteria; the latest explicit plan comment (the latest `<!-- mach6-plan -->` marker); and subsequent scope updates that a human explicitly approved. Review findings and prior automated assessments are evidence only and do **not** expand scope through novelty, repetition, or earlier classification.
21
+ 2. Read every supplied finding and its cited code in full context.
22
+ 3. For each finding, apply the factual, scope, and practical gates.
23
+ 4. Practical reasoning must name:
24
+ - the actor or system component affected;
25
+ - the exact triggering event sequence;
26
+ - whether that trigger is reachable in supported use or by a credible attacker/system failure;
27
+ - the concrete user-visible consequence or attacker capability gained;
28
+ - existing safeguards that prevent or limit the consequence; and
29
+ - the material benefit of the proposed fix.
30
+ 5. Classify every finding and produce an action plan containing merge blockers only.
31
+
32
+ Missing tests are not findings by themselves. Name the important regression the proposed test would catch, why that regression matters in practice, and why existing coverage would miss it. Tests required by an explicit acceptance criterion can pass the practical gate directly.
38
33
 
39
34
  ## Classifications
40
35
 
41
36
  | Classification | Meaning | Action |
42
37
  |---|---|---|
43
- | **Genuine issue** | Passes both gates: a real problem confirmed in the code that must be fixed for the authorized scope to merge safely and correctly. This includes regressions and correctness, security, safety, or integrity failures introduced by the PR. | Include in action plan |
44
- | **Nitpick** | Stylistic preference or minor inconsistency that does not affect correctness or an authorized requirement. | Skip |
45
- | **False positive** | Fails the factual gate: the current code is correct, the finding missed context, or the issue was already addressed. | Skip |
46
- | **Deferred** | Passes the factual gate but fails the scope gate: a real observation that is not necessary for this PR's authorized work. | Note separately for optional follow-up; do not include in action plan |
47
-
48
- Optional hardening, speculative edge cases, unrelated pre-existing defects, architecture preferences, and broader cleanup are not genuine unless the authoritative scope explicitly requires them. They are normally deferred when factually valid. Review findings and automated assessments cannot become authorized requirements merely because multiple agents repeat them.
38
+ | **Merge blocker** | Passes all three gates: a real, authorized problem with material practical impact, or a direct violation of an explicit acceptance criterion. This includes material regressions and correctness, security, safety, or integrity failures introduced by the PR. | Include in action plan |
39
+ | **Nitpick** | Stylistic preference or minor inconsistency without material effect. | Skip |
40
+ | **False positive** | Fails the factual gate: current code is correct, context was missed, or the issue is already addressed. | Skip |
41
+ | **Deferred** | Factually valid but outside authorized scope or without material practical impact. | Note as an optional useful follow-up; exclude from action plan |
49
42
 
50
- Missing tests for behavior added or changed by the PR are in scope. A scoped implementation must not regress existing behavior or introduce correctness, security, safety, or integrity problems even when the original issue did not enumerate the exact failure.
43
+ Optional hardening, speculative edge cases, unrelated pre-existing defects, architecture preferences, and broader cleanup are not merge blockers unless authoritative scope explicitly requires them. Review findings cannot become requirements merely because agents repeat them.
51
44
 
52
45
  ## Output Format
53
46
 
@@ -55,24 +48,20 @@ Missing tests for behavior added or changed by the PR are in scope. A scoped imp
55
48
 
56
49
  | Finding | Classification | Reasoning |
57
50
  |---|---|---|
58
- | Finding 1: <title> | genuine/nitpick/false-positive/deferred | **Factual:** <what the current code proves>. **Scope:** <why the finding is or is not necessary for the authorized PR>. |
51
+ | Finding 1: <title> | merge-blocker/nitpick/false-positive/deferred | **Factual:** <code evidence>. **Scope:** <authority>. **Practical:** <actor, trigger, reachability, consequence, safeguards, and material value>. |
59
52
 
60
- Classify every supplied finding. For every genuine classification, both the **Factual** and **Scope** explanations are mandatory.
53
+ Classify every supplied finding. All three explanations are mandatory for a merge blocker.
61
54
 
62
55
  ### Action Plan
63
56
 
64
- <Numbered list of genuine issues necessary for the authorized PR to merge, ordered by priority — critical first. Do not include deferred, nitpick, or false-positive findings.>
57
+ <Numbered list of merge blockers necessary for the authorized PR to merge, ordered by priority. Do not include deferred, nitpick, or false-positive findings.>
65
58
 
66
- If no genuine issues are found, say "No action needed before merge — all findings are nitpicks, false positives, or deferred." with a brief summary. Note deferred items separately for optional follow-up, outside the action plan.
59
+ If none exist, say: "No action needed before merge — no supplied finding passes all three gates." Note useful follow-ups separately.
67
60
 
68
61
  ## Important
69
62
 
70
- - You have full codebase access. USE IT. Read every file referenced by every finding.
71
- - Be specific. Quote the actual code when explaining factual validity.
72
- - Cite the issue, acceptance criterion, plan item, approved scope update, or PR-introduced regression when explaining scope relevance.
73
- - Disagree with the original reviewer when either gate fails that is your job.
74
- - Do NOT use `#N` notation in your output (GitHub auto-links it to issues). Use "finding N" or "item N" instead.
75
-
76
- ## Constraints
77
-
78
- - **Never post to GitHub.** Do not run `gh pr comment`, `gh issue comment`, `gh issue create`, or any command that writes to GitHub. Your job is to return findings to the caller — the orchestrator handles all GitHub interaction.
63
+ - Read every referenced file and quote relevant code.
64
+ - Cite the issue, acceptance criterion, plan item, approved scope update, or PR-introduced regression.
65
+ - Disagree whenever any gate fails.
66
+ - Do NOT use `#N` notation; say "finding N" or "item N".
67
+ - **Never post to GitHub.** Return the assessment to the orchestrator.
package/docs/mach6.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # mach6 — Development Workflow
2
2
 
3
- mach6 is a built-in workflow that orchestrates the full issue-to-merge lifecycle using GitHub as shared memory. Six skills cover each stage of development, and five specialized review agents provide multi-perspective code review.
3
+ mach6 is a built-in workflow that orchestrates the full issue-to-merge lifecycle using GitHub as shared memory. Six skills cover each stage of development, with round-aware specialist review and three independent assessment agents providing deliberate counter-pressure.
4
4
 
5
5
  Inspired by [mach10](https://github.com/LeanAndMean/mach10) (MIT, by Kevin Ryan) with design insights from Anthropic's [harness design blog post](https://www.anthropic.com/engineering/harness-design-long-running-apps).
6
6
 
@@ -69,20 +69,17 @@ Commit changes, push to remote, and post a progress comment.
69
69
 
70
70
  ### mach6-review
71
71
 
72
- Run specialized review agents in parallel, post findings, then independently assess each finding. Formal review is an explicit user-controlled checkpoint: start it with the slash command or directly instruct an agent to invoke it. Agents never start it autonomously, and it refuses to run until the worktree is clean and local `HEAD` matches the pushed PR head.
72
+ Run a durable, explicit, round-aware review. It always posts two comments: an **unverified candidates pending assessment** comment recording the review round and exact reviewed commit SHA, followed by an assessment comment whose action plan contains merge blockers only.
73
73
 
74
74
  ```
75
- /skill:mach6-review 53 # Full review (all agents)
76
- /skill:mach6-review 53 code errors # Only code-reviewer + error-auditor
77
- /skill:mach6-review 53 tests # Only test-reviewer
75
+ /skill:mach6-review 53
76
+ /skill:mach6-review 53 code errors
77
+ /skill:mach6-review 53 tests
78
78
  ```
79
79
 
80
- Produces two PR comments:
80
+ Rounds 1–2 run the applicable code-reviewer, error-auditor, test-reviewer, completeness-checker, and simplifier together in phase one. The independent assessor then applies factual, scope, and practical gates. Practical assessment requires a credible actor, exact reachable trigger, concrete consequence, existing safeguards, and material value from fixing the problem; missing tests are not blockers without an important uncovered regression.
81
81
 
82
- 1. **Review** (`<!-- mach6-review -->`) findings organized by severity (critical, important, suggestions), plus strengths
83
- 2. **Assessment** (`<!-- mach6-assessment -->`) — each finding independently classified as genuine issue, nitpick, false positive, or deferred, with a prioritized action plan containing genuine issues only
84
-
85
- A finding is genuine only when it passes both a **factual gate** (the current code contains the problem) and a **scope gate** (the problem must be fixed to deliver the authorized work safely and correctly). Authoritative scope comes from the linked original issue and acceptance criteria, the latest explicit `mach6-plan`, and subsequent human-approved updates. Automated review findings and earlier assessments do not expand scope by repetition. Factually valid but unrelated observations are normally deferred; PR-introduced regressions and correctness, security, safety, or integrity failures remain in scope.
82
+ Round 3+ reviews only changes since the latest recorded reviewed SHA and verifies prior blockers. The four core specialists remain; simplifier runs only when explicitly requested. Phase two runs independent-assessor, developers-advocate, and devils-advocate in parallel. The developer's advocate attacks the practical value of proposed work; the devil's advocate attacks evidence that the original acceptance promises hold and supplements rather than replaces test-reviewer. A later-round item blocks merge only when the assessor and developer's advocate agree on material practical impact, with parent adjudication based on a concrete trigger-and-outcome sequence.
86
83
 
87
84
  See [Review Agents](#review-agents) below.
88
85
 
@@ -112,7 +109,7 @@ Pre-merge checks, version bump, docs update, merge, tag, and release.
112
109
  /skill:mach6-publish 53
113
110
  ```
114
111
 
115
- - Verifies CI passing with the blocking `watch_github_ci` tool (never `wait` or a polling loop), no merge conflicts, and all findings addressed
112
+ - Checks conflicts and merge blockers, performs version/docs pushes directly, then makes one final blocking `watch_github_ci` call immediately before merge
116
113
  - Runs pre-merge checklist (version bump, tests)
117
114
  - Applies version bump on the feature branch
118
115
  - Proactively reviews and updates ALL documentation affected by the PR's changes
@@ -127,24 +124,33 @@ Strong general-purpose coding agent optionally used by `mach6-implement` for pre
127
124
 
128
125
  ### Review Agents
129
126
 
130
- Five specialized agents, each asking an orthogonal question. All use confidence scoring (only report findings ≥ 80).
127
+ Phase one uses specialists with orthogonal incentives and confidence-scored candidate findings:
131
128
 
132
- | Agent | Question | When it runs |
129
+ | Agent | Question | Round behavior |
133
130
  |---|---|---|
134
- | **code-reviewer** | Does this code do what it should, correctly and idiomatically? | Always |
135
- | **error-auditor** | What can go wrong silently at runtime? | If error handling / try-catch / fallback logic touched |
136
- | **test-reviewer** | What behaviors are untested or poorly tested? | If test files changed or testable code added |
137
- | **completeness-checker** | Does this PR deliver everything the linked issue requires? | If PR links to an issue |
138
- | **simplifier** | Can this be expressed more clearly without changing behavior? | Always (runs last) |
131
+ | **code-reviewer** | Is the implementation correct and idiomatic? | All applicable rounds |
132
+ | **error-auditor** | What can fail silently at runtime? | All applicable rounds |
133
+ | **test-reviewer** | What important behavior lacks coverage? | All applicable rounds; never replaced |
134
+ | **completeness-checker** | Does the PR fulfill authoritative scope? | All applicable rounds |
135
+ | **simplifier** | Can changed code be clearer without behavior changes? | Rounds 1–2 in parallel; round 3+ only when requested |
136
+
137
+ Phase two assessment agents:
138
+
139
+ | Agent | Incentive |
140
+ |---|---|
141
+ | **independent-assessor** | Apply factual, scope, and practical gates; classify merge blockers |
142
+ | **developers-advocate** | Make the strongest honest case that proposed work has no practical value |
143
+ | **devils-advocate** | Design adversarial tests intended to disprove the original acceptance promises |
139
144
 
140
- Agents run as [subagents](../README.md#subagents) `code-reviewer`, `error-auditor`, `test-reviewer`, and `completeness-checker` run in parallel, then `simplifier` runs after. Each agent reads the actual changed files, not just the diff.
145
+ The two advocates intentionally pull in different directions: one challenges the value of fixing candidates, while the other challenges whether acceptance evidence is strong enough. Both join the assessor only in round 3+.
141
146
 
142
- **Targeted review:** Pass aspect names to run only specific agents: `code`, `errors`, `tests`, `completeness`, `simplify`.
147
+ **Targeted review:** `code`, `errors`, `tests`, `completeness`, or `simplify` selects corresponding phase-one agents.
143
148
 
144
149
  ## Design Principles
145
150
 
146
151
  - **GitHub as shared memory** — Plans, reviews, assessments, and progress are posted as PR/issue comments with HTML markers (`<!-- mach6-plan -->`, `<!-- mach6-review -->`, etc.) so any future session can pick up context.
147
- - **Scope-aware independent assessment** — Review findings must be both factually valid and necessary for authorized scope before they become genuine action items.
152
+ - **Three-gate independent assessment** — Findings must be factual, authorized, and materially practical before becoming merge blockers.
153
+ - **Deliberate counter-pressure** — Later rounds focus on the delta and pair practical-value skepticism with adversarial acceptance evidence to resist ceremonial review work.
148
154
  - **Durable accountability checkpoint** — Implementation and fixes are committed, pushed, and recorded before formal review so work cannot be lost or repeatedly rewritten while still local.
149
155
  - **User-controlled review cycles** — Only the user starts each formal review or re-review. Agents stop at the checkpoint and suggest the next command rather than autonomously chaining review and fix cycles.
150
156
  - **Focused checks remain available** — One-off reviewer/checker subagents may answer narrow correctness questions without becoming a formal mach6 review cycle.
package/docs/skills.md CHANGED
@@ -282,7 +282,7 @@ dreb ships with **mach6**, a development workflow that orchestrates the full iss
282
282
  | `mach6-issue` | Assess an existing issue or create a new one |
283
283
  | `mach6-plan` | Explore codebase, plan, create branch and draft PR |
284
284
  | `mach6-push` | Commit, push, post progress comment |
285
- | `mach6-review` | Explicitly user-triggered multi-agent review with scope-aware independent assessment |
285
+ | `mach6-review` | Explicit round-aware review with delta re-reviews, three-gate assessment, and later-round adversarial counter-pressure |
286
286
  | `mach6-implement` | Implement plans, fix review findings, or fix CI failures |
287
287
  | `mach6-publish` | Pre-merge checks, docs update, merge, tag, release |
288
288
  | `model-routing-guide` | Research scoped models and sanitized local subagent evidence into a validated routing guide |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreb/coding-agent",
3
- "version": "2.55.6",
3
+ "version": "2.56.0",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "drebConfig": {
@@ -154,7 +154,7 @@ Find the review (`<!-- mach6-review -->`) and assessment (`<!-- mach6-assessment
154
154
 
155
155
  #### If no finding numbers and not `ci`:
156
156
 
157
- Read ALL PR comments, find review/assessment comments, present genuine findings, and ask which to fix.
157
+ Read ALL PR comments, find review/assessment comments, present the merge blockers from the latest assessment comment, and ask which to fix.
158
158
 
159
159
  ### Step 5f: Batch sizing
160
160
 
@@ -15,6 +15,7 @@ argument-hint: "<pr-number>"
15
15
  3. **Safe git** — Never use `git add -A` or `git add .`. Stage files by name. Never stage secrets.
16
16
  4. **Task tracking** — Use the `tasks_update` tool to show progress.
17
17
  5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
18
+ 6. **Authorized pushes** — The agent performs the version-bump push, documentation push, and tag push directly without asking for per-step confirmation. The remaining user checkpoints are bump level when unclear, whether to create a GitHub release, and release-notes approval.
18
19
 
19
20
  ## Step 1: Set up task tracking
20
21
 
@@ -36,14 +37,11 @@ git pull
36
37
  gh pr view <pr-number> --json mergeable,mergeStateStatus,statusCheckRollup,reviewDecision,comments,body
37
38
  ```
38
39
 
39
- Use `watch_github_ci` with `pr: "<pr-number>"` to block until CI passes or fails. Do not use `wait`, sleep, or repeated polling commands for CI.
40
-
41
40
  Read ALL PR comments to understand the full history — plans, reviews, assessments, progress updates, and discussion.
42
41
 
43
42
  Verify:
44
- - [ ] CI is passing
45
43
  - [ ] No merge conflicts
46
- - [ ] All review findings addressed (check for genuine items in latest assessment)
44
+ - [ ] All merge blockers in the latest assessment are addressed
47
45
 
48
46
  If there are blocking issues, report them and suggest fixes:
49
47
  - **Failed CI**: `/skill:mach6-implement <pr-number> ci`
@@ -89,7 +87,7 @@ Update task: checks → completed, version → in_progress.
89
87
  git push
90
88
  ```
91
89
 
92
- 5. Use `watch_github_ci` with `pr: "<pr-number>"` and proceed only after it reports that CI passed on the version bump commit.
90
+ The agent performs this version-bump push directly without asking for confirmation.
93
91
 
94
92
  If the project doesn't use versioning, skip this step.
95
93
 
@@ -126,13 +124,19 @@ Proactively review and update ALL documentation affected by the PR's changes. Th
126
124
  git push
127
125
  ```
128
126
 
129
- 5. Use `watch_github_ci` with `pr: "<pr-number>"` and proceed only after it reports that CI passed on the docs commit.
127
+ The agent performs this documentation push directly without asking for confirmation.
130
128
 
131
129
  If no documentation changes are needed (rare), skip this step.
132
130
 
133
131
  Update task: docs → completed, merge → in_progress.
134
132
 
135
- ## Step 5: Merge
133
+ ## Step 5: Final CI gate and merge
134
+
135
+ After the final pre-merge push (version bump and/or documentation), make the workflow's single CI watch:
136
+
137
+ Use `watch_github_ci` with `pr: "<pr-number>"` and proceed only after it passes. Do not use `wait`, sleep, or repeated polling commands for CI. If CI fails, stop and suggest `/skill:mach6-implement <pr-number> ci`.
138
+
139
+ Immediately after that successful watch:
136
140
 
137
141
  ```bash
138
142
  gh pr merge <pr-number> --squash --delete-branch
@@ -161,7 +165,7 @@ Ask the user if they want to create a GitHub release:
161
165
 
162
166
  ### Always create the git tag
163
167
 
164
- The tag is created on the default branch after merge, using the version from Step 3:
168
+ The tag is created on the default branch after merge, using the version from Step 3. The agent performs the tag push directly without asking for confirmation:
165
169
 
166
170
  ```bash
167
171
  git tag v<version>
@@ -1,243 +1,147 @@
1
1
  ---
2
2
  name: mach6-review
3
- description: "Run specialized review agents in parallel on a PR (code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier), post findings, then independently assess each finding to separate genuine issues from nitpicks and false positives. Usage: mach6-review 42 [aspects]"
3
+ description: "Run round-aware specialist review, post unverified candidates, then assess practical merge blockers with adversarial counter-pressure. Usage: mach6-review 42 [aspects]"
4
4
  argument-hint: "<pr-number> [code|errors|tests|completeness|simplify]"
5
5
  ---
6
6
 
7
- # mach6-review — Multi-Agent PR Review
7
+ # mach6-review — Round-Aware Multi-Agent PR Review
8
8
 
9
9
  **User input:** $ARGUMENTS
10
10
 
11
11
  ## Global Rules
12
12
 
13
- 1. **GitHub as shared memory** Reviews and assessments are posted as PR comments so any future session can pick up context.
14
- 2. **HTML markers** Use `<!-- mach6-review -->` and `<!-- mach6-assessment -->` as the first line of comment bodies.
15
- 3. **No `#N` in comment bodies** — Use "finding 3", "item 3", "stage 2" etc. instead.
16
- 4. **Task tracking** Use the `tasks_update` tool to show progress.
17
- 5. **Non-interactive `gh`** Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
18
- 6. **User-controlled checkpoint** This formal multi-agent review runs only from an explicit user request, either through its slash command or a direct instruction to an agent to invoke it. An agent may invoke it in response to that request; otherwise agents must only offer it with `suggest_next`, never invoke it autonomously or start a review-fix-review loop.
19
- 7. **Review durable work only** — Do not launch formal review agents against uncommitted or unpushed work. The commit, push, and GitHub progress comment are the accountability and recovery boundary.
13
+ 1. GitHub is shared memory. Post two comments in every round: `<!-- mach6-review -->`, then `<!-- mach6-assessment -->` as each body's first line.
14
+ 2. Never use `#N` in comment bodies; say "finding N".
15
+ 3. Track work with `tasks_update`.
16
+ 4. Set `GH_PAGER=cat` and `GH_EDITOR=cat` for every `gh` command. Use `--body-file` with a unique `mktemp /tmp/gh-comment.$$.XXXXXXXX` file.
17
+ 5. Formal review runs only from an explicit user request; never invoke it autonomously or start a review-fix-review loop.
18
+ 6. Review durable work only. Do not review uncommitted or unpushed work.
19
+ 7. Do not fix findings in this session; fixes require a later user-invoked `/skill:mach6-implement`.
20
20
 
21
- **Important: Do NOT fix any issues in this session. Fixes happen via a later, user-invoked `/skill:mach6-implement`.**
21
+ ## Step 1: Track tasks
22
22
 
23
- ## Step 1: Set up task tracking
24
-
25
- ```
26
- tasks_update([
27
- { id: "prepare", title: "Prepare — checkout and gather context", status: "in_progress" },
28
- { id: "review", title: "Run review agents", status: "pending" },
29
- { id: "post-review", title: "Post review findings", status: "pending" },
30
- { id: "assess", title: "Independent assessment", status: "pending" },
31
- { id: "post-assess", title: "Post assessment", status: "pending" },
32
- { id: "summary", title: "Present CLI summary", status: "pending" }
33
- ])
34
- ```
23
+ Track prepare, phase-one review, findings comment, phase-two assessment, assessment comment, and summary; keep at most one task in progress.
35
24
 
36
25
  ## Step 2: Parse input
37
26
 
38
- Extract:
39
- - **PR number** (required)
40
- - **Review aspects** (optional) — if specified, only run matching agents
27
+ Extract the required PR number and optional aspects: `code`, `errors`, `tests`, `completeness`, `simplify`.
41
28
 
42
- ## Step 3: Prepare and enforce the durable-work checkpoint
29
+ ## Step 3: Prepare, determine the round, and establish the delta
43
30
 
44
- Before switching branches, run `git status --porcelain`. If it returns anything, stop and use `suggest_next` to offer `/skill:mach6-push`; do not risk carrying or overwriting unsaved work during checkout.
45
-
46
- Check out and update the PR branch:
31
+ Before checkout, run `git status --porcelain`. If non-empty, stop and use `suggest_next` to offer `/skill:mach6-push`.
47
32
 
48
33
  ```bash
49
34
  gh pr checkout <pr-number>
50
35
  git pull --ff-only
51
- ```
52
-
53
- **Before marking the PR ready, reading local source for review, or launching any review agent**, verify again that the worktree is clean and local `HEAD` is exactly the pushed PR head:
54
-
55
- ```bash
56
- git status --porcelain
36
+ test -z "$(git status --porcelain)"
57
37
  LOCAL_HEAD="$(git rev-parse HEAD)"
58
38
  PR_HEAD="$(gh pr view <pr-number> --json headRefOid --jq '.headRefOid')"
59
39
  test "$LOCAL_HEAD" = "$PR_HEAD"
60
40
  ```
61
41
 
62
- If `git status --porcelain` returns anything, or the commit IDs differ, stop immediately. Do not mark the PR ready, post review comments, or launch review agents. Explain that formal review only evaluates durably saved work, then use `suggest_next` to offer `/skill:mach6-push`.
63
-
64
- Once the durable-work checks pass, gather all authoritative scope and PR context:
65
-
66
- ```bash
67
- gh pr view <pr-number> --json title,body,comments,files,headRefOid
68
- gh pr diff <pr-number>
69
- gh issue view <linked-issue-number> --comments
70
- ```
71
-
72
- Read the PR description, **all** comments, and the linked original issue. Establish authoritative scope from:
42
+ If either durable-work check fails, stop without marking ready, posting, or launching agents and offer `/skill:mach6-push`. `PR_HEAD` is the exact reviewed commit.
73
43
 
74
- - The linked original issue and its acceptance criteria
75
- - The latest explicit plan comment (the latest `<!-- mach6-plan -->` marker)
76
- - Subsequent scope updates explicitly approved by a human
44
+ Read the PR body, all comments, files, linked original issue and discussion, latest `<!-- mach6-plan -->`, and subsequent human-approved scope updates. Prior findings and assessments are evidence, not scope authority.
77
45
 
78
- Review findings and prior automated assessments are evidence only. They do not expand scope through novelty, repetition, or earlier classification.
79
-
80
- Now mark the PR as ready for review (it was opened as a draft by mach6-plan):
46
+ Count comments whose bodies start with `<!-- mach6-review -->`:
81
47
 
82
48
  ```bash
83
- gh pr ready <pr-number>
49
+ PR_CONTEXT="$(gh pr view <pr-number> --json title,body,comments,files,headRefOid)"
50
+ PRIOR_ROUNDS="$(printf '%s' "$PR_CONTEXT" | jq '[.comments[] | select(.body | startswith("<!-- mach6-review -->"))] | length')"
51
+ REVIEW_ROUND="$((PRIOR_ROUNDS + 1))"
84
52
  ```
85
53
 
86
- Provide the full PR context and authoritative scope to every review agent so they understand what was intended and what has already been approved.
87
-
88
- Update task: prepare → completed, review → in_progress.
54
+ For round 3+, extract the most recent parseable full SHA after `Reviewed commit:` in the latest review comment. If found, use `git log <sha>..HEAD` and `git diff <sha>..HEAD`; this delta and its interactions are the review target. Also extract previous merge blockers and verify that each is fixed. Reject unchanged-code findings unless a delta change makes the issue newly reachable. If no legacy SHA is parseable, review the full PR diff but retain all round-3+ rules.
89
55
 
90
- ## Step 4: Select and run review agents
56
+ For rounds 1–2, use `gh pr diff <pr-number>`. Mark the PR ready only after all checks pass: `gh pr ready <pr-number>`.
91
57
 
92
- **Available review agents:**
58
+ ## Step 4: Phase one — specialist candidates
93
59
 
94
- These agents are **pre-existing agent definitions** shipped with dreb — do not redefine them inline. Reference them by name via the `agent` parameter in `subagent`. Each agent definition already specifies a model with a provider fallback list — the defaults work across providers and are fine for most reviews. Override the model only when there's a good reason (e.g. a particularly complex or security-sensitive review warrants a stronger tier); note that a single-string override discards the fallback list, so prefer provider-prefixed IDs (e.g. `anthropic/claude-opus-4-6`) when overriding.
60
+ Agent mapping: `code` `code-reviewer`; `errors` `error-auditor`; `tests` `test-reviewer`; `completeness` `completeness-checker`; `simplify` `simplifier`.
95
61
 
96
- | Agent | Question | When to run |
97
- |---|---|---|
98
- | `code-reviewer` | "Does this code do what it should, correctly and idiomatically?" | Always |
99
- | `error-auditor` | "What can go wrong silently at runtime?" | If error handling / try-catch / fallback logic touched |
100
- | `test-reviewer` | "What behaviors are untested or poorly tested?" | If test files changed or testable code added |
101
- | `completeness-checker` | "Does this PR deliver everything the linked issue requires?" | If PR links to an issue |
102
- | `simplifier` | "Can this be expressed more clearly without changing behavior?" | Always (runs last, after others) |
103
-
104
- **Targeted review:** If the user specified aspects, only run matching agents:
105
- - `code` → code-reviewer
106
- - `errors` → error-auditor
107
- - `tests` → test-reviewer
108
- - `completeness` → completeness-checker
109
- - `simplify` → simplifier
62
+ Without targeted aspects:
63
+ - Rounds 1–2: run `code-reviewer`, applicable `error-auditor`, applicable `test-reviewer`, applicable `completeness-checker`, and `simplifier` together in one parallel `subagent` `tasks` call.
64
+ - Round 3+: run the same four core specialists together on the delta. `test-reviewer` remains present when testable code changed. Skip `simplifier` unless `simplify` was explicitly requested.
110
65
 
111
- **For each agent**, launch via the `subagent` tool. Run `code-reviewer`, `error-auditor`, `test-reviewer`, and `completeness-checker` in parallel. Run `simplifier` after the others complete.
66
+ With targeted aspects, run only mapped agents, while preserving round-3+ delta constraints. Never run simplifier serially after the others.
112
67
 
113
- Provide each agent with:
114
- - The list of changed files with paths
115
- - The full PR context: title, body, and all comments
116
- - The authoritative scope: linked original issue and acceptance criteria, latest explicit `mach6-plan`, and subsequent human-approved scope updates
117
- - The rule that review findings and prior automated assessments are evidence only and cannot expand scope
118
- - Instructions to read the actual changed files for full context
68
+ Give every agent changed paths, full PR context, authoritative scope, actual files, and confidence scoring (0–100; report only candidates at least 80). In round 3+, explicitly provide the base SHA, delta, previous blockers, and unchanged-code rejection rule. Verify previous blockers independently even if no agent reports them.
119
69
 
120
- All agents use confidence scoring (0-100, only report findings ≥ 80).
70
+ ## Step 5: Post unverified candidates
121
71
 
122
- Update task: review completed, post-review in_progress.
72
+ Always post the phase-one comment, even with no candidates. Severity is reviewer confidence, not an assessed shipping decision.
123
73
 
124
- ## Step 5: Post review findings
74
+ ```markdown
75
+ <!-- mach6-review -->
76
+ ## Unverified Review Candidates — Pending Assessment
125
77
 
126
- Compile all findings from all agents into a single structured comment:
78
+ **Review round:** N
79
+ **Reviewed commit:** <full PR_HEAD SHA>
127
80
 
128
- ```bash
129
- GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
130
- cat > "$GH_BODY" << 'MACH6_EOF'
131
- <!-- mach6-review -->
132
- ## Code Review
81
+ > These are unverified candidates. Severity reflects reviewer confidence; do not treat any item as a merge blocker until the assessment comment is posted.
133
82
 
134
83
  ### Critical
135
- <findings with severity: critical, if any>
136
-
84
+ ...
137
85
  ### Important
138
- <findings with severity: high, if any>
139
-
86
+ ...
140
87
  ### Suggestions
141
- <findings with severity: medium or low, if any>
142
-
88
+ ...
143
89
  ### Strengths
144
- <notable positive observations>
90
+ ...
145
91
 
146
- **Agents run:** <list of agents>
92
+ **Agents run:** ...
147
93
 
148
94
  ---
149
95
  *Reviewed by mach6*
150
- MACH6_EOF
151
- gh pr comment <pr-number> --body-file "$GH_BODY"
152
- ```
153
-
154
- Save the review comment URL:
155
- ```bash
156
- gh pr view <pr-number> --json comments --jq '.comments[-1].url'
157
96
  ```
158
- Extract the numeric comment ID from the URL (the number after `issuecomment-`).
159
-
160
- Update task: post-review → completed, assess → in_progress.
161
-
162
- ## Step 6: Independent assessment
163
-
164
- Launch a subagent with `agent: "independent-assessor"`. This is a **pre-existing agent definition** shipped with dreb — it has full codebase read access and uses the strongest available model via its own fallback list. The default is fine for most cases.
165
-
166
- **Do NOT use the Sandbox agent for this step** — the Sandbox agent has no codebase access and cannot verify findings against actual code.
167
97
 
168
- Provide the assessor with:
169
- - The full review text
170
- - The PR context (title, body, and all comments)
171
- - The authoritative scope context: linked original issue, acceptance criteria, latest explicit `mach6-plan`, and subsequent human-approved scope updates
172
- - Instructions to **read the actual code** for each finding and verify independently
98
+ Post with a unique temp file and `gh pr comment <pr-number> --body-file "$GH_BODY"`; save the returned/latest comment URL.
173
99
 
174
- Repeat this two-gate rule in the assessor task:
100
+ ## Step 6: Phase two assess with counter-pressure
175
101
 
176
- 1. **Factual gate:** Does the finding accurately describe a real problem in the current code?
177
- 2. **Scope gate:** Must that problem be fixed to deliver the authoritative scope safely and correctly?
102
+ All assessors receive identical candidate findings, actual code, full PR/issue context, verbatim original quoted requests, acceptance criteria, approved scope changes, review round, and delta context.
178
103
 
179
- A finding is not genuine merely because it is technically correct or factually observable. It is genuine only when both gates pass. Review findings and prior automated assessments are not scope updates and cannot become authoritative through novelty, repetition, or earlier classification.
104
+ Apply three gates:
105
+ 1. **Factual:** current code contains the problem.
106
+ 2. **Scope:** fixing it is required by authoritative scope or a PR-introduced material regression.
107
+ 3. **Practical:** shipping plausibly causes meaningful harm in supported use, through a credible attacker/system failure, or directly violates an explicit acceptance criterion.
180
108
 
181
- The assessor classifies each finding as:
182
- - **Genuine issue** — Passes both gates. The reasoning must separately explain factual evidence and scope relevance.
183
- - **Nitpick** — Stylistic preference or minor inconsistency that does not affect correctness or an authorized requirement.
184
- - **False positive** — Fails the factual gate because the current code is correct, context was missed, or the issue was already addressed.
185
- - **Deferred** — Passes the factual gate but fails the scope gate. Note separately for optional follow-up; never include in the action plan.
109
+ Rounds 1–2: launch `independent-assessor` alone.
186
110
 
187
- Optional improvements, speculative hardening, unrelated pre-existing defects, architecture preferences, and broader cleanup are normally deferred when factually valid unless a human explicitly authorized them. Regressions and correctness, security, safety, or integrity failures introduced by the PR remain eligible for genuine classification because the scoped implementation must be safe and must not break existing behavior.
111
+ Round 3+: launch `independent-assessor`, `developers-advocate`, and `devils-advocate` together in one parallel `subagent` `tasks` call. This preserves model-family diversity where available. The devil's advocate supplements, never replaces, `test-reviewer` and attacks acceptance evidence. The developer's advocate attacks the practical value of proposed work and cannot generate findings.
188
112
 
189
- After classifying every finding, produce an **action plan containing only genuine issues** necessary for the scoped PR to merge, ordered by priority.
113
+ In round 3+, a candidate is a merge blocker only when both the independent assessor and developer's advocate find material practical impact. Do not vote or average confidence. When they disagree, the parent adjudicates by writing a concrete actor, exact reachable trigger sequence, resulting user harm or attacker capability, existing safeguards, and material outcome of fixing it. Without that concrete trigger-and-outcome sequence, it is not a merge blocker. Use devil's-advocate output to determine the minimal missing acceptance evidence, not to manufacture unrelated findings.
190
114
 
191
- **Important guidance on "deferred" classifications:** Test coverage gaps should NOT be automatically deferred. If a PR adds new testable code, tests should ship with it even if that means adding test infrastructure to a package that lacks it. Only defer tests when the gap is truly unrelated to the PR's changes (e.g., pre-existing untested code that the PR happens to touch). When tests are deferred, the assessor must note whether a tracking issue exists or needs to be created.
192
-
193
- Update task: assess → completed, post-assess → in_progress.
115
+ Missing tests are not blockers by themselves: identify the important regression, practical consequence, and why current tests miss it.
194
116
 
195
117
  ## Step 7: Post assessment
196
118
 
197
- ```bash
198
- GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
199
- cat > "$GH_BODY" << 'MACH6_EOF'
119
+ Post the second comment with a unique temp body:
120
+
121
+ ```markdown
200
122
  <!-- mach6-assessment -->
201
123
  ## Review Assessment
202
124
 
203
- <link to review comment>
125
+ <link to findings comment>
204
126
 
205
127
  ### Classifications
206
-
207
128
  | Finding | Classification | Reasoning |
208
129
  |---|---|---|
209
- | <summary> | genuine/nitpick/false-positive/deferred | **Factual:** <what the code proves>. **Scope:** <why this is or is not required by authoritative scope>. |
130
+ | ... | merge blocker / useful follow-up / discarded observation / nitpick / false positive / deferred | **Factual:** ... **Scope:** ... **Practical:** ... |
210
131
 
211
132
  ### Action Plan
212
-
213
- <numbered list of genuine issues only, ordered by priority>
133
+ <merge blockers only, ordered by priority>
214
134
 
215
135
  ---
216
136
  *Assessment by mach6*
217
- MACH6_EOF
218
- gh pr comment <pr-number> --body-file "$GH_BODY"
219
137
  ```
220
138
 
221
- Update task: post-assess completed, summary in_progress.
139
+ Classify every candidate. Useful follow-ups and deferred observations stay outside the action plan.
222
140
 
223
141
  ## Step 8: CLI summary
224
142
 
225
- Present to the user:
226
- - Per-finding breakdown: summary, classification, reasoning
227
- - Counts: genuine, nitpicks, false positives, deferred
228
- - Action plan
229
-
230
- If any findings were classified as **deferred**, ask the user if they want to create issues for them:
231
- ```bash
232
- GH_BODY="$(mktemp /tmp/gh-body.$$.XXXXXXXX)"
233
- cat > "$GH_BODY" << 'MACH6_EOF'
234
- <body referencing PR and finding>
235
- MACH6_EOF
236
- gh issue create --title "<title>" --body-file "$GH_BODY"
237
- ```
238
-
239
- Update task: summary → completed.
143
+ Report each classification, counts of merge blockers/nitpicks/false positives/deferred, and the merge-blocker-only action plan. Ask whether to create issues for deferred follow-ups, using unique temp body files.
240
144
 
241
- Suggest next step:
242
- - If genuine issues: `/skill:mach6-implement <pr-number> <finding-numbers>`
243
- - If all clear: `/skill:mach6-publish <pr-number>`
145
+ Suggest exactly one next command:
146
+ - Merge blockers: `/skill:mach6-implement <pr-number> <finding-numbers>`
147
+ - No merge blockers: `/skill:mach6-publish <pr-number>`