04 · RAG and context systems

Next-question logic

A customer has already narrowed two hotels and still has not booked. The agent should ask the follow-up most likely to change that recommendation, then stop and ask for the booking.

One answer, preferring the quieter and more spacious hotel, moves Hotel B from a slight edge to 64%. The agent then asks the next question that could still change the outcome.

The idea

Better questions, then a close.

Two short pieces sit behind this page. The essay is the justification: why follow-up question logic is worth adding when satisfaction and close rate depend on the next thing the agent says. The repository is the technical solution.

WHY

A game of 20 questions

The Substack starts from a hotel-booking chat at the moment of decision. The guest is interested enough to still be talking. Every extra question spends a little patience, and a conversation that circles or pushes a booking link too early is how high-intent stays get abandoned. The useful question is the one whose answer is most likely to change which hotel you recommend. When another answer probably will not, recommend the hotel and offer the booking.

Read the essay →
HOW

Choose the question by information gain

README.md is the front door: what the prototype computes, and how to run the interactive loop. DISCUSSION.md is the design, in layers you can stop at. Hotel differences, a weak prior from the shortlist, the preference directions still unresolved, then expected information gain on this A-or-B decision. The aim is to get confident about the current choice while staying easy to correct about the person.

Candidate questions ranked by expected information gain. The compound preference question leads at 0.487 bits.

The leading question is the unresolved preference direction that actually separates these two hotels, about half a bit of decision uncertainty. Single features, including the largest hotel difference, rank well behind it. The full ranking and the update rules are in DISCUSSION.md.

The terminal is a stand-in for the chat agent. The same loop fits any agent helping someone choose among a few serious options: ask what would change the recommendation, then close.
← Back to projects