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
4 changes: 2 additions & 2 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
{
"name": "swarm",
"source": "./plugins/swarm",
"description": "Local mixture-of-agents code review for Claude Code. Fans a diff across Claude lenses plus the codex and grok CLIs (grok-build + composer models), merges by mechanism with cross-family consensus, verifies solo findings, and presents one ranked report. Optional --fix / --loop applies the findings you agreed with; --pr reviews a GitHub PR diff and posts the result. Skills: /swarm:review, /swarm:agents.",
"version": "0.4.1"
"description": "Local mixture-of-agents code review for Claude Code. Fans a diff across Claude lenses plus the codex and grok CLIs (grok-4.5 + composer models), merges by mechanism with cross-family consensus, verifies solo findings, and presents one ranked report. Optional --fix / --loop applies the findings you agreed with; --pr reviews a GitHub PR diff and posts the result. Skills: /swarm:review, /swarm:agents.",
"version": "0.4.2"
}
]
}
27 changes: 16 additions & 11 deletions .claude/knowledge/features/swarm-backend-adapter.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "Swarm Backend Adapter Layer"
createdAt: 2026-07-03
updatedAt: 2026-07-12
updatedAt: 2026-07-15
createdFrom: "PR #21"
updatedFrom: "session: 2026-07-12"
updatedFrom: "session: 2026-07-15"
pluginVersion: 1.8.2
prime: false
reindexedAt: 2026-07-12
Expand All @@ -19,7 +19,7 @@ The script header documents the per-backend mechanics; this entry captures the
*verified* CLI behavior the adapter is built on and the gotchas that cost a
debugging round.

## Verified CLI facts (codex 0.128 / grok 0.2.77, 2026-07)
## Verified CLI facts (codex 0.128 / grok 0.2.101, 2026-07)

