Cline CLI
Protection level: hook only. OpenMoat writes no OS sandbox for the Cline CLI; openmoat run -- cline runs the whole agent in one (openmoat run).
Set it up
Section titled “Set it up”-
Write OpenMoat’s hook script
Terminal window openmoat init --hosts clineIt writes OpenMoat’s script to
~/.cline/hooks/PreToolUseand, from 0.17.0, the same script to~/.cline/hooks/PostToolUse($CLINE_DIR/hooks/when that is set: runopenmoat initwith the sameCLINE_DIRCline runs with), and pins the MCP servers in Cline’scline_mcp_settings.json. A file of yours with either name is backed up first,openmoat initsays that it moved it aside, andopenmoat uninstallgives it back.Cline runs
PostToolUseafter each call with what the call returned. OpenMoat keeps fingerprints of untrusted output, so a later call of the session that uses a host, path or command it named needs review (Injected input). That file never blocks: it prints nothing, since Cline would stop the whole run on a cancel after the call. After upgrading,openmoat statusshows Cline’s hook out of date untilopenmoat initadds it. -
Start a new Cline session
Cline runs every
PreToolUsefile in its hooks directories before each tool call, from its next session. -
Check it
Terminal window openmoat statusFrom 0.15.0 the Cline CLI’s line is followed by a line of its limits (
cline --yoloruns no hooks; another hook or plugin can change a call after OpenMoat checked it; Cline runs the call when OpenMoat’s script cannot start or is killed after 120 s), and by every otherPreToolUsefile in Cline’s hook folders and every Cline plugin found.openmoat status --format jsonlists them underother_hooks, and gives each agent’slimit.
What OpenMoat sees
Section titled “What OpenMoat sees”| Cline tool | Checked as |
|---|---|
run_commands |
each command as a shell command, in the workspace; a {command, args} entry as its quoted words. Several commands are decided together; one that cannot be read alone (an open quote, a trailing \) makes the call need review |
read_files, search_codebase |
file reads (search_codebase reads the workspace) |
editor |
a file write |
apply_patch |
every file the patch names |
fetch_web_content |
a fetch for one URL; for several, every URL its arguments name |
MCP tools (<server>__<tool>) |
an MCP tool, recorded as mcp__<server>__<tool>; a browser server’s call that only opens a page is that page’s open |
| any other tool (skills, subagent and team tools, a plugin’s) | every path, URL and command its arguments name |
The hook sees the arguments as the model gave them, before Cline puts them in one shape, so every shape Cline accepts is read and any other is denied. Cline sends two copies of a call’s arguments; the payload limit counts them once, so a large file is refused at the same size as on other agents, with a message that says to write it in parts. ask_question and submit_and_exit are not checked, and the model provider’s own web_search never reaches the hook.
When a call needs review
Section titled “When a call needs review”Cline’s hooks cannot prompt, so a review is a deny, and a deny ends Cline’s run with OpenMoat’s reason. In your own terminal:
openmoat allow --last # that exact call, for the rest of the Cline sessionopenmoat allow --last --always # or a permanent ruleThen continue the session. Cline approves calls on its own by default (--auto-approve), so a call OpenMoat defers usually runs.
What the default policy protects
Section titled “What the default policy protects”kernel-selfprotects Cline’s hook and plugin directories, and~/Documents/Cline/Hooks, so the agent cannot change or remove OpenMoat’s script.agent-credentialscovers Cline’s stored provider keys (~/.cline/data/settings/providers.json) and connector credentials.- Writes to a workspace’s hooks,
.clinerules/hooks/and.cline/hooks/(every file of which Cline runs on each tool call), and renames onto.clinerules,.clineor theirhooksfolders need review (runs-later, from 0.15.0), since those hooks run with the agent’s rights. Rules files in.clinerules/stay ordinary writes. - Session taint covers
.clineand.clinerules: after the session read a web page or an MCP result, writing them needs review. - Any change to OpenMoat’s script denies every call until you run
openmoat doctor --accept.
If the hook fails
Section titled “If the hook fails”Cline runs a call whose hook fails, and reads only what the hook prints. So OpenMoat’s script prints a cancel itself when openmoat is missing, crashes or exits without its answer.
| Failure | Cline |
|---|---|
openmoat missing, crashing or giving no answer |
blocked by OpenMoat’s script |
the script cannot start (no sh, as on native Windows) |
runs the call |
| the script prints something that is not JSON | runs the call |
| the script is killed after Cline’s 120 seconds | runs the call |
--yolo |
runs no hooks at all |
Limits
Section titled “Limits”- No OS sandbox from OpenMoat: an allowed command runs with your permissions, and a script the session wrote needs review before it runs (Code the agent wrote).
--config,--hooks-diror aCLINE_DIRthat OpenMoat did not install into skip OpenMoat’s script.CLINE_DATA_DIRandCLINE_MCP_SETTINGS_PATHmove Cline’s data and MCP file; OpenMoat reads them only at their default place.- Another
PreToolUsefile or a plugin can rewrite a call’s input after OpenMoat checked it.openmoat statusandopenmoat doctorname each one they find.
Every agent side by side: Supported agents.