run_task_loop
Start a guarded task loop that executes, verifies, and audits repository changes while enforcing scoped permissions and confirmation boundaries.
Instructions
Start a guarded PatchWarden task loop by composing create_task, wait_for_task, safe summaries, and audit_task. By default it returns request_id, lineage_id, and the created main task immediately while Core continues the loop in the background; follow with wait_for_task and get_task_lineage. It does not bypass the watcher, command allow-list, workspace confinement, or confirmation boundaries.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| goal | Yes | Task goal to execute through the guarded loop. | |
| agent | No | Configured local agent name. No agents are currently configured. | |
| template | No | Initial guarded task template. Follow-up repair tasks use fix_tests automatically when verification fails. | feature_small |
| repo_path | Yes | Required repository path inside workspaceRoot. No implicit workspace-root fallback is allowed. | |
| request_id | No | Optional idempotency key. Retrying the same arguments with the same request_id returns the existing lineage and never creates a duplicate task. | |
| scope_files | No | Optional bounded file scope used only for agent routing hints. | |
| direct_verify | No | When true, run an independent Direct verification session after the guarded task/audit succeeds. Direct never patches files in this loop. | |
| auto_fix_tests | No | When true, create a fix_tests follow-up task after failed_verification until max_iterations is reached. | |
| isolation_mode | No | Use current_repo by default. worktree creates an isolated git worktree for the task but never auto-merges it. | current_repo |
| max_iterations | No | Maximum total main/fix task attempts. | |
| requested_model | No | Optional model override. Requires an explicit non-auto agent and is retained for every task iteration. | |
| verify_commands | Yes | Exact-match verification commands. The loop reuses create_task validation and will not run commands outside the allow-list. | |
| worktree_cleanup | No | Cleanup intent recorded in lineage. v1.5 keeps worktrees by default and does not auto-delete them. | keep |
| stop_on_high_risk | No | When true, stop immediately on non-policy high-risk audit evidence. Scope, policy, sensitive-path, release/publish, and confirmation boundaries always stop regardless of this flag. | |
| wait_for_completion | No | Local/debug compatibility mode. When false (default), return after the main task is created. Set true only when the transport timeout is known to exceed the full loop duration. | |
| task_timeout_seconds | No | Per-task wait budget in seconds (default 900, max 3600). | |
| worktree_base_branch | No | Optional base-branch label recorded in lineage. v1.5 does not auto-checkout or merge this branch. | |
| auto_cleanup_artifacts | No | Records cleanup intent in lineage. Low-risk cleanup remains handled by runTask post-task cleanup. | |
| confirm_workspace_root | No | Explicit acknowledgement required when repo_path is a detected multi-project workspace root. | |
| direct_verify_commands | No | Optional Direct verification commands. Defaults to verify_commands and still must pass the Direct command allow-list. | |
| direct_verify_timeout_seconds | No | Per-command timeout for Direct verification. |