Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/code-review-council.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"j03fr0st-skills": minor
---

`code-review` gains a fourth level, `council`: a deep review plus independent read-only passes from the other model families (Codex, Gemini or Antigravity, Claude) run through `scripts/council.mjs`. External candidates are validated by the host before they are reported, repository rules against sending code to external AI services are honoured, and the review scope reports each reviewer's status in a Council line.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ release checks, and [security reporting](SECURITY.md) for vulnerability reports.
- [codebase-design](docs/engineering/codebase-design.md) — design cohesive modules,
evidence-gated abstractions, intentional dependency direction, and explicit
inter-module contracts.
- [code-review](docs/engineering/code-review.md) — review changes at quick, standard, or
deep depth with a bounded default and evidence-backed findings.
- [code-review](docs/engineering/code-review.md) — review changes at quick, standard,
deep, or multi-model council depth with a bounded default and evidence-backed findings.
- [coding-standards](docs/engineering/coding-standards.md) — apply project conventions
with shared rules and conditional backend and frontend guidance.
- [compound-learnings](docs/engineering/compound-learnings.md) — capture durable
Expand Down
17 changes: 13 additions & 4 deletions docs/engineering/code-review.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Code Review

`code-review` reviews a defined set of changes and reports only introduced, concrete problems that the author can act on. One public skill covers three depths so callers can ask for more evidence without learning separate review workflows.
`code-review` reviews a defined set of changes and reports only introduced, concrete problems that the author can act on. One public skill covers four depths so callers can ask for more evidence without learning separate review workflows.

- **Invocation:** model-invoked for working-tree, commit, branch, pull-request, pre-merge, specification-compliance, and repository-standards reviews.
- **Default:** `standard`, a bounded single-reviewer pass.
- **Posture:** read-only during review. A requested review-and-fix completes review first, then hands findings to `implement`; publishing, approving, merging, committing, and posting remote comments require separate authorization.
- **Output:** severity-ordered findings first, followed by the exact review scope, a blast-radius line at `standard` and `deep`, and residual risks.
- **Output:** severity-ordered findings first, followed by the exact review scope, a blast-radius line at every level above `quick`, a Council line at `council`, and residual risks.

## Review levels

Expand All @@ -14,8 +14,9 @@
| `quick` | Small changes and fast preflight | Complete diff, repository rules, supplied intent, and only the local context needed to prove an obvious issue |
| `standard` | Most branch and pull-request reviews | Complete merge-base diff, nearby behavior, readily available intent, callers or tests that settle candidates, and at most a narrow targeted check |
| `deep` | High-risk or explicitly thorough work | Independent defects, specification, and standards/architecture passes; selective history and checks; a separate candidate-validation stage |
| `council` | Changes worth several models' scrutiny | Everything in `deep`, plus independent read-only passes from the other model families (Codex, Gemini, Claude) through their CLIs, all validated by the host before reporting |

The skill never silently escalates. If a standard review encounters authorization, money, destructive data work, migrations, concurrency, cross-process retries, or public compatibility, it completes the bounded review and names deep review as a residual-risk recommendation.
The skill never silently escalates, and `council` runs only on an explicit request. If a standard review encounters authorization, money, destructive data work, migrations, concurrency, cross-process retries, or public compatibility, it completes the bounded review and names deep review as a residual-risk recommendation.

## Review boundary

Expand Down Expand Up @@ -51,9 +52,15 @@ This separation gives high-risk work broader attention while keeping the default

When a reviewer on a different model or harness is available and permitted, deep mode can add it as one more read-only pass. It never blocks the review, and its candidates face the same validation. Dedicated threat modeling belongs to [security-review](security-review.md).

## Council review

Council mode is a deep review with outside reviewers. After building the deep packet, the host checks repository instructions for rules against sending code to external AI services, removes secret-bearing files from what leaves the machine, and selects every model family other than its own. `scripts/council.mjs` then runs those reviewers in parallel and read-only: `codex exec` in its read-only sandbox, `gemini` in default approval mode or `agy` (Antigravity) in its sandbox, and `claude -p` limited to read tools. Each reviewer gets the same brief and answers in a fixed candidate format; a missing CLI, failure, or timeout is reported rather than hidden.

External candidates join the host's own and face the same reasoning-blind validation. The host is the only judge: a candidate raised by one model is neither discounted nor favoured, agreement between models is not confirmation, and an external fix suggestion is never passed on until validation confirms the problem it fixes. The review scope ends with a Council line naming each reviewer's status, candidates raised, and confirmed findings. When no other family can run, the review completes as `deep` and says why.

