pub struct HatlessRalph { /* private fields */ }Expand description
Hatless Ralph - the constant coordinator.
Implementations§
Source§impl HatlessRalph
impl HatlessRalph
Sourcepub fn new(
completion_promise: impl Into<String>,
core: CoreConfig,
registry: &HatRegistry,
starting_event: Option<String>,
) -> Self
pub fn new( completion_promise: impl Into<String>, core: CoreConfig, registry: &HatRegistry, starting_event: Option<String>, ) -> Self
Creates a new HatlessRalph.
§Arguments
completion_promise- Event topic that signals loop completioncore- Core configuration (scratchpad, specs_dir, guardrails)registry- Hat registry for topology generationstarting_event- Optional event to publish after coordination to start hat workflow
Sourcepub fn with_memories_enabled(self, enabled: bool) -> Self
pub fn with_memories_enabled(self, enabled: bool) -> Self
Sets whether memories mode is enabled.
When enabled, adds tasks CLI instructions alongside scratchpad. Scratchpad is always included regardless of this setting.
Sourcepub fn with_skill_index(self, index: String) -> Self
pub fn with_skill_index(self, index: String) -> Self
Sets the pre-built skill index for prompt injection.
The skill index is a compact table of available skills that appears between GUARDRAILS and OBJECTIVE in the prompt.
Sourcepub fn set_objective(&mut self, objective: String)
pub fn set_objective(&mut self, objective: String)
Stores the user’s original objective so it persists across all iterations.
Called once during initialization. The objective is injected into every prompt regardless of which hat is active, ensuring intermediate hats (test_writer, implementer, refactorer) always see the goal.
Sourcepub fn set_robot_guidance(&mut self, guidance: Vec<String>)
pub fn set_robot_guidance(&mut self, guidance: Vec<String>)
Sets robot guidance messages collected from human.guidance events.
Called by EventLoop::build_prompt() before HatlessRalph::build_prompt().
Multiple guidance messages are squashed into a numbered list and injected
as a ## ROBOT GUIDANCE section in the prompt.
Sourcepub fn clear_robot_guidance(&mut self)
pub fn clear_robot_guidance(&mut self)
Clears stored robot guidance after it has been injected into a prompt.
Called by EventLoop::build_prompt() after HatlessRalph::build_prompt().
Sourcepub fn build_prompt(&self, context: &str, active_hats: &[&Hat]) -> String
pub fn build_prompt(&self, context: &str, active_hats: &[&Hat]) -> String
Builds Ralph’s prompt with filtered instructions for only active hats.
This method reduces token usage by including instructions only for hats that are currently triggered by pending events, while still showing the full hat topology table for context.
For solo mode (no hats), pass an empty slice: &[]
Sourcepub fn should_handle(&self, _topic: &Topic) -> bool
pub fn should_handle(&self, _topic: &Topic) -> bool
Always returns true - Ralph handles all events as fallback.