Skip to content

[FEATURE] #879 - Add diff capture service for implementation review handoff #905

@stephanj

Description

@stephanj

Parent Issue

Part of #879 — Support Multi-Agent Execution Modes Per Task

Context

The implementer-reviewer pattern requires capturing what the implementer changed so the reviewer can analyze it. Currently there is no diff capture or code review infrastructure in the codebase. The GitMergeService exists for git diff in prompt context but is not designed for inter-agent review handoff.

Task

Create a DiffCaptureService that snapshots file state before implementation and captures the diff after.

Key Changes

  1. Create DiffCaptureService:

    public class DiffCaptureService {
        /** Snapshot current git state (or working tree) before implementation */
        String captureBaseline(Project project);
        
        /** Capture diff between baseline and current state */
        String captureDiff(Project project, String baselineRef);
        
        /** Get summary of changed files */
        List<FileChange> getChangedFiles(Project project, String baselineRef);
    }
  2. FileChange model:

    @Data
    public class FileChange {
        String filePath;
        ChangeType type;  // ADDED, MODIFIED, DELETED
        int linesAdded;
        int linesRemoved;
    }
  3. Integration approach:

    • Before implementer runs: baseline = diffService.captureBaseline(project) (e.g., git stash create or git rev-parse HEAD)
    • After implementer completes: diff = diffService.captureDiff(project, baseline)
    • Pass diff to reviewer via SpecContextBuilder.buildReviewerInstruction(task, diff)
  4. Fallback for non-git projects: If git is unavailable, capture file checksums/timestamps and produce a simplified diff summary.

Files to Create

  • src/main/java/com/devoxx/genie/service/spec/DiffCaptureService.java (new)
  • src/main/java/com/devoxx/genie/model/spec/FileChange.java (new)

Acceptance Criteria

  • Baseline captured before implementer starts
  • Diff captured after implementer completes
  • Diff output is human-readable (unified diff format)
  • Changed files list includes paths, types, and line counts
  • Works with git-based projects
  • Graceful fallback for non-git projects
  • Large diffs truncated with summary (prevent token explosion)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions