pub struct AutonomousLoop {Show 16 fields
pub id: String,
pub task: String,
pub iteration: u8,
pub max_iterations: u8,
pub phase: LoopPhase,
pub started: bool,
pub emergency_stopped: bool,
pub tasks: Vec<LoopTask>,
pub batches: Vec<TaskBatch>,
pub issues: Vec<Issue>,
pub last_verification: Option<VerificationResult>,
pub last_commit: Option<String>,
pub git_clean: bool,
pub blocker: Option<String>,
pub created_at: String,
pub updated_at: String,
}Expand description
The autonomous development loop state machine.
Tracks the full lifecycle of an autonomous development task across multiple iterations of the Design → Plan → Implement → Verify → ReValidate → Fix loop.
§Usage
let mut al = AutonomousLoop::new("Implement user authentication");
al.start()?;
// Design phase
al.advance()?; // → Plan
// Plan phase — add tasks and compute batches
al.add_task(LoopTask::new("T1", "Create auth module").touches("src/auth.rs"));
al.add_task(LoopTask::new("T2", "Add login route").depends_on("T1"));
al.compute_batches()?;
al.advance()?; // → Implement
// ... execute batches ...
al.advance()?; // → VerifyFields§
§id: StringUnique loop instance ID.
task: StringThe task description.
iteration: u8Current iteration (1-based).
max_iterations: u8Maximum iterations allowed.
phase: LoopPhaseCurrent phase.
started: boolWhether the loop has been started.
emergency_stopped: boolWhether the loop has been forcefully stopped.
tasks: Vec<LoopTask>All tasks in the plan.
batches: Vec<TaskBatch>Computed execution batches.
issues: Vec<Issue>Issues found across all iterations.
last_verification: Option<VerificationResult>Latest verification result.
last_commit: Option<String>Most recent commit hash.
git_clean: boolWhether the git working tree is clean.
blocker: Option<String>Any blocking condition preventing progress.
created_at: StringCreation timestamp.
updated_at: StringLast update timestamp.
Implementations§
Source§impl AutonomousLoop
impl AutonomousLoop
Sourcepub fn with_max_iterations(self, max: u8) -> Self
pub fn with_max_iterations(self, max: u8) -> Self
Set the maximum number of iterations.
Sourcepub fn start(&mut self) -> Result<()>
pub fn start(&mut self) -> Result<()>
Start the loop (transitions to iteration 1, Design phase).
Sourcepub fn emergency_stop(&mut self, reason: impl Into<String>)
pub fn emergency_stop(&mut self, reason: impl Into<String>)
Emergency stop — halts the loop immediately.
Sourcepub fn advance(&mut self) -> Result<LoopPhase>
pub fn advance(&mut self) -> Result<LoopPhase>
Advance to the next phase.
Follows the standard loop flow:
- After ReValidate with no confirmed issues → Done
- After ReValidate with confirmed issues → Fix → Verify (new iteration)
- After Verify with no issues → Done
- After Verify with issues → ReValidate
Sourcepub fn set_phase(&mut self, phase: LoopPhase)
pub fn set_phase(&mut self, phase: LoopPhase)
Jump to a specific phase (for recovery or testing).
Sourcepub fn get_task_mut(&mut self, id: &str) -> Option<&mut LoopTask>
pub fn get_task_mut(&mut self, id: &str) -> Option<&mut LoopTask>
Get a mutable reference to a task by ID.
Sourcepub fn compute_batches(&mut self) -> Result<()>
pub fn compute_batches(&mut self) -> Result<()>
Compute execution batches from the current task list.
Groups tasks into batches using topological ordering. Each batch contains tasks whose dependencies are all in earlier batches. Tasks within a batch that touch overlapping files are flagged as having conflicts.
Uses Kahn’s algorithm for topological sorting, grouping tasks by their dependency depth level.
Sourcepub fn next_pending_batch(&self) -> Option<&TaskBatch>
pub fn next_pending_batch(&self) -> Option<&TaskBatch>
Get the next pending batch, if any.
Sourcepub fn get_batch_mut(&mut self, index: usize) -> Option<&mut TaskBatch>
pub fn get_batch_mut(&mut self, index: usize) -> Option<&mut TaskBatch>
Get a mutable reference to a batch by index.
Sourcepub fn completed_batch_count(&self) -> usize
pub fn completed_batch_count(&self) -> usize
Count completed batches.
Sourcepub fn total_batch_count(&self) -> usize
pub fn total_batch_count(&self) -> usize
Count total batches.
Sourcepub fn confirmed_issues(&self) -> Vec<&Issue>
pub fn confirmed_issues(&self) -> Vec<&Issue>
Get all confirmed, unfixed issues.
Sourcepub fn issues_by_verdict(&self, verdict: IssueVerdict) -> usize
pub fn issues_by_verdict(&self, verdict: IssueVerdict) -> usize
Count issues by verdict.
Sourcepub fn fixed_issue_count(&self) -> usize
pub fn fixed_issue_count(&self) -> usize
Count fixed issues.
Sourcepub fn record_verification(&mut self, result: VerificationResult)
pub fn record_verification(&mut self, result: VerificationResult)
Record a verification result.
Sourcepub fn is_clean(&self) -> bool
pub fn is_clean(&self) -> bool
Whether the current state is “clean” (no unfixed confirmed issues, all verification gates passed).
Sourcepub fn record_commit(&mut self, hash: impl Into<String>)
pub fn record_commit(&mut self, hash: impl Into<String>)
Record a commit hash.
Sourcepub fn set_git_clean(&mut self, clean: bool)
pub fn set_git_clean(&mut self, clean: bool)
Set the git clean status.
Sourcepub fn status(&self) -> LoopStatus
pub fn status(&self) -> LoopStatus
Produce a serializable status snapshot.
Sourcepub fn diagnostic(&self) -> String
pub fn diagnostic(&self) -> String
Produce a diagnostic report when the loop hits max iterations or emergency stop.
Trait Implementations§
Source§impl Clone for AutonomousLoop
impl Clone for AutonomousLoop
Source§fn clone(&self) -> AutonomousLoop
fn clone(&self) -> AutonomousLoop
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AutonomousLoop
impl Debug for AutonomousLoop
Source§impl<'de> Deserialize<'de> for AutonomousLoop
impl<'de> Deserialize<'de> for AutonomousLoop
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AutonomousLoop
impl RefUnwindSafe for AutonomousLoop
impl Send for AutonomousLoop
impl Sync for AutonomousLoop
impl Unpin for AutonomousLoop
impl UnsafeUnpin for AutonomousLoop
impl UnwindSafe for AutonomousLoop
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more