## Blast radius

At `standard` and `deep`, the reviewer names the one fact the change's safety depends on and reports how far it was proven: asserted, cited line, walked through, ran a script or test, or reproduced live. A fact that never reached a run is labelled `unproven` rather than presented as safe. Deep review also maps affected consumers and the invariant protecting each, and pushes the fact to a runtime check where it can; missing proof is a coverage gap, not a speculative finding.
At every level above `quick`, the reviewer names the one fact the change's safety depends on and reports how far it was proven: asserted, cited line, walked through, ran a script or test, or reproduced live. A fact that never reached a run is labelled `unproven` rather than presented as safe. Deep review also maps affected consumers and the invariant protecting each, and pushes the fact to a runtime check where it can; missing proof is a coverage gap, not a speculative finding.

## Attribution and design basis

Expand All @@ -62,3 +69,5 @@ The skill keeps the Standards and Spec distinction from Matt Pocock's MIT-licens
The cost condition for missing I/O error handling comes from EveryInc's `ce-code-review`, and the rule for tests that would pass with the behavior removed or that add a test-only seam comes from gstack's test value bar, both from the [2026-10 source sweep](../research/2026-10-06-source-repos-sweep.md).

The [2026-11 source sweep](../research/2026-11-16-source-repos-sweep.md) adds: searching for every standards file, with the nearer file deciding a conflict (Matt Pocock's and EveryInc's `code-review`); a caller check when a signature or behavior changes, and a stated load for scale findings (Ponytail's rewritten `ponytail-review`); latent defects a change exposes (Trail of Bits' `regression-hunt`, Addy Osmani's `code-review-and-quality`); a race test and lifecycle-state check, `deep` recommended only for a stated material failure scenario, and no `quick` review of verification mechanisms (EveryInc's `ce-code-review`); and run-proven, reasoning-blind validation in deep review (Cursor pstack's `interrogate`, Trail of Bits' `patching-bugs`).

The `council` level comes from the [2026-11 council research](../research/2026-11-24-code-review-council.md): the reviewer CLI invocations follow Trail of Bits' `second-opinion`, the host-only validation and per-model calibration follow published comparisons of Claude and Codex reviews.
49 changes: 49 additions & 0 deletions docs/research/2026-11-24-code-review-council.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Code review `council` level

Date: 2026-11-24. Question: what should a multi-model review level add to `code-review`, and how should it run other models' CLIs safely?

## Community evidence (last30days, 2026-10-25 to 2026-11-24)

A `last30days` run on "AI code review skills for Claude Code and Codex" (Reddit, Hacker News, YouTube, GitHub, dev.to; X unavailable) plus three web supplements found:

