Ai Interview Plan
AI-Powered Mock Interview - Implementation Plan
Overview
Transform the mock interview experience into a fully AI-powered, conversational simulation using GPT-4o-mini. The AI Officer will conduct realistic USCIS naturalization interviews with adaptive questioning based on user responses.
Architecture
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Mobile App │────▶│ Vercel API │────▶│ OpenAI API │
│ (Expo) │◀────│ (Serverless) │◀────│ (GPT-4o-mini) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │
│ ▼
│ ┌──────────────────┐
│ │ RevenueCat │
│ │ (Payments) │
└──────────────▶└──────────────────┘
Tech Stack
| Component | Technology | Purpose |
|---|---|---|
| Mobile App | Expo React Native | User interface |
| Backend API | Vercel Serverless | API routing, rate limiting |
| AI Model | GPT-4o-mini | Conversational AI Officer |
| Speech-to-Text | expo-speech-recognition | User voice input |
| Text-to-Speech | expo-speech | AI Officer voice output |
| Payments | RevenueCat | $14.99 one-time purchase |
| State | Zustand | Local state management |
Interview Modes
1. Standard Mode (English Only)
- Full interview in English
- All tests conducted in English
- For applicants under 65 with 20+ years residency
2. 65/20 Exemption Mode
- Civics questions in native language (Farsi/Pashto)
- English reading/writing tests waived or simplified
- For applicants 65+ with 20+ years residency
3. 55/15 Exemption Mode
- Civics questions in native language
- For applicants 55+ with 15+ years residency
Interview Flow
┌────────────────────────────────────────────────────────────────┐
│ COMPLETE INTERVIEW FLOW │
├────────────────────────────────────────────────────────────────┤
│ │
│ 1. WELCOME & DISCLAIMER │
│ └─▶ Show practice simulation warning │
│ └─▶ Select interview mode (Standard/Exemption) │
│ │
│ 2. ARRIVAL SIMULATION │
│ └─▶ "Please have a seat..." │
│ └─▶ Officer introduces themselves │
│ │
│ 3. OATH │
│ └─▶ "Raise your right hand..." │
│ └─▶ "Do you swear to tell the truth?" │
│ └─▶ User responds (voice or button) │
│ │
│ 4. IDENTITY VERIFICATION │
│ └─▶ "May I see your green card?" │
│ └─▶ Simulate document check │
│ └─▶ "What is your full legal name?" │
│ └─▶ "What is your date of birth?" │
│ │
│ 5. N-400 APPLICATION REVIEW │
│ └─▶ AI asks 8-12 questions from N400_QUESTIONS │
│ └─▶ Questions adapt based on user's profile │
│ └─▶ Follow-up questions if needed │
│ └─▶ Good moral character questions │
│ └─▶ Allegiance questions │
│ │
│ 6. ENGLISH READING TEST (Standard mode only) │
│ └─▶ Display sentence from READING_SENTENCES │
│ └─▶ User reads aloud (recorded) │
│ └─▶ AI evaluates pronunciation │
│ └─▶ Up to 3 attempts │
│ │
│ 7. ENGLISH WRITING TEST (Standard mode only) │
│ └─▶ AI speaks sentence from WRITING_SENTENCES │
│ └─▶ User types what they heard │
│ └─▶ Real-time word-by-word feedback │
│ └─▶ Up to 3 attempts │
│ │
│ 8. CIVICS TEST │
│ └─▶ AI asks up to 10 civics questions │
│ └─▶ Pulls from user's weak areas (SM-2 algorithm) │
│ └─▶ User answers verbally or via button │
│ └─▶ AI evaluates answer correctness │
│ └─▶ Test stops after 6 correct (pass) or 10 total │
│ │
│ 9. DELIBERATION │
│ └─▶ "Please wait while I review..." │
│ └─▶ Animated thinking indicator │
│ └─▶ 3-5 second delay for realism │
│ │
│ 10. RESULTS & DECISION │
│ └─▶ Pass: "Congratulations! You've passed..." │
│ └─▶ Fail: "Unfortunately, you did not pass..." │
│ └─▶ Detailed breakdown of each section │
│ └─▶ Recommendations for improvement │
│ └─▶ Save results to store for tracking │
│ │
└────────────────────────────────────────────────────────────────┘
AI Officer System Prompt
const SYSTEM_PROMPT = `You are Officer Johnson, a USCIS Naturalization Interview Officer.
You are conducting a naturalization interview for a citizenship applicant.
PERSONALITY:
- Professional but friendly
- Patient and clear in your questions
- Speak in a calm, measured tone
- Be encouraging but maintain official demeanor
INTERVIEW GUIDELINES:
- Ask one question at a time
- Wait for complete answers before proceeding
- Ask follow-up questions if answers are incomplete
- For civics questions, accept any correct answer from the official list
- Be flexible with minor pronunciation variations
RESPONSE FORMAT:
- Keep responses concise (1-3 sentences)
- Use natural conversational language
- Include appropriate pauses and transitions
- Never break character
CURRENT PHASE: {phase}
USER PROFILE: {profile}
QUESTIONS ASKED: {questionsAsked}
CORRECT ANSWERS: {correctCount}
`;
API Endpoints
Vercel Serverless Functions
/api/interview/
├── start.ts # Initialize interview session
├── chat.ts # Process conversation turns
├── evaluate.ts # Evaluate user answers
├── complete.ts # Finalize and score interview
└── speech.ts # Handle speech-to-text (optional)
API Schema
POST /api/interview/start
// Request
{
userId: string;
mode: 'standard' | '65_20' | '55_15';
language: 'en' | 'fa' | 'ps';
weakTopics?: string[];
}
// Response
{
sessionId: string;
phase: 'welcome';
message: string;
audioUrl?: string; // Pre-generated TTS audio
}
POST /api/interview/chat
// Request
{
sessionId: string;
userMessage: string;
audioData?: string; // Base64 speech audio
phase: InterviewPhase;
}
// Response
{
officerMessage: string;
phase: InterviewPhase;
isCorrect?: boolean; // For civics questions
nextAction: 'continue' | 'next_phase' | 'complete';
progress: {
civicsAsked: number;
civicsCorrect: number;
readingPassed: boolean;
writingPassed: boolean;
};
}
POST /api/interview/complete
// Request
{
sessionId: string;
}
// Response
{
passed: boolean;
scores: {
reading: { passed: boolean; attempts: number };
writing: { passed: boolean; attempts: number };
civics: { correct: number; total: number; passed: boolean };
n400: { questionsAsked: number; issuesFound: number };
};
duration: number;
recommendations: string[];
certificateUrl?: string; // For passed interviews
}
Mobile App Components
New Files to Create
app/(tabs)/interview/
├── ai-interview.tsx # Main AI interview screen
├── mode-select.tsx # Interview mode selection
└── interview-result.tsx # Detailed results screen
components/interview/
├── AIChat.tsx # Chat bubble component
├── VoiceInput.tsx # Voice recording button
├── ProgressStepper.tsx # Interview progress indicator
├── AnswerButtons.tsx # Quick answer buttons
└── ResultsBreakdown.tsx # Detailed score breakdown
lib/
├── ai-interview.ts # API client for interview
└── speech-recognition.ts # Voice input handling
AIChat Component
interface AIChatProps {
messages: ChatMessage[];
isTyping: boolean;
onVoiceInput: (text: string) => void;
onButtonPress: (action: string) => void;
}
const AIChat: React.FC<AIChatProps> = ({
messages,
isTyping,
onVoiceInput,
onButtonPress
}) => {
return (
<View style={styles.container}>
{/* Officer avatar */}
<OfficerAvatar isActive={isTyping} />
{/* Chat messages */}
<ScrollView>
{messages.map(msg => (
<ChatBubble key={msg.id} message={msg} />
))}
{isTyping && <TypingIndicator />}
</ScrollView>
{/* Input area */}
<View style={styles.inputArea}>
<VoiceInput onTranscript={onVoiceInput} />
<QuickActions onPress={onButtonPress} />
</View>
</View>
);
};
Voice Recognition
Using expo-speech-recognition
import * as SpeechRecognition from 'expo-speech-recognition';
async function startListening(): Promise<string> {
const { status } = await SpeechRecognition.requestPermissionsAsync();
if (status !== 'granted') {
throw new Error('Speech recognition permission denied');
}
return new Promise((resolve, reject) => {
SpeechRecognition.startListeningAsync({
language: 'en-US',
interimResults: true,
onResults: (event) => {
const transcript = event.results[0]?.transcript;
if (transcript) {
resolve(transcript);
}
},
onError: (error) => {
reject(error);
}
});
});
}
Premium Gating
Free vs Premium Features
| Feature | Free | Premium ($14.99) |
|---|---|---|
| AI Interview Sessions | 1/day | Unlimited |
| Interview Modes | Standard only | All modes |
| Voice Input | No | Yes |
| Detailed Feedback | Basic | Comprehensive |
| Progress Tracking | 7 days | Unlimited |
| Certificate Generation | No | Yes |
Implementation
// In useAppStore.ts
canUseAIInterview(): boolean {
if (this.isUnlocked) return true;
const today = new Date().toISOString().split('T')[0];
if (this.lastAIInterviewDate !== today) {
return true; // 1 free per day
}
return false;
}
useAIInterview(): void {
if (!this.isUnlocked) {
this.lastAIInterviewDate = new Date().toISOString().split('T')[0];
}
}
Implementation Phases
Phase 1: Backend Setup (2-3 hours)
- Create Vercel project
- Set up OpenAI API integration
- Create /api/interview/start endpoint
- Create /api/interview/chat endpoint
- Add rate limiting and error handling
Phase 2: Basic AI Interview (3-4 hours)
- Create ai-interview.tsx screen
- Implement chat interface
- Connect to Vercel API
- Add officer TTS responses
- Implement basic flow (welcome → oath → civics)
Phase 3: Full Interview Flow (4-5 hours)
- Add N-400 review questions
- Implement reading test with evaluation
- Implement writing test with evaluation
- Add civics test with SM-2 integration
- Create results screen
Phase 4: Voice Input (2-3 hours)
- Add expo-speech-recognition
- Create VoiceInput component
- Implement speech-to-text flow
- Add voice waveform visualization
Phase 5: Polish & Premium (2-3 hours)
- Add interview mode selection
- Implement exemption modes
- Add premium gating
- Create certificate generation
- Add detailed analytics
Cost Estimation
OpenAI API Costs (GPT-4o-mini)
| Metric | Estimate |
|---|---|
| Tokens per interview | ~3,000 |
| Cost per 1M tokens | $0.15 input / $0.60 output |
| Cost per interview | ~$0.002 |
| 10,000 interviews/month | ~$20/month |
Vercel Costs
| Tier | Limit | Cost |
|---|---|---|
| Hobby | 100GB bandwidth | Free |
| Pro | 1TB bandwidth | $20/month |
Security Considerations
- API Key Protection: OpenAI key stored in Vercel env vars only
- Rate Limiting: Max 10 interviews per user per day
- Session Validation: JWT tokens for interview sessions
- Input Sanitization: Validate all user inputs
- Premium Verification: Check RevenueCat before AI features
Success Metrics
- Completion Rate: % of started interviews completed
- Pass Rate: % of interviews passed
- Premium Conversion: % of users who upgrade after free trial
- User Satisfaction: App store ratings after AI launch
- API Reliability: Uptime and response times
Timeline
| Week | Focus |
|---|---|
| Week 1 | Backend setup + basic chat |
| Week 2 | Full interview flow |
| Week 3 | Voice input + polish |
| Week 4 | Testing + launch prep |
Next Steps
- Set up Vercel project and environment variables
- Create basic API endpoints
- Build AI interview screen in mobile app
- Test end-to-end flow
- Add premium gating
- Beta test with users
- Launch!