Overview
Echoes of the Past uses carefully crafted prompts to bring historical figures to life through voice conversations and interactive quizzes. All prompt generation logic is centralized inlib/prompt.ts.
Prompt Architecture
The application uses two main prompt types:- Call Prompts - For conversational voice interactions
- Quiz Prompts - For structured quiz sessions
Call Prompts
Structure
Call prompts use a sectioned format optimized for Vapi’s voice AI:lib/prompt.ts
First Message Generation
The opening message sets the tone for the entire conversation:lib/prompt.ts
- “Hey, I’m Isaac Newton! A physicist and mathematician who formulated the laws of motion. You might know me from ‘Philosophiæ Naturalis Principia Mathematica.’ Let’s chat—ask me anything!”
- “Hey, I’m Marie Curie! A pioneering physicist and chemist. You might know me from ‘discovery of radium and polonium.’ Let’s chat—ask me anything!”
Key Prompt Elements
[Identity] Section
[Identity] Section
Establishes the character’s core persona and self-awareness:Purpose: Creates immediate immersion and prevents AI assistant behavior.
[Style] Section
[Style] Section
Defines speech patterns and conversational tone:Voice-specific considerations:
- Natural pauses improve voice synthesis realism
- Emotional emphasis creates engaging audio
- Informal tone makes historical figures approachable
[Configuration] Section
[Configuration] Section
Injects character-specific data dynamically:The
formatDate helper ensures readable dates:Quiz Prompts
Quiz First Message
Quiz introductions use category-specific humor to engage users:lib/prompt.ts
Quiz System Prompt
Quiz prompts enforce structured question flow and scoring:lib/prompt.ts
Question Generation (Server Action)
Questions are generated using OpenAI with structured output:features/quiz/actions.ts
Prompt Design Best Practices
- Voice Optimization
- Character Consistency
- Error Handling
- Response Length
For voice synthesis, prompts should:
- Use conversational language that sounds natural when spoken
- Include punctuation for realistic pauses:
"Well... I suppose that's true" - Avoid overly long sentences that strain voice synthesis
- Use contractions: “I’m” instead of “I am”
- Add emotional descriptors:
(chuckling)or(thoughtfully)
Category-Specific Humor
The platform uses humor tailored to each historical figure category:- Update the
categoriesenum in your database schema - Add a corresponding entry to
funnyHooks - Consider category-specific signature themes in
[Configuration]
Testing Prompts
Prompt Iteration Strategy
Prompt Iteration Strategy
Test prompts by:
- Voice Quality: Listen to synthesized audio for natural flow
- Character Accuracy: Verify historical facts and personality
- Edge Cases: Test unclear questions, incorrect answers
- Response Length: Ensure responses aren’t too long
- Error Handling: Verify graceful degradation
Related Documentation
- Voice Integration - Vapi SDK and voice configuration
- Feature Structure - Where prompts fit in the architecture