Interface ProgressMemory


public interface ProgressMemory
Persistent learning store for cross-task knowledge transfer.

ProgressMemory implements the Ralph Pattern's "Progress Memory" principle: learnings from completed tasks are preserved and injected as context into subsequent tasks, enabling iterative improvement across a task list.

Usage


 ProgressMemory memory = ProgressMemory.inMemory();

 // Record a learning
 memory.recordLearning("task-1", "JWT requires RS256 for production",
     Set.of("auth", "security"));

 // Get relevant learnings for next task
 List<Learning> relevant = memory.getRelevantLearnings(Set.of("auth"));

 // Build context prompt for LLM
 String context = memory.buildContextPrompt();
 
Author:
TnsAI Team
See Also:
  • Method Details

    • inMemory

      static ProgressMemory inMemory()
      Creates an in-memory progress memory.
      Returns:
      new in-memory progress memory
    • file

      static ProgressMemory file(Path basePath)
      Creates a file-based progress memory.
      Parameters:
      basePath - directory to store progress data
      Returns:
      new file-based progress memory
    • recordLearning

      void recordLearning(String taskId, String content, Set<String> tags)
      Records a learning from a completed task.
      Parameters:
      taskId - the task that produced this learning
      content - the learning content
      tags - tags for relevance matching
    • getLearnings

      List<ProgressMemory.Learning> getLearnings()
      Gets all recorded learnings.
      Returns:
      all learnings, ordered by recording time
    • getRelevantLearnings

      List<ProgressMemory.Learning> getRelevantLearnings(Set<String> tags)
      Gets learnings relevant to the specified tags.

      A learning is relevant if it shares at least one tag with the query.

      Parameters:
      tags - the tags to match
      Returns:
      matching learnings
    • buildContextPrompt

      String buildContextPrompt()
      Builds a context prompt from all stored learnings.

      The returned string is formatted for injection into an LLM prompt, summarizing prior learnings for context transfer.

      Returns:
      formatted context string, or empty string if no learnings
    • size

      int size()
      Returns the number of stored learnings.
    • clear

      void clear()
      Clears all stored learnings.