refactor(code-review): reorder phases - adversarial first, context-aware second

- Swap step-03 and step-04: adversarial review now runs before context-aware
- Move discover_inputs from step-01 to step-04 (JIT loading)
- Add input_file_patterns to workflow.md frontmatter
- Adversarial runs lean (just diff + code), context-aware loads planning docs
This commit is contained in:
Alex Verkhovsky 2026-01-05 01:09:38 -08:00
parent 64c32d8c8c
commit ae9b83388c
5 changed files with 39 additions and 16 deletions

View File

@ -82,10 +82,9 @@ Set `{git_discrepancies}` with categories:
- **files_in_story_not_git**: Files in story File List but no git changes
- **uncommitted_undocumented**: Uncommitted changes not tracked in story
### 6. Load Context
### 6. Load Project Context
- Load `{project_context}` if exists (`**/project-context.md`)
- Invoke `discover_inputs` protocol to load architecture, UX, epic docs as needed
- Load `{project_context}` if exists (`**/project-context.md`) for coding standards
---
@ -105,7 +104,7 @@ Set `{git_discrepancies}` with categories:
- `{story_file_list}` compiled from Dev Agent Record
- `{git_changed_files}` discovered via git commands
- `{git_discrepancies}` calculated
- Context documents loaded
- `{project_context}` loaded if exists
- Explicit NEXT directive provided
## FAILURE MODES

View File

@ -3,7 +3,7 @@ name: 'step-02-build-attack-plan'
description: 'Extract ACs and tasks, create comprehensive review plan for both phases'
thisStepFile: '{installed_path}/steps/step-02-build-attack-plan.md'
nextStepFile: '{installed_path}/steps/step-03-context-aware-review.md'
nextStepFile: '{installed_path}/steps/step-03-adversarial-review.md'
---
# Step 2: Build Review Attack Plan
@ -124,7 +124,7 @@ Proceeding with dual-phase review...
**CRITICAL:** When this step completes, explicitly state:
"**NEXT:** Loading `step-03-context-aware-review.md`"
"**NEXT:** Loading `step-03-adversarial-review.md`"
---

View File

@ -1,12 +1,12 @@
---
name: 'step-04-adversarial-review'
name: 'step-03-adversarial-review'
description: 'Context-independent adversarial diff review via subagent - no story knowledge'
thisStepFile: '{installed_path}/steps/step-04-adversarial-review.md'
nextStepFile: '{installed_path}/steps/step-05-consolidate-findings.md'
thisStepFile: '{installed_path}/steps/step-03-adversarial-review.md'
nextStepFile: '{installed_path}/steps/step-04-context-aware-review.md'
---
# Step 4: Adversarial Review (Information Asymmetric)
# Step 3: Adversarial Review (Information Asymmetric)
**Goal:** Perform context-independent adversarial review of code changes. Reviewer sees ONLY the diff - no story, no ACs, no context about WHY changes were made.
@ -132,7 +132,7 @@ Proceeding to findings consolidation...
**CRITICAL:** When this step completes, explicitly state:
"**NEXT:** Loading `step-05-consolidate-findings.md`"
"**NEXT:** Loading `step-04-context-aware-review.md`"
---

View File

@ -1,12 +1,12 @@
---
name: 'step-03-context-aware-review'
name: 'step-04-context-aware-review'
description: 'Story-aware validation: verify ACs, audit task completion, check git discrepancies'
thisStepFile: '{installed_path}/steps/step-03-context-aware-review.md'
nextStepFile: '{installed_path}/steps/step-04-adversarial-review.md'
thisStepFile: '{installed_path}/steps/step-04-context-aware-review.md'
nextStepFile: '{installed_path}/steps/step-05-consolidate-findings.md'
---
# Step 3: Context-Aware Review
# Step 4: Context-Aware Review
**Goal:** Perform story-aware validation - verify AC implementation, audit task completion, review code quality with full story context.
@ -36,6 +36,12 @@ Initialize `{context_aware_findings}` as empty list.
## EXECUTION SEQUENCE
### 0. Load Planning Context (JIT)
Invoke `discover_inputs` protocol to load architecture, UX, and epic documents.
These provide the design context needed to validate AC implementation against system requirements.
### 1. Git vs Story Discrepancies
Review `{git_discrepancies}` and create findings:
@ -149,7 +155,7 @@ Store `{context_aware_findings}` for consolidation in step 5.
**CRITICAL:** When this step completes, explicitly state:
"**NEXT:** Loading `step-04-adversarial-review.md`"
"**NEXT:** Loading `step-05-consolidate-findings.md`"
---

View File

@ -2,6 +2,24 @@
name: code-review
description: 'Code review for dev-story output. Audits acceptance criteria against implementation, performs adversarial diff review, can auto-fix with approval. A different LLM than the implementer is recommended.'
web_bundle: false
input_file_patterns:
architecture:
description: 'System architecture for review context'
whole: '{planning_artifacts}/*architecture*.md'
sharded: '{planning_artifacts}/*architecture*/*.md'
load_strategy: 'FULL_LOAD'
ux_design:
description: 'UX design specification (if UI review)'
whole: '{planning_artifacts}/*ux*.md'
sharded: '{planning_artifacts}/*ux*/*.md'
load_strategy: 'FULL_LOAD'
epics:
description: 'Epic containing story being reviewed'
whole: '{planning_artifacts}/*epic*.md'
sharded_index: '{planning_artifacts}/*epic*/index.md'
sharded_single: '{planning_artifacts}/*epic*/epic-{{epic_num}}.md'
load_strategy: 'SELECTIVE_LOAD'
---
# Code Review Workflow