pub struct TaskState {
pub goal: String,
pub criteria: Vec<String>,
pub plan: Vec<PlanStep>,
pub current_step: Option<usize>,
pub progress: String,
pub scratchpad: String,
pub blocked_on: Vec<String>,
pub directives: Vec<String>,
pub preserved_refs: Vec<String>,
pub compression_log: Vec<CompressionEntry>,
}Expand description
Persistent task state that lives in the working partition.
Survives compression, renewal, and wake/resume cycles because the working
partition is compressible = false.
Fields§
§goal: StringPrimary objective for this run. Set at run_started, immutable thereafter.
criteria: Vec<String>Acceptance criteria copied from RunStarted.
plan: Vec<PlanStep>Ordered plan steps.
current_step: Option<usize>Index of the step currently executing (0-based). None before planning.
progress: StringFree-text progress note updated after each significant action.
scratchpad: StringEphemeral scratch space for model use. Cleared on renewal. NOT used by the compression pipeline (use compression_log instead).
blocked_on: Vec<String>Reasons the current step cannot proceed.
directives: Vec<String>Durable user directives / standing constraints (e.g. mid-task corrections, “don’t do X”).
Promoted here from the ephemeral signal channel so they survive compression AND renewal
like the goal does — without this, the most recent user command loses salience exactly at
the compaction/renewal boundaries between consecutive contexts (the “goal drift” failure).
Bounded + recency-ordered (oldest dropped past MAX_DIRECTIVES); newest last.
preserved_refs: Vec<String>Call IDs or artifact hashes that must be preserved from compression.
compression_log: Vec<CompressionEntry>Append-only log of all compression events. Never overwritten. Rendered into systemVolatile so the model always sees compression history.
Implementations§
Source§impl TaskState
impl TaskState
Sourcepub fn format_compact(&self) -> String
pub fn format_compact(&self) -> String
Compact text block for embedding in system_text.
Returns an empty string when the task has not been initialised.
Sourcepub fn record_directive(&mut self, text: impl Into<String>)
pub fn record_directive(&mut self, text: impl Into<String>)
Record a durable user directive (deduped against the most recent, recency-capped at
MAX_DIRECTIVES). Newest is appended last; the oldest is dropped past the cap so the
channel stays bounded across a long session.
Sourcepub fn log_compression(&mut self, action: &str, summary: String)
pub fn log_compression(&mut self, action: &str, summary: String)
Append a compression event to the log. Never overwrites existing entries.
pub fn apply(&mut self, update: TaskUpdate)
Sourcepub fn open_steps(&self) -> Vec<String>
pub fn open_steps(&self) -> Vec<String>
Open steps (not yet done), for renewal handoff.