Specialist subagents

The agent that writes the code is never the agent that judges it. Nine agent definitions split the work: one builder that tests first and never commits, seven reviewers that read a diff and report, and one UI designer. A routing table picks reviewers by the file types in the diff.

  • Multi-agent orchestration
  • Least privilege
  • Context isolation
  • Automated code review
What it is
Nine markdown files under agents/, each with a frontmatter tool allowlist and turn cap and a body that sets scope, a checklist and an output format. They run as Claude Code subagents, each in its own context window. mow dispatches the builder and names reviewers per lane.
What it isn't
Not a general reviewer pool. Every reviewer is tuned to one stack (FastAPI, Next.js, Expo, Supabase, Streamlit, server-rendered templates, LLM code). A diff in a stack outside that list gets no specialist here.
Why it exists
An agent that has just written code argues for it. Separate agents with separate context, a narrower tool set and a written checklist make review a different job from building, and they put findings in a fixed format with a file:line for each one.
9agent files in agents/
7reviewers, all Read, Grep, Glob, Bash
427measured tdd-builder lanes
90.0%of source-editing builder runs loaded tdd first

How it works

Routing lives in one table in global/CLAUDE.md under "Toolkit routing", which every session loads. It keys on what the diff contains: .py importing FastAPI or SQLAlchemy goes to backend-reviewer; templates, .html and framework-free .js go to classic-web-reviewer; anything touching prompts, tool calls, agents or RAG also goes to llm-sec-review, alongside the stack reviewer. A diff that touches a Python route and its template gets both halves reviewed, because dispatch is by file type and neither reviewer reads the other's files.

One diff api/routes.py templates/list.html agent/prompt.py Routing table by file type backend-reviewer async · ORM · tenancy classic-web-reviewer escaping · HTMX · a11y llm-sec-review injection · tool authz frontend-reviewer not dispatched Findings + Handoffs operator decides .py .html prompt no .tsx
A mixed diff gets one reviewer per file type, never one reviewer for everything. The prompt module is also Python, so in practice the backend reviewer reads it too; llm-sec-review runs alongside it for the model-facing risks.

Every reviewer follows the same shape. On invoke it establishes the diff scope itself (git diff --name-only first), confirms the stack from imports, and reads the project's own invariants (CLAUDE.md, ADRs, the tenancy model) before judging anything against them. Then it applies a lettered checklist to every changed hunk and reports Critical / Warning / Suggestion findings, each with a file:line and a concrete fix, plus a Handoffs section that names the sibling agent for anything outside its lane. Then it stops. The bodies say it outright: never edit, never fix, the developer decides.

AgentScopeTools · turn capRefuses or hands off
backend-reviewerFastAPI, Pydantic v2, async SQLAlchemy 2.0, Alembic, Celery/ARQ, agent code in PythonRead, Grep, Glob, Bash · 80Templates and JS to classic-web, React to frontend, Streamlit, Supabase, prompts to llm-sec. With no in-lane .py, it reports the handoff and stops.
classic-web-reviewerVanilla JS, jQuery, HTMX, Jinja-syntax templates, TailwindRead, Grep, Glob, Bash · 80Route authz, tenancy and query cost to backend; aesthetics to ui-designer. One escaping bug seen in a template and a script is one finding.
frontend-reviewerNext.js App Router, TypeScript, TanStack Query, SVG renderingRead, Grep, Glob, Bash · noneReviews correctness, not aesthetics. Expo diffs to expo-reviewer.
expo-reviewerExpo and React Native, Expo Router, secure token storage, platform splitsRead, Grep, Glob, Bash · 40Any Supabase key, client or RLS hit becomes a one-line handoff, never its own finding, even a Critical one.
supabase-reviewerMigrations, RLS, storage policies, security definer, pgTAP, keys in any languageRead, Grep, Glob, Bash · 30Triggered by a pattern grep, not a path. In an app file only the client-and-keys section is its job.
streamlit-reviewerRerun model, caching, session_state, cross-session leakage through globalsRead, Grep, Glob, Bash · noneImported service code to backend. Must name the rerun cost of each finding.
llm-sec-reviewPrompt injection, Rule of Two, tool-call authz, output sinks, secrets in model context, RAG, costRead, Grep, Glob, Bash · 70General application security goes to the built-in /security-review. Maps inputs, capabilities, secrets and sinks before judging.
tdd-builderExactly one dispatch brief or scoped taskRead, Edit, Write, Bash, Glob, Grep, Skill, Agent · 320Never commits, pushes or tags. Stops on an out-of-scope file. Does not grade its own work. Ends with ## Verification.
ui-designerNext.js + Tailwind + shadcn/ui screens, mobile-firstall (no allowlist) · 240Refuses inline hex, hand-built dialogs and fetch inside components. A project's own ui-designer overrides it.

The builder

tdd-builder is the only agent that writes code. Its brief is its whole contract: it has no other conversation context and is told not to assume any. Six non-negotiables govern it. Invoke the tdd skill before any production code and record the failing output as red evidence. Treat Files in scope as a hard boundary. Re-read Do NOT before the final pass. Run every QA-contract command for real. Never commit. Never self-certify.

It also auto-invokes skills mid-build: parallel-debug when pytest shows more than one unrelated failure, test-coverage on thin modules, adversarial-tester on pure logic, and imprint after any UI change. Each one gets a line in the final block, either "invoked" or "n/a" with a reason. A skill that isn't available in the runtime is followed from disk and recorded as such, so a missing skill doesn't drop a step without a trace.

