A-PIRO (Automatic Prompt Intent Recognition Optimization) is an industry-standard Prompt Engineering Engine designed to transform raw, vague user inputs into high-fidelity, mission-critical System Prompts.
Unlike standard "prompt improvers," A-PIRO uses a rigourous V5.5 Hybrid Architecture combining:
- Dual-Gradient Analysis: Optimizing for both fixes (negative gradient) and feature reinforcement (positive gradient).
- Evidence-Based Research: Real-time web validation of stacks and libraries (prevents hallucinations).
- Beam Search Simulation: Mentally simulating multiple architectural candidates before selection.
- Mockup Prevention Guard: A 4-layer defense system against fake APIs, "todo" placeholders, and unrealistic guarantees.
- 🛡️ Role-Based Firewalls: Automatically detects and blocks requests for "implementation code" (Builder stance), forcing an "Architect stance" (Prompt Design) instead.
- 🔍 Evidence-Based Research: Dynamic verification of libraries and versions using
WebSearch(max 30s) to ensure prompts are grounded in current reality. - 🧬 Evolutionary Validation: A self-correcting validation loop that scores prompts on Compliance vs. Quality and mutates them until they reach >9.5/10.
- 📝 Sidecar Protocol: Generates a separate
*.apo_log.mdfile detailing the reasoning behind every optimization decision. - ⚓ Context Anchoring: Enforces specific references to user-provided files (Context Injection) to prevent generic responses.
A-PIRO follows a strict algorithmic workflow:
- Input Analysis: Intent classification & Evidence-based research.
- Gradient Calculation: Root Cause Analysis (Fixes) + Success Factor Analysis (Preserve).
- Pitfall Prediction: Identifying domain-specific anti-patterns (e.g., "Div Soup" in HTML).
- Beam Search: Simulating "Strict" vs "Creative" strategies.
- Validation Loop: Iterative scoring and refinement.
- Content Synthesis: Injecting Anti-Drift Anchors and Constitutional Safeguards.
- Output Generation: Delivering the
System PromptandProcess Log.
- Claude Code (CLI)
- Access to
Tasktool capabilities
-
Clone the Repository:
git clone https://github.com/DarKWinGTM/A-PIRO.git cd A-PIRO -
Install the Agent:
# Copy the agent definition to your local Claude Code agents directory cp prompt-optimizer.md ~/.claude/agents/
Option 1: Direct Task Invocation
Use the Task tool to invoke the agent directly on a specific request.
Task(subagent_type="prompt-optimizer", prompt="Create a secure FastAPI backend for e-commerce")Option 2: Chat-based Interaction If installed as a main agent:
@prompt-optimizer Create a rigorous system prompt for a Python Data Science Expert
For every run, A-PIRO generates two files:
{filename}.md: The optimized System Prompt (The final product).{filename}.apo_log.md: The Process Log (Transparency report showing gradients, scores, and decisions).
A-PIRO operates under strict Constitutional Safeguards:
- Anti-Mockup Policy: No placeholders (
pass,TODO). Real implementation only. - Zero Hallucination: No guessing APIs. Must verify against docs.
- Architect Stance: The agent designs the blueprint (Prompt), it does not write the application code directly.
We welcome contributions! Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by the A-PIRO Team