Skip to main content

Phase

Trait Phase 

Source
pub trait Phase {
    // Required methods
    fn id(&self) -> PhaseId;
    fn deps(&self) -> &'static [PhaseId];
    fn can_resume(&self) -> bool;
    fn prompt(&self, ctx: &PhaseContext) -> String;
    fn make_packet(&self, ctx: &PhaseContext) -> Result<Packet>;
    fn postprocess(&self, raw: &str, ctx: &PhaseContext) -> Result<PhaseResult>;
}
Expand description

Core trait that all workflow phases must implement

This trait separates concerns into three distinct operations:

  • prompt(): Generate the prompt for Claude
  • make_packet(): Prepare context packet for Claude
  • postprocess(): Process Claude’s response into artifacts

Required Methods§

Source

fn id(&self) -> PhaseId

Returns the unique identifier for this phase

Source

fn deps(&self) -> &'static [PhaseId]

Returns the phases that must complete before this phase can run

Source

fn can_resume(&self) -> bool

Returns whether this phase can be resumed from a partial state

Source

fn prompt(&self, ctx: &PhaseContext) -> String

Generate the prompt text for Claude CLI

This method creates the specific prompt that will be sent to Claude for this phase, based on the current context and available artifacts.

Source

fn make_packet(&self, ctx: &PhaseContext) -> Result<Packet>

Create a packet of context information for Claude

This method builds the context packet that will be included with the prompt, selecting and organizing relevant files and information.

Source

fn postprocess(&self, raw: &str, ctx: &PhaseContext) -> Result<PhaseResult>

Process Claude’s raw response into structured artifacts

This method takes Claude’s raw output and converts it into the appropriate artifacts for this phase, handling any necessary parsing and validation.

Implementors§