- **Write with one model, review with another.** The working pattern on r/ChatGPTCoding is a spec in the repository, Codex building from it, and Claude Code reviewing the diff against the same spec ([thread](https://www.reddit.com/r/ChatGPTCoding/comments/1xw51jj/how_do_you_get_codex_claude_code_and_a_planner/)).
- **Cross-model review is asymmetric.** [arXiv 2607.21656](https://arxiv.org/abs/2607.21656): Claude reviewing Codex drafts raised the pass rate from 71.6% to 89.7%, while Codex reviewing Claude drafts lowered it from 91.4% to 82.8%. Applying an outside reviewer's advice without validation can make code worse.
- **One review skill, different models, different volume.** [gal vered](https://galvered.com/blog/best-code-review-skill/) found the same skill best on Claude Code and worst on Codex, and no skill caught every bug. [EveryInc/compound-engineering-plugin#835](https://github.com/EveryInc/compound-engineering-plugin/issues/835) reports Codex returning single-digit findings where Claude returns double digits on the same diff.
- **Review is moving into automation.** Commenters run review skills in CI (`claude-pr` GitHub Actions) and add a merge-gate check that each PR still matches what was decided ([dev.to](https://dev.to/rodrigo-duarte/our-agents-tests-passed-ci-would-have-failed-what-our-merge-gate-caught-last-week-14d0)). Out of scope for this change.
- **Theo's tstack** ships `council`, a three-provider review scored until the models agree ([AlphaSignal](https://alphasignal.ai/news/theo-browne-open-sources-tstack-to-automate-the-entire-pr-lifecycle)). Its name fits the level; its consensus-as-exit rule was not adopted (see below).

Raw results: `~/Documents/Last30Days/ai-code-review-skills-for-claude-code-and-codex-raw-v3.md` (local to the researcher's machine).

## Preferred source repositories

| # | Repository | Influence |
| --- | --- | --- |
| 1 | `mattpocock/skills` | `code-review` is single-model; no cross-model guidance. Not applicable beyond the existing Standards/Spec split. |
| 2 | `obra/superpowers` | `receiving-code-review` covers acting on review feedback, not running external reviewers. Not applicable. |
| 3 | `addyosmani/agent-skills` | `code-reviewer` agent and review command are single-model. Not applicable. |
| 4 | `cursor/plugins` (pstack) | Review agents are single-harness. Already the source of reasoning-blind validation, which council reuses unchanged. |
| 5 | `DietrichGebert/ponytail` | `ponytail-review` is single-model. Not applicable. |
| 6 | `mvanhorn/last30days-skill` | Used for the community evidence above. |
| 7 | `anthropics/skills` | `skill-creator` informs the eval additions only. |
| 8 | `trailofbits/skills` | **Direct influence.** `second-opinion` supplies the tested invocations: `codex exec --sandbox read-only --ephemeral -o <file> -` with the prompt on stdin; `gemini --approval-mode default --output-format text --prompt ... < prompt`; `agy` print mode with `--disable-slash-commands`, never auto-approval. Also: same captured diff for every provider, files outside the checkout, a failed or empty run is incomplete rather than clean, agreement is not proof. |
| 9 | `EveryInc/compound-engineering-plugin` | Issue #835 is the per-model volume evidence behind "count is not quality". |
| 10 | `garrytan/gstack` | `codex` skill runs `codex exec` with the prompt on stdin and probes the sandbox before dispatch. Confirms the stdin choice; its effort and model-policy machinery was not adopted (the runner keeps each CLI's configured defaults). |
| 11 | `affaan-m/ECC` | `ecc-contribution-review` is repository-specific. Not applicable. |
| 12 | `wshobson/agents` | `multi-reviewer-patterns` merges duplicate findings and credits every reviewer (adopted as the Council line's provenance). Its "conflicting severity takes the higher" rule was rejected: `code-review` assigns the lowest accurate severity after validation. |
| 13 | `nahid-sparktales/agent-dispatcher` | Reviewer role dispatch within one harness. Not applicable. |
| 14 | `humanlayer/skills` | No review skill found. |
| 15 | `testdouble/han` | Producer/reviewer split notes are single-model. Not applicable. |

## Decisions

- `council` is `deep` plus external passes, not a separate workflow, so the finding gate, packet, and validation stay in one place.
- The host is the only judge. External output is untrusted data; candidates are validated reasoning-blind, and consensus never stands in for validation (tstack's agreement loop and wshobson's higher-severity rule were not adopted).
- Select every family except the host's own by default; the user can name reviewers.
- Check repository rules for bans on external AI services and drop secret-bearing files before anything leaves the machine.
- A deterministic runner (`scripts/council.mjs`) owns CLI discovery, read-only flags, parallelism, and timeouts, so the prose does not restate per-CLI flags.

## Verification

- Live run on a planted two-bug diff (2026-11-24, Windows): `codex` 0.166.0, `agy` 1.5.13 and Claude Code 2.1.317 each found both bugs in the required block format; the repository stayed clean. `agy` print mode ignored stdin on the first run, so it now reads the brief from a file via `--add-dir`.
- Gemini CLI itself was not installed, so the `gemini` invocation is taken from Trail of Bits' tested reference, not run here.
- `scripts/code-review-council.test.mjs` covers argument parsing, missing CLIs, stdin delivery, and timeout termination with fake reviewers.
93 changes: 93 additions & 0 deletions scripts/code-review-council.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
import { parseArgs, runCouncil } from '../skills/engineering/code-review/scripts/council.mjs';

const WINDOWS = process.platform === 'win32';

// A fake reviewer CLI: either echoes the brief from stdin or sleeps past the timeout.
function fakeReviewer(dir, name, behaviour) {
if (WINDOWS) {
const body = behaviour === 'echo' ? '@echo off\r\nmore\r\n' : '@echo off\r\nping -n 30 127.0.0.1 >nul\r\n';
writeFileSync(join(dir, `${name}.cmd`), body);
} else {
const path = join(dir, name);
writeFileSync(path, behaviour === 'echo' ? '#!/bin/sh\ncat\n' : '#!/bin/sh\nsleep 30\n');
chmodSync(path, 0o755);
}
}

function sandbox() {
const root = mkdtempSync(join(tmpdir(), 'council-test-'));
const bin = join(root, 'bin');
const brief = join(root, 'brief.md');
writeFileSync(brief, 'REVIEW BRIEF MARKER\n');
mkdirSync(bin);
return { root, bin, brief, env: { PATH: bin, PATHEXT: '.CMD' }, cleanup: () => rmSync(root, { recursive: true, force: true }) };
}

function options(box, reviewers, extra = {}) {
return { brief: box.brief, out: join(box.root, 'out'), repo: box.root, reviewers, timeoutMs: 60_000, dryRun: false, ...extra };
}

test('parseArgs rejects an unknown reviewer family', () => {
assert.throws(() => parseArgs(['--brief', 'b', '--out', 'o', '--reviewers', 'codex,grok']), /unknown reviewer family "grok"/);
});

test('parseArgs drops the excluded host family', () => {
const parsed = parseArgs(['--brief', 'b', '--out', 'o', '--exclude', 'claude']);
assert.deepEqual(parsed.reviewers, ['codex', 'gemini']);
});

test('a reviewer whose CLI is not installed is reported missing, not failed', async () => {
const box = sandbox();
try {
const summary = await runCouncil(options(box, ['codex']), box.env);
assert.equal(summary.reviewers[0].status, 'missing');
assert.match(summary.reviewers[0].error, /codex/);
} finally {
box.cleanup();
}
});

test('an installed reviewer receives the brief on stdin and its answer is saved', async () => {
const box = sandbox();
try {
fakeReviewer(box.bin, 'claude', 'echo');
const summary = await runCouncil(options(box, ['claude']), box.env);
const [claude] = summary.reviewers;
assert.equal(claude.status, 'ok', JSON.stringify(claude));
assert.match(readFileSync(claude.outputFile, 'utf8'), /REVIEW BRIEF MARKER/);
} finally {
box.cleanup();
}
});

test('a reviewer still running at the timeout is stopped and reported as timeout', async () => {
const box = sandbox();
try {
fakeReviewer(box.bin, 'gemini', 'sleep');
const started = Date.now();
const summary = await runCouncil(options(box, ['gemini'], { timeoutMs: 1_000 }), box.env);
assert.equal(summary.reviewers[0].status, 'timeout');
assert.ok(Date.now() - started < 20_000, 'timeout did not stop the reviewer promptly');
} finally {
box.cleanup();
}
});

test('dry run resolves commands without launching anything', async () => {
const box = sandbox();
try {
fakeReviewer(box.bin, 'claude', 'echo');
const summary = await runCouncil(options(box, ['claude', 'codex'], { dryRun: true }), box.env);
assert.equal(summary.dryRun, true);
assert.equal(summary.reviewers[0].bin, 'claude');
assert.ok(summary.reviewers[0].args.includes('dontAsk'), 'claude must run without edit permission');
assert.equal(summary.reviewers[1].status, 'missing');
} finally {
box.cleanup();
}
});
2 changes: 1 addition & 1 deletion skills/engineering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ See the [workflow map](../../docs/workflow.md) for entry points and handoffs.

- [babysit-pr](../../docs/engineering/babysit-pr.md) - own the PR repair and watch loop through an explicit, verified endpoint.
- [codebase-design](../../docs/engineering/codebase-design.md) - design cohesive modules, evidence-gated abstractions, intentional dependency direction, and explicit inter-module contracts.
- [code-review](../../docs/engineering/code-review.md) - review changes at quick, standard, or deep depth with a bounded default and evidence-backed findings.
- [code-review](../../docs/engineering/code-review.md) - review changes at quick, standard, deep, or multi-model council depth with a bounded default and evidence-backed findings.
- [compound-learnings](../../docs/engineering/compound-learnings.md) - capture durable engineering lessons past a counterfactual bar and refresh the store against current code.
- [diagnosing-bugs](../../docs/engineering/diagnosing-bugs.md) - establish root causes through reproduction, hypotheses, and discriminating evidence before remediation.
- [coding-standards](../../docs/engineering/coding-standards.md) - apply project conventions with shared rules and conditional backend and frontend guidance.
Expand Down
Loading