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. ## Architecture ``` Claude Code Session | Plugin Stop Hook (claudezilla/plugin/) | (Unix socket query) Claudezilla Host (loop state) | Firefox Extension (visual control) ``` ## firefox_start_loop Start a focus loop. Claude will automatically continue working on the prompt until max iterations are reached or the completion promise is detected. ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `prompt` | string | **Yes** | - | The task prompt to work on iteratively | | `maxIterations` | number | No | `0` (unlimited) | Maximum iterations before stopping. Use `0` with caution. | | `completionPromise` | string | No | - | Text to signal completion. When Claude outputs `<promise>THIS_TEXT</promise>`, the loop ends. | | `timeout` | number | No | `150000` | Request timeout in ms (5000-300000) | ### Example ```js // 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> ``` ### Notes - 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. --- ## firefox_stop_loop Stop the active focus loop. The current iteration will complete, then Claude will be allowed to exit normally. ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `timeout` | number | No | `150000` | Request timeout in ms (5000-300000) | No other parameters. This tool takes no input besides the optional timeout. ### Example ```js // Stop the current loop const result = await firefox_stop_loop(); ``` --- ## firefox_loop_status Get the current focus loop status. Use this to check progress during a loop or verify whether a loop is active. ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `timeout` | number | No | `150000` | Request timeout in ms (5000-300000) | No other parameters. ### Example ```js 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" // } ``` --- ## Plugin Installation The focus loop plugin must be installed for the Stop hook to enforce loop continuation: ```bash # From the claudezilla directory ln -s "$(pwd)/plugin" ~/.claude/plugins/claudezilla-loop ``` ## Browser UI The Firefox extension popup shows loop status: - Active/inactive state - Current iteration counter - Prompt preview - Manual stop buttonFocus 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.
Architecture
Section titled “Architecture”Claude Code Session |Plugin Stop Hook (claudezilla/plugin/) | (Unix socket query)Claudezilla Host (loop state) |Firefox Extension (visual control)firefox_start_loop
Section titled “firefox_start_loop”Start a focus loop. Claude will automatically continue working on the prompt until max iterations are reached or the completion promise is detected.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | Yes | - | The task prompt to work on iteratively |
maxIterations | number | No | 0 (unlimited) | Maximum iterations before stopping. Use 0 with caution. |
completionPromise | string | No | - | Text to signal completion. When Claude outputs <promise>THIS_TEXT</promise>, the loop ends. |
timeout | number | No | 150000 | Request timeout in ms (5000-300000) |
Example
Section titled “Example”// Basic loop with iteration limitconst result = await firefox_start_loop({ prompt: "Build a REST API for todos", maxIterations: 20});
// Loop with completion signalconst 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: 0creates an unlimited loop. Always set a reasonable limit. - Only one loop can be active at a time.
firefox_stop_loop
Section titled “firefox_stop_loop”Stop the active focus loop. The current iteration will complete, then Claude will be allowed to exit normally.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
timeout | number | No | 150000 | Request timeout in ms (5000-300000) |
No other parameters. This tool takes no input besides the optional timeout.
Example
Section titled “Example”// Stop the current loopconst result = await firefox_stop_loop();firefox_loop_status
Section titled “firefox_loop_status”Get the current focus loop status. Use this to check progress during a loop or verify whether a loop is active.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
timeout | number | No | 150000 | Request timeout in ms (5000-300000) |
No other parameters.
Example
Section titled “Example”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"// }Plugin Installation
Section titled “Plugin Installation”The focus loop plugin must be installed for the Stop hook to enforce loop continuation:
# From the claudezilla directoryln -s "$(pwd)/plugin" ~/.claude/plugins/claudezilla-loopBrowser UI
Section titled “Browser UI”The Firefox extension popup shows loop status:
- Active/inactive state
- Current iteration counter
- Prompt preview
- Manual stop button