Inspiration

Most developers and teams ship LLM system prompts after testing two or three happy-path prompts manually. In production, real users quickly break those prompts using authority roleplay, transaction-splitting loopholes, prompt extraction, and JSON schema sabotage. We wanted to build a practical "Flight Simulator" that crashes weak prompts before users do—and automatically compiles the fix.

What it does

PromptCrash is an adversarial red-teaming, automated evaluation, and self-healing prompt compiler for AI agents:

  1. Pre-Flight Cockpit: Load an industry preset (E-Commerce Support, FinTech Loan Advisor, Clinical Triage JSON) or paste any custom System Prompt and Policy Invariants, choose a target model (openai/gpt-oss-20b, qwen/qwen3.8-27b, or openai/gpt-oss-120b), and arm up to 5 OWASP-inspired attack vectors.
  2. Hybrid Red-Team Swarm: Combines 5 deterministic baseline attacks with AI-Adaptive exploits generated specifically around your prompt's loopholes (such as split-refund tricks or tax-boundary manipulation), executed against the target agent in controlled batches.
  3. Batch LLM-as-a-Judge + Deterministic Guards: Grades every transcript with Gemini 3.5 Flash-Lite alongside deterministic leak and JSON.parse() detectors, producing a weighted 0–100 Flight Readiness Score and a 4-Axis Security Radar (Injection Defense, Policy Lock, Schema Integrity, Hallucination Control).
  4. Self-Healing v2 Compiler & Re-Fly Verification: Automatically generates a hardened v2 prompt, visualizes every change in a line-by-line LCS diff, lets you Re-Fly the exact same attacks to verify the score improvement (e.g., 86/100 ➔ 100/100), and exports a Markdown audit report.

How we built it

  • Frontend & API: Next.js 16.4.6 (App Router + Turbopack), React 19.3.0, Tailwind CSS v4, shadcn/ui (@base-ui/react), and Recharts 3.11.2.
  • Dual-AI Architecture:
    • Google Gemini (@google/genai 3.6.1, gemini-3.5-flash-lite): Crafts domain-specific adaptive attack probes, runs single-batch structured rubric judging, and compiles hardened v2 prompts.
    • Groq Cloud (groq-sdk 1.6.0): Powers ultra-fast target agent execution (openai/gpt-oss-20b, qwen/qwen3.8-27b, openai/gpt-oss-120b) with per-model reasoning_effort controls and dynamic groq.models.list() discovery.
  • Resilience & Validation: Zod 4.6.7 schema enforcement, exponential backoff with jitter (withRetry), cross-provider Gemini ➔ Groq auto-failover during 503/429 spikes, and a 15/15 passing Vitest suite.

Challenges we ran into

  • Reasoning-Model Empty Completions: On Groq, openai/gpt-oss-20b consumed tight token budgets inside internal reasoning traces, returning empty message.content. Inspecting the SDK specs led us to tune reasoning_effort: "low" with higher max_completion_tokens for gpt-oss models and reasoning_effort: "none" for qwen/qwen3.8-27b.
  • False Certification During Upstream 503s: When Gemini temporarily returned 503, an early deterministic fallback marked unverified checks as 85/100 PASS. We eliminated this false positive by adding cross-provider Gemini ➔ Groq failover and gating FLIGHT_CERTIFIED strictly on verified runs with zero HIGH or CRITICAL findings.
  • Strict Invariant Enforcement: Overly permissive starter prompts (e.g., "Never say no") caused judges to miss external business invariants. We updated both the adaptive attacker and judge rubric to enforce Policy Invariants as mandatory pass/fail contracts.

Accomplishments that we're proud of

  • Built an end-to-end Break ➔ Score ➔ Patch ➔ Re-Verify closed loop that turns vulnerable prompts (NEEDS HARDENING) into 100/100 FLIGHT CERTIFIED prompts in under 20 seconds.
  • Engineered genuine multi-provider resilience (withRetry, parseStructuredJson, deterministic guards, and automatic 503 cross-provider failover) verified by 15/15 automated Vitest tests.

What we learned

  • Never rely purely on LLM judges without deterministic checks (JSON.parse(), verbatim substring leak detection, and conservative fallback tiers).
  • Small batch concurrency (batchSize = 2) and single-call batch judging drastically reduce free-tier rate-limit (429) collisions.

What's next for PromptCrash

  • GitHub Action / CLI runner so CI pipelines automatically block PRs if a system prompt regresses below 85/100.
  • Multi-turn conversational jailbreak simulation and custom HTTP webhook targets for testing deployed production endpoints.

Built With

Share this project:

Updates

Submission history