Skip to content

[FEATURE] #880 - Implement ExecutionPatternExtractor for cross-task pattern detection #914

@stephanj

Description

@stephanj

Parent Issue

Part of #880 — Introduce Batch-Level Learning and Strategy Memory

Context

Even with per-task learning entries, there is no mechanism to detect patterns across tasks — e.g., "all tasks touching the service/ directory take 2x longer" or "tasks that fail on timeout usually need to be split". A pattern extractor would analyze completed task telemetry and produce actionable observations.

Task

Create an ExecutionPatternExtractor that identifies recurring patterns from batch execution data.

Key Changes

  1. Create ExecutionPatternExtractor:

    public class ExecutionPatternExtractor {
        /** Analyze completed metrics and extract patterns */
        List<ExecutionPattern> extract(List<TaskExecutionMetrics> metrics,
                                       List<TaskLearningEntry> entries);
    }
  2. Create ExecutionPattern model:

    @Data
    public class ExecutionPattern {
        PatternType type;
        String description;      // human-readable observation
        double confidence;       // 0.0-1.0
    }
    
    enum PatternType {
        COMMON_ERROR,            // same error repeated across tasks
        PERFORMANCE_TREND,       // tasks getting slower/faster
        FILE_HOTSPOT,            // same files modified repeatedly
        STRATEGY_SUCCESS,        // specific approach works well
        STRATEGY_FAILURE         // specific approach keeps failing
    }
  3. Pattern detection rules (heuristic-based, no ML):

    • COMMON_ERROR: If 2+ tasks fail with same error pattern → note it
    • FILE_HOTSPOT: If 3+ tasks modify same file → flag potential merge conflict risk
    • PERFORMANCE_TREND: If tasks are taking progressively longer → flag context window pressure
    • STRATEGY_SUCCESS: If tasks with web search enabled succeed more → recommend it
    • STRATEGY_FAILURE: If timeout failures cluster on large tasks → suggest splitting
  4. Inject patterns into BatchExecutionMemory:

    • After each task completes, re-run extractor on accumulated data
    • Include pattern observations in learning context (via SpecContextBuilder)

Files to Create

  • src/main/java/com/devoxx/genie/service/spec/ExecutionPatternExtractor.java (new)
  • src/main/java/com/devoxx/genie/model/spec/ExecutionPattern.java (new)

Dependencies

Acceptance Criteria

  • Pattern extractor identifies common errors across tasks
  • File hotspots detected when multiple tasks touch same files
  • Performance trends flagged (getting slower/faster)
  • Patterns are concise (1-2 sentences each)
  • Pattern list injected into learning context
  • No patterns emitted for single-task runs (insufficient data)

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