Context is semistructured information about a user or conversation session that helps a system interpret messages and decide what to say or do next. In NLP, it can include metadata; in a dialog engine, it is the current conversation state or memory. section 1.2.3 section 12.3.2
A context field can store names, locations, ages, pronouns, message history, educational progress, and other facts. JSON suits this role because new measurements can be added as key–value pairs without fixing every field in advance. section 12.3.3
Context supports several practical dialog decisions:
- Choose the next response or action from the current conversation state. section 12.3.2
- Adjust repetition limits according to student performance or question difficulty instead of applying one universal rule. section 12.3.2
- Personalize lessons and quiz difficulty using grade level, completed lessons, and mastery scores. section 12.3.3
- Reconstruct sessions from message logs and use dead ends to improve conversation graphs and intent training data. section 12.3.3
Counting tutor
A counting lesson stores its conversation as states such as welcome and q1. After the bot sends “11, 12, 13,” the next state depends on whether the learner answers “14,” “fourteen,” or something else. section 12.3.2
Listing 12.1 Elementary counting lesson
- name: start
convo_name: count by one
convo_description: Teach counting to elementary school students
nlp: keyword
version: 3.1
triggers:
- {user_text: "__next__", target: welcome}
- name: welcome
actions:
- send_message: bot_text: Let's start by counting up by 1s.
- send_message: bot_text: I will give you 3 numbers.
- send_message: bot_text: Your answer is the next number in the list.
- send_message:
bot_text: For example, if I say "4, 5, 6" you should answer "7".
- send_message: Now you try
triggers:
- {user_text: "OK", button_text: "OK", target: q1}
- name: q1
actions:
- send_message: bot_text: 11, 12, 13
triggers:
- {user_text: 14, target: correct-answer-q1}
- {user_text: fourteen, target: correct-answer-q1}
- {user_text: "__default__", target: wrong-answer-q1}
- name: wrong-answer-q1
actions:
- send_message: bot_text: Oops!
triggers:
- {user_text: "__next__", target: q1}
- name: correct-answer-q1
actions:
- send_message: bot_text: Exactly right!
triggers:
- {user_text: "__next__", target: q2}
- name: q2
actions:
- send_message: bot_text: 16, 17, 18
triggers:
- {user_text: 19, target: stop}
- {user_text: nineteen, target: stop}
- {user_text: "__default__", target: wrong-answer-q2}
Inspect a compact conversation graph showing states, actions, triggers, and branches that use session context. section 12.3.2

















