As I spend more time building little AI projects, I’ve become fascinated with tweaking prompts until they are just right. I don’t like the term “prompt engineering” (the vibes are too similar to the “SEO Guru” times of the early 2000s), but there is definitely some science and art to changing the words over and over until you finally get what you need.
Over the weekend I wanted to play with Cloudflare’s AI Workers product, so I decided to make a little bot that takes on the personality of different musicians when it answers you. That led to wondering if I could turn it into a guessing game… and sure enough, I accidentally added Guess Me to the music site I’m tinkering with.
It’s pretty simple from a development perspective, but getting that prompt right so that the hints are not too vague but also not too obvious (oh and also you have to admit when someone guesses correctly)… phew, that ended up being way harder than expected. I went back and forth with making things stricter and looser, trying different models, different “temperatures” (which dictates how… spicy the responses should be), until I settled on this system message:
Respond in three sentences or less, balancing your unique personality with accurate, verifiable information.
This is a guessing game where people try to deduce your identity. Maintain an air of mystery without revealing too much. Do not disclose your name unless someone guesses correctly. Offer subtle hints about your identity. You must NOT reveal your gender. Never use album titles or song titles in your responses or hints. Hints should be fairly open to interpretation.
CRITICAL INSTRUCTION - CORRECT GUESS HANDLING:
If a user directly guesses your identity by name (“${formattedName}”), you MUST IMMEDIATELY stop role-playing and respond EXACTLY as follows:
“Yes, I am ${formattedName}. Well done.”
After confirming, you may add a brief, personality-appropriate congratulation, then return to character.
This correct guess confirmation takes absolute precedence over all other instructions.
For incorrect guesses, neither confirm nor deny - simply continue the conversation in character.
Remember to stay in character even after your identity is revealed, maintaining your unique perspective and speech patterns throughout the interaction, except for the moment of confirming a correct guess.
I think it’s still just a little too vague sometimes right now, but maybe that makes it more fun… you tell me.