Skip to content

RecapGenerator

Category: Agent

Source: recap_generator.dart

Classes

RecapGenerator

Generates a one-line session recap using a small [LlmClient].

Companion to [TitleGenerator]: titles describe what a session is about, recaps describe what has happened in it so far. Same shape, different prompt and a slightly relaxed length ceiling.

Constructor

dart
RecapGenerator({required LlmClient llmClient, this.onUsage})

Properties

PropertyTypeDescription
systemPromptconst

Methods

void Function(UsageInfo)

Optional per-call usage callback. Surfaces wire this to SessionManager.recordUsage(stats, role: 'recap') so recap cost is accounted for in session totals.

Future<String?> generateFromContext(TitleContext context)
static String? sanitize(String? raw)

Sanitize a recap to printable ASCII, collapsing whitespace and stripping leading/trailing quotes the model occasionally adds.

Returns null if the result is empty after sanitization.

Released under the MIT License.