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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to the claude-plugins project will be documented in this fil

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Entries are listed newest-first; each plugin section is treated as released when merged to `main`.

### code-review v3.0.0

#### Removed
- Retired the `Premise` finding category and its entire processing layer, now inert since the premise reviewer was removed (no producer emits `category: "Premise"`). Dropped `Premise` from the `CATEGORIES` schema enum; removed the two verdict-precedence rules that gated on Premise findings (the Premise priority-0 → `CHANGES_REQUESTED` rule and the cumulative-Premise → `NEEDS_ATTENTION` rule) along with the `_count_gateable_premise_medium` helper, the `premise_cumulative_medium` operator threshold, and its `justification_rate_alert` companion; removed the Premise-scoped `stats` telemetry sub-blocks (`by_subcategory`, `justification`, `premise_cumulative_medium_count`); removed the verifier "always verify Premise" eligibility branch and the Premise extra-strictness blocks from `verifier_prompt.txt`; and deleted the four `premise_*.md` fix templates with their `/fix` dispatch rows. The shared/BHA reviewer prompts keep the generic "PREMISE:" reasoning step (what the code is supposed to do), and the general author-justification machinery — the `justified[]` bucket, `JUSTIFIED-VALID`/`JUSTIFIED-INVALID` verdicts, the verifier's J1/J2 audit, and the justification-audit learning stream — is retained; only the Premise-specific pieces were removed.
- Removed the four now-unreachable Premise reasoning-certificate kinds (`necessity`, `cohesion`, `workaround`, `complexity`) from `REASONING_CERTIFICATE_KINDS`; only the active reviewer/reasoning-step kinds (`impact`, `test_quality`, `sibling_pattern`, `bha`, `bhb`, `auditor`) remain.