- **Uniform findings JSON** is achievable from both CLIs: `codex exec
--output-schema <file>` and `grok --json-schema '<inline>'` both enforce a
Expand All @@ -32,10 +32,15 @@ debugging round.
`--output-last-message <file>` (stdout carries the agent transcript,
stderr the progress log); grok prints a response **envelope** on stdout —
the validated object is its `.structuredOutput` field.
- **grok's default model rejects `--effort`** (`grok-composer-2.5-fast` errors
with "does not support parameter reasoningEffort"). The adapter must pin
`-m grok-build`. grok's effort ladder (low…max) matches code-review's;
codex has no `max` tier → map `max`→`xhigh` (`-c model_reasoning_effort=…`).
- **The adapter pins `-m grok-4.5`** — the schema-capable model. grok 0.2.101
renamed it from `grok-build` (same upstream pin-rename class as codex's
`gpt-5.6-terra`; verified drop-in: identical envelope/`structuredOutput`
shape, `--single` unchanged). `grok-composer-2.5-fast` still rejects
`--effort` ("does not support parameter reasoningEffort").
- **Effort ladders**: grok is `low|medium|high` since 0.2.101 (the `max` tier
is gone) → the adapter maps `xhigh`/`max`→`high`; codex has no `max` tier →
map `max`→`xhigh` (`-c model_reasoning_effort=…`). Both mappings degrade a
stale caller instead of erroring.
- **codex model is pinned** to `CODEX_DEFAULT_MODEL` (`gpt-5.6-terra`, the adapter
passes `-m` on every call), overridable per call via `--model` — so a review is
reproducible instead of tracking the user's ambient `~/.codex/config` default.
Expand All @@ -46,18 +51,18 @@ debugging round.
still usable as a second grok voice. Given a strict-JSON *prompt* (the adapter
appends the schema text and drops `--json-schema`/`--effort`), it emits **pure
`{"findings":[...]}` directly on stdout — no response envelope, no
`structuredOutput`** (verified P2, grok 0.2.82; simpler than grok-build's
`structuredOutput`** (verified P2, grok 0.2.82; simpler than grok-4.5's
envelope). The adapter routes `--model grok-composer-2.5-fast` to a separate
`run_grok_composer` path that parses the answer **defensively**: collect ALL
balanced `{...}` objects (whole string, fenced blocks, every `{` run), pick the
first **non-empty** `findings` object (a leading `{"note":…}`/`{"findings":[]}`
would otherwise mask the real one), and **validate every item against
`finding.schema.json`** (composer, unlike codex/grok-build, is not CLI-schema-
`finding.schema.json`** (composer, unlike codex/grok-4.5, is not CLI-schema-
enforced — a malformed item must ERROR, not reach merge/verify). Both the
first-object bug and the missing per-item validation were caught by swarm
reviewing its own diff. composer is
~2× faster than grok-build. It is same-family-correlated, so consumers must
count consensus by **model family**, not backend (composer + grok-build
~2× faster than grok-4.5. It is same-family-correlated, so consumers must
count consensus by **model family**, not backend (composer + grok-4.5
agreeing is one grok vote — see [swarm-review-pipeline](swarm-review-pipeline.md)).
- **Headless tool execution**: both CLIs run read-only commands (e.g.
`git diff`) without extra approval flags — codex inside `-s read-only`
Expand Down
21 changes: 11 additions & 10 deletions .claude/knowledge/features/swarm-review-pipeline.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "Swarm Review Pipeline (/swarm:review)"
createdAt: 2026-07-08
updatedAt: 2026-07-14
updatedAt: 2026-07-15
createdFrom: "PR #24"
updatedFrom: "session: 2026-07-14"
updatedFrom: "session: 2026-07-15"
pluginVersion: 1.8.2
prime: false
reindexedAt: 2026-07-12
Expand All @@ -15,7 +15,7 @@ P2 turns the blueprint into a working review: a **Workflow-tool script**
(`plugins/swarm/workflows/swarm-review.js`) launched by the `/swarm:review`
skill. Shape: `scope+gate → fan-out (4 voices) → merge (file,mechanism) →
verify solos → output-gated synthesis`. Four voices: Claude lenses ∥ codex ∥
grok-build ∥ composer (see [swarm-backend-adapter](swarm-backend-adapter.md)).
grok-4.5 ∥ composer (see [swarm-backend-adapter](swarm-backend-adapter.md)).

## The skill ↔ workflow wiring (the non-obvious parts)

Expand All @@ -41,7 +41,7 @@ grok-build ∥ composer (see [swarm-backend-adapter](swarm-backend-adapter.md)).
- **Consensus counts model *families*, not backends.** A cross-family cluster
(≥2 of claude / openai / grok) is CONFIRMED without extra verify; everything
else is solo and goes through the adversarial 3-state verifier. composer +
grok-build agreeing is one grok vote — they cannot alone mint consensus.
grok-4.5 agreeing is one grok vote — they cannot alone mint consensus.
- **Security is intentionally minimal** (user directive: no cannons-at-sparrows).
The P1 adapter floor stays (sandbox, tool-less grok, secret scrub, env filter,
caps); P2 adds only three cheap things — **fencing** the diff as data
Expand All @@ -60,7 +60,7 @@ grok-build ∥ composer (see [swarm-backend-adapter](swarm-backend-adapter.md)).
the delimiter); the workflow only collision-checks it against the returned
findings and extends it deterministically (`nonce-1`, `-2`…) on collision.

- **`args.claude: false`** runs an **external-only control** (codex + grok-build
- **`args.claude: false`** runs an **external-only control** (codex + grok-4.5
+ composer, no Claude finder lenses, no gate; merge/verify still in-session).
Proven useful: a control run found real bugs the with-Claude run missed (an
`aws_secret_access_key` scrub-list drift, `git diff` omitting untracked files)
Expand Down Expand Up @@ -95,11 +95,12 @@ the diff out of the script, above). Claude applies edits between rounds.
the report table contract this entry defines above (P2 reserved them).
- **`--max` profile** (`INPUT.max` in the workflow): lifts every voice to its
ceiling — codex `gpt-5.6-sol`@`xhigh` (codex has NO `max` tier, xhigh is its
top), grok-build `max`, Claude finder lenses + verifier `xhigh`; gate/merge
and composer (no effort control) unchanged. Orthogonal to `--fix`/`--loop`,
composes with both. Both max-tier settings were verified live before wiring
(`gpt-5.6-sol`@xhigh + grok `--effort max` end-to-end) — the "no silent fail
on a non-existent model/effort" rule.
top), Claude finder lenses + verifier `xhigh`; gate/merge, grok (`high` is
its ceiling since grok 0.2.101 dropped `max` — it runs there on both
profiles) and composer (no effort control) unchanged. Orthogonal to `--fix`/`--loop`,
composes with both. The profile's live settings are verified end-to-end
(`gpt-5.6-sol`@`xhigh` at wiring time; grok re-verified at `--effort high` on
0.2.101) — the "no silent fail on a non-existent model/effort" rule.

## `--pr`: review a PR diff and post the result (swarm 0.4.0)

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ entries are grouped per plugin, newest first.

## swarm

### 0.4.2 — 2026-07-15
- Fix grok CLI 0.2.101 compat: pin `grok-4.5` (upstream renamed `grok-build`), cap grok effort at `high` (the `max` tier is gone; the adapter maps `xhigh`/`max` → `high` so stale callers degrade instead of erroring).

### 0.4.1 — 2026-07-15
- Extract the `/swarm:review --pr` publish path into a deterministic, unit-tested `scripts/pr-post.py` (per-cell sanitizer, stale-head gate, `gh` post); shrink `SKILL.md` step 5 to orchestration + the human confirm gate.

Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This is a **Claude Code plugin marketplace** (monorepo) containing plugins that
- **knowledge-system** (v1.5.x) — Knowledge management with three layers: Rules, Knowledge, Memory. Skills: `/init`, `/query`, `/curate`, `/reindex`, `/backfill-knowledge`, `/migrate`, `/statusline`
- **work-system** (v1.2.x) — Task and worktree workflow. Skills: `/define`, `/kickoff`, `/adopt`, `/continue`, `/status`, `/close`, `/list`
- **pr-flow** (v1.1.x) — PR review feedback loop. Skills: `/open`, `/cycle`, `/check`, `/fix`, `/rebase`, `/merge`
- **swarm** (v0.3.x) — Local mixture-of-agents code review (external `codex`/`grok` CLIs — grok-build + composer — plus Claude lenses). P2: `/swarm:review` pipeline (scope→fan-out→merge→verify); P5: `--fix`/`--loop` apply the findings you agreed with. Skills: `/swarm:review`, `/swarm:agents`
- **swarm** (v0.4.x) — Local mixture-of-agents code review (external `codex`/`grok` CLIs — grok-4.5 + composer — plus Claude lenses). P2: `/swarm:review` pipeline (scope→fan-out→merge→verify); P5: `--fix`/`--loop` apply the findings you agreed with. Skills: `/swarm:review`, `/swarm:agents`

## Plugin Anatomy

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PR review feedback loop. Create PRs with readiness checks, commit + push + trigg

### Swarm

Local mixture-of-agents code review. Fans out one review across Claude lens subagents plus the `codex` and `grok` CLIs (grok in `grok-build` + `composer` modes), merges and verifies their findings, and presents a single ranked report — before anything is pushed. With `--fix` / `--loop` it also applies the findings you agreed with (only Claude edits; the external agents stay review-only). `--pr [<number>]` runs the same ensemble against a GitHub PR's diff and posts the gated result as a PR comment (via your own `gh` auth, after one confirmation) — no CI or API-token setup. Complementary to PR Flow's GitHub-side loop. *(Phase 5: `/swarm:review` pipeline + fix loop + PR posting.)*
Local mixture-of-agents code review. Fans out one review across Claude lens subagents plus the `codex` and `grok` CLIs (grok in `grok-4.5` + `composer` modes), merges and verifies their findings, and presents a single ranked report — before anything is pushed. With `--fix` / `--loop` it also applies the findings you agreed with (only Claude edits; the external agents stay review-only). `--pr [<number>]` runs the same ensemble against a GitHub PR's diff and posts the gated result as a PR comment (via your own `gh` auth, after one confirmation) — no CI or API-token setup. Complementary to PR Flow's GitHub-side loop. *(Phase 5: `/swarm:review` pipeline + fix loop + PR posting.)*

**Commands:** `/swarm:review [--fix | --loop[=N]] [--max]`, `/swarm:review --pr [<number>]`, `/swarm:agents` *(more to come: `/swarm:adversarial`, `/swarm:style`, `/swarm:security`)*

Expand Down
4 changes: 2 additions & 2 deletions plugins/swarm/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "swarm",
"description": "Local mixture-of-agents code review for Claude Code. Fans a diff across Claude lenses plus the codex and grok CLIs (grok-build + composer models), merges by mechanism with cross-family consensus, verifies solo findings, and presents one ranked report. Optional --fix / --loop applies the findings you agreed with; --pr reviews a GitHub PR diff and posts the result. Skills: /swarm:review, /swarm:agents.",
"version": "0.4.1",
"description": "Local mixture-of-agents code review for Claude Code. Fans a diff across Claude lenses plus the codex and grok CLIs (grok-4.5 + composer models), merges by mechanism with cross-family consensus, verifies solo findings, and presents one ranked report. Optional --fix / --loop applies the findings you agreed with; --pr reviews a GitHub PR diff and posts the result. Skills: /swarm:review, /swarm:agents.",
"version": "0.4.2",
"author": {
"name": "gering"
},
Expand Down
13 changes: 7 additions & 6 deletions plugins/swarm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Complementary to [pr-flow](../pr-flow/): pr-flow drives the GitHub-PR

**Phase 5 of 6** — the pipeline can now **act** (P3/P4 lens presets still to
come). `/swarm:review` fans a diff
across four voices (Claude lenses + `codex` + `grok-build` + `composer`),
across four voices (Claude lenses + `codex` + `grok-4.5` + `composer`),
merges by mechanism, verifies solo findings, presents one ranked report, and —
with `--fix` / `--loop` — applies the findings you agreed with.

Expand All @@ -25,7 +25,8 @@ with `--fix` / `--loop` — applies the findings you agreed with.
default branch (including uncommitted work). `--fix` applies the agreed
findings once; `--loop[=N]` re-reviews after each fix round until it converges
(cap default `10`); `--max` runs the deepest-effort profile (codex
`gpt-5.6-sol`/`xhigh`, grok `max`, Claude lenses + verifier `xhigh`) — slower,
`gpt-5.6-sol`/`xhigh`, Claude lenses + verifier `xhigh`; grok already runs
at `high`, its ceiling) — slower,
more thorough, composes with `--fix`/`--loop`.
- `/swarm:review --pr [<number>]` — run the same ensemble against a **GitHub
PR's diff** (`gh pr diff`; bare `--pr` resolves the current branch's PR) and,
Expand All @@ -43,21 +44,21 @@ presets).
## The pipeline (`/swarm:review`)

