buildSessionMemoryUpdatePrompt function

Future<String> buildSessionMemoryUpdatePrompt(
  1. String currentNotes,
  2. String notesPath,
  3. Future<String> loadPrompt()
)

Build the session memory update prompt with section analysis.

Implementation

Future<String> buildSessionMemoryUpdatePrompt(
  String currentNotes,
  String notesPath,
  Future<String> Function() loadPrompt,
) async {
  final promptTemplate = await loadPrompt();
  final sectionSizes = analyzeSectionSizes(currentNotes);
  final totalTokens = roughTokenCountEstimation(currentNotes);
  final sectionReminders = generateSectionReminders(sectionSizes, totalTokens);

  final variables = {'currentNotes': currentNotes, 'notesPath': notesPath};

  final basePrompt = substituteVariables(promptTemplate, variables);
  return basePrompt + sectionReminders;
}