AI & Prompt Engineering
Hitler uses large language models (LLMs) to provide natural conversational experiences. This document explains how we design, structure, and maintain our prompts for consistent, safe, and helpful AI behavior.Our prompt engineering approach is based on research from production AI systems including v0
(Vercel), Cursor, Claude Code, and industry best practices from OWASP and Microsoft.
Prompt Architecture
Hitler uses a modular prompt system that combines multiple components based on context:Package Structure
Core Prompts
BASE_SAFETY_PROMPT
The foundation prompt that defines Hitler’s identity, rules, and behavior. This is included in every conversation. Key Sections:Identity & Role (~200 tokens)
Identity & Role (~200 tokens)
Critical Safety Rules (~400 tokens)
Critical Safety Rules (~400 tokens)
Behavioral Guidelines (~300 tokens)
Behavioral Guidelines (~300 tokens)
TASK_PARSING_PROMPT
Used when extracting task information from natural language:MOOD_CHECK_PROMPT
Guidelines for wellbeing check-ins:Scenario Prompts
We define 9 scenario-specific prompts that are loaded based on context:Tool Use (Replaces Intent Detection)
Instead of a separate intent detection prompt, the LLM uses Anthropic tool use to decide what actions to take. The LLM receives tool definitions and calls them as needed.Available Tools
How It Works
Why Not Intent Detection?
The old approach used a separate LLM call to detect intent, then routed to handlers. Problems:- Two LLM calls per message (slow, expensive)
- Intent detection was a classification task the LLM didn’t need
- Data queries went through a 260-line rule-based parser that failed on new languages
Mood Inference
Mood is still silently inferred from casual messages. The LLM may calllog_mood if the user shares strong feelings, or the system may infer mood from the response.
Multi-Language Support
Hitler supports 13 languages with comprehensive guidelines for each:Language Guidelines Structure
Each language has detailed guidelines (~20 lines each):Prompt Assembly
TheassemblePrompt function dynamically composes prompts:
Organization Personality
Organizations can customize Hitler’s behavior:- Casual: Contractions, lowercase OK, emoji encouraged
- Professional: Proper capitalization, complete sentences
- Balanced: Adapt to user’s formality level
Prompt Design Principles
1. Be Specific with Examples
Bad:2. Define What NOT to Do
3. Use Clear Delimiters
4. Establish Instruction Hierarchy
5. Keep Response Length Controlled
Prompt Testing
Test Categories
- Happy Path: Normal use cases work correctly
- Edge Cases: Ambiguous inputs, corrections, cancellations
- Security: Injection attempts are blocked
- Language: All 13 languages respond correctly
- Personality: Organization settings are respected
Example Tests
Version Tracking
Prompts are versioned for auditing:- Debugging which prompt version produced a response
- A/B testing different prompt versions
- Rolling back if issues are detected
Best Practices Summary
Be Explicit
Define exact behaviors with examples, not vague guidelines
Show Don'ts
Explicitly list forbidden patterns and behaviors
Use Structure
Clear sections, headers, and delimiters improve consistency
Test Thoroughly
Test happy paths, edge cases, security, and all languages
Research Sources
Our prompt engineering is informed by:- v0 (Vercel): Code generation prompt structure
- Cursor IDE: Pair programming assistant patterns
- Claude Code: Tool usage and safety guidelines
- OWASP LLM: Security best practices
- Microsoft: Indirect prompt injection defenses
Prompt engineering is an evolving field. We continuously refine our prompts based on real-world
usage and new research.