File size: 3,515 Bytes
7a5c442
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Review workflow

`icat_app` uses a findings-first reviewer contract. Reviewer behavior is enforced by hooks; this doc is the human-readable version of that contract.

## When the reviewer runs

The reviewer must run before any commit that touches substantive files (`.py`, `.ts`, `.tsx`, `.js`, `.jsx`, `.R`, `.r`, `.java`, `.sql`, anything under `scripts/`). Pure docs / markdown changes do not require the reviewer.

In a Claude Code session, the Stop hook (`.claude/hooks/reviewer-stop.sh`) blocks session end if substantive files are modified and no fresh `.decode-reviewer-clean` marker exists. The `commit-msg` git hook (`.githooks/commit-msg`) blocks the commit itself unless a fresh marker exists.

## What the reviewer does

The reviewer is the `feature-dev:code-reviewer` subagent (provided by the `feature-dev@claude-plugins-official` plugin). It is dispatched via the Agent tool. The contract:

- **Input**: `git diff HEAD` (current change) + repo context.
- **Latency target**: under 90 seconds.
- **Output**: blocker findings only. Confidence floor: ≥ 80.
- **Outcome (exactly one)**:
  - **No blockers** → write `.decode-reviewer-clean` with one line: `<HEAD-SHA> <DIFF-HASH> <ISO-8601-UTC-timestamp>`. Compute `<HEAD-SHA>` via `git rev-parse HEAD` and `<DIFF-HASH>` via `bash scripts/reviewer-hash.sh` (covers tracked diff + untracked file contents).
  - **Blockers** → write `.decode-reviewer-findings.md` with the list. **Do not** write `.decode-reviewer-clean`.

Both files are session-local artifacts. They are listed in `.gitignore` and must never be committed.

## Why the marker binds to a diff hash

If the marker only bound to `HEAD`, an agent could pass review, then silently edit a file, then commit. By binding the marker to `bash scripts/reviewer-hash.sh` (which hashes both `git diff HEAD` AND untracked file contents), any change after review invalidates the marker. The `commit-msg` hook recomputes and compares.

## Override

For genuinely trivial changes (typo, comment), an author may bypass with:

```
git commit -m "... [override-reviewer: <real reason>]"
```

The override:
- is logged forever in `git log --grep="override-reviewer"`
- is also reported in CI by the `override-audit` job in `.github/workflows/gate.yml`
- requires a real reason — `[override-reviewer: skip]` defeats the audit

Do not normalize overrides. Repeated overrides indicate the reviewer flow is broken; fix the flow.

## What the reviewer is NOT

- Not a style police. Ruff handles lint via `.githooks/pre-commit` + `.github/workflows/gate.yml`.
- Not a structural sweep. `python scripts/repo_validate.py` handles `py_compile` + manifest sanity (locally + in `.github/workflows/repo_validate.yml`).
- Not a security scanner. See `SECURITY.md` for the secrets handling rules.

The reviewer's job is to catch **blocking semantic / design / boundary issues** that lint and `py_compile` cannot see — e.g., "this change touches `.github/workflows/main.yml` and will alter the HF deploy"; "this introduces a new `helper.py` dependency that contradicts the active-surface map".

## Plugin requirement

The reviewer subagent ships with the `feature-dev@claude-plugins-official` plugin. Install once per machine via Claude Code:

```
/plugin marketplace add anthropics/claude-plugins-official
/plugin install feature-dev@claude-plugins-official
```

Without `feature-dev`, every commit touching source code will be blocked by the `commit-msg` gate. See `CLAUDE.md` for the full session-start setup.