Skip to content

Commit 2d9b44b

Browse files
nhortonclaude
andauthored
feat(review): default to minimal 'reviewer' subagent on Sonnet (#364)
* feat(review): default to minimal 'reviewer' subagent on Sonnet Ship a new 'reviewer' subagent in the DeepWork Claude plugin pinned to Sonnet with minimal instructions, and default review dispatch to it. Opus→Sonnet across parallel review fan-out is the dominant cost lever. Per-rule agent overrides still take precedence. The reviewer's tools list includes dual-wildcard MCP prefixes (mcp__plugin_deepwork_deepwork__* and mcp__deepwork-dev__*) so the same agent file resolves mark_review_as_passed in both production (plugin install only) and development (dev MCP server, with or without plugin) contexts. Spec REVIEW-REQ-006.3.c and test_formatter.py are updated in lockstep; stale REVIEW-REQ-006.3.3b/c cross-references corrected. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address review findings — ID numbering, docs, and PLUG-REQ-001.14 - Fix test_formatter.py traceability comment IDs: restore the .3.3 hierarchy level (REVIEW-REQ-006.3.3c, .3.3b) instead of the incorrectly shortened .3.c, .3.b format. - Update README_REVIEWS.md example output to match current formatter format (name/description/subagent_type/prompt fields, reviewer default). - Add agents/ directory to CLAUDE.md and doc/architecture.md project structure trees. - Add PLUG-REQ-001.14 (Default Reviewer Subagent) formalizing the reviewer agent's existence, model, tools, and behavioral constraints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 484e1d6 commit 2d9b44b

7 files changed

Lines changed: 62 additions & 13 deletions

File tree

README_REVIEWS.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,18 +305,21 @@ This:
305305
### What the output looks like
306306

307307
```
308-
Invoke the following list of Tasks in parallel:
308+
Invoke the following list of Tasks in parallel.
309309

310-
Name: "python_review review of src/app.py"
311-
Agent: Default
310+
name: "python_review review of src/app.py"
311+
description: Review python_review
312+
subagent_type: reviewer
312313
prompt: "@.deepwork/tmp/review_instructions/7142141.md"
313314

314-
Name: "python_review review of src/lib.py"
315-
Agent: Default
315+
name: "python_review review of src/lib.py"
316+
description: Review python_review
317+
subagent_type: reviewer
316318
prompt: "@.deepwork/tmp/review_instructions/6316224.md"
317319

318-
Name: "db_migration_safety review of 2 files"
319-
Agent: db-expert
320+
name: "db_migration_safety review of 2 files"
321+
description: Review db_migration_safety
322+
subagent_type: db-expert
320323
prompt: "@.deepwork/tmp/review_instructions/3847291.md"
321324
```
322325
@@ -529,3 +532,9 @@ Patterns follow standard glob syntax, evaluated relative to the `.deepreview` fi
529532
| `config/*` | `config/settings.yaml` | `config/deep/nested.yaml` |
530533
| `**/Dockerfile` | `Dockerfile`, `services/api/Dockerfile` | `Dockerfile.dev` |
531534
| `CHANGELOG.md` | `CHANGELOG.md` | `docs/CHANGELOG.md` |
535+
536+
## Contributor setup
537+
538+
By default, `/review` dispatches each review task to the `reviewer` subagent shipped with the DeepWork Claude plugin (`plugins/claude/agents/reviewer.md`). If you are developing against this repo with only the dev MCP server (`uv run deepwork serve`) and no plugin installed, Claude Code cannot resolve `subagent_type: reviewer` and review dispatch will fail.
539+
540+
To run reviews as a contributor, install the plugin alongside the dev server: `claude plugin marketplace add Unsupervisedcom/deepwork && claude plugin install deepwork@deepwork-plugins`. The plugin ships the reviewer agent file, and either MCP server prefix (`mcp__deepwork-dev__*` or `mcp__plugin_deepwork_deepwork__*`) will resolve the reviewer's tools.

doc/architecture.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ deepwork/ # DeepWork tool repository
105105
│ ├── claude/ # Claude Code plugin
106106
│ │ ├── .claude-plugin/plugin.json
107107
│ │ ├── README_REVIEWS.md # Review system documentation
108+
│ │ ├── agents/ # Subagent definitions (e.g., reviewer.md)
109+
│ │ │ └── reviewer.md # Default review subagent (Sonnet, minimal instructions)
108110
│ │ ├── example_reviews/ # Example review instruction files
109111
│ │ │ ├── prompt_best_practices.md
110112
│ │ │ └── suggest_new_reviews.md

plugins/claude/agents/reviewer.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: reviewer
3+
description: Minimal review subagent for DeepWork review tasks. Reads a supplied instruction file, performs the review against the criteria in that file, and reports results via the DeepWork MCP mark_review_as_passed tool. Use when dispatching parallel review tasks from .deepreview rules or workflow quality gates.
4+
model: sonnet
5+
color: cyan
6+
tools:
7+
- Read
8+
- Grep
9+
- Glob
10+
- Bash
11+
- "mcp__plugin_deepwork_deepwork__*"
12+
- "mcp__deepwork-dev__*"
13+
---
14+
15+
You are a DeepWork review agent. Your only job is to execute one review task and report the result.
16+
17+
**Process**
18+
19+
1. Read the instruction file referenced in the user prompt (e.g. `@.deepwork/tmp/review_instructions/<id>.md`). The file contains the review criteria, the file(s) to review, and the expected verdict format.
20+
2. Perform the review exactly against the criteria in that file. Use `Read`, `Grep`, `Glob`, and `Bash` to examine only the files the instructions direct you to examine.
21+
3. When finished, call `mark_review_as_passed` with the structured verdict the instructions specify. Use whichever DeepWork MCP prefix is available in your environment (`mcp__plugin_deepwork_deepwork__mark_review_as_passed` in production; `mcp__deepwork-dev__mark_review_as_passed` in development).
22+
4. If the instructions ask you to call additional DeepWork MCP tools (e.g. `get_configured_reviews`, `get_named_schemas`), use whichever prefix is available in your environment.
23+
24+
**Constraints**
25+
26+
- Do not edit files. You are a read-only reviewer.
27+
- Do not explore beyond what the instructions direct. No scope creep.
28+
- Do not add commentary outside the structured verdict the instructions request.
29+
- If the instructions are ambiguous, apply them as literally as possible and note the ambiguity in the verdict rather than asking for clarification.

specs/deepwork/cli_plugins/PLUG-REQ-001-claude-code-plugin.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,12 @@ The Claude Code plugin is the primary distribution mechanism for DeepWork on the
9898
2. The skill MUST document how DeepWork Reviews work, including `.deepreview` config format, review strategies (`individual`, `matches_together`, `all_changed_files`), and how changed files are detected.
9999
3. The skill MUST explain how DeepSchemas automatically generate synthetic review rules.
100100
4. The skill MUST describe workflow quality gates and how `finished_step` triggers reviews on step outputs.
101+
102+
### PLUG-REQ-001.14: Default Reviewer Subagent
103+
104+
1. The plugin MUST ship a default reviewer subagent at `plugins/claude/agents/reviewer.md`.
105+
2. The agent's `model` frontmatter field MUST be set to `sonnet` to reduce per-review cost relative to the parent session's model.
106+
3. The agent's `tools` frontmatter field MUST include at minimum `Read`, `Grep`, `Glob`, and `Bash`, plus DeepWork MCP tools needed for review completion (`mark_review_as_passed`) in both the production (`mcp__plugin_deepwork_deepwork__*`) and development (`mcp__deepwork-dev__*`) MCP server prefixes.
107+
4. The agent body MUST instruct the subagent to read the instruction file from the user prompt, perform the review against the criteria in that file, and call `mark_review_as_passed` to report results.
108+
5. The agent body MUST instruct the subagent not to edit files and not to explore beyond what the review instructions direct.
109+
6. When the review formatter renders tasks with no per-rule agent persona specified (`agent_name` is `None`), it MUST default to `"reviewer"` as the `subagent_type` (see REVIEW-REQ-006.3.3c).

specs/deepwork/review/REVIEW-REQ-006-cli-review-command.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The `deepwork review` CLI command orchestrates the full DeepWork Reviews pipelin
3232
3. For each review task, the output MUST include fields matching the Claude Code `Task` tool parameters:
3333
a. A `name` field formatted as `"{scope_prefix}{rule_name} review of {file_or_scope}"` — for `individual` strategy, `{file_or_scope}` is the single filename; for grouped strategies, it is a summary (e.g., `"3 files"`). When the rule comes from a `.deepreview` in a subdirectory, `{scope_prefix}` MUST be `"{parent_dir_name}/"` (e.g., `"my_job/"`); for root-level `.deepreview` files, `{scope_prefix}` MUST be empty.
3434
b. A `description` field with a short (3-5 word) summary for the task (e.g., `"Review {rule_name}"`). When the rule comes from a `.deepreview` in a subdirectory, the description MUST include the scope (e.g., `"Review my_job/{rule_name}"`).
35-
c. A `subagent_type` field set to the agent persona name (from the rule's `agent.claude` value) or `"general-purpose"` if no persona is specified.
35+
c. A `subagent_type` field set to the agent persona name (from the rule's `agent.claude` value) or `"reviewer"` if no persona is specified. `"reviewer"` refers to the default reviewer subagent shipped by the DeepWork Claude plugin (`plugins/claude/agents/reviewer.md`).
3636
d. A `prompt` field referencing the instruction file path relative to the project root, prefixed with `@` (e.g., `@.deepwork/tmp/review_instructions/7142141.md`).
3737
4. The instruction file paths MUST be relative to the project root.
3838
5. When running inside a git worktree, the formatter MUST resolve `@file` paths relative to the main working tree root (not the worktree root), because Claude Code expands `@file` references relative to the main repo root. The main repo root MUST be detected via `git rev-parse --path-format=absolute --git-common-dir`. If git is unavailable or the directory is not a worktree, the formatter MUST fall back to using the project root.

src/deepwork/review/formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def format_for_claude(
106106

107107
name = _task_name(task)
108108
description = _task_description(task)
109-
subagent_type = task.agent_name or "general-purpose"
109+
subagent_type = task.agent_name or "reviewer"
110110

111111
lines.append(f'name: "{name}"')
112112
lines.append(f"\tdescription: {description}")

tests/unit/review/test_formatter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,23 @@ def test_inline_content_task_name_says_inline_content(self, tmp_path: Path) -> N
7070
assert 'name: "string_rule review of inline content"' in result
7171
assert "0 files" not in result
7272

73-
# THIS TEST VALIDATES A HARD REQUIREMENT (REVIEW-REQ-006.3.3b).
73+
# THIS TEST VALIDATES A HARD REQUIREMENT (REVIEW-REQ-006.3.3c).
7474
# YOU MUST NOT MODIFY THIS TEST UNLESS THE REQUIREMENT CHANGES
7575
def test_default_subagent_type_when_no_agent(self, tmp_path: Path) -> None:
7676
task = _make_task(agent_name=None)
7777
file_path = tmp_path / "instructions.md"
7878
result = format_for_claude([(task, file_path)], tmp_path)
79-
assert "subagent_type: general-purpose" in result
79+
assert "subagent_type: reviewer" in result
8080

81-
# THIS TEST VALIDATES A HARD REQUIREMENT (REVIEW-REQ-006.3.3b).
81+
# THIS TEST VALIDATES A HARD REQUIREMENT (REVIEW-REQ-006.3.3c).
8282
# YOU MUST NOT MODIFY THIS TEST UNLESS THE REQUIREMENT CHANGES
8383
def test_custom_subagent_type(self, tmp_path: Path) -> None:
8484
task = _make_task(agent_name="security-expert")
8585
file_path = tmp_path / "instructions.md"
8686
result = format_for_claude([(task, file_path)], tmp_path)
8787
assert "subagent_type: security-expert" in result
8888

89-
# THIS TEST VALIDATES A HARD REQUIREMENT (REVIEW-REQ-006.3.3c).
89+
# THIS TEST VALIDATES A HARD REQUIREMENT (REVIEW-REQ-006.3.3b).
9090
# YOU MUST NOT MODIFY THIS TEST UNLESS THE REQUIREMENT CHANGES
9191
def test_description_field_present(self, tmp_path: Path) -> None:
9292
task = _make_task(rule_name="py_review")

0 commit comments

Comments
 (0)