Free sample lesson ยท Context Windows, Caching, and Reliability

The Persistent Case Facts Block

After summarisation the agent says a recent order instead of $247.83 for order #8891.

Lesson 1 of the Wondering course Context Windows, Caching, and Reliability

Mastering the Persistent Case Facts Block

Context Management Strategy

Discover how summarisation destroys critical transactional details and learn to manage agent context securely using a persistent case facts block.

The Progressive Summarization Trap

Large Language Models have finite context windows. To save space, developers often summarize earlier parts of a conversation.

This creates a systematic trap. Summaries preserve the narrative but discard specific identifiers like dates and amounts.

Compression vs. Transactional Detail

A request for a refund of $247.83 for order #8891 placed on March 3rd often compresses into: Customer wants a refund for a recent order.

All three critical facts are lost during this compression step.

Why Instructions Are Not Enough

You might try telling the model to preserve all numerical values while summarizing. This approach often fails.

Prompt-level instructions compete with the heavy pressure of compression. The model prioritizes the "gist" over the details.

Why Instructions Fail
  • Prompt Level: Telling the model to preserve values competes with compression pressure.
  • Prioritising Gist: The model naturally drops specific figures in favour of the general narrative.
  • Server Compaction: Automated features can still drop transactional values if left unprotected.
  • External Data: Data must be moved entirely out of conversational history to ensure accuracy.

Even server-side features like compaction can drop transactional values if they are not protected.

To maintain 100% accuracy, you must move data out of the conversational history entirely.

The Persistent Case Facts Block

The solution is a structured block of data included in every prompt. This block is never summarized.

It sits outside the message history and is copied forward verbatim. It acts as the "source of truth" for the agent.

Persistent Case Facts Structure

A typical block includes customerId C-4421 and an issues array. This array stores orderId #8891, orderDate 2024-03-03, and refundAmount $247.83.

This ensures the agent still quotes the correct figures on turn 20.

Managing Multiple Issues

A common mistake is using one shared block for everything. This fails when a customer raises several separate issues.

Each unique problem needs its own entry in the issues array. This keeps attribution honest from end to end.

Block vs Narrative History
  • Case Facts Block
  • Narrative History

Decide what belongs in the block versus the summary. Transactional facts like status pending_refund stay in the block.

Subjective details, such as the customer mood, belong in the summarized narrative history.

Putting It All Together

Managing Agent Context End-to-End
  • Capture Details: Extract numbers, dates, and order identifiers immediately upon receipt.
  • Isolate from Summary: Keep transactional facts outside the conversational history to prevent loss during compaction.
  • Handle Multi-Issues: Assign separate array entries for each distinct problem the customer raises.
  • Maintain Attribution: Reference the case block on later turns to ensure honest and accurate agent responses.

Check yourself

Will adding prompt-level instructions to preserve numerical values reliably prevent an LLM from dropping dates and amounts during conversation summarisation?

  • Yes
  • No

Answer: No

Prompt-level instructions compete with the high compression pressure of summarisation, causing the model to naturally drop specific figures in favour of the general narrative.

In agent context management, _____ like order numbers are kept in a persistent block, whereas _____ like customer mood belong in the summarised conversation history.

Answer: In agent context management, transactional facts like order numbers are kept in a persistent block, whereas subjective details like customer mood belong in the summarised conversation history.

Transactional facts must sit outside conversation history in an unsummarised block to avoid context decay, while subjective elements like customer sentiment remain in the summarised narrative history.

A customer reports two separate issues in one support session: a delayed delivery for order #101 and a damaged item from order #102. How should the persistent case facts block handle this?

  • Overwrite order #101 details with order #102 details as soon as the second issue is raised.
  • Create a separate entry for each distinct problem within an issues array inside the block.
  • Keep order #101 in the persistent block and place order #102 into the summarised narrative history.
  • Concatenate both order numbers into a single text field named orderId within the block.

Answer: Create a separate entry for each distinct problem within an issues array inside the block.

Using a single shared block fails when multiple issues arise. Each distinct problem requires its own item in an issues array to maintain clear and accurate attribution across long sessions.

Keep going

This is lesson 1 of 8 in Context Windows, Caching, and Reliability. Next up:

  1. Where Findings Sit and What Tools Return
  2. Statelessness and the Cacheable Prefix
  3. Degradation Is an Attention Problem
  4. Three Triggers Worth Escalating On
  5. Error Context a Coordinator Can Act On

Start this course free

Wondering turns any topic into short lessons you can read, watch, or listen to, with practice questions and an AI tutor.