Skip to content

[FEATURE] #880 - Create BatchExecutionMemory service for cross-task learning summaries #911

@stephanj

Description

@stephanj

Parent Issue

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

Context

Each task starts with a fresh conversation context. There is no mechanism to pass execution learnings from completed tasks to subsequent ones. A BatchExecutionMemory service would collect per-task summaries and make them available for injection into downstream task prompts.

Task

Create a BatchExecutionMemory service that accumulates learning from completed tasks within a batch run.

Key Changes

  1. Create BatchExecutionMemory service:

    public class BatchExecutionMemory {
        /** Record what a completed task learned/produced */
        void recordTaskCompletion(String taskId, TaskLearningEntry entry);
        
        /** Get summarized learning context for injection into next task */
        String getSummarizedContext(int maxChars);
        
        /** Get entries for specific dependency tasks */
        List<TaskLearningEntry> getEntriesForTasks(List<String> taskIds);
        
        /** Clear at batch start */
        void clear();
    }
  2. Create TaskLearningEntry model:

    @Data
    public class TaskLearningEntry {
        String taskId;
        String taskTitle;
        String executionSummary;      // what was done (from finalSummary)
        List<String> filesModified;   // what files changed
        List<String> patternsFound;   // extracted patterns/notes
        String strategyUsed;          // e.g., "used web search", "refactored via AST"
        TaskResultStatus status;      // success/fail
        long executionTimeMs;
        String errorNote;             // what went wrong (if failed)
    }
  3. Populate from task completion:

    • On onTaskCompleted(): re-read TaskSpec from SpecService to get finalSummary, implementationNotes
    • Extract structured data into TaskLearningEntry
    • On onTaskSkipped()/failed: record failure patterns
  4. Summarization strategy:

    • Most recent N tasks get full entries
    • Older tasks get one-line summaries
    • Total context capped at configurable maxLearningContextLength
    • Failed tasks always included (so downstream can avoid same mistakes)

Files to Create

  • src/main/java/com/devoxx/genie/service/spec/BatchExecutionMemory.java (new)
  • src/main/java/com/devoxx/genie/model/spec/TaskLearningEntry.java (new)

Dependencies

Acceptance Criteria

  • Learning entries captured for completed and failed tasks
  • getSummarizedContext() returns a token-budget-respecting summary
  • Older entries compressed to one-liners, recent entries full
  • Failed tasks always included in summary
  • Memory cleared between batch runs
  • Thread-safe for potential parallel execution

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