```
Scope+gate → Fan-out (Claude lenses ∥ codex ∥ grok-build ∥ composer)
Scope+gate → Fan-out (Claude lenses ∥ codex ∥ grok-4.5 ∥ composer)
→ Merge (file, mechanism) → Verify solos → Ranked synthesis
```

1. **Scope + gate** — a cheap agent classifies the diff and picks which Claude
lenses are worth running (security is never gated out when code/args/files
flow to an external process).
2. **Fan-out** — four voices in parallel: one Claude finder per gated lens plus
`codex`, `grok-build` and `composer` as full reviews through the adapter.
`codex`, `grok-4.5` and `composer` as full reviews through the adapter.
3. **Merge** — an LLM step clusters findings by `(file, mechanism)`, not
`(file, line)` (external CLIs number against the inlined diff).
4. **Verify** — solo clusters go through an adversarial 3-state verifier
(`CONFIRMED`/`PLAUSIBLE`/`REFUTED`; only `REFUTED` is dropped).

**Consensus counts model *families*, not backends.** `grok-build` and
**Consensus counts model *families*, not backends.** `grok-4.5` and
`composer` are both grok, so their agreement is one vote — a `CONSENSUS` tag
requires ≥2 of *claude / openai / grok*. Everything else is a solo and earns
its place through the verifier.
Expand Down Expand Up @@ -93,7 +94,7 @@ Backends:
|---------|------|-----------|
| `claude` | probe-only | reviews run in-session via the Agent tool |
| `codex` | external reviewer | `codex exec --output-schema` (model `gpt-5.6-terra`, effort `xhigh`) in a read-only sandbox; auth via `codex login status` |
| `grok` | external reviewer | headless `-p` with inline `--json-schema` (model `grok-build`); findings extracted from the response envelope. `--model grok-composer-2.5-fast` takes a separate defensive-parse path (a ~2×-faster second grok voice, no schema flag). |
| `grok` | external reviewer | headless `-p` with inline `--json-schema` (model `grok-4.5`); findings extracted from the response envelope. `--model grok-composer-2.5-fast` takes a separate defensive-parse path (a ~2×-faster second grok voice, no schema flag). |

Unavailable backends drop from the ensemble — `claude` alone still works.
`/swarm:review` reports a backend that *errored* mid-run distinctly from one
Expand Down
4 changes: 2 additions & 2 deletions plugins/swarm/docs/pipeline-blueprint.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,11 @@ credential mid-review) converged on these non-negotiable mitigations:

- **Registered workflow** (not inline) so per-agent `durationMs` is available
for the timing balance line.
- **Model labels** in the balance line (`Opus-4.8`/`GPT-5.5`/`grok-build`),
- **Model labels** in the balance line (`Opus-4.8`/`GPT-5.5`/`grok-4.5`),
read from each backend's review output.
- **Optional composer lens-gate**: `grok-composer-2.5-fast` can't enforce
`--json-schema`/`--effort`, but a strict-JSON prompt makes it emit valid JSON
and reason on demand (tested 2/2). It's ~2× faster than grok-build but its
and reason on demand (tested 2/2). It's ~2× faster than grok-4.5 but its
~20s CLI cost undercuts a Haiku gate; keep it optional, with a defensive
parser + fallback-to-all-lenses.
- **Balance / footer / loop-round box:** render deterministically from the
Expand Down
Loading
Loading