Package com.tnsai.planning.tasklist
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:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA recorded learning from task execution. -
Method Summary
Modifier and TypeMethodDescriptionBuilds a context prompt from all stored learnings.voidclear()Clears all stored learnings.static ProgressMemoryCreates a file-based progress memory.Gets all recorded learnings.getRelevantLearnings(Set<String> tags) Gets learnings relevant to the specified tags.static ProgressMemoryinMemory()Creates an in-memory progress memory.voidrecordLearning(String taskId, String content, Set<String> tags) Records a learning from a completed task.intsize()Returns the number of stored learnings.
-
Method Details
-
inMemory
Creates an in-memory progress memory.- Returns:
- new in-memory progress memory
-
file
Creates a file-based progress memory.- Parameters:
basePath- directory to store progress data- Returns:
- new file-based progress memory
-
recordLearning
Records a learning from a completed task.- Parameters:
taskId- the task that produced this learningcontent- the learning contenttags- tags for relevance matching
-
getLearnings
List<ProgressMemory.Learning> getLearnings()Gets all recorded learnings.- Returns:
- all learnings, ordered by recording time
-
getRelevantLearnings
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.
-