Loop & Enhance

Automatic detect-fix-rerun cycles around a workflow; let Cerevisor improve your workflow between rounds.

Loop & Enhance wraps a workflow run in a detect-fix-rerun cycle. After each round, the harness analyzes what failed, an LLM planner proposes edits to your workflow, those edits apply, and the next round runs.

The result: workflows that improve themselves between rounds, converging on a working version.

License gate: Trial+/Paid only.

When to use it

  • Your workflow mostly works but has reliability issues you can't pin down.
  • You want the harness to evolve the workflow toward something more robust.
  • You're iterating on the shape of a workflow, not just its output.

When not to use it:

  • For a workflow that already produces good output reliably: Loop & Enhance is overhead without payoff.
  • For one-shot tasks where the cost of multiple rounds isn't justified.

Enabling it

First time: Settings → Automation → Loop & Enhance → Setup opens the Loop & Enhance Setup Modal with the key knobs:

Field Default Effect
Max rounds 3 Hard cap on cycles.
Budget cap (USD) $5.00 Total cost across all rounds, including planner LLM calls.
Convergence mode strict strict = stop only when no failures detected. lenient = also accept convergence when the only remaining failures are intentional skips or fallback outputs.
Pause between rounds Off If on, the run pauses after each round and asks you to approve continuation.
Planner provider Chat builder's Provider for the per-round planner LLM.
Planner model Inherits Specific model.

After setup, toggle Loop & Enhance on per workflow in Settings → Workflow → Loop & Enhance.

How it works

  1. You click Run. The workflow runs round 1, same as a normal run.
  2. At end-of-round, the harness builds a structured FailureReport: which agents failed, what their output looked like, what the verifier said, what the user feedback was.
  3. The harness checks the report: did anything fail? If no: convergence; stop.
  4. If yes: the planner LLM reads the FailureReport and proposes a list of workflow operations (add agent, set instructions, add skill, etc.) using the same op schema as the chat builder.
  5. The orchestrator emits the proposed ops to the renderer. The renderer applies them via the standard applyWorkflowOp code path (same as chat-builder edits) and sends an ACK back with the edited workflow.
  6. Round 2 runs against the edited workflow.
  7. Loop until convergence, max rounds, or budget cap.

Safety rails

Multiple guards prevent runaway:

  • Hard maxRounds cap: set per workflow. Run never exceeds.
  • Cumulative budget cap: covers workflow execution + planner LLM cost. Run halts when reached.
  • Stuck detection: if two consecutive rounds produce the same FailureReport fingerprint, the FSM emits a loop_fixation_warning orchestrator event (consumed by the Situational Awareness pillar to flip the run's state label to fixation-risk) and optionally aborts. The planner isn't making progress; we stop.
  • Op allowlist: the planner can only emit a limited set of ops. It can't delete the workflow, change the provider, or do anything truly destructive. The allowlist is ENHANCER_ALLOWED_OPS in code.

The Loop & Enhance tab

When Loop & Enhance is running, the Execution Modal grows an extra Loop & Enhance tab showing:

  • Round counter ("Round 2 of 3").
  • Budget burn so far.
  • Per-round timeline:
  • What failed.
  • What the planner proposed.
  • What was applied.
  • The planner's rationale.

Useful to understand why the workflow changed between rounds.

Pause between rounds

If you turn this on, the FSM stops at the end of each round and waits for you to click Continue to next round. Useful when you want to review the proposed edits before committing.

The pause is between rounds, not between agents within a round.

Planner provider rules

The planner needs a chat surface. Codex CLI and Cursor Agent as the planner provider are problematic: their output is harder to coax into the op schema. The default planner provider is your chat builder's provider, which is typically Anthropic or OpenAI-compatible for exactly this reason.

If your global default is Codex/Cursor, configure a different planner provider in Settings → Automation → Loop & Enhance → Planner provider.

When convergence isn't possible

Some failures aren't fixable by editing the workflow:

  • Provider rate limits.
  • Network errors.
  • Skill compatibility issues that the planner doesn't know how to resolve.

In these cases, Loop & Enhance will hit max rounds or budget cap and give up gracefully: the workflow's last successful round's output is preserved, and the failure report explains what couldn't be fixed.

Cost expectations

Each round costs the workflow's normal run cost + a planner LLM call (~few cents on Anthropic Haiku). A 3-round run with $0.50/round workflow and 3¢/round planner = about $1.60.

Set the budget cap to a value you're comfortable spending on an automated optimization cycle.

Why this exists

It's a different mode of working, instead of "run, edit, run, edit" manually, you set a goal and let the harness drive iteration. Worth it for stable workflows you keep coming back to; not worth it for one-shot tasks.

Back to docs