Skip to content

Context Management Decision Framework

Run the Context Management Decision Framework MicroSim Fullscreen

About This MicroSim

This interactive decision tree helps you choose the right context management strategy for your prompt engineering tasks. Context management is one of the most important skills in prompt engineering -- knowing how to work within (and around) the model's context window determines the quality and reliability of your results.

The diagram maps out the key decision points:

  • Are you writing a single query or managing a conversation?
  • How much context does the model need?
  • How long will the conversation run?

Each path leads to specific techniques (shown in green) or combined strategies (shown in purple) that match your situation.

How to Use

  1. Start at the top -- the blue "What Is Your Task?" node
  2. Click any node to see a detailed description in the info panel on the right
  3. Follow the labeled arrows to navigate the decision tree based on your situation
  4. When you click a node, the path to that node is highlighted while other nodes dim, making it easy to see the decision path
  5. Click empty space to reset the highlighting
  6. Use Reset View to return to the default zoom and position
  7. Use Expand All to fit the entire tree in view

Techniques Covered

Technique Best For
System Prompts Setting consistent behavior for every interaction
Few-Shot Examples Teaching patterns through input/output examples
RAG Referencing large knowledge bases or document sets
Chunking Processing documents too large for the context window
Conversation Summarization Managing long, evolving conversations
Conversation Pruning Simple context window management for shorter chats
Structured Memory Persisting facts and preferences across sessions

Iframe Embed Code

You can add this MicroSim to any web page by adding this to your HTML:

1
2
3
4
<iframe src="https://dmccreary.github.io/prompt-class/sims/context-management-decision-framework/main.html"
        height="622px"
        width="100%"
        scrolling="no"></iframe>

Lesson Plan

Grade Level

High School through Undergraduate

Duration

10-15 minutes

Prerequisites

Basic understanding of how LLMs process text and the concept of a context window.

Activities

  1. Exploration (5 min): Navigate the decision tree and read about each technique. Identify which strategies you have already used.
  2. Guided Practice (5 min): Given a scenario (e.g., "summarize a 50-page report"), trace the decision path to find the recommended technique.
  3. Assessment (5 min): For three different real-world tasks, identify which context management strategy is most appropriate and explain why.

Assessment

Students should be able to correctly match at least 3 out of 4 scenarios to appropriate context management techniques and articulate why their chosen strategy fits.

References

  1. Prompt Engineering Guide - Context Management
  2. Retrieval-Augmented Generation (RAG)
  3. OpenAI Cookbook - Context Management