If you wanted Claude Code to keep an eye on logs or CI while it worked, you used to open a second terminal for tail -f, or have the model run it in the background with Bash and report once it finished. The changelog for 2.1.310 (2026-10-23) states that the Monitor tool and plugin monitors now work on Bedrock, Vertex and Foundry, and also when telemetry or nonessential traffic is disabled; long foreground sleeps are now blocked in those environments too.
This matters a lot for anyone who uses a third-party API or turns off telemetry in settings, because many third-party write-ups still say "Monitor is off by default and unavailable on Bedrock or with telemetry off." We compared the official changelog, concept docs that are still circulating, and the SDK type definitions bundled with the Claude Code 2.1.310 installed on our machine, and ran a pipe buffering comparison on Linux.
The bottom line first:
- Official changelog: since 2.1.310, Monitor and plugin monitors cover Bedrock, Vertex and Foundry, plus sessions with telemetry or nonessential traffic disabled.
- CLI installed from npm:
claude --versionshows 2.1.310 (Claude Code);sdk-tools.d.tscontains completeMonitorInput/MonitorOutputdefinitions. - Timeout: the SDK sets a default of
300000ms, and anything above 1800000ms (30 minutes) is capped. The 3600000ms (1 hour) quoted in many reposted docs does not match the current type definitions. - Local pipe test: with the same 8 lines of progress output, when
grepruns without--line-buffered, the first event takes 1.213 s to arrive; with it, the first one arrives in 0.009 s, then one roughly every 0.15 s. - Monitor is for "notify me on every line." If you only want to wait for a process to finish, use Bash's
run_in_background(that is exactly what the CLI's built-in description says).
What Monitor does
In one sentence: it starts a background watch script, and every line of stdout becomes a notification in the conversation, while you keep editing code in the main session. It is not "tell me when the command finishes"; Bash in the background handles that.
Typical uses:
- watching
deploy.logforError/deployed - polling CI or PR status every few dozen seconds
- checking whether new files appear in a build directory, or whether a training log has reached a certain step
What 2.1.310 changed (compared with the old docs)
Concept pages that are still circulating (for example, community write-ups of Tool-Monitor) list roughly these limits:
Off by default (server-side feature flag). Unavailable on Amazon Bedrock, Google Cloud, and Microsoft Foundry. Off when DISABLE_TELEMETRY or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC is set.
But the Claude Code changelog lists this under Added for 2.1.310:
Added the Monitor tool and plugin monitors on Bedrock, Vertex, and Foundry, and when telemetry or nonessential traffic is disabled; long foreground sleeps are now blocked there too
In other words, if you assumed Monitor "just isn't there" because you had set DISABLE_TELEMETRY=1 or were using a cloud provider endpoint, upgrade to 2.1.310 and try again. On the enterprise side, the same version also added Cloud sessions / Remote Control permissions to custom roles; that is a separate topic not covered here.
Checking locally: version and SDK fields
On Linux we ran:
npm install -g @anthropic-ai/claude-code@2.1.310
claude --version
# 输出:2.1.310 (Claude Code)
Opening sdk-tools.d.ts in the package, here is an excerpt of Monitor's input and output (field names as in the installed package):
export interface MonitorInput {
description: string; // 通知上显示的短标签
timeout_ms: number; // 默认 300000;>1800000 会被封顶
command?: string; // 每行 stdout = 一条事件
ws?: { url: string; protocols?: string[] }; // 与 command 互斥
}
export interface MonitorOutput {
taskId: string;
timeoutMs: number; // persistent 时为 0
persistent?: boolean; // 用 TaskStop 或会话结束来停
}
The tool description the CLI gives the model also includes a very practical boundary (confirmed against strings in the 2.1.310 binary):
Use the Monitor tool to stream events from a background process (each stdout line is a notification). For one-shot "wait until done," use Bash with run_in_background instead.
How to use it: just tell Claude in plain language
First point Claude Code at your Key. For third-party setups, see Claude Code third-party API setup. An example global ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.aicodewith.ai",
"ANTHROPIC_AUTH_TOKEN": "你的 API Key"
},
"model": "claude-sonnet-5-5"
}
In your project, just say:
盯着 ./logs/dev.log,出现 Error、FAILED、Traceback 或 Listening on 就告诉我。过滤器记得加 grep --line-buffered。
The model will usually put together a command along these lines (illustrative):
tail -F ./logs/dev.log | grep -E --line-buffered \
"Listening on|Traceback|Error|FAILED|Killed|OOM"
Key points:
- Put both the success and failure keywords in the filter: if you only watch for
deployedand the process crashes, you just see silence, which you cannot tell apart from "still running." - For long session-level watching, use
persistentand stop it withTaskStop; the default timer is about 5 minutes. - If events come too thick and fast it gets stopped automatically; tighten the grep and start it again.
- A WebSocket source (
ws.url) andcommandare mutually exclusive; the URL must be ASCIIws:///wss://, and never put credentials in the URL.
Exclusive: why --line-buffered is a must
On our machine we used the same producer script (8 lines of progress plus a final line deployed ok, with flush=True on each line and about 0.15 s between lines) to compare two grep commands:
| Pipe | First event arrives | Pace after that | Total time |
|---|---|---|---|
| grep -E '…' | 1.213 s | 9 events bunched at the same moment | About 1.21 s |
| grep -E --line-buffered '…' | 0.009 s | About one every 0.15 s | About 1.21 s |
The total time is about the same, but what matters to Monitor is when each line becomes a notification. Without --line-buffered, the other end of the pipe may sit waiting on block buffering: the log has clearly reported an error, yet nothing happens in the conversation, which feels exactly like "the monitor is broken."
Choosing between MCP Tasks, Monitor and plain background Bash
| Need | Use | Notes |
|---|---|---|
| Wait for a command to finish | Bash + run_in_background | One notification when it ends |
| Push every line as it happens | Monitor | Since 2.1.310 also works on cloud providers and with telemetry off |
| An MCP server running its own long task | MCP Tasks | The task lives on the server side and can pause for an Elicitation |
For workflows like security audits that start many sub-Agents, see Cloudflare security-audit skill, tested; that is a different kind of "parallel isolation," not Monitor.
FAQ
Still no Monitor after upgrading?
First check whether claude --version is ≥ 2.1.310. The stable channel and some Homebrew casks may lag behind npm's @anthropic-ai/claude-code. A third-party gateway only needs to support Messages tool calls; Monitor itself is a client-side tool and does not depend on whether the model "knows how to tail."
What is the maximum timeout?
Go by sdk-tools.d.ts in the 2.1.310 package: 5 minutes by default, capped at 30 minutes. If you need longer, use persistent + TaskStop.
Do events count as authorization?
No. Log lines and WebSocket frames are just data; they cannot be used to approve a file write or loosen the sandbox. This matches the security boundary for Channels and plugin monitors.



