Detectors on the endpoint flag candidates. The hosted AI assessment reviews flagged calls afterwards, with more context.
Detectors on the endpoint
Kestrel
Kestrel is a shell command classifier built into the Kontext CLI. It scores every shell command on the endpoint, including calls a policy denied. Kestrel needs no setup or download. Kestrel reads the command without the task context. Because agents runrm -rf often, Kestrel can miss destructive forms such as rm -rf / or dd onto a disk.
Merlin
Merlin scores short tool calls that are not file operations, using the user’s request and the recent tool history. It looks for calls that do not fit the user’s request. Instructions hidden in a page or file can cause this behavior. Merlin skips file tools such asRead, Write, Edit, and apply_patch, and it skips calls whose request or arguments are too long for the model. A skipped call has no Merlin result. When Merlin flags a call, it keeps a short redacted copy of the request and tool history so the AI assessment can see the same context.
Additional shell check
The additional shell check uses Qwen3-0.6B, a small local language model served byllama-server. It flags destructive shell commands that Kestrel can miss. It also flags more ordinary commands.
To run the additional shell check:
- On a self-serve endpoint, install the runtime with
brew install llama.cpp. Then runkontext setup --with-local-llmand provide your API key when prompted. Setup downloads about 680 MB of model weights. MDM-managed endpoints do not includellama-serverand run without this check. - Open the endpoint from Home and turn on Guardrail LLM in its drawer. Turn it off there to stop the check without making changes on the endpoint.
When detectors flag a call
Kontext flags a call for review when any of these is true:- Kestrel rates the command risky.
- Merlin rates the call unsafe.
- The additional shell check rates the command risky.
- The call’s risk score, shown in Detection details, is at or near its threshold.
The AI assessment
Kontext queues each flagged call for an AI assessment in your workspace. The assessment uses a hosted OpenAI model and receives:- the tool name and the credential-redacted command and arguments
- the user’s request and recent tool results, when Merlin kept them
- the policy decision, its reason, and the mode it ran in
- the reported outcome and any error
- up to 20 earlier tool calls from the same session
When important evidence is missing, the assessment reports risk present with weak evidence and says what is missing. If Merlin’s evidence arrives later, Kontext assesses the call again. Risk shows the newer result.