Inspiration

Prompt quality directly impacts the value users get from AI. But most people don’t write prompts with clarity or security in mind. At the same time, prompt injection attacks and misuse vectors are growing more sophisticated. I wanted to create something that improves user prompts in real time—while also acting as a lightweight security and feedback layer.

This project was inspired by three things: 1. A need for safer and more effective AI input, 2. The elegance of Streamlit for rapid prototyping, 3. And the flexibility of Claude via AWS Bedrock.

What it does

Prompt Refiner AI is a simple, fast, one-page application that does three things: • Refines user prompts for clarity, specificity, and safety using Claude on AWS Bedrock. • Grades the original prompt on a scale of 1–10. • Suggests 2–3 follow-up improvements or questions based on the intent.

It also blocks suspicious prompts using a regex-based injection detection engine, tracks token usage and cost, and logs every session to CSV. Pushover notifications alert on both successful runs and blocked input.

How we built it

The app is written in Python using Streamlit and deployed to an EC2 instance.

Core technologies: • AWS Bedrock (Claude 3 Haiku) for prompt refinement, grading, and suggestions. • Streamlit served behind Nginx as a reverse proxy, and Cloudflared. • Pushover API for mobile notifications on usage and alerts. • CSV logging for prompt history, token/cost tracking, and auditability. • Regex detection engine to block injections, XSS vectors, base64 blobs, and other unsafe inputs.

A custom invoke_claude() function dispatches requests to Claude based on three modes (refine, grade, suggest) with adjusted temperature and token limits. All costs are calculated per session.

Challenges we ran into

• Initial AccessDenied errors when configuring AWS Bedrock permissions.
• Lost SSH access to the EC2 instance mid-way through the project—recovered by pushing updates via Streamlit.
• Prompt injection detection was tricky to tune without over-blocking benign input.
• Cost estimation and token tracking required experimentation to balance granularity with simplicity.
• Keeping the UI minimal yet informative without turning it into a multi-tab app.

Accomplishments that we're proud of

• Built a fully functional multi-step Claude workflow in under 200 lines of Python.
• Implemented real-time injection blocking, mobile alerting, and cost tracking from scratch.
• Maintained a fast, reliable, one-screen interface that feels complete, without scope creep.
• Deployed and running live via EC2 with full observability and logging.

What we learned

• Prompt quality and prompt security can—and should—coexist.
• Claude 3 Haiku is fast enough for multi-call workflows with real-time UX.
• Simple tools like CSV logging and Pushover go a long way for visibility during a hackathon.
• Clean, single-purpose interfaces often outperform feature-heavy dashboards.

What's next for Prompt Refiner AI

• Add API access so developers can use the prompt refiner in their own apps.
• Integrate with S3 or DynamoDB for more persistent and queryable logging.
• Build a browser extension version of the app for inline AI enhancement.
• Explore using Guardrails or Truss for structured output validation.
• Open-source the tool for educational and red-teaming use cases.

Built With

  • amazon
  • amazon-web-services
  • api
  • bedrock
  • boto3
  • claude
  • cloudlfare
  • csv
  • ec2
  • grading
  • haiku
  • logging
  • pushover
  • python
  • python-?-core-language-for-backend-and-logic-?-streamlit-?-ui-framework-for-rapid-app-development-?-aws-bedrock-(claude-3-haiku)-?-foundation-model-api-for-prompt-refinement
  • regex
  • streamlit
Share this project:

Updates