Skip to content

Plan review agent — blast radius analysis before implementation begins #71

@justinjdev

Description

@justinjdev

Problem

Plans are text — they list files and steps, but don't validate whether the proposed changes are actually scoped correctly. A plan might say "modify UserService.authenticate()" without accounting for 12 callers, 3 interface implementations, and 2 open PRs touching the same file. These surprises surface during Implement, causing recovery triggers and rework.

Balrog reviews code after implementation. Nothing reviews plans before implementation.

Proposal

A plan review agent that validates plans at the Plan gate, analogous to how balrog validates code at the Implement gate.

What It Analyzes

Check Method Finding Example
Blast radius Trace callers/dependents of functions targeted by the plan "authenticate() is called from 12 locations — signature changes will cascade"
Open PR overlap gh pr list + diff file sets "PR #38 also modifies auth_middleware.go — potential merge conflict"
Missing files Cross-reference plan steps against import/dependency graph "Plan modifies UserService but doesn't mention UserServiceTest — tests will break"
Scope creep risk Count files/functions affected transitively "Plan targets 3 files directly but affects 11 transitively — consider narrowing scope"
Interface contracts Check if modified functions are interface implementations "authenticate() implements Authenticator interface — changes require updating all implementations"

Invocation

Spawned by the quest runner after Plan is written, before the Plan gate is submitted:

Phase 2 (Plan):
  1. Write plan (file:line references, test strategy)
  2. Spawn plan review agent → receives plan + codebase access
  3. Agent produces findings report
  4. Quest incorporates findings (revise plan if needed)
  5. Submit Plan gate with plan + review findings

Findings Format

## Plan Review

### REVISE (plan needs changes before approval)
- authenticate() has 12 callers — plan doesn't account for caller updates
- PR #38 modifies auth_middleware.go — coordinate or sequence

### CAUTION (proceed but be aware)
- UserService implements Authenticator interface (2 implementations)
- Transitive blast radius: 11 files (plan lists 3)

### CLEAR
- Test files correctly identified
- No open PR conflicts for other plan files

Blast Radius: 3 direct → 11 transitive
Open PR Overlap: 1 PR (#38)

Agent Definition

  • Tools: Read, Glob, Grep, Bash (read-only: gh pr list, git log), SendMessage
  • No write access — purely analytical, like palantir
  • Named: Could extend balrog's role or be a new agent (e.g., "saruman" — the planner who sees far but doesn't act)

Relationship to Existing Features

  • Balrog: reviews code after implementation for failure modes. Plan review agent reviews plans before implementation for scope accuracy.
  • Warden: reviews code against conventions. Plan review agent reviews plans against the dependency graph.
  • Palantir: monitors progress during execution. Plan review agent is a one-shot analysis at the Plan gate.

Configuration

{
  "planReview": {
    "enabled": true,
    "autoSpawn": true,
    "blastRadiusWarning": 10
  }
}

Scope

  • New agent definition (or extend existing agent)
  • Blast radius analysis (caller/dependent tracing)
  • Open PR overlap detection
  • Missing file detection (test files, interface implementations)
  • Integration into quest Phase 2 (spawn before Plan gate)
  • Findings format and gate integration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions