Cline is a core reference system because it provides a strong example of a coding-agent execution loop centered on tool use, iteration, recovery, and explicit completion semantics.
- Strong candidate evidence for the tool-result loop.
- Strong candidate evidence for explicit completion tools.
- Strong candidate evidence for recoverable tool failures.
- Cline treats
attempt_completionas an explicit tool. The system prompt tool spec instructs the model to use the tool only after tool success is confirmed, and the handler owns the user-confirmation loop, checkpointing, telemetry, and post-completion feedback reinjection. - Completion is guarded in multiple ways. There is a configurable double-check flow that rejects the first completion attempt, and the completion handler can require command approval, run pre-tool hooks, and return user feedback into the task instead of hard-closing it.
- Tool failures are preserved as in-band results.
ToolExecutorconverts execution exceptions intotoolError(...)responses and still runs the post-tool hook path rather than crashing the session by default. - Cline has recoverable no-tools-used behavior.
SubagentRunnerexplicitly nudges the conversation forward when the model emits no tool call, instead of immediately failing, and only terminates after repeated empty responses. - Subagents are bounded, status-reporting, and instrumented.
SubagentRunnertracks tool calls, tokens, context usage, and status;SubagentToolHandleraggregates per-subagent success and failure rather than flattening them into one opaque result. - Context compaction is proactive. The subagent loop checks whether it should compact before the next request and compacts conversation state before continuing.
- Hooks are part of runtime behavior.
AttemptCompletionHandlerinvokes TaskComplete and Notification hooks, andToolExecutorruns post-tool hooks on both success and error paths.
- Explicit completion tool:
src/core/prompts/system-prompt/tools/attempt_completion.ts. - Completion handler and feedback loop:
src/core/task/tools/handlers/AttemptCompletionHandler.ts. - Double-check completion tests:
src/core/task/tools/handlers/__tests__/AttemptCompletionHandler.doubleCheck.test.ts. - Failure normalization and hook integration:
src/core/task/ToolExecutor.ts. - Subagent bounded loop and progress reporting:
src/core/task/tools/subagent/SubagentRunner.tsandsrc/core/task/tools/handlers/SubagentToolHandler.ts. - Context-summary fallback:
src/core/prompts/contextManagement.ts.
- Tool-result execution loop.
- Completion attempts as explicit runtime events.
- Recovery via structured failure reinjection.
- Status-reporting subagents with bounded tool surfaces.
- Proactive compaction based on token usage.
- Hook interception around tool and completion boundaries.
- Provider-specific configuration flows.
- UI language that does not affect runtime behavior.
- Cline-specific focus chain and message-type conventions.
high-confidence convergence for loop, guarded completion, recoverable failure handling, and bounded subagents.
- https://github.com/cline/cline/blob/main/src/core/prompts/system-prompt/tools/attempt_completion.ts
- https://github.com/cline/cline/blob/main/src/core/task/tools/handlers/AttemptCompletionHandler.ts
- https://github.com/cline/cline/blob/main/src/core/task/tools/handlers/__tests__/AttemptCompletionHandler.doubleCheck.test.ts
- https://github.com/cline/cline/blob/main/src/core/task/ToolExecutor.ts
- https://github.com/cline/cline/blob/main/src/core/task/tools/subagent/SubagentRunner.ts
- https://github.com/cline/cline/blob/main/src/core/task/tools/handlers/SubagentToolHandler.ts
- https://github.com/cline/cline/blob/main/src/core/prompts/contextManagement.ts