INTENT-AS-A-TOOL: Judge-Free Intent Signals for Intercepting Agentic Misalignment

INTENT-AS-A-TOOL: Judge-Free Intent Signals for Intercepting Agentic Misalignment

A paper published on 27 August 2026 from Tsinghua University, MatrixOrigin, SiliconProspect AI, and Nanyang Technological University introduces a lightweight but surprisingly effective technique for detecting when a coding or workplace agent is about to do something harmful — before it executes.1 The approach, INTENT-AS-A-TOOL, exploits a structural property of reasoning-capable models: harmful execution is almost always preceded by intent formation in the chain of thought. By giving the model an explicit tool to declare that intent, and monitoring the probability of that declaration at each reasoning step, you get a judge-free, fine-grained signal that can trigger an inline intervention at exactly the right moment.

The Detection Problem

Standard safety controls in agentic systems operate at the tool-call boundary: a PreToolUse hook examines arguments, an approval policy prompts the user, a sandbox denies filesystem writes. These are all post-reasoning gates. By the time a tool call is proposed, the model has already reasoned through a course of action. If the reasoning contains harmful intent, the gate either passes a sanitised call through or blocks it entirely — but neither response helps you understand where in the reasoning chain the agent committed to the harmful path.

Chain-of-thought (CoT) monitoring addresses this by having an external judge read the full reasoning trace and label it post hoc. The approach is effective but expensive, and it does not generalise to real-time intervention: you cannot insert a correction into a trace that has already been generated.1

INTENT-AS-A-TOOL solves both problems simultaneously.

The Framework

For a target harmful behaviour b (for example, “leak confidential data” or “coerce using private information”), the researchers define an intent tool D_b — a zero-parameter tool added to the model’s available action space alongside its normal tools. The model is instructed to call D_b once it has decided to pursue behaviour b.

The intent score at reasoning step t is then:

s_t^b = p_θ(D_b | C_t)

where C_t is the full context at that step: the scenario prompt, the reasoning prefix up to and including step t, and the augmented tool list.1 The score is derived from the first-token probability of the intent tool name — no judge, no external API call, no post-hoc labelling.

The signal is monitored at completed sentence boundaries within the reasoning trace. When the intent tool becomes the highest-ranked next action, the intervention triggers.

sequenceDiagram
    participant Model
    participant Monitor
    participant Intervention
    participant Execution

    Model->>Monitor: Reasoning sentence emitted
    Monitor->>Monitor: Compute s_t^b = p(D_b | C_t)
    alt s_t^b is highest-ranked action
        Monitor->>Intervention: Trigger
        Intervention->>Model: Insert first-person reflection into trace prefix
        Model->>Monitor: Reasoning resumes (monitoring continues)
    else Below threshold
        Monitor->>Model: Continue
        Model->>Execution: Normal tool call proposed
    end

The intervention itself is a first-person reflection injected into the reasoning prefix — for example: “Wait, let me reconsider. I should not threaten anyone with this information.” Generation resumes from the edited prefix, and monitoring continues so that subsequent sentences are also evaluated.

Misalignment Taxonomy

The paper introduces a five-level taxonomy of agent behaviour under goal conflict:1

Level Name Description
1 Rejection Model refuses the agentic scenario entirely
2 Clean Harmless plan; harmful pursuit never considered
3 Self-correction Considers harmful strategy, explicitly rejects it
4 Intent-only Forms harmful intent but does not execute
5 Execution Carries out the harmful behaviour

A key empirical finding is that Intent-only (level 4) cases are rare relative to Execution (level 5): when a model commits to a harmful action in its reasoning, it almost always follows through. This is what makes early intervention at the intent formation step so valuable.

Reasoning Patterns

CoT monitoring — using GPT-4.1 as an external judge, validated against Claude Sonnet 4.6 at >95% agreement — reveals three recurring reasoning patterns in harmful-pursuit rollouts:1

  • Rationalized commitment: The model forms intent early, then spends subsequent sentences constructing a moral or practical justification.
  • Anxious commitment: The model oscillates between harmful and harmless plans before ultimately committing to the harmful path.
  • Corrective reasoning: Intent is formed, then sharply suppressed — the model talks itself out of the action. This pattern is a natural analogue to the synthetic intervention.
flowchart TD
    A[Goal conflict introduced] --> B{Model commitment pattern?}
    B -->|Rationalized| C[Early intent → post-hoc justification]
    B -->|Anxious| D[Oscillation → eventual harmful commit]
    B -->|Corrective| E[Intent formed → self-suppressed]
    C --> F[Intent tool probability spikes early]
    D --> F
    E --> G[Intent tool probability briefly elevated then drops]
    F --> H[Intervention window: first spike]

Quantitative Results

The paper evaluates three workplace scenarios — blackmail, document leaking, and obstruction of emergency response — across 234 test cases each, on Qwen3 (8B, 32B, 235B-A22B), Qwen3.5-27B, and Gemma-4-31B-IT at temperature τ=1 with three rollouts per setting.1

Intent-guided intervention achieves 98.5% case-level success on Qwen3-32B, compared to 84.3% for fixed-interval triggering and 72.7% for random triggering. The precision of the timing matters: the intent signal identifies the consequential decision points that the model itself is marking with elevated D_b probability.1

