agent-ops-patterns / gallery / Cline map / how it decides
How Cline decides
In an ordinary Cline session, plain code runs the work and sets its limits, and the AI model decides when the task is done. By default the model also writes the summary that replaces older history, and in command-line plan mode it decides when to start acting on the plan.
How it decides it is done
-
How does it decide the task is finished?
Decided by an AI model In an ordinary session, the model replies without asking to use a tool and code ends the run as completed; nothing checks that the work was done.
agent-runtime.ts:949-971· decision G1 in the full map -
When its yolo mode ends a run as "verified", does anything check?
Decided by an AI model No. The model ends the run by submitting a summary with a verified yes or no, and both the command-line tool and scheduled runs accept the submission either way.
runtime-handlers.ts:76-85· decision G2 in the full map -
Did a scheduled run succeed?
Decided by plain code Unless the run was cancelled, timed out or lost its place, any turn that does not end with an error, including one that ended as stopped, is recorded as done and counted as a success.
cron-runner.ts:445-485· decision G5 in the full map
Limits and memory
-
How long can it keep going before it is stopped?
Decided by plain code Ordinary VS Code and command-line sessions set no limit on steps. A limit applies only where a caller sets one: the --timeout flag, a schedule, or a task queued through the hub.
agent-runtime.ts:836-839· decision F5 in the full map -
When the history gets too long, who decides what to keep?
Decided by an AI model With the default strategy, a model writes a summary of the older part while about the last 20,000 tokens stay word for word, and code puts in place any summary that is not empty.
agentic-compaction.ts:255-278· decision F7 in the full map
Other judgments
-
In plan mode on the command line, who decides you have approved the plan and the work can start?
Decided by an AI model The model, by calling a switch-to-act tool; the tool does not look at what you wrote. When that turn completes, the command-line tool rebuilds the session in act mode and starts on the plan.
mode.ts:31-68· decision A3 in the full map -
On the command line, when is a running shell command stopped?
Decided by plain code After 30 seconds by default, when code tries to kill the command and the processes it started. The command-line tool does not change that default.
bash.ts:837-843· decision E3 in the full map -
When another tool runs past its time limit, is it stopped?
Decided by plain code Usually not. The model is told the tool timed out, but the work itself is not cancelled and may still finish, so a file edit that timed out can still be written.
helpers.ts:48-59· decision E9 in the full map
Three problems in the code
-
1. Shell commands are cut off at 30 seconds
On the command line, a shell command the agent runs is stopped after 30 seconds by default and the agent is told it timed out, so a long build, test run or install can be stopped partway. Cline's tracker has two open reports about this limit.
Already tracked upstream (#10549), checked 2026-10-28.
Where:
bash.ts:1138,definitions.ts:515. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) in two rounds on 2026-10-28. -
2. A file edit that timed out can still be written
File edits are given a time limit, but reaching it only tells the model the edit failed; the edit itself is not stopped. So the model can be told an edit timed out while the change still lands in the file.
Not reported upstream, checked 2026-10-28.
Where:
definitions.ts:745-749,editor.ts:230-267. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) in two rounds on 2026-10-28. -
3. A cut-off summary is used as if it were complete
When the history is shortened, the model's summary replaces the older messages. If the summary was cut off before the model finished it, code still puts it in place; only an empty summary is skipped.
Already tracked upstream (#14732), checked 2026-10-28.
Where:
agentic-compaction.ts:258-278. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) in two rounds on 2026-10-28.