← Back to Labs

Case Facts Extraction

context managementFill in Blank

Complete this system prompt that uses a persistent 'case facts' block to preserve critical transactional details that would otherwise be lost during progressive summarization.

function buildSystemPrompt(
  caseFacts: CaseFacts,
  summarizedHistory: string
): string {
  return `You are a customer support agent.

## Case Facts (persistent -- never summarize)
Extract and maintain these from the conversation:
- 
- Customer name and verified ID
- Product names and SKUs mentioned

${JSON.stringify(caseFacts, null, 2)}

## Conversation History
This block is  the summarized history to ensure
case facts are never lost during progressive summarization.

${summarizedHistory}

Always reference the Case Facts block for exact values.
Never rely on summarized history for amounts, dates, or identifiers.`;
}
Next Exercise →