Host tools — monitor, stop_monitor and list_monitors: the managed stream, batching, delivery between turns, monitor rows and the boot sweep. A repository rule for apps/daemon/src/v1/agents/**/monitor*, apps/daemon/src/v1/agents/**/managed-stream*, apps/daemon/src/v1/teams/services/monitor-graph-delivery*, apps/daemon/src/v1/mcp/tools/monitor/**, apps/daemon/src/v1/mcp/tools/stop-monitor/**, apps/daemon/src/v1/mcp/tools/list-monitors/**; read it before editing a file there.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rule Daemon Host Tools Monitors?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/geniro-io-rule-daemon-host-tools-monitors)
---
name: rule-daemon-host-tools-monitors
description: "Host tools — monitor, stop_monitor and list_monitors: the managed stream, batching, delivery between turns, monitor rows and the boot sweep. A repository rule for apps/daemon/src/v1/agents/**/monitor*, apps/daemon/src/v1/agents/**/managed-stream*, apps/daemon/src/v1/teams/services/monitor-graph-delivery*, apps/daemon/src/v1/mcp/tools/monitor/**, apps/daemon/src/v1/mcp/tools/stop-monitor/**, apps/daemon/src/v1/mcp/tools/list-monitors/**; read it before editing a file there."
---
<!-- GENERATED by scripts/sync-agent-rules.mjs from .claude/rules/daemon-host-tools-monitors.md. DO NOT EDIT: edit the source, then run `pnpm sync:agent-rules`. -->
# Host tools — monitors
- `monitor` / `stop_monitor` / `list_monitors` (`MonitorBroker` over the leaf `MonitorRegistry`): an agent's shell command (`/bin/sh -c`, deliberately a shell — the CLI's permission prompt shows the line) whose output wakes it. Spawned by `startManagedStream` (`utils/managed-stream.ts`: detached group, journaled, `buildChildEnv` then `runTagEnv`, ProcessRegistry key `monitor:<runId>:<id>` — never the bare run id, which would read as a busy run — stdin closed, stdout and stderr together, an `awakeTimeout` deadline, group TERM then KILL; the group is ended the moment the shell exits — TERM at once, KILL after the grace only while a member seen at the exit still lives in it with its start time (`isGroupAnchored`), since an emptied group's id can be reissued — and never signalled otherwise after it). `MonitorBatcher` (`utils/monitor-batcher.ts`, chord's limits): ANSI stripped, a carriage-return redraw keeps what a terminal shows (also across chunks), registered secrets masked before lines are cut at 1000 characters, a 200 ms window, at most 100 lines or 16 KiB per message (the rest counted), stopped as `flooded` past 1000 lines or 256 KiB in 10 s; timeout 1 s–24 h, default 10 min (a timeout wakes the agent, and a wake after the prompt cache lapsed re-reads the whole conversation uncached, so a quiet watcher is given a long timeout rather than re-armed hourly); 8 per run. Out-of-range arguments are refused, never clamped — the one exception is a `description` over 60 characters, cut to its first 60 (it only labels the monitor, and a refusal would cost the agent a whole request). So is a `tail -f` piped into a reader that stops early (`followsPastItsReader` in the reader): `tail` learns its reader left only from a failed write, so once the file stops growing the pipeline, and whatever follows it on the line, waits for the timeout (measured on macOS's `tail`); the refusal says to loop with `until grep -q`. A command the same conversation already runs is refused too (`MonitorRegistry.start`, exact text, naming the monitor that runs it, a stopping one not counted; another conversation may run it), and a start's receipt names the conversation's others (`alsoRunning`), since a newer monitor does not end an older one. `stop_monitor` on the caller's own monitor that already ended, or is stopping, answers a normal result saying how it ended (`Monitor mN already ended: <how>`, `MonitorRegistry.stop` → `{status: 'ended'}`); an unknown id, or another conversation's, is refused. Ids `mN` count per run; `stop_monitor` and `list_monitors` see only the calling conversation's. Offered only where a geniro tool call is put to the user first or the turn is `auto` (`offersMonitorTools` over `AdapterConfig.hostToolCallUngatedReason`, null on every CLI: measured per CLI beside its config; a team member only when every pool member passes). Never auto-approved: no `isHost<Name>Call`. The permission card keeps the CLI's remember choices, which remember the TOOL, so it says that remembering approves every later monitor command (user decision; `namesGeniroMonitor` in the renderer).
- Delivery never enters a running turn, on any CLI. Output arriving while the conversation works is held, one message per monitor with later batches merged in, and goes out when the turn ends: a chat through `MonitorChatDelivery` → `ChatService.sendMessage(…, {ownTurn, hostRow})`, whose opening row is the monitor `system` row instead of a user message (released from `onTurnSettled` and only once the daemon listens (`startDelivering`, from `onListening`), held while `hostTurnHold` says a turn runs or a question/plan/patch card waits, held again on `RUN_BUSY`; an archived chat stops the run's monitors; a send that fails before its opening row is written (a folder that is gone with nowhere to move, a failed write) is tried again at the chat's next settled turn — never the failed send's own settle — or after `MONITOR_SEND_RETRY_MS`, never on new output, and a thread Stop while it is out cancels the retry; the `MONITOR_SEND_ATTEMPTS`th failure in a row, or one after the row was written (a model refused — a retry would show the output twice), stops the run's monitors, owes the chat's next turn a note naming them that carries the output it never got (none once the opening row showed it), and, once the send is over, writes a run-level warning row naming why; a host turn that never started leaves the run's status as it was, and one that failed after announcing `running` puts back the status it had, announced `hostTurn`; dropped by the thread's Stop (`onStopped`); its settle announces `hostTurn`, so no banner is posted for it, only while every monitor its row names is still running (`wakesOnMonitorProgress`): a turn opened by a monitor's end, or by any host wake, settles as news); a team conversation through `MonitorGraphDelivery` → `TeamExecutorService.wakeConversation` (Team call runtime). The text sits in a `monitor-output-<random>` fence after a line saying it is the command's output, under chord's `<message from="<description> · monitor[ · <end>]" monitor="mN">` header. Each wake's prompt then names the conversation's monitors that have not ended (`promptNamingRunning` over `MonitorRegistry.stillRunning`), the one that just printed included: output that looks final otherwise reads as the monitor being over, and inside a call one still running holds the call open. The undelivered note carries the prompt without that line, since it says they were stopped.
- Rows (`monitors[]` on a `system` payload, `woke` true for a delivered message — twin of the renderer's `chats/monitor-payload.ts`; each entry carries the monitor's `command`, `startedAt` and `timeoutMs` from its snapshot through `monitorFactsOf`, an interrupted end the sweep writes what its start row carries, else the command read off its call and its start row's time, and an older row none): the start and an unannounced end are written by `MonitorRowWriter`; a delivered batch or end is the opening row of the turn it starts, and a delivery that drops a message carrying an end writes that end (`writeEnds`) unless its opening row was already written (`onHostRowWritten`), so no start is left without one and no end is written twice. A stop by the agent, the thread's Stop or teardown ends `stopped` and wakes nobody; the panel's Stop (`processes/stop` `monitorIds`) ends `stopped` and wakes the agent, telling it the user stopped it. `MonitorOutcomeSweep` (boot, after `ActionOutcomeSweep`, handed the stop cause `closeInterruptedRuns` read) ends every monitor whose newest row is not an end as `interrupted`, and its owner is told the monitor's id, description, command and about how long it had left (`StoppedMonitor`, `stoppedMonitorLine` in `utils/monitor-text.ts`; the command is read off the `monitor` tool call that started it — the newest of the same member before the start row with the same description — since a start row written before rows carried it holds none; not found reads "command not recorded"). A team run that is not archived or cancelled, after any stop, and a chat whose own turn was cut off, after a `self-update` or `restart` (`continuesUnattended`), put the monitor into the run's continuation record (`Run.restartContinuation`, a monitors-only record for a team run the reconcile left none) with its end row written `woke: true`, and the drain after listen wakes its owner once, inside the continuation message when its turn is continued too (Teams and passes); after `crash`/`unknown` a team run's record is held for the user's choice, and a declined one owes each owner a note under its own session key (`oweKeyNote`: the member's, or the callee conversation's). Otherwise a chat's wake is handed to `MonitorChatDelivery` (sent after listen, under its holds) unless the stop was `crash`/`unknown`, when its next turn is owed a note instead; an archived or cancelled run gets neither. The run's ids seed the registry's counter (`noteUsedIds`), which is per launch, so a new monitor never reuses one; a run the sweep did not read is seeded by `MonitorBroker` before its first monitor of the launch. A team stretch reopened by output of monitors still running, with no other turn, wake or user message in it, announces `hostTurn` too; a monitor's end or a host wake inside it makes its settle news. A lead whose own turn only such output woke announces going idle (`rootsWorking: 0`) with `hostTurn` as well, since the renderer reads the leads going idle as the run's ending, and a live pass that such a turn rolls up to `completed` announces it with `hostTurn`; the flag rides that one turn (`continueNode`'s `monitorProgress`), so the idle after a user's turn the same pass ran stays news. A monitor is never started again.