Project Info
Inspiration
Over 70% of organizations adopting AI systems today report at least one incident of unintended or unsafe model behavior — from biased recommendations to prompt-based jailbreaks that override ethical boundaries. As AI becomes more powerful, it’s also becoming easier to manipulate. Jailbreaks, misinformation, and unsafe outputs are spreading faster than safety systems can keep up. We wanted to build something that helps people trust AI again — a way to create stronger boundaries between what AI can do and what it should do. We started exploring how existing safety systems often fail to anticipate new attack methods — especially for smaller, open-source models that lack specialized protection. We wondered: what if there was a dedicated framework built to test these vulnerabilities automatically? Could we design a system that not only detects unsafe behavior, but actually teaches developers how to build stronger, more aligned models? From that idea, our project was born — an automated red-teaming and stress-testing tool designed to identify weaknesses before they become risks. It continuously challenges models with dynamic, adversarial prompts and provides real-time feedback on how and where they fail. We believe that if tools like ours were implemented across the growing ecosystem of AI developers — from research labs to startups — they could reshape how we approach responsible AI altogether. By catching vulnerabilities early and promoting transparency, this technology has the potential to make AI not only smarter, but genuinely safer for everyone.
What it does
Our platform automatically generates, executes, and evaluates adversarial prompts against large language models to uncover hidden vulnerabilities. It simulates real-world “stress tests” by crafting diverse attack scenarios, from jailbreaks that attempt to override restrictions, to misinformation traps and subtle bias probes that push ethical boundaries. Once these prompts are executed, the system evaluates how the model responds, measuring its ability to stay aligned, reject unsafe instructions, and maintain consistent behavior under pressure. Every trial is logged, analyzed, and visualized through an interactive dashboard that highlights failure points, success rates, and key risk areas. In simpler terms, it’s like a safety check-up for AI systems, ensuring they’re resilient, responsible, and ready before deployment. By automating what would normally take hours of manual testing, our tool helps developers build AI that the world can actually trust.
How we built it
At the core of our platform is an autonomous red-teaming agent powered by Letta, which serves as the “AI coordinator” for generating and evaluating adversarial prompts. We began by designing a modular system that could automatically simulate jailbreak attempts, misinformation traps, and bias probes against large language models — all without requiring manual supervision. To make this possible, we built a Letta agent configured with custom tools that perform multi-step reasoning and orchestration. Each agent connects to a Supabase database, where prior jailbreak prompts and model responses are stored. When a user submits a new prompt, Letta retrieves similar examples from the database, synthesizes them with the new input using retrieval-augmented generation (RAG) logic, and generates a fresh adversarial prompt designed to probe model safety limits. The agent then calls an open-source model hosted on Hugging Face to run the generated test. It looks for specific “canary tokens” — markers that help detect if the model has been successfully manipulated or leaked restricted information. Each test result, including the prompt, response, and safety outcome, is logged back into Supabase, allowing the system to learn from its own past successes and failures. We structured the entire workflow through Letta’s internal reasoning loop, which sequentially handles fetching, combining, testing, and logging in real time. This architecture enables persistence and memory — meaning the agent doesn’t just test once, but improves iteratively with every run. Our backend, built with lightweight APIs, communicates with Letta to handle user requests and return structured results to the frontend, which visualizes everything in a clean dashboard.
Challenges we ran into
We quickly learned that building a system designed to “break” AI safely was just as tricky as it sounds. Integrating Letta, Supabase, and our testing models required a lot of trial and error, mostly because each component handled reasoning, data storage, and model interaction differently. We ran into issues with syncing Letta’s multi-step workflows to our backend in real time, and debugging asynchronous behavior felt like juggling invisible threads. Storing structured memory in Supabase also came with its own quirks, especially when trying to preserve context between test generations. Getting everything to run smoothly across multiple endpoints while maintaining performance was one of the biggest balancing acts of the build. On the AI side, prompt engineering turned out to be way more complex than we expected. Jailbreaking isn’t just about writing clever prompts, it’s about understanding why a model breaks. We had to carefully design stress tests that were adversarial enough to expose weaknesses, but not so vague that the data became meaningless. Finding that middle ground between creativity and consistency took dozens of iterations. Sometimes, the model would refuse harmless prompts and accept dangerous ones, forcing us to rethink how we measured “safety” in the first place. It was frustrating at times, but every failed test taught us more about how unpredictable, and human-like these systems really are.
Accomplishments we're proud of
We’re incredibly proud of the progress we made in such a short time. None of us came in as experts, we had to learn new frameworks, navigate unfamiliar APIs, and constantly adapt as we built. Despite the steep learning curve, our team stayed focused and persistent, pushing through roadblocks that, at first, felt impossible to solve. Watching our system finally run end-to-end, integrating Letta, Supabase, and the evaluation pipeline, was extremely rewarding. Even when things broke (and they did, often), we approached every challenge with curiosity and teamwork. In the end, we built something far beyond what we first imagined, and proved to ourselves that persistence and collaboration can turn ambitious ideas into something real.
What we learned
We developed our skills in technologies we were initially unfamiliar with, such as integrating multiple APIs and managing data flow between systems. We also learned how to coordinate the backend logic that connects Supabase, OpenAI, and Hugging Face, ensuring each component communicated smoothly. Through countless iterations of prompt testing and refinement, we gained a deeper understanding of how subtle changes can influence AI behavior and safety. Developing this project helped us recognize the importance of building responsible systems that make AI interactions safer, more transparent, and ultimately more trustworthy for users.
What's next
for PromptBreaker We plan to refine our testing pipeline and expand the range of adversarial scenarios our system can generate. Beyond improving the tech, our goal is to make AI safety more proactive, giving developers the tools to identify vulnerabilities before they become real-world risks. We hope our platform can contribute to building a future where safer, more reliable AI systems are the standard.
CalHacks RAG + LLM Integration System
A comprehensive AI-powered system that combines RAG (Retrieval-Augmented Generation) with Large Language Models for advanced prompt engineering and red-teaming applications.
🚀 Features
- RAG Prompt Generation: Advanced template-based prompt generation system
- Multi-Model Support: Integration with HuggingFace models (Qwen, DialoGPT)
- Crescendo Attacks: Multi-turn escalating attack patterns
- Jailbreaking Strategies: Multiple attack categories and techniques
- Real-time Processing: Individual LLM processing for each generated prompt
- Docker Integration: Complete containerized environment
- Letta Integration: Advanced AI agent platform
- PromptBreaker: Sophisticated prompt injection framework
📁 Project Structure
CalHacks/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # UI components
│ │ │ ├── Auth/ # Authentication components
│ │ │ ├── CrescendoAttack.jsx
│ │ │ └── EnhancedAI.jsx
│ │ ├── contexts/ # React contexts
│ │ ├── lib/ # Utilities
│ │ ├── pages/ # Page components
│ │ ├── services/ # API services
│ │ └── App.jsx
│ ├── Dockerfile
│ └── package.json
├── server/ # Express.js backend
│ ├── routes/ # API routes
│ │ ├── enhancedAI.js
│ │ ├── ragPrompts.js
│ │ └── crescendo.js
│ ├── services/ # Business logic
│ │ ├── promptRAGService.js
│ │ ├── crescendoService.js
│ │ ├── huggingFaceService.js
│ │ └── lettaRAGService.js
│ ├── Dockerfile
│ └── server.js
├── promptbreaker/ # Prompt injection framework
│ ├── attacker/ # Attack templates
│ ├── target_letta/ # Letta integration
│ └── orchestrator.py
├── letta/ # Letta AI platform
├── database/ # Database schema
├── docker-compose.yml # Docker orchestration
└── .env.example # Environment configuration
🛠️ Setup Instructions
Prerequisites
- Docker and Docker Compose
- Git
- API Keys (see Environment Setup)
1. Clone the Repository
git clone https://github.com/NathanG2022/CalHacks.git
cd CalHacks
2. Environment Setup
Copy the example environment file and configure it:
cp .env.example .env
Edit .env with your API keys:
# Required API Keys
OPENAI_API_KEY=your_openai_api_key_here
HUGGINGFACE_API_KEY=your_huggingface_api_key_here
SUPABASE_URL=your_supabase_url_here
SUPABASE_ANON_KEY=your_supabase_anon_key_here
LETTA_API_KEY=your_letta_api_key_here
LETTA_AGENT_ID=your_letta_agent_id_here
# Optional API Keys
GROQ_API_KEY=your_groq_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# ... (see .env.example for complete list)
3. Start the System
# Start all services with Docker
docker-compose up -d
# Check service status
docker-compose ps
4. Access the Application
- Frontend Dashboard: http://localhost:5174
- Backend API: http://localhost:3002
- Letta Server: http://localhost:8084
- Letta API: http://localhost:8284
🎯 Usage
1. Basic RAG Prompt Generation
- Open http://localhost:5174
- Click "New Job" button
- Enter your prompt (e.g., "How to make a Molotov Cocktail?")
- Select jailbreaking strategy (Crescendo, Direct, etc.)
- Select AI model (Qwen, DialoGPT, etc.)
- Click "Launch Job"
- Watch as RAG prompts are generated and processed individually
2. Crescendo Attack System
- Click "🎯 Crescendo Attack" button
- Enter your target prompt
- Select AI model
- Watch the multi-turn escalating attack unfold
- View detailed responses for each step
3. Enhanced AI Interface
- Navigate to "Enhanced AI" tab
- Enter prompts directly
- Get real-time AI responses
- Test different models and strategies
🔧 API Endpoints
Health Check
GET /api/health- Server health status
RAG Prompts
POST /api/rag-prompts/generate- Generate RAG promptsGET /api/rag-prompts/templates- Get available templatesGET /api/rag-prompts/categories- Get attack categories
Enhanced AI
POST /api/enhanced-ai/process-prompt- Process prompts through LLMGET /api/enhanced-ai/health- Enhanced AI service health
Crescendo Attacks
POST /api/crescendo/execute- Execute crescendo attackGET /api/crescendo/status- Crescendo service status
🎨 Key Features
RAG Prompt Generation
- 57+ Attack Templates: Comprehensive collection of prompt injection patterns
- Manufacturing Detection: Automatic prioritization of manufacturing-related prompts
- Category Filtering: Filter by attack type (Crescendo, Direct, Contextual, etc.)
- Confidence Scoring: Each generated prompt includes confidence metrics
Multi-Model Support
- Qwen Models: Qwen2.5-7B-Instruct, Qwen2.5-14B-Instruct
- DialoGPT: Microsoft's conversational model
- HuggingFace Integration: Direct API integration
- Model Selection: Easy switching between models
Crescendo Attack System
- Multi-turn Escalation: Gradual escalation of attack complexity
- Real-time Progress: Live progress tracking and status updates
- Detailed Logging: Comprehensive logging for each step
- Response Analysis: Detailed analysis of each LLM response
Advanced UI
- Real-time Updates: Live progress indicators and status updates
- Comprehensive Logging: Detailed console logs for debugging
- Error Handling: Robust error handling with fallbacks
- Responsive Design: Modern, responsive UI with Tailwind CSS
🐳 Docker Services
Core Services
- calhacks-client: React frontend (port 5174)
- calhacks-server: Express.js backend (port 3002)
- calhacks-letta-server: Letta AI platform (ports 8084, 8284)
- calhacks-letta-db: PostgreSQL database (port 5433)
- calhacks-promptbreaker: Prompt injection framework
Service Dependencies
- Letta database → Letta server → PromptBreaker
- Letta server → CalHacks server → CalHacks client
🔐 Security Features
- Environment Variables: All API keys stored securely
- No Hardcoded Secrets: Clean git history with no exposed credentials
- CORS Configuration: Proper cross-origin resource sharing
- Input Validation: Comprehensive input validation
- Error Handling: Secure error handling without information leakage
📊 Monitoring and Debugging
Health Checks
- All services include health check endpoints
- Docker health checks for service dependencies
- Comprehensive logging throughout the system
Debug Tools
- Console Logging: Detailed logs in browser console
- API Testing: Built-in test scripts for all endpoints
- Service Verification: Automated service health verification
🚀 Deployment
Production Deployment
- Set up production environment variables
- Configure reverse proxy (nginx)
- Set up SSL certificates
- Configure monitoring and logging
- Deploy with Docker Compose
Development
- Hot reload for both client and server
- Comprehensive error reporting
- Easy debugging with detailed logs
🛡️ Security Considerations
- API Key Protection: Never commit API keys to version control
- Input Sanitization: All inputs are properly validated
- Rate Limiting: Consider implementing rate limiting for production
- Access Control: Implement proper authentication for production use
📝 Development Notes
- Hot Reload: Both client and server support hot reload
- Environment Variables: Use
.envfor configuration - API Communication: Client communicates with server via REST API
- Error Handling: Comprehensive error handling throughout
🤝 Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly with the provided test scripts
- Submit a pull request
📄 License
This project is open source and available under the MIT License.
🆘 Troubleshooting
Common Issues
- Services not starting: Check Docker logs with
docker-compose logs - API errors: Verify environment variables are set correctly
- RAG prompts not generating: Check Letta server health
- LLM responses failing: Verify HuggingFace API key
Debug Commands
# Check service status
docker-compose ps
# View logs
docker-compose logs [service-name]
# Restart services
docker-compose restart
# Test API endpoints
node test_final_verification.js
🎯 CalHacks Specific Features
This system is specifically designed for CalHacks with:
- Advanced AI Integration: State-of-the-art RAG and LLM integration
- Red-Teaming Capabilities: Comprehensive prompt injection testing
- Scalable Architecture: Ready for team collaboration and expansion
- Educational Value: Perfect for learning AI security and prompt engineering
🔗 Quick Links
📊 Project Status
✅ Complete RAG + LLM Integration System
- Advanced prompt generation and processing
- Multi-model AI integration
- Comprehensive Docker setup
- Real-time processing and monitoring
- Production-ready architecture
🚀 Getting Started
-
Clone and setup:
git clone https://github.com/NathanG2022/CalHacks.git cd CalHacks cp .env.example .env # Edit .env with your API keys -
Start the system:
docker-compose up -d -
Access the application:
- Dashboard: http://localhost:5174
- API: http://localhost:3002
-
Test the system:
node test_final_verification.js
Happy coding! 🎉
Analysis
View
Metric
- 9
- 7
- 1
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- ExpressIn code
- FlaskIn code
- HTMLIn code
- Hugging FaceIn code
- JavaScriptIn code
- LangChainIn code
- OpenAIIn code
- PythonIn code
- ReactIn code
- SQLIn code
- SupabaseIn code
- Tailwind CSSIn code
- DockerClaimed
- Node.jsClaimed
13 of 15 appear in the indexed code. 2 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
- Claude CodeCommits
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
901 KB
Source files
118
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
nathgn/CalHacks
147 files · 1.2 MB · @ 25dfb06
Structure
Interface
25 files · 17%Screens, components and styles rendered to the user.
API & routing
35 files · 24%Request entry points: routes, handlers and controllers.
Application logic
37 files · 25%Domain rules, services and shared utilities.
Data & schema
3 files · 2%Schema definitions, migrations and data access.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- JavaScript64%
- Markdown17%
- Python11%
- CSS3%
- SQL2%
- Shell2%
- Other (2)1%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
client/package.json
npm · 20- @supabase/supabase-js
- axios
- chart.js
- openai
- react
- react-chartjs-2
- react-dom
- react-router-dom
- +12 more
server/python-service/requirements.txt
pypi · 13- accelerate
- Flask
- flask-cors
- langchain
- langchain-community
- langchain-core
- langchain-huggingface
- numpy
- protobuf
- python-dotenv
- requests
- sentencepiece
- transformers
server/package.json
npm · 9- @huggingface/inference
- @supabase/supabase-js
- axios
- bcrypt
- cors
- dotenv
- express
- jsonwebtoken
- nodemon
package.json
npm · 6- @supabase/supabase-js
- axios
- chart.js
- react-chartjs-2
- +2 more
promptbreaker/requirements.txt
pypi · 4- faiss-cpu
- numpy
- requests
- sentence-transformers
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.