pub trait PromptFragment:
Send
+ Sync
+ DynClone {
// Required methods
fn name(&self) -> &str;
fn render(&self, ctx: &FragmentContext<'_>) -> Option<String>;
// Provided method
fn priority(&self) -> i32 { ... }
}Expand description
Composable prompt fragment — each fragment owns one concern.
§Priority convention
| Range | Typical use |
|---|---|
| 10–19 | Core role/personality |
| 20–29 | Thinking methodology |
| 50–59 | Safety rules, environment info |
| 60–69 | Workflow instructions |
| 70–79 | Tool descriptions |
| 80–89 | Feature-specific (multi-agent) |
| 90–99 | Network environment, memory |
Lower priority renders first (closer to the top of the system prompt).
Required Methods§
Sourcefn render(&self, ctx: &FragmentContext<'_>) -> Option<String>
fn render(&self, ctx: &FragmentContext<'_>) -> Option<String>
Render this fragment’s content. Return None to skip.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".