Agentic.Loop.ContinuationDetector (agentic v0.2.2)

Copy Markdown

Detects plan steps and completion signals in LLM text output.

Ported from Homunculus ContinuationDetector. Uses regex patterns to detect when the agent signals step completion or task completion.

Detection Categories

  1. Step completion — "Step 1 is complete", "Completed step 2"
  2. Task completion — "All done", "Task finished", "Nothing left to do"
  3. Continuation intent — "Let me continue", "Moving on to"
  4. Blockers — "I can't proceed", "I need clarification"
  5. Summary signals — "In summary", "To summarize"

Summary

Functions

Returns true if a blocker is detected.

Detect continuation signals in text. Returns a list of detections sorted by confidence (highest first). Pass steps: false to suppress step detection.

Extract the first step number mentioned as complete.

Returns true if any step completion is detected.

Returns true if task completion is detected.

Types

detection()

@type detection() :: %{
  category:
    :step_complete | :task_complete | :continuation | :blocker | :summary,
  match: String.t(),
  confidence: float()
}

Functions

blocked?(text)

@spec blocked?(String.t()) :: boolean()

Returns true if a blocker is detected.

detect(text, opts \\ [])

@spec detect(
  String.t(),
  keyword()
) :: [detection()]

Detect continuation signals in text. Returns a list of detections sorted by confidence (highest first). Pass steps: false to suppress step detection.

extract_step_number(text)

@spec extract_step_number(String.t()) :: integer() | nil

Extract the first step number mentioned as complete.

step_complete?(text)

@spec step_complete?(String.t()) :: boolean()

Returns true if any step completion is detected.

task_complete?(text)

@spec task_complete?(String.t()) :: boolean()

Returns true if task completion is detected.