Skip to content

Commit fcd0b9a

Browse files
catlog22claude
andcommitted
refactor: split review responsibilities — code review in lite-execute, convergence review in lite-test-review
- lite-plan LP-Phase 4: split single "Review" into two selections (Code Review + Convergence Review) - lite-execute: add Step 4 Code Review (agent/codex/gemini) with code-review.md artifact, Step 5 passes convergenceReviewTool - lite-test-review: rename reviewTool → convergenceReviewTool, TR-Phase 2 focused on convergence criteria verification - All autoYes paths default both reviews to Skip - Data structures updated across all three files for consistency Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fab07c2 commit fcd0b9a

3 files changed

Lines changed: 172 additions & 51 deletions

File tree

.claude/skills/workflow-lite-execute/SKILL.md

Lines changed: 106 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function selectExecutionOptions() {
7474
const autoYes = workflowPreferences?.autoYes ?? false
7575

7676
if (autoYes) {
77-
return { execution_method: "Auto", code_review_tool: "Skip" }
77+
return { execution_method: "Auto", code_review_tool: "Skip", convergence_review_tool: "Skip" }
7878
}
7979

8080
return AskUserQuestion({
@@ -90,14 +90,25 @@ function selectExecutionOptions() {
9090
]
9191
},
9292
{
93-
question: "Review tool for test-review phase?",
94-
header: "Review Tool (passed to lite-test-review)",
93+
question: "Code review after execution? (runs here in lite-execute)",
94+
header: "Code Review",
9595
multiSelect: false,
9696
options: [
97-
{ label: "Agent Review", description: "Agent review in test-review (default)" },
98-
{ label: "Gemini Review", description: "Gemini CLI in test-review" },
99-
{ label: "Codex Review", description: "Codex CLI in test-review" },
100-
{ label: "Skip", description: "Skip review in test-review" }
97+
{ label: "Gemini Review", description: "Gemini CLI: git diff quality review" },
98+
{ label: "Codex Review", description: "Codex CLI: git-aware code review (--mode review)" },
99+
{ label: "Agent Review", description: "@code-reviewer agent" },
100+
{ label: "Skip", description: "No code review" }
101+
]
102+
},
103+
{
104+
question: "Convergence review in test-review phase?",
105+
header: "Convergence Review",
106+
multiSelect: false,
107+
options: [
108+
{ label: "Agent", description: "Agent: verify convergence criteria" },
109+
{ label: "Gemini", description: "Gemini CLI: convergence verification" },
110+
{ label: "Codex", description: "Codex CLI: convergence verification" },
111+
{ label: "Skip", description: "Skip convergence review, run tests only" }
101112
]
102113
}
103114
]
@@ -117,7 +128,8 @@ if (executionContext) {
117128
console.log(`
118129
Execution Strategy (from lite-plan):
119130
Method: ${executionContext.executionMethod}
120-
Review: ${executionContext.codeReviewTool}
131+
Code Review: ${executionContext.codeReviewTool}
132+
Convergence Review: ${executionContext.convergenceReviewTool}
121133
Tasks: ${getTasks(executionContext.planObject).length}
122134
Complexity: ${executionContext.planObject.complexity}
123135
${executionContext.executorAssignments ? ` Assignments: ${JSON.stringify(executionContext.executorAssignments)}` : ''}
@@ -367,18 +379,97 @@ ${(t.test?.success_metrics || []).length > 0 ? `**Success metrics**: ${t.test.su
367379
}
368380
```
369381
370-
### Step 4: Chain to Test Review & Post-Completion
382+
### Step 4: Code Review
371383
372-
> **Note**: Spec sync (session:sync) is handled by lite-test-review's TR-Phase 5, not here. This avoids duplicate sync and ensures test fix changes are also captured.
384+
**Skip if**: `codeReviewTool === 'Skip'`
373385
374-
**Map review tool**: Convert lite-execute's `codeReviewTool` to test-review tool name.
386+
**Resolve review tool**: From `executionContext.codeReviewTool` (Mode 1) or `userSelection.code_review_tool` (Mode 2/3).
375387
376388
```javascript
377-
function mapReviewTool(codeReviewTool) {
389+
const codeReviewTool = executionContext?.codeReviewTool || userSelection?.code_review_tool || 'Skip'
390+
const resolvedTool = (() => {
378391
if (!codeReviewTool || codeReviewTool === 'Skip') return 'skip'
379392
if (/gemini/i.test(codeReviewTool)) return 'gemini'
380393
if (/codex/i.test(codeReviewTool)) return 'codex'
381394
return 'agent'
395+
})()
396+
397+
if (resolvedTool === 'skip') {
398+
console.log('[Code Review] Skipped')
399+
} else {
400+
// proceed with review
401+
}
402+
```
403+
404+
**Agent Code Review** (resolvedTool === 'agent'):
405+
406+
```javascript
407+
Agent({
408+
subagent_type: "code-reviewer",
409+
run_in_background: false,
410+
description: `Code review: ${planObject.summary}`,
411+
prompt: `## Code Review — Post-Execution Quality Check
412+
413+
**Goal**: ${originalUserInput}
414+
**Plan Summary**: ${planObject.summary}
415+
416+
### Changed Files
417+
Run \`git diff --name-only HEAD~${getTasks(planObject).length}..HEAD\` to identify changes.
418+
419+
### Review Focus
420+
1. **Code quality**: Readability, naming, structure, dead code
421+
2. **Correctness**: Logic errors, off-by-one, null handling, edge cases
422+
3. **Patterns**: Consistency with existing codebase conventions
423+
4. **Security**: Injection, XSS, auth bypass, secrets exposure
424+
5. **Performance**: Unnecessary loops, N+1 queries, missing indexes
425+
426+
### Instructions
427+
1. Run git diff to see actual changes
428+
2. Read changed files for full context
429+
3. For each issue found: severity (Critical/High/Medium/Low) + file:line + description + fix suggestion
430+
4. Return structured review: issues[], summary, overall verdict (PASS/WARN/FAIL)`
431+
})
432+
```
433+
434+
**CLI Code Review — Codex** (resolvedTool === 'codex'):
435+
436+
```javascript
437+
const reviewId = `${sessionId}-code-review`
438+
Bash(`ccw cli -p "Review code changes for quality, correctness, security, and pattern compliance. Focus: ${planObject.summary}" --tool codex --mode review --id ${reviewId}`, { run_in_background: true })
439+
// STOP - wait for hook callback
440+
```
441+
442+
**CLI Code Review — Gemini** (resolvedTool === 'gemini'):
443+
444+
```javascript
445+
const reviewId = `${sessionId}-code-review`
446+
Bash(`ccw cli -p "PURPOSE: Post-execution code quality review for: ${planObject.summary}
447+
TASK: • Run git diff to identify all changes • Review each changed file for quality, correctness, security • Check pattern compliance with existing codebase • Identify potential bugs, edge cases, performance issues
448+
MODE: analysis
449+
CONTEXT: @**/* | Memory: lite-execute completed, reviewing code quality
450+
EXPECTED: Per-file review with severity levels (Critical/High/Medium/Low), file:line references, fix suggestions, overall verdict
451+
CONSTRAINTS: Read-only | Focus on code quality not convergence" --tool gemini --mode analysis --rule analysis-review-code-quality --id ${reviewId}`, { run_in_background: true })
452+
// STOP - wait for hook callback
453+
```
454+
455+
**Write review artifact** (if session folder exists):
456+
```javascript
457+
if (executionContext?.session?.folder) {
458+
Write(`${executionContext.session.folder}/code-review.md`, codeReviewOutput)
459+
}
460+
```
461+
462+
### Step 5: Chain to Test Review & Post-Completion
463+
464+
**Resolve convergence review tool**: From `executionContext.convergenceReviewTool` (Mode 1) or `userSelection.convergence_review_tool` (Mode 2/3).
465+
466+
```javascript
467+
function resolveConvergenceTool(ctx, selection) {
468+
const raw = ctx?.convergenceReviewTool || selection?.convergence_review_tool || 'skip'
469+
if (!raw || raw === 'Skip') return 'skip'
470+
if (/gemini/i.test(raw)) return 'gemini'
471+
if (/codex/i.test(raw)) return 'codex'
472+
return 'agent'
382473
}
383474
```
384475
@@ -389,7 +480,7 @@ testReviewContext = {
389480
planObject: planObject,
390481
taskFiles: executionContext?.taskFiles
391482
|| getTasks(planObject).map(t => ({ id: t.id, path: `${executionContext?.session?.folder}/.task/${t.id}.json` })),
392-
reviewTool: mapReviewTool(executionContext?.codeReviewTool),
483+
convergenceReviewTool: resolveConvergenceTool(executionContext, userSelection),
393484
executionResults: previousExecutionResults,
394485
originalUserInput: originalUserInput,
395486
session: executionContext?.session || {
@@ -442,7 +533,8 @@ Skill("lite-test-review")
442533
explorationManifest: {...} | null,
443534
clarificationContext: {...} | null,
444535
executionMethod: "Agent" | "Codex" | "Auto",
445-
codeReviewTool: "Skip" | "Gemini Review" | "Agent Review" | string,
536+
codeReviewTool: "Skip" | "Gemini Review" | "Codex Review" | "Agent Review",
537+
convergenceReviewTool: "Skip" | "Agent" | "Gemini" | "Codex",
446538
originalUserInput: string,
447539
executorAssignments: { // per-task override, priority over executionMethod
448540
[taskId]: { executor: "gemini" | "codex" | "agent", reason: string }

.claude/skills/workflow-lite-plan/SKILL.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,8 @@ ${tasks.map((t, i) => `${i+1}. ${t.title} (${t.scope || t.files?.[0]?.path || ''
492492
let userSelection
493493
494494
if (workflowPreferences.autoYes) {
495-
console.log(`[Auto] Allow & Execute | Auto | Skip`)
496-
userSelection = { confirmation: "Allow", execution_method: "Auto", code_review_tool: "Skip" }
495+
console.log(`[Auto] Allow & Execute | Auto | Skip + Skip`)
496+
userSelection = { confirmation: "Allow", execution_method: "Auto", code_review_tool: "Skip", convergence_review_tool: "Skip" }
497497
} else {
498498
// "Other" in Execution allows specifying CLI tools from ~/.claude/cli-tools.json
499499
userSelection = AskUserQuestion({
@@ -519,22 +519,33 @@ if (workflowPreferences.autoYes) {
519519
]
520520
},
521521
{
522-
question: "Code review after execution?",
523-
header: "Review",
522+
question: "Code review after execution? (runs in lite-execute)",
523+
header: "Code Review",
524524
multiSelect: false,
525525
options: [
526-
{ label: "Gemini Review", description: "Gemini CLI review" },
527-
{ label: "Codex Review", description: "Git-aware review (prompt OR --uncommitted)" },
526+
{ label: "Gemini Review", description: "Gemini CLI: git diff quality review" },
527+
{ label: "Codex Review", description: "Codex CLI: git-aware code review (--mode review)" },
528528
{ label: "Agent Review", description: "@code-reviewer agent" },
529-
{ label: "Skip", description: "No review" }
529+
{ label: "Skip", description: "No code review" }
530+
]
531+
},
532+
{
533+
question: "Convergence review in test-review phase?",
534+
header: "Convergence Review",
535+
multiSelect: false,
536+
options: [
537+
{ label: "Agent", description: "Agent: verify convergence criteria against implementation" },
538+
{ label: "Gemini", description: "Gemini CLI: convergence verification" },
539+
{ label: "Codex", description: "Codex CLI: convergence verification" },
540+
{ label: "Skip", description: "Skip convergence review, run tests only" }
530541
]
531542
}
532543
]
533544
})
534545
}
535546
```
536547
537-
// TodoWrite: Phase 4 → completed `[${userSelection.execution_method} + ${userSelection.code_review_tool}]`, Phase 5 → in_progress
548+
// TodoWrite: Phase 4 → completed `[${userSelection.execution_method} | CR:${userSelection.code_review_tool} | CVR:${userSelection.convergence_review_tool}]`, Phase 5 → in_progress
538549
539550
## 10. LP-Phase 5: Handoff to Execution
540551
@@ -561,6 +572,7 @@ executionContext = {
561572
clarificationContext: clarificationContext || null,
562573
executionMethod: userSelection.execution_method,
563574
codeReviewTool: userSelection.code_review_tool,
575+
convergenceReviewTool: userSelection.convergence_review_tool,
564576
originalUserInput: task_description,
565577
executorAssignments: executorAssignments, // { taskId: { executor, reason } } — overrides executionMethod
566578
session: {
@@ -588,7 +600,7 @@ TodoWrite({ todos: [
588600
{ content: "LP-Phase 1: Exploration", status: "completed" },
589601
{ content: "LP-Phase 2: Clarification", status: "completed" },
590602
{ content: "LP-Phase 3: Planning", status: "completed" },
591-
{ content: `LP-Phase 4: Confirmed [${userSelection.execution_method}]`, status: "completed" },
603+
{ content: `LP-Phase 4: Confirmed [${userSelection.execution_method} | CR:${userSelection.code_review_tool} | CVR:${userSelection.convergence_review_tool}]`, status: "completed" },
592604
{ content: `LP-Phase 5: Handoff → lite-execute`, status: "completed" },
593605
{ content: `LE-Phase 1: Task Loading [${taskCount} tasks]`, status: "in_progress", activeForm: "Loading tasks" }
594606
]})
@@ -605,6 +617,7 @@ Skill("lite-execute")
605617
├── explorations-manifest.json # Exploration index
606618
├── planning-context.md # Evidence paths + understanding
607619
├── plan.json # Plan overview (task_ids[])
620+
├── code-review.md # Generated by lite-execute Step 4
608621
├── test-checklist.json # Generated by lite-test-review
609622
├── test-review.md # Generated by lite-test-review
610623
└── .task/
@@ -618,9 +631,12 @@ Skill("lite-execute")
618631
```
619632
lite-plan (LP-Phase 1-5)
620633
└─ Skill("lite-execute") ← executionContext (global)
621-
├─ Step 1-4: Execute + Review
634+
├─ Step 1-3: Task Execution
635+
├─ Step 4: Code Review (quality/correctness/security)
622636
└─ Step 5: Skill("lite-test-review") ← testReviewContext (global)
623-
├─ TR-Phase 1-4: Test + Fix
637+
├─ TR-Phase 1: Detect test framework
638+
├─ TR-Phase 2: Convergence verification (plan criteria)
639+
├─ TR-Phase 3-4: Run tests + Auto-fix
624640
└─ TR-Phase 5: Report + Sync specs
625641
```
626642

.claude/skills/workflow-lite-test-review/SKILL.md

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,31 @@ Test review and fix engine for lite-execute chain or standalone invocation.
3131

3232
**Input Source**: `testReviewContext` global variable set by lite-execute Step 4
3333

34-
**Behavior**: Skip session discovery, inherit reviewTool from execution chain, proceed directly to TR-Phase 1.
34+
**Behavior**: Skip session discovery, inherit convergenceReviewTool from execution chain, proceed directly to TR-Phase 1.
3535

36-
> **Note**: lite-execute Step 4 is the chain gate. Mode 1 invocation means execution is complete — proceed with test review.
36+
> **Note**: lite-execute Step 5 is the chain gate. Mode 1 invocation means execution + code review are complete — proceed with convergence verification + tests.
3737
3838
### Mode 2: Standalone
3939

4040
**Trigger**: User calls with session path or `--last`
4141

42-
**Behavior**: Discover session → load plan + tasks → `reviewTool = 'agent'` → proceed to TR-Phase 1.
42+
**Behavior**: Discover session → load plan + tasks → `convergenceReviewTool = 'agent'` → proceed to TR-Phase 1.
4343

4444
```javascript
45-
let sessionPath, plan, taskFiles, reviewTool
45+
let sessionPath, plan, taskFiles, convergenceReviewTool
4646

4747
if (testReviewContext) {
4848
// Mode 1: from lite-execute chain
4949
sessionPath = testReviewContext.session.folder
5050
plan = testReviewContext.planObject
5151
taskFiles = testReviewContext.taskFiles.map(tf => JSON.parse(Read(tf.path)))
52-
reviewTool = testReviewContext.reviewTool || 'agent'
52+
convergenceReviewTool = testReviewContext.convergenceReviewTool || 'agent'
5353
} else {
5454
// Mode 2: standalone — find last session or use provided path
5555
sessionPath = resolveSessionPath($ARGUMENTS) // Glob('.workflow/.lite-plan/*/plan.json'), take last
5656
plan = JSON.parse(Read(`${sessionPath}/plan.json`))
5757
taskFiles = plan.task_ids.map(id => JSON.parse(Read(`${sessionPath}/.task/${id}.json`)))
58-
reviewTool = 'agent'
58+
convergenceReviewTool = 'agent'
5959
}
6060

6161
const skipFix = $ARGUMENTS?.includes('--skip-fix') || false
@@ -66,7 +66,7 @@ const skipFix = $ARGUMENTS?.includes('--skip-fix') || false
6666
| Phase | Core Action | Output |
6767
|-------|-------------|--------|
6868
| TR-Phase 1 | Detect test framework + gather changes | testConfig, changedFiles |
69-
| TR-Phase 2 | Review implementation against convergence criteria | reviewResults[] |
69+
| TR-Phase 2 | Convergence verification against plan criteria | reviewResults[] |
7070
| TR-Phase 3 | Run tests + generate checklist | test-checklist.json |
7171
| TR-Phase 4 | Auto-fix failures (iterative, max 3 rounds) | Fixed code + updated checklist |
7272
| TR-Phase 5 | Output report + chain to session:sync | test-review.md |
@@ -93,32 +93,45 @@ Output: `testConfig = { command, framework, type }` + `changedFiles[]`
9393
9494
// TodoWrite: Phase 1 → completed, Phase 2 → in_progress
9595
96-
## TR-Phase 2: Review Implementation Against Plan
96+
## TR-Phase 2: Convergence Verification
9797
98-
**Skip if**: `reviewTool === 'skip'` — set all tasks to PASS, proceed to Phase 3.
98+
**Skip if**: `convergenceReviewTool === 'skip'` — set all tasks to PASS, proceed to Phase 3.
9999
100-
For each task, verify convergence criteria and identify test gaps.
100+
Verify each task's convergence criteria are met in the implementation and identify test gaps.
101101
102-
**Agent Review** (reviewTool === 'agent', default):
102+
**Agent Convergence Review** (convergenceReviewTool === 'agent', default):
103103
104104
For each task in taskFiles:
105-
1. Extract `convergence.criteria[]` and `test` requirements
106-
2. Find changed files matching `task.files[].path` against `changedFiles`
107-
3. Read matched files, evaluate each criterion against implementation
108-
4. Check test coverage: if `task.test.unit` exists but no test files in changedFiles → mark as test gap
109-
5. Same for `task.test.integration`
110-
6. Build `reviewResult = { taskId, title, criteria_met[], criteria_unmet[], test_gaps[], files_reviewed[] }`
105+
1. Extract `convergence.criteria[]` from the task
106+
2. Match `task.files[].path` against `changedFiles` to find actually-changed files
107+
3. Read each matched file, verify each convergence criterion with file:line evidence
108+
4. Check test coverage gaps:
109+
- If `task.test.unit` defined but no matching test files in changedFiles → mark as test gap
110+
- If `task.test.integration` defined but no integration test in changedFiles → mark as test gap
111+
5. Build `reviewResult = { taskId, title, criteria_met[], criteria_unmet[], test_gaps[], files_reviewed[] }`
111112
112-
**CLI Review** (reviewTool === 'gemini' or 'codex'):
113+
**Verdict logic**:
114+
- PASS = all `convergence.criteria` met + no test gaps
115+
- PARTIAL = some criteria met OR has test gaps
116+
- FAIL = no criteria met
117+
118+
**CLI Convergence Review** (convergenceReviewTool === 'gemini' or 'codex'):
113119
114120
```javascript
115-
const reviewId = `${sessionId}-tr-review`
116-
Bash(`ccw cli -p "PURPOSE: Post-execution test review — verify convergence criteria met and identify test gaps
117-
TASK: • Read plan.json and .task/*.json convergence criteria • For each criterion, check implementation in changed files • Identify missing unit/integration tests • List unmet criteria with file:line evidence
121+
const reviewId = `${sessionId}-convergence`
122+
const taskCriteria = taskFiles.map(t => `${t.id}: [${(t.convergence?.criteria || []).join(' | ')}]`).join('\n')
123+
Bash(`ccw cli -p "PURPOSE: Convergence verification — check each task's completion criteria against actual implementation
124+
TASK: • For each task below, verify every convergence criterion is satisfied in the changed files • Mark each criterion as MET (with file:line evidence) or UNMET (with what's missing) • Identify test coverage gaps (planned tests not found in changes)
125+
126+
TASK CRITERIA:
127+
${taskCriteria}
128+
129+
CHANGED FILES: ${changedFiles.join(', ')}
130+
118131
MODE: analysis
119-
CONTEXT: @${sessionPath}/plan.json @${sessionPath}/.task/*.json @**/* | Memory: lite-execute completed, reviewing convergence
120-
EXPECTED: Per-task verdict table (PASS/PARTIAL/FAIL) + unmet criteria list + test gap list
121-
CONSTRAINTS: Read-only | Focus on convergence verification" --tool ${reviewTool} --mode analysis --id ${reviewId}`, { run_in_background: true })
132+
CONTEXT: @${sessionPath}/plan.json @${sessionPath}/.task/*.json @**/* | Memory: lite-execute completed
133+
EXPECTED: Per-task verdict (PASS/PARTIAL/FAIL) with per-criterion evidence + test gap list
134+
CONSTRAINTS: Read-only | Focus strictly on convergence criteria verification, NOT code quality (code review already done in lite-execute)" --tool ${convergenceReviewTool} --mode analysis --id ${reviewId}`, { run_in_background: true })
122135
// STOP - wait for hook callback, then parse CLI output into reviewResults format
123136
```
124137
@@ -207,13 +220,13 @@ Skill({ skill: "workflow:session:sync", args: `-y "Test review: ${testChecklist.
207220
208221
## Data Structures
209222
210-
### testReviewContext (Input - Mode 1, set by lite-execute)
223+
### testReviewContext (Input - Mode 1, set by lite-execute Step 5)
211224
212225
```javascript
213226
{
214227
planObject: { /* same as executionContext.planObject */ },
215228
taskFiles: [{ id: string, path: string }],
216-
reviewTool: "skip" | "agent" | "gemini" | "codex",
229+
convergenceReviewTool: "skip" | "agent" | "gemini" | "codex",
217230
executionResults: [...],
218231
originalUserInput: string,
219232
session: {

0 commit comments

Comments
 (0)