## Verification
- Commands run: <exact commands + pass/fail>
- Contract items: <each QA-contract item → met / not-applicable + why>
- Artifacts: <paths created/modified, or "none">
- Red evidence: <per regression test: name + failing output pre-fix>
- Auto-invokes: tdd · parallel-debug · ui · imprint · test-coverage · adversarial-tester

The block doesn't stay in chat. mow writes it to dispatch/verification/<brief>, and check_verification refuses a wave whose lanes have no record, or whose record names artifacts the tree doesn't hold. That second check exists because a record once claimed two findings closed after a reset had removed all of their code.

AI engineering practices it demonstrates

  • Builder/reviewer separation. The builder is told "you are not the reviewer"; reviewers are told to stop after reporting. /fix-bug repeats it: independent review of the diff, builder ≠ reviewer.
  • Least privilege, checked by a test. Reviewers get four tools. bin/tests/test_agent_tools.py fails if an agent's body tells it to use a tool its allowlist doesn't grant. It was written after tdd-builder was told to track items with a task tool it could not call, so the instruction degraded to nothing.
  • Context isolation. Each subagent starts with a fresh window and the brief. A lane's progress checklist goes to the scratchpad or $TMPDIR, never the repo.
  • Budgets come from measurement. Turn caps follow one rule over measured runs: max(observed max, ceil(p99 × 1.5)), rounded up to 10, and only for agent types with at least 20 runs. bin/tests/test_lane_bounds.py fails if any cap in agents/*.md drifts from the rule.
  • Loop breaking. hooks/lane-repeat-guard.py denies a subagent's fourth identical failing call. A successful edit resets the count, so a red-green loop that keeps rerunning pytest is not mistaken for a stuck one.
  • One finding has one reporter. Overlapping lanes (Expo and Supabase keys, a template and a route) hand off instead of double-reporting.
  • Project invariants over generic advice. A reviewer reads CLAUDE.md, ADRs and the tenancy model before judging. When a finding depends on context it hasn't seen, it says so and names what would confirm it.

Capabilities

  • Seven stacks covered by checklists of six to nine lettered sections each, with severity mappings and a shared output format.
  • Pattern-triggered review: supabase-reviewer greps the diff for createClient, .from(, .rpc(, service_role and SUPABASE_, so a leaked key in a mobile screen reaches it even when no supabase/ path changed.
  • A lane can fan out its own subagents (parallel-debug, a project ui-designer) because tdd-builder holds the Agent tool. Reviewers do not hold it.
  • The same definitions travel to other runtimes through ai-sync. See Architecture and sync.

Benefits

  • Review output is uniform across stacks, so a mow gate can read seven reviewers' findings the same way.
  • The builder's claims arrive as an auditable block on disk. A lane that skipped red evidence says so in its own words, which is easier to catch than silence.
  • Runaway lanes are bounded without cutting real ones: no measured run would have hit its cap.

Limits

Where it loses

"Read-only" is an instruction, not a sandbox. Every reviewer holds Bash and could write through the shell. The readonly: true frontmatter flag is honoured only by runtimes that read it. I found no test or guard that proves a review run left the tree untouched.

  • Stack-locked. The measured lane table shows 111 runs of a django-reviewer that lives in a product repo's own agents, not here. A Django, Go or Rails diff gets the generic "stack reviewer matching the project" row and nothing in this repo.
  • Routing is advisory. The CLAUDE.md table says so ("recommend or invoke, don't block"). Only mow's dispatch index names reviewers per lane, and nothing yet checks that each named reviewer resolves to a real agent file.
  • The builder's test-first rate sits on its bar. 360 of 400 source-editing tdd-builder runs loaded tdd before the first edit: 90.0%, exactly the threshold. Forty runs edited source first.
  • ui-designer assumes Next.js + shadcn/ui and has no tool allowlist. On any other stack the builder has to find a project-local designer or skip it.
  • frontend-reviewer (11 measured runs) and streamlit-reviewer (none) have no turn cap yet, because the sizing rule needs 20 runs.

Roadmap

ItemWhy it mattersStatus
Confirm Cursor runs shell hooks for subagent callsLane guards are only proven on Claude Code; a runtime that skips them for subagents loses the loop breakerunverified
Decide which library docs count as primary sources for the React and TanStack checklist itemsSeveral frontend checklist items wait on this rulingdecision pending
Gate: every reviewer named in a dispatch resolves to an agent fileA misspelled reviewer would silently never runbacklog
Concurrent custom-agent lanes on the work-PC Copilot hostThe builder/reviewer split has only run on Claude Codebacklog
Project-tuned reviewersA shared way to adapt checklists per project; parked until the public harness decision landsparked

Sources

  • agents/*.md: nine files; frontmatter tools, readonly, maxTurns; On invoke, checklists, Handoffs, Rules of engagement.
  • global/CLAUDE.md, section "Toolkit routing": the dispatch-by-file-type table.
  • docs/workflow/lane-bounds.md: measured lane table (2026-10-05), sizing rule, repeat guard.
  • hooks/lane-repeat-guard.py, bin/tests/test_agent_tools.py, bin/tests/test_lane_bounds.py.
  • taskman/taskman/mow/check_verification.py: the on-disk Verification gate.
  • docs/workflow/skill-evals.md, "Real chats": the 360/400 builder figure.
  • Task board: open items for runtime hook coverage, primary-source ruling, reviewer-name gate, Copilot lanes.

Facts as of 2026-10-08. Agent counts, tool lists and caps read from source on that date; lane statistics as measured 2026-10-05.