run_task_loop
Run a safe, automated task loop for code modifications: creates tasks, waits for completion, verifies with allowed commands, audits for risks, and optionally fixes tests, all within security boundaries.
Instructions
Run a guarded PatchWarden task loop by composing create_task, wait_for_task, safe summaries, and audit_task. It does not bypass the watcher, command allow-list, workspace confinement, or confirmation boundaries. Returns only bounded structured lineage and final status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| goal | Yes | Task goal to execute through the guarded loop. | |
| agent | No | Configured local agent name. Available agents: "codex", "opencode". run_task_loop also accepts "auto" for bounded routing. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. |