Skip to main content

TaskState

Struct TaskState 

Source
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 recent_actions: 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: String

Primary 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: String

Free-text progress note updated after each significant action.

§scratchpad: String

Ephemeral 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.

§recent_actions: Vec<String>

Rolling log of recent task activity — one entry per turn, each a compact summary of that turn’s tool calls (e.g. “module_read, module_list”). Kernel-maintained from REAL tool activity (not model-curated), so the State turn always shows forward motion even when the model never maintains plan. Lives in the volatile State turn (out of the cacheable prefix), so updating it never churns the prompt cache. Bounded + recency-ordered; newest last.

§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

Source

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.

Source

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.

Source

pub fn note_actions(&mut self, summary: impl Into<String>)

Record one turn’s tool activity into the recency log (kernel-driven). summary is a compact string of the turn’s task tool names; blank input is ignored. Bounded at MAX_RECENT_ACTIONS (oldest dropped past the cap).

Source

pub fn log_compression(&mut self, action: &str, summary: String)

Append a compression event to the log. Never overwrites existing entries.

Source

pub fn apply(&mut self, update: TaskUpdate)

Source

pub fn open_steps(&self) -> Vec<String>

Open steps (not yet done), for renewal handoff.

Trait Implementations§

Source§

impl Clone for TaskState

Source§

fn clone(&self) -> TaskState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TaskState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TaskState

Source§

fn default() -> TaskState

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TaskState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for TaskState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.