Skip to content

Focus Loops

Focus loops enable persistent iterative development where Claude works on a task repeatedly until completion. When a loop is active, Claude’s Stop hook prevents exit and re-injects the task prompt, enforcing continuous work.

Claude Code Session
|
Plugin Stop Hook (claudezilla/plugin/)
| (Unix socket query)
Claudezilla Host (loop state)
|
Firefox Extension (visual control)

Start a focus loop. Claude will automatically continue working on the prompt until max iterations are reached or the completion promise is detected.

ParameterTypeRequiredDefaultDescription
promptstringYes-The task prompt to work on iteratively
maxIterationsnumberNo0 (unlimited)Maximum iterations before stopping. Use 0 with caution.
completionPromisestringNo-Text to signal completion. When Claude outputs <promise>THIS_TEXT</promise>, the loop ends.
timeoutnumberNo150000Request timeout in ms (5000-300000)
// Basic loop with iteration limit
const result = await firefox_start_loop({
prompt: "Build a REST API for todos",
maxIterations: 20
});
// Loop with completion signal
const result = await firefox_start_loop({
prompt: "Refactor the auth module to use JWT",
maxIterations: 15,
completionPromise: "DONE"
});
// Loop ends when Claude outputs: <promise>DONE</promise>
  • The Stop hook must be installed for enforcement. See plugin installation below.
  • Setting maxIterations: 0 creates an unlimited loop. Always set a reasonable limit.
  • Only one loop can be active at a time.

Stop the active focus loop. The current iteration will complete, then Claude will be allowed to exit normally.

ParameterTypeRequiredDefaultDescription
timeoutnumberNo150000Request timeout in ms (5000-300000)

No other parameters. This tool takes no input besides the optional timeout.

// Stop the current loop
const result = await firefox_stop_loop();

Get the current focus loop status. Use this to check progress during a loop or verify whether a loop is active.

ParameterTypeRequiredDefaultDescription
timeoutnumberNo150000Request timeout in ms (5000-300000)

No other parameters.

const result = await firefox_loop_status();
// Returns:
// {
// active: true,
// iteration: 5,
// maxIterations: 20,
// prompt: "Build a REST API for todos",
// completionPromise: "DONE",
// startedAt: "2026-03-06T12:00:00Z"
// }

The focus loop plugin must be installed for the Stop hook to enforce loop continuation:

Terminal window
# From the claudezilla directory
ln -s "$(pwd)/plugin" ~/.claude/plugins/claudezilla-loop

The Firefox extension popup shows loop status:

  • Active/inactive state
  • Current iteration counter
  • Prompt preview
  • Manual stop button