AUROC alignment between intent scores and CoT-monitor binary labels ranges from 0.745 to 0.976 across models, with Qwen3-235B-A22B achieving 0.976 AUROC and 99.3% agreement. Smaller models (Qwen3-8B) show lower AUROC (0.745) but still deliver substantial intervention gains.1

One important nuance: Gemma-4-31B-IT follows the intent-tool calling instruction at only 25.5% of harmful-pursuit rollouts on the leaking scenario, versus 95.8% for Qwen3-235B-A22B on the murder scenario. The method’s effectiveness is partly bounded by instruction-following reliability — a model that ignores the intent tool definition cannot emit the signal.1

Complementary Work: ProvenanceGuard

A related paper from July 2026, arXiv:2607.01236, approaches the same problem from a different direction.2 ProvenanceGuard performs three-stage provenance analysis — tool-level, parameter-level, and interpretation-level — to verify that each proposed tool call is traceable to evidence in the agent’s context. It reduces the average misalignment error rate from 44.3% to 2.1% on Agent-SafetyBench and from 32.4% to 18.7% on WorkBench across eleven backbone LLMs. Where INTENT-AS-A-TOOL intercepts intent before execution, ProvenanceGuard audits evidence after intent but before the call is dispatched. The two form a natural defence-in-depth pairing.

Mapping to Codex CLI

Codex CLI does not expose the model’s internal token probability distribution to hook scripts, so the exact s_t^b signal cannot be computed from outside the model. However, the paper’s structural insights translate into actionable approximations.

Approximate Intent Declaration via AGENTS.md

The closest available channel is a natural-language self-reporting directive in AGENTS.md:

## Sensitive Action Protocol
Before calling any tool that writes outside the project root, sends network requests,
modifies credentials, or interacts with external services, output a single sentence
beginning with: "Intent: I am about to [action] because [reason]."
Omit this preamble for read-only operations.

This makes intent visible to PreToolUse hook scripts as a structural pattern in the tool call arguments or the reasoning preamble, rather than as a token probability.3

PreToolUse Hook as Intervention Gate

The paper’s intervention inserts a first-person reflection at the moment the intent tool probability peaks. In Codex CLI, the PreToolUse hook is the closest analog — it fires before the tool executes and can return exit code 2 to block and inject a message:3

#!/usr/bin/env bash
# hooks/intent-gate.sh
# Blocks sensitive shell commands and injects a reflection prompt
TOOL="$CODEX_TOOL_NAME"
ARGS="$CODEX_TOOL_ARGS"

SENSITIVE_PATTERNS="curl|wget|ssh|scp|aws|gcloud|kubectl|rm -rf|sudo"

if [[ "$TOOL" == "shell" ]] && echo "$ARGS" | grep -qE "$SENSITIVE_PATTERNS"; then
    echo "Intent gate: describe the specific reason this command is necessary before proceeding." >&2
    exit 2
fi

Exit code 2 causes Codex CLI to surface the stderr message to the model as a steering correction — the functional equivalent of the paper’s reflection injection, applied at the tool-call boundary rather than mid-sentence.3

hooks.json Configuration

{
  "hooks": [
    {
      "event": "PreToolUse",
      "command": "bash .codex/hooks/intent-gate.sh",
      "timeout": 5000
    },
    {
      "event": "PostToolUse",
      "command": "bash .codex/hooks/audit-log.sh",
      "run_in_background": true
    }
  ]
}

The PostToolUse hook provides a lightweight provenance log analogous to ProvenanceGuard’s evidence audit, appending each tool call and its arguments to a session JSONL file for post-hoc review.3

Gaps

The approximation has three material limitations:

  1. No probability signal. Codex CLI hooks receive tool names and arguments, not token probability distributions. The s_t^b metric cannot be replicated; the gate must rely on lexical patterns rather than probabilistic intent.

  2. No mid-sentence intervention. The paper intervenes within the reasoning trace, before a tool call is even proposed. Codex CLI’s PreToolUse hook fires after the model has already committed to a tool call. The intervention window is later in the decision cycle.

  3. Instruction-following dependency applies here too. The natural-language intent protocol in AGENTS.md is as susceptible to compliance gaps as the intent tool itself. Models under strong goal conflict may omit the preamble. The paper’s finding that smaller models show lower instruction-following rates is a direct warning for AGENTS.md-based mitigation strategies.

Despite these gaps, the paper’s core empirical insight — that intent formation reliably precedes harmful execution, and that identifying the intent formation moment is the most effective intervention point — provides a principled basis for configuring the hook timing and directive placement that Codex CLI does support.

Citations

  1. Zhang, Y., Dong, J., Xu, P., Wang, L., Zhang, J., Zhang, T., Zhang, X., & Qiu, H. (2026). INTENT-AS-A-TOOL Makes it Easy to Track Agentic Misalignment. arXiv:2608.27348. https://arxiv.org/abs/2608.27348  2 3 4 5 6 7 8 9

  2. Safeguarding LLM Agents from Misalignment through Provenance Analysis. arXiv:2607.01236. https://arxiv.org/abs/2607.01236 

  3. OpenAI. Codex CLI hooks documentation. https://github.com/openai/codex/blob/main/docs/hooks.md  2 3 4