#### Changed
- Bumped `SCHEMA_VERSION` 1 → 2 for the `Finding` + `ResultEnvelope` contract to reflect the removed `Premise` category and telemetry keys. Because the schema version is folded into the prompt/cache hash, this invalidates the Bug Hunter A and verification caches once on rollout. `verdict-thresholds.json` now exposes only `impact_cumulative` (the FEA-1401 cumulative Impact gate, PLN-726 OQ#6), and `stats` retains `impact_cumulative_count` in place of the removed premise count.
- Pinned `effort: high` in the `code-review-worker` and `code-review-worker-graph` subagent definitions so the reviewer fleet's reasoning depth no longer drops when `/code-review` is run from a lower session effort level. Reasoning effort, unlike `model`, has no per-invocation override — a spawned reviewer otherwise inherits the session effort — so pinning it in frontmatter holds every reviewer at `high` regardless of the session level (`high` is valid on both Opus and Sonnet, the route-assigned reviewer models). `start.md` and `README.md` now document the effort axis alongside the existing session-model cost guidance.

#### Fixed
- Corrected documentation and a test left stale by the `Premise` removal and the renumbered verdict-precedence list. The cumulative Impact verdict gate is now referenced by name (FEA-1401 / PLN-726 OQ#6) in `start.md` and `README.md` rather than a bare ordinal that collided with `SCHEMA.md`'s sequential rules, and a numbering note in `SCHEMA.md` records that `_compute_canonical_verdict`'s plan-derived rule labels do not map 1:1 to that list. The `SCHEMA.md` deferred-fixture count now matches `_DEFERRED_FIXTURES` (3 deferred; `golden_injection_quarantine` is listed as a shipped fixture). The schema test that exercised the removed `stats.justification` / `stats.by_subcategory` telemetry sub-blocks now targets the live `stats.verification` sub-block (`justified_valid_count` / `justified_invalid_count` / `by_reviewer`).
- Restored the operator-facing Impact gate count in GitHub-mode output: the `github-review.md` Verifier Stats block now shows `Impact gateable count` (`stats.impact_cumulative_count`, gate threshold `impact_cumulative`) to match the local-mode presenter — the removed Premise cumulative-gate display had left GitHub mode with no line for the envelope's sole operator-tunable verdict-gate count. Also clarified the `golden_schema_v1_round_trip` fixture description to reflect that it round-trips a `schema_version: 1` finding through the current `schema_version: 2` envelope (a v1-finding backward-compat probe), instead of implying a stale v1-only test.

### code-review v2.37.1

#### Fixed
Expand Down
2 changes: 1 addition & 1 deletion plugins/code-review/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "code-review",
"description": "Code review plugin",
"version": "2.37.1",
"version": "3.0.0",
"author": {
"name": "ClosedLoop",
"email": "support@closedloop.ai"
Expand Down
15 changes: 6 additions & 9 deletions plugins/code-review/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A multi-agent code review plugin for Claude Code that performs deep, partitioned
- **Multi-agent parallel review**: Splits changed files into partitions and spawns concurrent reviewer agents (Bug Hunter A, plus domain specialists) to review each partition independently
- **Deterministic hygiene checks**: Pattern-based checks for CI artifacts, sensitive file exposure, and path leakage — zero LLM tokens required
- **Risk-based model routing**: Scores each file partition by risk (size, file type, LOC) and routes high-risk partitions to more capable models
- **Cost-optimized orchestration**: The orchestrator walk is mechanical (run helper, read JSON, honor gates) and carries no diff or large artifacts in its own context, so it is cheap to run on a lower-cost session model while spawned reviewer and verifier subagents keep their own route-assigned models — run `/code-review` from a standard-context Sonnet session for the cheapest orchestrator without changing review quality
- **Cost-optimized orchestration**: The orchestrator walk is mechanical (run helper, read JSON, honor gates) and carries no diff or large artifacts in its own context, so it is cheap to run on a lower-cost session model while spawned reviewer and verifier subagents keep their own route-assigned models — run `/code-review` from a standard-context Sonnet session for the cheapest orchestrator without changing review quality (the worker subagents pin `effort: high`, so lowering the session effort too won't reduce reviewer reasoning depth)
- **Finding validation and deduplication**: Normalizes severity, filters low-confidence findings, deduplicates near-duplicate issues via Jaccard similarity, and validates line numbers against the actual diff
- **Incremental reviews**: Tracks prior review state to diff only new commits since the last successful review (auto-incremental mode)
- **Caching**: Content-addressed cache keyed on prompt hash and diff tip to skip re-reviewing unchanged partitions
Expand Down Expand Up @@ -260,21 +260,19 @@ Each finding includes: file path, line number, severity, category, issue title,

Operator-tunable knobs live under `.closedloop-ai/settings/`. All files are optional; absent or malformed entries fall back to built-in defaults.

### `verdict-thresholds.json` (PLN-721, PLN-773)
### `verdict-thresholds.json` (FEA-1401)

Tunes the verdict-precedence gates and the operator-facing telemetry alerts:
Tunes the verdict-precedence gates:

```json
{
"premise_cumulative_medium": 3,
"justification_rate_alert": 0.30
"impact_cumulative": 2
}
```

| Key | Default | Effect |
|---|---|---|
| `premise_cumulative_medium` | `3` | Trigger `NEEDS_ATTENTION` when at least N MEDIUM Premise findings survive verification on the same PR, even if no individual finding is HIGH. Set to a very large number (e.g. `999`) to disable. Values below 1 are ignored. |
| `justification_rate_alert` | `0.30` | Threshold above which `stats.justification.threshold_alert` flips to `true` and the Verifier Stats footer flags the run. PLN-721 §Telemetry: "if > ~30%, authors likely gaming the hatch." Footer-only alert (does not modify the verdict). Set to `1.0` to disable. Values outside `[0.0, 1.0]` are ignored. |
| `impact_cumulative` | `2` | Trigger `NEEDS_ATTENTION` when at least N BLOCKING/HIGH `ImpactAnalysis` findings survive verification on the same PR (the cumulative Impact gate — SCHEMA.md §5 verdict-precedence Rule 4 / FEA-1401 OQ#6), even if no single finding would gate on its own. Set to a very large number (e.g. `999`) to disable. Values below 1 are ignored. |

### `verification-gates.json` (PLN-722)

Expand Down Expand Up @@ -307,8 +305,7 @@ The presenter (local mode `start.md`, GitHub mode `code-review-verifier-stats.md

- Per-reviewer FP rate (`stats.verification.by_reviewer[*].fp_rate`)
- Override count per reviewer (`stats.verification.by_reviewer[*].re_asserted`)
- Premise justification rate + rejection rate (`stats.justification.*`)
- Premise findings partitioned by subcategory (`stats.by_subcategory`)
- Justified-finding counts (`stats.verification.justified_valid_count` / `justified_invalid_count`)

`pending-learnings/premise-justifications.jsonl` and `pending-learnings/verifier-overrides.jsonl` feed `self-learning:process-learnings` so the verifier's J2 (responsiveness) threshold and the per-reviewer FP-rate gate can tune over time. Both jsonl writers serialize via `fcntl.flock` so concurrent runs each get exactly one well-formed line per event.

Expand Down
23 changes: 12 additions & 11 deletions plugins/code-review/SCHEMA.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ shape. Producers may emit dicts directly; the Python convenience type lives in
"system_marker": "<from the canonical enum (Section 3); null when finding_scope == 'diff'>",

// ── Classification ────────────────────────────────────────
"category": "Correctness | Code Quality | Documentation | Hygiene | Repo Hygiene | Premise | ImpactAnalysis | TestQuality | Coverage | InjectionAttempt | CompanionChange | Security",
"category": "Correctness | Code Quality | Documentation | Hygiene | Repo Hygiene | ImpactAnalysis | TestQuality | Coverage | InjectionAttempt | CompanionChange | Security",
"subcategory": "<category-specific; nullable>",

// ── Severity ──────────────────────────────────────────────
Expand Down Expand Up @@ -181,7 +181,7 @@ The terminal artifact of every review run.
// ── Stats ─────────────────────────────────────────────────
"stats": {
"by_severity": {"BLOCKING": <int>, "HIGH": <int>, "MEDIUM": <int>},
"by_category": {"Correctness": <int>, "Premise": <int>, ...},
"by_category": {"Correctness": <int>, ...},
"by_reviewer": {"<reviewer>": {"verified": <int>, "rejected": <int>, "tentative": <int>, "justified": <int>}},
"by_finding_scope": {"diff": <int>, "system": <int>, "pr_metadata": <int>},
"verification": {
Expand All @@ -194,7 +194,7 @@ The terminal artifact of every review run.
"skipped_count": <int>,
"false_positive_rate": <float>
},
"premise_cumulative_medium_count": <int>,
"impact_cumulative_count": <int>,
"agent_failures": [{"agent_id": "<id>", "reason": "<string>"}]
},

Expand Down Expand Up @@ -270,13 +270,14 @@ The `verdict` subcommand applies these rules in order; the first match wins.
1. Any coverage gap with `required: true` (foundation) → **CHANGES_REQUESTED**
2. Any BLOCKING finding (verified or system-scoped) → **CHANGES_REQUESTED**
3. Any HIGH finding (verified or system-scoped) → **NEEDS_ATTENTION**
4. ≥ N MEDIUM Premise findings (plan 02; default N=3) → **NEEDS_ATTENTION**
5. ≥ M BLOCKING/HIGH Impact Analysis findings (plan 06; default M=2) → **NEEDS_ATTENTION**
6. Any TENTATIVE finding (plan 03) → **NEEDS_ATTENTION**
7. Otherwise → **APPROVED**
4. ≥ M BLOCKING/HIGH Impact Analysis findings (plan 06; default M=2) → **NEEDS_ATTENTION**
5. Any TENTATIVE finding (plan 03) → **NEEDS_ATTENTION**
6. Otherwise → **APPROVED**

`verdict_reason` cites the specific finding(s) that produced the verdict.

**Numbering note.** This list is a clean sequential summary. The implementation (`_compute_canonical_verdict`) carries plan-derived rule labels — including the `2.5` (mandatory-human-review short-circuit) and `3.5` (TENTATIVE fall-through) sub-rules, and the cumulative Impact gate labeled **Rule 6** (PLN-726 OQ#6) — so the code's labels do not map 1:1 to the numbers above (e.g. the Impact gate is item 4 here but "Rule 6" in code).

The verdict subcommand writes `<CR_DIR>/verdict.json` with both the canonical verdict and a `verdict` string compatible with `run-loop.sh` (which keys on the legacy form):
- APPROVED → approve
- NEEDS_ATTENTION → needs_attention
Expand Down Expand Up @@ -648,12 +649,12 @@ the same normalization path the assertion uses, so a subsequent
no-flag run sees byte-identical output. Updates are reviewed in the
commit diff, not auto-merged.

**Phase 8 ships 3 fixtures end-to-end**
**Phase 8 shipped 3 fixtures end-to-end**
(`golden_minimal_correctness`, `golden_all_categories`,
`golden_schema_v1_round_trip`) plus a byte-identical determinism test
for `prepare-run`. The 6 fixtures requiring plans 01/02/03/05/06
(`golden_premise_*`, `golden_impact_with_callsites`,
`golden_coverage_gap`, `golden_injection_quarantine`,
for `prepare-run`; PLN-720 promoted a 4th, `golden_injection_quarantine`.
The remaining 3 fixtures requiring plans 03/05/06
(`golden_impact_with_callsites`, `golden_coverage_gap`,
`golden_budget_exceeded`) have reserved directories with READMEs and
are skipped via a `_DEFERRED_FIXTURES` map in the test module until
their dependent plans land. Phase 4b will extend the harness to walk
Expand Down
1 change: 1 addition & 0 deletions plugins/code-review/agents/code-review-worker-graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: code-review-worker-graph
description: Graph-aware code review worker for the cross-file reviewers (Impact Analyzer, Bug Hunter B, fast-path). Identical to code-review-worker but adds read-only codebase-memory-mcp tools for precise cross-file usage discovery. Use only for reviewers whose role prompt loads the codebase knowledge graph protocol.
tools: Read, Write, Grep, Glob, mcp__codebase-memory-mcp__search_graph, mcp__codebase-memory-mcp__trace_path, mcp__codebase-memory-mcp__get_code_snippet, mcp__codebase-memory-mcp__search_code
effort: high # pinned so a lowered session effort can't cut reviewer reasoning depth (no per-Task override; frontmatter is the only lever). Not redundant with the default — do not remove. Rationale: start.md "Orchestrator model (cost)".
---

# Code Review Worker (graph-aware)
Expand Down
1 change: 1 addition & 0 deletions plugins/code-review/agents/code-review-worker.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: code-review-worker
description: Worker agent for partitioned code review tasks. Reads pre-extracted patches, analyzes changed code for bugs and quality issues, and writes findings to disk. Use when spawning background review agents that need file access.
tools: Read, Write, Grep, Glob
effort: high # pinned so a lowered session effort can't cut reviewer reasoning depth (no per-Task override; frontmatter is the only lever). Not redundant with the default — do not remove. Rationale: start.md "Orchestrator model (cost)".
---

# Code Review Worker
Expand Down
Loading
Loading