Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 3.9 KB

File metadata and controls

59 lines (43 loc) · 3.9 KB

Cline Review

Overview

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.

Why It Matters

  • Strong candidate evidence for the tool-result loop.
  • Strong candidate evidence for explicit completion tools.
  • Strong candidate evidence for recoverable tool failures.

Source-Backed Findings

  1. Cline treats attempt_completion as 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.
  2. 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.
  3. Tool failures are preserved as in-band results. ToolExecutor converts execution exceptions into toolError(...) responses and still runs the post-tool hook path rather than crashing the session by default.
  4. Cline has recoverable no-tools-used behavior. SubagentRunner explicitly nudges the conversation forward when the model emits no tool call, instead of immediately failing, and only terminates after repeated empty responses.
  5. Subagents are bounded, status-reporting, and instrumented. SubagentRunner tracks tool calls, tokens, context usage, and status; SubagentToolHandler aggregates per-subagent success and failure rather than flattening them into one opaque result.
  6. Context compaction is proactive. The subagent loop checks whether it should compact before the next request and compacts conversation state before continuing.
  7. Hooks are part of runtime behavior. AttemptCompletionHandler invokes TaskComplete and Notification hooks, and ToolExecutor runs post-tool hooks on both success and error paths.

Evidence

  • 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.ts and src/core/task/tools/handlers/SubagentToolHandler.ts.
  • Context-summary fallback: src/core/prompts/contextManagement.ts.

Reusable Pattern Candidates

  • 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.

Product-Specific Artifacts To Avoid Generalizing

  • Provider-specific configuration flows.
  • UI language that does not affect runtime behavior.
  • Cline-specific focus chain and message-type conventions.

Current Confidence

high-confidence convergence for loop, guarded completion, recoverable failure handling, and bounded subagents.

Source Notes