trudi-watch-alerts

trudi-watch-alerts is a command for Claude Code from nebulae/trudi. It costs 29 tokens per session (1,085 once invoked), scanned A, original, MIT.

A command that keeps watching a case's alert folder and wakes the agent when a new alert appears. TRUDI is the surrounding live-monitoring system, and the command uses a persistent watcher instead of a scheduler that checks only periodically.

In plain words
What is it for?
Starting continuous alert monitoring for a named case and passing a chosen polling interval. When an alert arrives, it triggers the same investigation and automatic protection process as the related alert-check command.
Why use it?
It reduces the delay between a new alert and the agent's response, avoiding the longer minimum interval of the regular loop command.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Good fit Starting continuous alert monitoring for a named case and passing a chosen polling interval. When an alert arrives, it triggers the same investigation and automatic protection process as the related alert-check command.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/nebulae/trudi/trudi-watch-alerts
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/nebulae/trudi

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for trudi-watch-alerts

README.md
[![agentmods](https://agentmods.dev/badge/commands/nebulae/trudi/trudi-watch-alerts/github.svg)](https://agentmods.dev/commands/nebulae/trudi/trudi-watch-alerts)
Your own site
<a href="https://agentmods.dev/commands/nebulae/trudi/trudi-watch-alerts"><img src="https://agentmods.dev/badge/commands/nebulae/trudi/trudi-watch-alerts/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for trudi-watch-alerts

Your own site · 80×15
<a href="https://agentmods.dev/commands/nebulae/trudi/trudi-watch-alerts"><img src="https://agentmods.dev/badge/commands/nebulae/trudi/trudi-watch-alerts.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,085 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00029 $0.01085
Opus 5 $0.00015 $0.00543
Sonnet 5 $0.00006 $0.00217
Haiku 4.5 $0.00003 $0.00109

Measured 12d ago against content hash 9bf55d7a699e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

trudi-watch-alerts scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

claude/commands/trudi-watch-alerts.md · 83 lines

How it starts

The opening of the file, as written. The whole thing — 83 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/trudi-watch-alerts

A second-granularity, event-driven alternative to /loop 15s /trudi-check-alerts. /loop re-fires on the scheduler, which clamps to a 60s floor, so a 15s loop really polls ~once a minute. This command instead runs a persistent waiter (bin/trudi-alert-waiter.py --follow) under the harness Monitor tool: the waiter watches the case's monitoring/alerts/ directory every N seconds (default 2) and prints one line each time new alerts land; Monitor turns each line into a notification that wakes me immediately. I then run the same investigation + auto-protect flow as /trudi-check-alerts. Detection is already real-time (the Velociraptor sidecar streams alerts as they fire); this closes the gap on the agent side, with time-to-response ≈ the poll interval instead of a minute.

The first argument names the case (else read ~/cases/.common/active_case). The second, if given, is the waiter poll interval in seconds (default 2).

Why Monitor, not a one-shot background task

A one-shot waiter that exits on the first alert must be re-armed by the agent after every investigation — and that re-arm step is easily dropped when the agent dispatches into the long /trudi-check-alerts flow, so the loop runs once and dies (alerts that arrive after the first batch are then missed). The Monitor tool runs the --follow waiter persistently: it keeps emitting an event per new-alert batch with no re-arm, and alerts that land while I'm investigating still queue as later events. This is the robust mechanism.

Steps

1. Cold start (operator invoked this command)

  1. Resolve CASE (argument or cat ~/cases/.common/active_case); N = second argument or 2.
  2. monitor.list_watchers(CASE) — confirm a sidecar is alive. If none, STOP and tell the operator to run /trudi-start-watcher first (without the sidecar the alerts directory never fills).
  3. Start the persistent watcher with the Monitor tool:
    • command: python3 ~/trudi/bin/trudi-alert-waiter.py --follow --case-id <CASE> --interval <N>
    • description: new TRUDI alerts for <CASE>
    • persistent: true The --follow waiter reads monitoring/_last_check_seq.txt for its start cursor (so already-drained alerts aren't re-reported) and emits one JSON line per new batch. Tell the operator: "👁️ Watching — I'll act within ~s of each new alert. Say 'stop watching' to end."

Read the full file on GitHub · 83 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 83 lines · 29 tokens per session scan A 9bf55d7a699e

Subscribe to this mod's changes

trudi-watch-alerts is a command published in the GitHub repository nebulae/trudi (59 stars, last pushed today), licensed MIT. It adds 29 tokens to every session and 1,085 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.