Automated Prompt Engineering for Rust
Rig Examples Series: Entry #1 This project is the first in a series of examples designed to teach Agentic AI in Rust. Developed under the mentorship of Joshua Mo, maintainer of the Rig Framework, this series aims to provide gold-standard implementations for the community. More examples are coming soon.
This specific example (Entry #1) focuses on Prompt Auto-Improvement. It demonstrates how to use agents to refine the very instructions used to drive them.
In most AI applications, prompts are treated as static strings of text. They are often guessed, hard-coded, and rarely tested.
This is risky. It is like writing software without a compiler.
RigScribe treats prompts like software assets. It separates what you want (Human Intent) from what the AI needs (Technical Specification).
As the foundation of our series, this project uses Rust's type safety and Agentic workflows to ensure your prompts are robust, reusable, and precise.
RigScribe acts as a quality assurance layer for your AI interactions. It transforms vague requests into professional system prompts in three steps:
-
Raw Input You provide a simple, human-readable goal.
- Example: "Summarize this text."
-
Agentic Refinement RigScribe hands this goal to a specialized "Expert Agent." This agent automatically:
- Clarifies the instruction.
- Injects structural best practices.
- Removes ambiguity.
-
Robust Output The system returns a high-performance system prompt. You get state-of-the-art quality without manual engineering.
RigScribe includes a persistent file-based cache. By utilizing a strongly-typed ScopeId, it automatically saves and retrieves optimized artifacts from disk, preventing redundant computations across sessions.
// RigScribe automatically handles file I/O for you.
// If "./cache/2027.json" exists, it loads instantly.
// If not, it runs the agents and saves the result.
let scribe = RigScribe::new("./.cache");
let artifact = scribe.optimize_with_cache("fix this code", ScopeId(2027)).await?;This is just the beginning. The next phase of our roadmap introduces Reinforcement Learning (RL).
Future versions of RigScribe will:
- Measure Success: Track if the AI's output valid (e.g., correct JSON).
- Adapt: Automatically rewrite the prompt if it fails.
- Evolve: Learn the perfect phrasing for your specific use case over time.
This is an open-source initiative to demonstrate the power of Rig and Rust.
Whether you are a prompt engineer, a Rustacean, or an AI enthusiast, your contributions are welcome. Help us build the standard for agentic prompt engineering.
